/* ==========================================================================
   Calculadora meteorológica de montaña y gradiente térmico
   Estilos CSS canónicos para fijate.com (Dark / Light Theme)
   ========================================================================== */

:root {
  /* Paleta Dark Mode (Por defecto) */
  --bg-page: #0b0f17;
  --bg-card: #131a26;
  --bg-card-subtle: #192233;
  --bg-input: #101622;
  --bg-input-focus: #141c2c;
  --border-color: #232f45;
  --border-focus: #3b82f6;

  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --text-muted: #64748b;

  --color-brand: #38bdf8; /* Azul cielo / atmósfera */
  --color-brand-hover: #0ea5e9;
  --color-summit: #10b981; /* Verde cumbre */
  --color-warning: #f59e0b; /* Naranja valle */
  --color-danger: #ef4444; /* Peligro congelación */
  --color-ice: #38bdf8;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.5);

  --radius-sm: 6px;
  --radius-md: 10px;
  --radius-lg: 14px;
}

[data-theme="light"] {
  --bg-page: #f8fafc;
  --bg-card: #ffffff;
  --bg-card-subtle: #f1f5f9;
  --bg-input: #ffffff;
  --bg-input-focus: #f8fafc;
  --border-color: #cbd5e1;
  --border-focus: #2563eb;

  --text-primary: #0f172a;
  --text-secondary: #475569;
  --text-muted: #64748b;

  --color-brand: #0284c7;
  --color-brand-hover: #0369a1;
  --color-summit: #059669;
  --color-warning: #d97706;
  --color-danger: #dc2626;
  --color-ice: #0284c7;

  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.08);
  --shadow-lg: 0 10px 25px rgba(0, 0, 0, 0.12);
}

/* Tipografías corporativas */
body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background-color: var(--bg-page);
  color: var(--text-primary);
  margin: 0;
  padding: 0;
  overflow-x: clip;
  width: 100%;
  max-width: 100%;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, h5, h6 {
  font-family: 'Outfit', sans-serif;
  color: var(--text-primary);
  font-weight: 700;
  margin-top: 0;
}

.font-mono {
  font-family: 'JetBrains Mono', monospace;
}

/* Layout y contención */
.tool-layout {
  max-width: 1240px;
  width: 100%;
  margin: 1.5rem auto 3.5rem;
  padding: 0 1rem;
  box-sizing: border-box;
}

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

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

.tool-ad-sidebar {
  width: 300px;
  flex-shrink: 0;
  display: none;
}

@media (min-width: 1536px) {
  .tool-ad-sidebar {
    display: block;
  }
}

.ad-sticky-box {
  position: sticky;
  top: 2rem;
}

/* Migas de pan */
.tool-breadcrumbs {
  margin-bottom: 1.25rem;
  font-size: 0.85rem;
}

.tool-breadcrumbs-list {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  list-style: none;
  padding: 0;
  margin: 0;
  gap: 0.5rem;
  color: var(--text-muted);
}

.tool-breadcrumbs-item a {
  color: var(--text-secondary);
  text-decoration: none;
  transition: color 0.15s ease;
}

.tool-breadcrumbs-item a:hover {
  color: var(--color-brand);
}

.tool-breadcrumbs-item:not(:last-child)::after {
  content: "›";
  margin-left: 0.5rem;
  color: var(--text-muted);
}

.tool-breadcrumbs-item[aria-current="page"] {
  color: var(--text-primary);
  font-weight: 500;
}

/* Badge meteo en cabecera */
.badge-meteo {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.35rem 0.65rem;
  border-radius: 9999px;
  background: rgba(56, 189, 248, 0.12);
  color: var(--color-brand);
  border: 1px solid rgba(56, 189, 248, 0.25);
}

/* Tarjeta principal */
.card-main {
  background-color: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  box-shadow: var(--shadow-md);
  margin-bottom: 2rem;
}

@media (max-width: 640px) {
  .card-main {
    padding: 1.2rem;
  }
}

/* Introducción y presets */
.tool-intro-box {
  margin-bottom: 1.75rem;
  padding-bottom: 1.5rem;
  border-bottom: 1px solid var(--border-color);
}

.tool-intro-title {
  font-size: 1.45rem;
  margin-bottom: 0.5rem;
}

.tool-intro-desc {
  font-size: 0.95rem;
  color: var(--text-secondary);
  margin: 0 0 1rem;
  max-width: 820px;
}

.preset-routes-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}

