/* ── Shipment Tracker Pro — Public CSS ───────────────────────────────────── */
@import url('https://fonts.googleapis.com/css2?family=Sora:wght@400;500;600;700;800&family=JetBrains+Mono:wght@400;600&display=swap');

:root {
  --st-primary:      #1e40af;
  --st-primary-light:#3b82f6;
  --st-primary-glow: rgba(59,130,246,.18);
  --st-success:      #059669;
  --st-warning:      #d97706;
  --st-danger:       #dc2626;
  --st-purple:       #7c3aed;
  --st-white:        #ffffff;
  --st-gray-50:      #f8fafc;
  --st-gray-100:     #f1f5f9;
  --st-gray-200:     #e2e8f0;
  --st-gray-400:     #94a3b8;
  --st-gray-500:     #64748b;
  --st-gray-700:     #334155;
  --st-gray-900:     #0f172a;
  --st-radius:       16px;
  --st-radius-sm:    10px;
  --st-shadow:       0 1px 3px rgba(0,0,0,.06), 0 8px 32px rgba(0,0,0,.08);
  --st-shadow-lg:    0 4px 6px rgba(0,0,0,.05), 0 20px 60px rgba(0,0,0,.12);
  --st-font:         'Sora', -apple-system, BlinkMacSystemFont, sans-serif;
  --st-mono:         'JetBrains Mono', 'Menlo', 'Monaco', monospace;
}

.st-tracker-root {
  font-family: var(--st-font);
  color: var(--st-gray-900);
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 16px 60px;
  position: relative;
}
.st-tracker-root * { box-sizing: border-box; }

/* ── Hero / Search ────────────────────────────────────────────────────────── */
.st-tracker-hero {
  text-align: center;
  padding: 56px 24px 48px;
}
.st-tracker-title {
  font-size: clamp(1.8rem, 4vw, 2.8rem);
  font-weight: 800;
  color: var(--st-gray-900);
  margin: 0 0 32px;
  letter-spacing: -.02em;
  line-height: 1.15;
}
.st-tracker-title::after {
  content: '';
  display: block;
  width: 56px; height: 4px;
  background: linear-gradient(90deg, var(--st-primary-light), var(--st-purple));
  border-radius: 2px;
  margin: 16px auto 0;
}

.st-search-form {
  display: flex; gap: 0; max-width: 600px; margin: 0 auto;
  border-radius: var(--st-radius);
  box-shadow: var(--st-shadow-lg);
  overflow: hidden;
  border: 2px solid var(--st-gray-200);
  transition: border-color .2s, box-shadow .2s;
}
.st-search-form:focus-within {
  border-color: var(--st-primary-light);
  box-shadow: 0 0 0 4px var(--st-primary-glow), var(--st-shadow-lg);
}

.st-search-input-wrap {
  flex: 1; display: flex; align-items: center; gap: 12px; padding: 0 18px;
  background: var(--st-white);
}
.st-search-icon { color: var(--st-gray-400); flex-shrink: 0; }
.st-tracker-input {
  flex: 1; border: none; outline: none; font-family: var(--st-mono);
  font-size: 1rem; font-weight: 600; letter-spacing: .06em;
  color: var(--st-gray-900); background: transparent; padding: 18px 0;
}
.st-tracker-input::placeholder { font-family: var(--st-font); font-weight: 400; letter-spacing: 0; color: var(--st-gray-400); font-size: .95rem; }

.st-tracker-btn {
  display: flex; align-items: center; gap: 8px;
  padding: 18px 28px; border: none; cursor: pointer;
  background: linear-gradient(135deg, var(--st-primary-light), var(--st-primary));
  color: var(--st-white); font-family: var(--st-font); font-size: 0.95rem; font-weight: 700;
  transition: filter .2s, transform .15s;
  flex-shrink: 0;
}
.st-tracker-btn:hover { filter: brightness(1.1); }
.st-tracker-btn:active { transform: scale(.97); }
.st-tracker-btn.loading .st-btn-text::after {
  content: '…';
  animation: st-dots 1.2s infinite;
}
@keyframes st-dots { 0%,100%{opacity:1} 50%{opacity:.3} }

