/* ===== LM Express Tracking – Styles ===== */
:root {
  --bg: #f0f2f5;
  --card: #ffffff;
  --border: #e1e4e8;
  --primary: #1a1a2e;
  --primary-light: #2d2d44;
  --accent: #e63946;
  --accent-hover: #c42d3a;
  --success: #0d6832;
  --success-bg: #d4edda;
  --error: #721c24;
  --error-bg: #f8d7da;
  --warn: #856404;
  --warn-bg: #fff3cd;
  --info: #0c5460;
  --info-bg: #d1ecf1;
  --text: #333333;
  --text-muted: #555555;
  --text-light: #888888;
  --radius: 8px;
  --radius-sm: 6px;
  --shadow: 0 2px 12px rgba(0,0,0,0.06);
  --shadow-lg: 0 8px 32px rgba(0,0,0,0.12);
  --transition: 0.2s ease;
}

* { box-sizing: border-box; }

body {
  margin: 0;
  padding: 0;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Header ── */
.header {
  background: var(--primary);
  text-align: center;
}
.header a { display: block; }
.header-banner {
  display: block;
  width: 100%;
  max-width: 520px;
  height: auto;
  margin: 0 auto;
}

/* ── Main ── */
.main {
  max-width: 520px;
  margin: 0 auto;
  padding: 1rem;
  min-height: calc(100vh - 200px);
}

/* ── Cards ── */
.card {
  background: var(--card);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  padding: 1.25rem;
  margin-bottom: 1rem;
}

/* ── Search view ── */
.search-card {
  text-align: center;
  padding: 2rem 1.25rem;
}
.search-icon {
  color: var(--accent);
  margin-bottom: 0.75rem;
}
.search-title {
  margin: 0 0 0.25rem;
  font-size: 1.4rem;
  font-weight: 600;
  color: var(--primary);
}
.search-desc {
  margin: 0 0 1.5rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}
.search-form {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.form-input {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-sm);
  outline: none;
  transition: border-color var(--transition);
  font-family: inherit;
  text-align: center;
  letter-spacing: 0.03em;
}
.form-input:focus {
  border-color: var(--accent);
}

/* ── Buttons ── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.7rem 1.25rem;
  font-size: 0.95rem;
  font-weight: 600;
  font-family: inherit;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: all var(--transition);
  text-decoration: none;
  line-height: 1.4;
}
.btn:active { transform: scale(0.97); }

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

.btn-ghost {
  background: transparent;
  color: var(--text);
  border: 1.5px solid var(--border);
}
.btn-ghost:hover { border-color: var(--text-muted); }

.btn-sm {
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
}

.btn-pickup {
  display: block;
  width: 100%;
  padding: 0.9rem 1.5rem;
  background: var(--accent);
  color: #fff;
  font-size: 1.05rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  text-align: center;
  text-decoration: none;
  transition: all var(--transition);
  box-shadow: 0 4px 14px rgba(230,57,70,0.3);
  margin: 1rem 0 0.75rem;
}
.btn-pickup:hover {
  background: var(--accent-hover);
  box-shadow: 0 6px 20px rgba(230,57,70,0.4);
}
.btn-pickup:active { transform: scale(0.97); }

/* ── Loading ── */
.loading-card {
  text-align: center;
  padding: 3rem 1.25rem;
}
.spinner {
  display: inline-block;
  width: 44px;
  height: 44px;
  border: 4px solid var(--border);
  border-top-color: var(--accent);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }
.loading-text {
  margin: 1rem 0 0;
  color: var(--text-muted);
  font-size: 0.95rem;
}

/* ── Error ── */
.error-card {
  text-align: center;
  padding: 2rem 1.25rem;
}
.error-icon {
  color: var(--accent);
  margin-bottom: 0.5rem;
}
.error-title {
  margin: 0 0 0.25rem;
  font-size: 1.15rem;
  font-weight: 600;
  color: var(--primary);
}
.error-desc {
  margin: 0 0 1.25rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

/* ── Package card ── */
.package-card { padding-bottom: 1rem; }
.package-header {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}
.package-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
}
.package-tracking {
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary);
  background: var(--bg);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-family: 'SF Mono', 'Cascadia Code', 'Consolas', monospace;
  letter-spacing: 0.04em;
  word-break: break-all;
}
.package-recipient {
  margin: 0 0 0.15rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}
.package-contents {
  margin: 0 0 0.75rem;
  font-size: 0.88rem;
  color: var(--text-muted);
}

