:root {
  --primary-color: #2563eb;
  --success-color: #16a34a;
  --success-bg: #f0fdf4;
  --active-color: #1d4ed8;
  --active-bg: #eff6ff;
  --active-bg-halo: rgba(37, 99, 235, 0.15);
  --muted-color: #94a3b8;
  --muted-border: #cbd5e1;
  --danger-color: #ef4444;
  --danger-bg-faded: rgba(239, 68, 68, 0.08);
  --danger-border-faded: rgba(239, 68, 68, 0.3);
  --pending-bg: #f1f5f9;
  --pending-color: #0f172a;
  --processing-bg: #eff6ff;
  --processing-color: #1d4ed8;
  --awaiting-pickup-bg: #eef2ff;
  --awaiting-pickup-color: #3730a3;
  --in-transit-bg: #dcfce7;
  --in-transit-color: #166534;
  --arrived-at-facility-bg: #e0f2fe;
  --arrived-at-facility-color: #1d4ed8;
  --customs-clearance-bg: #fef3c7;
  --customs-clearance-color: #92400e;
  --held-at-airport-bg: #ede9fe;
  --held-at-airport-color: #6d28d9;
  --held-at-customs-bg: #fee2e2;
  --held-at-customs-color: #b91c1c;
  --on-hold-bg: #fef2f2;
  --on-hold-color: #991b1b;
  --out-for-delivery-bg: #dcfce7;
  --out-for-delivery-color: #166534;
  --delivered-bg: #ecfdf5;
  --delivered-color: #15803d;
  --delayed-bg: #fef3c7;
  --delayed-color: #a16207;
  --damaged-in-transit-bg: #fee2e2;
  --damaged-in-transit-color: #b91c1c;
  --returned-bg: #e2e8f0;
  --returned-color: #334155;
  --cancelled-bg: #f8d7da;
  --cancelled-color: #842029;
  --bg-light: #f8fafc;
  --border-color: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  font-family:
    -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial,
    sans-serif;
}

body {
  background-color: var(--bg-light);
  color: var(--text-main);
  overflow-x: hidden;
  overflow-y: auto;
  scrollbar-width: none;
  -ms-overflow-style: none;
  -webkit-touch-callout: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
  user-select: none;
}

input,
textarea,
[contenteditable="true"],
[contenteditable=""],
.allow-select {
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
  user-select: text;
}

html {
  scrollbar-width: none;
  -ms-overflow-style: none;
}

body::-webkit-scrollbar,
html::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}

/* --- STEP 1: PORTAL HERO LANDING PAGE --- */
.tracking-portal-container {
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  width: 100vw;
  background: none;
  position: absolute;
  top: 0;
  left: 0;
  z-index: 10000;
  transition:
    opacity 0.5s ease,
    visibility 0.5s ease;
  padding: 0;
  overflow-y: auto;
}

.tracking-portal-container.track-page {
  height: 100dvh;
  min-height: 100dvh;
  justify-content: flex-end;
  overflow: hidden;
  background:
    linear-gradient(rgba(15, 32, 67, 0.85), rgba(10, 20, 41, 0.95)),
    url("https://images.unsplash.com/photo-1501594907352-04cda38ebc29?q=80&w=1920&auto=format&fit=crop")
      no-repeat center center;
  background-size: cover;
}

