/* ============================================================
   JITU - Private Courier Tracking | Custom Styles
   ============================================================ */

/* ---------- Google Fonts ---------- */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=JetBrains+Mono:wght@400;500;600;700&display=swap');

/* ---------- CSS Custom Properties ---------- */
:root {
  --bg-primary: #0a0f1e;
  --bg-secondary: #111827;
  --bg-tertiary: #1e293b;
  --bg-card: rgba(30, 41, 59, 0.6);
  --bg-glass: rgba(17, 24, 39, 0.7);
  --bg-glass-strong: rgba(10, 15, 30, 0.85);
  --border-glass: rgba(255, 255, 255, 0.08);
  --border-glass-strong: rgba(255, 255, 255, 0.12);

  --accent-cyan: #ff5722;
  --accent-teal: #e52d27;
  --accent-blue: #ee4d2d;
  --accent-gradient: linear-gradient(135deg, #ff5722, #e52d27);
  --accent-gradient-h: linear-gradient(90deg, #ff5722, #ee4d2d);

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;
  --text-accent: #ff8a65;

  --status-green: #10b981;
  --status-yellow: #f59e0b;
  --status-red: #ef4444;
  --status-blue: #3b82f6;
  --status-gray: #6b7280;
  --status-cyan: #06b6d4;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);
  --shadow-xl: 0 16px 48px rgba(0, 0, 0, 0.6);
  --shadow-glow-cyan: 0 0 20px rgba(6, 182, 212, 0.3);
  --shadow-glow-blue: 0 0 20px rgba(59, 130, 246, 0.3);

  --radius-sm: 0.375rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;

  --transition-fast: 150ms ease;
  --transition-base: 250ms ease;
  --transition-slow: 400ms ease;

  --font-sans: 'Inter', system-ui, -apple-system, sans-serif;
  --font-mono: 'JetBrains Mono', 'Fira Code', monospace;
}

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

html {
  scroll-behavior: smooth;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ---------- Custom Scrollbar ---------- */
::-webkit-scrollbar {
  width: 6px;
  height: 6px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 3px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--text-muted);
}

* {
  scrollbar-width: thin;
  scrollbar-color: var(--bg-tertiary) var(--bg-primary);
}

/* ---------- Glassmorphism ---------- */
.glass {
  background: var(--bg-glass);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-glass);
  box-shadow: var(--shadow-md);
}

.glass-strong {
  background: var(--bg-glass-strong);
  backdrop-filter: blur(24px);
  -webkit-backdrop-filter: blur(24px);
  border: 1px solid var(--border-glass-strong);
  box-shadow: var(--shadow-lg);
}

.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-md);
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.glass-card:hover {
  box-shadow: var(--shadow-lg);
}

/* ---------- Animated Gradient Background ---------- */
.animated-bg {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: -1;
  overflow: hidden;
  background: var(--bg-primary);
}

.animated-bg::before {
  content: '';
  position: absolute;
  top: -50%;
  left: -50%;
  width: 200%;
  height: 200%;
  background: radial-gradient(ellipse at 20% 50%, rgba(6, 182, 212, 0.08) 0%, transparent 50%),
              radial-gradient(ellipse at 80% 20%, rgba(59, 130, 246, 0.06) 0%, transparent 50%),
              radial-gradient(ellipse at 40% 80%, rgba(8, 145, 178, 0.05) 0%, transparent 50%);
  animation: bgFloat 20s ease-in-out infinite;
}

.animated-bg::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: radial-gradient(ellipse at 60% 40%, rgba(6, 182, 212, 0.04) 0%, transparent 60%);
  animation: bgPulse 15s ease-in-out infinite alternate;
}

@keyframes bgFloat {
  0%, 100% { transform: translate(0, 0) rotate(0deg); }
  33% { transform: translate(2%, -1%) rotate(1deg); }
  66% { transform: translate(-1%, 2%) rotate(-1deg); }
}

@keyframes bgPulse {
  0% { opacity: 0.5; }
  100% { opacity: 1; }
}

