/* ========================================
   CUSTOM STYLES
   ======================================== */

/* --- DESKTOP: Centrar las tarjetas --- */
@media (min-width: 769px) {
    .componentes-scroll-container {
        justify-content: center;
    }

    .componente-card h3 {
        font-size: 0.9rem; 
    }
}

/* --- MOBILE: Ajustes de tamaño de tarjeta y letra --- */
@media (max-width: 768px) {
    .componente-card {
        flex-basis: 95%; 
        min-height: 30rem; 
    }

    .componente-card h3 {
        font-size: 1rem; 
    }

    .componente-card .flex-shrink-0 {
        width: 3.5rem; 
        height: 3.5rem; 
    }

    .componente-card .flex-shrink-0 svg {
        width: 2.25rem; 
        height: 2.25rem; 
    }
}

/* ========================================
   DESKTOP SUBMENU PANEL (EL PANEL REAL DE PC)
   ======================================== */
#desktop-submenu-panel {
    position: fixed;
    top: 63px; 
    
    /* Posición FINAL deseada (cuando está abierto) */
    left: 61% !important; 
    
    /* === ANIMACIÓN DE ENTRADA DESDE LA IZQUIERDA === */
    /* Estado inicial (cerrado): Desplazado hacia la izquierda y oculto */
    transform: translateX(-100%) !important; 
    opacity: 0;
    visibility: hidden;
    
    /* Transición suave para el efecto de deslizamiento */
    transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
    /* ============================================== */
    
    /* Dimensiones Fijas */
    width: 1250px !important;  /* Aumentado un poco */
    max-width: 98vw !important; 
    min-width: 300px !important;
    height: 755px !important; 
    max-height: calc(100vh - 80px) !important; 
    
    background-color: #ffffff;
    border: 2px solid #eff3f1; /* Borde grs claro */
    border-radius: 0 0 32px 16px; /* Esquina inferior derecha más redondeada */
    box-shadow: 0 10px 25px rgba(0,0,0,0.15);
    z-index: 1201; 
    overflow-y: auto;
    padding: 1.5rem;
    
    /* Ocultar barra de desplazamiento */
    scrollbar-width: none; /* Firefox */
    -ms-overflow-style: none; /* IE y Edge */
}

/* Ocultar scrollbar en Chrome, Safari y Opera */
#desktop-submenu-panel::-webkit-scrollbar {
    display: none;
}

/* Estado ABIERTO: Se mueve a su posición final (-50% para centrar relativo al left:66%) */
#desktop-submenu-panel.is-open {
    opacity: 1;
    visibility: visible;
    transform: translateX(-50%) !important; 
}

@media (max-width: 1023px) {
    #desktop-submenu-panel {
        display: none;
    }
}

#desktop-submenu-panel .panel-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #14532d; 
    padding-bottom: 0.5rem;
    margin-bottom: 1rem;
    border-bottom: 2px solid #166534; 
    text-align: center;
}

/* Estilos de los botones (Ancho 370px) */
#desktop-submenu-panel .panel-button {
    display: block;
    width: 370px !important; /* Aumentado para aprovechar el espacio */
    max-width: 100%;
    padding: 0.5rem 0.8rem; 
    margin-bottom: 0.4rem;
    text-align: left;
    font-size: 1rem; /* Aumentado para PC */
    line-height: 1.3;
    color: #374151; 
    background-color: #dcfce7; /* Verde claro sutil */
    border: 1px solid #d1fae5;
    border-radius: 0.375rem;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1); /* Sombra sutil */
    transition: all 0.2s;
    cursor: pointer;
    white-space: normal; 
}

#desktop-submenu-panel .panel-button:hover {
    background-color: #166534; 
    color: #ffffff;
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
}

#desktop-submenu-panel .panel-submenu-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: #16a34a; 
    margin-top: 0;
    margin-bottom: 0.5rem;
    padding-bottom: 0.3rem;
    border-bottom: 1px solid #d1d5db;
    text-align: center;
    text-transform: uppercase;
}

/* Configuración de columnas */
.panel-columns {
    display: flex !important; 
    flex-direction: row;
    align-items: flex-start;
    justify-content: center; 
    gap: 1.5rem; 
    width: 100%; 
    height: 100%; 
}

/* Cada columna dentro del panel */
.panel-columns > div {
    display: flex;
    flex-direction: column;
    width: 370px !important; /* Aumentado para aprovechar el espacio */
    flex-shrink: 0;
}

.dropdown-menu-content {
    background-color: white;
}

.menu-item-stack {
    display: block;
    width: 60%;
    padding: 0.8rem 1.5rem;
    font-weight: 500;
    text-align: left;
    font-size: 1rem;
    color: #374151;
    transition: background-color 0.2s, color 0.2s;
}

.menu-item-stack:hover {
    background-color: rgba(59, 130, 246, 0.1);
    color: #1d4ed8;
}

/* AJUSTES MENÚ MÓVIL (Sin cambios que afecten PC) */
@media (min-width: 1024px) {
    .mobile-dropdown .dropdown-menu-content > .menu-item-stack {
        display: block !important;
        width: 100% !important;
    }
}

/* ============================================================
   BLOQUE DE RESCATE: VISIBILIDAD DE SECCIONES
   ============================================================ */

/* MODIFICADO: Se eliminaron los estilos de "tarjeta" (fondo blanco, sombra)
   de las secciones internas para evitar el doble borde, manteniendo solo
   la estructura necesaria. */