.tracking-portal-container.hidden {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

/* Center card wrapper */
.portal-hero-main {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-grow: 1;
  padding: 0 24px;
}
.tracking-portal-container.track-page .portal-hero-main {
  position: absolute;
  inset: 0;
  z-index: 1;
  width: 100%;
  height: 100dvh;
  min-height: 100dvh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 0 24px;
}

.tracking-portal-container.track-page .portal-footer {
  position: relative;
  z-index: 2;
}

.tracking-card {
  background: #f4f6f8;
  border-radius: 36px;
  width: min(100%, 500px);
  max-width: 500px;
  padding: 28px 28px 10px;
  text-align: center;
  box-shadow: none;
}

@media (max-width: 640px) {
  .tracking-card {
    padding: 24px 24px 10px;
    border-radius: 28px;
  }
}

.tracking-card h2 {
  font-size: 1.95rem;
  font-weight: 800;
  color: #152238;
  margin-bottom: 10px;
  letter-spacing: -0.5px;
}

.tracking-card p {
  font-size: 0.95rem;
  color: #64748b;
  margin-bottom: 14px;
  font-weight: 500;
}

/* Combined input bar container - Compact design */
.tracking-form-capsule {
  background: #ffffff;
  border-radius: 14px;
  padding: 4px;
  display: flex;
  align-items: center;
  box-shadow: none;
  border: 1px solid #e2e8f0;
  position: relative;
  max-width: 410px;
  margin: 0 auto;
}

.tracking-form-capsule.focused {
  border-color: #2563eb;
  box-shadow: none;
}

.tracking-input {
  width: 100%;
  border: none;
  outline: none;
  padding: 8px 10px;
  font-size: 0.88rem;
  font-weight: 600;
  color: #152238;
  background: transparent;
}

.tracking-input::placeholder {
  color: #94a3b8;
  text-transform: none;
}

/* Stable Button layout to prevent shrinking when loading */
.tracking-btn {
  background-color: #2563eb;
  color: #ffffff;
  border: none;
  border-radius: 10px;
  padding: 10px 24px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition:
    background-color 0.2s,
    transform 0.1s;
  flex-shrink: 0;
  min-width: 112px; /* Stable width safeguards footprint */
  height: 38px;
}

.tracking-btn:hover {
  background-color: #1d4ed8;
}

.tracking-btn:active {
  transform: scale(0.97);
}

/* 3-Dot Bouncing Loader styling */
.three-dots-loader {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 4px;
  height: 100%;
}

.three-dots-loader .dot {
  width: 6px;
  height: 6px;
  background-color: #ffffff;
  border-radius: 50%;
  animation: dotBounce 1.4s infinite ease-in-out both;
}

.three-dots-loader .dot:nth-child(1) {
  animation-delay: -0.32s;
}
.three-dots-loader .dot:nth-child(2) {
  animation-delay: -0.16s;
}

@keyframes dotBounce {
  0%,
  80%,
  100% {
    transform: scale(0);
  }
  40% {
    transform: scale(1);
  }
}

.tracking-btn.loading .btn-text,
.tracking-btn.loading i {
  display: none;
}

.tracking-btn.loading .three-dots-loader {
  display: flex;
}

.error-message {
  color: var(--danger-color);
  font-size: 0.8rem;
  font-weight: 600;
  margin-top: 10px;
  text-align: left;
  display: flex;
  align-items: center;
  gap: 6px;
  max-width: 410px;
  margin-left: auto;
  margin-right: auto;
  min-height: 1rem;
  visibility: hidden;
  opacity: 0;
  pointer-events: none;
}

.error-message.show {
  visibility: visible;
  opacity: 1;
  pointer-events: auto;
}

.error-message i {
  font-size: 0.95rem;
  flex-shrink: 0;
}

/* --- STEP 2: DASHBOARD LAYOUT STRUCTURE --- */
.app-container {
  display: flex;
  flex-direction: row-reverse; /* Puts content on the left, map on the right on desktop */
  height: 100vh;
  width: 100vw;
  position: relative;
  opacity: 0;
  transition: opacity 0.5s ease;
}

.app-container.visible {
  opacity: 1;
}

/* Map Column */
.map-section {
  flex: 1;
  position: relative;
  background-color: #e0f2fe;
  height: 100%;
}

#map {
  width: 100%;
  height: 100%;
  z-index: 1;
}

/* --- GALLERY CONTAINER & OVERLAY --- */
.map-image-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 50;
  background-color: #000000;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.4s ease,
    visibility 0.4s ease;
  overflow: hidden;
}

.map-image-overlay.active {
  opacity: 1;
  visibility: visible;
}

.gallery-slide {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  opacity: 0;
  transition: opacity 0.3s linear;
}

