/* ============================================================================
   TRACKING PAGE STYLES
============================================================================ */

.track-header {
  padding-top: 128px;
  padding-bottom: 32px;
}
.track-back {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13.5px;
  color: var(--text-low);
  margin-bottom: 22px;
  transition: color .2s var(--ease);
}
.track-back:hover { color: var(--text-hi); }

.track-title-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
}
.track-title-row .section-kicker { margin-bottom: 8px; }
.track-title-row h1 { font-size: clamp(24px, 3.4vw, 34px); }
.track-code {
  font-family: var(--font-mono);
  font-size: 14px;
  color: var(--text-low);
}

/* ---------------------------- STATUS BANNER ------------------------------ */
.status-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 20px;
  padding: 26px 30px;
  margin-bottom: 24px;
}
.status-banner.tone-blue { border-color: rgba(61,127,255,.35); }
.status-banner.tone-green { border-color: rgba(52,211,153,.35); }
.status-banner.tone-red { border-color: rgba(240,86,61,.4); background: linear-gradient(180deg, rgba(240,86,61,.08), var(--panel)); }

.status-left { display: flex; align-items: center; gap: 16px; }
.status-label { font-family: var(--font-mono); font-size: 12.5px; color: var(--text-faint); margin-bottom: 6px; }
.status-value { font-size: 22px; font-family: var(--font-display); color: var(--text-hi); display: flex; align-items: center; gap: 10px; }

.status-eta { text-align: right; }
.status-eta .status-label { text-align: right; }
.status-eta .status-value { font-size: 17px; }

/* ---------------------------- ATTENTION NOTICE ---------------------------- */
.attention-notice {
  display: flex;
  gap: 16px;
  padding: 22px 24px;
  border-radius: var(--radius-md);
  background: rgba(240, 86, 61, 0.08);
  border: 1px solid rgba(240, 86, 61, 0.35);
  margin-bottom: 28px;
}
.attention-notice .icon {
  width: 38px; height: 38px;
  border-radius: 10px;
  background: rgba(240,86,61,.16);
  color: var(--attention-red);
  display: grid; place-items: center;
  flex-shrink: 0;
}
.attention-notice h3 { font-size: 16px; color: var(--text-hi); margin-bottom: 6px; }
.attention-notice p { font-size: 14px; color: var(--text-low); margin-bottom: 14px; max-width: 60ch; }

/* ---------------------------- GRID LAYOUT --------------------------------- */
.track-grid {
  display: grid;
  grid-template-columns: 340px 1fr;
  gap: 24px;
  align-items: start;
}
@media (max-width: 980px) { .track-grid { grid-template-columns: 1fr; } }

/* ---------------------------- RECIPIENT CARD ------------------------------ */
.recipient-card { padding: 28px 26px; }
.recipient-top {
  display: flex;
  align-items: center;
  gap: 16px;
  margin-bottom: 22px;
}
.recipient-photo {
  width: 60px; height: 60px;
  border-radius: 16px;
  object-fit: cover;
  border: 1px solid var(--line);
  flex-shrink: 0;
}
.recipient-avatar-fallback {
  width: 60px; height: 60px;
  border-radius: 16px;
  background: linear-gradient(135deg, var(--route-blue), var(--checkpoint-cyan));
  display: grid; place-items: center;
  font-family: var(--font-display);
  font-size: 20px;
  color: #0a1128;
  flex-shrink: 0;
}
.recipient-name { font-size: 17.5px; color: var(--text-hi); margin-bottom: 3px; }
.recipient-sub { font-size: 13px; color: var(--text-low); font-family: var(--font-mono); }

.recipient-list { display: flex; flex-direction: column; gap: 16px; }
.recipient-row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line-soft);
  font-size: 14px;
}
.recipient-row:last-child { border-bottom: none; padding-bottom: 0; }
.recipient-row .k { color: var(--text-faint); }
.recipient-row .v { color: var(--text-hi); text-align: right; max-width: 60%; }

