/* ============================================================
   Tracking page — design based on Figma "delivery-UP--Copy-"
   Colors: bg #f3f4f6 | dark #151517 | orange #f98d37
           white #fff | card-bg #f5f6f8 | alert-bg #fdeaea
           blue #1d8ae8 | red #930000 | active-red #e32c2a
   Font: Sora 400/600/700, JetBrains Mono 400
   ============================================================ */

/* ---- Reset / base ---- */
*, *::before, *::after { box-sizing: border-box; }

body.tracking-index-index {
    margin: 0;
    padding: 0;
    background: #f3f4f6;
    font-family: 'Sora', sans-serif;
    font-weight: 400;
    color: #151517;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.hidden { display: none !important; }

/* ============================================================
   TOP ANNOUNCEMENT BAR
   ============================================================ */
.tracking-alert-header {
    background: #e32c2a;
    color: #fff;
    font-size: 13px;
    font-weight: 600;
    line-height: 18px;
    padding: 7px 40px 9px;
    position: relative;
    z-index: 10;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    min-height: 32px;
    text-align: center;
}
.tracking-alert-header::before,
.tracking-alert-header::after {
    content: '';
    flex-shrink: 0;
    width: 24px;
    height: 24px;
    background: url('/images/figma/icon-alert-truck.svg') center/contain no-repeat;
}
.tracking-alert-header::after { transform: scaleX(-1); }
@media (max-width: 767px) {
    .tracking-alert-header {
        font-size: 11px;
        line-height: 16px;
        padding: 7px 16px;
        gap: 8px;
    }
    .tracking-alert-header::before,
    .tracking-alert-header::after {
        width: 18px;
        height: 18px;
    }
}

/* ============================================================
   SCREEN 1 — SEARCH (initial state; legacy styles kept for
   compatibility with older tracking-search-* markup)
   ============================================================ */
.tracking-search-screen {
    position: relative;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

.tracking-search-content {
    position: relative;
    z-index: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 24px;
}

.tracking-search-logo { width: 159px; height: auto; }

.tracking-search-bg {
    position: absolute;
    inset: 0;
    background: #f3f4f6;
    background-image: url('/images/figma/tracking-search-bg.png');
    background-size: 104.23% auto;
    background-position: center bottom;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 0;
}

.tracking-error-message {
    color: #e44;
    font-size: 13px;
    margin-top: 8px;
    text-align: center;
    font-family: 'Sora', sans-serif;
}

/* ============================================================
   SCREEN 2 — ORDER TRACKING RESULT
   ============================================================ */
.order-tracking {
    flex: 1;
    display: flex;
    flex-direction: column;
    width: 100%;
}

.tracking-wrap {
    max-width: 1920px;
    margin: 0 auto;
    padding: 30px 245px 60px;
    display: flex;
    flex-direction: column;
    gap: 16px;
    width: 100%;
    box-sizing: border-box;
}

/* ---- Head: title + Track another shipment ---- */
.tracking-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    padding: 0 4px 8px;
}
.tracking-head__title {
    margin: 0;
    font-family: 'Sora', sans-serif;
    font-size: 28px;
    font-weight: 600;
    line-height: normal;
    color: #151517;
}
.tracking-head__another {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    background: none;
    border: 0;
    padding: 0;
    cursor: pointer;
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    font-weight: 500;
    line-height: 1;
    color: #151517;
    transition: opacity 0.15s;
}
.tracking-head__another:hover { opacity: 0.7; }
.tracking-head__another svg,
.tracking-head__another img { width: 24px; height: 24px; flex-shrink: 0; display: block; }

/* ---- Order details card (wide) ---- */
.tracking-details {
    background: #fff;
    border-radius: 30px;
    padding: 24px 30px 30px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}
.tracking-details__title {
    margin: 0;
    font-family: 'Sora', sans-serif;
    font-size: 24px;
    font-weight: 600;
    line-height: normal;
    color: #282f36;
}
.tracking-details__body {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 40px;
}
.tracking-details__list {
    margin: 0;
    display: flex;
    align-items: flex-start;
    flex-wrap: wrap;
    column-gap: 32px;
    row-gap: 10px;
    min-width: 0;
}
.tracking-details__row {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
    padding: 4px 0;
}
.tracking-details__row--address {
    flex: 1 1 220px;
    max-width: 320px;
}
.tracking-details__label {
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    font-weight: 400;
    color: #282f36;
    opacity: 0.4;
    line-height: normal;
    margin: 0;
}
.tracking-details__value {
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    font-weight: 400;
    color: #282f36;
    line-height: normal;
    word-break: break-word;
    margin: 0;
}
.tracking-details__value--blue {
    color: #1d8ae8;
    font-family: 'JetBrains Mono', monospace;
    font-weight: 400;
    font-size: 16px;
}
.tracking-details__status {
    display: flex;
    align-items: center;
    gap: 12px;
    flex-shrink: 0;
}
.tracking-details__status-icon {
    width: 36px;
    height: 36px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 10px;
    background: #24A253;
}
.tracking-details__status-icon img {
    width: 22px;
    height: 22px;
    filter: brightness(0) invert(1);
}
/* Stage-specific colors — all green per design */
.tracking-details__status-icon--order-placed,
.tracking-details__status-icon--production,
.tracking-details__status-icon--warehouse,
.tracking-details__status-icon--delivery,
.tracking-details__status-icon--complete { background: #24A253; }
.tracking-details__status-txt {
    display: flex;
    flex-direction: column;
    gap: 2px;
    justify-content: center;
}
.tracking-details__status-label {
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 400;
    color: #282f36;
    opacity: 0.4;
    line-height: normal;
}
.tracking-details__status-value {
    font-family: 'Sora', sans-serif;
    font-size: 16px;
    font-weight: 600;
    color: #282f36;
    line-height: normal;
}
.tracking-details__status-value.status-orange,
.tracking-details__status-value.status-green,
.tracking-details__status-value.status-gray { color: #151517; }

/* ---- Shipment progress card ---- */
.tracking-progress {
    background: #fff;
    border-radius: 20px;
    padding: 20px 30px 24px;
    display: flex;
    flex-direction: column;
    gap: 16px;
}
.tracking-progress__title {
    margin: 0;
    font-family: 'Sora', sans-serif;
    font-size: 21px;
    font-weight: 600;
    line-height: normal;
    color: #151517;
}
.tracking-progress__body {
    display: flex;
    align-items: center;
    gap: 30px;
}

/* ---- Horizontal status bar (desktop) ---- */
.order-status-bar {
    flex: 1;
    min-width: 0;
}
.order-status-bar__track {
    display: flex;
    align-items: flex-start;
    gap: 0;
    position: relative;
}
.order-status-bar__lines {
    position: absolute;
    top: 74px;
    left: 10%;
    right: 10%;
    height: 0;
    display: flex;
    z-index: 0;
}
.order-status-bar__line {
    flex: 1;
    height: 3px;
    margin-top: -1px;
    background-image: repeating-linear-gradient(
        to right,
        #EFF1F4 0,
        #EFF1F4 2px,
        transparent 2px,
        transparent 4px
    );
}
.order-status-bar__line.complete {
    background-image: none;
    background-color: #3AB037;
}
.order-status-bar__line.active {
    background-image: linear-gradient(to right, #3AB037, #E32C2A);
    background-color: transparent;
}

/* ---- Step item (shared for both horizontal + vertical) ---- */
.status {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    flex: 1;
    position: relative;
    z-index: 1;
    cursor: default;
    text-align: center;
}
.status__icons {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
}
.status__icon-wrap {
    width: 50px;
    height: 50px;
    border-radius: 10px;
    background: #f5f6f8;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
    transition: background 0.3s;
    flex-shrink: 0;
}
.status__img {
    width: 28px;
    height: 28px;
    object-fit: contain;
    filter: opacity(0.35);
}
.status.complete .status__img { filter: none; }
.status__dot-wrap {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    overflow: hidden;
    flex-shrink: 0;
    background: #fff;
    border-radius: 50%;
    z-index: 2;
    position: relative;
}
.status__dot {
    width: 16px;
    height: 16px;
    background-image: url('/images/figma/icon-dot-pending.svg');
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
}
.status.complete .status__dot { background-image: url('/images/figma/icon-done-check.svg'); }
.status.active .status__dot { background-image: url('/images/figma/icon-dot-active.svg'); }

.status__label {
    font-size: 16px;
    font-weight: 400;
    color: #151517;
    line-height: normal;
    opacity: 0.4;
}
.status__sublabel {
    font-size: 13px;
    color: #151517;
    opacity: 0.4;
    line-height: normal;
}
.status__sublabel--active {
    color: #e32c2a;
    font-weight: 600;
    opacity: 1;
}
.status.complete .status__label,
.status.complete .status__sublabel { opacity: 1; color: #151517; }
.status.complete .status__sublabel { opacity: 0.4; }
.status.active .status__label { opacity: 1; font-weight: 400; }
.status.active .status__sublabel--active { color: #e32c2a; font-weight: 600; opacity: 1; }

.status.complete .status__icon-wrap { background: #f5f6f8; }
.status.active  .status__icon-wrap { background: #fdeaea; }
.status.active  .status__img { filter: brightness(0) saturate(100%) invert(23%) sepia(97%) saturate(2380%) hue-rotate(349deg) brightness(87%); }

/* Tooltip on inactive stages */
.status[data-tooltip] { position: relative; }
.status[data-tooltip]:not(.complete):not(.active):hover::after {
    content: attr(data-tooltip);
    position: absolute;
    top: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #151517;
    color: #fff;
    font-size: 12px;
    padding: 6px 10px;
    border-radius: 8px;
    white-space: normal;
    max-width: 220px;
    text-align: center;
    pointer-events: none;
    z-index: 10;
}

/* ---- Estimate delivery (sidebar on ≥1280, strip on 768–1279, vertical stack on <768) ---- */
.tracking-estimate {
    display: flex;
    flex-direction: column;
    width: 240px;
    flex-shrink: 0;
    border-radius: 12px;
}
.tracking-estimate__date-box {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 4px;
    background: #fdeaea;
    border-radius: 12px 12px 0 0;
    padding: 12px 14px 10px;
}
.tracking-estimate__date-h {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 16px;
    font-weight: 600;
    color: #282f36;
    text-transform: uppercase;
    line-height: 1;
    white-space: nowrap;
}
.tracking-estimate__date-row {
    display: flex;
    align-items: center;
    gap: 8px;
    padding-left: 24px;
}
.order-summary__delivery-range {
    font-size: 13px;
    font-weight: 600;
    color: #e32c2a;
    line-height: 18px;
    white-space: nowrap;
}
.order-summary__info-icon {
    cursor: help;
    display: flex;
    align-items: center;
    position: relative;
}
.order-summary__info-icon::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: calc(100% + 8px);
    left: 50%;
    transform: translateX(-50%);
    background: #151517;
    color: #fff;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.5;
    padding: 8px 12px;
    border-radius: 8px;
    width: 240px;
    text-align: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
    white-space: normal;
}
.order-summary__info-icon::before {
    content: '';
    position: absolute;
    bottom: calc(100% + 2px);
    left: 50%;
    transform: translateX(-50%);
    border: 5px solid transparent;
    border-top-color: #151517;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.15s;
    z-index: 100;
}
.order-summary__info-icon:hover::after,
.order-summary__info-icon:hover::before { opacity: 1; }

.tracking-estimate__next-step {
    display: flex;
    align-items: center;
    gap: 4px;
    background: #f5f6f8;
    border-radius: 0 0 12px 12px;
    padding: 10px 14px;
    font-size: 13px;
    font-weight: 400;
    color: #292d32;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: normal;
}

/* ---- Map ---- */
.tracking-map {
    border-radius: 20px;
    overflow: hidden;
    width: 100%;
    height: 720px;
    background: #e8e8e8;
}

/* ============================================================
   SPINNER
   ============================================================ */
.tracking-spinner-background {
    position: fixed;
    inset: 0;
    background: rgba(243,244,246,0.7);
    z-index: 300;
}
.tracking-spinner {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 301;
}
.tracking-spinner__ring {
    width: 44px;
    height: 44px;
    border: 4px solid #e0e0e0;
    border-top-color: #f98d37;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ============================================================
   CONTACTS (Magento only, hidden by default)
   ============================================================ */
.contacts { display: none; }
.contacts:not(.hidden) { display: block; }

/* ============================================================
   TRACK ANOTHER SHIPMENT MODAL
   ============================================================ */
.tracking-modal {
    position: fixed;
    inset: 0;
    z-index: 400;
    display: flex;
    align-items: center;
    justify-content: center;
}
body.tracking-modal-open { overflow: hidden; }
.tracking-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(21,21,23,0.55);
}
.tracking-modal__dialog {
    position: relative;
    background: #fff;
    border-radius: 20px;
    padding: 50px 60px 40px;
    width: 560px;
    max-width: calc(100vw - 32px);
    max-height: calc(100vh - 32px);
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 24px;
    box-shadow: 0 24px 60px rgba(0,0,0,.20);
}
.tracking-modal__close {
    position: absolute;
    top: 20px;
    right: 20px;
    width: 32px;
    height: 32px;
    background: transparent;
    border: 0;
    padding: 0;
    cursor: pointer;
    color: #151517;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: background 0.15s;
}
.tracking-modal__close:hover { background: #f5f6f8; }
.tracking-modal__close svg { width: 14px; height: 14px; }
.tracking-modal__h {
    display: flex;
    flex-direction: column;
    gap: 12px;
    text-align: center;
}
.tracking-modal__title {
    margin: 0;
    font-family: 'Sora', sans-serif;
    font-size: 24px;
    font-weight: 600;
    line-height: 1.2;
    color: #151517;
}
.tracking-modal__subtitle {
    margin: 0;
    font-family: 'Sora', sans-serif;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    color: #151517;
    opacity: 0.6;
}
.tracking-modal__form {
    display: flex;
    flex-direction: column;
    gap: 10px;
}
.tracking-modal__input {
    height: 50px;
    padding: 0 20px;
    border: 1px solid #e5e7eb;
    border-radius: 10px;
    font-family: 'JetBrains Mono', monospace;
    font-size: 15px;
    color: #1d8ae8;
    outline: none;
    background: #fff;
    transition: border-color 0.15s;
}
.tracking-modal__input::placeholder { color: #151517; opacity: 0.4; font-family: 'Sora', sans-serif; }
.tracking-modal__input:focus { border-color: #151517; }
.tracking-modal__submit {
    height: 50px;
    background: #e32c2a;
    color: #fff;
    border: 0;
    border-radius: 10px;
    font-family: 'Sora', sans-serif;
    font-weight: 700;
    font-size: 14px;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: background 0.15s;
}
.tracking-modal__submit:hover { background: #c42220; }
.tracking-modal__helps {
    display: flex;
    gap: 30px;
    padding-top: 10px;
    border-top: 1px dashed #e5e7eb;
}
.tracking-modal__help {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
    text-decoration: none;
    flex: 1;
    min-width: 0;
}
.tracking-modal__help-icon {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.tracking-modal__help-icon svg,
.tracking-modal__help-icon img { width: 100%; height: 100%; display: block; }
.tracking-modal__help-txt {
    display: flex;
    flex-direction: column;
    gap: 4px;
    min-width: 0;
}
.tracking-modal__help-primary {
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    color: #151517;
    line-height: 1.2;
    white-space: nowrap;
}
.tracking-modal__help-link {
    font-family: 'Sora', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #1d8ae8;
    line-height: 1.2;
    text-decoration: underline;
    white-space: nowrap;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */

/* 1680px – 1919px */
@media (max-width: 1919px) {
    .tracking-wrap { padding: 30px 130px 60px; }
    .tracking-map { height: 720px; }
}

/* 1280px – 1679px */
@media (max-width: 1679px) {
    .tracking-wrap { padding: 24px 24px 48px; }
    .tracking-map { height: 620px; }
    .tracking-details { padding: 20px 30px; }
}

/* 1024px – 1279px: estimate becomes a strip below timeline */
@media (max-width: 1279px) {
    .tracking-progress__body {
        flex-direction: column;
        align-items: stretch;
        gap: 16px;
    }
    .tracking-estimate {
        width: 100%;
        flex-direction: row;
        align-items: center;
        justify-content: space-between;
        background: #fdeaea;
        border-radius: 12px;
        padding: 6px 6px 6px 14px;
        overflow: visible;
        height: 40px;
    }
    .tracking-estimate__date-box {
        flex-direction: row;
        align-items: center;
        gap: 8px;
        background: transparent;
        border-radius: 0;
        padding: 0;
    }
    .tracking-estimate__date-row { padding-left: 0; }
    .tracking-estimate__next-step {
        flex-direction: row;
        background: #fff;
        border-radius: 10px;
        height: 28px;
        padding: 0 12px;
        white-space: nowrap;
    }
    .tracking-map { height: 500px; }
}

/* 768px – 1023px */
@media (max-width: 1023px) {
    .tracking-details__list {
        display: grid;
        grid-template-columns: repeat(2, minmax(0, 1fr));
        column-gap: 24px;
        row-gap: 12px;
        justify-content: initial;
    }
    .tracking-details__row--address {
        grid-column: 1 / -1;
        flex: initial;
        max-width: none;
    }
    .tracking-map { height: 420px; }
}

/* Tablet layout tweaks */
@media (max-width: 900px) {
    .tracking-head__title { font-size: 24px; }
}

/* <768px — mobile: vertical timeline, stacked content */
@media (max-width: 767px) {
    .tracking-wrap {
        padding: 16px 20px 40px;
        gap: 12px;
    }
    .tracking-head {
        flex-direction: column;
        align-items: center;
        gap: 12px;
        padding: 0;
        text-align: center;
    }
    .tracking-head__title { font-size: 24px; }

    .tracking-details {
        padding: 16px 20px;
        gap: 12px;
    }
    .tracking-details__title { font-size: 18px; }
    .tracking-details__body {
        flex-direction: column;
        align-items: stretch;
        gap: 14px;
    }
    .tracking-details__list {
        display: flex;
        flex-direction: column;
        gap: 10px;
    }
    .tracking-details__status {
        padding-top: 12px;
        border-top: 1px solid #eef0f3;
    }

    .tracking-progress {
        padding: 16px 20px;
        gap: 12px;
    }
    .tracking-progress__title { font-size: 18px; }

    /* Vertical timeline */
    .order-status-bar__track {
        flex-direction: column;
        align-items: stretch;
        gap: 0;
    }
    .order-status-bar__lines { display: none; }
    .status {
        flex-direction: row;
        align-items: center;
        text-align: left;
        gap: 12px;
        flex: 0 0 auto;
        padding: 8px 0;
        position: relative;
    }
    /* Connector between steps — on each step except the first.
       Spans from the previous dot's bottom edge (-22px, since dot center is at
       y=28 and dot is 12px tall) to this step's dot top (+22px). This connects
       dot-to-dot without passing through them. */
    .status + .status::before {
        content: '';
        position: absolute;
        left: 5px;
        top: -22px;
        height: 44px;
        width: 2px;
        background-image: repeating-linear-gradient(
            to bottom,
            #EFF1F4 0, #EFF1F4 2px,
            transparent 2px, transparent 4px
        );
        background-color: transparent;
    }
    /* After a completed step — solid green */
    .status.complete + .status::before {
        background-image: none;
        background-color: #3AB037;
    }
    /* Into the active step (preceded by a completed one) — green-to-red gradient */
    .status.complete + .status.active::before {
        background-image: linear-gradient(to bottom, #3AB037, #E32C2A);
        background-color: transparent;
    }
    .status__icons {
        flex-direction: row-reverse;
        align-items: center;
        gap: 10px;
    }
    .status__icon-wrap { width: 40px; height: 40px; }
    .status__img { width: 22px; height: 22px; }
    .status__dot-wrap { width: 12px; height: 12px; background: transparent; }
    .status__dot { width: 12px; height: 12px; }
    .status__label { font-size: 14px; }
    .status__sublabel { font-size: 12px; }
    .status[data-tooltip]:not(.complete):not(.active):hover::after { display: none; }

    /* Estimate: vertical stacked card on mobile */
    .tracking-estimate {
        flex-direction: column;
        height: auto;
        padding: 0;
        background: transparent;
        border-radius: 12px;
        width: 100%;
    }
    .tracking-estimate__date-box {
        background: #fdeaea;
        border-radius: 12px 12px 0 0;
        padding: 12px 14px 10px;
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
        width: 100%;
    }
    .tracking-estimate__date-h { font-size: 13px; }
    .tracking-estimate__date-row { padding-left: 24px; }
    .tracking-estimate__next-step {
        background: #f5f6f8;
        border-radius: 0 0 12px 12px;
        height: auto;
        padding: 10px 14px;
        justify-content: flex-start;
        width: 100%;
    }

    .tracking-map {
        height: 300px;
        border-radius: 16px;
    }

    /* Modal — mobile */
    .tracking-modal__dialog {
        padding: 46px 24px 30px;
        width: 100%;
        max-width: calc(100vw - 24px);
        gap: 20px;
    }
    .tracking-modal__title { font-size: 20px; }
    .tracking-modal__subtitle { font-size: 13px; }
    .tracking-modal__helps {
        flex-direction: column;
        gap: 14px;
    }
}