.gallery-slide.active {
  opacity: 1;
}

.gallery-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(255, 255, 255, 0.9);
  border: none;
  border-radius: 50%;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  cursor: pointer;
  z-index: 60;
  transition:
    transform 0.1s ease,
    background 0.2s ease;
}

.gallery-arrow:active {
  transform: translateY(-50%) scale(0.92);
}

.gallery-arrow:hover {
  background: #ffffff;
}

.gallery-arrow i {
  font-size: 24px;
  color: var(--text-main);
}

.gallery-arrow.prev {
  left: 20px;
}
.gallery-arrow.next {
  right: 20px;
}

.gallery-fullscreen-trigger {
  position: absolute;
  bottom: 24px;
  right: 24px;
  z-index: 65;
  background: rgba(15, 23, 42, 0.85);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.15);
  color: #ffffff;
  padding: 10px 16px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  transition:
    transform 0.1s ease,
    background-color 0.2s ease;
  box-shadow: none;
}

.gallery-fullscreen-trigger:hover {
  background: rgba(15, 23, 42, 0.95);
}

.gallery-fullscreen-trigger:active {
  transform: scale(0.95);
}

/* --- WHITE BACKDROP MODAL SYSTEM --- */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(255, 255, 255, 0.96);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  visibility: hidden;
  transition:
    opacity 0.3s cubic-bezier(0.25, 1, 0.5, 1),
    visibility 0.3s;
}

.modal-overlay.active {
  opacity: 1;
  visibility: visible;
}

.modal-close-btn {
  position: absolute;
  top: 24px;
  right: 24px;
  background: rgba(15, 23, 42, 0.05);
  border: 1px solid rgba(15, 23, 42, 0.1);
  color: var(--text-main);
  width: 48px;
  height: 48px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition:
    background-color 0.2s,
    transform 0.1s;
  z-index: 100001;
}

.modal-close-btn:hover {
  background: rgba(15, 23, 42, 0.1);
}
.modal-close-btn:active {
  transform: scale(0.92);
}

.modal-arrow {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  background: #ffffff;
  border: 1px solid var(--border-color);
  border-radius: 50%;
  width: 48px;
  height: 48px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  cursor: pointer;
  z-index: 100000;
  transition:
    transform 0.1s ease,
    background-color 0.2s ease;
}

.modal-arrow:active {
  transform: translateY(-50%) scale(0.92);
}
.modal-arrow:hover {
  background: #f8fafc;
}
.modal-arrow.prev {
  left: 24px;
}
.modal-arrow.next {
  right: 24px;
}

.modal-image-container {
  max-width: 90%;
  max-height: 85%;
  transform: scale(0.9);
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  border-radius: 12px;
  overflow: hidden;
  box-shadow: none;
  z-index: 99999;
}

.modal-overlay.active .modal-image-container {
  transform: scale(1);
}

.modal-img {
  display: block;
  max-width: 100%;
  max-height: 85vh;
  object-fit: contain;
}

/* Hide Leaflet Routing Machine text boxes */
.leaflet-routing-container {
  display: none !important;
}

/* --- MINIMALISTIC MAP LOADER SYSTEM --- */
.map-loader {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: #ffffff;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  transition:
    opacity 0.4s cubic-bezier(0.25, 1, 0.5, 1),
    visibility 0.4s;
}

