/**
 * SOY EL ÚLTIMO - DESIGN SYSTEM (APPLE & GOOGLE MINIMALIST HYBRID)
 * Vanguard, Clean, Typography-Driven, High-Contrast & Frictionless
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&family=JetBrains+Mono:wght@500;700&display=swap');

:root {
  /* Paleta Monocromática Minimalista */
  --bg-canvas: #f6f7f9;
  --surface-card: rgba(255, 255, 255, 0.94);
  --surface-solid: #ffffff;
  --surface-secondary: #f0f2f5;
  --surface-hover: #e4e7eb;
  
  --text-primary: #0a0c10;
  --text-secondary: #5a606d;
  --text-tertiary: #8c93a0;
  
  --border-subtle: rgba(0, 0, 0, 0.07);
  --border-strong: rgba(0, 0, 0, 0.12);
  
  /* Acentos de Alta Precisión */
  --accent-black: #0f1115;
  --accent-white: #ffffff;
  --accent-live: #10b981;
  --accent-traffic-heavy: #eb3b3b;
  --accent-traffic-mod: #f59e0b;
  --accent-traffic-low: #10b981;
  
  /* Sombras y Elevaciones Apple/Google */
  --shadow-hud: 0 12px 36px -4px rgba(0, 0, 0, 0.08), 0 4px 12px -2px rgba(0, 0, 0, 0.04);
  --shadow-floating: 0 8px 24px rgba(0, 0, 0, 0.07);
  --shadow-btn: 0 2px 8px rgba(0, 0, 0, 0.06);
  
  /* Radios */
  --radius-xl: 26px;
  --radius-lg: 18px;
  --radius-md: 12px;
  --radius-pill: 9999px;
  
  /* Tipografía */
  --font-sans: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, 'SF Pro Display', 'Google Sans', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
  -webkit-tap-highlight-color: transparent;
}

body {
  font-family: var(--font-sans);
  background-color: var(--bg-canvas);
  color: var(--text-primary);
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* =========================================
   MAPA PRINCIPAL A PANTALLA COMPLETA
   ========================================= */
#map {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  z-index: 1;
  background: #f2f3f5;
}

/* =========================================
   BANNER PUBLICITARIO SUPERIOR (800x200 MÁX)
   ========================================= */
.top-banner-wrapper {
  position: absolute;
  top: 12px;
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 24px);
  max-width: 800px;
  height: 80px;
  max-height: 160px;
  z-index: 1050;
  pointer-events: auto;
}

@media (min-width: 768px) {
  .top-banner-wrapper {
    height: 120px;
    max-height: 200px;
  }
}

.top-ad-card {
  width: 100%;
  height: 100%;
  background: var(--surface-card);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-floating);
  overflow: hidden;
  display: block;
  text-decoration: none;
  color: var(--text-primary);
  position: relative;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.top-ad-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-hud);
}

.top-ad-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.ad-placeholder-content {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(240,242,245,0.9));
}

.ad-badge {
  font-size: 0.65rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--accent-black);
  background: rgba(0, 0, 0, 0.06);
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  display: inline-block;
  margin-bottom: 4px;
}

.ad-cta-btn {
  background: var(--accent-black);
  color: #ffffff;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 8px 14px;
  border-radius: var(--radius-pill);
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

/* =========================================
   CABECERA FLOTANTE (MINIMAL ISLAND)
   (Posicionada a 15px por debajo del banner)
   ========================================= */
.top-island {
  position: absolute;
  top: 107px; /* 12px + 80px (banner) + 15px margen */
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 440px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 8px;
  pointer-events: none;
}

@media (min-width: 768px) {
  .top-island {
    top: 147px; /* 12px + 120px + 15px margen */
  }
}

.island-header {
  pointer-events: auto;
  background: var(--surface-card);
  backdrop-filter: blur(24px) saturate(180%);
  -webkit-backdrop-filter: blur(24px) saturate(180%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-pill);
  padding: 5px 8px 5px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  box-shadow: var(--shadow-floating);
}

.brand-badge {
  display: flex;
  align-items: center;
  gap: 8px;
}

.brand-badge .live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background-color: var(--accent-live);
  box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.2);
}