#credenciales-section,
#directiva-section,
section[id$="-section"]:not(#homepage-section) {
    display: none;
    background-color: transparent; /* Eliminado el fondo blanco */
    border-radius: 0;             /* Eliminado el borde redondeado */
    padding: 0;                   /* Eliminado padding extra */
    margin: 5rem auto 1rem auto;  /* Ajustado margen superior para respetar el logo */
    max-width: 100%;              /* Ancho completo dentro del contenedor padre */
    box-shadow: none;             /* Eliminada la sombra */
    position: relative;
    z-index: 50;
}

#credenciales-section.active,
#directiva-section.active,
section[id$="-section"].active {
    display: block !important;
    animation: fadeIn 0.5s ease-out;
}

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

#credenciales-section *, 
#directiva-section * {
    color: #1f2937; 
}

#credenciales-section h1, #credenciales-section h2, #credenciales-section h3,
#directiva-section h1, #directiva-section h2, #directiva-section h3 {
    color: inherit; 
}

.credenciales-main-title { color: #EAB308 !important; }
.credenciales-main-subtitle { color: #EAB308 !important; }
.credenciales-section-title { color: #F54C38 !important; }

body:not(.homepage) {
    background-image: url('../images/101.webp') !important; 
    background-size: cover !important;
    background-attachment: fixed !important;
}

/* ========================================
   MODAL AVISO PROFESIONAL
   ======================================== */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 2000;
    backdrop-filter: blur(5px);
    opacity: 0;
    visibility: hidden;
    /* Transición para entrada y salida */
    transition: opacity 0.4s ease, visibility 0s linear 0.4s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
    transition: opacity 0.4s ease;
}

.modal-content {
    background-color: #ffffff;
    padding: 2rem;
    border-radius: 0.75rem;
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
    max-width: 550px;
    width: 90%;
    position: relative;
    text-align: center; /* CENTRAR TODO EL CONTENIDO POR DEFECTO */
    font-size: 1.05rem;
    line-height: 1.6;
    color: #333;
    /* Transición para entrada y salida */
    transform: scale(0.9);
    opacity: 0;
    transition: transform 0.4s ease, opacity 0.4s ease;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
    opacity: 1;
}

.modal-logo {
    width: 70px;
    height: 70px;
    margin: 0 auto 1rem auto;
    display: block;
}

.modal-title {
    font-size: 1.5rem;
    font-weight: 700;
    color: #1f2937;
    margin-bottom: 1.5rem;
    text-align: center;
}

.modal-content p {
    margin-bottom: 1rem;
    text-align: justify;
}

.modal-content p strong {
    text-align: left; /* Para que los strong no se justifiquen */
}

.modal-content strong {
    color: #1d4ed8;
}

.modal-divider {
    border: 0;
    height: 1px;
    background-color: #e5e7eb;
    margin: 1.5rem 0;
}

.modal-close {
    position: absolute;
    top: 0.75rem;
    right: 0.75rem;
    background: transparent;
    border: none;
    font-size: 2rem;
    color: #9ca3af;
    cursor: pointer;
    line-height: 1;
    transition: color 0.2s ease;
}

.modal-close:hover {
    color: #1f2937;
}

.modal-accept-button {
    background-color: #16a34a;
    color: #ffffff;
    border: none;
    border-radius: 0.5rem;
    padding: 0.75rem 1.5rem;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-top: 1.5rem;
    transition: background-color 0.2s ease;
}

.modal-accept-button:hover {
    background-color: #15803d;
}
@media (max-width: 768px) {
    .modal-content {
        width: 97%;
    }
}

/* ============================================================
   DESKTOP: Eliminar barra verde y container al mismo nivel que mobile
   ============================================================ */
@media (min-width: 1024px) {
    body.show-directiva .desktop-navbar,
    body.show-credenciales .desktop-navbar {
        display: none !important;
    }

    body.show-directiva #contenido.card-container,
    body.show-credenciales #contenido.card-container {
        margin-top: 4.0rem !important;
        border-radius: 1.8rem !important;
    }

    /* Título más arriba en PC */
    body.show-directiva #main-section,
    body.show-credenciales #credenciales-section {
        margin-top: 3.5rem !important;
    }

    body.show-directiva #main-section > header {
        padding-top: 0.5rem !important;
    }

    body.show-credenciales .credenciales-title-container {
        margin-top: 0.5rem !important;
    }
}

/* ============================================================
   MOBILE: Ajustes Directivas y Credenciales
   ============================================================ */
@media (max-width: 767px) {
    /* Container pegado justo debajo del banner, con bordes redondeados */
    #contenido.card-container {
        margin-top: 4.8rem !important;
        padding-top: 0.75rem !important;
        border-radius: 1.8rem !important;
    }

    /* Bajar un poco el título en Directivas y Credenciales */
    #main-section,
    #credenciales-section {
        margin-top: 5.0rem !important;
    }

    /* Subir título en Directivas */
    #main-section > header {
        padding-top: 0.5rem !important;
    }

    /* Subir título en Credenciales */
    .credenciales-title-container {
        margin-top: 0.5rem !important;
    }

    /* Chevron: esquina superior derecha, z-index por encima de las secciones (z-index:50) */
    #credenciales-arrow-back-btn {
        top: 0.7rem !important;
        right: 0.5rem !important;
        margin-top: 0 !important;
        z-index: 60 !important;
    }
}

/* Chevron desktop: neutralizar space-y-6 */
@media (min-width: 768px) {
    #credenciales-arrow-back-btn {
        top: 1.1rem !important;
        margin-top: 0 !important;
        z-index: 60 !important;
    }
}
