/**
 * INAP — Inducción a la Administración Pública
 * Estilos compartidos (curso estático + Tailwind CDN).
 */
:root {
    --primary-blue: #0f2b5b;
    --secondary-blue: #1e40af;
    --accent-ring: #3b82f6;
    --light-blue: #dbeafe;
    --white: #ffffff;
    --gray-50: #f8fafc;
    --gray-100: #f1f5f9;
    --gray-200: #e2e8f0;
    --gray-400: #94a3b8;
    --gray-600: #64748b;
    --gray-800: #1e293b;
}

*,
*::before,
*::after {
    box-sizing: border-box;
}

html {
    scroll-behavior: smooth;
}

/* Logo oficial INAP (barra y pie) */
.brand-logo {
    display: block;
    height: 2.5rem;
    width: auto;
    max-width: min(17rem, 72vw);
    object-fit: contain;
    object-position: left center;
}

@media (min-width: 768px) {
    .brand-logo {
        height: 2.75rem;
        max-width: 19rem;
    }
}

.brand-logo-footer {
    display: block;
    height: 2.25rem;
    width: auto;
    max-width: min(15rem, 88vw);
    object-fit: contain;
    object-position: left center;
}

@media (min-width: 640px) {
    .brand-logo-footer {
        height: 2.625rem;
        max-width: 17rem;
    }
}