.preset-label {
  font-size: 0.82rem;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.btn-pill-peak {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  color: var(--text-secondary);
  padding: 0.35rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-pill-peak:hover {
  background: rgba(56, 189, 248, 0.12);
  border-color: var(--color-brand);
  color: var(--color-brand);
  transform: translateY(-1px);
}

/* Rejilla de trabajo: Controles vs Gráfico */
.meteo-workspace-grid {
  display: grid;
  grid-template-columns: 1fr 1.15fr;
  gap: 1.5rem;
  align-items: stretch;
}

@media (max-width: 960px) {
  .meteo-workspace-grid {
    grid-template-columns: 1fr;
  }
}

.controls-column {
  display: flex;
  flex-direction: column;
}

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

.panel-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.panel-icon-box {
  width: 36px;
  height: 36px;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.base-icon {
  background: rgba(245, 158, 11, 0.12);
  color: var(--color-warning);
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.summit-icon {
  background: rgba(16, 185, 129, 0.12);
  color: var(--color-summit);
  border: 1px solid rgba(16, 185, 129, 0.25);
}

.panel-title {
  font-size: 1.05rem;
  margin: 0;
}

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

/* Sliders interactivos con altura táctil */
.form-field-slider {
  display: flex;
  flex-direction: column;
  gap: 0.4rem;
}

.slider-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
}

.slider-header label {
  font-size: 0.84rem;
  font-weight: 600;
  color: var(--text-secondary);
}

.slider-val-display {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.custom-slider {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: var(--border-color);
  outline: none;
  -webkit-appearance: none;
  appearance: none;
  cursor: pointer;
  margin: 8px 0;
}

.custom-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-brand);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: grab;
  transition: transform 0.1s, background 0.15s;
}

.custom-slider::-webkit-slider-thumb:active {
  cursor: grabbing;
  transform: scale(1.15);
}

.custom-slider::-moz-range-thumb {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  background: var(--color-brand);
  border: 2px solid #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.4);
  cursor: grab;
}

.field-help {
  font-size: 0.73rem;
  color: var(--text-muted);
}

/* Tarjeta del visor de montaña SVG */
.visual-column {
  display: flex;
  flex-direction: column;
}

.mountain-viewport-card {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  height: 100%;
  box-sizing: border-box;
}

.mountain-viewport-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.85rem;
}

.viewport-title {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
}

.mountain-cloud-status {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 0.25rem 0.65rem;
  border-radius: 9999px;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
}

.badge-cloud-clear {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.badge-cloud-fog {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

.mountain-svg-wrapper {
  position: relative;
  width: 100%;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: inset 0 2px 6px rgba(0, 0, 0, 0.4);
  background: #071226;
  aspect-ratio: 600 / 460;
  display: flex;
  align-items: center;
  justify-content: center;
}

.mountain-svg-wrapper svg {
  width: 100%;
  height: 100%;
  display: block;
}

.mountain-legend-footer {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-around;
  gap: 0.65rem;
  margin-top: 1rem;
  padding-top: 0.85rem;
  border-top: 1px solid var(--border-color);
  font-size: 0.74rem;
  color: var(--text-secondary);
}

.legend-chip {
  display: flex;
  align-items: center;
  gap: 0.35rem;
}

.chip-color {
  width: 12px;
  height: 12px;
  border-radius: 2px;
}

.color-summit { background: #10b981; }
.color-cloud { background: rgba(226, 232, 240, 0.85); border: 1px solid #94a3b8; }
.color-iso { background: #38bdf8; }
.color-base { background: #f59e0b; }

/* Rejilla de Métricas de Resultados */
.results-cards-grid {
  display: grid;
  grid-template-columns: repeat(3, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 860px) {
  .results-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .results-cards-grid {
    grid-template-columns: 1fr;
  }
}

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

.result-card.highlight-wind-card {
  background: linear-gradient(135deg, rgba(56, 189, 248, 0.1), rgba(99, 102, 241, 0.08));
  border-color: rgba(56, 189, 248, 0.35);
}

.result-label {
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  margin-bottom: 0.4rem;
}

.result-value {
  font-size: 1.6rem;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1.1;
  margin-bottom: 0.35rem;
}

.result-sub {
  font-size: 0.74rem;
  color: var(--text-muted);
}

.result-status-badge {
  display: inline-flex;
  align-items: center;
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
  width: fit-content;
}

.badge-chill-safe {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.badge-chill-warning {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge-chill-danger {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

/* Sistema de Tres Capas */
.layering-system-box {
  background: var(--bg-card-subtle);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  padding: 1.35rem;
}

.layering-header {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  margin-bottom: 1.15rem;
}

.layering-header svg {
  color: var(--color-brand);
  flex-shrink: 0;
}

.layering-title {
  font-size: 1.1rem;
  margin: 0;
}

.layering-sub {
  font-size: 0.76rem;
  color: var(--text-muted);
}

.layers-cards-grid {
  display: grid;
  grid-template-columns: repeat(4, minmax(0, 1fr));
  gap: 1rem;
}

@media (max-width: 960px) {
  .layers-cards-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}

@media (max-width: 500px) {
  .layers-cards-grid {
    grid-template-columns: 1fr;
  }
}

.layer-item-card {
  background: var(--bg-card);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-sm);
  padding: 1rem;
  display: flex;
  flex-direction: column;
}

.layer-tag {
  font-size: 0.7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--color-brand);
  margin-bottom: 0.35rem;
}

.layer-name {
  font-size: 0.88rem;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.layer-desc {
  font-size: 0.74rem;
  color: var(--text-secondary);
  line-height: 1.35;
  margin: 0;
}

/* Clases de utilidad */
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1.25rem; }
.mt-5 { margin-top: 2rem; }
