@import url('https://fonts.googleapis.com/css2?family=Roboto+Slab:wght@400;500;600;700;800&family=Roboto:ital,wght@0,300;0,400;0,500;0,700;1,400&display=swap');

*,
*::before,
*::after {
    box-sizing: border-box;
}

:root {
    /* Paleta Oficial Gobierno de Chile (UI Kit v3.0.1) */
    --gob-navy: #00135A;
    --gob-navy-dark: #001141;
    --gob-blue-base: #0F69C4;
    --gob-blue-dark: #003B8D;
    --gob-blue-light: #4282E0;
    --gob-red-accent: #FF4731;
    --gob-red-dark: #C82018;

    /* Alias Semánticos Institucionales */
    --gob-blue: var(--gob-blue-base);
    --gob-red: var(--gob-red-accent);
    --gob-light: #F4F6F8;

    /* Colores Funcionales / Estados UI Kit */
    --gob-exito-base: #4CAF50;
    --gob-exito-dark: #1B5E20;
    --gob-exito-light: #E8F5E9;

    --gob-info-base: #2196F3;
    --gob-info-dark: #0D47A1;
    --gob-info-light: #E3F2FD;

    --gob-adv-base: #FF5722;
    --gob-adv-dark: #BF360C;
    --gob-adv-light: #FBE9E7;

    --gob-err-base: #FB3B3B;
    --gob-err-dark: #BE0A1F;
    --gob-err-light: #FFEBEF;

    --gob-focus: #FFBE5C;
    --gob-link: #1D70B8;
    --gob-link-hover: #003078;

    --gob-header: #092039;

    /* Tipografías Oficiales */
    --font-heading: 'Roboto Slab', serif;
    --font-body: 'Roboto', sans-serif;

    /* Escalas de Fuente Estándar */
    --fs-h1: 2.5rem;
    --fs-h2: 2.0rem;
    --fs-h3: 1.5rem;
    --fs-body: 1.0rem;

    /* Colores de Fondo y Texto General */
    --bg-main: #FFFFFF;
    --text-primary: #1F2937;
    --text-secondary: #4B5563;
    --border-color: #E5E7EB;
    --panel-bg: #FFFFFF;
}

body {
    margin: 0;
    padding: 0;
    font-family: var(--font-body);
    font-size: var(--fs-body);
    color: var(--text-primary);
    background-color: var(--bg-main);
    line-height: 1.6;
}

/* --- TIPOGRAFÍA Y JERARQUÍA --- */
h1,
h2,
h3,
h4,
h5,
h6,
.heading-xl,
.heading-l,
.heading-m,
.heading-s {
    font-family: var(--font-heading);
    color: var(--gob-navy);
    margin-top: 0;
}

h1,
.heading-xl {
    font-size: var(--fs-h1);
    font-weight: 700;
}

h2,
.heading-l {
    font-size: var(--fs-h2);
    font-weight: 700;
}

h3,
.heading-m {
    font-size: var(--fs-h3);
    font-weight: 600;
}

/* --- NAVEGACIÓN SUPERIOR INSTITUCIONAL --- */
.top-nav {
    background-color: var(--gob-header);
    padding: 10px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    border-bottom: 1px solid rgba(255, 255, 255, 0.12);
    position: relative;
    z-index: 100;
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: #FFFFFF;
    transition: opacity 0.2s ease;
}

.nav-brand:hover {
    opacity: 0.9;
}

.nav-logo-img {
    height: 32px;
    width: auto;
    max-width: 34px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.3));
}

.nav-logo-text {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 600;
    color: #FFFFFF;
    letter-spacing: -0.2px;
    line-height: 1.2;
}

.nav-admin-link {
    color: rgba(255, 255, 255, 0.9);
    text-decoration: none;
    font-weight: 500;
    font-size: 0.85rem;
    padding: 6px 14px;
    border-radius: 20px;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.nav-admin-link:hover {
    color: #FFFFFF;
    background: var(--gob-blue-base);
    border-color: var(--gob-blue-base);
}

/* --- BANNER INSTITUCIONAL DE MARCHA BLANCA --- */
html.hide-marcha-blanca #marcha-blanca-banner {
    display: none !important;
}

.marcha-blanca-banner {
    background-color: #EBF3FC;
    border-bottom: 1px solid #BFDBFE;
    color: #0F172A;
    font-family: var(--font-body, 'Roboto', sans-serif);
    position: relative;
    z-index: 90;
    transition: opacity 0.25s ease, max-height 0.25s ease;
}

