/* ================================
   ESTILO GUBERNAMENTAL BTA 2.0
   ================================ */

/* Variables CSS para consistencia */
:root {
    --primary-color: #1e4a72;        /* Azul gubernamental más claro */
    --secondary-color: #4a90e2;      /* Azul gubernamental intermedio */
    --accent-color: #2e8b57;         /* Verde institucional */
    --light-gray: #f8f9fa;          /* Gris muy claro */
    --medium-gray: #e9ecef;         /* Gris medio */
    --dark-gray: #6c757d;           /* Gris oscuro */
    --text-primary: #212529;        /* Negro suave */
    --text-secondary: #6c757d;      /* Gris para texto secundario */
    --border-color: #dee2e6;        /* Color de bordes */
    --shadow: 0 2px 4px rgba(0,0,0,0.1); /* Sombra suave */
    --table-header-bg: #4a90e2;     /* Azul sólido para headers de tabla */
}

/* Reset y configuración base */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

html, body {
    margin: 0;
    padding: 0;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: var(--text-primary);
    background-color: var(--light-gray);
}

/* Header gubernamental - manteniendo degradado */
.container-fluid {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: var(--shadow);
    border-bottom: 3px solid var(--accent-color);
    margin: 0;
    padding: 0;
}

.navbar {
    background: transparent !important;
    padding: 0.8rem 1rem;
    margin: 0;
}

.navbar.fixed-top {
    top: 0;
    margin-top: 0;
}

.navbar-brand {
    display: flex;
    align-items: center;
}

.navbar-brand::before {
    content: "📋" !important;
    font-size: 2.5rem !important;
    margin-right: 0.8rem !important;
    background-image: none !important;
    background: none !important;
    width: auto !important;
    height: auto !important;
    position: static !important;
}

#TitleCatalog {
    color: #FFFFFF;
    font-weight: 700;
    font-size: 1.8rem;
    margin: 0;
    text-shadow: 1px 1px 2px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
}

/* Navegación */
.navbar-nav .nav-link {
    color: white !important;
    font-weight: 500;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    transition: all 0.3s ease;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.navbar-nav .nav-link:hover {
    background-color: rgba(255, 255, 255, 0.2);
    transform: translateY(-1px);
}

/* Dropdown gubernamental */
.dropdown-menu {
    border: none;
    border-radius: 8px;
    box-shadow: 0 8px 25px rgba(0,0,0,0.15);
    background-color: white;
    border-top: 3px solid var(--accent-color);
}

.dropstart .dropdown-menu[data-bs-popper] {
    top: 2rem;
    right: 20%;
    left: auto;
    margin-top: 0;
    margin-right: var(--bs-dropdown-spacer);
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: clip;
}

.dropdown-item {
    color: var(--text-primary);
    padding: 0.7rem 1.2rem;
    border-bottom: 1px solid var(--border-color);
    transition: all 0.2s ease;
}

.dropdown-item:last-child {
    border-bottom: none;
}

.dropdown-item:hover {
    background-color: var(--secondary-color);
    color: white;
    padding-left: 1.5rem;
}

.dropdown-divider {
    border-color: var(--accent-color);
    margin: 0.5rem 0;
}

/* Input de búsqueda */
#myInput {
    margin: 0.5rem;
    width: calc(100% - 1rem);
    padding: 0.6rem;
    border: 2px solid var(--border-color);
    border-radius: 6px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease;
}

#myInput:focus {
    border-color: var(--secondary-color);
    outline: none;
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

/* Títulos */
h1 {
    text-align: center;
    font-weight: 700;
    color: var(--primary-color);
    margin-bottom: 2rem;
}

h2 {
    color: var(--primary-color);
    font-weight: 600;
    margin-bottom: 1.5rem;
    padding-left: 1rem;
    border-left: 4px solid var(--accent-color);
}

h4 {
    color: var(--text-primary);
    font-weight: 500;
}

/* Secciones - ajuste de padding superior para header fijo */
section {
    padding: 1.5rem;
    background-color: white;
    margin: 1.5rem auto;
    max-width: 1400px;
    border-radius: 8px;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--secondary-color);
    margin-top: 120px; /* Espacio para el header fijo */
}