/* ---------------------------- DETAILS GRID -------------------------------- */
.details-panel { padding: 28px 26px; margin-bottom: 24px; }
.details-panel h3, .timeline-panel h3, .map-panel h3, .progress-panel h3, .updates-panel h3, .perstat-panel h3 {
  font-size: 15px;
  font-family: var(--font-mono);
  color: var(--text-low);
  font-weight: 500;
  margin-bottom: 22px;
  letter-spacing: 0.01em;
}

.details-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 22px 20px;
}
.detail-item .k { font-size: 12.5px; color: var(--text-faint); margin-bottom: 6px; }
.detail-item .v { font-size: 15px; color: var(--text-hi); font-family: var(--font-mono); }

@media (max-width: 720px) { .details-grid { grid-template-columns: 1fr 1fr; } }
@media (max-width: 460px) { .details-grid { grid-template-columns: 1fr; } }

/* ---------------------------- TIMELINE ------------------------------------ */
.timeline-panel { padding: 28px 26px; margin-bottom: 24px; }
.timeline-list { display: flex; flex-direction: column; }

.tl-item {
  display: grid;
  grid-template-columns: 28px 1fr;
  gap: 18px;
  position: relative;
  padding-bottom: 28px;
}
.tl-item:last-child { padding-bottom: 0; }
.tl-item::before {
  content: '';
  position: absolute;
  left: 13px; top: 26px; bottom: 0;
  width: 1px;
  background: var(--line);
}
.tl-item:last-child::before { display: none; }

.tl-marker {
  width: 26px; height: 26px;
  border-radius: 50%;
  display: grid; place-items: center;
  flex-shrink: 0;
  z-index: 1;
  color: var(--void);
}
.tl-item.done .tl-marker { background: var(--delivered-green); }
.tl-item.current .tl-marker { background: var(--route-blue); color: #fff; }
.tl-item.upcoming .tl-marker { background: transparent; border: 1.5px solid var(--line); }

.tl-content { padding-top: 2px; }
.tl-stage { font-size: 15.5px; color: var(--text-hi); margin-bottom: 4px; display: flex; align-items: center; gap: 10px; }
.tl-item.upcoming .tl-stage { color: var(--text-faint); }
.tl-meta { font-size: 13px; color: var(--text-low); font-family: var(--font-mono); }
.tl-current-tag {
  font-family: var(--font-mono);
  font-size: 10.5px;
  color: var(--route-blue);
  border: 1px solid rgba(61,127,255,.4);
  padding: 2px 8px;
  border-radius: 999px;
}

/* ---------------------------- MAP ------------------------------------------ */
.map-panel { padding: 28px 26px 26px; margin-bottom: 24px; }
.map-frame {
  width: 100%;
  height: 420px;
  border-radius: var(--radius-md);
  overflow: hidden;
  border: 1px solid var(--line);
}
.map-legend {
  display: flex;
  gap: 22px;
  margin-top: 18px;
  flex-wrap: wrap;
}
.map-legend-item { display: flex; align-items: center; gap: 8px; font-size: 13px; color: var(--text-low); }

/* Leaflet dark theme touch-ups */
.leaflet-container { background: #0b1226; font-family: var(--font-body); }
.leaflet-popup-content-wrapper {
  background: var(--panel-2);
  color: var(--text-hi);
  border: 1px solid var(--line);
  border-radius: 10px;
}
.leaflet-popup-tip { background: var(--panel-2); }
.leaflet-popup-content { font-size: 13px; margin: 10px 12px; }
.leaflet-container a.leaflet-popup-close-button { color: var(--text-low); }

.custom-marker { display: grid; place-items: center; }
.marker-dot {
  width: 14px; height: 14px;
  border-radius: 50%;
  border: 2px solid var(--void);
}
.marker-current {
  width: 16px; height: 16px;
  border-radius: 50%;
  background: var(--attention-red);
  border: 2px solid #fff;
  position: relative;
}
.marker-current::after {
  content: '';
  position: absolute;
  inset: -8px;
  border-radius: 50%;
  border: 2px solid var(--attention-red);
  animation: pulse-ring 1.8s var(--ease) infinite;
}

/* ---------------------------- PROGRESS ------------------------------------- */
.progress-panel { padding: 28px 26px; margin-bottom: 24px; }
.progress-list { display: flex; flex-direction: column; gap: 16px; }
.progress-row { display: grid; grid-template-columns: 130px 1fr 40px; align-items: center; gap: 14px; }
.progress-row .label { font-size: 13.5px; color: var(--text-mid); }
.progress-row .pct { font-size: 12.5px; color: var(--text-low); font-family: var(--font-mono); text-align: right; }
.progress-track {
  height: 8px;
  border-radius: 999px;
  background: var(--line-soft);
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--route-blue), var(--checkpoint-cyan));
  width: 0%;
  transition: width 1.1s var(--ease);
}
.progress-row.upcoming .progress-fill { background: var(--line); }