.map-loader.hidden {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.spinner-minimal {
  width: 32px;
  height: 32px;
  border: 2px solid #f1f5f9;
  border-top: 2px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 0.65s linear infinite;
}

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

.map-header {
  position: absolute;
  top: 20px;
  left: 20px;
  right: 20px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
}

.map-btn {
  position: absolute;
  background: white;
  border: none;
  border-radius: 16px;
  width: 48px;
  height: 48px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: none;
  cursor: pointer;
  pointer-events: auto;
  transition: transform 0.1s ease;
}

.map-btn.btn-left {
  left: 0;
}
.map-btn.btn-right {
  right: 0;
}
.map-btn:active {
  transform: scale(0.95);
}
.map-btn.loading {
  opacity: 0.7;
  pointer-events: none;
  cursor: wait;
}
.map-btn.loading i {
  display: none;
}

.map-btn.loading::before {
  content: "";
  width: 20px;
  height: 20px;
  border: 2px solid rgba(15, 23, 42, 0.15);
  border-top-color: #2563eb;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  display: inline-block;
}
.map-btn i {
  font-size: 24px;
  color: #0f172a;
  line-height: 1;
}

.live-map-badge {
  background: white;
  height: 32px;
  width: 160px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 30px;
  font-weight: 700;
  font-size: 0.8rem;
  line-height: 1;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #1e293b;
  box-shadow: none;
  white-space: nowrap;
  pointer-events: auto;
  text-align: center;
}

/* Info Column */
.info-section {
  width: 450px;
  background: white;
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 200;
}

/* --- DETAIL COMPONENTS --- */
.sheet-header {
  padding: 24px;
  border-bottom: 1px dashed var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  background: white;
  flex-shrink: 0;
}

.drag-handle-container {
  display: none;
  width: 100%;
  padding: 12px 0;
  cursor: grab;
  user-select: none;
  touch-action: none;
  background: white;
  flex-shrink: 0;
  justify-content: center;
}

.drag-handle {
  width: 46px;
  height: 5px;
  background: #d1d5db;
  border-radius: 999px;
  margin: 0 auto;
  box-shadow: inset 0 0 0 1px rgba(15, 23, 42, 0.08);
}

.ptr-refresh-indicator {
  display: none;
  flex-direction: column;
  gap: 8px;
  padding: 0 20px 12px 20px;
  opacity: 0;
  transform: translateY(-4px);
  transition:
    opacity 0.18s ease,
    transform 0.18s ease;
}
.ptr-refresh-indicator.active {
  display: flex;
  opacity: 1;
  transform: translateY(0);
}
.ptr-refresh-text {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-align: center;
}
.ptr-refresh-bar {
  width: 100%;
  height: 6px;
  background: #e2e8f0;
  border-radius: 999px;
  overflow: hidden;
}
.ptr-refresh-progress {
  width: 0%;
  height: 100%;
  background: var(--primary-color);
  transition: width 0.1s ease;
}

.id-group {
  font-size: 1.15rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-main);
  word-break: break-all;
}

.id-label {
  color: var(--text-muted);
}
.id-value {
  color: var(--text-main);
}

.status-pill {
  background-color: var(--danger-bg-faded);
  color: var(--danger-color);
  border: 1px solid var(--danger-border-faded);
  padding: 5px 14px;
  border-radius: 14px;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.3px;
  flex-shrink: 0;
  line-height: 1;
}

.status-pill.pending {
  background-color: var(--pending-bg);
  color: var(--pending-color);
  border-color: rgba(148, 163, 184, 0.35);
}

.status-pill.processing {
  background-color: var(--processing-bg);
  color: var(--processing-color);
  border-color: rgba(59, 130, 246, 0.35);
}

.status-pill.awaiting-pickup {
  background-color: var(--awaiting-pickup-bg);
  color: var(--awaiting-pickup-color);
  border-color: rgba(59, 130, 246, 0.35);
}

.status-pill.in-transit {
  background-color: var(--in-transit-bg);
  color: var(--in-transit-color);
  border-color: rgba(22, 101, 52, 0.35);
}

.status-pill.arrived-at-facility {
  background-color: var(--arrived-at-facility-bg);
  color: var(--arrived-at-facility-color);
  border-color: rgba(29, 78, 216, 0.35);
}

.status-pill.customs-clearance {
  background-color: var(--customs-clearance-bg);
  color: var(--customs-clearance-color);
  border-color: rgba(217, 119, 6, 0.35);
}

.status-pill.held-at-airport,
.status-pill.held-at-customs,
.status-pill.on-hold,
.status-pill.hold-status {
  background-color: rgba(254, 226, 226, 0.95);
  color: var(--danger-color);
  border-color: rgba(239, 68, 68, 0.35);
  animation: status-blink 0.85s linear infinite;
  box-shadow: 0 0 0 2px rgba(239, 68, 68, 0.08);
}

