: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 (Amarillo y Naranja) */
    --amber-primary: #ffb300;
    --amber-glow: rgba(255, 179, 0, 0.5);
    --amber-border: rgba(255, 179, 0, 0.3);
    --amber-bg: rgba(255, 179, 0, 0.15);

    --orange-primary: #ff6d00;
    --orange-glow: rgba(255, 109, 0, 0.5);
    --orange-border: rgba(255, 109, 0, 0.3);
    --orange-bg: rgba(255, 109, 0, 0.12);

    --cyan-primary: #00d2ff;
    --cyan-border: rgba(0, 210, 255, 0.3);
    --cyan-bg: rgba(0, 210, 255, 0.1);

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

    --red-primary: #ff6b6b;
    --red-border: rgba(255, 107, 107, 0.4);
    --red-bg: rgba(255, 107, 107, 0.1);

    --separator-color: rgba(255, 255, 255, 0.2);
    --shadow-color: rgba(0, 0, 0, 0.3);
}

[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 adaptados a claridad */
    --amber-primary: #d37a00;
    --amber-glow: rgba(211, 122, 0, 0.3);
    --amber-border: rgba(211, 122, 0, 0.4);
    --amber-bg: rgba(211, 122, 0, 0.08);

    --orange-primary: #e65100;
    --orange-glow: rgba(230, 81, 0, 0.3);
    --orange-border: rgba(230, 81, 0, 0.4);
    --orange-bg: rgba(230, 81, 0, 0.08);

    --cyan-primary: #0077a3;
    --cyan-border: rgba(0, 119, 163, 0.4);
    --cyan-bg: rgba(0, 119, 163, 0.08);

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

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

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

/* ========== 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(--amber-primary);
}

/* ========== 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(--amber-primary);
    text-shadow: 0 0 20px var(--amber-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(--amber-primary);
    background: transparent;
    border: none;
    border-bottom: 3px solid var(--amber-primary);
    text-shadow: 0 0 10px var(--amber-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;
}

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

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

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

/* ========== SELECTORES DE GRID ========== */
.grid-selector-container {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 10px;
    margin-bottom: 1.5rem;
}

.grid-option-card {
    border: 1px solid var(--card-border);
    background: rgba(0,0,0,0.15);
    border-radius: 8px;
    padding: 0.8rem;
    cursor: pointer;
    text-align: center;
    transition: all 0.2s ease;
}

.grid-option-card:hover {
    border-color: var(--amber-primary);
    background: var(--amber-bg);
}

.grid-option-card.active {
    border-color: var(--amber-primary);
    background: var(--amber-bg);
    box-shadow: 0 0 10px var(--amber-glow);
}

.grid-option-card i {
    font-size: 1.5rem;
    margin-bottom: 5px;
    display: block;
    color: var(--text-subtitle);
}

.grid-option-card.active i {
    color: var(--amber-primary);
}

.grid-option-title {
    font-size: 0.85rem;
    font-weight: 700;
    color: var(--text-main);
    display: block;
}

/* ========== RADIAL/PROGRESS CIRCULAR DE EFICIENCIA ========== */
.efficiency-radial-container {
    position: relative;
    width: 130px;
    height: 130px;
    margin: 0 auto 10px;
}

.efficiency-svg {
    transform: rotate(-90deg);
    width: 100%;
    height: 100%;
}

.efficiency-svg-bg {
    fill: none;
    stroke: var(--separator-color);
    stroke-width: 8px;
}

.efficiency-svg-progress {
    fill: none;
    stroke: var(--amber-primary);
    stroke-width: 8px;
    stroke-linecap: round;
    transition: stroke-dashoffset 0.5s ease;
}

.efficiency-value-text {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 1.6rem;
    font-weight: 800;
    color: var(--text-title);
    text-shadow: 0 0 10px var(--amber-glow);
}

/* ========== DISPLAYS ========== */
.display-result {
    font-size: 2.3rem;
    font-weight: 800;
    color: var(--amber-primary);
    text-shadow: 0 0 15px var(--amber-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.2rem;
    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(--orange-bg);
    border: 1px solid var(--orange-border);
    border-left-width: 4px;
    border-left-color: var(--orange-primary);
    color: var(--text-main);
}
.diagnostic-yellow i, .diagnostic-yellow h5 {
    color: var(--orange-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(--amber-primary);
}

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

.spec-box-amber {
    background: var(--amber-bg);
    border: 1px solid var(--amber-border);
}
.spec-box-amber i, .spec-box-amber h5 {
    color: var(--amber-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-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: rgba(183, 148, 246, 0.1);
    border: 1px solid rgba(183, 148, 246, 0.3);
}
.spec-box-purple i, .spec-box-purple h5 {
    color: #b794f6;
}

.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: 1.9rem;
    }
    .grid-selector-container {
        grid-template-columns: 1fr;
    }
}