body {
    font-family: "Source Sans 3", "Source Sans Pro", system-ui, sans-serif;
    background: var(--gray-50);
    min-height: 100vh;
    margin: 0;
    color: var(--gray-800);
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.font-display {
    font-family: "Inter", system-ui, sans-serif;
    font-feature-settings: "cv02", "cv03", "cv04", "cv11";
}

.hero-gradient {
    background: linear-gradient(
        145deg,
        #0a1f42 0%,
        var(--primary-blue) 42%,
        var(--secondary-blue) 100%
    );
}

.site-nav {
    background: rgba(255, 255, 255, 0.94);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
    box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}

.site-footer {
    background: linear-gradient(180deg, #0f172a 0%, #020617 100%);
    border-top: 1px solid rgba(148, 163, 184, 0.12);
}

.card-hover {
    transition: transform 0.25s ease, box-shadow 0.25s ease, border-color 0.25s ease;
}

.card-hover:hover {
    transform: translateY(-3px);
    box-shadow:
        0 18px 40px -12px rgba(15, 23, 42, 0.12),
        0 8px 16px -8px rgba(15, 23, 42, 0.08);
}

.animate-fade-in {
    animation: fadeIn 0.55s ease-out both;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(16px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.animate-slide-in {
    animation: slideIn 0.7s ease-out both;
}

@keyframes slideIn {
    from {
        opacity: 0;
        transform: translateX(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

.nav-link {
    position: relative;
    transition: color 0.2s ease;
}

.nav-link:hover {
    color: var(--secondary-blue);
}

.nav-link::after {
    content: "";
    position: absolute;
    bottom: -2px;
    left: 0;
    width: 0;
    height: 2px;
    background: var(--secondary-blue);
    transition: width 0.25s ease;
}

.nav-link:hover::after {
    width: 100%;
}

.nav-link.border-b-2::after {
    display: none;
}

/* Barra superior de lectura (scroll) — id usado por site.js */
.progress-indicator {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 3px;
    background: var(--gray-200);
    z-index: 1000;
}

.progress-bar {
    height: 100%;
    width: 0%;
    background: linear-gradient(
        90deg,
        var(--secondary-blue) 0%,
        var(--primary-blue) 100%
    );
    transition: width 0.2s ease;
}

/* Mini barras en tarjetas de la portada (no confundir con .progress-bar) */
.unit-progress-fill {
    height: 100%;
    min-height: 4px;
    border-radius: 9999px;
    background: linear-gradient(
        90deg,
        var(--secondary-blue) 0%,
        var(--primary-blue) 100%
    );
    transition: width 0.35s ease;
}

.unit-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    padding: 24px;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.unit-card:hover {
    border-color: rgba(30, 64, 175, 0.35);
    box-shadow:
        0 12px 32px -12px rgba(15, 43, 91, 0.15),
        0 4px 12px -4px rgba(15, 23, 42, 0.06);
}

.floating-element {
    animation: float 6s ease-in-out infinite;
}

@keyframes float {
    0%,
    100% {
        transform: translateY(0);
    }
    50% {
        transform: translateY(-8px);
    }
}

.pulse-dot {
    animation: pulse 2.4s ease-in-out infinite;
}

@keyframes pulse {
    0%,
    100% {
        opacity: 0.35;
    }
    50% {
        opacity: 0.85;
    }
}

a:focus-visible,
button:focus-visible {
    outline: 2px solid var(--accent-ring);
    outline-offset: 2px;
}

#mobile-menu-button:focus:not(:focus-visible) {
    outline: none;
}

/* ——— Unidad I ——— */
.accordion-content {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.accordion-content.active {
    max-height: 1000px;
}

.breadcrumb-item {
    color: var(--gray-600);
}

.breadcrumb-item.active {
    color: var(--primary-blue);
    font-weight: 600;
}

.concept-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.concept-card:hover {
    border-color: var(--secondary-blue);
    box-shadow: 0 10px 24px -8px rgba(15, 23, 42, 0.1);
}

.example-box {
    background: var(--light-blue);
    border-left: 4px solid var(--secondary-blue);
    padding: 16px;
    margin: 16px 0;
    border-radius: 0 8px 8px 0;
}

/* ——— Unidad II ——— */
.principle-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.principle-card:hover {
    border-color: var(--secondary-blue);
    box-shadow: 0 10px 24px -8px rgba(15, 23, 42, 0.1);
}

.principle-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--secondary-blue);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
}

/* ——— Unidad III ——— */
.legal-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.legal-card:hover {
    border-color: var(--secondary-blue);
    box-shadow: 0 10px 24px -8px rgba(15, 23, 42, 0.1);
}

.law-hierarchy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
}

.law-level {
    padding: 12px 24px;
    border-radius: 8px;
    text-align: center;
    font-weight: 600;
    min-width: 200px;
}

.law-level-1 {
    background: #fee2e2;
    color: #991b1b;
}
.law-level-2 {
    background: #fef3c7;
    color: #92400e;
}
.law-level-3 {
    background: #fef9c3;
    color: #a16207;
}
.law-level-4 {
    background: #dcfce7;
    color: #166534;
}
.law-level-5 {
    background: #dbeafe;
    color: #1e40af;
}
.law-level-6 {
    background: #e9d5ff;
    color: #7c3aed;
}

.arrow-down {
    width: 0;
    height: 0;
    border-left: 8px solid transparent;
    border-right: 8px solid transparent;
    border-top: 8px solid #9ca3af;
}

/* ——— Ley 41-08 ——— */
.law-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 16px;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.law-card:hover {
    border-color: var(--secondary-blue);
    box-shadow: 0 10px 24px -8px rgba(15, 23, 42, 0.1);
}

.category-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
    margin-bottom: 8px;
}

.category-free {
    background: #fef3c7;
    color: #92400e;
}
.category-career {
    background: #dcfce7;
    color: #166534;
}
.category-simplified {
    background: #dbeafe;
    color: #1e40af;
}
.category-temporary {
    background: #fee2e2;
    color: #991b1b;
}

.fault-level {
    padding: 12px;
    border-radius: 8px;
    margin-bottom: 8px;
}

.fault-level-1 {
    background: #fef3c7;
    border-left: 4px solid #f59e0b;
}
.fault-level-2 {
    background: #fed7aa;
    border-left: 4px solid #f97316;
}
.fault-level-3 {
    background: #fee2e2;
    border-left: 4px solid #ef4444;
}

.calculation-box {
    background: #f0f9ff;
    border: 1px solid #0ea5e9;
    border-radius: 8px;
    padding: 16px;
    margin: 16px 0;
}

/* ——— Casos ——— */
.case-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    padding: 24px;
    margin-bottom: 24px;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease,
        transform 0.2s ease;
    cursor: pointer;
}

.case-card:hover {
    border-color: var(--secondary-blue);
    box-shadow: 0 12px 28px -10px rgba(15, 23, 42, 0.12);
    transform: translateY(-2px);
}

.case-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(15, 23, 42, 0.45);
    z-index: 1050;
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

.case-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    background: white;
    border-radius: 16px;
    max-width: 800px;
    max-height: 90vh;
    overflow-y: auto;
    margin: 20px;
    box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.28);
}

.case-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--secondary-blue);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 16px;
}

.difficulty-badge {
    display: inline-flex;
    align-items: center;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 12px;
    font-weight: 600;
}

.difficulty-easy {
    background: #dcfce7;
    color: #166534;
}
.difficulty-medium {
    background: #fef3c7;
    color: #92400e;
}
.difficulty-hard {
    background: #fee2e2;
    color: #991b1b;
}