.brand-badge span {
  font-size: 0.86rem;
  font-weight: 800;
  letter-spacing: -0.2px;
  color: var(--text-primary);
}

/* Segmented Control de Garitas (Estilo Apple iOS) */
.segmented-control {
  display: flex;
  background: var(--surface-secondary);
  border-radius: var(--radius-pill);
  padding: 3px;
}

.seg-btn {
  border: none;
  background: transparent;
  padding: 5px 14px;
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  border-radius: var(--radius-pill);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.22s cubic-bezier(0.16, 1, 0.3, 1);
}

.seg-btn.active {
  background: var(--surface-solid);
  color: var(--text-primary);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

/* Selector de Línea (Minimal Pills) */
.lines-scroll-wrapper {
  pointer-events: auto;
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 2px 2px;
  scrollbar-width: none;
}

.lines-scroll-wrapper::-webkit-scrollbar {
  display: none;
}

.line-pill {
  flex-shrink: 0;
  border: 1px solid var(--border-subtle);
  background: var(--surface-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  color: var(--text-secondary);
  padding: 6px 14px;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.78rem;
  font-weight: 600;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.03);
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.line-pill:hover {
  background: var(--surface-solid);
  color: var(--text-primary);
}

.line-pill.active {
  background: var(--accent-black);
  color: var(--accent-white);
  border-color: var(--accent-black);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

/* =========================================
   BOTÓN FLOTANTE GPS
   ========================================= */
.btn-gps-fab {
  position: absolute;
  right: 18px;
  bottom: 275px;
  z-index: 900;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-pill);
  background: var(--surface-solid);
  border: 1px solid var(--border-subtle);
  box-shadow: var(--shadow-floating);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: var(--text-primary);
  transition: all 0.2s ease;
}

.btn-gps-fab:active {
  transform: scale(0.92);
}

/* =========================================
   HUD INFERIOR FLOTANTE (ESTILO APPLE/GOOGLE CARD)
   (Reducido 25% para máxima elegancia y espacio)
   ========================================= */
.hud-sheet {
  position: absolute;
  bottom: 72px; /* Elevado para dejar espacio al menú inferior */
  left: 50%;
  transform: translateX(-50%);
  width: calc(100% - 28px);
  max-width: 420px;
  background: var(--surface-card);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border: 1px solid var(--border-subtle);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-hud);
  z-index: 1000;
  padding: 12px 16px 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.hud-top-row {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
}

.eta-container {
  display: flex;
  flex-direction: column;
  gap: 1px;
}

.eta-label {
  font-size: 0.62rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: var(--text-tertiary);
}

.eta-value {
  font-size: 1.65rem; /* Reducido 25% (era 2.2rem) */
  font-weight: 800;
  line-height: 1;
  letter-spacing: -0.6px;
  color: var(--text-primary);
  font-feature-settings: "tnum" on, "lnum" on;
}

.status-pill {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
  background: var(--surface-secondary);
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
}

.status-pill.live {
  background: #e6f9f0;
  color: #059669;
}

/* Fila de Ubicación Compacta */
.location-row {
  background: var(--surface-secondary);
  border-radius: var(--radius-md);
  padding: 7px 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.loc-details {
  display: flex;
  align-items: center;
  gap: 6px;
  overflow: hidden;
}

.loc-details svg {
  flex-shrink: 0;
  color: var(--text-secondary);
  width: 14px;
  height: 14px;
}

.loc-details span {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-primary);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.loc-dist {
  font-family: var(--font-mono);
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--text-secondary);
  flex-shrink: 0;
}

/* Fila de Capacidad CBP Oficial */
.cbp-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(30, 41, 59, 0.05);
  border: 1px solid rgba(30, 41, 59, 0.08);
  padding: 5px 10px;
  border-radius: 10px;
  font-size: 0.73rem;
  margin-bottom: 2px;
}

.cbp-info {
  display: flex;
  align-items: center;
  gap: 6px;
  color: var(--text-secondary);
  font-weight: 600;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.cbp-pill-tag {
  font-size: 0.64rem;
  font-weight: 800;
  background: #1e293b;
  color: #ffffff;
  padding: 2px 6px;
  border-radius: 6px;
  letter-spacing: 0.02em;
  flex-shrink: 0;
}

.cbp-delay-tag {
  font-weight: 800;
  color: #d97706;
  font-size: 0.74rem;
  flex-shrink: 0;
}

/* Botones de Acción Táctiles */
.hud-actions {
  display: grid;
  grid-template-columns: 1.25fr 1fr;
  gap: 8px;
}

.btn-tactile {
  border: none;
  border-radius: var(--radius-pill);
  font-family: var(--font-sans);
  font-size: 0.8rem;
  font-weight: 700;
  padding: 9px 12px;
  height: 38px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.18s cubic-bezier(0.16, 1, 0.3, 1);
  letter-spacing: -0.1px;
}

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

.btn-navigate {
  background: var(--accent-black);
  color: var(--accent-white);
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.18);
}

.btn-navigate:hover {
  background: #232730;
}

.btn-report {
  background: var(--surface-solid);
  color: var(--text-primary);
  border: 1px solid var(--border-strong);
}

.btn-report:hover {
  background: var(--surface-secondary);
}

/* =========================================
   MODAL DE NAVEGACIÓN (APPLE BOTTOM SHEET)
   ========================================= */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(10, 12, 16, 0.4);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 2000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-sheet {
  background: var(--surface-solid);
  width: 100%;
  max-width: 440px;
  border-radius: 28px 28px 0 0;
  padding: 24px 22px 34px 22px;
  display: flex;
  flex-direction: column;
  gap: 16px;
  box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.12);
  transform: translateY(100%);
  transition: transform 0.28s cubic-bezier(0.16, 1, 0.3, 1);
}

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

