/**
 * Monitor de Estaciones de Esquí y Nieve
 * Estilos canónicos de la herramienta
 */

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

  /* Colores tema oscuro (Midnight Slate con acentos glaciar) */
  --bg-body: #0b0f17;
  --bg-card: #131a26;
  --bg-card-hover: #192233;
  --bg-card-subtle: #0f1520;
  --border-color: #1e293b;
  --border-focus: #06b6d4;

  --text-main: #f1f5f9;
  --text-muted: #94a3b8;
  --text-dim: #64748b;

  --accent-cyan: #06b6d4;
  --accent-cyan-light: rgba(6, 182, 212, 0.12);
  --accent-blue: #3b82f6;
  --accent-emerald: #10b981;
  --accent-amber: #f59e0b;
  --accent-rose: #f43f5e;

  /* Pistas de esquí */
  --piste-green: #22c55e;
  --piste-blue: #3b82f6;
  --piste-red: #ef4444;
  --piste-black: #1e293b;

  --radius-md: 10px;
  --radius-lg: 14px;
  --radius-xl: 18px;
  --shadow-sm: 0 2px 8px rgba(0, 0, 0, 0.25);
  --shadow-md: 0 6px 20px rgba(0, 0, 0, 0.35);
  --shadow-lg: 0 12px 32px rgba(0, 0, 0, 0.45);
}

body.theme-light {
  --bg-body: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-hover: #f1f5f9;
  --bg-card-subtle: #f8fafc;
  --border-color: #e2e8f0;
  --border-focus: #0284c7;

  --text-main: #0f172a;
  --text-muted: #475569;
  --text-dim: #94a3b8;

  --accent-cyan: #0284c7;
  --accent-cyan-light: rgba(2, 132, 199, 0.08);
  --accent-blue: #2563eb;
  --accent-emerald: #059669;
  --accent-amber: #d97706;
  --accent-rose: #e11d48;

  --piste-black: #334155;

  --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.06);
  --shadow-md: 0 4px 14px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.1);
}

