:root {
    /* --- TEMA DARK (Por defecto) --- */
    --bg-main: radial-gradient(circle at top center, #1a2a3a 0%, #0f1214 80%);
    --text-main: #e0e0e0;
    --text-title: #ffffff;
    --text-muted: #ced4da;
    --text-subtitle: rgba(255, 255, 255, 0.5);

    /* Tarjetas */
    --card-bg: rgba(30, 35, 40, 0.8);
    --card-border: rgba(255, 255, 255, 0.1);
    --card-shadow: rgba(0, 0, 0, 0.3);

    /* Colores de acento */
    --cyan-primary: #00d2ff;
    --cyan-glow: rgba(0, 210, 255, 0.5);
    --cyan-border: rgba(0, 210, 255, 0.3);
    --cyan-bg: rgba(0, 210, 255, 0.15);

    --yellow-primary: #ffc107;
    --yellow-glow: rgba(255, 193, 7, 0.4);
    --yellow-border: rgba(255, 193, 7, 0.3);
    --yellow-bg: rgba(255, 193, 7, 0.15);

    --green-primary: #2ecc71;
    --green-glow: rgba(46, 204, 113, 0.3);
    --green-border: rgba(25, 135, 84, 0.4);
    --green-bg: rgba(25, 135, 84, 0.15);

    --red-primary: #ff6b6b;
    --red-glow: rgba(231, 76, 60, 0.3);
    --red-border: rgba(220, 53, 69, 0.4);
    --red-bg: rgba(220, 53, 69, 0.1);

    --orange-primary: #ff7e5f;
    --orange-glow: rgba(255, 126, 95, 0.3);
    --orange-border: rgba(255, 126, 95, 0.4);
    --orange-bg: rgba(255, 126, 95, 0.1);

    --purple-primary: #b794f6;
    --purple-border: rgba(183, 148, 246, 0.3);
    --purple-bg: rgba(183, 148, 246, 0.15);

    /* Separadores y temas */
    --separator-color: rgba(255, 255, 255, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.3);
    --info-box-bg: rgba(0, 0, 0, 0.3);

    /* Termómetro visual */
    --temp-blue: #00d2ff;
    --temp-orange: #ff7e5f;
}

[data-theme='light'] {
    /* --- TEMA LIGHT --- */
    --bg-main: linear-gradient(135deg, #f0f4f8 0%, #e8eef3 100%);
    --text-main: #212529;
    --text-title: #1a1d21;
    --text-muted: #495057;
    --text-subtitle: #6c757d;

    /* Tarjetas */
    --card-bg: #ffffff;
    --card-border: rgba(0, 0, 0, 0.15);
    --card-shadow: rgba(0, 0, 0, 0.15);

    /* Colores de acento */
    --cyan-primary: #0077a3;
    --cyan-glow: rgba(0, 119, 163, 0.3);
    --cyan-border: rgba(0, 119, 163, 0.4);
    --cyan-bg: rgba(0, 119, 163, 0.08);

    --yellow-primary: #d39e00;
    --yellow-glow: rgba(211, 158, 0, 0.3);
    --yellow-border: rgba(211, 158, 0, 0.4);
    --yellow-bg: rgba(255, 193, 7, 0.1);

    --green-primary: #198754;
    --green-glow: rgba(25, 135, 84, 0.3);
    --green-border: rgba(25, 135, 84, 0.5);
    --green-bg: rgba(25, 135, 84, 0.08);

    --red-primary: #dc3545;
    --red-glow: rgba(220, 53, 69, 0.3);
    --red-border: rgba(220, 53, 69, 0.5);
    --red-bg: rgba(220, 53, 69, 0.08);

    --orange-primary: #e65c00;
    --orange-glow: rgba(230, 92, 0, 0.3);
    --orange-border: rgba(230, 92, 0, 0.5);
    --orange-bg: rgba(230, 92, 0, 0.08);

    --purple-primary: #6f42c1;
    --purple-border: rgba(111, 66, 193, 0.4);
    --purple-bg: rgba(111, 66, 193, 0.08);

    --separator-color: rgba(0, 0, 0, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.15);
    --info-box-bg: #f8f9fa;
}

/* ========== GENERAL ========== */
body {
    background: var(--bg-main) !important;
    color: var(--text-main);
}

.content-wrapper {
    max-width: 1600px;
    margin: 0 auto;
}

/* ========== THEME TOGGLE ========== */
.theme-toggle {
    position: fixed;
    top: 80px;
    right: 20px;
    width: 45px;
    height: 45px;
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 1000;
    box-shadow: 0 4px 15px var(--shadow-color);
    transition: all 0.3s ease;
}

.theme-toggle:hover {
    transform: scale(1.1);
}

.theme-toggle i {
    font-size: 1.2rem;
    color: var(--cyan-primary);
}

/* ========== TEXTOS Y LEGBILIDAD ========== */
.text-white-custom {
    color: var(--text-title) !important;
}

.text-light-custom {
    color: var(--text-main) !important;
}

.text-white-50-custom {
    color: var(--text-subtitle) !important;
}

/* Blindaje estricto de textos pequeños y mutados */
.text-muted, .small-muted, .small, .form-text {
    color: var(--text-muted) !important;
}

.main-title {
    color: var(--cyan-primary);
    text-shadow: 0 0 20px var(--cyan-glow);
    font-weight: 700;
}

.main-subtitle {
    color: var(--text-subtitle);
}

/* ========== TARJETAS ========== */
.card-clean {
    border: 1px solid var(--card-border);
    border-radius: 1rem;
    box-shadow: 0 4px 12px var(--card-shadow);
    background-color: var(--card-bg);
    backdrop-filter: blur(10px);
    height: 100%;
    color: var(--text-main);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

/* ========== PESTAÑAS (NAVS) ========== */
.nav-tabs-custom {
    border-bottom: 2px solid var(--separator-color);
    margin-bottom: 1.5rem;
}

.nav-tabs-custom .nav-link {
    color: var(--text-subtitle);
    border: none;
    background: transparent;
    padding: 0.8rem 1.5rem;
    font-weight: 600;
    transition: all 0.2s ease;
    border-bottom: 3px solid transparent;
}

.nav-tabs-custom .nav-link:hover {
    color: var(--text-title);
    border-bottom: 3px solid var(--separator-color);
}

.nav-tabs-custom .nav-link.active {
    color: var(--cyan-primary);
    background: transparent;
    border: none;
    border-bottom: 3px solid var(--cyan-primary);
    text-shadow: 0 0 10px var(--cyan-glow);
}

/* ========== SLIDERS ELEGANTES ========== */
.range-slider-container {
    position: relative;
    padding-bottom: 15px;
}

.custom-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--separator-color);
    outline: none;
    transition: background 0.3s ease;
}

.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--cyan-primary);
    cursor: pointer;
    box-shadow: 0 0 10px var(--cyan-glow);
    transition: transform 0.1s ease;
}