/* Ajuste específico para la primera sección */
section:first-of-type {
    margin-top: 100px;
}

/* Presentación */
.presentacion {
    text-align: center;
    padding: 3rem 2rem;
    background-color: white; /* Sin degradado, fondo blanco sólido */
    border-radius: 12px;
    margin-bottom: 2rem;
}

.presentacion h1 {
    color: var(--primary-color);
    font-size: 2.5rem;
    margin-bottom: 2rem;
    font-weight: 800;
}

.presentacion h4 {
    color: var(--text-secondary);
    font-weight: 400;
    font-size: 1.1rem;
    line-height: 1.8;
    max-width: 900px;
    margin: 0 auto 2rem auto;
    text-align: justify;
}

/* Tablas gubernamentales - sin degradados */
.table {
    background-color: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
    margin-bottom: 2rem;
    table-layout: auto;
    word-wrap: normal;
}

.table thead th {
    background-color: var(--table-header-bg); /* Azul sólido sin degradado */
    color: white;
    font-weight: 600;
    text-transform: uppercase;
    font-size: 0.85rem;
    letter-spacing: 0.5px;
    padding: 0.5rem 0.8rem;
    border: 2px solid white; /* Borde blanco solo en headers */
    position: sticky;
    top: 0;
    z-index: 10;
    white-space: nowrap;
}

.table tbody tr {
    transition: all 0.2s ease;
    border-bottom: 1px solid var(--border-color);
}

