/* ─────────────────────────────────────────────────────────────────────────────
   TrackFlow — DHL Express style
───────────────────────────────────────────────────────────────────────────── */

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

:root {
  --yellow:       #FFCC00;
  --yellow-dark:  #e6b800;
  --red:          #D40511;
  --red-dark:     #b00410;
  --red-light:    #fff0f0;
  --red-border:   #f5b8bc;
  --grey-bg:      #f4f4f4;
  --grey-light:   #ebebeb;
  --grey-mid:     #cccccc;
  --grey-text:    #767676;
  --text:         #1a1a1a;
  --white:        #ffffff;
  --green:        #2e7d32;
  --green-dark:   #1b5e20;
  --green-light:  #e8f5e9;

  --font: 'Inter', 'Helvetica Neue', Arial, sans-serif;
  --t:    0.15s ease;
}

html { scroll-behavior: smooth; }

body {
  font-family: var(--font);
  background: var(--grey-bg);
  color: var(--text);
  font-size: 14px;
  line-height: 1.5;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
}

a { color: var(--red); text-decoration: none; }
a:hover { text-decoration: underline; }

/* ── Layout ───────────────────────────────────────────────────────────────── */
.container {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  padding: 0;
}

/* All track-page content sits inside this centred column */
.page-wrap {
  width: 100%;
  max-width: 480px;
  margin: 0 auto;
  background: var(--grey-bg);
  box-shadow: 0 0 0 1px rgba(0,0,0,.06);
  min-height: calc(100vh - 44px);
}

.main-content {
  flex: 1;
  padding-bottom: 40px;
}

/* ── Header ───────────────────────────────────────────────────────────────── */
.site-header {
  background: var(--yellow);
  padding: 0;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 2px 4px rgba(0,0,0,.12);
}

.site-header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  max-width: 480px;
  margin: 0 auto;
  padding: 10px 16px;
}

.logo {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.logo svg { display: block; }
.logo span { display: none; }

/* ── Footer ───────────────────────────────────────────────────────────────── */
.site-footer {
  background: #1a1a1a;
  padding: 12px 16px;
  text-align: center;
  font-size: 12px;
  color: #888;
}

/* ── Home Page ────────────────────────────────────────────────────────────── */
.home-page {
  display: flex;
  align-items: flex-start;
  justify-content: center;
  padding: 24px 16px;
}

.home-card {
  background: var(--white);
  border-radius: 4px;
  padding: 32px 24px;
  width: 100%;
  max-width: 480px;
  box-shadow: 0 1px 4px rgba(0,0,0,.10);
  text-align: center;
}

.home-icon {
  width: 72px;
  height: 72px;
  background: var(--red-light);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 18px;
  color: var(--red);
}

.home-card h1 {
  font-size: 20px;
  font-weight: 800;
  margin-bottom: 6px;
}

.home-subtitle {
  color: var(--grey-text);
  font-size: 13px;
  margin-bottom: 20px;
}

.input-group {
  display: flex;
  gap: 8px;
}

.tracking-input {
  flex: 1;
  padding: 11px 12px;
  border: 1.5px solid var(--grey-mid);
  border-radius: 4px;
  font-family: var(--font);
  font-size: 15px;
  color: var(--text);
  background: var(--white);
  transition: border-color var(--t);
  letter-spacing: 0.5px;
}
.tracking-input:focus { outline: none; border-color: var(--red); }
.tracking-input::placeholder { letter-spacing: 0; color: var(--grey-text); font-size: 13px; }

.input-error {
  font-size: 12px;
  color: var(--red);
  margin-top: 6px;
  min-height: 16px;
  text-align: left;
}

/* ── Buttons ──────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 11px 20px;
  border-radius: 4px;
  font-family: var(--font);
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: background var(--t);
  text-decoration: none;
  white-space: nowrap;
  letter-spacing: 0.3px;
}
.btn:hover { text-decoration: none; }

.btn-primary  { background: var(--red); color: #fff; }
.btn-primary:hover { background: var(--red-dark); }

.btn-warning  { background: var(--red); color: #fff; }
.btn-warning:hover { background: var(--red-dark); }

.btn-outline  { background: transparent; color: var(--red); border: 2px solid var(--red); }
.btn-outline:hover { background: var(--red-light); }

.btn-payment  { background: var(--green); color: #fff; font-weight: 700; transition: background var(--t), transform var(--t), box-shadow var(--t); }
.btn-payment:hover { background: var(--green-dark); transform: translateY(-1px); box-shadow: 0 4px 12px rgba(46,125,50,.35); }

/* ── Alert stripe (Phase 2) ───────────────────────────────────────────────── */
.alert-banner {
  background: linear-gradient(135deg, var(--red) 0%, #b00410 100%);
  color: #fff;
  padding: 14px 18px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  border-radius: 8px;
  margin-bottom: 6px;
  animation: slideDown 0.3s ease;
  box-shadow: 0 2px 8px rgba(212,5,17,.15);
}

@keyframes slideDown {
  from { opacity:0; transform:translateY(-6px); }
  to   { opacity:1; transform:translateY(0); }
}

.alert-icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: #fff;
  opacity: .9;
}

.alert-content { flex: 1; }

.alert-title {
  font-size: 13px;
  font-weight: 800;
  color: #fff;
  margin-bottom: 3px;
  text-transform: uppercase;
  letter-spacing: 0.4px;
}

.alert-body {
  font-size: 13px;
  color: rgba(255,255,255,.9);
  margin-bottom: 12px;
  line-height: 1.5;
}

.alert-banner .btn-payment {
  background: #fff;
  color: var(--green);
  font-size: 12px;
  padding: 8px 18px;
  font-weight: 700;
  transition: background var(--t), color var(--t), transform var(--t), box-shadow var(--t);
}
.alert-banner .btn-payment:hover {
  background: var(--green);
  color: #fff;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(46,125,50,.35);
}

/* ── Shipment status hero ─────────────────────────────────────────────────── */
.status-hero {
  background: var(--white);
  padding: 16px 16px 0;
  border-bottom: 1px solid var(--grey-light);
}

.status-hero-top {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 8px;
  margin-bottom: 4px;
}

.status-main-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--grey-text);
  margin-bottom: 2px;
}

