/* =========================================================================
   Portal de Estudiantes - DPI Facultad de Medicina
   Bloque <style> corregido. Reemplaza integramente las lineas 94-370
   de index_portal.php (desde <style> hasta </style>, sin incluir las etiquetas).
   ========================================================================= */

:root {
    --primary-color: #003d7a;
    --secondary-color: #0066cc;
    --accent-color: #00a8e8;
    --dark-color: #1a1a1a;
    --light-gray: #f8f9fa;
    --border-color: #e0e0e0;
    --focus-ring: #ffbf47;
}

/* ---------------------------------------------------------------
   Layout base: sticky footer con flexbox.
   El footer deja de ser fixed, por lo tanto ya no tapa contenido.
   Requiere en el HTML: <main class="container page-content"> ... </main>
   --------------------------------------------------------------- */
body {
    /* Antes: * { font-family } -- ahora se hereda desde body */
    font-family: 'Inter', system-ui, -apple-system, 'Segoe UI', Roboto, sans-serif;
    background: linear-gradient(135deg, #f5f7fa 0%, #e8eef5 100%);
    background-attachment: fixed;   /* evita que el degradado se "corte" al hacer scroll */
    min-height: 100vh;
    min-height: 100dvh;             /* corrige la barra de direcciones en moviles */
    display: flex;
    flex-direction: column;
    /* padding-bottom: 100px  <-- ELIMINADO: era el parche del footer fixed */
}

/* El contenido ocupa el espacio disponible y empuja el footer hacia abajo */
.page-content {
    flex: 1 0 auto;
}

/* ---------------------------------------------------------------
   Navbar
   --------------------------------------------------------------- */
.navbar-custom {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    padding: 1rem 0;
}

.navbar-custom .navbar-brand {
    font-weight: 600;
    font-size: 1.25rem;
    color: #fff !important;
    display: flex;
    align-items: center;
    gap: 0.75rem;
}

.navbar-custom .nav-link {
    color: rgba(255, 255, 255, 0.9) !important;
    font-weight: 500;
    padding: 0.5rem 1rem !important;
    border-radius: 8px;
    transition: background-color 0.2s ease, color 0.2s ease;
}

.navbar-custom .nav-link:hover,
.navbar-custom .nav-link:focus-visible {
    background: rgba(255, 255, 255, 0.15);
    color: #fff !important;
}

/* Foco visible sobre fondo oscuro */
.navbar-custom .nav-link:focus-visible,
.navbar-custom .navbar-brand:focus-visible,
.navbar-custom .navbar-toggler:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------
   Hero
   --------------------------------------------------------------- */
.hero-section {
    background: #fff;
    border-radius: 20px;
    padding: 3rem 2rem;
    margin: 2rem 0;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
    text-align: center;
}

.hero-section h1 {
    color: var(--primary-color);
    font-weight: 700;
    margin-bottom: 1rem;
    font-size: 2rem;
}

/* Antes se estilaba un <h4> como parrafo. En el HTML usar <p class="hero-lead"> */
.hero-section .hero-lead {
    color: #555;
    font-size: 1.1rem;
    line-height: 1.6;
    font-weight: 400;
    max-width: 65ch;        /* linea de lectura comoda */
    margin-inline: auto;
    margin-bottom: 0;
}

/* Titulo de seccion de modulos (antes era un segundo <h1>) */
.section-title {
    color: var(--primary-color);
    font-weight: 600;
    font-size: 1.5rem;
    text-align: center;
    margin: 3rem 0;
}

/* ---------------------------------------------------------------
   Cards informativas
   --------------------------------------------------------------- */
.info-card {
    background: #fff;
    border-radius: 16px;
    padding: 2rem;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    height: 100%;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.info-card-header {
    background: linear-gradient(135deg, var(--accent-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    padding: 1rem;
    border-radius: 12px;
    margin-bottom: 1.5rem;
    font-weight: 600;
    font-size: 1.1rem;
}

/* ---------------------------------------------------------------
   Grilla de modulos
   min() evita desborde horizontal en pantallas de 320-360px
   --------------------------------------------------------------- */
.modules-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(min(320px, 100%), 1fr));
    gap: 1.5rem;
    margin: 2rem 0;
}

.module-card {
    background: #fff;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    display: flex;
    flex-direction: column;
}

.module-header {
    background: linear-gradient(135deg, var(--primary-color) 0%, var(--secondary-color) 100%);
    color: #fff;
    padding: 1.5rem;
    text-align: center;
}

.module-header h2,
.module-header h3,
.module-header h5 {
    margin: 0;
    font-weight: 600;
    font-size: 1.1rem;
}

.module-body {
    padding: 1.5rem;
    flex-grow: 1;
    display: flex;
    flex-direction: column;
}

.module-body p {
    color: #555;
    line-height: 1.6;
    flex-grow: 1;
}

.module-footer {
    padding: 1.25rem 1.5rem;
    background: var(--light-gray);
    text-align: center;
    border-top: 1px solid var(--border-color);
}

/* ---------------------------------------------------------------
   Botones
   Se usan las variables de Bootstrap 5.3 para NO anular .btn-sm
   --------------------------------------------------------------- */
.btn-modern {
    --bs-btn-padding-y: 0.75rem;
    --bs-btn-padding-x: 2rem;
    --bs-btn-border-radius: 12px;
    font-weight: 600;
    border: none;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.btn-modern.btn-sm {
    --bs-btn-padding-y: 0.45rem;
    --bs-btn-padding-x: 1.25rem;
    --bs-btn-font-size: 0.875rem;
}

.btn-primary-modern {
    background: linear-gradient(135deg, var(--secondary-color) 0%, var(--accent-color) 100%);
    color: #fff;
}

.btn-primary-modern:hover,
.btn-primary-modern:focus-visible {
    color: #fff;
}

/* El borde se elimino en .btn-modern: hay que devolver un indicador de foco */
.btn-modern:focus-visible {
    outline: 3px solid var(--primary-color);
    outline-offset: 3px;
    box-shadow: none;
}

/* ---------------------------------------------------------------
   Alerts
   --------------------------------------------------------------- */
.alert-modern {
    border: none;
    border-radius: 12px;
    padding: 1.25rem;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
}

.alert-modern i {
    margin-right: 0.5rem;
}

.alert-modern ul {
    padding-left: 1.25rem;
}

/* ---------------------------------------------------------------
   Login
   --------------------------------------------------------------- */
.login-card {
    background: #fff;
    border-radius: 20px;
    padding: 3rem;
    box-shadow: 0 12px 32px rgba(0, 0, 0, 0.12);
    max-width: 600px;
    margin: 2rem auto;
}

.login-card-header {
    text-align: center;
    margin-bottom: 2rem;
}

.login-card-header h2 {
    color: var(--primary-color);
    font-weight: 700;
    font-size: 1.5rem;
}

/* ---------------------------------------------------------------
   Video
   --------------------------------------------------------------- */
.video-container {
    position: relative;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
    margin: 2rem 0;
}

.video-container iframe {
    display: block;
    width: 100%;
    aspect-ratio: 16 / 9;
    border: 0;
}

/* ---------------------------------------------------------------
   Footer: ya NO es fixed. Queda al final del flujo gracias al
   flex del body, sin superponerse jamas al contenido.
   --------------------------------------------------------------- */
footer {
    background: linear-gradient(135deg, var(--dark-color) 0%, var(--primary-color) 100%);
    color: #fff;
    padding: 2rem 1rem;
    margin-top: 3rem;
    flex-shrink: 0;
}

footer a {
    color: var(--accent-color);
    text-decoration: none;
    transition: color 0.2s ease;
}

footer a:hover,
footer a:focus-visible {
    color: #fff;
    text-decoration: underline;
}

footer a:focus-visible {
    outline: 3px solid var(--focus-ring);
    outline-offset: 2px;
}

/* ---------------------------------------------------------------
   Tabla de datos personales
   --------------------------------------------------------------- */
.table-modern {
    border: none;
    margin-bottom: 0;
}

.table-modern th {
    background: var(--light-gray);
    color: var(--primary-color);
    font-weight: 600;
    border: none;
    padding: 1rem;
    width: 30%;
    white-space: nowrap;
}

.table-modern td {
    border-bottom: 1px solid var(--border-color);
    padding: 1rem;
}

/* Correos largos no rompen el layout en movil */
.table-modern td {
    overflow-wrap: anywhere;
}

/* ---------------------------------------------------------------
   Interacciones: solo en dispositivos con puntero fino.
   Evita el "hover pegado" al tocar una card en movil.
   --------------------------------------------------------------- */
@media (hover: hover) and (pointer: fine) {
    .info-card:hover {
        transform: translateY(-5px);
        box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
    }

    .module-card:hover {
        transform: translateY(-6px);
        box-shadow: 0 12px 32px rgba(0, 0, 0, 0.15);
    }

    .btn-primary-modern:hover {
        transform: translateY(-2px);
        box-shadow: 0 8px 16px rgba(0, 102, 204, 0.3);
    }
}

/* ---------------------------------------------------------------
   Responsive
   --------------------------------------------------------------- */
@media (max-width: 768px) {
    .hero-section {
        padding: 2rem 1rem;
    }

    .hero-section h1 {
        font-size: 1.5rem;
    }

    .login-card {
        padding: 2rem 1.5rem;
    }

    .module-header,
    .module-body,
    .info-card {
        padding: 1.25rem;
    }
}

/* ---------------------------------------------------------------
   Accesibilidad: respetar preferencia de movimiento reducido
   --------------------------------------------------------------- */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        transition-duration: 0.01ms !important;
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        scroll-behavior: auto !important;
    }

    .info-card:hover,
    .module-card:hover,
    .btn-primary-modern:hover {
        transform: none;
    }
}

/* ---------------------------------------------------------------
   Impresion: con el footer fixed anterior se repetia en cada hoja
   --------------------------------------------------------------- */
@media print {
    body {
        background: #fff;
        display: block;
    }

    .navbar-custom,
    .btn,
    .video-container {
        display: none !important;
    }

    footer {
        background: none;
        color: #000;
        margin-top: 1rem;
    }

    .module-card,
    .info-card,
    .hero-section {
        box-shadow: none;
        border: 1px solid var(--border-color);
        break-inside: avoid;
    }
}