:root {
    /* --- TEMA DARK (Por defecto) --- */
    --bg-main: radial-gradient(circle at top center, #1b263b 0%, #0b0d17 80%);
    --text-main: #d0d7e5;
    --text-title: #ffffff;
    --text-muted: #9fa5c0;
    --text-subtitle: rgba(255, 255, 255, 0.5);

    /* Tarjetas */
    --card-bg: rgba(21, 28, 45, 0.85);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-shadow: rgba(0, 0, 0, 0.4);

    /* Colores temáticos */
    --ev-cyan: #00d2ff;
    --ev-cyan-glow: rgba(0, 210, 255, 0.4);
    --ev-cyan-bg: rgba(0, 210, 255, 0.12);

    --ice-red: #ff4d4d;
    --ice-red-glow: rgba(255, 77, 77, 0.4);
    --ice-red-bg: rgba(255, 77, 77, 0.12);

    --green-primary: #2ecc71;
    --green-glow: rgba(46, 204, 113, 0.4);
    --green-bg: rgba(46, 204, 113, 0.12);

    --separator-color: rgba(255, 255, 255, 0.15);
    --shadow-color: rgba(0, 0, 0, 0.4);
}

[data-theme='light'] {
    /* --- TEMA LIGHT --- */
    --bg-main: linear-gradient(135deg, #f4f7fb 0%, #e3e8f0 100%);
    --text-main: #333d4f;
    --text-title: #181d28;
    --text-muted: #677288;
    --text-subtitle: #7a869e;

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

    /* Ajustes claros */
    --ev-cyan: #00779a;
    --ev-cyan-glow: rgba(0, 119, 154, 0.25);
    --ev-cyan-bg: rgba(0, 119, 154, 0.08);

    --ice-red: #c0392b;
    --ice-red-glow: rgba(192, 57, 43, 0.25);
    --ice-red-bg: rgba(192, 57, 43, 0.08);

    --green-primary: #27ae60;
    --green-glow: rgba(39, 174, 96, 0.25);
    --green-bg: rgba(39, 174, 96, 0.08);

    --separator-color: rgba(0, 0, 0, 0.12);
    --shadow-color: rgba(0, 0, 0, 0.12);
}

/* ========== GENERAL ========== */
body {
    background: var(--bg-main) !important;
    color: var(--text-main);
    font-family: 'Outfit', 'Inter', sans-serif;
}

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

/* ========== THEME TOGGLE (Alineación requerida) ========== */
.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 cubic-bezier(0.4, 0, 0.2, 1);
}

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

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

/* ========== TEXTOS Y LEGIBILIDAD ========== */
.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 de pequeños y mutados */
.text-muted, .small-muted, .small, .form-text {
    color: var(--text-muted) !important;
}

.main-title {
    color: var(--ev-cyan);
    text-shadow: 0 0 20px var(--ev-cyan-glow);
    font-weight: 800;
    letter-spacing: -0.5px;
}

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

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

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

.nav-tabs-custom .nav-link {
    color: var(--text-subtitle);
    border: none;
    background: transparent;
    padding: 0.9rem 1.8rem;
    font-weight: 700;
    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(--ev-cyan);
    background: transparent;
    border: none;
    border-bottom: 3px solid var(--ev-cyan);
    text-shadow: 0 0 12px var(--ev-cyan-glow);
}

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

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

/* Slider Eléctrico (Cian) */
.range-ev .custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ev-cyan);
    cursor: pointer;
    box-shadow: 0 0 12px var(--ev-cyan-glow);
    transition: transform 0.1s ease;
}
.range-ev .custom-range::-webkit-slider-thumb:hover { transform: scale(1.25); }

.range-ev .custom-range::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ev-cyan);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 12px var(--ev-cyan-glow);
    transition: transform 0.1s ease;
}
.range-ev .custom-range::-moz-range-thumb:hover { transform: scale(1.25); }

.range-ev .slider-value-badge {
    background: var(--ev-cyan-bg);
    border: 1px solid rgba(0, 210, 255, 0.3);
    color: var(--ev-cyan);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
}

/* Slider Gasolina (Rojo) */
.range-ice .custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ice-red);
    cursor: pointer;
    box-shadow: 0 0 12px var(--ice-red-glow);
    transition: transform 0.1s ease;
}
.range-ice .custom-range::-webkit-slider-thumb:hover { transform: scale(1.25); }

.range-ice .custom-range::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--ice-red);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 12px var(--ice-red-glow);
    transition: transform 0.1s ease;
}
.range-ice .custom-range::-moz-range-thumb:hover { transform: scale(1.25); }

.range-ice .slider-value-badge {
    background: var(--ice-red-bg);
    border: 1px solid rgba(255, 77, 77, 0.3);
    color: var(--ice-red);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
}

/* Slider Global (Cian) */
.range-global .custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--green-primary);
    cursor: pointer;
    box-shadow: 0 0 12px var(--green-glow);
    transition: transform 0.1s ease;
}
.range-global .custom-range::-webkit-slider-thumb:hover { transform: scale(1.25); }