*, *::before, *::after {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: var(--font-main);
  background-color: var(--bg-body);
  color: var(--text-main);
  line-height: 1.5;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

h1, h2, h3, h4, h5, h6 {
  font-family: var(--font-title);
  font-weight: 700;
  color: var(--text-main);
}

.tool-layout {
  max-width: 1200px;
  margin: 1.5rem auto 3rem;
  padding: 0 1rem;
  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;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

/* ==========================================================================
   KPI BARRA DE ESTADO
   ========================================================================== */
.kpi-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

.kpi-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.1rem 1.25rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.kpi-card:hover {
  transform: translateY(-2px);
  border-color: rgba(6, 182, 212, 0.4);
}

.kpi-icon-wrap {
  width: 46px;
  height: 46px;
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.icon-cyan {
  background: rgba(6, 182, 212, 0.15);
  color: var(--accent-cyan);
}

.icon-emerald {
  background: rgba(16, 185, 129, 0.15);
  color: var(--accent-emerald);
}

.icon-indigo {
  background: rgba(99, 102, 241, 0.15);
  color: #818cf8;
}

.icon-amber {
  background: rgba(245, 158, 11, 0.15);
  color: var(--accent-amber);
}

.kpi-content {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.kpi-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 500;
  text-transform: none;
}

.kpi-value {
  font-family: var(--font-mono);
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.2;
  margin: 0.15rem 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.kpi-detail {
  font-size: 0.72rem;
  color: var(--text-dim);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ==========================================================================
   PANEL DE CONTROLES (BUSCADOR, ORDENACIÓN Y FILTROS)
   ========================================================================== */
.controls-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 1rem;
  box-shadow: var(--shadow-sm);
}

.controls-top-row {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.search-wrap {
  position: relative;
  flex: 1 1 260px;
  min-width: 220px;
}

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

.search-input {
  width: 100%;
  height: 44px;
  padding: 0 40px 0 42px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-main);
  font-family: var(--font-main);
  font-size: 0.92rem;
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.search-input:focus {
  border-color: var(--border-focus);
  box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.2);
}

.btn-clear-search {
  position: absolute;
  right: 12px;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 1.3rem;
  cursor: pointer;
  width: 24px;
  height: 24px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sort-and-views {
  display: flex;
  gap: 0.75rem;
  align-items: center;
  flex-wrap: wrap;
}

.select-wrap {
  position: relative;
  min-width: 210px;
}

.custom-select {
  width: 100%;
  max-width: 100%;
  min-width: 0;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  height: 44px;
  padding: 0 40px 0 14px;
  background-color: var(--bg-card-subtle);
  color: var(--text-main);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.88rem;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 14px center;
  background-size: 16px;
  cursor: pointer;
  outline: none;
  transition: border-color 0.2s ease;
}

.custom-select:focus {
  border-color: var(--border-focus);
}

.custom-select option {
  background-color: var(--bg-card);
  color: var(--text-main);
}

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

.btn-view-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  height: 38px;
  padding: 0 14px;
  border-radius: calc(var(--radius-md) - 2px);
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.86rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-view-toggle.active {
  background: var(--accent-cyan);
  color: #ffffff;
  font-weight: 600;
  box-shadow: var(--shadow-sm);
}

body.theme-light .btn-view-toggle.active {
  background: var(--accent-cyan);
  color: #ffffff;
}

.btn-view-toggle:hover:not(.active) {
  color: var(--text-main);
}

/* Barra de filtros por cordillera */
.systems-filter-bar {
  display: flex;
  gap: 0.5rem;
  overflow-x: auto;
  padding-bottom: 4px;
  scrollbar-width: thin;
}

.systems-filter-bar::-webkit-scrollbar {
  height: 4px;
}

.systems-filter-bar::-webkit-scrollbar-thumb {
  background: var(--border-color);
  border-radius: 4px;
}

.btn-filter-pill {
  white-space: nowrap;
  padding: 0.45rem 0.95rem;
  min-height: 40px;
  border-radius: 9999px;
  border: 1px solid var(--border-color);
  background: var(--bg-card-subtle);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.82rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-filter-pill:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

.btn-filter-pill.active {
  background: var(--accent-cyan-light);
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
  font-weight: 600;
}

/* ==========================================================================
   LISTADO Y TARJETAS DE ESTACIONES
   ========================================================================== */
.resorts-status-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
  padding: 0 0.25rem;
}

.last-sync-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  color: var(--text-dim);
}

.resorts-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1.25rem;
}

.resort-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  overflow: hidden;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  transition: transform 0.2s ease, border-color 0.2s ease, box-shadow 0.2s ease;
  position: relative;
}

.resort-card:hover {
  transform: translateY(-3px);
  border-color: rgba(6, 182, 212, 0.45);
  box-shadow: var(--shadow-md);
}

.resort-card-header {
  padding: 1.15rem 1.25rem 0.85rem;
  border-bottom: 1px solid rgba(30, 41, 59, 0.6);
  position: relative;
}

body.theme-light .resort-card-header {
  border-bottom: 1px solid var(--border-color);
}

.resort-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.5rem;
  margin-bottom: 0.35rem;
}

.system-tag {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: none;
  padding: 2px 8px;
  border-radius: 6px;
  background: rgba(6, 182, 212, 0.12);
  color: var(--accent-cyan);
}

.resort-name {
  font-size: 1.18rem;
  line-height: 1.25;
  margin-bottom: 0.25rem;
}

.resort-location {
  font-size: 0.8rem;
  color: var(--text-dim);
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Métricas clave en tarjeta (Espesor y Temperatura) */
.resort-card-body {
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.9rem;
  flex: 1 1 auto;
}

.snow-stats-row {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 0.75rem;
  background: var(--bg-card-subtle);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  border: 1px solid rgba(30, 41, 59, 0.5);
}

body.theme-light .snow-stats-row {
  border: 1px solid var(--border-color);
}

.snow-stat-box {
  display: flex;
  flex-direction: column;
}

.snow-stat-title {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.snow-stat-depth {
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 700;
  color: #38bdf8;
  line-height: 1.2;
}

body.theme-light .snow-stat-depth {
  color: #0284c7;
}

.snow-stat-depth small {
  font-size: 0.78rem;
  font-weight: 500;
  color: var(--text-muted);
}

/* Indicador de pistas de colores */
.pistes-row {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.pistes-label-row {
  display: flex;
  justify-content: space-between;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.pistes-bar-track {
  height: 8px;
  border-radius: 4px;
  background: #1e293b;
  display: flex;
  overflow: hidden;
}

body.theme-light .pistes-bar-track {
  background: #e2e8f0;
}

.piste-seg-green { background: var(--piste-green); }
.piste-seg-blue { background: var(--piste-blue); }
.piste-seg-red { background: var(--piste-red); }
.piste-seg-black { background: var(--piste-black); }

.pistes-legend-mini {
  display: flex;
  gap: 8px;
  font-size: 0.72rem;
  font-family: var(--font-mono);
  color: var(--text-dim);
}

.piste-dot {
  width: 8px;
  height: 8px;
  border-radius: 2px;
  display: inline-block;
  margin-right: 3px;
}

.dot-green { background: var(--piste-green); }
.dot-blue { background: var(--piste-blue); }
.dot-red { background: var(--piste-red); }
.dot-black { background: var(--piste-black); }

/* Fila de meteorología actual */
.weather-status-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px dashed var(--border-color);
  padding-top: 0.75rem;
}

.weather-temp-badge {
  font-family: var(--font-mono);
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  gap: 4px;
}

/* Pie de tarjeta con botones de acción */
.resort-card-footer {
  padding: 0.75rem 1.25rem 1rem;
  display: flex;
  gap: 0.65rem;
}

.btn-card-primary {
  flex: 1 1 0%;
  min-height: 40px;
  background: var(--accent-cyan);
  color: #ffffff;
  border: none;
  border-radius: var(--radius-md);
  font-family: var(--font-main);
  font-size: 0.86rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: background 0.2s ease, transform 0.1s ease;
}

.btn-card-primary:hover {
  background: #0891b2;
}

.btn-card-webcam {
  min-height: 40px;
  padding: 0 12px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.82rem;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 5px;
  text-decoration: none;
  transition: all 0.2s ease;
}

.btn-card-webcam:hover {
  border-color: var(--accent-cyan);
  color: var(--accent-cyan);
}

/* ==========================================================================
   VISTA DE MAPA INTERACTIVO
   ========================================================================== */
.map-view {
  width: 100%;
}

.map-wrapper-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.map-top-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.25rem 0.5rem;
}

.map-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.8rem;
  color: var(--text-muted);
  flex-wrap: wrap;
}

.legend-item {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.legend-dot {
  width: 10px;
  height: 10px;
  border-radius: 50%;
}

.dot-high { background: #38bdf8; box-shadow: 0 0 6px rgba(56, 189, 248, 0.6); }
.dot-mid { background: #10b981; }
.dot-low { background: #94a3b8; }

.btn-map-locate {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-height: 40px;
  padding: 0 14px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  font-family: var(--font-main);
  font-size: 0.82rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-map-locate:hover {
  border-color: var(--accent-cyan);
  color: var(--text-main);
}

.interactive-map {
  width: 100%;
  height: 560px;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-color);
  z-index: 10;
}

/* Popups de Leaflet personalizados */
.leaflet-popup-content-wrapper {
  background: var(--bg-card) !important;
  color: var(--text-main) !important;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md) !important;
  box-shadow: var(--shadow-md) !important;
  padding: 4px;
}

.leaflet-popup-tip {
  background: var(--bg-card) !important;
  border: 1px solid var(--border-color);
}

.map-popup-box {
  display: flex;
  flex-direction: column;
  gap: 6px;
  min-width: 180px;
}

.map-popup-title {
  font-family: var(--font-title);
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-main);
}

.map-popup-info {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.map-popup-snow {
  font-family: var(--font-mono);
  font-weight: 700;
  color: var(--accent-cyan);
  font-size: 1.05rem;
}

.btn-map-popup-action {
  margin-top: 4px;
  width: 100%;
  min-height: 34px;
  background: var(--accent-cyan);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 0.78rem;
  font-weight: 600;
  cursor: pointer;
}

/* ==========================================================================
   SECCIÓN DE GUÍA EDUCATIVA
   ========================================================================== */
.card-info-guide {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  box-shadow: var(--shadow-sm);
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.guide-header {
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.guide-icon {
  width: 44px;
  height: 44px;
  border-radius: var(--radius-md);
  background: var(--accent-cyan-light);
  color: var(--accent-cyan);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.guide-title {
  font-size: 1.25rem;
  margin-bottom: 0.2rem;
}

.guide-subtitle {
  font-size: 0.88rem;
  color: var(--text-muted);
}

.guide-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 1.25rem;
}

.guide-item {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.1rem;
}

.guide-item-title {
  font-size: 0.95rem;
  color: var(--accent-cyan);
  margin-bottom: 0.4rem;
}

.guide-item p {
  font-size: 0.84rem;
  color: var(--text-muted);
  line-height: 1.55;
}

/* ==========================================================================
   MODAL DE DETALLE Y PREVISIÓN 7 DÍAS
   ========================================================================== */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.75);
  backdrop-filter: blur(5px);
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.2s ease-out;
}

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

.modal-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-xl);
  width: 100%;
  max-width: 780px;
  max-height: 90vh;
  overflow-y: auto;
  box-shadow: var(--shadow-lg);
  display: flex;
  flex-direction: column;
}

.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 1rem;
  position: sticky;
  top: 0;
  background: var(--bg-card);
  z-index: 2;
}

.modal-category-badge {
  font-size: 0.72rem;
  font-weight: 600;
  padding: 2px 8px;
  border-radius: 6px;
  background: var(--accent-cyan-light);
  color: var(--accent-cyan);
  display: inline-block;
  margin-bottom: 0.35rem;
}

.modal-title {
  font-size: 1.4rem;
  line-height: 1.2;
}

.modal-subtitle {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.btn-close-modal {
  background: transparent;
  border: none;
  color: var(--text-muted);
  font-size: 2rem;
  line-height: 1;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-close-modal:hover {
  background: var(--bg-card-subtle);
  color: var(--text-main);
}

.modal-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.modal-loading {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3rem 1rem;
  color: var(--text-muted);
  gap: 1rem;
}

.spinner {
  width: 38px;
  height: 38px;
  border: 3px solid rgba(6, 182, 212, 0.2);
  border-top-color: var(--accent-cyan);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

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

/* Métricas en el modal */
.modal-stats-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.85rem;
}

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

.modal-stat-title {
  font-size: 0.72rem;
  color: var(--text-dim);
}

.modal-stat-value {
  font-family: var(--font-mono);
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-main);
  margin-top: 0.15rem;
}

.chart-section {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.chart-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.chart-title {
  font-size: 0.98rem;
  font-weight: 600;
}

.chart-legend {
  display: flex;
  gap: 1rem;
  font-size: 0.76rem;
  color: var(--text-muted);
}

.canvas-chart-wrap {
  width: 100%;
  height: 220px;
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 10px;
}

.forecast-canvas {
  width: 100%;
  height: 100%;
  display: block;
}

.pistes-detail-section {
  display: flex;
  flex-direction: column;
  gap: 0.65rem;
}

.pistes-boxes-row {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 0.75rem;
}

.piste-box {
  padding: 0.75rem;
  border-radius: var(--radius-md);
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.piste-badge {
  width: 24px;
  height: 24px;
  border-radius: 6px;
  flex-shrink: 0;
}

.piste-box-green .piste-badge { background: var(--piste-green); }
.piste-box-blue .piste-badge { background: var(--piste-blue); }
.piste-box-red .piste-badge { background: var(--piste-red); }
.piste-box-black .piste-badge { background: var(--piste-black); }

.piste-box-info {
  display: flex;
  flex-direction: column;
}

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

.piste-box-count {
  font-family: var(--font-mono);
  font-size: 1.15rem;
  font-weight: 700;
}

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

.btn-webcam-external {
  flex: 1 1 0%;
  min-height: 44px;
  background: #0284c7;
  color: #fff;
  border-radius: var(--radius-md);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  text-decoration: none;
  font-weight: 600;
  font-size: 0.88rem;
  transition: background 0.2s ease;
}

.btn-webcam-external:hover {
  background: #0369a1;
}

/* ==========================================================================
   RESPONSIVE (MÓVIL Y TABLETS)
   ========================================================================== */
@media (max-width: 1024px) {
  .kpi-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .resorts-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .modal-stats-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 768px) {
  .kpi-grid {
    grid-template-columns: 1fr;
  }
  .controls-top-row {
    flex-direction: column;
    align-items: stretch;
  }
  .search-wrap {
    width: 100%;
  }
  .sort-and-views {
    flex-direction: column;
    align-items: stretch;
  }
  .select-wrap {
    width: 100%;
  }
  .view-toggle-group {
    width: 100%;
    justify-content: center;
  }
  .btn-view-toggle {
    flex: 1;
    justify-content: center;
  }
  .resorts-grid {
    grid-template-columns: 1fr;
  }
  .guide-grid {
    grid-template-columns: 1fr;
  }
  .interactive-map {
    height: 420px;
  }
  .pistes-boxes-row {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
  .modal-card {
    border-radius: var(--radius-lg);
  }
}