/* ---------- Gradient Text ---------- */
.gradient-text {
  background: var(--accent-gradient-h);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* ---------- Tracking Number Font ---------- */
.tracking-number {
  font-family: var(--font-mono);
  letter-spacing: 0.05em;
  font-weight: 600;
}

/* ---------- Form Inputs (Dark Theme) ---------- */
.input-dark {
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  width: 100%;
  transition: border-color var(--transition-base), box-shadow var(--transition-base), background var(--transition-base);
  outline: none;
}

.input-dark::placeholder {
  color: var(--text-muted);
}

.input-dark:hover {
  border-color: rgba(255, 255, 255, 0.15);
  background: rgba(15, 23, 42, 0.9);
}

.input-dark:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15), 0 0 12px rgba(6, 182, 212, 0.1);
  background: rgba(15, 23, 42, 1);
}

.input-search {
  background: rgba(15, 23, 42, 0.6);
  border: 2px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-xl);
  color: var(--text-primary);
  padding: 1.125rem 1.5rem;
  padding-right: 4rem;
  font-family: var(--font-mono);
  font-size: 1.0625rem;
  width: 100%;
  transition: all var(--transition-base);
  outline: none;
}

.input-search::placeholder {
  color: var(--text-muted);
  font-family: var(--font-sans);
  font-size: 0.9375rem;
}

.input-search:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 4px rgba(6, 182, 212, 0.12), var(--shadow-glow-cyan);
  background: rgba(15, 23, 42, 0.9);
}

/* ---------- Buttons ---------- */
.btn-primary {
  background: var(--accent-gradient);
  color: white;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.75rem 1.5rem;
  font-family: var(--font-sans);
  font-weight: 600;
  font-size: 0.9375rem;
  cursor: pointer;
  transition: all var(--transition-base);
  position: relative;
  overflow: hidden;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.btn-primary::before {
  content: '';
  position: absolute;
  inset: 0;
  background: linear-gradient(135deg, rgba(255,255,255,0.15), transparent);
  opacity: 0;
  transition: opacity var(--transition-base);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: var(--shadow-glow-cyan), var(--shadow-md);
}

.btn-primary:hover::before {
  opacity: 1;
}

.btn-primary:active {
  transform: translateY(0);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-secondary);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  padding: 0.625rem 1.25rem;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: var(--radius-md);
  padding: 0.625rem 1.25rem;
  font-family: var(--font-sans);
  font-weight: 500;
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-base);
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.25);
  color: #fecaca;
}

.btn-icon {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all var(--transition-fast);
  font-size: 0.875rem;
}

.btn-icon:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-primary);
  border-color: rgba(255, 255, 255, 0.15);
}

/* ---------- Map Container ---------- */
#trackingMap, #miniMap, .map-container {
  border-radius: var(--radius-lg);
  overflow: hidden;
  border: 1px solid var(--border-glass);
  z-index: 1;
}

#trackingMap {
  min-height: 500px;
  height: 100%;
}

#miniMap {
  min-height: 300px;
  height: 300px;
}

/* Leaflet Overrides */
.leaflet-control-zoom {
  border: none !important;
  box-shadow: var(--shadow-md) !important;
}

.leaflet-control-zoom a {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border: 1px solid var(--border-glass) !important;
  width: 32px !important;
  height: 32px !important;
  line-height: 32px !important;
  font-size: 16px !important;
}

.leaflet-control-zoom a:hover {
  background: var(--bg-tertiary) !important;
}

.leaflet-control-attribution {
  background: rgba(10, 15, 30, 0.8) !important;
  color: var(--text-muted) !important;
  font-size: 10px !important;
  backdrop-filter: blur(4px);
}

.leaflet-control-attribution a {
  color: var(--text-muted) !important;
}

.leaflet-popup-content-wrapper {
  background: var(--bg-secondary) !important;
  color: var(--text-primary) !important;
  border-radius: var(--radius-md) !important;
  border: 1px solid var(--border-glass) !important;
  box-shadow: var(--shadow-lg) !important;
}

.leaflet-popup-tip {
  background: var(--bg-secondary) !important;
  border-right: 1px solid var(--border-glass) !important;
  border-bottom: 1px solid var(--border-glass) !important;
}

