/* ==========================================================================
   Radar de áreas de servicio y paradas en ruta en autopistas de España
   css/style.css - Fijate Tools
   ========================================================================== */

:root {
  --font-main: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --font-heading: 'Outfit', sans-serif;
  --font-mono: 'JetBrains Mono', monospace;

  /* Colores Corporativos Tema Claro */
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-subtle: #f1f5f9;
  --bg-muted: #e2e8f0;
  --text-main: #0f172a;
  --text-muted: #64748b;
  --text-subtle: #94a3b8;
  --border-color: #e2e8f0;
  --border-focus: #3b82f6;

  /* Acentos */
  --primary: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --accent-gold: #f59e0b;
  --accent-gold-light: #fef3c7;
  --accent-green: #10b981;
  --accent-green-light: #ecfdf5;
  --accent-purple: #8b5cf6;
  --accent-purple-light: #f5f3ff;
  --accent-cyan: #06b6d4;
  --accent-cyan-light: #ecfeff;
  --accent-danger: #ef4444;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 16px;
  --radius-full: 9999px;
}

[data-theme="dark"] {
  --bg-page: #0b0f17;
  --bg-card: #151d2a;
  --bg-subtle: #1e293b;
  --bg-muted: #273549;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --text-subtle: #64748b;
  --border-color: #263345;
  --border-focus: #60a5fa;

  --primary: #3b82f6;
  --primary-hover: #60a5fa;
  --primary-light: rgba(59, 130, 246, 0.12);
  --accent-gold: #fbbf24;
  --accent-gold-light: rgba(251, 191, 36, 0.12);
  --accent-green: #34d399;
  --accent-green-light: rgba(52, 211, 153, 0.12);
  --accent-purple: #a78bfa;
  --accent-purple-light: rgba(167, 139, 250, 0.12);
  --accent-cyan: #22d3ee;
  --accent-cyan-light: rgba(34, 211, 238, 0.12);
  --accent-danger: #f87171;

  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.3);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.4);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.5);
}

/* Base */
body {
  font-family: var(--font-main);
  background-color: var(--bg-page);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

.text-mono {
  font-family: var(--font-mono);
}

/* Layout Canónico */
.tool-layout {
  max-width: 1240px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  box-sizing: border-box;
  flex: 1 0 auto;
  width: 100%;
}

.tool-with-sidebar {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
  width: 100%;
}

.tool-main-content {
  flex: 1 1 0%;
  min-width: 0;
  width: 100%;
}

/* Banner de la Autopista */
.highway-info-banner {
  margin-bottom: 1.5rem;
}

.highway-banner-inner {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem 1.5rem;
  box-shadow: var(--shadow-sm);
}

.highway-banner-title {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.5rem;
}

.highway-badge {
  background: var(--primary);
  color: #ffffff;
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0.25rem 0.75rem;
  border-radius: var(--radius-sm);
  letter-spacing: 0.5px;
}

.highway-full-name {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: 1.25rem;
  color: var(--text-main);
}

.highway-banner-desc {
  color: var(--text-muted);
  font-size: 0.95rem;
  line-height: 1.5;
  margin: 0 0 1rem 0;
}

.highway-meta-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
}

.meta-tag {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 0.3rem 0.65rem;
  border-radius: var(--radius-sm);
}

.meta-tag strong {
  color: var(--text-main);
}

/* Selector de Autopistas (Chips) */
.highway-selector-bar {
  margin-bottom: 1.5rem;
}

.highway-selector-label {
  display: block;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  margin-bottom: 0.5rem;
  text-transform: none;
}

.highway-chips-scroll {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 0.5rem;
  -webkit-overflow-scrolling: touch;
}

.btn-highway-chip {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  white-space: nowrap;
  min-height: 44px;
  display: inline-flex;
  flex-direction: column;
  align-items: flex-start;
  transition: all 0.15s ease;
  font-family: var(--font-main);
}