.marcha-blanca-container {
    max-width: 1280px;
    margin: 0 auto;
    padding: 8px 24px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.marcha-blanca-content {
    display: flex;
    align-items: center;
    gap: 12px;
    flex: 1;
}

.marcha-blanca-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background-color: var(--gob-blue-base, #0F69C4);
    color: #FFFFFF;
    font-size: 0.72rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.06em;
    padding: 3px 10px;
    border-radius: 4px;
    white-space: nowrap;
    flex-shrink: 0;
}

.marcha-blanca-text {
    margin: 0;
    font-size: 0.88rem;
    line-height: 1.45;
    color: #1E293B;
}

.marcha-blanca-text strong {
    font-weight: 600;
    color: #00135A;
}

.marcha-blanca-close {
    background: transparent;
    border: none;
    color: #475569;
    font-size: 1.15rem;
    line-height: 1;
    width: 28px;
    height: 28px;
    border-radius: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: background-color 0.15s ease, color 0.15s ease;
}

.marcha-blanca-close:hover {
    background-color: rgba(15, 105, 196, 0.12);
    color: #00135A;
}

.marcha-blanca-close:focus-visible {
    outline: 2px solid var(--gob-blue-base, #0F69C4);
    outline-offset: 1px;
}

/* Modo Alto Contraste */
[data-theme="high-contrast"] .marcha-blanca-banner {
    background-color: #000000 !important;
    border-bottom: 2px solid #FFBE5C !important;
    color: #FFFFFF !important;
}

[data-theme="high-contrast"] .marcha-blanca-badge {
    background-color: #FFBE5C !important;
    color: #000000 !important;
    border: 1px solid #FFBE5C !important;
}

[data-theme="high-contrast"] .marcha-blanca-text,
[data-theme="high-contrast"] .marcha-blanca-text strong {
    color: #FFFFFF !important;
}

[data-theme="high-contrast"] .marcha-blanca-close {
    color: #FFBE5C !important;
}

[data-theme="high-contrast"] .marcha-blanca-close:hover {
    background-color: #FFBE5C !important;
    color: #000000 !important;
}

@media (max-width: 768px) {
    .marcha-blanca-container {
        padding: 8px 16px;
        align-items: flex-start;
    }

    .marcha-blanca-content {
        flex-direction: column;
        align-items: flex-start;
        gap: 4px;
    }

    .marcha-blanca-text {
        font-size: 0.82rem;
    }
}

/* --- HERO SECTION --- */
.hero-section {
    position: relative;
    min-height: 65vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: var(--gob-navy);
    color: white;
    padding: 50px 20px;
    overflow: hidden;
}

.hero-section::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 900px;
    background-color: var(--gob-navy);
    background-image: url('/static/img/hero_bg.svg');
    background-size: 1920px auto;
    background-position: center top;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 1;
}

.hero-content {
    max-width: 1000px;
    width: 100%;
    text-align: center;
    z-index: 10;
    position: relative;
}

/* --- LOGO HERO SVG Y DISPOSICIÓN JUNTO AL TÍTULO --- */
.hero-title-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 22px;
    margin-bottom: 18px;
}

.logo-hero-container {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 0;
    flex-shrink: 0;
}

.hero-logo-svg {
    height: 90px;
    width: auto;
    max-width: 100%;
    filter: drop-shadow(0 4px 10px rgba(0, 0, 0, 0.3));
    overflow: visible;
}

.ring-outer,
.ring-inner {
    opacity: 1;
    filter: none;
}

.hero-title {
    font-family: var(--font-heading);
    font-size: clamp(1.8rem, 4vw, 2.7rem);
    font-weight: 700;
    color: #FFFFFF;
    margin-bottom: 0;
    line-height: 1.2;
    text-shadow: 0 4px 10px rgba(0, 0, 0, 0.4);
    text-align: left;
}

.hero-subtitle {
    font-size: clamp(0.95rem, 2.5vw, 1.15rem);
    font-weight: 300;
    margin-bottom: 35px;
    opacity: 0.95;
    line-height: 1.65;
    max-width: 750px;
    margin-left: auto;
    margin-right: auto;
}

/* --- BUSCADOR CONCENTRICO --- */
.search-box {
    background: rgba(0, 15, 60, 0.65);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.28);
    padding: 6px 6px 6px 20px;
    border-radius: 40px;
    display: flex;
    align-items: center;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
    transition: transform 0.3s ease, box-shadow 0.3s ease, background 0.3s ease, border-color 0.3s ease;
}