@keyframes status-blink {
  0%,
  100% {
    opacity: 1;
    transform: translateY(0);
  }
  50% {
    opacity: 0.3;
    transform: translateY(-1px);
  }
}

.status-pill.out-for-delivery {
  background-color: var(--out-for-delivery-bg);
  color: var(--out-for-delivery-color);
  border-color: rgba(22, 101, 52, 0.35);
}

.status-pill.delivered {
  background-color: var(--delivered-bg);
  color: var(--delivered-color);
  border-color: rgba(21, 128, 61, 0.35);
}

.status-pill.delayed {
  background-color: var(--delayed-bg);
  color: var(--delayed-color);
  border-color: rgba(161, 98, 7, 0.35);
}

.status-pill.damaged-in-transit {
  background-color: var(--damaged-in-transit-bg);
  color: var(--damaged-in-transit-color);
  border-color: rgba(185, 28, 28, 0.35);
}

.status-pill.returned {
  background-color: var(--returned-bg);
  color: var(--returned-color);
  border-color: rgba(51, 65, 85, 0.35);
}

.status-pill.cancelled {
  background-color: var(--cancelled-bg);
  color: var(--cancelled-color);
  border-color: rgba(132, 32, 41, 0.35);
}

.status-pill.success {
  background-color: var(--success-bg);
  color: var(--success-color);
  border-color: var(--success-color);
}

.content-block {
  padding: 20px 24px;
  overflow-y: auto;
  flex: 1;
  scrollbar-width: none;
  -ms-overflow-style: none;
}

.content-block::-webkit-scrollbar {
  display: none;
}

/* Current Location Section */
.location-banner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--bg-light);
  border: 1px solid var(--border-color);
  padding: 12px 16px;
  border-radius: 12px;
  margin-bottom: 20px;
}

.location-meta {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
}

.loc-icon {
  background: #dbeafe;
  color: var(--primary-color);
  padding: 8px;
  border-radius: 50%;
  font-size: 1.2rem;
  flex-shrink: 0;
}

.location-text {
  word-break: break-word;
  overflow-wrap: break-word;
  flex: 1;
}

.location-text p {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

.location-text h4 {
  font-size: 0.9rem;
  font-weight: 600;
  transition: color 0.2s ease;
  min-height: 1.2rem;
  display: flex;
  align-items: center;
}

/* --- SKELETON LOADER ANIMATION --- */
.skeleton-loader {
  display: inline-block;
  height: 14px;
  width: 100%;
  max-width: 180px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 4px;
}

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

.details-loading .skeleton-placeholder {
  position: relative;
  display: inline-block;
  width: 100%;
  min-height: 1.2em;
  color: transparent;
}

.details-loading .skeleton-placeholder::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 4px;
}

/* --- STYLIZED TIMELINE CARD CONTAINER --- */
.timeline-card-container {
  background-color: var(--bg-light);
  border: 1px solid var(--border-color);
  border-radius: 20px;
  padding: 30px 12px 24px 12px;
  margin-bottom: 24px;
}

.timeline {
  display: flex;
  justify-content: space-between;
  position: relative;
}

.timeline::before {
  content: "";
  position: absolute;
  top: clamp(16px, 4.5vw, 23px);
  left: 12.5%;
  right: 12.5%;
  height: 3px;
  background-color: #e2e8f0;
  z-index: 1;
}

.timeline-progress {
  position: absolute;
  top: clamp(16px, 4.5vw, 23px);
  left: 12.5%;
  width: 0%;
  height: 3px;
  background-color: var(--active-color);
  z-index: 2;
  transition: width 1.5s cubic-bezier(0.25, 1, 0.5, 1);
}

.timeline-step {
  position: relative;
  z-index: 3;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 10px;
  width: 25%;
}