.btn-highway-chip strong {
  font-family: var(--font-heading);
  font-size: 0.95rem;
}

.btn-highway-chip .chip-sub {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.btn-highway-chip:hover {
  border-color: var(--primary);
  background: var(--bg-subtle);
}

.btn-highway-chip.active {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-highway-chip.active .chip-sub {
  color: var(--primary);
  opacity: 0.85;
}

/* Barra de Sentido de la Marcha */
.direction-control-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.direction-info {
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
}

.direction-info .dir-text {
  font-size: 0.95rem;
  color: var(--text-main);
}

.direction-info .dir-pks {
  font-size: 0.8rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.btn-direction-toggle {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.5rem 0.9rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.85rem;
  transition: all 0.15s ease;
}

.btn-direction-toggle:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

/* Asistente DGT de Parada Inteligente */
.assistant-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
}

.assistant-header-toggle {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.assistant-title-group {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.assistant-icon-box {
  background: var(--accent-gold-light);
  color: var(--accent-gold);
  width: 36px;
  height: 36px;
  border-radius: var(--radius-sm);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
}

.assistant-header-toggle h3 {
  font-family: var(--font-heading);
  font-size: 1.1rem;
  margin: 0;
  color: var(--text-main);
}

.assistant-header-toggle p {
  margin: 0.15rem 0 0 0;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* Switch */
.switch-container {
  display: inline-flex;
  align-items: center;
  cursor: pointer;
}

.switch-input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
}

.switch-slider {
  width: 48px;
  height: 26px;
  background-color: var(--bg-muted);
  border-radius: 34px;
  position: relative;
  transition: 0.2s ease;
}

.switch-slider::before {
  content: "";
  position: absolute;
  height: 20px;
  width: 20px;
  left: 3px;
  bottom: 3px;
  background-color: white;
  border-radius: 50%;
  transition: 0.2s ease;
}

.switch-input:checked + .switch-slider {
  background-color: var(--primary);
}

.switch-input:checked + .switch-slider::before {
  transform: translateX(22px);
}

/* Panel expandible del asistente */
.assistant-panel {
  display: none;
  margin-top: 1.25rem;
  padding-top: 1.25rem;
  border-top: 1px solid var(--border-color);
}

.assistant-panel.active {
  display: block;
}

.assistant-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
  margin-bottom: 1rem;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
}

.form-group label {
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--text-muted);
}

.form-input,
.form-select {
  height: 42px;
  padding: 0 0.75rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.9rem;
  box-sizing: border-box;
  width: 100%;
}

.form-select {
  appearance: none;
  background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 16px;
  padding-right: 2.2rem;
}

.btn-calculate-assistant {
  background: var(--primary);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  padding: 0.6rem 1.25rem;
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  min-height: 42px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  transition: background 0.15s ease;
}

.btn-calculate-assistant:hover {
  background: var(--primary-hover);
}

/* Banner de Resultados del Asistente */
.assistant-results-banner {
  display: none;
  margin-bottom: 1.5rem;
}

.assistant-banner-card {
  background: var(--accent-gold-light);
  border: 1px solid var(--accent-gold);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}

.assistant-banner-header {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.assistant-banner-tag {
  font-weight: 700;
  font-size: 0.85rem;
  color: #92400e;
}

[data-theme="dark"] .assistant-banner-tag {
  color: #fde68a;
}

.assistant-summary-kpis {
  font-size: 0.85rem;
  color: var(--text-main);
}

.suggested-stops-mini-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
  gap: 0.75rem;
}

.suggested-stop-pill {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.65rem 0.85rem;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  gap: 0.2rem;
  box-shadow: var(--shadow-sm);
  transition: all 0.15s ease;
}

.suggested-stop-pill:hover {
  border-color: var(--accent-gold);
  transform: translateY(-1px);
}

.suggested-stop-pill .stop-num {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-gold);
}

.suggested-stop-pill .stop-name {
  font-size: 0.88rem;
  color: var(--text-main);
}

.suggested-stop-pill .stop-pk {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Filtros y Buscador */
.controls-filter-bar {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  margin-bottom: 1.5rem;
}

.search-and-view-row {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.search-box-wrapper {
  position: relative;
  flex: 1 1 280px;
}

.search-icon {
  position: absolute;
  left: 0.85rem;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-subtle);
  pointer-events: none;
}

.search-input {
  width: 100%;
  height: 42px;
  padding: 0 2.2rem 0 2.4rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  color: var(--text-main);
  font-size: 0.9rem;
  box-sizing: border-box;
}

.btn-clear-search {
  position: absolute;
  right: 0.65rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-subtle);
  cursor: pointer;
  font-size: 1.1rem;
  display: none;
}

.view-and-itinerary-actions {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.view-toggle-group {
  display: inline-flex;
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 3px;
}

.btn-view-toggle {
  background: transparent;
  border: none;
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
  cursor: pointer;
  min-height: 34px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  transition: all 0.15s ease;
}

.btn-view-toggle.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

.btn-open-itinerary {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.85rem;
  border-radius: var(--radius-md);
  cursor: pointer;
  min-height: 40px;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  font-weight: 600;
  transition: all 0.15s ease;
}

.btn-open-itinerary:hover {
  border-color: var(--primary);
  color: var(--primary);
}

.itinerary-badge {
  background: var(--primary);
  color: #ffffff;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: var(--radius-full);
  padding: 0.1rem 0.45rem;
  min-width: 18px;
  height: 18px;
  display: none;
  align-items: center;
  justify-content: center;
}

/* Chips táctiles de servicios */
.filter-chips-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
}

.btn-filter-chip {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.45rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.82rem;
  font-weight: 500;
  transition: all 0.15s ease;
}

.btn-filter-chip:hover {
  background: var(--bg-muted);
}

.btn-filter-chip.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.status-summary-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 0.85rem;
  font-size: 0.82rem;
  color: var(--text-muted);
}

