/* MeteoVillena - Tema oscuro (clase .dark en <html>) */

html.dark { color-scheme: dark; background: #0f172a; }
html.dark body { background-color: #0f172a !important; color: #e2e8f0; }

/* --- Superficies --- */
html.dark .bg-white { background-color: #1e293b; }
html.dark .bg-slate-50 { background-color: #18253b; }
html.dark .bg-slate-100 { background-color: #223047; }
html.dark .bg-slate-800 { background-color: #111c2e; }
html.dark .bg-blue-50 { background-color: rgba(37, 99, 235, .15); }
html.dark .bg-sky-50 { background-color: rgba(14, 165, 233, .15); }
html.dark .bg-yellow-50 { background-color: rgba(234, 179, 8, .12); }
html.dark .bg-amber-50 { background-color: rgba(245, 158, 11, .12); }
html.dark .bg-red-50 { background-color: rgba(239, 68, 68, .12); }
html.dark .bg-green-50 { background-color: rgba(34, 197, 94, .12); }
html.dark .hover\:bg-slate-50:hover { background-color: #223047; }
html.dark .hover\:bg-sky-100:hover { background-color: rgba(14, 165, 233, .25); }
html.dark .hover\:bg-orange-50:hover { background-color: rgba(249, 115, 22, .15); }

/* --- Texto --- */
html.dark .text-slate-800 { color: #e2e8f0; }
html.dark .text-slate-700 { color: #cbd5e1; }
html.dark .text-slate-600 { color: #a8b7cc; }
html.dark .text-slate-500 { color: #94a3b8; }
html.dark .text-slate-400 { color: #8b9bb0; }
html.dark .text-slate-300 { color: #cbd5e1; }
html.dark .text-blue-900 { color: #bfdbfe; }
html.dark .text-blue-800 { color: #bfdbfe; }
html.dark .text-blue-700 { color: #93c5fd; }
html.dark .text-blue-600 { color: #60a5fa; }
html.dark .text-green-700 { color: #86efac; }
html.dark .text-green-600 { color: #4ade80; }
html.dark .text-red-700 { color: #fca5a5; }
html.dark .text-yellow-900 { color: #fef3c7; }
html.dark .text-yellow-800 { color: #fde68a; }
html.dark .text-yellow-800\/70 { color: rgba(253, 230, 138, .7); }
html.dark .text-yellow-700 { color: #fde047; }
html.dark .text-amber-700 { color: #fcd34d; }
html.dark .text-orange-600 { color: #fdba74; }
html.dark .text-sky-900 { color: #bae6fd; }
html.dark .text-sky-700 { color: #7dd3fc; }

/* --- Bordes --- */
html.dark .border-slate-100 { border-color: #334155; }
html.dark .border-slate-200 { border-color: #334155; }
html.dark .border-slate-300 { border-color: #475569; }
html.dark .border-blue-100 { border-color: rgba(59, 130, 246, .35); }
html.dark .border-blue-200 { border-color: rgba(59, 130, 246, .45); }
html.dark .border-yellow-100 { border-color: rgba(234, 179, 8, .35); }
html.dark .border-yellow-200 { border-color: rgba(234, 179, 8, .35); }
html.dark .border-red-200 { border-color: rgba(239, 68, 68, .35); }
html.dark .border-green-200 { border-color: rgba(34, 197, 94, .35); }
html.dark .border-sky-200 { border-color: rgba(14, 165, 233, .4); }
html.dark .border-white\/70 { border-color: rgba(255, 255, 255, .25); }
html.dark .divide-slate-100 > :not([hidden]) ~ :not([hidden]) { border-color: #334155; }
html.dark hr { border-color: #334155; }

/* --- Sombras --- */
html.dark .shadow-sm { box-shadow: 0 1px 2px 0 rgba(0, 0, 0, .6); }
html.dark .shadow-md { box-shadow: 0 4px 6px -1px rgba(0, 0, 0, .55), 0 2px 4px -2px rgba(0, 0, 0, .55); }
html.dark .shadow-lg { box-shadow: 0 10px 15px -3px rgba(0, 0, 0, .6), 0 4px 6px -4px rgba(0, 0, 0, .6); }
html.dark .shadow-xl { box-shadow: 0 20px 25px -5px rgba(0, 0, 0, .6), 0 8px 10px -6px rgba(0, 0, 0, .6); }

/* --- Formularios --- */
html.dark input, html.dark textarea, html.dark select {
    background-color: #0f172a;
    color: #e2e8f0;
    border-color: #475569;
}
html.dark ::placeholder { color: #64748b; }
html.dark input:focus, html.dark textarea:focus, html.dark select:focus { border-color: #60a5fa; }

/* --- Cabecera con fotografía --- */
html.dark .mv-cabecera {
    background-color: #0b1220;
    background-blend-mode: multiply;
}

/* --- Botones propios --- */
html.dark .chart-btn, html.dark .day-btn { background: #223047; color: #cbd5e1; }
html.dark .chart-btn:hover, html.dark .day-btn:hover { background: #2e3d55; }
html.dark .chart-btn-active, html.dark .chart-btn-active:hover,
html.dark .day-btn-active, html.dark .day-btn-active:hover { background: #2563eb; color: #fff; }
html.dark .card-hover:hover { box-shadow: 0 10px 25px rgba(0, 0, 0, .6); }

/* --- Selector de idioma --- */
html.dark .lang-opt[aria-current="true"] { background: #60a5fa; color: #0f172a; border-color: #60a5fa; }

/* --- Botón de tema (junto al selector de idioma) --- */
.theme-toggle {
    cursor: pointer;
    background: transparent;
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}
.theme-toggle:hover { background: rgba(255, 255, 255, .15); }
.theme-toggle:focus-visible { outline: 2px solid #93c5fd; outline-offset: 2px; }
.theme-toggle .fas { pointer-events: none; }
.theme-toggle-fixed {
    position: fixed;
    right: 16px;
    bottom: 16px;
    z-index: 99999;
    width: 46px;
    height: 46px;
    border-radius: 9999px;
    background: #1d4ed8;
    color: #fff;
    border: 1px solid #60a5fa;
    box-shadow: 0 6px 16px rgba(0, 0, 0, .4);
}
.theme-toggle-fixed:hover { background: #2563eb; }

/* --- Mapas Leaflet --- */
html.dark .leaflet-container { background: #0f172a; }
html.dark .leaflet-popup-content-wrapper,
html.dark .leaflet-popup-tip { background: #1e293b; color: #e2e8f0; }
html.dark .leaflet-popup-close-button { color: #94a3b8 !important; }
html.dark .leaflet-bar a,
html.dark .leaflet-bar a:hover { background: #1e293b; color: #e2e8f0; border-bottom-color: #334155; }
html.dark .leaflet-control-attribution { background: rgba(15, 23, 42, .75) !important; color: #94a3b8 !important; }
html.dark .leaflet-control-attribution a { color: #93c5fd !important; }

/* --- Barras de desplazamiento --- */
html.dark ::-webkit-scrollbar { width: 12px; height: 12px; }
html.dark ::-webkit-scrollbar-thumb { background: #334155; border-radius: 6px; }
html.dark ::-webkit-scrollbar-track { background: #0f172a; }
html.dark #citizen-alerts-banner { background: #18253b !important; }
html.dark #citizen-alerts-title,
html.dark #citizen-alerts-icon { color: #e2e8f0 !important; }

/* --- Highcharts (Stock) --- */
html.dark .highcharts-axis-labels tspan,
html.dark .highcharts-axis-labels text,
html.dark .highcharts-axis-title,
html.dark .highcharts-subtitle,
html.dark .highcharts-legend-item text,
html.dark .highcharts-range-selector-buttons text,
html.dark .highcharts-credits { fill: #cbd5e1 !important; }
html.dark .highcharts-title { fill: #e2e8f0 !important; }