.step-icon {
  width: clamp(32px, 9vw, 46px);
  height: clamp(32px, 9vw, 46px);
  border-radius: 50%;
  background-color: white;
  border: 2px solid var(--muted-border);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.step-icon svg {
  width: clamp(14px, 4.5vw, 22px);
  height: clamp(14px, 4.5vw, 22px);
}

.timeline-step span {
  font-size: clamp(0.7rem, 2.2vw, 0.85rem);
  font-weight: 600;
  color: #64748b;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  padding: 0 2px;
  transition: all 0.3s ease;
}

.timeline-step.completed .step-icon {
  border-color: var(--active-color);
  background-color: var(--active-bg);
  color: var(--active-color);
}
.timeline-step.completed span {
  color: var(--active-color);
}

.timeline-step.pending .step-icon {
  border-color: var(--muted-border);
  background-color: #ffffff;
  color: var(--muted-color);
}
.timeline-step.pending span {
  color: var(--muted-color);
}

.timeline-step.active .step-icon {
  border-color: var(--success-color);
  background-color: white;
  color: var(--success-color);
  box-shadow: none;
}
.timeline-step.active span {
  color: var(--success-color);
  font-weight: 700;
}

.timeline-step.completed .step-icon,
.timeline-step.active .step-icon,
.timeline-step.pending .step-icon {
  transition:
    border-color 0.3s ease,
    background-color 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease;
}

.timeline-step.completed .step-icon,
.timeline-step.active .step-icon {
  transition:
    border-color 0.3s ease,
    background-color 0.3s ease,
    color 0.3s ease,
    box-shadow 0.3s ease;
}

.details-loading .timeline {
  opacity: 0.55;
}

.details-loading .timeline::before,
.details-loading .timeline-progress {
  background-color: #e2e8f0;
}

.details-loading .timeline-progress {
  width: 0 !important;
  transition: none;
}

.details-loading .timeline-step span {
  color: transparent;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
  border-radius: 8px;
  display: inline-block;
  width: 80%;
  min-height: 0.9rem;
}

.details-loading .timeline-step .step-icon {
  border-color: #e2e8f0;
  background: #f8fafc;
}

.details-loading .timeline-step .step-icon svg {
  opacity: 0;
}

.details-loading .location-text h4 {
  position: relative;
  display: inline-block;
  width: 100%;
  min-height: 1.2rem;
  color: transparent;
}

.details-loading .location-text h4::after {
  content: "";
  position: absolute;
  inset: 0;
  max-width: 180px;
  border-radius: 8px;
  background: linear-gradient(90deg, #e2e8f0 25%, #f1f5f9 50%, #e2e8f0 75%);
  background-size: 200% 100%;
  animation: shimmer 1.5s infinite linear;
}

.time-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 20px;
}

.info-card {
  background-color: var(--bg-light);
  border-radius: 12px;
  padding: 16px;
  border: 1px solid var(--border-color);
  word-break: break-word;
  overflow-wrap: break-word;
}

.card-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}
.card-value {
  font-size: 0.9rem;
  font-weight: 600;
}

.section-title {
  font-size: 0.85rem;
  text-transform: uppercase;
  font-weight: 700;
  color: var(--primary-color);
  letter-spacing: 0.5px;
  margin-top: 24px;
  margin-bottom: 12px;
}

.contact-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.snapshot-preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(96px, 1fr));
  gap: 10px;
}

.snapshot-preview-tile {
  width: 100%;
  aspect-ratio: 1 / 1;
  padding: 0;
  border: 0;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  background: transparent;
}

.snapshot-preview-tile img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Overlay and CTA for snapshot tiles */
.snapshot-preview-tile {
  position: relative;
}

.snapshot-preview-tile .snapshot-overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.62); /* darker by default */
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  transition:
    background 180ms ease,
    opacity 180ms ease;
  pointer-events: none; /* allow clicks to pass to the button */
}

.snapshot-preview-tile:hover .snapshot-overlay {
  background: rgba(0, 0, 0, 0.84); /* stronger on hover */
}

.snapshot-preview-tile .open-cta {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #fff;
  padding: 6px 10px;
  border-radius: 8px;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  gap: 8px;
  align-items: center;
}