/* ==========================================================================
   Línea Temporal (Timeline)
   ========================================================================== */
.timeline-container {
  position: relative;
  margin-top: 1rem;
}

.timeline-step-distance {
  display: flex;
  justify-content: center;
  padding: 0.5rem 0;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
}

.timeline-step-distance span {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.2rem 0.6rem;
  border-radius: var(--radius-full);
}

.timeline-item {
  display: flex;
  gap: 1.25rem;
  position: relative;
  padding-bottom: 1.5rem;
}

.timeline-item::before {
  content: "";
  position: absolute;
  left: 17px;
  top: 36px;
  bottom: 0;
  width: 2px;
  background: var(--border-color);
}

.timeline-item:last-child::before {
  display: none;
}

.timeline-axis {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  min-width: 36px;
}

.timeline-dot {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--bg-card);
  border: 2px solid var(--primary);
  color: var(--primary);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.85rem;
  font-family: var(--font-mono);
  box-shadow: var(--shadow-sm);
  z-index: 2;
}

.timeline-dot.dot-gold {
  background: var(--accent-gold);
  border-color: #d97706;
  color: #ffffff;
  font-size: 1rem;
  box-shadow: 0 0 0 4px var(--accent-gold-light);
}

.timeline-pk-badge {
  font-size: 0.72rem;
  font-weight: 600;
  color: var(--text-muted);
  background: var(--bg-subtle);
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

/* Tarjeta del Timeline */
.timeline-card-content {
  flex: 1 1 0%;
  min-width: 0;
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  box-shadow: var(--shadow-sm);
  transition: border-color 0.15s ease, transform 0.15s ease;
}

.timeline-item.item-recommended .timeline-card-content {
  border: 2px solid var(--accent-gold);
  box-shadow: 0 0 16px rgba(245, 158, 11, 0.15);
}

.timeline-item.flash-highlight .timeline-card-content {
  animation: flashCard 1.5s ease-out;
}

@keyframes flashCard {
  0% { transform: scale(1.02); border-color: var(--primary); }
  50% { transform: scale(1.02); border-color: var(--primary); }
  100% { transform: scale(1); }
}

.banner-recommended-badge {
  background: var(--accent-gold-light);
  color: #92400e;
  font-size: 0.78rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  margin-bottom: 0.75rem;
  display: inline-block;
}

[data-theme="dark"] .banner-recommended-badge {
  color: #fde68a;
}

.card-main-header {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.75rem;
  margin-bottom: 0.35rem;
}

.card-title-group {
  display: flex;
  flex-direction: column;
}

.card-title {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: var(--text-main);
}

.card-operator {
  font-size: 0.8rem;
  color: var(--primary);
  font-weight: 600;
}

.card-margin-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-muted);
  font-size: 0.75rem;
  padding: 0.2rem 0.5rem;
  border-radius: var(--radius-sm);
  white-space: nowrap;
}

