/* ============================================================================
   ESTILOS PREMIUM - COMPARADOR Y CALCULADORA DE DESGASTE DE NEUMÁTICOS
   ============================================================================ */

/* --- Variables de Diseño con Paletas HSL Tailored --- */
:root {
    --bg-dark: #0f1319;
    --card-dark: #161b22;
    --border-dark: rgba(255, 255, 255, 0.05);
    --text-dark-primary: #e0e6ed;
    --text-dark-secondary: #8b949e;
    
    --bg-light: #f4f6f9;
    --card-light: #ffffff;
    --border-light: rgba(0, 0, 0, 0.05);
    --text-light-primary: #2c3e50;
    --text-light-secondary: #6c757d;

    /* Colores semánticos HSL dinámicos */
    --optimal-hue: 145; /* Verde */
    --rotate-hue: 48;   /* Amarillo */
    --warning-hue: 28;  /* Naranja */
    --danger-hue: 0;    /* Rojo */
}

/* --- Transiciones globales --- */
body {
    transition: background-color 0.4s ease, color 0.4s ease;
}

/* --- Temas (Oscuro/Claro) --- */
body[data-theme="dark"] {
    background-color: var(--bg-dark);
    color: var(--text-dark-primary);
}
body[data-theme="dark"] .card-clean {
    background-color: var(--card-dark);
    border: 1px solid var(--border-dark);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.2);
}
body[data-theme="dark"] .text-white-custom {
    color: #ffffff !important;
}
body[data-theme="dark"] .text-light-custom {
    color: var(--text-dark-secondary) !important;
}
body[data-theme="dark"] .range-slider-container {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
}