.snapshot-preview-tile .snapshot-count {
  position: absolute;
  right: 8px;
  bottom: 8px;
  background: rgba(0, 0, 0, 0.6);
  color: #fff;
  padding: 6px 8px;
  border-radius: 14px;
  font-weight: 700;
  font-size: 0.85rem;
  display: inline-flex;
  gap: 6px;
  align-items: center;
}

.snapshot-preview-tile .snapshot-count svg {
  width: 14px;
  height: 14px;
  stroke: #fff;
}

/* Disabled arrow state for gallery controls */
.gallery-arrow.disabled,
.modal-arrow.disabled {
  opacity: 0.36;
  pointer-events: none;
}

.grid-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
  min-width: 0;
}

.grid-item span {
  font-size: 0.75rem;
  color: var(--text-muted);
}
.grid-item p {
  font-size: 0.9rem;
  font-weight: 600;
  word-wrap: break-word;
  word-break: break-word;
  overflow-wrap: break-word;
}

/* --- CUSTOM MAP MARKERS STYLING --- */
.leaflet-div-icon {
  background: transparent !important;
  border: none !important;
}

.circle-marker {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  border: 3px solid white;
  box-shadow: none;
  transition: all 0.2s ease;
}

.circle-origin {
  background-color: var(--primary-color);
}
.circle-destination {
  background-color: var(--success-color);
}

.current-marker-wrap {
  position: relative;
  width: 52px;
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999 !important;
}

.current-marker-pulse-halo {
  position: absolute;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background-color: rgba(239, 68, 68, 0.25);
  animation: pulseRadar 1.8s infinite cubic-bezier(0.24, 0, 0.38, 1);
  z-index: 1;
}

.current-marker-dot {
  position: absolute;
  width: 28px;
  height: 28px;
  background-color: var(--danger-color);
  border: 3px solid white;
  border-radius: 50%;
  box-shadow: none;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 5;
}

.current-marker-dot i {
  font-size: 14px;
  color: white;
}

@keyframes pulseRadar {
  0% {
    transform: scale(0.5);
    opacity: 1;
  }
  100% {
    transform: scale(1.8);
    opacity: 0;
  }
}

/* --- RESPONSIVE MOBILE VIEWPORT RULES --- */
@media (max-width: 768px) {
  /* Responsive Header & Navigation Styles */
  /* Dashboard Layout Adjustments */
  .app-container {
    flex-direction: column;
  }
  .map-section {
    height: 100%;
    width: 100%;
    position: relative;
  }
  .map-image-overlay {
    height: calc(45vh + 24px);
    top: 0;
  }
  .gallery-arrow {
    width: 40px;
    height: 40px;
    top: 50%;
    transform: translateY(-50%);
  }
  .gallery-arrow.prev {
    left: 16px;
  }
  .gallery-arrow.next {
    right: 16px;
  }

  .gallery-fullscreen-trigger {
    bottom: calc(24px + 24px);
    right: 16px;
    padding: 0;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    justify-content: center;
    gap: 0;
  }

  .gallery-fullscreen-trigger span {
    display: none;
  }

  .info-section {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    height: 55vh;
    background: white;
    border-radius: 24px 24px 0 0;
    border-right: none;
    border-top: 1px solid var(--border-color);
    box-shadow: none;
    z-index: 200;
    will-change: height;
    transition: height 0.3s cubic-bezier(0.25, 1, 0.5, 1);
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .info-section .content-block {
    overscroll-behavior: contain;
    touch-action: pan-y;
  }

  .drag-handle-container {
    display: block;
  }
  .sheet-header {
    padding: 4px 24px 20px 24px;
  }
  .modal-arrow {
    width: 40px;
    height: 40px;
  }
  .modal-arrow.prev {
    left: 16px;
  }
  .modal-arrow.next {
    right: 16px;
  }

  .tracking-card {
    padding: 32px 20px 10px;
  }
  .tracking-card h2 {
    font-size: 1.7rem;
  }
}
