/* =================== / Variables de Colores y Estilos Base / ==================== */
:root {
    --color-bg-primary: #0A0A0A; /* Fondo principal muy oscuro, casi negro vibrante */
    --color-bg-card: #F9FAFB; /* Gris muy claro (Tailwind bg-gray-50) para fondo de tarjetas/modales */
    --color-text-light: #FAFAFA; /* Texto claro más brillante para fondos oscuros */
    --color-text-dark: #2A2A2A; /* Texto oscuro profundo para fondos claros */
    --color-primary-indigo: #4F46E5; /* Indigo principal vibrante */
    --color-primary-indigo-dark: #4338CA; /* Indigo oscuro para hover/activo */
    --color-title-pastel-yellow: #FDE68A; /* Amarillo pastel para el título */
    --color-close-button-bg: #E74C3C; /* Rojo suave para el fondo del botón de cerrar */
    --color-close-button-hover: #C0392B; /* Rojo más oscuro para el hover del botón de cerrar */
    --color-border-card: #E0E0E0; /* Borde sutil para tarjetas claras */
    --color-border-dark: #333333; /* Borde para elementos oscuros */
    --shadow-card: 0 4px 12px rgba(0, 0, 0, 0.1); /* Sombra más sutil */
    --shadow-hover: 0 8px 20px rgba(0, 0, 0, 0.2); /* Sombra en hover */
    --shadow-modal: 0 20px 40px rgba(0, 0, 0, 0.7); /* Sombra de modal */
    --text-spacing: 0.015em; /* Ligero espaciado de texto para claridad */
    --transition-speed-fast: 0.2s; /* Velocidad rápida para animaciones y transiciones */
    --transition-speed-medium: 0.3s; /* Velocidad media para animaciones */
}

/* =================== / Estilos Generales del Body / ==================== */
body {
    font-family: 'Exo 2', sans-serif;
    background-color: var(--color-bg-primary);
    color: var(--color-text-light);
    overflow-x: hidden;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    line-height: 1.6; /* Interlineado estándar */
}

/* =================== / Contenedor Principal (Portal) / ==================== */
.main-portal-container {
    position: relative;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    /* La ruta de la imagen es relativa al archivo CSS */
    background-image: url('./IPSPUPTYAB-BG.jpg'); 
    background-size: cover;
    background-position: center;
    background-attachment: fixed;
    overflow: hidden;
    padding: 1.5rem 1rem; /* Padding más compacto */
    box-sizing: border-box;
    filter: brightness(0.9); /* Menos opaco, la imagen se ve más clara */
    animation: backgroundFadeIn 1s ease-out forwards; /* Animación más rápida */
}

.main-portal-overlay {
    position: absolute;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.6); /* Menos opaco aún, para que el fondo se aprecie más */
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 1rem;
    box-sizing: border-box;
    z-index: 1;
}

/* =================== / Títulos y Subtítulos / ==================== */
.portal-title {
    font-size: 2.5rem; /* Tamaño más pequeño */
    font-weight: 800;
    margin-bottom: 0.6rem; /* Margen más compacto */
    color: var(--color-title-pastel-yellow);
    letter-spacing: var(--text-spacing);
    line-height: 1.1;
    text-shadow: 1px 1px 8px rgba(0,0,0,0.8); /* Sombra más sutil */
    z-index: 2;
    opacity: 0; /* Animación inicial: opacity 0, se vuelve 1 con fadeInDown */
    transform: translateY(-20px); /* Animación inicial: se mueve desde arriba */
    animation: fadeInDown 0.8s ease-out forwards; /* Animación más rápida */
}
@media (min-width: 640px) { .portal-title { font-size: 3rem; } }
@media (min-width: 768px) { .portal-title { font-size: 4rem; margin-bottom: 0.8rem; } }
@media (min-width: 1024px) { .portal-title { font-size: 4.8rem; margin-bottom: 1rem; } }

.portal-subtitle {
    font-size: 0.9rem;
    font-weight: 400;
    color: var(--color-text-light); /* Color más brillante para mayor visibilidad */
    text-shadow: 1px 1px 5px rgba(0,0,0,0.7); /* Añadir una sombra sutil para contraste */
    margin-bottom: 2.5rem;
    line-height: 1.7;
    max-width: 85%;
    padding: 0 0.5rem;
    z-index: 2;
    letter-spacing: var(--text-spacing);
    opacity: 0; /* Animación inicial: opacity 0, se vuelve 1 con fadeIn */
    animation: fadeIn 1s ease-out forwards;
    animation-delay: 0.3s;
}
@media (min-width: 640px) { .portal-subtitle { font-size: 0.95rem; } }
@media (min-width: 768px) { .portal-subtitle { font-size: 1.05rem; max-width: 55rem; } }
@media (min-width: 1024px) { .portal-subtitle { font-size: 1.15rem; max-width: 65rem; } }

