/* ============================================
   AUTODIAGNÓSTICO IA - Frontend con Bootstrap 5
   Estilo institucional premium
   ============================================ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&display=swap');

:root {
    --azul-oscuro: #0f2b46;
    --azul-medio: #1e5fa6;
    --azul-accent: #3b82f6;
    --azul-claro: #eff6ff;
    --azul-gradient: linear-gradient(135deg, #0f2b46 0%, #1e5fa6 50%, #2563eb 100%);
    --gris-texto: #374151;
    --gris-muted: #6b7280;
    --gris-light: #f8fafc;
    --blanco: #ffffff;
    --rojo-nivel: #dc2626;
    --naranja-nivel: #ea580c;
    --verde-nivel: #16a34a;
    --sombra-sm: 0 1px 3px rgba(0,0,0,0.06), 0 1px 2px rgba(0,0,0,0.04);
    --sombra-md: 0 4px 6px -1px rgba(0,0,0,0.07), 0 2px 4px -1px rgba(0,0,0,0.04);
    --sombra-lg: 0 10px 25px -3px rgba(0,0,0,0.08), 0 4px 6px -2px rgba(0,0,0,0.04);
    --sombra-xl: 0 20px 50px -12px rgba(0,0,0,0.15);
    --radius: 12px;
    --radius-lg: 20px;
}

body {
    font-family: 'Inter', sans-serif;
    color: var(--gris-texto);
    background: var(--gris-light);
    -webkit-font-smoothing: antialiased;
}

/* --- NAVBAR --- */
.navbar-brand-custom {
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--azul-oscuro) !important;
    letter-spacing: -0.3px;
}
.navbar-brand-custom svg { margin-right: 8px; }
.navbar { box-shadow: var(--sombra-sm); }

/* --- HERO --- */
.hero-section {
    background: var(--azul-gradient);
    position: relative;
    overflow: hidden;
    padding: 80px 0 100px;
}
.hero-section::before {
    content: '';
    position: absolute;
    top: -50%;
    right: -20%;
    width: 600px;
    height: 600px;
    border-radius: 50%;
    background: rgba(255,255,255,0.03);
}
.hero-section::after {
    content: '';
    position: absolute;
    bottom: -40%;
    left: -10%;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}
.hero-section h1 {
    font-size: 2.5rem;
    font-weight: 800;
    letter-spacing: -1px;
    line-height: 1.15;
}
.hero-section .lead {
    font-size: 1.15rem;
    opacity: 0.85;
    font-weight: 400;
}