body[data-theme="light"] {
    background-color: var(--bg-light);
    color: var(--text-light-primary);
}
body[data-theme="light"] .card-clean {
    background-color: var(--card-light);
    border: 1px solid var(--border-light);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.05);
}
body[data-theme="light"] .text-white-custom {
    color: var(--text-light-primary) !important;
}
body[data-theme="light"] .text-light-custom {
    color: var(--text-light-secondary) !important;
}
body[data-theme="light"] .range-slider-container {
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

/* --- Estructura y Cabecera --- */
.content-wrapper {
    max-width: 1300px;
    margin: 0 auto;
}
.main-title {
    font-family: 'Outfit', sans-serif;
    letter-spacing: -0.5px;
    background: linear-gradient(135deg, #00d2ff 0%, #00f2fe 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}
body[data-theme="light"] .main-title {
    background: linear-gradient(135deg, #005f73 0%, #0a9396 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
}

/* --- Tarjetas de Diseño Premium --- */
.card-clean {
    border-radius: 16px;
    transition: transform 0.3s cubic-bezier(0.165, 0.84, 0.44, 1), box-shadow 0.3s ease;
}
.card-clean:hover {
    transform: translateY(-2px);
}

/* --- Pestañas Personalizadas --- */
.nav-tabs-custom {
    border-bottom: 2px solid rgba(0, 210, 255, 0.1);
    gap: 10px;
    margin-bottom: 2.5rem;
}
.nav-tabs-custom .nav-link {
    border: none;
    color: var(--text-dark-secondary);
    font-weight: 600;
    padding: 10px 24px;
    border-radius: 10px 10px 0 0;
    transition: all 0.3s ease;
    font-family: 'Outfit', sans-serif;
}
body[data-theme="light"] .nav-tabs-custom .nav-link {
    color: var(--text-light-secondary);
}
.nav-tabs-custom .nav-link:hover {
    color: #00d2ff;
    background: rgba(0, 210, 255, 0.05);
}
.nav-tabs-custom .nav-link.active {
    color: #ffffff;
    background: linear-gradient(135deg, #198754 0%, #115e3b 100%);
    box-shadow: 0 4px 15px rgba(25, 135, 84, 0.25);
}

/* --- Sliders Premium --- */
.range-slider-container {
    padding: 18px;
    border-radius: 12px;
}
.custom-range {
    -webkit-appearance: none;
    width: 100%;
    height: 6px;
    border-radius: 3px;
    outline: none;
    background: rgba(255, 255, 255, 0.1);
    transition: background 0.3s;
}
body[data-theme="light"] .custom-range {
    background: rgba(0, 0, 0, 0.1);
}
.custom-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: #00d2ff;
    cursor: pointer;
    box-shadow: 0 0 10px rgba(0, 210, 255, 0.5);
    transition: transform 0.1s, background-color 0.2s;
}
body[data-theme="light"] .custom-range::-webkit-slider-thumb {
    background: #005f73;
    box-shadow: 0 0 8px rgba(0, 95, 115, 0.4);
}
.custom-range::-webkit-slider-thumb:hover {
    transform: scale(1.2);
}
.slider-value-badge {
    background: rgba(0, 210, 255, 0.15);
    color: #00d2ff;
    padding: 4px 10px;
    border-radius: 8px;
    font-weight: 700;
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
}
body[data-theme="light"] .slider-value-badge {
    background: rgba(0, 95, 115, 0.1);
    color: #005f73;
}

/* --- Custom Selectors (Driving Styles & Tires) --- */
.selector-group {
    display: flex;
    gap: 10px;
    width: 100%;
}
.selector-btn {
    flex: 1;
    border: 1px solid rgba(255, 255, 255, 0.1);
    background: rgba(255, 255, 255, 0.02);
    color: var(--text-dark-primary);
    padding: 12px;
    border-radius: 12px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 5px;
    text-align: center;
}
body[data-theme="light"] .selector-btn {
    border: 1px solid rgba(0, 0, 0, 0.08);
    background: rgba(0, 0, 0, 0.02);
    color: var(--text-light-primary);
}
.selector-btn i {
    font-size: 1.4rem;
    opacity: 0.7;
    transition: transform 0.3s ease;
}
.selector-btn:hover {
    border-color: #00d2ff;
    background: rgba(0, 210, 255, 0.05);
}
.selector-btn:hover i {
    transform: translateY(-2px);
}
.selector-btn.active {
    border-color: #198754;
    background: rgba(25, 135, 84, 0.12);
    color: #ffffff;
    box-shadow: 0 0 15px rgba(25, 135, 84, 0.2);
}
body[data-theme="light"] .selector-btn.active {
    background: rgba(25, 135, 84, 0.08);
    color: #198754;
}

/* --- Neumáticos Visualizer Graphic --- */
.tire-visualizer-container {
    display: flex;
    flex-direction: column;
    gap: 25px;
    padding: 10px;
}
.tire-card-wrapper {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    padding: 20px;
    border-radius: 16px;
    position: relative;
    overflow: hidden;
}
body[data-theme="light"] .tire-card-wrapper {
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

/* El dibujo visual de la banda de rodadura */
.tread-visual-ribs {
    width: 60px;
    height: 120px;
    background: #1e222b;
    border-radius: 10px;
    border: 3px solid #2e3542;
    display: flex;
    flex-direction: column;
    justify-content: space-around;
    padding: 5px;
    box-shadow: inset 0 0 15px rgba(0, 0, 0, 0.5);
    position: relative;
}
body[data-theme="light"] .tread-visual-ribs {
    background: #2d3436;
    border-color: #636e72;
}

.tread-groove {
    height: 6px;
    background: #0f1319;
    border-radius: 3px;
    opacity: 0.8;
}

/* Medidor vertical de profundidad */
.tread-depth-indicator {
    position: absolute;
    bottom: 5px;
    left: 5px;
    right: 5px;
    height: 0%; /* Reactivo via JS */
    border-radius: 6px;
    background: linear-gradient(to top, hsla(var(--hue), 80%, 45%, 0.8), hsla(var(--hue), 85%, 55%, 0.8));
    transition: height 0.6s cubic-bezier(0.25, 0.46, 0.45, 0.94), background 0.4s ease;
    box-shadow: 0 0 10px hsla(var(--hue), 80%, 50%, 0.4);
}

.tread-depth-label {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-weight: 800;
    font-size: 1.1rem;
    color: #ffffff;
    text-shadow: 0 2px 5px rgba(0, 0, 0, 0.8);
    pointer-events: none;
    z-index: 2;
}

/* KPIs de cada rueda */
.tire-kpi-info {
    flex: 1;
}

.tire-badge-axle {
    font-family: 'Outfit', sans-serif;
    font-weight: 700;
    font-size: 0.8rem;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #00d2ff;
    margin-bottom: 5px;
    display: inline-block;
}
body[data-theme="light"] .tire-badge-axle {
    color: #005f73;
}

.display-result-wrapper {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 12px;
    padding: 16px;
    transition: all 0.3s ease;
}
body[data-theme="light"] .display-result-wrapper {
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.03);
}

.display-label {
    font-size: 0.8rem;
    color: var(--text-dark-secondary);
    font-weight: 600;
}
body[data-theme="light"] .display-label {
    color: var(--text-light-secondary);
}

.display-result {
    font-size: 2.2rem;
    font-weight: 800;
    font-family: 'Outfit', sans-serif;
    line-height: 1.1;
    margin-bottom: 0;
}

/* --- Panel de Diagnóstico dinámico --- */
.diagnostic-alert {
    display: flex;
    gap: 15px;
    padding: 20px;
    border-radius: 12px;
    margin-bottom: 15px;
    border-left: 5px solid;
    animation: fadeIn 0.4s ease-out;
}
.diagnostic-alert i {
    font-size: 1.8rem;
    line-height: 1;
}
.diagnostic-alert h5 {
    font-weight: 700;
    margin-bottom: 5px;
    font-family: 'Outfit', sans-serif;
    font-size: 1.05rem;
}
.diagnostic-alert p {
    font-size: 0.9rem;
    margin-bottom: 0;
    line-height: 1.4;
}

/* Umbrales de color dinámicos */
.status-optimal {
    background: rgba(25, 135, 84, 0.1);
    border-color: #198754;
    color: #a3cfbb;
}
body[data-theme="light"] .status-optimal {
    background: rgba(25, 135, 84, 0.05);
    color: #198754;
}
.status-rotate {
    background: rgba(255, 193, 7, 0.1);
    border-color: #ffc107;
    color: #ffe69c;
}
body[data-theme="light"] .status-rotate {
    background: rgba(255, 193, 7, 0.05);
    color: #856404;
}
.status-warning {
    background: rgba(253, 126, 20, 0.1);
    border-color: #fd7e14;
    color: #ffcab0;
}
body[data-theme="light"] .status-warning {
    background: rgba(253, 126, 20, 0.05);
    color: #b25400;
}
.status-danger {
    background: rgba(220, 53, 69, 0.1);
    border-color: #dc3545;
    color: #f8d7da;
}
body[data-theme="light"] .status-danger {
    background: rgba(220, 53, 69, 0.05);
    color: #dc3545;
}

/* --- Panel de Teoría (Fundamentos de desgaste) --- */
.theory-block {
    background: rgba(255, 255, 255, 0.02);
    border: 1px solid rgba(255, 255, 255, 0.04);
    border-radius: 14px;
    padding: 24px;
    height: 100%;
    transition: all 0.3s ease;
}
body[data-theme="light"] .theory-block {
    background: rgba(0, 0, 0, 0.01);
    border: 1px solid rgba(0, 0, 0, 0.03);
}
.theory-block:hover {
    transform: translateY(-2px);
}
.theory-block i {
    font-size: 2.2rem;
    margin-bottom: 15px;
    display: inline-block;
}
.theory-block h5 {
    font-weight: 700;
    margin-bottom: 12px;
    font-family: 'Outfit', sans-serif;
    color: #ffffff;
}
body[data-theme="light"] .theory-block h5 {
    color: var(--text-light-primary);
}
.theory-block p {
    font-size: 0.9rem;
    line-height: 1.5;
    margin-bottom: 0;
}

/* Decoradores de bloques teóricos */
.block-blue i { color: #00d2ff; }
.block-blue { border-top: 3px solid #00d2ff; }
.block-red i { color: #dc3545; }
.block-red { border-top: 3px solid #dc3545; }
.block-green i { color: #198754; }
.block-green { border-top: 3px solid #198754; }
.block-purple i { color: #a29bfe; }
.block-purple { border-top: 3px solid #a29bfe; }

/* --- Alternador flotante oficial de tema --- */
.theme-toggle {
    position: fixed;
    bottom: 25px;
    right: 25px;
    width: 50px;
    height: 50px;
    background: rgba(25, 135, 84, 0.95);
    border: 2px solid rgba(255, 255, 255, 0.1);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 1.3rem;
    cursor: pointer;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    z-index: 1000;
    transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}
.theme-toggle:hover {
    transform: scale(1.1) rotate(15deg);
    background: #198754;
    box-shadow: 0 12px 40px rgba(25, 135, 84, 0.4);
}

/* --- Animación de fade-in --- */
@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* --- Adaptabilidad responsiva --- */
@media (max-width: 991.98px) {
    .selector-group {
        flex-direction: column;
    }
    .tire-card-wrapper {
        flex-direction: column;
        text-align: center;
        padding: 15px;
    }
    .tread-visual-ribs {
        margin: 0 auto 10px;
    }
}