/* =================== / Contenedor de Módulos (Cards) / ==================== */
.module-grid-container {
    display: grid;
    grid-template-columns: repeat(1, minmax(0, 1fr));
    gap: 1.2rem;
    width: 100%;
    max-width: 25rem;
    z-index: 2;
    padding: 0;
    opacity: 0; /* Animación inicial: opacity 0, se vuelve 1 con fadeInUp */
    transform: translateY(20px); /* Animación inicial: se mueve desde abajo */
    animation: fadeInUp 0.8s ease-out forwards;
    animation-delay: 0.6s;
}
@media (min-width: 640px) { .module-grid-container { max-width: 30rem; gap: 1.5rem; } }
@media (min-width: 768px) {
    .module-grid-container {
        grid-template-columns: repeat(2, minmax(0, 1fr));
        gap: 2rem;
        max-width: 60rem;
    }
}
@media (min-width: 1024px) { .module-grid-container { max-width: 70rem; gap: 2.5rem; } }

/* =================== / Estilo de los Módulos (Cards) / ==================== */
.system-module {
    background-color: var(--color-bg-card);
    padding: 1.8rem;
    box-shadow: var(--shadow-card);
    border: 1px solid var(--color-border-card);
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    cursor: pointer;
    transition: all var(--transition-speed-medium) ease-in-out;
    height: 100%;
    /* Sin bordes redondeados */
}
.system-module:hover {
    transform: translateY(-5px);
    box-shadow: var(--shadow-hover);
    border-color: var(--color-primary-indigo);
}

.module-icon {
    color: var(--color-primary-indigo);
    font-size: 3.5rem;
    margin-bottom: 1rem;
    transition: transform var(--transition-speed-fast) ease;
}
@media (min-width: 640px) { .module-icon { font-size: 3.8rem; } }
@media (min-width: 768px) { .module-icon { font-size: 4rem; } }
.system-module:hover .module-icon {
    transform: scale(1.05);
}

.module-title {
    color: var(--color-text-dark);
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 0.7rem;
    line-height: 1.2;
    letter-spacing: var(--text-spacing);
}
@media (min-width: 640px) { .module-title { font-size: 1.6rem; } }
@media (min-width: 768px) { .module-title { font-size: 1.7rem; } }

.module-description {
    color: #555555;
    font-size: 0.9rem;
    margin-bottom: auto;
    line-height: 1.7;
    padding-bottom: 1.2rem;
    flex-grow: 1;
    letter-spacing: var(--text-spacing);
}
@media (min-width: 640px) { .module-description { font-size: 0.95rem; } }
@media (min-width: 768px) { .module-description { font-size: 1rem; } }

.module-button {
    background-color: var(--color-primary-indigo);
    color: white;
    font-weight: 600;
    padding: 0.7rem 1.6rem;
    font-size: 0.9rem;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    transition: all var(--transition-speed-fast) ease;
    display: block;
    width: 100%;
    /* Sin bordes redondeados */
    margin-top: auto;
    border: 1px solid var(--color-primary-indigo);
}
.module-button:hover {
    background-color: var(--color-primary-indigo-dark);
    border-color: var(--color-primary-indigo-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}
.module-button:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.4);
}
@media (min-width: 768px) { .module-button { width: auto; padding: 0.8rem 1.8rem; font-size: 0.95rem;} }

/* =================== / Footer / ==================== */
footer {
    background-color: var(--color-bg-primary);
    color: #888888;
    padding: 1.5rem 1rem;
    text-align: center;
    font-size: 0.8rem;
    box-shadow: inset 0 1px 4px rgba(0, 0, 0, 0.4);
    z-index: 10;
    margin-top: auto;
}

/* =================== / Modales / ==================== */
.modal-overlay {
    position: fixed;
    inset: 0;
    background-color: rgba(0, 0, 0, 0.9);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 9999;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-speed-fast) ease;
}
.modal-overlay.is-active {
    opacity: 1;
    visibility: visible;
}

.modal-content-wrapper {
    background-color: var(--color-bg-card);
    color: var(--color-text-dark);
    padding: 1.8rem;
    box-shadow: var(--shadow-modal);
    position: relative;
    max-width: 90vw;
    max-height: 90vh;
    overflow-y: auto;
    width: 25rem;
    transform: scale(0.8);
    opacity: 0;
    transition: all var(--transition-speed-medium) cubic-bezier(0.2, 0.8, 0.2, 1);
    display: flex;
    flex-direction: column;
    border: 1px solid var(--color-border-card);
}
@media (min-width: 640px) { .modal-content-wrapper { width: 30rem; padding: 2rem;} }
@media (min-width: 768px) { .modal-content-wrapper { width: 38rem; padding: 2.2rem; } }
@media (min-width: 1024px) { .modal-content-wrapper { width: 45rem; padding: 2.5rem; } }
.modal-content-wrapper.is-active {
    transform: scale(1);
    opacity: 1;
}