.range-global .custom-range::-moz-range-thumb {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: var(--green-primary);
    cursor: pointer;
    border: none;
    box-shadow: 0 0 12px var(--green-glow);
    transition: transform 0.1s ease;
}
.range-global .custom-range::-moz-range-thumb:hover { transform: scale(1.25); }

.range-global .slider-value-badge {
    background: var(--green-bg);
    border: 1px solid rgba(46, 204, 113, 0.3);
    color: var(--green-primary);
    padding: 0.25rem 0.75rem;
    border-radius: 0.5rem;
    font-size: 0.95rem;
    font-weight: 700;
}

/* ========== SWITCH DE DEDUCCIONES ========== */
.custom-switch-container {
    background: rgba(0, 0, 0, 0.25);
    border: 1px solid var(--card-border);
    padding: 0.8rem 1rem;
    border-radius: 12px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.custom-switch-label {
    font-weight: 700;
    font-size: 0.9rem;
}

.switch-toggle {
    position: relative;
    display: inline-block;
    width: 52px;
    height: 28px;
    margin-bottom: 0;
}

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

.slider-switch {
    position: absolute;
    cursor: pointer;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--separator-color);
    transition: .3s;
    border-radius: 34px;
}

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

input:checked + .slider-switch {
    background-color: var(--ev-cyan);
    box-shadow: 0 0 8px var(--ev-cyan-glow);
}

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

/* ========== DISPLAYS ========== */
.display-result-wrapper {
    text-align: center;
    padding: 1.2rem;
    background: rgba(0, 0, 0, 0.18);
    border-radius: 14px;
    border: 1px solid var(--card-border);
    transition: all 0.3s ease;
    height: 100%;
}

.display-result-wrapper.ev-card {
    background: var(--ev-cyan-bg);
    border-color: rgba(0, 210, 255, 0.25);
}

.display-result-wrapper.ice-card {
    background: var(--ice-red-bg);
    border-color: rgba(255, 77, 77, 0.25);
}

.display-result-wrapper.green-card {
    background: var(--green-bg);
    border-color: rgba(46, 204, 113, 0.25);
}

.display-result {
    font-size: 2.1rem;
    font-weight: 800;
    margin-bottom: 2px;
    line-height: 1.2;
}

.display-label {
    font-size: 0.8rem;
    color: var(--text-subtitle);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1.2px;
}

/* ========== GRÁFICAS ========== */
.chart-container {
    position: relative;
    width: 100%;
    height: 320px;
}

/* ========== PANELES DE DIAGNÓSTICO ========== */
.diagnostic-alert {
    border-radius: 14px;
    padding: 1.25rem 1.5rem;
    margin-bottom: 0;
    border-left: 5px solid transparent;
    display: flex;
    align-items: flex-start;
    animation: fadeIn 0.4s ease-out;
}

.diagnostic-alert i {
    font-size: 1.7rem;
    margin-right: 15px;
    margin-top: 3px;
}

.diagnostic-alert h5 {
    font-weight: 800;
    margin-bottom: 6px;
    font-size: 1.1rem;
}

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

.status-fast {
    background: var(--green-bg);
    border: 1px solid rgba(46, 204, 113, 0.22);
    border-left: 5px solid var(--green-primary);
    color: var(--text-main);
}
.status-fast i, .status-fast h5 { color: var(--green-primary); }

.status-standard {
    background: var(--ev-cyan-bg);
    border: 1px solid rgba(0, 210, 255, 0.22);
    border-left: 5px solid var(--ev-cyan);
    color: var(--text-main);
}
.status-standard i, .status-standard h5 { color: var(--ev-cyan); }

.status-slow {
    background: var(--ice-red-bg);
    border: 1px solid rgba(255, 77, 77, 0.22);
    border-left: 5px solid var(--ice-red);
    color: var(--text-main);
}
.status-slow i, .status-slow h5 { color: var(--ice-red); }

/* ========== SECCIÓN DE FUNDAMENTOS ========== */
.theory-intro-card {
    border-bottom: 3px solid var(--ev-cyan);
    margin-bottom: 2rem;
}

.theory-block {
    padding: 1.5rem;
    border-radius: 14px;
    height: 100%;
    border: 1px solid var(--card-border);
    background: rgba(0, 0, 0, 0.15);
    transition: transform 0.25s ease;
}

.theory-block:hover {
    transform: translateY(-4px);
}

.theory-block i {
    font-size: 2rem;
    margin-bottom: 12px;
}

.theory-block h5 {
    font-weight: 800;
    margin-bottom: 10px;
    font-size: 1.15rem;
}

.theory-block p {
    font-size: 0.9rem;
    line-height: 1.6;
    margin-bottom: 0;
}

.block-cyan i, .block-cyan h5 { color: var(--ev-cyan); }
.block-red i, .block-red h5 { color: var(--ice-red); }
.block-green i, .block-green h5 { color: var(--green-primary); }
.block-purple i, .block-purple h5 { color: #b794f6; }

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

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