.modal-sheet-header {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.modal-sheet-header h3 {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.3px;
}

.modal-sheet-header p {
  font-size: 0.8rem;
  color: var(--text-secondary);
}

.nav-apps-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.nav-app-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 13px 16px;
  border-radius: var(--radius-lg);
  background: var(--surface-secondary);
  text-decoration: none;
  color: var(--text-primary);
  font-weight: 600;
  font-size: 0.9rem;
  transition: all 0.15s ease;
}

.nav-app-item:hover {
  background: var(--surface-hover);
}

.nav-app-item:active {
  transform: scale(0.98);
}

.nav-app-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.nav-app-info span.name {
  font-weight: 700;
}

/* =========================================
   NOTIFICACIÓN TOAST (APPLE CAPSULE)
   ========================================= */
.toast-capsule {
  position: fixed;
  top: 18px;
  left: 50%;
  transform: translateX(-50%) translateY(-30px);
  background: rgba(15, 17, 21, 0.94);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  padding: 9px 18px;
  border-radius: var(--radius-pill);
  font-size: 0.8rem;
  font-weight: 600;
  z-index: 3000;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.2);
  opacity: 0;
  pointer-events: none;
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  white-space: nowrap;
}

.toast-capsule.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
  pointer-events: auto;
}

/* =========================================
   MARCADOR BEACON (APPLE MAPS RADAR PIN)
   ========================================= */
.beacon-marker {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
}

.beacon-marker .radar {
  position: absolute;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(235, 59, 59, 0.25);
  animation: radarPulse 1.8s cubic-bezier(0.25, 1, 0.5, 1) infinite;
}

.beacon-marker .dot {
  position: relative;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: var(--accent-traffic-heavy);
  border: 2.5px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  z-index: 2;
}

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

/* =========================================
   BARRA DE MENÚ INFERIOR (BOTTOM TAB BAR)
   ========================================= */
.bottom-nav-bar {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 60px;
  background: var(--surface-card);
  backdrop-filter: blur(28px) saturate(200%);
  -webkit-backdrop-filter: blur(28px) saturate(200%);
  border-top: 1px solid var(--border-subtle);
  display: flex;
  align-items: center;
  justify-content: space-around;
  padding: 0 10px;
  z-index: 2000;
  box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.05);
}