@media (max-width: 520px) {
  .progress-row { grid-template-columns: 90px 1fr 34px; }
}

/* ---------------------------- PER-SHIPMENT STATS ---------------------------- */
.perstat-panel { padding: 28px 26px; margin-bottom: 24px; }
.perstat-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 18px;
}
.perstat-cell {
  padding: 18px;
  border: 1px solid var(--line-soft);
  border-radius: var(--radius-sm);
}
.perstat-value { font-family: var(--font-display); font-size: 24px; color: var(--text-hi); }
.perstat-label { font-size: 12px; color: var(--text-faint); margin-top: 6px; }

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

/* ---------------------------- UPDATES FEED ---------------------------------- */
.updates-panel { padding: 28px 26px; }
.updates-day-label {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--text-faint);
  margin: 22px 0 12px;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.updates-day-label:first-child { margin-top: 0; }

.update-item {
  display: flex;
  gap: 16px;
  padding: 16px 0;
  border-bottom: 1px solid var(--line-soft);
}
.update-item:last-child { border-bottom: none; }
.update-icon {
  width: 34px; height: 34px;
  border-radius: 9px;
  display: grid; place-items: center;
  flex-shrink: 0;
}
.update-item.normal .update-icon { background: rgba(61,127,255,.12); color: var(--route-blue); }
.update-item.attention .update-icon { background: rgba(240,86,61,.14); color: var(--attention-red); }

.update-body { flex: 1; }
.update-title-row { display: flex; align-items: baseline; gap: 10px; margin-bottom: 4px; flex-wrap: wrap; }
.update-title { font-size: 14.5px; color: var(--text-hi); }
.update-time { font-size: 12px; color: var(--text-faint); font-family: var(--font-mono); }
.update-note { font-size: 13.5px; color: var(--text-low); }

/* ---------------------------- NOT FOUND STATE -------------------------------- */
.notfound {
  min-height: 70vh;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding-top: 100px;
}
.notfound-inner { max-width: 440px; }
.notfound-icon {
  width: 64px; height: 64px;
  border-radius: 16px;
  border: 1px solid var(--line);
  color: var(--text-faint);
  display: grid; place-items: center;
  margin: 0 auto 26px;
}
.notfound h1 { font-size: 24px; margin-bottom: 10px; }
.notfound p { color: var(--text-low); margin-bottom: 28px; font-size: 15px; }

/* ---------------------------- LOADING STATE ---------------------------------- */
.track-loading {
  min-height: 70vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 18px;
  padding-top: 100px;
}
.loading-ring {
  width: 34px; height: 34px;
  border-radius: 50%;
  border: 2px solid var(--line);
  border-top-color: var(--route-blue);
  animation: spin 0.9s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.track-loading span { font-family: var(--font-mono); font-size: 13px; color: var(--text-faint); }
