/* ============================================================
   Spliff Track v3 — Tracking Page CSS
   Design : Apple-style clean, light, premium, rassurant
   ============================================================ */

:root {
    --st-primary:    #2D6A4F;
    --st-secondary:  #52B788;
    --st-bg:         #FFFFFF;
    --st-card-bg:    #F8F8F5;
    --st-text:       #1A1A18;
    --st-text2:      #6B6B65;
    --st-success:    #2D6A4F;
    --st-error:      #D62828;
    --st-warning:    #E9840A;
    --st-font:       -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    --st-radius:     16px;
    --st-radius-sm:  10px;
    --st-shadow:     0 2px 20px rgba(0,0,0,.07), 0 1px 4px rgba(0,0,0,.04);
    --st-shadow-lg:  0 8px 40px rgba(0,0,0,.10), 0 2px 8px rgba(0,0,0,.05);
    --st-transition: 0.22s cubic-bezier(.4,0,.2,1);
    --st-page-max:   680px;
}

/* ── Reset local ─────────────────────────────────────── */
.st-page * { box-sizing: border-box; }
.st-page { font-family: var(--st-font); color: var(--st-text); background: var(--st-bg); line-height: 1.55; -webkit-font-smoothing: antialiased; }
.st-page a { color: var(--st-primary); text-decoration: none; }
.st-page a:hover { text-decoration: underline; }
.st-page h1, .st-page h2, .st-page h3 { margin: 0; font-weight: 700; line-height: 1.25; letter-spacing: -.02em; }

/* ── Page wrapper ────────────────────────────────────── */
.st-page {
    max-width: var(--st-page-max);
    margin: 0 auto;
    padding: 0 0 80px;
    min-height: 100vh;
}