.interactive-element {
    transition: transform 0.2s ease;
}

.interactive-element:hover {
    transform: scale(1.02);
}

/* ——— Glosario ——— */
.glossary-card {
    background: var(--white);
    border: 1px solid var(--gray-100);
    border-radius: 12px;
    padding: 20px;
    margin-bottom: 16px;
    transition:
        border-color 0.25s ease,
        box-shadow 0.25s ease;
}

.glossary-card:hover {
    border-color: var(--secondary-blue);
    box-shadow: 0 10px 24px -8px rgba(15, 23, 42, 0.1);
}

.alphabet-filter {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 24px;
    justify-content: center;
}

.alphabet-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: var(--white);
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-weight: 600;
    cursor: pointer;
    transition:
        background 0.2s ease,
        color 0.2s ease,
        border-color 0.2s ease;
}

.alphabet-letter:hover,
.alphabet-letter.active {
    background: var(--secondary-blue);
    color: white;
    border-color: var(--secondary-blue);
}

.search-box {
    position: relative;
    margin-bottom: 24px;
}

.search-input {
    width: 100%;
    padding: 12px 48px 12px 16px;
    border: 1px solid var(--gray-200);
    border-radius: 8px;
    font-size: 16px;
    font-family: inherit;
    transition:
        border-color 0.2s ease,
        box-shadow 0.2s ease;
}

.search-input:focus {
    outline: none;
    border-color: var(--secondary-blue);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.search-icon {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    pointer-events: none;
}

.term-letter {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: var(--secondary-blue);
    color: white;
    border-radius: 50%;
    font-weight: bold;
    font-size: 14px;
    margin-right: 12px;
    flex-shrink: 0;
}

.highlight {
    background: rgba(250, 204, 21, 0.45);
    padding: 1px 4px;
    border-radius: 4px;
}

/* ── Scroll Spy ── */
.scroll-spy-active {
    background-color: #eff6ff;
    color: #1e40af !important;
    font-weight: 600;
    border-left: 3px solid #1e40af;
    padding-left: 9px;
}

/* ── Section Read Badge ── */
.section-read-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 18px;
    height: 18px;
    background: #16a34a;
    color: white;
    border-radius: 50%;
    font-size: 10px;
    font-weight: bold;
    margin-left: 8px;
    flex-shrink: 0;
}