.card-location {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.82rem;
  color: var(--text-muted);
  margin: 0 0 0.65rem 0;
}

.card-notes {
  font-size: 0.88rem;
  line-height: 1.45;
  color: var(--text-muted);
  margin: 0 0 0.85rem 0;
}

.card-services-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 1rem;
}

.service-pill {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  font-size: 0.75rem;
  padding: 0.25rem 0.55rem;
  border-radius: var(--radius-sm);
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
}

.service-pill.pill-dog { border-color: rgba(16, 185, 129, 0.4); }
.service-pill.pill-shade { border-color: rgba(34, 197, 94, 0.4); }
.service-pill.pill-ev { border-color: rgba(6, 182, 212, 0.4); }
.service-pill.pill-play { border-color: rgba(245, 158, 11, 0.4); }

.card-footer-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--border-color);
}

.btn-card-action {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
  padding: 0.4rem 0.75rem;
  border-radius: var(--radius-md);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  min-height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-card-action:hover {
  background: var(--primary-light);
  border-color: var(--primary);
  color: var(--primary);
}

.btn-card-action.btn-action-save.active {
  background: var(--primary);
  border-color: var(--primary);
  color: #ffffff;
}

.btn-card-action.btn-action-gps {
  background: var(--bg-muted);
}

/* ==========================================================================
   Mapa Cartográfico Leaflet
   ========================================================================== */
.map-section {
  display: none;
  margin-top: 1rem;
}

.map-card-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
}

.map-container {
  width: 100%;
  height: 560px;
  background: #0b0f17;
}

/* Pines Leaflet personalizados */
.custom-div-icon {
  background: transparent;
  border: none;
}

.map-marker-pin {
  position: relative;
  width: 36px;
  height: 42px;
  cursor: pointer;
}

.pin-head {
  width: 36px;
  height: 32px;
  background: var(--primary);
  color: #ffffff;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 700;
  box-shadow: var(--shadow-md);
  position: relative;
}

.pin-point {
  width: 0;
  height: 0;
  border-left: 6px solid transparent;
  border-right: 6px solid transparent;
  border-top: 8px solid var(--primary);
  margin: 0 auto;
}

.map-marker-pin.marker-recommended .pin-head {
  background: var(--accent-gold);
  border: 2px solid #ffffff;
  box-shadow: 0 0 10px rgba(245, 158, 11, 0.8);
}
.map-marker-pin.marker-recommended .pin-point {
  border-top-color: var(--accent-gold);
}

.map-marker-pin.marker-ev .pin-head {
  background: #0284c7;
}
.map-marker-pin.marker-ev .pin-point {
  border-top-color: #0284c7;
}

.marker-star,
.marker-ev-badge,
.marker-dog-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  background: #ffffff;
  color: var(--text-main);
  border-radius: 50%;
  width: 16px;
  height: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.65rem;
  box-shadow: var(--shadow-sm);
}

/* Popup Leaflet */
.leaflet-popup-content-wrapper {
  background: var(--bg-card);
  color: var(--text-main);
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  box-shadow: var(--shadow-lg);
  padding: 0;
}

