/* ==================================
   VARIABLES CSS INSTITUCIONALES
===================================== */
:root {
    --primary-color: #0b3d91;
    /* Azul institucional */
    --primary-dark: #082c69;
    --secondary-color: #2e7d32;
    /* Verde salud pública */
    --accent-color: #43a047;
    --bg-color: #f5f7fb;
    --text-color: #333333;
    --ink: #0f172a;
    --ink-muted: #64748b;
    --navbar-bg: #ffffff;
    --transition-speed: 0.3s;
    --font-display: 'Newsreader', Georgia, serif;
}

/* ==================================
   RESETEOS Y ESTRUCTURA GENERAL
===================================== */
body {
    font-family: 'Inter', sans-serif;
    background-color: var(--bg-color);
    color: var(--text-color);
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

#app-content {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* Bootstrap Icons hereda line-height:1.5 del body por defecto, lo que dejaba
   relleno invisible arriba/abajo del glifo y los hacía ver chicos/apretados. */
.bi,
[class^="bi-"],
[class*=" bi-"] {
    line-height: 1;
}

/* ==================================
   NAVBAR Y NAVEGACIÓN
===================================== */
.navbar {
    background-color: var(--navbar-bg);
    transition: all var(--transition-speed) ease;
    border-bottom: 1px solid rgba(15, 23, 42, 0.07);
}

.navbar-brand .text-primary {
    color: var(--primary-color) !important;
}

.brand-subtitle {
    display: block;
    font-size: 0.68rem;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--secondary-color);
}

.nav-link {
    font-weight: 500;
    color: #555;
    padding: 0.5rem 1rem;
    transition: color var(--transition-speed) ease, background-color var(--transition-speed) ease;
    border-radius: 8px;
    margin: 0 0.2rem;
}

.nav-link:hover {
    color: var(--primary-color);
    background-color: rgba(11, 61, 145, 0.06);
}

.nav-link.active {
    color: var(--primary-color) !important;
    font-weight: 600;
    position: relative;
}

.nav-link.active::after {
    content: '';
    position: absolute;
    bottom: 0px;
    left: 10%;
    width: 80%;
    height: 3px;
    background-color: var(--primary-color);
    border-radius: 3px 3px 0 0;
}

/* Botón "Iniciar sesión" en el navbar */
.login-btn {
    display: inline-flex !important;
    align-items: center;
    border: 1.5px solid var(--primary-color);
    color: var(--primary-color) !important;
    font-weight: 600;
    padding: 0.5rem 1.1rem !important;
}

.login-btn:hover {
    background-color: var(--primary-color);
    color: #ffffff !important;
}

/* ==================================
   HERO (Página de inicio)
===================================== */
.hero-section {
    position: relative;
    overflow: hidden;
    padding: 4.5rem 1rem 5rem;
    background: linear-gradient(135deg, var(--primary-color) 0%, #0a3277 62%, var(--primary-dark) 100%);
    animation: fadeIn 0.5s ease-out;
}

.hero-illustration {
    position: absolute;
    right: -80px;
    top: -120px;
    opacity: 0.45;
    pointer-events: none;
}

.hero-content {
    position: relative;
    max-width: 640px;
}

.hero-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.35rem 0.9rem;
    border-radius: 999px;
    background: rgba(67, 160, 71, 0.18);
    border: 1px solid rgba(67, 160, 71, 0.4);
    color: #8fe3a0;
    font-size: 0.8rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 2.6rem;
    line-height: 1.15;
    color: #ffffff;
    margin-bottom: 1.1rem;
    letter-spacing: -0.01em;
}

.hero-subtitle {
    font-size: 1.05rem;
    line-height: 1.6;
    color: #c7d3ec;
    margin-bottom: 2rem;
    max-width: 500px;
}

.hero-cta-primary {
    display: inline-flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.8rem 1.5rem;
    background: var(--accent-color);
    color: #ffffff;
    border-radius: 10px;
    font-weight: 600;
    font-size: 0.95rem;
    box-shadow: 0 12px 24px rgba(67, 160, 71, 0.35);
    text-decoration: none;
    transition: transform var(--transition-speed) ease, box-shadow var(--transition-speed) ease;
}

.hero-cta-primary:hover {
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 16px 30px rgba(67, 160, 71, 0.4);
}

@media (max-width: 767.98px) {
    .hero-title {
        font-size: 2rem;
    }

    .hero-illustration {
        display: none;
    }
}

/* ==================================
   SECCIONES DE CATEGORÍA (Home)
===================================== */
.category-section {
    padding: 3rem 0 0.5rem;
}

.category-heading {
    display: flex;
    align-items: center;
    gap: 0.9rem;
    margin-bottom: 1.75rem;
}

.category-icon-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 12px;
    background: rgba(11, 61, 145, 0.09);
    color: var(--primary-color);
    font-size: 1.5rem;
    flex-shrink: 0;
}

.category-section.is-green .category-icon-badge {
    background: rgba(46, 125, 50, 0.1);
    color: var(--secondary-color);
}