.st-error-msg {
  margin-top: 14px; font-size: .88rem; color: var(--st-danger);
  font-weight: 500; min-height: 1.2em;
}

/* ── Loading Overlay ──────────────────────────────────────────────────────── */
.st-loading-overlay {
  position: relative; text-align: center; padding: 48px;
  color: var(--st-gray-500); font-size: .9rem;
}
.st-spinner {
  width: 40px; height: 40px; border: 3px solid var(--st-gray-200);
  border-top-color: var(--st-primary-light); border-radius: 50%;
  animation: st-spin .8s linear infinite; margin: 0 auto 16px;
}
@keyframes st-spin { to { transform: rotate(360deg); } }

/* ── Result Area ──────────────────────────────────────────────────────────── */
.st-result { animation: st-fade-in .4s ease-out; }
@keyframes st-fade-in { from{opacity:0;transform:translateY(16px)} to{opacity:1;transform:none} }

/* ── Result Header ────────────────────────────────────────────────────────── */
.st-result-header-card {
  background: linear-gradient(135deg, var(--st-primary) 0%, #1e3a8a 100%);
  border-radius: var(--st-radius);
  padding: 28px 32px;
  color: var(--st-white);
  margin-bottom: 20px;
  box-shadow: var(--st-shadow-lg);
  display: flex; align-items: flex-start; justify-content: space-between; flex-wrap: wrap; gap: 20px;
}
.st-rh-left { display: flex; flex-direction: column; gap: 8px; }
.st-rh-name { font-size: 1.3rem; font-weight: 700; line-height: 1.2; }
.st-rh-tracking {
  display: inline-flex; align-items: center; gap: 8px;
  font-family: var(--st-mono); font-size: .85rem; font-weight: 600;
  background: rgba(255,255,255,.15); padding: 5px 12px; border-radius: 6px;
  letter-spacing: .08em;
}
.st-rh-route { font-size: .88rem; opacity: .85; display: flex; align-items: center; gap: 8px; flex-wrap: wrap; }
.st-rh-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.st-rh-status-badge {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 8px 18px; border-radius: 999px; font-size: .85rem; font-weight: 700;
  background: rgba(255,255,255,.2); backdrop-filter: blur(4px);
  border: 1px solid rgba(255,255,255,.3);
}
.st-rh-eta { font-size: .8rem; opacity: .8; text-align: right; }

/* ── Progress ─────────────────────────────────────────────────────────────── */
.st-progress-card {
  background: var(--st-white); border: 1px solid var(--st-gray-200);
  border-radius: var(--st-radius); box-shadow: var(--st-shadow);
  padding: 24px 32px; margin-bottom: 20px;
}
.st-progress-label {
  display: flex; justify-content: space-between; align-items: center;
  margin-bottom: 14px; font-size: .85rem; font-weight: 600;
}
.st-progress-bar-track {
  height: 10px; background: var(--st-gray-100); border-radius: 999px; overflow: hidden;
}
.st-progress-bar-fill {
  height: 100%; border-radius: 999px;
  background: linear-gradient(90deg, var(--st-primary-light), var(--st-purple));
  transition: width 1s cubic-bezier(.4,0,.2,1);
  position: relative; overflow: hidden;
}
.st-progress-bar-fill::after {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(90deg, transparent 0%, rgba(255,255,255,.35) 50%, transparent 100%);
  animation: st-shimmer 2s infinite;
}
@keyframes st-shimmer { 0%{transform:translateX(-100%)} 100%{transform:translateX(100%)} }

.st-progress-steps {
  display: flex; justify-content: space-between; margin-top: 16px; gap: 4px;
}
.st-ps-step {
  display: flex; flex-direction: column; align-items: center; gap: 6px;
  font-size: .7rem; font-weight: 600; color: var(--st-gray-400);
  text-align: center; flex: 1;
  transition: color .3s;
}
.st-ps-step.done { color: var(--st-primary-light); }
.st-ps-step.active { color: var(--st-primary); }
.st-ps-dot {
  width: 10px; height: 10px; border-radius: 50%;
  background: var(--st-gray-200); transition: background .3s, transform .3s;
}
.st-ps-step.done  .st-ps-dot { background: var(--st-primary-light); }
.st-ps-step.active .st-ps-dot {
  background: var(--st-primary); transform: scale(1.4);
  box-shadow: 0 0 0 3px var(--st-primary-glow);
}

/* ── Result Body ──────────────────────────────────────────────────────────── */
.st-result-body {
  display: grid; grid-template-columns: 1fr 1.2fr; gap: 20px; margin-bottom: 20px;
}
@media (max-width: 768px) { .st-result-body { grid-template-columns: 1fr; } }

/* ── Detail Card ──────────────────────────────────────────────────────────── */
.st-detail-card {
  background: var(--st-white); border: 1px solid var(--st-gray-200);
  border-radius: var(--st-radius); box-shadow: var(--st-shadow); overflow: hidden;
  height: 100%;
}
.st-detail-section {
  padding: 18px 22px; border-bottom: 1px solid var(--st-gray-100);
}
.st-detail-section:last-child { border-bottom: none; }
.st-detail-section-title {
  font-size: .72rem; font-weight: 700; text-transform: uppercase; letter-spacing: .1em;
  color: var(--st-gray-400); margin-bottom: 12px;
}
.st-detail-row {
  display: flex; gap: 12px; margin-bottom: 8px; align-items: flex-start;
  font-size: .85rem;
}
.st-detail-row:last-child { margin-bottom: 0; }
.st-detail-label { color: var(--st-gray-500); font-weight: 500; min-width: 100px; flex-shrink: 0; }
.st-detail-val   { color: var(--st-gray-900); font-weight: 600; word-break: break-word; }

/* ── Map Card ─────────────────────────────────────────────────────────────── */
.st-map-card {
  background: var(--st-white); border: 1px solid var(--st-gray-200);
  border-radius: var(--st-radius); box-shadow: var(--st-shadow); overflow: hidden;
}
.st-map-card-header {
  padding: 14px 20px; font-size: .85rem; font-weight: 600; color: var(--st-gray-700);
  border-bottom: 1px solid var(--st-gray-100); background: var(--st-gray-50);
}
#stPublicMap {
  height: 320px;
}