.search-box:focus-within {
    transform: translateY(-2px);
    box-shadow: 0 15px 40px rgba(0, 0, 0, 0.45);
    background: rgba(0, 15, 60, 0.85);
    border-color: var(--gob-blue-light, #4282E0);
}

.search-input {
    flex: 1;
    background: transparent !important;
    border: none !important;
    padding: 10px 10px 10px 5px;
    font-size: 1.05rem;
    color: #FFFFFF !important;
    font-family: var(--font-body);
    -webkit-appearance: none;
    appearance: none;
}

.search-input::placeholder {
    color: rgba(255, 255, 255, 0.9);
}

.search-input:focus {
    outline: none;
}

.hero-disclaimer {
    font-size: 0.86rem;
    color: rgba(255, 255, 255, 0.9);
    margin-top: 14px;
    margin-bottom: 0;
    line-height: 1.5;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
}

/* Pestañas de Búsqueda */
.search-tabs {
    display: inline-flex;
    gap: 12px;
    margin-bottom: 20px;
    background: transparent;
    padding: 0;
    border-radius: 0;
    border: none;
}

.tab-btn {
    background: transparent;
    border: none;
    color: rgba(255, 255, 255, 0.85);
    padding: 8px 20px;
    border-radius: 24px;
    font-size: 0.9rem;
    font-family: var(--font-body);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.tab-btn:hover {
    color: #FFFFFF;
    background: rgba(255, 255, 255, 0.15);
}

.tab-btn.active {
    background: #FFFFFF;
    color: var(--gob-navy);
    font-weight: 700;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Botón de Búsqueda Concéntrico (Radio 34px vs Contenedor 40px con 6px padding) */
.btn-search {
    background: var(--gob-red-accent);
    background-color: var(--gob-red-accent);
    color: #FFFFFF;
    border: none;
    border-radius: 34px;
    padding: 12px 30px;
    height: 48px;
    font-weight: 700;
    font-family: var(--font-heading);
    font-size: 0.95rem;
    cursor: pointer;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    transition: background 0.2s ease, transform 0.1s ease;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    white-space: nowrap;
}

.btn-search:hover {
    background: var(--gob-red-dark);
    background-color: var(--gob-red-dark);
    color: #FFFFFF;
}

.btn-search.btn-ai-submit {
    background: var(--gob-blue-base);
    background-color: var(--gob-blue-base);
    color: #FFFFFF;
    border: none;
}

.btn-search.btn-ai-submit:hover {
    background: var(--gob-blue-dark);
    background-color: var(--gob-blue-dark);
    color: #FFFFFF;
}

.btn-search:active {
    transform: scale(0.98);
}

/* --- STATS SECTION --- */
.stats-section {
    background-color: var(--gob-light);
    padding: 60px 20px;
    border-bottom: 1px solid var(--border-color);
}

.stats-grid {
    max-width: 1200px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
    gap: 30px;
}

.stat-card {
    background: var(--panel-bg);
    padding: 30px;
    border-radius: 12px;
    text-align: center;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.02);
    border: 1px solid var(--border-color);
    transition: transform 0.2s ease;
}

.stat-card:hover {
    transform: translateY(-5px);
}

.stat-value {
    font-family: var(--font-heading);
    font-size: 3rem;
    font-weight: 700;
    color: var(--gob-navy);
    margin-bottom: 10px;
}

.stat-label {
    color: var(--text-secondary);
    font-weight: 500;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.9rem;
}

/* --- RESULTS SECTION --- */
.results-container {
    max-width: 1000px;
    margin: 60px auto;
    padding: 0 20px;
}

.results-header {
    margin-bottom: 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 2px solid var(--gob-light);
    padding-bottom: 15px;
}

.results-header h2 {
    margin: 0;
    font-size: 1.5rem;
}

.result-card {
    background: var(--panel-bg);
    border-radius: 14px;
    padding: 24px 28px;
    margin-bottom: 22px;
    border: 1px solid var(--border-color);
    border-left: 4px solid var(--gob-blue-base);
    box-shadow: 0 4px 14px rgba(0, 19, 90, 0.05);
    transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
}

.result-card:hover {
    box-shadow: 0 8px 24px rgba(0, 19, 90, 0.1);
    transform: translateY(-2px);
    border-color: var(--gob-blue-light);
}

.result-card-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    margin-bottom: 14px;
    flex-wrap: wrap;
}

.result-badge-group {
    display: flex;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.badge-pub-type {
    background: var(--gob-navy);
    color: #FFFFFF;
    padding: 4px 12px;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 600;
    font-family: var(--font-body);
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-chile-author {
    background: var(--gob-exito-light);
    color: var(--gob-exito-dark);
    border: 1px solid rgba(27, 94, 32, 0.15);
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.badge-chile-data {
    background: var(--gob-info-light);
    color: var(--gob-info-dark);
    border: 1px solid rgba(13, 71, 161, 0.15);
    padding: 4px 11px;
    border-radius: 20px;
    font-size: 0.78rem;
    font-weight: 600;
    display: inline-flex;
    align-items: center;
    gap: 5px;
}

.result-card-title {
    font-family: var(--font-heading);
    font-size: 1.22rem;
    font-weight: 700;
    line-height: 1.35;
    margin: 0 0 10px 0;
}

.result-title-link {
    color: var(--gob-navy);
    text-decoration: none;
    transition: color 0.2s ease;
}

.result-title-link:hover {
    color: var(--gob-blue-base);
    text-decoration: underline;
}

/* --- AUTORES EN TARJETA DE RESULTADOS (ALTERNATIVA C) --- */
.result-authors {
    display: flex;
    align-items: center;
    gap: 7px;
    font-size: 0.92rem;
    color: #475569;
    margin-bottom: 8px;
    line-height: 1.45;
    flex-wrap: wrap;
}

.result-authors-icon {
    font-size: 0.95rem;
    color: var(--gob-blue-base, #0F69C4);
    flex-shrink: 0;
}

.result-authors-text {
    color: #475569;
}

.author-link {
    color: var(--gob-navy, #00135A);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.15s ease, text-decoration 0.15s ease;
}

.author-link:hover {
    color: var(--gob-blue-base, #0F69C4);
    text-decoration: underline;
}

.author-affiliation {
    color: #64748B;
    font-size: 0.88rem;
    font-weight: 400;
}

.coauthors-tag {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background-color: #F1F5F9;
    color: var(--gob-blue-base, #0F69C4);
    font-size: 0.82rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 4px;
    margin-left: 4px;
    cursor: help;
    border: 1px solid #E2E8F0;
    transition: background-color 0.15s ease, border-color 0.15s ease;
}

.coauthors-tag:hover,
.coauthors-tag:focus-visible {
    background-color: #EBF3FC;
    border-color: var(--gob-blue-base, #0F69C4);
    outline: none;
}

.result-meta {
    font-size: 0.85rem;
    color: var(--text-secondary);
    margin-bottom: 12px;
    display: flex;
    gap: 8px;
    align-items: center;
    flex-wrap: wrap;
}

.meta-separator {
    color: #CBD5E1;
    font-weight: bold;
}

.result-source-link {
    color: var(--gob-blue-base);
    text-decoration: none;
    font-weight: 500;
}

.result-source-link:hover {
    text-decoration: underline;
}

.result-abstract {
    color: var(--text-primary);
    font-size: 0.94rem;
    line-height: 1.65;
    margin: 0;
}

.btn-listen-article {
    background-color: var(--gob-blue-base);
    color: #FFFFFF;
    border: 1px solid var(--gob-blue-light);
    border-radius: 20px;
    padding: 4px 13px;
    font-size: 0.8rem;
    font-family: var(--font-body), 'Roboto', sans-serif;
    font-weight: 600;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 5px;
    transition: all 0.2s ease;
    box-shadow: 0 2px 4px rgba(15, 105, 196, 0.2);
}

.btn-listen-article:hover {
    background-color: var(--gob-navy);
    color: #FFFFFF;
    border-color: var(--gob-navy);
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0, 19, 90, 0.2);
}

.btn-listen-article.playing {
    background-color: var(--gob-err-base);
    color: #FFFFFF;
    border-color: var(--gob-err-dark);
    animation: pulse-red-subtle 1.5s infinite;
}

@keyframes pulse-red-subtle {
    0% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0.4);
    }

    70% {
        box-shadow: 0 0 0 6px rgba(211, 47, 47, 0);
    }

    100% {
        box-shadow: 0 0 0 0 rgba(211, 47, 47, 0);
    }
}

/* ==========================================================================
   COMPONENTE PAGINACIÓN GOB.CL (UI Kit v3.0.1)
   ========================================================================== */
.gob-pagination {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 40px auto 20px auto;
    padding: 8px 12px;
    user-select: none;
    flex-wrap: wrap;
    box-sizing: border-box;
}

/* Flechas oficiales Gob.cl (Anterior / Siguiente) */
.pagination-arrow {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    min-width: 40px;
    min-height: 40px;
    background-color: #FFFFFF;
    border: 1px solid var(--border-color, #CBD5E1);
    border-radius: var(--gob-btn-radius, 4px);
    color: var(--gob-btn-blue-primary, #0F69C4);
    cursor: pointer;
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
    padding: 0;
    box-sizing: border-box;
    position: relative;
}

/* Área táctil WCAG AAA (44x44px) */
.pagination-arrow::after,
.pagination-page::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    min-width: 44px;
    min-height: 44px;
    width: 100%;
    height: 100%;
    pointer-events: auto;
}

.pagination-arrow svg {
    stroke: var(--gob-btn-blue-primary, #0F69C4);
    transition: stroke 0.15s ease;
    pointer-events: none;
}

.pagination-arrow:hover:not(:disabled) {
    background-color: #EBF3FC;
    border-color: var(--gob-btn-blue-hover, #003B8D);
    color: var(--gob-btn-blue-hover, #003B8D);
}

.pagination-arrow:hover:not(:disabled) svg {
    stroke: var(--gob-btn-blue-hover, #003B8D);
}

.pagination-arrow:active:not(:disabled) {
    background-color: var(--gob-btn-blue-active, #002B66);
    border-color: var(--gob-btn-blue-active, #002B66);
    color: #FFFFFF;
}

.pagination-arrow:active:not(:disabled) svg {
    stroke: #FFFFFF;
}

.pagination-arrow:focus-visible,
.pagination-page:focus-visible {
    outline: 3px solid var(--gob-btn-focus-ring, #FFBE5C) !important;
    outline-offset: 2px !important;
    box-shadow: 0 0 0 1px #001141 !important;
    z-index: 5;
}

.pagination-arrow:disabled {
    opacity: 0.35;
    cursor: not-allowed;
    background-color: #F8FAFC;
    border-color: #E2E8F0;
    color: #94A3B8;
}

.pagination-arrow:disabled svg {
    stroke: #94A3B8;
}

.pagination-numbers {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    flex-wrap: wrap;
}

/* Celdas numéricas oficiales Gob.cl (Elemento=Numero, Estado=Inactive/Active) */
.pagination-page {
    background: transparent;
    border: 1px solid transparent;
    font-family: var(--font-body, 'Roboto', sans-serif);
    font-size: 0.95rem;
    font-weight: 500;
    color: var(--gob-btn-blue-primary, #0F69C4);
    text-decoration: none;
    min-width: 40px;
    height: 40px;
    padding: 0 6px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    border-radius: var(--gob-btn-radius, 4px);
    transition: background-color 0.15s ease, border-color 0.15s ease, color 0.15s ease;
    box-sizing: border-box;
    position: relative;
}

.pagination-page:hover:not(.active) {
    background-color: #EBF3FC;
    color: var(--gob-btn-blue-hover, #003B8D);
    text-decoration: none;
}

.pagination-page:active:not(.active) {
    background-color: #D6E7FA;
    color: var(--gob-btn-blue-active, #002B66);
}

.pagination-page.active {
    background-color: var(--gob-btn-blue-primary, #0F69C4);
    color: #FFFFFF;
    text-decoration: none;
    font-weight: 700;
    border-color: var(--gob-btn-blue-primary, #0F69C4);
    cursor: default;
    box-shadow: 0 1px 3px rgba(15, 105, 196, 0.2);
}

.pagination-ellipsis {
    color: #64748B;
    font-family: var(--font-body, 'Roboto', sans-serif);
    font-weight: 600;
    padding: 0 6px;
    font-size: 1rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 24px;
    height: 40px;
}

/* --- RAG IA COMPONENTES --- */
.rag-card {
    background: #FFFFFF;
    color: var(--text-primary);
    border-radius: 12px;
    padding: 28px 30px;
    border: 1px solid var(--border-color);
    border-left: 5px solid var(--gob-blue);
    border-radius: 14px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08);
}

.rag-card-header {
    border-bottom: 1px solid var(--border-color, #E5E7EB);
    padding-bottom: 16px;
    margin-bottom: 20px;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.rag-header-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
}

.rag-header-badge-group {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rag-badge {
    background: var(--gob-navy);
    color: #FFFFFF;
    padding: 4px 12px;
    border-radius: 20px;
    font-weight: 600;
    font-family: var(--font-body);
    font-size: 0.82rem;
    display: inline-flex;
    align-items: center;
    gap: 6px;
}

.rag-header-actions {
    display: flex;
    align-items: center;
    gap: 10px;
}

.rag-header-query {
    margin: 0;
}

.rag-query-title {
    font-family: var(--font-heading);
    font-weight: 700;
    color: var(--gob-navy);
    font-size: 1.25rem;
    margin: 0;
    line-height: 1.4;
}

.rag-loading-text {
    display: flex;
    align-items: center;
    gap: 12px;
    color: var(--gob-blue);
    font-weight: 600;
    font-size: 1.05rem;
    margin-bottom: 20px;
}

.btn-rag-listen {
    padding: 5px 14px;
    font-size: 0.82rem;
    background-color: var(--gob-blue-base);
    color: #FFFFFF;
    border: 1px solid var(--gob-blue-light);
    border-radius: 20px;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-weight: 600;
    box-shadow: 0 2px 6px rgba(15, 105, 196, 0.2);
    transition: all 0.2s ease;
}

.btn-rag-listen:hover {
    background: var(--gob-navy);
    color: #FFFFFF;
    transform: translateY(-1px);
    box-shadow: 0 4px 10px rgba(0, 19, 90, 0.3);
}

.btn-rag-close {
    background: rgba(0, 19, 90, 0.05);
    border: none;
    border-radius: 50%;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 1.3rem;
    line-height: 1;
    transition: all 0.2s ease;
}

.btn-rag-close:hover {
    background: var(--gob-err-light, #FFEBEF);
    color: var(--gob-red, #FF4731);
}

.rag-answer-body {
    color: var(--text-primary);
    line-height: 1.8;
    margin-bottom: 20px;
    font-size: 1.05rem;
}

.rag-answer-body p {
    color: var(--text-primary);
    margin-bottom: 12px;
}

.rag-sources-details {
    margin-top: 15px;
    cursor: pointer;
    color: var(--text-secondary);
    font-size: 0.95rem;
}

.rag-sources-summary {
    font-weight: 600;
    font-family: var(--font-body);
    color: var(--gob-navy);
    padding: 6px 0;
}

.rag-doc-item {
    background: #F8FAFC;
    border: 1px solid var(--border-color, #E2E8F0);
    border-left: 4px solid var(--gob-blue-base, #0F69C4);
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 12px;
    transition: transform 0.2s ease, box-shadow 0.2s ease, background 0.2s ease;
}

.rag-doc-item:hover {
    background: #FFFFFF;
    box-shadow: 0 4px 12px rgba(0, 19, 90, 0.08);
    border-color: var(--gob-blue-light);
}

.rag-doc-header {
    margin-bottom: 6px;
    line-height: 1.4;
}

.rag-doc-citation {
    background: #EBF3FC;
    color: var(--gob-navy, #00135A);
    font-weight: 700;
    font-size: 0.78rem;
    padding: 2px 7px;
    border-radius: 4px;
    display: inline-block;
    margin-right: 6px;
    border: 1px solid #D0E1F9;
}

.rag-doc-title-link {
    color: var(--gob-navy, #00135A);
    text-decoration: none;
    font-weight: 700;
    font-size: 0.95rem;
    font-family: var(--font-heading);
    transition: color 0.2s ease;
}

.rag-doc-title-link:hover {
    color: var(--gob-blue-base, #0F69C4);
    text-decoration: underline;
}

.rag-doc-authors {
    color: var(--text-secondary, #64748B);
    font-size: 0.84rem;
    margin: 4px 0 6px 0;
    line-height: 1.4;
}

.rag-doc-footer {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 0.82rem;
    flex-wrap: wrap;
}

.rag-doc-score {
    color: var(--gob-blue-base, #0F69C4);
    font-weight: 600;
    background: #EBF3FC;
    padding: 2px 8px;
    border-radius: 12px;
}

.rag-doc-source-link {
    color: var(--gob-blue-base, #0F69C4);
    text-decoration: none;
    font-weight: 600;
}

.rag-doc-source-link:hover {
    text-decoration: underline;
}

/* --- SECCIÓN SOBRE EL PROYECTO --- */
.about-section {
    max-width: 1000px;
    margin: 60px auto 40px auto;
    padding: 0 20px;
}

.about-header {
    text-align: center;
    margin-bottom: 35px;
}

.about-header h2 {
    font-family: var(--font-heading);
    color: var(--gob-navy);
    font-size: 1.8rem;
    margin: 0 0 10px 0;
}

.about-header p {
    color: var(--text-secondary);
    max-width: 700px;
    margin: 0 auto;
    font-size: 1rem;
    line-height: 1.6;
}

.about-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
    gap: 25px;
}

.about-card {
    background: var(--panel-bg);
    border: 1px solid var(--border-color);
    border-radius: 12px;
    padding: 25px;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.about-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.06);
    border-color: var(--gob-blue-light);
}

.about-card-icon {
    font-size: 2.2rem;
    margin-bottom: 15px;
    display: inline-block;
}

.about-card h3 {
    font-family: var(--font-heading);
    color: var(--gob-navy);
    font-size: 1.2rem;
    margin: 0 0 10px 0;
}

.about-card p {
    color: var(--text-secondary);
    font-size: 0.93rem;
    line-height: 1.6;
    margin: 0;
}

/* --- SECCIÓN PREGUNTAS FRECUENTES (FAQ) --- */
.faq-section {
    max-width: 900px;
    width: 100%;
    margin: 40px auto 60px auto;
    padding: 0 20px;
    box-sizing: border-box;
}

.faq-header {
    text-align: center;
    margin-bottom: 35px;
}

.faq-header h2 {
    font-family: var(--font-heading);
    color: var(--gob-navy);
    font-size: 1.8rem;
    margin: 0 0 10px 0;
}

.faq-list {
    width: 100%;
    display: flex;
    flex-direction: column;
    gap: 15px;
}

/* ==========================================================================
   EXPANSION PANEL (ACORDEÓN / FAQ) - UI KIT V3.0.1 GOBIERNO DE CHILE
   ========================================================================== */

.faq-item {
    width: 100%;
    border: 1px solid #E2E8F0;
    border-radius: 8px;
    overflow: hidden;
    background: #FFFFFF;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.03);
    transition: border-color 0.2s ease, box-shadow 0.2s ease, border-left 0.2s ease;
    margin-bottom: 1rem;
    box-sizing: border-box;
}

.faq-item:hover {
    border-color: #CBD5E1;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}

.faq-item.active {
    border-color: #CBD5E1;
    border-left: 4px solid var(--gob-btn-blue-primary, #0F69C4);
    box-shadow: 0 4px 14px rgba(15, 105, 196, 0.08);
}

.faq-question {
    width: 100%;
    padding: 18px 24px;
    background: transparent;
    border: none;
    text-align: left;
    font-family: var(--font-body, 'Roboto', sans-serif);
    font-size: 1.05rem;
    font-weight: 600;
    color: var(--gob-navy, #00135A);
    cursor: pointer;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 16px;
    transition: background-color 0.15s ease, color 0.15s ease;
    box-sizing: border-box;
}

.faq-item.active .faq-question {
    padding: 18px 24px 16px 24px;
    color: var(--gob-btn-blue-primary, #0F69C4);
    border-bottom: 1px solid #F1F5F9;
}

.faq-question:hover {
    background-color: #F8FAFC;
    color: var(--gob-btn-blue-primary, #0F69C4);
}

.faq-question:focus-visible {
    outline: 3px solid var(--gob-btn-focus-ring, #FFBE5C) !important;
    outline-offset: -2px !important;
    background-color: #F8FAFC;
}

.faq-question span:first-child {
    flex: 1;
    line-height: 1.4;
}

/* Ícono Chevron Oficial Gob.cl */
.faq-chevron {
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), stroke 0.2s ease;
    stroke: var(--gob-btn-blue-primary, #0F69C4);
    flex-shrink: 0;
}

.faq-item.active .faq-chevron {
    transform: rotate(180deg);
}

.faq-question:hover .faq-chevron {
    stroke: var(--gob-btn-blue-hover, #003B8D);
}

.faq-answer {
    display: grid;
    grid-template-rows: 0fr;
    transition: grid-template-rows 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    background: #FFFFFF;
}

.faq-item.active .faq-answer {
    grid-template-rows: 1fr;
}

.faq-answer-inner {
    overflow: hidden;
    min-height: 0;
    padding: 0 24px;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.25s ease, padding 0.3s ease, visibility 0.25s ease;
}

.faq-item.active .faq-answer-inner {
    padding: 16px 24px 22px 24px;
    opacity: 1;
    visibility: visible;
}

.faq-answer p {
    color: #334155;
    font-size: 0.96rem;
    line-height: 1.65;
    margin: 0 0 14px 0;
    padding: 0;
}

.faq-answer p:last-child {
    margin-bottom: 0;
}

.faq-answer a {
    color: var(--gob-btn-blue-primary, #0F69C4);
    text-decoration: underline;
    font-weight: 500;
}

.faq-answer a:hover {
    color: var(--gob-btn-blue-hover, #003B8D);
}

/* Nav Superior */
.top-nav {
    position: sticky;
    top: 0;
    width: 100%;
    padding: 12px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    box-sizing: border-box;
    z-index: 100;
    background: var(--gob-header);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.nav-brand {
    display: flex;
    align-items: center;
    gap: 12px;
    text-decoration: none;
    color: white;
    background: transparent;
    padding: 0;
    border-radius: 0;
    transition: opacity 0.2s ease;
}

.nav-brand:hover {
    opacity: 0.9;
    background: transparent;
}

.top-nav .nav-admin-link {
    color: white;
    text-decoration: none;
    font-family: var(--font-body);
    font-weight: 500;
    font-size: 0.85rem;
    background: rgba(255, 255, 255, 0.1);
    padding: 8px 18px;
    border-radius: 20px;
    border: 1px solid rgba(255, 255, 255, 0.2);
    transition: all 0.2s ease;
}

.top-nav .nav-admin-link:hover {
    background: var(--gob-blue-base);
    border-color: var(--gob-blue-base);
}

/* ==========================================================================
   FOOTER INSTITUCIONAL GOB.CL (UI Kit v3.0.1)
   ========================================================================== */
.gob-footer {
    background-color: var(--gob-header);
    color: #FFFFFF;
    position: relative;
    z-index: 10;
    margin-top: 50px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.gob-footer-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 48px 24px 36px 24px;
    display: grid;
    grid-template-columns: 1.4fr 1fr 1fr 1.2fr;
    gap: 36px;
}

.footer-col {
    display: flex;
    flex-direction: column;
}

.footer-brand-header {
    display: flex;
    align-items: center;
    gap: 12px;
    margin-bottom: 12px;
}

.footer-logo-img {
    height: 34px;
    width: auto;
    max-width: 36px;
    object-fit: contain;
    filter: drop-shadow(0 2px 4px rgba(0, 0, 0, 0.4));
}

.footer-brand-title {
    font-family: var(--font-heading);
    font-size: 1.15rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: -0.2px;
}

.footer-brand-sub {
    font-size: 0.85rem;
    font-weight: 500;
    color: #93C5FD;
    margin: 0 0 10px 0;
    line-height: 1.4;
}

.footer-brand-desc {
    font-size: 0.82rem;
    color: #CBD5E1;
    line-height: 1.6;
    margin: 0;
    max-width: 340px;
}

.footer-brand-desc a,
.footer-col-brand a {
    color: #FFFFFF;
    text-decoration: underline;
    text-underline-offset: 3px;
    font-weight: 500;
    transition: color 0.2s ease, opacity 0.2s ease;
}

.footer-brand-desc a:hover,
.footer-col-brand a:hover {
    color: #93C5FD;
    opacity: 0.9;
}

.footer-heading {
    font-family: var(--font-heading);
    font-size: 0.88rem;
    font-weight: 700;
    color: #FFFFFF;
    letter-spacing: 0.5px;
    text-transform: uppercase;
    margin: 0 0 16px 0;
}

.footer-links {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.footer-links a,
.footer a {
    color: #E2E8F0;
    text-decoration: none;
    font-size: 0.85rem;
    transition: color 0.2s ease, transform 0.2s ease;
    display: inline-block;
}

.footer-links a:hover {
    color: #38BDF8;
    text-decoration: underline;
}

.footer-helpdesk {
    margin-top: 14px;
    padding-top: 12px;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.footer-helpdesk-label {
    font-size: 0.85rem;
    font-weight: 600;
    color: #FFFFFF;
    margin: 0 0 4px 0;
}

.footer-helpdesk-hours {
    font-size: 0.8rem;
    color: #94A3B8;
    margin: 0 0 8px 0;
}

.footer-phone {
    font-family: var(--font-heading);
    font-size: 1.05rem;
    font-weight: 700;
    color: #38BDF8;
    text-decoration: none;
    display: inline-block;
    transition: color 0.2s ease;
}

.footer-phone:hover {
    color: #7DD3FC;
    text-decoration: underline;
}

/* Sub-footer / Barra Bicolor Inferior Gob.cl */
.gob-footer-bottom {
    background-color: var(--gob-header);
    border-top: 1px solid rgba(255, 255, 255, 0.08);
    padding: 18px 24px 24px 24px;
}

.gob-footer-bottom-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.gob-accent-bar {
    display: flex;
    height: 4px;
    width: 90px;
    border-radius: 2px;
    overflow: hidden;
}

.gob-bar-blue {
    width: 45%;
    background-color: var(--gob-blue, #0F69C4);
}

.gob-bar-red {
    width: 55%;
    background-color: var(--gob-red, #FF4731);
}

.gob-copyright {
    font-size: 0.78rem;
    color: #94A3B8;
    margin: 0;
    line-height: 1.5;
}

/* --- RESPONSIVIDAD (MEDIA QUERIES) --- */
@media (max-width: 768px) {
    .top-nav {
        padding: 8px 10px;
        gap: 8px;
    }

    .top-nav a {
        font-size: 0.72rem;
        padding: 5px 8px;
        letter-spacing: -0.2px;
    }

    .hero-section {
        min-height: auto;
        padding: 40px 16px 30px 16px;
    }

    .hero-title-wrapper {
        flex-direction: column;
        gap: 12px;
        text-align: center;
    }

    .hero-title {
        text-align: center;
    }

    .search-box {
        padding: 4px 4px 4px 14px;
        border-radius: 30px;
    }

    .search-input {
        padding: 8px;
        font-size: 0.95rem;
    }

    .btn-search {
        border-radius: 26px;
        padding: 0 18px;
        height: 40px;
        font-size: 0.85rem;
        white-space: nowrap;
    }

    .stats-section {
        padding: 40px 16px;
    }

    .stats-grid {
        grid-template-columns: 1fr;
        gap: 20px;
    }

    .stat-card {
        padding: 20px;
    }

    .stat-value {
        font-size: 2.5rem;
    }

    .results-container {
        margin: 30px auto;
        padding: 0 16px;
    }

    .result-card {
        padding: 16px;
    }

    .gob-footer-container {
        grid-template-columns: 1fr;
        gap: 28px;
        padding: 36px 16px 24px 16px;
    }

    .footer-col {
        border-bottom: 1px solid rgba(255, 255, 255, 0.08);
        padding-bottom: 20px;
    }

    .footer-col:last-child {
        border-bottom: none;
        padding-bottom: 0;
    }
}