/* ── Reset & Base ─────────────────────────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
  --yellow: #f3c500;
  --black: #000;
  --white: #fff;
  --grey-100: #f7f7f7;
  --grey-200: #ebebeb;
  --grey-400: #999;
  --grey-600: #555;
  --radius: 4px;
  --border: 1px solid #000;
  --font: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --max-w: 1140px;
}

html { font-size: 14px; scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--white);
  color: var(--black);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

a { color: inherit; text-decoration: none; }
img { display: block; max-width: 100%; }
button { cursor: pointer; font-family: inherit; }

/* ── Static file warning ─────────────────────────────────────────────────── */
#static-warning {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
}
#static-warning.visible { display: flex; }
.static-box {
  background: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  padding: 40px;
  max-width: 440px;
  text-align: center;
}
.static-box .static-icon { font-size: 40px; margin-bottom: 16px; }
.static-box h2 { font-size: 18px; font-weight: 700; margin-bottom: 12px; }
.static-box p { font-size: 13px; color: var(--grey-600); line-height: 1.6; }
.static-box code {
  display: inline-block;
  background: var(--grey-100);
  border: 1px solid var(--grey-200);
  border-radius: 2px;
  padding: 2px 6px;
  font-size: 12px;
  font-family: monospace;
  margin-top: 8px;
}

/* ── Header ──────────────────────────────────────────────────────────────── */
.site-header {
  border-bottom: var(--border);
  padding: 0 24px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  background: var(--white);
  z-index: 100;
}
.site-logo {
  font-size: 22px;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--black);
}
.header-link {
  font-size: 13px;
  font-weight: 500;
  color: var(--grey-600);
  border-bottom: 1px solid transparent;
  padding-bottom: 1px;
  transition: color 0.15s, border-color 0.15s;
}
.header-link:hover { color: var(--black); border-color: var(--black); }

/* ── Track Hero ──────────────────────────────────────────────────────────── */
.track-hero {
  border-bottom: var(--border);
  padding: 48px 24px 40px;
  text-align: center;
}
.track-hero h1 {
  font-size: clamp(28px, 5vw, 48px);
  font-weight: 800;
  letter-spacing: -0.02em;
  line-height: 1.1;
}
.track-hero p {
  margin-top: 10px;
  font-size: 14px;
  color: var(--grey-600);
}

/* ── Track Form ──────────────────────────────────────────────────────────── */
.track-form-wrap {
  max-width: 520px;
  margin: 0 auto;
  padding: 40px 24px;
  border-bottom: var(--border);
}
.track-form { display: flex; flex-direction: column; gap: 12px; }
.track-form label {
  display: block;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-bottom: 4px;
  color: var(--black);
}
.track-form input {
  width: 100%;
  height: 48px;
  border: var(--border);
  border-radius: var(--radius);
  padding: 0 14px;
  font-size: 14px;
  font-family: inherit;
  background: var(--white);
  color: var(--black);
  transition: border-color 0.15s;
  outline: none;
}
.track-form input::placeholder { color: var(--grey-400); }
.track-form input:focus { border-color: var(--yellow); box-shadow: 0 0 0 3px rgba(243,197,0,0.18); }
.track-form input:focus-visible { border-color: var(--yellow); }

.btn-track {
  height: 50px;
  background: var(--black);
  color: var(--white);
  border: var(--border);
  border-radius: var(--radius);
  font-size: 13px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  transition: background 0.15s, color 0.15s;
  position: relative;
  overflow: hidden;
  margin-top: 4px;
}
.btn-track:hover:not(:disabled) { background: var(--yellow); color: var(--black); }
.btn-track:disabled { opacity: 0.6; cursor: default; }
.btn-track .btn-text { transition: opacity 0.15s; }
.btn-track .btn-spinner {
  display: none;
  position: absolute;
  inset: 0;
  align-items: center;
  justify-content: center;
}
.btn-track.loading .btn-text { opacity: 0; }
.btn-track.loading .btn-spinner { display: flex; }