/* ── Header ──────────────────────────────────────────── */
.st-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 20px 24px;
    border-bottom: 1px solid rgba(0,0,0,.06);
    position: sticky;
    top: 0;
    background: rgba(255,255,255,.92);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 100;
}
.st-header__logo { display: flex; align-items: center; gap: 8px; }
.st-header__brand {
    font-weight: 800;
    font-size: 20px;
    letter-spacing: -.04em;
    color: var(--st-text);
}
.st-header__cta {
    font-size: 13px;
    font-weight: 600;
    color: var(--st-primary);
    padding: 7px 14px;
    border: 1.5px solid var(--st-primary);
    border-radius: 50px;
    transition: background var(--st-transition), color var(--st-transition);
}
.st-header__cta:hover { background: var(--st-primary); color: #fff; text-decoration: none; }

/* ── Hero ────────────────────────────────────────────── */
.st-hero {
    padding: 40px 24px 32px;
    display: flex;
    align-items: flex-start;
    gap: 20px;
}
.st-hero__icon {
    font-size: 52px;
    line-height: 1;
    flex-shrink: 0;
    animation: st-icon-in .5s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes st-icon-in { from { opacity:0; transform: scale(.4) rotate(-10deg); } to { opacity:1; transform: scale(1) rotate(0); } }

.st-hero__title { font-size: clamp(22px, 5vw, 28px); color: var(--st-text); margin-bottom: 8px; }
.st-hero__sub   { font-size: 15px; color: var(--st-text2); margin: 0 0 16px; }
.st-hero__meta  { display: flex; flex-wrap: wrap; gap: 8px; }

/* Status-specific hero colours */
.st-hero--delivered   .st-hero__title { color: var(--st-success); }
.st-hero--outfordelivery .st-hero__title { color: #1D6A3A; }
.st-hero--error       .st-hero__title { color: var(--st-error); }
.st-hero--returned    .st-hero__title { color: var(--st-text2); }

/* ── Badges ──────────────────────────────────────────── */
.st-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 50px;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: .01em;
}
.st-badge--order   { background: #F0F0EB; color: var(--st-text2); }
.st-badge--tracking{ background: #EAF3EE; color: var(--st-success); font-family: ui-monospace, "SF Mono", monospace; }
.st-badge--type    { background: #FFF3E0; color: var(--st-warning); }

/* ── ETA Banner ──────────────────────────────────────── */
.st-eta-banner {
    margin: 0 16px 16px;
    padding: 16px 20px;
    background: #F0F7F4;
    border-radius: var(--st-radius);
    border-left: 3px solid var(--st-primary);
    display: flex;
    align-items: center;
    gap: 14px;
    animation: st-slide-up .3s ease both;
}
.st-eta-banner--today {
    background: linear-gradient(135deg, #D8F3DC 0%, #B7E4C7 100%);
    border-color: var(--st-success);
    box-shadow: 0 4px 16px rgba(45,106,79,.15);
}
.st-eta-banner__icon { font-size: 28px; flex-shrink: 0; }
.st-eta-banner__text { display: flex; flex-direction: column; gap: 2px; }
.st-eta-banner__text strong { font-size: 15px; color: var(--st-text); }
.st-eta-banner__text span   { font-size: 13px; color: var(--st-text2); }
.st-eta-banner--today .st-eta-banner__text strong { color: var(--st-success); font-size: 17px; }

/* ── Cards ───────────────────────────────────────────── */
.st-card {
    margin: 0 16px 16px;
    background: var(--st-card-bg);
    border-radius: var(--st-radius);
    padding: 24px;
    box-shadow: var(--st-shadow);
    animation: st-slide-up .3s ease both;
}
.st-card--relay  { border-top: 3px solid var(--st-primary); }
.st-card--alert  { background: #FFF5F5; border-top: 3px solid var(--st-error); }
.st-card__header {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 16px;
}
.st-card__icon  { font-size: 20px; }
.st-card__title { font-size: 16px; color: var(--st-text); flex: 1; }
.st-card__text  { font-size: 14px; color: var(--st-text2); margin: 0 0 16px; }

/* ── Stepper ─────────────────────────────────────────── */
.st-stepper {
    display: flex;
    align-items: flex-start;
    gap: 0;
    position: relative;
    padding: 0;
    overflow: visible;
}
.st-stepper--vertical { flex-direction: column; gap: 4px; }

.st-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    flex: 1;
    gap: 8px;
    position: relative;
}
.st-stepper--vertical .st-step {
    flex-direction: row;
    flex: 0;
    align-items: flex-start;
    width: 100%;
}

/* Node */
.st-step__node {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 2;
    flex-shrink: 0;
    transition: all var(--st-transition);
}
.st-step--done   .st-step__node { background: var(--st-success); color: #fff; box-shadow: 0 2px 8px rgba(45,106,79,.3); }
.st-step--active .st-step__node { background: var(--st-primary); color: #fff; box-shadow: 0 4px 16px rgba(45,106,79,.35); }
.st-step--pending .st-step__node { background: #E8E8E4; color: var(--st-text2); }

.st-step__check  { width: 18px; height: 18px; }
.st-step__icon   { font-size: 18px; }
.st-step__num    { font-size: 14px; font-weight: 700; }

/* Pulse animation for active step */
.st-step__pulse {
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid var(--st-primary);
    animation: st-pulse 2s ease-in-out infinite;
}
@keyframes st-pulse {
    0%, 100% { opacity: .6; transform: scale(1); }
    50%       { opacity: 0; transform: scale(1.4); }
}

/* Connector line */
.st-step__line {
    position: absolute;
    top: 20px;
    left: calc(50% + 20px);
    right: calc(-50% + 20px);
    height: 2px;
    background: #E8E8E4;
    z-index: 1;
    transition: background var(--st-transition);
}
.st-step__line--done { background: var(--st-success); }
.st-stepper--vertical .st-step__line {
    top: 40px;
    left: 19px;
    right: auto;
    width: 2px;
    height: 28px;
}

/* Labels */
.st-step__label {
    font-size: 11px;
    font-weight: 600;
    text-align: center;
    color: var(--st-text2);
    letter-spacing: .02em;
    text-transform: uppercase;
    max-width: 72px;
    line-height: 1.3;
}
.st-step--active  .st-step__label { color: var(--st-primary); }
.st-step--done    .st-step__label { color: var(--st-success); }
.st-stepper--vertical .st-step__label { text-align: left; max-width: none; font-size: 13px; padding-top: 10px; }

/* Exception stepper */
.st-stepper__exception {
    width: 100%;
    padding: 16px 20px;
    border-radius: var(--st-radius-sm);
    font-size: 15px;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 10px;
}
.st-stepper__exception--error   { background: #FFF0F0; color: var(--st-error); }
.st-stepper__exception--returned { background: #F0F0EB; color: var(--st-text2); }

/* Progress bar */
.st-progress-bar {
    position: absolute;
    bottom: -16px;
    left: 0; right: 0;
    height: 3px;
    background: #E8E8E4;
    border-radius: 3px;
    overflow: hidden;
}
.st-progress-bar__fill {
    height: 100%;
    background: linear-gradient(90deg, var(--st-primary), var(--st-secondary));
    border-radius: 3px;
    transition: width .8s cubic-bezier(.4,0,.2,1);
}

/* ── Relay section ───────────────────────────────────── */
.st-relay {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
    align-items: start;
}
@media (max-width: 520px) { .st-relay { grid-template-columns: 1fr; } }

.st-relay__name    { font-size: 17px; font-weight: 700; color: var(--st-text); margin-bottom: 6px; }
.st-relay__address { font-size: 14px; color: var(--st-text2); line-height: 1.5; margin-bottom: 8px; }
.st-relay__phone   { font-size: 14px; margin-bottom: 8px; }
.st-relay__phone a { color: var(--st-primary); font-weight: 600; }

.st-relay__hours-toggle {
    background: none;
    border: none;
    color: var(--st-primary);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    display: flex;
    align-items: center;
    gap: 4px;
}
.st-relay__hours-list { display: none; margin-top: 10px; }
.st-relay__hours.is-open .st-relay__hours-list { display: block; }

.st-relay__map {
    height: 180px;
    border-radius: var(--st-radius-sm);
    overflow: hidden;
    background: #E8E8E4;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--st-text2);
    font-size: 13px;
}
.st-relay__map iframe,
.st-relay__map > div { width: 100% !important; height: 100% !important; }

.st-hours__row {
    display: flex;
    justify-content: space-between;
    padding: 5px 0;
    border-bottom: 1px solid rgba(0,0,0,.05);
    font-size: 13px;
}
.st-hours__row:last-child { border-bottom: none; }
.st-hours__row--today { font-weight: 700; color: var(--st-primary); }
.st-hours__day  { color: var(--st-text); }
.st-hours__time { color: var(--st-text2); font-variant-numeric: tabular-nums; }
.st-hours__row--today .st-hours__time { color: var(--st-primary); }

/* ── Timeline ────────────────────────────────────────── */
.st-timeline { display: flex; flex-direction: column; gap: 0; }
.st-timeline__item {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    padding: 10px 0;
    border-bottom: 1px solid rgba(0,0,0,.05);
    animation: st-slide-up .25s ease both;
}
.st-timeline__item:last-child { border-bottom: none; }

.st-timeline__dot {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background: #D8D8D4;
    flex-shrink: 0;
    margin-top: 5px;
    transition: background var(--st-transition);
}
.st-timeline__dot--active { background: var(--st-primary); box-shadow: 0 0 0 3px rgba(45,106,79,.2); }

.st-timeline__content { flex: 1; }
.st-timeline__date    { font-size: 11px; color: var(--st-text2); font-variant-numeric: tabular-nums; margin-bottom: 2px; letter-spacing: .01em; text-transform: uppercase; }
.st-timeline__desc    { font-size: 14px; color: var(--st-text); font-weight: 500; }
.st-timeline__loc     { font-size: 12px; color: var(--st-text2); margin-top: 3px; }

/* ── History toggle ──────────────────────────────────── */
.st-history-toggle {
    background: none;
    border: none;
    color: var(--st-primary);
    font-size: 12px;
    font-weight: 600;
    cursor: pointer;
    padding: 0;
    font-family: inherit;
    margin-left: auto;
}

/* ── Apple Wallet ────────────────────────────────────── */
.st-wallet-section {
    margin: 0 16px 16px;
    display: flex;
    justify-content: center;
}
.st-wallet-btn {
    display: inline-flex;
    align-items: center;
    transition: opacity var(--st-transition), transform var(--st-transition);
}
.st-wallet-btn:hover { opacity: .85; transform: scale(.98); }
.st-wallet-btn img { display: block; }

/* ── Delivered celebration ───────────────────────────── */
.st-delivered-message {
    margin: 0 16px 16px;
    background: linear-gradient(135deg, #D8F3DC 0%, #B7E4C7 100%);
    border-radius: var(--st-radius);
    padding: 32px 24px;
    text-align: center;
    position: relative;
    overflow: hidden;
}
.st-delivered-inner { position: relative; z-index: 2; }
.st-delivered-emoji { font-size: 52px; margin-bottom: 12px; }
.st-delivered-message p {
    font-size: 18px;
    font-weight: 700;
    color: var(--st-success);
    margin: 0 0 6px;
}
.st-delivered-signed { font-size: 13px !important; font-weight: 400 !important; color: var(--st-text2) !important; }

/* Confetti */
.st-confetti-container {
    position: absolute;
    inset: 0;
    pointer-events: none;
    overflow: hidden;
}
.st-confetti-piece {
    position: absolute;
    width: 8px;
    height: 8px;
    border-radius: 1px;
    animation: st-confetti-fall linear infinite;
    opacity: 0;
}
@keyframes st-confetti-fall {
    0%   { transform: translateY(-20px) rotate(0deg); opacity: 1; }
    100% { transform: translateY(200px) rotate(360deg); opacity: 0; }
}

/* ── Buttons ─────────────────────────────────────────── */
.st-btn {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    padding: 13px 24px;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 700;
    font-family: inherit;
    cursor: pointer;
    transition: all var(--st-transition);
    text-decoration: none;
    border: none;
    line-height: 1;
}
.st-btn--primary {
    background: var(--st-primary);
    color: #fff;
    box-shadow: 0 4px 16px rgba(45,106,79,.3);
}
.st-btn--primary:hover {
    background: color-mix(in srgb, var(--st-primary) 85%, black);
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(45,106,79,.4);
    color: #fff;
    text-decoration: none;
}
.st-btn--full { width: 100%; justify-content: center; }
.st-btn__arrow { flex-shrink: 0; }

/* ── Refresh bar ─────────────────────────────────────── */
.st-refresh-bar {
    position: fixed;
    bottom: 16px;
    left: 50%;
    transform: translateX(-50%);
    background: rgba(26,26,24,.88);
    color: #fff;
    border-radius: 50px;
    padding: 8px 16px;
    font-size: 12px;
    display: flex;
    align-items: center;
    gap: 8px;
    backdrop-filter: blur(8px);
    z-index: 200;
    transition: opacity var(--st-transition);
}
.st-refresh-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--st-secondary);
    animation: st-blink 2s ease-in-out infinite;
}
@keyframes st-blink { 0%, 100% { opacity: 1; } 50% { opacity: .3; } }

/* ── Lookup form ─────────────────────────────────────── */
.st-page--lookup { min-height: 100vh; }
.st-lookup {
    max-width: 480px;
    margin: 80px auto 0;
    padding: 0 24px;
    text-align: center;
}
.st-lookup__icon   { font-size: 64px; margin-bottom: 24px; animation: st-icon-in .5s ease both; }
.st-lookup__title  { font-size: clamp(26px, 6vw, 36px); margin-bottom: 12px; }
.st-lookup__sub    { font-size: 16px; color: var(--st-text2); margin-bottom: 32px; }
.st-lookup__form   { text-align: left; }
.st-lookup__tabs   { display: flex; gap: 0; margin-bottom: 20px; border: 1.5px solid #E8E8E4; border-radius: var(--st-radius-sm); overflow: hidden; }
.st-tab {
    flex: 1;
    padding: 10px 16px;
    background: none;
    border: none;
    font-family: inherit;
    font-size: 14px;
    font-weight: 600;
    color: var(--st-text2);
    cursor: pointer;
    transition: all var(--st-transition);
}
.st-tab.is-active { background: var(--st-primary); color: #fff; }
.st-lookup__field  { margin-bottom: 16px; }
.st-lookup__field:not(.is-active) { display: none; }

.st-input {
    width: 100%;
    padding: 14px 18px;
    border: 1.5px solid #E8E8E4;
    border-radius: var(--st-radius-sm);
    font-size: 16px;
    font-family: inherit;
    background: var(--st-bg);
    color: var(--st-text);
    transition: border-color var(--st-transition), box-shadow var(--st-transition);
    appearance: none;
}
.st-input:focus {
    outline: none;
    border-color: var(--st-primary);
    box-shadow: 0 0 0 3px rgba(45,106,79,.12);
}
.st-input::placeholder { color: #B8B8B4; }
.st-label { display: block; font-size: 13px; font-weight: 600; color: var(--st-text2); margin-bottom: 6px; }

.st-lookup__spinner {
    display: flex;
    justify-content: center;
    margin-top: 16px;
}
.st-spinner {
    width: 24px;
    height: 24px;
    border: 2.5px solid #E8E8E4;
    border-top-color: var(--st-primary);
    border-radius: 50%;
    animation: st-spin .7s linear infinite;
}
@keyframes st-spin { to { transform: rotate(360deg); } }

.st-lookup__error {
    margin-top: 12px;
    color: var(--st-error);
    font-size: 14px;
    font-weight: 500;
    text-align: center;
}

/* ── Alert ───────────────────────────────────────────── */
.st-alert {
    padding: 14px 18px;
    border-radius: var(--st-radius-sm);
    font-size: 14px;
    margin-bottom: 20px;
}
.st-alert--error { background: #FFF0F0; color: var(--st-error); border-left: 3px solid var(--st-error); }

/* ── Animations ──────────────────────────────────────── */
@keyframes st-slide-up {
    from { opacity: 0; transform: translateY(12px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Stagger les cartes */
.st-hero       { animation: st-slide-up .35s ease .05s both; }
.st-eta-banner { animation: st-slide-up .35s ease .1s both; }
.st-card:nth-child(3) { animation-delay: .15s; }
.st-card:nth-child(4) { animation-delay: .20s; }
.st-card:nth-child(5) { animation-delay: .25s; }
.st-wallet-section    { animation: st-slide-up .35s ease .3s both; }
.st-delivered-message { animation: st-slide-up .35s ease .3s both; }

/* ── Responsive ──────────────────────────────────────── */
@media (max-width: 640px) {
    .st-page { padding-bottom: 60px; }
    .st-hero  { padding: 28px 16px 24px; gap: 14px; }
    .st-hero__icon { font-size: 42px; }
    .st-card  { margin: 0 12px 12px; padding: 18px; }
    .st-eta-banner { margin: 0 12px 12px; padding: 14px 16px; }
    .st-wallet-section { margin: 0 12px 12px; }
    .st-delivered-message { margin: 0 12px 12px; }
    .st-step__label { font-size: 10px; max-width: 60px; }
    .st-step__node  { width: 36px; height: 36px; }
    .st-step__line  { top: 18px; left: calc(50% + 18px); right: calc(-50% + 18px); }
    .st-lookup { margin-top: 48px; }
}

/* ── Print ───────────────────────────────────────────── */
@media print {
    .st-header__cta, .st-refresh-bar, .st-wallet-section { display: none; }
    .st-header { position: static; background: white; }
    .st-card    { box-shadow: none; border: 1px solid #E8E8E4; }
}