.category-title {
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 1.5rem;
    margin: 0;
    color: var(--ink);
}

.category-subtitle {
    margin: 0.15rem 0 0;
    font-size: 0.85rem;
    color: var(--ink-muted);
}

/* ==================================
   DASHBOARD / CONTENIDOS
===================================== */
.dashboard-header {
    display: flex;
    align-items: flex-end;
    justify-content: space-between;
    flex-wrap: wrap;
    gap: 0.75rem;
    padding: 1.25rem 1.75rem 0;
    animation: fadeInDown 0.5s ease-out;
}

.dashboard-header h1 {
    font-family: var(--font-display);
    color: var(--ink);
    font-weight: 600;
    font-size: 1.6rem;
    margin-bottom: 0.2rem;
}

.dashboard-header p {
    color: var(--ink-muted);
    font-size: 0.85rem;
    margin-bottom: 0;
}

.dashboard-breadcrumb {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8rem;
    color: #94a3b8;
    margin-bottom: 0.3rem;
}

.dashboard-breadcrumb strong {
    color: var(--ink);
    font-weight: 600;
}

.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.4rem 0.9rem;
    border-radius: 999px;
    background: rgba(46, 125, 50, 0.09);
    color: var(--secondary-color);
    font-size: 0.78rem;
    font-weight: 600;
    white-space: nowrap;
}

.status-badge .dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--accent-color);
}

/* Contenedor Iframe Power BI */
.iframe-container {
    position: relative;
    width: 100%;
    flex: 1;
    min-height: 420px;
    background-color: #fff;
    border-radius: 14px;
    box-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
    overflow: hidden;
    animation: fadeIn 0.6s ease-out;
}

.dashboard-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    padding: 1rem 1.75rem 1.75rem;
}

.iframe-container iframe {
    width: 100%;
    height: 100%;
    border: none;
    position: absolute;
    top: 0;
    left: 0;
    z-index: 10;
}

/* ==================================
   LOADER (Indicador de carga)
===================================== */
.loader-wrapper {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    display: flex;
    justify-content: center;
    align-items: center;
    background-color: #f8f9fa;
    z-index: 5;
    flex-direction: column;
}

.spinner-border {
    color: var(--primary-color);
    width: 2.6rem;
    height: 2.6rem;
}

.loader-text {
    margin-top: 1rem;
    color: var(--ink-muted);
    font-weight: 500;
    font-size: 0.9rem;
}

/* ==================================
   INTERFAZ (Botones, utilidades)
===================================== */
/* Botón "Volver Arriba" */
#btn-back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    display: none;
    background-color: var(--primary-color);
    color: white;
    border: none;
    z-index: 99;
    width: 45px;
    height: 45px;
    padding: 0;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    transition: all var(--transition-speed) ease;
}

#btn-back-to-top:hover {
    background-color: var(--secondary-color);
    transform: translateY(-3px);
    box-shadow: 0 6px 15px rgba(0, 0, 0, 0.2) !important;
}

.footer-institucional {
    background-color: var(--primary-dark);
}

/* ==================================
   TARJETAS DE PROYECTO (Home)
===================================== */
.project-card {
    transition: transform 0.3s ease, box-shadow 0.3s ease, border-color 0.3s ease;
    border: 1px solid rgba(0, 0, 0, 0.08);
    border-radius: 14px;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.03);
    height: 100%;
    text-decoration: none;
    color: inherit;
    display: flex;
    flex-direction: column;
    background-color: #fff;
}

.project-card:hover {
    transform: translateY(-6px);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.12);
    border-color: rgba(11, 61, 145, 0.25);
}

.project-card:hover .project-card-arrow {
    transform: translateX(4px);
    opacity: 1;
}

.project-card-icon-badge {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    border-radius: 11px;
    background: rgba(11, 61, 145, 0.08);
    color: var(--primary-color);
    font-size: 1.5rem;
    margin-bottom: 1.1rem;
}

.category-section.is-green .project-card-icon-badge {
    background: rgba(46, 125, 50, 0.09);
    color: var(--secondary-color);
}

.project-card h4 {
    font-size: 1.02rem;
    font-weight: 700;
    color: var(--ink);
    margin-bottom: 0.4rem;
}

.project-card p {
    font-size: 0.85rem;
    line-height: 1.55;
    color: var(--ink-muted);
    margin-bottom: 1.1rem;
    flex: 1;
}

.project-card-footer {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.83rem;
    font-weight: 600;
    color: var(--primary-color);
}

.category-section.is-green .project-card-footer {
    color: var(--secondary-color);
}

.project-card-arrow {
    font-size: 1rem;
    transition: transform var(--transition-speed) ease, opacity var(--transition-speed) ease;
    opacity: 0.45;
}

/* ==================================
   ANIMACIONES
===================================== */
@keyframes fadeIn {
    from {
        opacity: 0;
    }

    to {
        opacity: 1;
    }
}

@keyframes fadeInDown {
    from {
        opacity: 0;
        transform: translateY(-20px);
    }

    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.4s ease-in-out;
}