.custom-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}

.custom-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: var(--cyan-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 10px var(--cyan-glow);
    transition: transform 0.1s ease;
}

.custom-range::-moz-range-thumb:hover {
    transform: scale(1.2);
}

.slider-value-badge {
    background: var(--cyan-bg);
    border: 1px solid var(--cyan-border);
    color: var(--cyan-primary);
    padding: 0.2rem 0.6rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    font-weight: 700;
}

/* ========== SWITCHES DINÁMICOS ========== */
.form-check-input:checked {
    background-color: var(--cyan-primary) !important;
    border-color: var(--cyan-primary) !important;
    box-shadow: 0 0 8px var(--cyan-glow) !important;
}

.form-switch .form-check-input {
    width: 2.5em;
    height: 1.25em;
    cursor: pointer;
}

.form-check-label {
    cursor: pointer;
    font-weight: 500;
}

/* ========== VISUALIZADOR DE CLIMA DINÁMICO ========== */
.climate-visualizer {
    position: relative;
    border-radius: 12px;
    overflow: hidden;
    height: 120px;
    margin-bottom: 1.5rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--card-border);
    transition: background 0.5s ease;
}

.climate-visualizer::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    opacity: 0.35;
    z-index: 1;
    transition: background 0.5s ease;
}

.climate-visualizer-content {
    position: relative;
    z-index: 2;
    text-align: center;
}

.climate-visualizer-icon {
    font-size: 2.2rem;
    margin-bottom: 5px;
    display: inline-block;
    transition: transform 0.3s ease;
}

.climate-visualizer-text {
    font-size: 1.1rem;
    font-weight: 700;
    text-shadow: 0 2px 4px rgba(0,0,0,0.5);
}