/* ── Status badge ── */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  padding: 0.35rem 0.75rem;
  border-radius: 20px;
  font-size: 0.82rem;
  font-weight: 600;
}
.status-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}
/* Default */
.status-badge { background: #f0f0f0; color: var(--text-muted); }
.status-badge .status-dot { background: var(--text-muted); }
/* Created (101) */
.status-created { background: #f0f0f0; color: #666; }
.status-created .status-dot { background: #999; }
/* Transit (102) */
.status-transit { background: var(--info-bg); color: var(--info); }
.status-transit .status-dot { background: #17a2b8; }
/* At station (200) */
.status-station { background: var(--warn-bg); color: var(--warn); }
.status-station .status-dot { background: #e0a800; }
/* Ready (201) */
.status-ready { background: var(--success-bg); color: var(--success); }
.status-ready .status-dot { background: var(--success); animation: pulse 2s ease infinite; }
@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

.status-date {
  margin: 0.35rem 0 0;
  font-size: 0.8rem;
  color: var(--text-light);
}

/* ── Pickup card ── */
.pickup-card {
  border-left: 4px solid var(--accent);
  padding: 1.25rem;
}
.pickup-header {
  display: flex;
  align-items: flex-start;
  gap: 0.6rem;
  margin-bottom: 0.75rem;
}
.pickup-check { color: var(--success); flex-shrink: 0; }
.pickup-title {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  color: var(--primary);
}
.pickup-location {
  background: var(--bg);
  border-radius: var(--radius-sm);
  padding: 0.75rem;
  margin-bottom: 0;
}
.pickup-station {
  margin: 0 0 0.15rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--primary);
}
.pickup-address {
  margin: 0;
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.4;
}
.pickup-hint {
  margin: 0;
  font-size: 0.8rem;
  color: var(--text-muted);
  text-align: center;
  line-height: 1.5;
}
.pickup-hint--urgent {
  color: var(--accent);
  background: var(--error-bg);
  padding: 0.6rem 0.75rem;
  border-radius: var(--radius-sm);
  font-weight: 500;
}

/* ── Timeline ── */
.timeline-card { padding-bottom: 0.5rem; }
.timeline-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  font-weight: 600;
  color: var(--primary);
}
.timeline {
  list-style: none;
  margin: 0;
  padding: 0;
}
.timeline-event {
  display: flex;
  gap: 0.75rem;
  position: relative;
  padding-bottom: 1.25rem;
}
/* Vertical line */
.timeline-event:not(:last-child)::after {
  content: '';
  position: absolute;
  left: 5px;
  top: 16px;
  bottom: 0;
  width: 2px;
  background: var(--border);
}
.timeline-dot {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: var(--border);
  flex-shrink: 0;
  margin-top: 4px;
  position: relative;
  z-index: 1;
}
.timeline-event--latest .timeline-dot {
  background: var(--accent);
  box-shadow: 0 0 0 4px rgba(230,57,70,0.15);
}
.timeline-content { flex: 1; min-width: 0; }
.timeline-label {
  display: block;
  font-size: 0.88rem;
  font-weight: 600;
  color: var(--primary);
  margin-bottom: 0.1rem;
}
.timeline-date {
  display: block;
  font-size: 0.78rem;
  color: var(--text-light);
}
.timeline-location {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  margin-top: 0.15rem;
}

/* ── New search ── */
.new-search {
  text-align: center;
  padding: 0.5rem 0 1rem;
}

/* ── Footer ── */
.footer {
  background: var(--primary);
  text-align: center;
  padding: 1.25rem 1rem;
  margin-top: 1rem;
}
.footer-brand {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  color: rgba(255,255,255,0.6);
}
.footer-phone {
  margin: 0 0 0.5rem;
}
.footer-phone a {
  color: var(--accent);
  text-decoration: none;
  font-size: 0.85rem;
}
.footer-copy {
  margin: 0;
  font-size: 0.7rem;
  color: rgba(255,255,255,0.35);
}

/* ── Responsive ── */
@media (min-width: 640px) {
  .main { padding: 1.5rem; }
  .card { padding: 1.5rem; }
  .search-card { padding: 2.5rem 2rem; }
  .search-form {
    flex-direction: row;
    max-width: 400px;
    margin: 0 auto;
  }
  .form-input { text-align: left; }
  .search-title { font-size: 1.6rem; }
  .loading-card { padding: 4rem 2rem; }
}