.leaflet-popup-close-button {
  color: var(--text-secondary) !important;
}

.leaflet-popup-close-button:hover {
  color: var(--text-primary) !important;
}

/* Custom Map Markers */
.map-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: 0 0 8px rgba(0,0,0,0.5), 0 0 16px rgba(0,0,0,0.3);
  position: relative;
}

.map-marker.origin {
  background: var(--status-green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.5), 0 0 16px rgba(16, 185, 129, 0.2);
}

.map-marker.destination {
  background: var(--status-red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.5), 0 0 16px rgba(239, 68, 68, 0.2);
}

.map-marker.transit {
  background: var(--accent-cyan);
  width: 12px;
  height: 12px;
  border-width: 2px;
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
}

.map-marker.completed {
  background: #10b981;
  width: 14px;
  height: 14px;
  border-width: 2px;
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
}

.map-marker.completed::after {
  content: '✓';
  color: white;
  font-size: 8px;
  font-weight: bold;
  line-height: 1;
}

.map-marker.current {
  background: var(--accent-blue);
  width: 20px;
  height: 20px;
  border-width: 3px;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.6), 0 0 24px rgba(59, 130, 246, 0.3);
  animation: currentPulse 2s ease-in-out infinite;
}

@keyframes currentPulse {
  0%, 100% { box-shadow: 0 0 12px rgba(59, 130, 246, 0.6), 0 0 24px rgba(59, 130, 246, 0.3); }
  50% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.8), 0 0 40px rgba(59, 130, 246, 0.4); }
}

/* Animated Route Polyline */
.route-line-animated {
  stroke-dasharray: 12, 8;
  animation: dashMove 1.5s linear infinite;
}

@keyframes dashMove {
  to { stroke-dashoffset: -20; }
}

/* ---------- Status Badges ---------- */
.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.375rem;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

.status-badge.processing {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.3);
}

.status-badge.in-transit {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.3);
}

.status-badge.delivered {
  background: rgba(16, 185, 129, 0.15);
  color: #34d399;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-badge.delayed {
  background: rgba(239, 68, 68, 0.15);
  color: #fca5a5;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.status-badge.cancelled {
  background: rgba(107, 114, 128, 0.15);
  color: #9ca3af;
  border: 1px solid rgba(107, 114, 128, 0.3);
}

/* Status dot */
.status-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  display: inline-block;
}

.status-dot.processing { background: #fbbf24; }
.status-dot.in-transit { background: #60a5fa; animation: dotPulse 1.5s ease-in-out infinite; }
.status-dot.delivered { background: #34d399; }
.status-dot.delayed { background: #fca5a5; animation: dotPulse 1s ease-in-out infinite; }
.status-dot.cancelled { background: #9ca3af; }

@keyframes dotPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.4; }
}

/* ---------- Progress Bar ---------- */
.progress-bar-container {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
  position: relative;
}

.progress-bar-fill {
  height: 100%;
  border-radius: 3px;
  background: var(--accent-gradient-h);
  transition: width 1s ease-out;
  position: relative;
}

.progress-bar-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 30px;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.3));
  animation: progressShine 2s ease-in-out infinite;
}

@keyframes progressShine {
  0%, 100% { opacity: 0; }
  50% { opacity: 1; }
}

/* ---------- Timeline ---------- */
.timeline {
  position: relative;
  padding-left: 2rem;
}

.timeline::before {
  content: '';
  position: absolute;
  left: 0.5625rem;
  top: 0.5rem;
  bottom: 0.5rem;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
}

.timeline-item {
  position: relative;
  padding-bottom: 1.5rem;
  opacity: 0;
  transform: translateX(-10px);
  animation: timelineSlideIn 0.4s ease forwards;
}

.timeline-item:last-child {
  padding-bottom: 0;
}

.timeline-item .timeline-dot {
  position: absolute;
  left: -1.6875rem;
  top: 0.25rem;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  border: 2px solid;
  z-index: 1;
}

.timeline-item.completed .timeline-dot {
  background: var(--status-green);
  border-color: var(--status-green);
  box-shadow: 0 0 8px rgba(16, 185, 129, 0.4);
}