.status-main-value {
  font-size: 20px;
  font-weight: 800;
  color: var(--text);
  line-height: 1.2;
}

.status-main-value.status-hold  { color: var(--red); }
.status-main-value.status-done  { color: var(--green); }

.status-share-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  border: 1.5px solid var(--grey-mid);
  background: var(--white);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  cursor: pointer;
  color: var(--grey-text);
}

.status-update-line {
  font-size: 12px;
  color: var(--grey-text);
  margin-bottom: 14px;
}

.status-update-line strong { color: var(--text); font-weight: 600; }

.status-origin-dest {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  color: var(--grey-text);
  margin-bottom: 14px;
}
.status-origin-dest strong { color: var(--text); }
.status-arrow { color: var(--grey-mid); font-size: 14px; }

/* ── Progress bar (DHL style) ─────────────────────────────────────────────── */
.progress-wrap {
  padding: 0 0 18px;
}

.progress-steps {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  position: relative;
}

/* connector line behind dots */
.progress-steps::before {
  content: '';
  position: absolute;
  top: 14px;
  left: 14px;
  right: 14px;
  height: 2px;
  background: var(--grey-mid);
  z-index: 0;
}

.progress-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 6px;
  flex: 1;
  position: relative;
  z-index: 1;
}

/* filled connector segment for completed portion */
.progress-step.step-done + .progress-step::before,
.progress-step.step-active::before {
  content: '';
  position: absolute;
  top: 14px;
  right: 50%;
  left: -50%;
  height: 2px;
  background: var(--red);
  z-index: 0;
}
.progress-step.step-active::before { right: 50%; }

.step-dot {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--white);
  border: 2px solid var(--grey-mid);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
  font-weight: 700;
  color: var(--grey-text);
  position: relative;
  z-index: 2;
  transition: all var(--t);
  flex-shrink: 0;
}

.step-label {
  font-size: 9px;
  font-weight: 600;
  text-align: center;
  color: var(--grey-text);
  line-height: 1.25;
  max-width: 58px;
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* done */
.step-done .step-dot {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
}
.step-done .step-label { color: var(--red); }

/* active */
.step-active .step-dot {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  box-shadow: 0 0 0 4px rgba(212,5,17,.18);
}
.step-active .step-label { color: var(--red); font-weight: 700; }

/* hold */
.step-hold .step-dot {
  background: var(--red);
  border-color: var(--red);
  color: #fff;
  animation: pulse 1.8s infinite;
}
.step-hold .step-label { color: var(--red); font-weight: 700; }

@keyframes pulse {
  0%,100% { box-shadow: 0 0 0 4px rgba(212,5,17,.18); }
  50%      { box-shadow: 0 0 0 7px rgba(212,5,17,.08); }
}

/* ── Info card (recipient / cargo / address) ──────────────────────────────── */
.info-section {
  background: var(--white);
  border-top: 1px solid var(--grey-light);
  padding: 14px 16px;
}

.info-section + .info-section {
  border-top: 8px solid var(--grey-bg);
}

.info-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--grey-text);
  margin-bottom: 12px;
}

.info-row {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  margin-bottom: 10px;
}
.info-row:last-child { margin-bottom: 0; }