/* Modos del visualizador */
.climate-frozen::before {
    background: linear-gradient(135deg, #00c6ff 0%, #0072ff 100%);
}
.climate-frozen {
    border-color: #00c6ff;
}

.climate-cool::before {
    background: linear-gradient(135deg, #70e1f5 0%, #ffd194 100%);
}
.climate-cool {
    border-color: #70e1f5;
}

.climate-mild::before {
    background: linear-gradient(135deg, #a8ff78 0%, #78ffd6 100%);
}
.climate-mild {
    border-color: #78ffd6;
}

.climate-warm::before {
    background: linear-gradient(135deg, #f12711 0%, #f5af19 100%);
}
.climate-warm {
    border-color: #f5af19;
}

/* ========== DISPLAYS ENORMES ========== */
.display-result {
    font-size: 2.5rem;
    font-weight: 800;
    color: var(--cyan-primary);
    text-shadow: 0 0 15px var(--cyan-glow);
    margin-bottom: 0;
    line-height: 1.2;
}

.display-label {
    font-size: 0.85rem;
    color: var(--text-subtitle);
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 1px;
}

.result-card-inner {
    padding: 1.5rem;
    border-radius: 12px;
    background: rgba(0,0,0,0.2);
    border: 1px solid rgba(255,255,255,0.05);
}

/* ========== GRÁFICA DE CONTROL ========== */
.chart-container {
    position: relative;
    width: 100%;
    height: 300px;
}

/* ========== PANELES DE DIAGNÓSTICO ========== */
.diagnostic-alert {
    border-radius: 12px;
    padding: 1rem 1.25rem;
    margin-bottom: 1rem;
    border-left: 4px solid transparent;
    display: flex;
    align-items: flex-start;
    animation: fadeIn 0.3s ease-in-out;
}

.diagnostic-alert i {
    font-size: 1.5rem;
    margin-right: 12px;
    margin-top: 2px;
}

.diagnostic-alert h5 {
    font-weight: 700;
    margin-bottom: 4px;
}

.diagnostic-alert p {
    margin-bottom: 0;
    font-size: 0.9rem;
    line-height: 1.5;
}

.diagnostic-green {
    background: var(--green-bg);
    border: 1px solid var(--green-border);
    border-left-width: 4px;
    border-left-color: var(--green-primary);
    color: var(--text-main);
}
.diagnostic-green i, .diagnostic-green h5 {
    color: var(--green-primary);
}

.diagnostic-cyan {
    background: var(--cyan-bg);
    border: 1px solid var(--cyan-border);
    border-left-width: 4px;
    border-left-color: var(--cyan-primary);
    color: var(--text-main);
}
.diagnostic-cyan i, .diagnostic-cyan h5 {
    color: var(--cyan-primary);
}

.diagnostic-yellow {
    background: var(--yellow-bg);
    border: 1px solid var(--yellow-border);
    border-left-width: 4px;
    border-left-color: var(--yellow-primary);
    color: var(--text-main);
}
.diagnostic-yellow i, .diagnostic-yellow h5 {
    color: var(--yellow-primary);
}

.diagnostic-red {
    background: var(--red-bg);
    border: 1px solid var(--red-border);
    border-left-width: 4px;
    border-left-color: var(--red-primary);
    color: var(--text-main);
}
.diagnostic-red i, .diagnostic-red h5 {
    color: var(--red-primary);
}

/* ========== SECCIÓN DE FÍSICA Y TEORÍA ========== */
.physics-card {
    border-left: 4px solid var(--cyan-primary);
}

.physics-image-container {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    margin-bottom: 1.5rem;
    background: #000;
}

.physics-image-container img {
    width: 100%;
    height: auto;
    object-fit: cover;
    transition: transform 0.5s ease;
}

.physics-image-container:hover img {
    transform: scale(1.03);
}

.physics-video-container {
    border-radius: 12px;
    overflow: hidden;
    border: 1px solid var(--card-border);
    margin-bottom: 1.5rem;
    background: #000;
}

.physics-video-container video {
    width: 100%;
    display: block;
}

.spec-box {
    border-radius: 12px;
    padding: 1.25rem;
    height: 100%;
}

.spec-box-cyan {
    background: var(--cyan-bg);
    border: 1px solid var(--cyan-border);
}
.spec-box-cyan i, .spec-box-cyan h5 {
    color: var(--cyan-primary);
}

.spec-box-purple {
    background: var(--purple-bg);
    border: 1px solid var(--purple-border);
}
.spec-box-purple i, .spec-box-purple h5 {
    color: var(--purple-primary);
}

.spec-box-orange {
    background: var(--orange-bg);
    border: 1px solid var(--orange-border);
}
.spec-box-orange i, .spec-box-orange h5 {
    color: var(--orange-primary);
}

.spec-desc {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0;
}

/* ========== ANIMACIONES ========== */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* ========== RESPONSIVE ========== */
@media (max-width: 991px) {
    .theme-toggle {
        top: auto;
        bottom: 20px;
        right: 20px;
    }
    
    .display-result {
        font-size: 2rem;
    }
}