.timeline-item.current .timeline-dot {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 8px rgba(6, 182, 212, 0.5);
  animation: dotPulse 1.5s ease-in-out infinite;
}

.timeline-item.pending .timeline-dot {
  background: transparent;
  border-color: var(--text-muted);
}

.timeline-item.delayed .timeline-dot {
  background: var(--status-red);
  border-color: var(--status-red);
  box-shadow: 0 0 8px rgba(239, 68, 68, 0.4);
}

@keyframes timelineSlideIn {
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.timeline-item:nth-child(1) { animation-delay: 0.1s; }
.timeline-item:nth-child(2) { animation-delay: 0.2s; }
.timeline-item:nth-child(3) { animation-delay: 0.3s; }
.timeline-item:nth-child(4) { animation-delay: 0.4s; }
.timeline-item:nth-child(5) { animation-delay: 0.5s; }
.timeline-item:nth-child(6) { animation-delay: 0.6s; }
.timeline-item:nth-child(7) { animation-delay: 0.7s; }
.timeline-item:nth-child(8) { animation-delay: 0.8s; }
.timeline-item:nth-child(9) { animation-delay: 0.9s; }
.timeline-item:nth-child(10) { animation-delay: 1.0s; }

/* ---------- Loading Spinner ---------- */
.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid rgba(255, 255, 255, 0.1);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

.spinner-sm {
  width: 18px;
  height: 18px;
  border-width: 2px;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  inset: 0;
  background: rgba(10, 15, 30, 0.7);
  backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.loading-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

/* Skeleton loading */
.skeleton {
  background: linear-gradient(90deg, rgba(255,255,255,0.04) 25%, rgba(255,255,255,0.08) 50%, rgba(255,255,255,0.04) 75%);
  background-size: 200% 100%;
  animation: skeletonShimmer 1.5s ease-in-out infinite;
  border-radius: var(--radius-sm);
}

@keyframes skeletonShimmer {
  0% { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

/* ---------- Live Tracking Pulse ---------- */
.live-indicator {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--status-green);
  text-transform: uppercase;
  letter-spacing: 0.08em;
}

.live-indicator .live-dot {
  width: 8px;
  height: 8px;
  background: var(--status-green);
  border-radius: 50%;
  position: relative;
}

.live-indicator .live-dot::before {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--status-green);
  opacity: 0;
  animation: livePulse 2s ease-out infinite;
}

@keyframes livePulse {
  0% { transform: scale(0.5); opacity: 0.8; }
  100% { transform: scale(1.5); opacity: 0; }
}

/* ---------- Toast Notifications ---------- */
.toast-container {
  position: fixed;
  top: 1.5rem;
  right: 1.5rem;
  z-index: 10000;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  pointer-events: none;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  min-width: 320px;
  max-width: 420px;
  box-shadow: var(--shadow-xl);
  backdrop-filter: blur(16px);
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  pointer-events: auto;
  animation: toastIn 0.35s ease forwards;
  transition: all var(--transition-base);
}

.toast.removing {
  animation: toastOut 0.3s ease forwards;
}

.toast.success {
  border-left: 3px solid var(--status-green);
}

.toast.error {
  border-left: 3px solid var(--status-red);
}

.toast.info {
  border-left: 3px solid var(--accent-blue);
}

.toast.warning {
  border-left: 3px solid var(--status-yellow);
}

.toast-icon {
  font-size: 1.125rem;
  flex-shrink: 0;
  margin-top: 0.125rem;
}

.toast.success .toast-icon { color: var(--status-green); }
.toast.error .toast-icon { color: var(--status-red); }
.toast.info .toast-icon { color: var(--accent-blue); }
.toast.warning .toast-icon { color: var(--status-yellow); }

.toast-content {
  flex: 1;
}

.toast-title {
  font-weight: 600;
  font-size: 0.875rem;
  margin-bottom: 0.125rem;
}

.toast-message {
  font-size: 0.8125rem;
  color: var(--text-secondary);
}

.toast-close {
  background: none;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1rem;
  padding: 0;
  flex-shrink: 0;
  transition: color var(--transition-fast);
}

.toast-close:hover {
  color: var(--text-primary);
}

@keyframes toastIn {
  from {
    opacity: 0;
    transform: translateX(100%);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

@keyframes toastOut {
  from {
    opacity: 1;
    transform: translateX(0);
  }
  to {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ---------- Modal ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(6px);
  z-index: 5000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  pointer-events: none;
  transition: opacity var(--transition-base);
}

.modal-overlay.active {
  opacity: 1;
  pointer-events: auto;
}

.modal {
  background: var(--bg-secondary);
  border: 1px solid var(--border-glass);
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  width: 100%;
  max-width: 640px;
  max-height: 90vh;
  overflow-y: auto;
  transform: scale(0.95) translateY(10px);
  transition: transform var(--transition-base);
}

.modal-overlay.active .modal {
  transform: scale(1) translateY(0);
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.5rem;
  border-bottom: 1px solid var(--border-glass);
}

.modal-header h3 {
  font-size: 1.125rem;
  font-weight: 700;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-top: 1px solid var(--border-glass);
}

.modal-lg {
  max-width: 800px;
}

/* ---------- Table ---------- */
.data-table {
  width: 100%;
  border-collapse: collapse;
}

.data-table thead th {
  text-align: left;
  padding: 0.875rem 1rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  border-bottom: 1px solid var(--border-glass);
  white-space: nowrap;
}

.data-table tbody tr {
  border-bottom: 1px solid rgba(255, 255, 255, 0.04);
  transition: background var(--transition-fast);
}

.data-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.data-table tbody td {
  padding: 0.875rem 1rem;
  font-size: 0.875rem;
  color: var(--text-secondary);
  white-space: nowrap;
}

/* ---------- Stat Cards ---------- */
.stat-card {
  position: relative;
  overflow: hidden;
}

.stat-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 3px;
  border-radius: 3px 3px 0 0;
}

.stat-card.cyan::before { background: var(--accent-gradient); }
.stat-card.blue::before { background: linear-gradient(90deg, #3b82f6, #6366f1); }
.stat-card.green::before { background: linear-gradient(90deg, #10b981, #34d399); }
.stat-card.red::before { background: linear-gradient(90deg, #ef4444, #f97316); }

/* ---------- Sidebar ---------- */
.sidebar {
  width: 260px;
  min-height: 100vh;
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-glass);
  transition: transform var(--transition-slow);
  position: fixed;
  left: 0;
  top: 0;
  z-index: 100;
}

.sidebar-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 99;
  display: none;
}

@media (max-width: 1023px) {
  .sidebar {
    transform: translateX(-100%);
  }

  .sidebar.open {
    transform: translateX(0);
  }

  .sidebar-overlay.open {
    display: block;
  }
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  color: var(--text-secondary);
  font-size: 0.9375rem;
  font-weight: 500;
  border-radius: var(--radius-md);
  margin: 0.25rem 0.75rem;
  transition: all var(--transition-fast);
  text-decoration: none;
  cursor: pointer;
}

.sidebar-link:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.sidebar-link.active {
  background: rgba(6, 182, 212, 0.1);
  color: var(--accent-cyan);
}

/* ---------- Pagination ---------- */
.pagination {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.page-btn {
  width: 2.25rem;
  height: 2.25rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: transparent;
  color: var(--text-secondary);
  font-size: 0.875rem;
  cursor: pointer;
  transition: all var(--transition-fast);
}

.page-btn:hover {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-primary);
}

.page-btn.active {
  background: var(--accent-gradient);
  color: white;
  border-color: transparent;
}

.page-btn:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}

/* ---------- Page Transitions ---------- */
.page-enter {
  animation: pageEnter 0.5s ease forwards;
}

@keyframes pageEnter {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.4s ease forwards;
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

.slide-up {
  animation: slideUp 0.5s ease forwards;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(30px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

/* ---------- Misc ---------- */
.divider {
  height: 1px;
  background: var(--border-glass);
  margin: 1rem 0;
}

.badge-count {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 1.25rem;
  height: 1.25rem;
  padding: 0 0.375rem;
  border-radius: 9999px;
  background: var(--status-red);
  color: white;
  font-size: 0.6875rem;
  font-weight: 700;
}

/* Error state */
.error-state {
  text-align: center;
  padding: 3rem 1.5rem;
}

.error-state svg {
  width: 64px;
  height: 64px;
  margin: 0 auto 1.5rem;
  color: var(--text-muted);
}

/* ---------- Responsive ---------- */
@media (max-width: 767px) {
  .toast-container {
    top: auto;
    bottom: 1rem;
    right: 1rem;
    left: 1rem;
  }

  .toast {
    min-width: auto;
    max-width: 100%;
  }

  .modal {
    max-height: 85vh;
    margin: 0.5rem;
  }

  .data-table {
    display: block;
    overflow-x: auto;
  }

  #trackingMap {
    min-height: 350px;
  }
}

@media (max-width: 639px) {
  .input-search {
    font-size: 0.9375rem;
    padding: 1rem 1.25rem;
    padding-right: 3.5rem;
  }
}

/* ---------- Utility animations ---------- */
.hover-lift {
  transition: transform var(--transition-base), box-shadow var(--transition-base);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-lg);
}

/* Number counter animation helper */
.count-up {
  display: inline-block;
}

/* Select dropdown dark */
.select-dark {
  appearance: none;
  background: rgba(15, 23, 42, 0.8);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--radius-md);
  color: var(--text-primary);
  padding: 0.75rem 2.5rem 0.75rem 1rem;
  font-family: var(--font-sans);
  font-size: 0.9375rem;
  width: 100%;
  cursor: pointer;
  outline: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' fill='%2394a3b8' viewBox='0 0 16 16'%3E%3Cpath d='M4.646 5.646a.5.5 0 0 1 .708 0L8 8.293l2.646-2.647a.5.5 0 0 1 .708.708l-3 3a.5.5 0 0 1-.708 0l-3-3a.5.5 0 0 1 0-.708z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  transition: border-color var(--transition-base), box-shadow var(--transition-base);
}

.select-dark:focus {
  border-color: var(--accent-cyan);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.select-dark option {
  background: var(--bg-secondary);
  color: var(--text-primary);
}

/* ---------- Stepper styles ---------- */
.stepper-item {
  position: relative;
  padding-left: 3.5rem;
  padding-bottom: 2rem;
  opacity: 0;
  transform: translateY(10px);
  animation: timelineSlideIn 0.5s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.stepper-item:last-child {
  padding-bottom: 0;
}

.stepper-icon-container {
  position: absolute;
  left: 0;
  top: 0;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2;
  transition: all var(--transition-base);
  border: 2px solid rgba(255, 255, 255, 0.1);
  background: var(--bg-secondary);
}

.stepper-item.completed .stepper-icon-container {
  background: var(--status-green);
  border-color: var(--status-green);
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.3);
}

.stepper-item.current .stepper-icon-container {
  background: var(--accent-cyan);
  border-color: var(--accent-cyan);
  box-shadow: 0 0 16px rgba(255, 87, 34, 0.4);
  animation: pulseBrand 2s infinite;
}

.stepper-item.delayed .stepper-icon-container {
  background: var(--status-red);
  border-color: var(--status-red);
  box-shadow: 0 0 12px rgba(239, 68, 68, 0.3);
}

.stepper-item.pending .stepper-icon-container {
  background: var(--bg-tertiary);
  border-color: rgba(255, 255, 255, 0.15);
}

.stepper-line {
  position: absolute;
  left: 1.0625rem;
  top: 2.25rem;
  bottom: 0;
  width: 2px;
  background: rgba(255, 255, 255, 0.08);
  z-index: 1;
}

.stepper-item:last-child .stepper-line {
  display: none;
}

@keyframes pulseBrand {
  0% {
    box-shadow: 0 0 0 0 rgba(255, 87, 34, 0.4);
  }
  70% {
    box-shadow: 0 0 0 10px rgba(255, 87, 34, 0);
  }
  100% {
    box-shadow: 0 0 0 0 rgba(255, 87, 34, 0);
  }
}