.tab-btn {
  background: none;
  border: none;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 3px;
  padding: 6px 12px;
  border-radius: var(--radius-md);
  color: var(--text-secondary);
  cursor: pointer;
  transition: all 0.15s ease;
  flex: 1;
  max-width: 100px;
}

.tab-btn .tab-icon {
  font-size: 1.15rem;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

.tab-btn .tab-label {
  font-size: 0.68rem;
  font-weight: 700;
  letter-spacing: -0.01em;
}

.tab-btn.active {
  color: var(--accent-black);
}

.tab-btn.active .tab-icon {
  transform: scale(1.15);
}

.tab-btn:active {
  transform: scale(0.94);
}

/* =========================================
   MODALES DE MENÚ (APPLE BOTTOM SHEETS)
   ========================================= */
.info-modal-sheet {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.5);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  z-index: 2500;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

@media (min-width: 600px) {
  .info-modal-sheet {
    align-items: center;
    padding: 20px;
  }
}

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

.info-sheet-card {
  width: 100%;
  max-width: 500px;
  background: var(--surface-solid);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: 24px 20px 32px 20px;
  box-shadow: var(--shadow-hud);
  transform: translateY(100%);
  transition: transform 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  max-height: 85vh;
  overflow-y: auto;
}

@media (min-width: 600px) {
  .info-sheet-card {
    border-radius: var(--radius-xl);
    transform: translateY(20px);
  }
}

.info-modal-sheet.active .info-sheet-card {
  transform: translateY(0);
}

.info-sheet-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
}

.info-sheet-title {
  font-size: 1.15rem;
  font-weight: 800;
  letter-spacing: -0.02em;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 8px;
}

.btn-close-sheet {
  background: var(--surface-secondary);
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 0.9rem;
  color: var(--text-secondary);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

/* Grid de Comparativa de Tiempos */
.times-summary-grid {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.port-times-card {
  background: var(--surface-secondary);
  border-radius: var(--radius-lg);
  padding: 14px;
}

.port-times-title {
  font-size: 0.85rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 10px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.port-line-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-subtle);
  font-size: 0.82rem;
}

.port-line-row:last-child {
  border-bottom: none;
}

/* =========================================
   BANNER PUBLICITARIO IN-MODAL (TIEMPOS)
   ========================================= */
.modal-ad-banner {
  margin-top: 14px;
  width: 100%;
  aspect-ratio: 4 / 1;
  max-height: 110px;
  border-radius: var(--radius-md);
  overflow: hidden;
  display: block;
  text-decoration: none;
  background: var(--surface-secondary);
  border: 1px solid var(--border-subtle);
  position: relative;
  transition: transform 0.2s ease;
}

.modal-ad-banner:hover {
  transform: translateY(-2px);
}

.modal-ad-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.modal-ad-placeholder {
  width: 100%;
  height: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 14px;
  background: linear-gradient(135deg, rgba(255,255,255,0.9), rgba(240,242,245,0.9));
}

/* =========================================
   SELECTOR DE CIUDADES (CITY SELECTOR HUB)
   ========================================= */
.city-selector-content {
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.state-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.state-label {
  font-size: 0.72rem;
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-tertiary);
  margin-bottom: 2px;
}

.city-item-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: var(--surface-secondary);
  padding: 12px 14px;
  border-radius: var(--radius-lg);
  cursor: pointer;
  border: 1.5px solid transparent;
  transition: all 0.18s ease;
}

.city-item-card:hover {
  background: var(--surface-hover);
}

.city-item-card.active {
  background: #f0fdf4;
  border-color: #10b981;
}

.city-info .city-name {
  font-size: 0.92rem;
  font-weight: 800;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 6px;
}

.city-info .city-ports-desc {
  font-size: 0.72rem;
  color: var(--text-secondary);
  margin-top: 2px;
}

.city-active-badge {
  font-size: 0.7rem;
  font-weight: 800;
  background: #10b981;
  color: #ffffff;
  padding: 3px 8px;
  border-radius: var(--radius-pill);
}

.city-btn-select {
  font-size: 0.72rem;
  font-weight: 700;
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.08);
  padding: 4px 10px;
  border-radius: var(--radius-pill);
}