/* ── Quiz ── */
.quiz-option {
    display: block;
    width: 100%;
    text-align: left;
    padding: 0.75rem 1rem;
    margin-bottom: 0.5rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: #f8fafc;
    cursor: pointer;
    transition: border-color 0.15s, background 0.15s;
    font-size: 0.95rem;
}
.quiz-option:hover:not([style*="pointer-events: none"]) {
    border-color: #3b82f6;
    background: #eff6ff;
}
.quiz-option.quiz-selected {
    border-color: #3b82f6;
    background: #dbeafe;
}
.quiz-option.quiz-correct {
    border-color: #16a34a;
    background: #dcfce7;
    color: #15803d;
    font-weight: 600;
}
.quiz-option.quiz-incorrect {
    border-color: #dc2626;
    background: #fee2e2;
    color: #b91c1c;
}
.quiz-question {
    margin-bottom: 1.5rem;
    padding: 1.25rem;
    background: white;
    border-radius: 10px;
    border: 1px solid #e2e8f0;
}
.quiz-question p {
    font-weight: 600;
    color: #1e293b;
    margin-bottom: 0.75rem;
}
.quiz-submit {
    display: inline-block;
    padding: 0.75rem 2rem;
    background: #1e40af;
    color: white;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: background 0.15s;
    margin-top: 0.5rem;
}
.quiz-submit:hover { background: #1d4ed8; }
.quiz-result {
    display: none;
    margin-top: 1rem;
    padding: 1rem 1.25rem;
    border-radius: 8px;
    font-size: 1rem;
    font-weight: 600;
}
.quiz-result-excellent { background: #dcfce7; color: #15803d; border-left: 4px solid #16a34a; }
.quiz-result-good      { background: #fef9c3; color: #854d0e; border-left: 4px solid #ca8a04; }
.quiz-result-review    { background: #fee2e2; color: #b91c1c; border-left: 4px solid #dc2626; }
.quiz-result-warning   { background: #fff7ed; color: #c2410c; border-left: 4px solid #ea580c; }

/* ── Print CSS ── */
@media print {
    header, footer, nav, .sticky, #mobile-menu,
    #mobile-menu-button, .quiz-submit, .quiz-option,
    a[href^="http"]::after { display: none !important; }
    main { width: 100% !important; margin: 0 !important; padding: 0 !important; }
    body { font-size: 12pt; color: #000; background: #fff; }
    h1, h2, h3 { color: #000 !important; }
    section { break-inside: avoid; margin-bottom: 1.5rem; }
}

/* ── Dark Mode ── */
html.dark body {
    background-color: #0f172a;
    color: #e2e8f0;
}
html.dark .site-nav {
    background-color: #0f172a;
    border-bottom: 1px solid #1e293b;
}
html.dark .site-nav .nav-link {
    color: #cbd5e1 !important;
}
html.dark .site-nav .nav-link:hover,
html.dark .site-nav .nav-link.text-blue-600 {
    color: #60a5fa !important;
}
html.dark #dark-mode-toggle {
    color: #cbd5e1;
}
html.dark #dark-mode-toggle:hover {
    background-color: #1e293b;
    color: #60a5fa;
}
html.dark #mobile-menu-button {
    color: #cbd5e1;
}
html.dark #mobile-menu {
    background-color: #0f172a;
    border-color: #1e293b;
}
html.dark #mobile-menu a {
    color: #cbd5e1 !important;
}
/* Breadcrumb */
html.dark .bg-gray-50 {
    background-color: #1e293b !important;
}
html.dark .breadcrumb-item {
    color: #94a3b8 !important;
}
html.dark .breadcrumb-item.active {
    color: #e2e8f0 !important;
}
/* Cards and surfaces */
html.dark .bg-white {
    background-color: #1e293b !important;
}
html.dark .bg-gray-100 {
    background-color: #334155 !important;
}
html.dark .shadow-sm,
html.dark .shadow-lg {
    box-shadow: 0 1px 3px rgba(0,0,0,0.5) !important;
}
/* Text overrides */
html.dark .text-gray-800,
html.dark .text-gray-900 { color: #f1f5f9 !important; }
html.dark .text-gray-700 { color: #cbd5e1 !important; }
html.dark .text-gray-600 { color: #94a3b8 !important; }
/* Borders */
html.dark .border-gray-100,
html.dark .border-gray-200 { border-color: #334155 !important; }
/* Sidebar and sticky panels */
html.dark .sticky .bg-white,
html.dark .rounded-lg.shadow-lg {
    background-color: #1e293b !important;
    border-color: #334155 !important;
}
html.dark .sticky .text-gray-700 { color: #cbd5e1 !important; }
html.dark .sticky a { color: #94a3b8 !important; }
html.dark .sticky a:hover,
html.dark .scroll-spy-active { color: #60a5fa !important; background-color: #0f2b5b !important; }
/* Tables */
html.dark table thead tr { background-color: #1e3a5f !important; }
html.dark table tbody tr { border-color: #334155 !important; }
html.dark table tbody tr:hover { background-color: #334155 !important; }
html.dark td, html.dark th { color: #cbd5e1 !important; }
/* Quiz */
html.dark .quiz-option {
    background: #334155 !important;
    border-color: #475569 !important;
    color: #e2e8f0 !important;
}
html.dark .quiz-option:hover:not([style*="pointer-events: none"]) {
    border-color: #60a5fa !important;
    background: #1e3a5f !important;
}
html.dark .quiz-option.quiz-selected { border-color: #60a5fa !important; background: #1e3a5f !important; }
html.dark .quiz-question { background: #1e293b !important; border-color: #334155 !important; }
html.dark .quiz-question p { color: #f1f5f9 !important; }
/* Footer already dark — no overrides needed */
/* Hero gradient stays as-is */
/* Color-specific light backgrounds for info boxes */
html.dark .bg-blue-50 { background-color: #1e3a5f !important; }
html.dark .bg-green-50 { background-color: #14532d !important; }
html.dark .bg-yellow-50 { background-color: #713f12 !important; }
html.dark .bg-red-50 { background-color: #7f1d1d !important; }
html.dark .bg-purple-50 { background-color: #4a1d96 !important; }
html.dark .bg-teal-50 { background-color: #134e4a !important; }
html.dark .bg-orange-50 { background-color: #7c2d12 !important; }
html.dark .bg-indigo-50 { background-color: #312e81 !important; }
html.dark .bg-rose-50 { background-color: #881337 !important; }
html.dark .bg-emerald-50 { background-color: #064e3b !important; }
html.dark .bg-amber-50 { background-color: #78350f !important; }