.leaflet-popup-content {
  margin: 0.85rem;
  line-height: 1.4;
}

.area-popup-card .popup-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.area-popup-card .popup-title {
  font-family: var(--font-heading);
  font-size: 0.98rem;
  font-weight: 700;
  margin: 0 0 0.25rem 0;
  color: var(--text-main);
}

.area-popup-card .popup-location {
  font-size: 0.78rem;
  color: var(--text-muted);
  margin: 0 0 0.5rem 0;
}

.area-popup-card .popup-badges {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.65rem;
}

.popup-badge {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  font-size: 0.68rem;
  padding: 0.15rem 0.4rem;
  border-radius: var(--radius-sm);
}

.area-popup-card .popup-actions {
  display: flex;
  gap: 0.5rem;
  margin-top: 0.5rem;
  padding-top: 0.5rem;
  border-top: 1px solid var(--border-color);
}

.btn-popup-details,
.btn-popup-nav {
  flex: 1;
  min-height: 34px;
  padding: 0.35rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  text-align: center;
  cursor: pointer;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-popup-details {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-popup-nav {
  background: var(--primary);
  color: #ffffff;
  border: none;
}

/* ==========================================================================
   Modales Accesibles (Sin alerts)
   ========================================================================== */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.65);
  backdrop-filter: blur(4px);
  z-index: 9999;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}

.modal-overlay.active {
  display: flex;
}

.modal-dialog {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 620px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
  animation: modalEnter 0.2s ease-out;
}

@keyframes modalEnter {
  from { opacity: 0; transform: scale(0.96); }
  to { opacity: 1; transform: scale(1); }
}

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

.modal-header h3 {
  font-family: var(--font-heading);
  font-size: 1.2rem;
  margin: 0;
  color: var(--text-main);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  cursor: pointer;
  font-size: 1.35rem;
  padding: 0.25rem;
  line-height: 1;
}

.modal-body {
  padding: 1.5rem;
  overflow-y: auto;
  flex: 1;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  flex-wrap: wrap;
  gap: 0.75rem;
  justify-content: flex-end;
}

/* Ficha técnica modal */
.detail-kpis-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.detail-kpi-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  padding: 0.65rem 0.85rem;
  border-radius: var(--radius-md);
  display: flex;
  flex-direction: column;
}

.detail-kpi-label {
  font-size: 0.72rem;
  color: var(--text-muted);
}

.detail-kpi-val {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-main);
}

.detail-feature-list {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.detail-feature-list li {
  display: flex;
  align-items: flex-start;
  gap: 0.65rem;
  font-size: 0.85rem;
  padding: 0.5rem;
  border-radius: var(--radius-sm);
  background: var(--bg-subtle);
}

.detail-feature-list li.feat-no {
  opacity: 0.6;
}

.detail-advice-box {
  background: var(--accent-gold-light);
  border: 1px solid var(--accent-gold);
  padding: 0.85rem;
  border-radius: var(--radius-md);
  margin-bottom: 1.25rem;
}

.detail-advice-box h4 {
  margin: 0 0 0.35rem 0;
  font-size: 0.85rem;
  color: #92400e;
}

[data-theme="dark"] .detail-advice-box h4 {
  color: #fde68a;
}

.detail-advice-box p {
  margin: 0;
  font-size: 0.82rem;
  color: var(--text-main);
}

.modal-action-bar {
  display: flex;
  gap: 0.75rem;
}

.btn-primary,
.btn-secondary {
  flex: 1;
  min-height: 42px;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.88rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-decoration: none;
  transition: all 0.15s ease;
}

.btn-primary {
  background: var(--primary);
  color: #ffffff;
  border: none;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-secondary {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-main);
}

.btn-danger-outline {
  background: transparent;
  border: 1px solid var(--accent-danger);
  color: var(--accent-danger);
}

/* Hoja de ruta modal */
.itinerary-stop-card {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 0.85rem 1rem;
  margin-bottom: 0.75rem;
}

.itinerary-stop-header {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.itinerary-stop-name {
  margin: 0 0 0.2rem 0;
  font-size: 1rem;
  color: var(--text-main);
}

.itinerary-stop-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin: 0 0 0.65rem 0;
}

.itinerary-stop-actions {
  display: flex;
  gap: 0.5rem;
}

.btn-itinerary-gps,
.btn-itinerary-remove {
  padding: 0.35rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 600;
  cursor: pointer;
  text-decoration: none;
}

.btn-itinerary-gps {
  background: var(--primary);
  color: #ffffff;
  border: none;
}

.btn-itinerary-remove {
  background: transparent;
  border: 1px solid var(--border-color);
  color: var(--text-muted);
}

.empty-itinerary {
  text-align: center;
  padding: 2rem 1rem;
  color: var(--text-muted);
}

.empty-itinerary .sub-text {
  font-size: 0.85rem;
  color: var(--text-subtle);
  margin-top: 0.5rem;
}

/* Toast feedback */
.toast-notification {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #0f172a;
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-full);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-lg);
  z-index: 10000;
  opacity: 0;
  transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  pointer-events: none;
}