.table tbody tr:hover {
    background-color: rgba(74, 144, 226, 0.08); /* Hover azul muy suave */
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.table td {
    padding: 0.4rem 0.8rem;
    vertical-align: middle;
    border-color: var(--border-color); /* Vuelve al color original */
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
    word-break: keep-all;
    white-space: normal;
    min-width: 120px;
}

.table-bordered {
    border: 2px solid var(--border-color);
}

.table-bordered th,
.table-bordered td {
    border: 1px solid var(--border-color);
}

/* Excepción: headers de tabla-bordered mantienen borde blanco */
.table-bordered thead th {
    border: 2px solid white;
}

.tabla-ajustada {
    margin-bottom: 0.5rem;
    border-radius: 6px;
    overflow: hidden;
}

.tabla-ajustada td,
.tabla-ajustada th {
    padding: 0.3rem;
    vertical-align: top;
}

.tabla-ajustada thead th {
    background-color: var(--table-header-bg);
    color: white;
    border: 2px solid white; /* Borde blanco solo en headers */
}

.tabla-ajustada td {
    border: 1px solid var(--border-color); /* Color normal en celdas */
}

/* Enlaces */
a {
    color: var(--secondary-color);
    text-decoration: none;
    font-weight: 500;
    transition: all 0.2s ease;
}

a:hover {
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-color: var(--accent-color);
    text-decoration-thickness: 2px;
}

/* NUEVO: Enlaces en tablas - estilo en negrita */
.table a,
.tabla-ajustada a {
    font-weight: 700;
    color: var(--secondary-color);
}

.table a:hover,
.tabla-ajustada a:hover {
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-color: var(--accent-color);
    text-decoration-thickness: 2px;
}

/* Acordeón gubernamental - sin degradados */
.accordion {
    border-radius: 8px;
    overflow: hidden;
    box-shadow: var(--shadow);
}

.accordion-item {
    border: none;
    border-bottom: 1px solid var(--border-color);
}

.accordion-item:last-child {
    border-bottom: none;
}

.accordion-header {
    background-color: var(--light-gray);
}

.accordion-button {
    background-color: var(--light-gray); /* Color sólido sin degradado */
    color: var(--primary-color);
    font-weight: 600;
    padding: 0.8rem 1.2rem;
    border: none;
    text-transform: uppercase;
    font-size: 0.9rem;
    letter-spacing: 0.5px;
}

.accordion-button:not(.collapsed) {
    background-color: var(--table-header-bg); /* Azul sólido */
    color: white;
    box-shadow: none;
}

.accordion-button:focus {
    border-color: var(--secondary-color);
    box-shadow: 0 0 0 3px rgba(0, 102, 204, 0.1);
}

.accordion-body {
    padding: 1rem;
    background-color: white;
}

/* Footer gubernamental - manteniendo degradado solo aquí */
footer {
    background: linear-gradient(135deg, #2d5a87 0%, #3a6fa0 100%);
    color: white;
    padding: 0.4rem 0;
    margin-top: 2rem;
    border-top: 2px solid var(--accent-color);
    box-shadow: 0 -1px 6px rgba(0,0,0,0.1);
    min-height: 35px;
}

footer .container {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
}

footer .text-muted {
    color: rgba(255, 255, 255, 0.95) !important;
    font-weight: 400;
    font-size: 0.8rem;
    margin: 0;
    line-height: 1.3;
    text-shadow: 1px 1px 1px rgba(0,0,0,0.3);
}

/* Elementos de énfasis */
.badge {
    background-color: var(--accent-color);
    color: white;
    padding: 0.4rem 0.8rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

/* Clases utilitarias gubernamentales */
.gov-card {
    background-color: white;
    border-radius: 8px;
    padding: 2rem;
    box-shadow: var(--shadow);
    border-top: 4px solid var(--secondary-color);
    margin-bottom: 2rem;
}

.gov-highlight {
    background-color: rgba(74, 144, 226, 0.1); /* Azul muy suave sin degradado */
    padding: 1rem;
    border-radius: 6px;
    border-left: 4px solid var(--accent-color);
    margin: 1rem 0;
}

.romper-palabras {
    word-wrap: break-word;
    overflow-wrap: break-word;
    hyphens: none;
    word-break: normal;
}

/* Responsive */
@media (max-width: 768px) {
    .container-fluid {
        padding: 0.5rem;
    }

    #TitleCatalog {
        font-size: 1.4rem;
    }

    .presentacion {
        padding: 2rem 1rem;
    }

    .presentacion h1 {
        font-size: 2rem;
    }

    section {
        margin: 1rem;
        padding: 1rem;
    }

    .table {
        font-size: 0.9rem;
    }

    .table td,
    .table th {
        padding: 0.5rem 0.3rem;
    }
}

/* Animaciones suaves */
@keyframes fadeInUp {
    from {
        opacity: 0;
        transform: translateY(20px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

section {
    animation: fadeInUp 0.6s ease-out;
}

/* Estados de carga */
.loading {
    position: relative;
    overflow: hidden;
}

.loading::after {
    content: "";
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(74, 144, 226, 0.1), transparent);
    animation: shimmer 1.5s infinite;
}

@keyframes shimmer {
    0% { left: -100%; }
    100% { left: 100%; }
}

/* Mejoras de accesibilidad */
.sr-only {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Focus visible para accesibilidad */
*:focus-visible {
    outline: 2px solid var(--secondary-color);
    outline-offset: 2px;
}

/* Alto contraste para accesibilidad */
@media (prefers-contrast: high) {
    :root {
        --primary-color: #000066;
        --secondary-color: #0033aa;
        --text-primary: #000000;
    }
}

/* Forzar fondo blanco siempre */
body {
    background-color: #f8f9fa !important;
    color: #212529 !important;
}

section {
    background-color: white !important;
}

.table {
    background-color: white !important;
}

/* Estilo especial para tablas anidadas en acordeones */
.accordion-body .table {
    margin-bottom: 0;
}

.accordion-body .table thead th {
    background-color: var(--table-header-bg);
    border: 2px solid white; /* Solo headers con borde blanco */
}

.accordion-body .table td {
    border: 1px solid var(--border-color); /* Celdas con borde normal */
}

/* NUEVO: Enlaces en tablas dentro de acordeones también en negrita */
.accordion-body .table a {
    font-weight: 700;
    color: var(--secondary-color);
}

.accordion-body .table a:hover {
    font-weight: 700;
    color: var(--primary-color);
    text-decoration: underline;
    text-decoration-color: var(--accent-color);
    text-decoration-thickness: 2px;
}

/* Dropdown submenu styles para navegación jerárquica */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-top: -6px;
    margin-left: -1px;
    border-radius: 0 6px 6px 6px;
}

.dropdown-submenu:hover .dropdown-menu {
    display: block;
}

.dropdown-submenu > .dropdown-toggle:after {
    display: none;
}

.dropdown-submenu > .dropdown-toggle:before {
    content: "▶";
    float: right;
    border: none;
    font-size: 0.8em;
}