.spinner {
  width: 20px; height: 20px;
  border: 2px solid rgba(255,255,255,0.3);
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
.btn-track:hover .spinner { border-top-color: var(--black); border-color: rgba(0,0,0,0.2); }
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Error / Empty State ─────────────────────────────────────────────────── */
#state-empty { padding: 56px 24px; text-align: center; }
#state-error {
  display: none;
  max-width: 520px;
  margin: 0 auto;
  padding: 32px 24px;
}
.error-box {
  border: 1px solid #e00;
  border-radius: var(--radius);
  padding: 16px 20px;
  background: #fff5f5;
  display: flex;
  gap: 12px;
  align-items: flex-start;
}
.error-icon { font-size: 18px; flex-shrink: 0; margin-top: 1px; }
.error-text { font-size: 13px; color: #c00; line-height: 1.5; }

/* ── Results ─────────────────────────────────────────────────────────────── */
#track-results { display: none; }
.results-inner { max-width: var(--max-w); margin: 0 auto; padding: 0 24px; }

/* ── Status Strip ────────────────────────────────────────────────────────── */
.status-strip {
  border-bottom: var(--border);
  padding: 32px 0;
}
.status-strip-inner {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 24px;
  flex-wrap: wrap;
}
.status-left { flex: 1; min-width: 200px; }
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border: var(--border);
  border-radius: 100px;
  padding: 5px 14px;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.07em;
  text-transform: uppercase;
  margin-bottom: 14px;
}
.status-badge .badge-dot {
  width: 7px; height: 7px;
  border-radius: 50%;
  flex-shrink: 0;
}
.stage-confirmed .badge-dot { background: var(--grey-400); }
.stage-packed .badge-dot { background: #f0a500; }
.stage-shipped .badge-dot { background: #2563eb; animation: pulse-blue 1.5s ease-in-out infinite; }
.stage-ofd .badge-dot { background: #f0a500; animation: pulse-yellow 1.5s ease-in-out infinite; }
.stage-delivered .badge-dot { background: #16a34a; }
.stage-exception .badge-dot { background: #dc2626; }

@keyframes pulse-blue {
  0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}
@keyframes pulse-yellow {
  0%, 100% { opacity: 1; } 50% { opacity: 0.4; }
}

.status-headline {
  font-size: clamp(16px, 2.5vw, 22px);
  font-weight: 700;
  line-height: 1.3;
  letter-spacing: -0.01em;
}
.status-order-code { font-size: 12px; color: var(--grey-600); margin-top: 6px; }

.status-meta {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-width: 180px;
  padding-top: 4px;
}
.meta-row { display: flex; flex-direction: column; gap: 2px; }
.meta-label {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--grey-400);
}
.meta-value { font-size: 13px; font-weight: 600; }

/* ── Progress Bar ────────────────────────────────────────────────────────── */
.progress-section {
  padding: 32px 0;
  border-bottom: var(--border);
  overflow-x: auto;
}
.progress-track {
  display: flex;
  align-items: flex-start;
  gap: 0;
  min-width: 460px;
}
.progress-step {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  position: relative;
}
.progress-step:not(:last-child)::after {
  content: '';
  position: absolute;
  top: 10px;
  left: 50%;
  width: 100%;
  height: 2px;
  background: var(--grey-200);
  z-index: 0;
}
.progress-step.done:not(:last-child)::after,
.progress-step.active:not(:last-child)::after {
  background: var(--black);
}
.step-dot {
  width: 22px; height: 22px;
  border-radius: 50%;
  border: 2px solid var(--grey-200);
  background: var(--white);
  position: relative;
  z-index: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: border-color 0.2s, background 0.2s;
}
.progress-step.done .step-dot {
  border-color: var(--black);
  background: var(--black);
}
.progress-step.active .step-dot {
  border-color: var(--yellow);
  background: var(--yellow);
  box-shadow: 0 0 0 4px rgba(243,197,0,0.25);
}
.progress-step.exception .step-dot {
  border-color: #dc2626;
  background: #dc2626;
}
.step-check { color: var(--white); font-size: 12px; }
.step-label {
  font-size: 10px;
  font-weight: 600;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  margin-top: 8px;
  text-align: center;
  color: var(--grey-400);
}
.progress-step.done .step-label,
.progress-step.active .step-label { color: var(--black); }

/* ── Main columns ────────────────────────────────────────────────────────── */
.track-columns {
  display: grid;
  grid-template-columns: 1fr 340px;
  gap: 0;
  border-bottom: var(--border);
}

/* ── Timeline ────────────────────────────────────────────────────────────── */
.timeline-section {
  padding: 32px 32px 32px 0;
  border-right: var(--border);
}
.section-title {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  margin-bottom: 24px;
  color: var(--grey-600);
}
.timeline { display: flex; flex-direction: column; gap: 0; }
.timeline-item {
  display: flex;
  gap: 16px;
  position: relative;
  padding-bottom: 28px;
}
.timeline-item:last-child { padding-bottom: 0; }
.timeline-spine {
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  width: 16px;
}
.timeline-dot {
  width: 12px; height: 12px;
  border-radius: 50%;
  border: 2px solid var(--grey-200);
  background: var(--white);
  flex-shrink: 0;
}
.timeline-item.current .timeline-dot {
  border-color: var(--yellow);
  background: var(--yellow);
  box-shadow: 0 0 0 3px rgba(243,197,0,0.2);
}
.timeline-line {
  flex: 1;
  width: 2px;
  background: var(--grey-200);
  margin-top: 4px;
}
.timeline-item:last-child .timeline-line { display: none; }
.timeline-item.current ~ .timeline-item .timeline-dot { border-color: var(--grey-200); }

.checkpoint-title { font-size: 13px; font-weight: 600; }
.checkpoint-note { font-size: 12px; color: var(--grey-600); margin-top: 3px; }
.timeline-item.current .checkpoint-title { color: var(--black); }

.no-checkpoints {
  font-size: 13px;
  color: var(--grey-600);
  padding: 16px 0;
}

/* ── Order Items (sidebar) ───────────────────────────────────────────────── */
.order-items-section { padding: 32px 0 32px 32px; }
.item-card {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--grey-200);
}
.item-card:last-child { border-bottom: none; }
.item-img {
  width: 72px; height: 72px;
  flex-shrink: 0;
  border: 1px solid var(--grey-200);
  border-radius: var(--radius);
  overflow: hidden;
  background: var(--grey-100);
}
.item-img img { width: 100%; height: 100%; object-fit: cover; }
.item-img-placeholder {
  width: 100%; height: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  color: var(--grey-400);
}
.item-info { flex: 1; min-width: 0; }
.item-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.item-meta { font-size: 12px; color: var(--grey-600); margin-top: 4px; }
.item-price { font-size: 13px; font-weight: 700; margin-top: 6px; }

/* ── Upsell Section ──────────────────────────────────────────────────────── */
.upsell-section {
  padding: 40px 0 48px;
  border-bottom: var(--border);
}
.upsell-header {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  margin-bottom: 24px;
}
.upsell-title {
  font-size: clamp(18px, 2.5vw, 26px);
  font-weight: 800;
  letter-spacing: -0.02em;
}
.upsell-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 16px;
}
.upsell-card {
  border: var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  transition: box-shadow 0.15s;
  text-decoration: none;
  color: inherit;
  display: block;
}
.upsell-card:hover { box-shadow: 0 4px 16px rgba(0,0,0,0.1); }
.upsell-img {
  aspect-ratio: 3/4;
  background: var(--grey-100);
  overflow: hidden;
}
.upsell-img img { width: 100%; height: 100%; object-fit: cover; transition: transform 0.3s ease; }
.upsell-card:hover .upsell-img img { transform: scale(1.04); }
.upsell-body { padding: 12px; }
.upsell-name { font-size: 13px; font-weight: 600; line-height: 1.3; }
.upsell-price { font-size: 13px; font-weight: 700; margin-top: 4px; }
.upsell-size {
  display: inline-block;
  margin-top: 8px;
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.05em;
  background: var(--black);
  color: var(--white);
  border-radius: 2px;
  padding: 3px 8px;
  text-transform: uppercase;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */
.site-footer {
  border-top: var(--border);
  padding: 32px 24px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  flex-wrap: wrap;
}
.footer-brand { font-size: 16px; font-weight: 800; letter-spacing: 0.08em; text-transform: uppercase; }
.footer-links { display: flex; gap: 24px; }
.footer-link { font-size: 12px; color: var(--grey-600); }
.footer-link:hover { color: var(--black); }
.footer-copy { font-size: 11px; color: var(--grey-400); }

/* ── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 900px) {
  .track-columns {
    grid-template-columns: 1fr;
  }
  .timeline-section {
    border-right: none;
    border-bottom: var(--border);
    padding: 28px 0;
  }
  .order-items-section { padding: 28px 0; }
  .upsell-grid { grid-template-columns: repeat(2, 1fr); }
}

@media (max-width: 600px) {
  .site-header { padding: 0 16px; }
  .track-hero { padding: 36px 16px 28px; }
  .track-form-wrap { padding: 28px 16px; }
  .results-inner { padding: 0 16px; }
  .status-strip-inner { flex-direction: column; gap: 20px; }
  .upsell-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
  .site-footer { flex-direction: column; align-items: flex-start; }
  .footer-links { gap: 16px; }
}

@media (max-width: 380px) {
  .upsell-grid { grid-template-columns: 1fr; }
}