/* Features strip */
.features-strip {
    margin-top: -50px;
    position: relative;
    z-index: 2;
}
.feature-card {
    background: var(--blanco);
    border-radius: var(--radius);
    box-shadow: var(--sombra-lg);
    padding: 28px 24px;
    text-align: center;
    transition: transform 0.2s, box-shadow 0.2s;
    height: 100%;
}
.feature-card:hover {
    transform: translateY(-4px);
    box-shadow: var(--sombra-xl);
}
.feature-icon {
    width: 52px;
    height: 52px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 14px;
    font-size: 24px;
}
.feature-icon.blue { background: #dbeafe; color: #2563eb; }
.feature-icon.green { background: #dcfce7; color: #16a34a; }
.feature-icon.orange { background: #ffedd5; color: #ea580c; }
.feature-card h6 {
    font-weight: 700;
    font-size: 0.9rem;
    margin-bottom: 6px;
    color: var(--azul-oscuro);
}
.feature-card p {
    font-size: 0.82rem;
    color: var(--gris-muted);
    margin: 0;
    line-height: 1.5;
}

/* --- MAIN FORM CARD --- */
.form-card {
    background: var(--blanco);
    border-radius: var(--radius-lg);
    box-shadow: var(--sombra-xl);
    border: 1px solid rgba(0,0,0,0.04);
}
.form-card .card-body { padding: 40px; }
.form-card .form-label {
    font-weight: 600;
    font-size: 0.85rem;
    color: var(--azul-oscuro);
    margin-bottom: 6px;
}
.form-card .form-control,
.form-card .form-select {
    border-radius: 10px;
    border: 1.5px solid #e2e8f0;
    padding: 10px 16px;
    font-size: 0.9rem;
    transition: border-color 0.2s, box-shadow 0.2s;
}
.form-card .form-control:focus,
.form-card .form-select:focus {
    border-color: var(--azul-accent);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.1);
}
.form-card .btn-primary {
    background: var(--azul-accent);
    border: none;
    border-radius: 10px;
    padding: 12px 32px;
    font-weight: 600;
    font-size: 1rem;
    letter-spacing: -0.2px;
    transition: all 0.2s;
}
.form-card .btn-primary:hover {
    background: var(--azul-medio);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(30,95,166,0.3);
}
.legal-text {
    font-size: 0.75rem;
    color: var(--gris-muted);
    line-height: 1.5;
}

/* --- TEST LAYOUT --- */
.test-layout {
    min-height: calc(100vh - 72px);
}

/* Progress sidebar */
.progress-sidebar {
    background: var(--blanco);
    border-radius: var(--radius);
    box-shadow: var(--sombra-md);
    padding: 28px;
    position: sticky;
    top: 88px;
}
.progress-sidebar h6 {
    font-size: 0.7rem;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    color: var(--gris-muted);
    font-weight: 700;
    margin-bottom: 20px;
}
.progress-step {
    display: flex;
    align-items: flex-start;
    gap: 14px;
    margin-bottom: 22px;
    position: relative;
}
.progress-step:not(:last-child)::after {
    content: '';
    position: absolute;
    left: 17px;
    top: 38px;
    width: 2px;
    height: calc(100% - 12px);
    background: #e5e7eb;
    border-radius: 1px;
}
.progress-step.completed:not(:last-child)::after { background: var(--verde-nivel); }
.step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 700;
    flex-shrink: 0;
    background: #f1f5f9;
    color: #94a3b8;
    border: 2px solid #e2e8f0;
    transition: all 0.3s;
}
.progress-step.active .step-circle {
    background: var(--azul-accent);
    color: var(--blanco);
    border-color: var(--azul-accent);
    box-shadow: 0 0 0 4px rgba(59,130,246,0.15);
}
.progress-step.completed .step-circle {
    background: var(--verde-nivel);
    color: var(--blanco);
    border-color: var(--verde-nivel);
}
.step-label {
    font-size: 0.82rem;
    color: #94a3b8;
    padding-top: 8px;
    line-height: 1.3;
    font-weight: 500;
}
.progress-step.active .step-label { color: var(--azul-oscuro); font-weight: 600; }
.progress-step.completed .step-label { color: var(--verde-nivel); }

/* Question area */
.question-area {
    background: var(--blanco);
    border-radius: var(--radius-lg);
    box-shadow: var(--sombra-lg);
    padding: 40px;
    border: 1px solid rgba(0,0,0,0.04);
}
.question-header {
    font-size: 0.75rem;
    color: var(--azul-accent);
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 10px;
}
.question-separator {
    height: 2px;
    background: linear-gradient(90deg, var(--azul-accent) 0%, transparent 100%);
    margin-bottom: 28px;
    border-radius: 1px;
}
.question-text {
    font-size: 1.1rem;
    font-weight: 600;
    color: var(--azul-oscuro);
    margin-bottom: 24px;
    line-height: 1.5;
}

/* Options */
.option-item {
    display: block;
    padding: 16px 20px;
    border: 2px solid #f1f5f9;
    border-radius: 12px;
    margin-bottom: 10px;
    cursor: pointer;
    transition: all 0.2s;
    background: #fafbfc;
}
.option-item:hover {
    border-color: #bfdbfe;
    background: #eff6ff;
    transform: translateX(4px);
}
.option-item input { display: none; }
.option-item:has(input:checked) {
    border-color: var(--azul-accent);
    background: #eff6ff;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.08);
}
.option-item:has(input:checked) .option-text { color: var(--azul-medio); font-weight: 600; }
.option-text {
    font-size: 0.9rem;
    line-height: 1.55;
    padding-left: 32px;
    position: relative;
    color: var(--gris-texto);
}
.option-text::before {
    content: '';
    position: absolute;
    left: 0;
    top: 3px;
    width: 20px;
    height: 20px;
    border: 2px solid #cbd5e1;
    border-radius: 50%;
    transition: all 0.2s;
}
.option-item:has(input[type="checkbox"]) .option-text::before { border-radius: 6px; }
.option-item:has(input:checked) .option-text::before {
    border-color: var(--azul-accent);
    background: var(--azul-accent);
    box-shadow: inset 0 0 0 3px #fff;
}

.question-actions {
    display: flex;
    justify-content: flex-end;
    margin-top: 32px;
    gap: 12px;
}
.question-actions .btn { border-radius: 10px; padding: 10px 28px; font-weight: 600; }

.question-slide { display: none; }
.question-slide.active { display: block; animation: slideIn 0.35s ease-out; }
@keyframes slideIn { from { opacity: 0; transform: translateY(12px); } to { opacity: 1; transform: translateY(0); } }

/* --- RESULTS --- */
.results-hero {
    background: var(--azul-gradient);
    padding: 60px 0 80px;
    position: relative;
    overflow: hidden;
}
.results-hero::before {
    content: '';
    position: absolute;
    top: -60%;
    right: -15%;
    width: 500px;
    height: 500px;
    border-radius: 50%;
    background: rgba(255,255,255,0.04);
}

.gauge-card {
    margin-top: -60px;
    position: relative;
    z-index: 2;
    background: var(--blanco);
    border-radius: var(--radius-lg);
    box-shadow: var(--sombra-xl);
    border: 1px solid rgba(0,0,0,0.04);
    padding: 44px;
}
.gauge-svg { width: 240px; height: 140px; margin: 0 auto; display: block; }
.gauge-score {
    font-size: 3rem;
    font-weight: 800;
    letter-spacing: -2px;
    line-height: 1;
    margin-top: 12px;
}
.gauge-level {
    font-size: 1.25rem;
    font-weight: 700;
    margin: 4px 0 16px;
}
.gauge-description {
    font-size: 0.92rem;
    color: var(--gris-muted);
    line-height: 1.7;
}

.section-result-card {
    background: var(--blanco);
    border-radius: var(--radius);
    box-shadow: var(--sombra-md);
    border: 1px solid rgba(0,0,0,0.04);
    padding: 28px;
    margin-bottom: 16px;
    transition: transform 0.2s, box-shadow 0.2s;
}
.section-result-card:hover {
    transform: translateY(-2px);
    box-shadow: var(--sombra-lg);
}
.section-icon-circle {
    width: 50px;
    height: 50px;
    border-radius: 14px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}
.section-icon-circle svg { width: 24px; height: 24px; }
.section-info h5 {
    font-size: 1rem;
    font-weight: 700;
    color: var(--azul-oscuro);
    margin-bottom: 8px;
}
.section-info .section-text {
    font-size: 0.88rem;
    color: var(--gris-muted);
    line-height: 1.65;
}
.section-resources a {
    display: inline-block;
    font-size: 0.8rem;
    color: var(--azul-accent);
    text-decoration: none;
    margin-right: 16px;
    margin-top: 6px;
    font-weight: 500;
}
.section-resources a:hover { text-decoration: underline; }
.score-big {
    font-size: 2rem;
    font-weight: 800;
    letter-spacing: -1px;
}
.badge-nivel {
    display: inline-block;
    padding: 5px 14px;
    border-radius: 8px;
    font-size: 0.7rem;
    font-weight: 700;
    color: var(--blanco);
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

/* --- FOOTER --- */
.site-footer {
    background: var(--azul-oscuro);
    color: rgba(255,255,255,0.6);
    font-size: 0.82rem;
}
.site-footer a { color: rgba(255,255,255,0.8); text-decoration: none; }
.site-footer a:hover { color: #fff; }

/* --- RESPONSIVE TEST --- */
@media (max-width: 991px) {
    .progress-sidebar {
        position: static;
        display: flex;
        gap: 8px;
        overflow-x: auto;
        padding: 16px;
        margin-bottom: 16px;
    }
    .progress-sidebar h6 { display: none; }
    .progress-step { margin-bottom: 0; flex-direction: column; align-items: center; min-width: 70px; }
    .progress-step:not(:last-child)::after { display: none; }
    .step-label { font-size: 0.7rem; text-align: center; }
    .question-area { padding: 24px; }
}
@media (max-width: 767px) {
    .hero-section { padding: 50px 0 70px; }
    .hero-section h1 { font-size: 1.75rem; }
    .gauge-card { padding: 24px; }
    .gauge-score { font-size: 2.2rem; }
}

/* Alert */
.alert-validation {
    background: #fef2f2;
    border: 1px solid #fecaca;
    color: #991b1b;
    border-radius: 10px;
}

/* --- COOKIE BANNER --- */
#cookie-banner {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(15,43,70,0.97);
    backdrop-filter: blur(12px);
    z-index: 9999;
    padding: 0;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.15);
    transition: transform 0.4s ease, opacity 0.4s ease;
}
#cookie-banner.cookie-hidden {
    transform: translateY(100%);
    opacity: 0;
}
.cookie-inner {
    max-width: 1100px;
    margin: 0 auto;
    padding: 20px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 24px;
    flex-wrap: wrap;
}
.cookie-text {
    flex: 1;
    min-width: 300px;
    color: rgba(255,255,255,0.9);
    font-size: 0.85rem;
    line-height: 1.5;
}
.cookie-text strong { color: #fff; font-size: 0.9rem; display: block; margin-bottom: 4px; }
.cookie-text p { margin: 0; color: rgba(255,255,255,0.7); }
.cookie-text a { color: #60a5fa; text-decoration: underline; }
.cookie-actions { display: flex; gap: 10px; flex-shrink: 0; }
.cookie-btn-accept {
    padding: 10px 24px;
    background: var(--azul-accent);
    color: #fff;
    border: none;
    border-radius: 8px;
    font-weight: 600;
    font-size: 0.85rem;
    cursor: pointer;
    transition: background 0.2s;
    font-family: inherit;
}
.cookie-btn-accept:hover { background: #2563eb; }
.cookie-btn-reject {
    padding: 10px 20px;
    background: transparent;
    color: rgba(255,255,255,0.7);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 8px;
    font-weight: 500;
    font-size: 0.85rem;
    cursor: pointer;
    transition: all 0.2s;
    font-family: inherit;
}
.cookie-btn-reject:hover { border-color: rgba(255,255,255,0.6); color: #fff; }
@media (max-width: 600px) {
    .cookie-inner { flex-direction: column; text-align: center; }
    .cookie-actions { width: 100%; justify-content: center; }
}

/* --- FOOTER LEGAL LINKS --- */
.footer-legal {
    margin-top: 8px;
}
.footer-legal a {
    color: rgba(255,255,255,0.5);
    text-decoration: none;
    font-size: 0.78rem;
    margin: 0 10px;
    transition: color 0.2s;
}
.footer-legal a:hover { color: rgba(255,255,255,0.9); }
