/* ==========================================================================
   CHOW45 LIVE MAPBOX ORDER TRACKING
   Real-time dispatch visualization, custom markers, timeline drawer
   ========================================================================== */

.tracking-screen {
  display: flex;
  flex-direction: column;
  height: calc(100vh - 120px);
  min-height: 520px;
  position: relative;
  border-radius: var(--radius-card);
  overflow: hidden;
  border: 1px solid var(--c-border);
  box-shadow: none;
  background: var(--c-bg-surface);
}

/* Map Container */
.map-viewport {
  width: 100%;
  height: 100%;
  flex: 1;
  position: relative;
  background: #E5E7EB;
}

/* Mapbox GL Map Canvas */
#mapbox-canvas {
  width: 100%;
  height: 100%;
}

/* Custom Marker Styling */
.marker-pin {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 44px;
  height: 44px;
  border-radius: 50%;
  background: white;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
  border: 2px solid white;
  position: relative;
  cursor: pointer;
  transition: transform var(--transition-snappy);
}
.marker-pin:hover {
  transform: scale(1.1);
}

.marker-store {
  background: var(--c-accent);
  color: white;
}
.marker-customer {
  background: var(--c-secondary);
  color: white;
}
.marker-rider {
  background: var(--c-primary);
  color: #ffffff;
  border: 3px solid white;
  z-index: 10;
}

/* Radar Pulse for Rider */
.marker-rider::after {
  content: '';
  position: absolute;
  inset: -6px;
  border-radius: 50%;
  background: rgba(3, 139, 92, 0.35);
  animation: radarPulse 1.8s infinite cubic-bezier(0.2, 0.8, 0.2, 1);
  z-index: -1;
}

@keyframes radarPulse {
  0% {
    transform: scale(0.8);
    opacity: 0.9;
  }
  100% {
    transform: scale(2.4);
    opacity: 0;
  }
}

/* Floating Status Overlay Drawer */
.tracking-overlay-card {
  position: absolute;
  bottom: 16px;
  left: 16px;
  right: 16px;
  max-width: 480px;
  margin: 0 auto;
  background: rgba(255, 255, 255, 0.98);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--c-border);
  border-radius: var(--radius-card);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
  padding: var(--space-20);
  z-index: 20;
}

.tracking-header-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-12);
  margin-bottom: var(--space-12);
}

.status-headline {
  font-family: var(--font-display);
  font-size: 1.2rem;
  font-weight: 600;
  color: var(--c-text-primary);
  line-height: 1.2;
}
.status-eta-pill {
  background: var(--c-primary-surface);
  color: var(--c-primary);
  font-size: 0.78rem;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: var(--radius-pill);
  white-space: nowrap;
}

.status-subtext {
  font-size: 0.85rem;
  color: var(--c-text-secondary);
  line-height: 1.4;
  margin-bottom: var(--space-16);
}

/* Progress Step Bar */
.tracking-stepper {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-bottom: var(--space-16);
}
.stepper-segment {
  flex: 1;
  height: 6px;
  background: var(--c-border-subtle);
  border-radius: var(--radius-pill);
  transition: background var(--transition-smooth);
}
.stepper-segment.completed {
  background: var(--c-primary);
}
.stepper-segment.active {
  background: var(--c-accent);
}

/* Rider Info Profile */
.rider-dispatch-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--c-bg-subtle);
  border-radius: var(--radius-lg);
  padding: 10px 14px;
  margin-bottom: var(--space-12);
}
.rider-avatar-wrap {
  display: flex;
  align-items: center;
  gap: var(--space-12);
}
.rider-avatar {
  width: 42px;
  height: 42px;
  border-radius: 50%;
  object-fit: cover;
  border: 2px solid white;
}
.rider-name {
  font-size: 0.9rem;
  font-weight: 800;
  color: var(--c-text-primary);
}
.rider-rating {
  font-size: 0.75rem;
  color: var(--c-text-secondary);
  display: flex;
  align-items: center;
  gap: 3px;
}

.rider-action-btn {
  border: none;
  background: var(--c-bg-surface);
  color: var(--c-primary);
  width: 38px;
  height: 38px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-xs);
  cursor: pointer;
  transition: transform var(--transition-snappy);
}
.rider-action-btn:hover {
  transform: scale(1.08);
}

/* Delivery Verification PIN Box */
.pin-security-box {
  background: var(--c-accent-soft);
  border: 1px dashed rgba(255, 184, 0, 0.7);
  border-radius: var(--radius-md);
  padding: 8px 12px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 0.8rem;
  color: #7A5100;
  font-weight: 600;
}
.pin-code {
  font-family: monospace;
  font-size: 1.1rem;
  font-weight: 800;
  letter-spacing: 2px;
  color: #072B1F;
}

/* Back to Shopping button */
.tracking-back-btn {
  border: none;
  background: transparent;
  color: var(--c-primary);
  font-size: 0.82rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  margin-top: 8px;
}
.tracking-back-btn:hover {
  text-decoration: underline;
}

/* -------------------------------------------------------------
   Mobile Tracking Overlay Optimization
   ------------------------------------------------------------- */
@media (max-width: 640px) {
  .tracking-screen {
    height: calc(100dvh - 120px);
    min-height: 460px;
    border-radius: var(--radius-lg);
  }

  .tracking-overlay-card {
    bottom: 8px;
    left: 8px;
    right: 8px;
    padding: 14px;
    border-radius: var(--radius-lg);
    max-height: 52vh;
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;
  }

  .status-headline {
    font-size: 1.1rem;
  }
  .status-subtext {
    font-size: 0.78rem;
    margin-bottom: 8px;
  }
  .status-eta-pill {
    font-size: 0.72rem;
    padding: 3px 8px;
  }

  .rider-dispatch-card {
    padding: 8px 10px;
    margin-bottom: 8px;
  }
  .rider-avatar {
    width: 36px;
    height: 36px;
  }
  .rider-name {
    font-size: 0.82rem;
  }
  .rider-rating {
    font-size: 0.7rem;
  }
  .rider-action-btn {
    width: 32px;
    height: 32px;
  }
  .rider-action-btn svg {
    width: 15px;
    height: 15px;
  }

  .pin-security-box {
    padding: 6px 10px;
    font-size: 0.74rem;
  }
  .pin-code {
    font-size: 0.98rem;
  }
}