/* Estilo del botón de cerrar modal (X) */
.modal-close-btn {
    position: absolute;
    top: 0.6rem; /* Ajuste para centrar mejor en el fondo */
    right: 0.6rem; /* Ajuste para centrar mejor en el fondo */
    background-color: var(--color-close-button-bg); /* Fondo rojo para la X */
    color: white; /* Color blanco para la X */
    font-size: 1.5rem; /* Tamaño más grande para el ícono X */
    line-height: 1; /* Para que la X esté bien centrada */
    width: 2.2rem; /* Ancho del botón de cierre */
    height: 2.2rem; /* Alto del botón de cierre */
    display: flex; /* Para centrar el ícono X */
    align-items: center; /* Para centrar el ícono X */
    justify-content: center; /* Para centrar el ícono X */
    border: none;
    cursor: pointer;
    transition: all var(--transition-speed-fast) ease;
    border-radius: 0.125rem; /* rounded-sm */
    box-shadow: 0 2px 5px rgba(0,0,0,0.3); /* Sombra sutil para darle relieve */
}
.modal-close-btn:hover {
    background-color: var(--color-close-button-hover); /* Rojo más oscuro en hover */
    transform: scale(1.05); /* Ligero agrandamiento en hover */
}
.modal-close-btn:focus {
    outline: none;
    box-shadow: 0 0 0 3px rgba(79, 70, 229, 0.4); /* Sombra de foco para accesibilidad */
}

.modal-title-system {
    color: var(--color-primary-indigo);
    font-size: 2rem;
    font-weight: 700;
    margin-bottom: 1rem;
    text-align: center;
    letter-spacing: var(--text-spacing);
}
.modal-description-system {
    color: var(--color-text-dark);
    font-size: 1rem;
    line-height: 1.8;
    margin-bottom: 1.5rem;
    text-align: center;
    letter-spacing: var(--text-spacing);
}
.modal-action-button {
    background-color: var(--color-primary-indigo);
    color: white;
    font-weight: 600;
    padding: 0.8rem 2rem;
    font-size: 0.95rem;
    letter-spacing: 0.05em;
    text-transform: uppercase;
    transition: all var(--transition-speed-fast) ease;
    display: block;
    width: 100%;
    /* Sin bordes redondeados */
    margin-top: 1rem;
    border: 1px solid var(--color-primary-indigo);
}
.modal-action-button:hover {
    background-color: var(--color-primary-indigo-dark);
    border-color: var(--color-primary-indigo-dark);
    transform: translateY(-1px);
    box-shadow: 0 3px 10px rgba(0,0,0,0.2);
}

/* =================== / Carrusel (Solo para SACIPS) / ==================== */
.carousel-container {
    position: relative;
    width: 100%;
    height: 180px;
    overflow: hidden;
    margin-bottom: 1.8rem;
    box-shadow: inset 0 0 10px rgba(0,0,0,0.5);
    background-color: #222222;
    border: 1px solid var(--color-border-dark);
}
@media (min-width: 640px) { .carousel-container { height: 220px; } }
@media (min-width: 768px) { .carousel-container { height: 280px; } }
@media (min-width: 1024px) { .carousel-container { height: 350px; } }

.carousel-slide {
    width: 100%;
    height: 100%;
    position: absolute;
    top: 0;
    left: 0;
    opacity: 0;
    transition: opacity 0.6s ease-in-out;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: contain;
    background-repeat: no-repeat;
    background-position: center;
    filter: brightness(0.95);
}
.carousel-slide.active { opacity: 1; }

.carousel-nav-btn {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.6);
    color: white;
    border: none;
    padding: 0.7rem 1rem;
    cursor: pointer;
    font-size: 1.5rem;
    transition: background-color var(--transition-speed-fast) ease;
    z-index: 10;
}
.carousel-nav-btn:hover { background-color: rgba(0, 0, 0, 0.85); }
.carousel-nav-btn.prev { left: 0; }
.carousel-nav-btn.next { right: 0; }

.carousel-dots {
    position: absolute;
    bottom: 0.6rem;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 0.5rem;
    z-index: 10;
}
.dot {
    width: 10px;
    height: 10px;
    background-color: rgba(255, 255, 255, 0.4);
    cursor: pointer;
    transition: background-color var(--transition-speed-fast) ease;
}
.dot.active {
    background-color: var(--color-primary-indigo);
}

/* =================== / Animaciones CSS Keyframes / ==================== */
@keyframes backgroundFadeIn {
    from { filter: brightness(0.5); }
    to { filter: brightness(0.9); }
}
@keyframes fadeInDown {
    from { opacity: 0; transform: translateY(-30px); }
    to { opacity: 1; transform: translateY(0); }
}
@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
@keyframes fadeInUp {
    from { opacity: 0; transform: translateY(30px); }
    to { opacity: 1; transform: translateY(0); }
}