.info-row-icon {
  flex-shrink: 0;
  margin-top: 1px;
  color: var(--red);
}

.info-row-body {}

.info-row-label {
  font-size: 11px;
  color: var(--grey-text);
  margin-bottom: 1px;
}

.info-row-value {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  line-height: 1.4;
}

.fee-badge {
  display: inline-block;
  background: var(--red-light);
  color: var(--red);
  font-weight: 800;
  font-size: 13px;
  padding: 2px 10px;
  border-radius: 12px;
  border: 1px solid var(--red-border);
}

/* ── Payment status badges ────────────────────────────────────────────────── */
.payment-status-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: 12px;
  font-weight: 700;
  padding: 3px 10px;
  border-radius: 12px;
  letter-spacing: 0.2px;
}
.payment-status-badge::before {
  content: '';
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: currentColor;
  opacity: .7;
  flex-shrink: 0;
}

.ps-paid     { background: #edfbf1; color: #1a7a3a; border: 1px solid #a3d9b1; }
.ps-pending  { background: #fff8e1; color: #b45309; border: 1px solid #fcd34d; }
.ps-cod      { background: #eff6ff; color: #1e40af; border: 1px solid #93c5fd; }
.ps-partial  { background: #fdf4ff; color: #7e22ce; border: 1px solid #d8b4fe; }
.ps-refunded { background: #f3f4f6; color: #374151; border: 1px solid #d1d5db; }

/* ── Tracking number section ──────────────────────────────────────────────── */
.tracking-no-section {
  background: var(--white);
  border-top: 8px solid var(--grey-bg);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.tracking-no-label {
  font-size: 11px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--grey-text);
  margin-bottom: 3px;
}

.tracking-no-value {
  font-size: 18px;
  font-weight: 800;
  color: var(--text);
  letter-spacing: 0.5px;
}

/* ── Timeline (DHL grouped by date) ──────────────────────────────────────── */
.timeline-section {
  background: var(--white);
  border-top: 8px solid var(--grey-bg);
  padding: 0;
}

.timeline-section-title {
  font-size: 11px;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  color: var(--grey-text);
  padding: 14px 16px 10px;
  border-bottom: 1px solid var(--grey-light);
}

.timeline {
  list-style: none;
}

.timeline-date-group {
  padding: 0;
}

.timeline-date-header {
  font-size: 11px;
  font-weight: 700;
  color: var(--grey-text);
  text-transform: uppercase;
  letter-spacing: 0.6px;
  padding: 10px 16px 4px;
  background: var(--grey-bg);
}

.timeline-item {
  display: flex;
  align-items: flex-start;
  gap: 12px;
  padding: 12px 16px;
  border-bottom: 1px solid var(--grey-light);
  position: relative;
}
.timeline-item:last-child { border-bottom: none; }

.timeline-item-left {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  min-width: 44px;
  flex-shrink: 0;
}

.timeline-time {
  font-size: 11px;
  font-weight: 700;
  color: var(--text);
  white-space: nowrap;
}

.timeline-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
  background: var(--grey-mid);
  flex-shrink: 0;
}
.timeline-latest .timeline-dot {
  background: var(--red);
  box-shadow: 0 0 0 3px rgba(212,5,17,.15);
}

.timeline-item-body { flex: 1; }

.timeline-location {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  font-weight: 700;
  color: var(--red);
  margin-bottom: 2px;
}

.timeline-msg {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
}

.timeline-latest .timeline-msg { font-weight: 600; }

.no-events {
  text-align: center;
  color: var(--grey-text);
  font-size: 13px;
  padding: 24px 16px;
}

/* ── Track another ────────────────────────────────────────────────────────── */
.track-another {
  padding: 20px 16px;
  background: var(--white);
  border-top: 8px solid var(--grey-bg);
  text-align: center;
}
.track-another .btn-outline {
  width: 100%;
  max-width: 320px;
}

/* ── Error Page ───────────────────────────────────────────────────────────── */
.error-page {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  min-height: calc(100vh - 100px);
  gap: 12px;
  padding: 24px 16px;
}

.error-icon { color: var(--red); opacity: .7; margin-bottom: 8px; }

.error-page h1 {
  font-size: 20px;
  font-weight: 800;
}

.error-message {
  color: var(--grey-text);
  font-size: 14px;
  max-width: 300px;
  margin-bottom: 8px;
}

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .step-label { font-size: 8px; max-width: 48px; }
  .step-dot { width: 24px; height: 24px; }
  .progress-steps::before { top: 12px; }
  .progress-step.step-done + .progress-step::before,
  .progress-step.step-active::before { top: 12px; }
  .status-main-value { font-size: 18px; }
}

@media (min-width: 640px) {
  .container { padding: 0; }
  .main-content { padding-bottom: 60px; }
}