/* ── Timeline ─────────────────────────────────────────────────────────────── */
.st-timeline-card {
  background: var(--st-white); border: 1px solid var(--st-gray-200);
  border-radius: var(--st-radius); box-shadow: var(--st-shadow); overflow: hidden;
}
.st-timeline-header {
  padding: 18px 28px; font-size: .9rem; font-weight: 700; color: var(--st-gray-700);
  border-bottom: 1px solid var(--st-gray-100); background: var(--st-gray-50);
  display: flex; align-items: center; gap: 10px;
}
.st-timeline-body { padding: 24px 28px; }

.st-tl-item {
  display: flex; gap: 20px; position: relative;
  padding-bottom: 28px;
}
.st-tl-item:last-child { padding-bottom: 0; }
.st-tl-left { display: flex; flex-direction: column; align-items: center; }
.st-tl-dot {
  width: 14px; height: 14px; border-radius: 50%; flex-shrink: 0; position: relative; z-index: 1;
  box-shadow: 0 0 0 4px white, 0 0 0 6px var(--dot-color, #e2e8f0);
  transition: box-shadow .3s;
}
.st-tl-item.active .st-tl-dot {
  width: 18px; height: 18px;
  box-shadow: 0 0 0 4px white, 0 0 0 7px var(--dot-color), 0 0 16px var(--dot-color);
  animation: st-pulse 2s ease-in-out infinite;
}
@keyframes st-pulse { 0%,100%{box-shadow:0 0 0 4px white,0 0 0 7px var(--dot-color),0 0 10px var(--dot-color)} 50%{box-shadow:0 0 0 4px white,0 0 0 8px var(--dot-color),0 0 24px var(--dot-color)} }

.st-tl-line {
  width: 2px; flex: 1; background: var(--st-gray-200); margin: 4px 0;
  min-height: 24px;
}
.st-tl-item.done .st-tl-line { background: var(--dot-color, var(--st-primary-light)); }

.st-tl-right { flex: 1; padding-top: 0; min-width: 0; }
.st-tl-status-badge {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 4px 12px; border-radius: 999px; font-size: .75rem; font-weight: 700;
  margin-bottom: 6px;
}
.st-tl-meta { font-size: .78rem; color: var(--st-gray-400); margin-bottom: 6px; font-weight: 500; }
.st-tl-location { font-size: .88rem; font-weight: 700; color: var(--st-gray-900); margin-bottom: 4px; }
.st-tl-note { font-size: .82rem; color: var(--st-gray-500); font-style: italic; line-height: 1.5; }
.st-tl-coords { font-size: .72rem; font-family: var(--st-mono); color: var(--st-gray-400); margin-top: 4px; }

/* ── Responsive ───────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .st-tracker-hero { padding: 32px 0 28px; }
  .st-tracker-btn .st-btn-text { display: none; }
  .st-result-header-card { padding: 20px; }
  .st-rh-right { align-items: flex-start; }
  .st-progress-card { padding: 18px; }
  .st-detail-label { min-width: 80px; }
  .st-timeline-body { padding: 16px; }
}

/* ── Google Maps overrides ────────────────────────────────────────────────── */
.gm-style { font-family: var(--st-font) !important; }
.gm-style .gm-style-iw-c { border-radius: 12px !important; box-shadow: var(--st-shadow-lg) !important; padding: 14px 18px !important; }
.gm-style .gm-style-iw-d { overflow: hidden !important; font-family: var(--st-font); font-size: .85rem; line-height: 1.6; }
.gm-style-iw-t::after { background: #fff !important; }
/* Map label styling for origin/current markers */
.st-gmap-label { background: rgba(255,255,255,0.92); padding: 2px 6px; border-radius: 6px; box-shadow: 0 2px 6px rgba(0,0,0,.15); white-space: nowrap; }

/* ── Map enhancements ─────────────────────────────────────────────────────── */
#stPublicMap {
  height: 420px;
}
.st-plane-wrap {
  pointer-events: none;
  will-change: transform;
}

/* ── Timeline note style ──────────────────────────────────────────────────── */
.st-tl-note {
  font-size: .82rem;
  color: var(--st-gray-600, #475569);
  font-style: italic;
  background: var(--st-gray-50, #f8fafc);
  border-left: 3px solid var(--st-gray-200, #e2e8f0);
  padding: 6px 10px;
  border-radius: 0 6px 6px 0;
  margin-top: 4px;
  line-height: 1.5;
}

/* ── Email link in details ────────────────────────────────────────────────── */
.st-detail-val a {
  color: var(--st-primary, #1e40af);
  text-decoration: none;
}
.st-detail-val a:hover { text-decoration: underline; }

/* ── Receipt / Barcode card ────────────────────────────────────────────────── */
.st-receipt-card {
  background: linear-gradient(135deg,#0f172a 0%,#1e3a8a 100%);
  border-radius: 12px; padding: 20px 24px; margin-bottom: 0;
  color: #fff; font-family: 'JetBrains Mono', monospace;
}
.st-receipt-header { text-align:center; margin-bottom:12px; }
.st-receipt-title { font-size:.65rem; font-weight:700; letter-spacing:.18em; color:#94a3b8; text-transform:uppercase; }
.st-receipt-sub   { font-size:.78rem; color:#cbd5e1; margin-top:4px; }
.st-barcode-wrap  { background:#fff; border-radius:8px; padding:12px 16px; margin:10px 0; }
.st-receipt-footer{
  display:flex; align-items:center; justify-content:space-between;
  font-size:.75rem; color:#94a3b8; padding-top:8px; border-top:1px dashed #334155;
}

/* ── Map ───────────────────────────────────────────────────────────────────── */
#stPublicMap { height:420px; }

/* ── Timeline note style ───────────────────────────────────────────────────── */
.st-tl-note {
  font-size:.82rem; color:#475569; background:#f8fafc;
  border-left:3px solid #e2e8f0; padding:6px 10px;
  border-radius:0 6px 6px 0; margin-top:4px; line-height:1.5; font-style:italic;
}

/* ── Email link ────────────────────────────────────────────────────────────── */
.st-detail-val a { color:inherit; text-decoration:underline; text-underline-offset:2px; }
.st-detail-val a:hover { opacity:.8; }