[data-theme="dark"] .toast-notification {
  background: #ffffff;
  color: #0f172a;
}

.toast-notification.show {
  opacity: 1;
  transform: translateX(-50%) translateY(0);
}

/* Guía SEO y Acordeón FAQ */
.seo-guide-section {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-top: 2rem;
  box-shadow: var(--shadow-sm);
}

.seo-guide-section h2 {
  font-family: var(--font-heading);
  font-size: 1.4rem;
  margin: 0 0 1rem 0;
  color: var(--text-main);
}

.seo-guide-section p {
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 1rem;
}

.seo-guide-section h3 {
  font-family: var(--font-heading);
  font-size: 1.15rem;
  margin: 1.5rem 0 0.5rem 0;
  color: var(--text-main);
}

.faq-accordion-group {
  margin-top: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.faq-item {
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  overflow: hidden;
  background: var(--bg-subtle);
}

.faq-question {
  width: 100%;
  padding: 1rem 1.25rem;
  text-align: left;
  background: transparent;
  border: none;
  font-family: var(--font-main);
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-main);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
}

.faq-icon-arrow {
  transition: transform 0.2s ease;
}

.faq-item.active .faq-icon-arrow {
  transform: rotate(180deg);
}

.faq-answer {
  display: none;
  padding: 0 1.25rem 1.25rem;
  color: var(--text-muted);
  font-size: 0.9rem;
  line-height: 1.6;
}

.faq-item.active .faq-answer {
  display: block;
}

/* Responsividad móvil */
@media (max-width: 768px) {
  .tool-layout {
    margin: 1rem auto 2rem;
    padding: 0 0.75rem;
  }

  .direction-control-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .btn-direction-toggle {
    width: 100%;
    justify-content: center;
  }

  .search-and-view-row {
    flex-direction: column;
    align-items: stretch;
  }

  .search-box-wrapper {
    width: 100%;
  }

  .view-and-itinerary-actions {
    justify-content: space-between;
  }

  .btn-open-itinerary {
    flex: 1;
    justify-content: center;
  }

  .timeline-item {
    gap: 0.75rem;
  }

  .timeline-dot {
    width: 30px;
    height: 30px;
    font-size: 0.75rem;
  }

  .timeline-item::before {
    left: 14px;
  }

  .timeline-pk-badge {
    font-size: 0.65rem;
    padding: 0.1rem 0.3rem;
  }

  .timeline-card-content {
    padding: 1rem;
  }

  .card-footer-actions {
    flex-direction: column;
  }

  .btn-card-action {
    width: 100%;
    justify-content: center;
  }

  .detail-kpis-grid {
    grid-template-columns: 1fr;
  }

  .modal-action-bar {
    flex-direction: column;
  }

  .map-container {
    height: 420px;
  }
}
