/* --- CONFIGURACIÓN GENERAL --- */
.library-section {
    padding: 60px 20px;
}

/* ==========================================================================
   CONFIGURACIÓN GENERAL CON FONDO FIJO (REEMPLAZAR EN estilos-biblioteca.css)
   ========================================================================== */
body {
    font-family: 'Montserrat', sans-serif;
    /* Capa oscura superpuesta + Imagen de fondo del directorio o internet */
    background: linear-gradient(rgba(24, 26, 38, 0.88), rgba(24, 26, 38, 0.88)), 
                url('fondo2.jpg') no-repeat center center;
    
    /* PROPIEDADES CLAVE PARA DEJAR EL FONDO FIJO E INMÓVIL */
    background-attachment: fixed !important; 
    background-size: cover !important;
    
    color: #ffffff;
    min-height: 100vh;
}


/* --- BARRA DE NAVEGACIÓN --- */
.main-header {
    background-color: #1a1d24; 
    position: sticky;
    top: 0;
    width: 100%;
    z-index: 99999; 
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
    font-family: 'Montserrat', sans-serif;
}

.nav-container {
    max-width: 1100px;
    margin: 0 auto;
    padding: 15px 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.nav-logo a {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    color: #ffffff;
    text-decoration: none;
    font-weight: 700;
}

.nav-menu ul {
    display: flex;
    list-style: none;
    gap: 5px;
    padding: 0;
    margin: 0;
    align-items: center;
}

/* Unificamos el aspecto de enlaces y botones principales del menú */
.nav-menu ul li a, 
.nav-menu ul li .submenu-trigger {
    color: #e2e8f0;
    text-decoration: none;
    font-family: 'Montserrat', sans-serif;
    font-size: 14px;
    font-weight: 500;
    padding: 10px 16px;
    border-radius: 4px;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 6px;
    transition: all 0.2s ease;
}

.nav-menu ul li a:hover, 
.nav-menu ul li .submenu-trigger:hover,
.has-submenu.pop-active .submenu-trigger {
    color: #ffffff;
    background-color: rgba(255, 255, 255, 0.08);
}

.arrow-indicator {
    font-size: 9px;
    transition: transform 0.3s ease;
}

.has-submenu {
    position: relative;
}

/* --- FORMATO SUBMENÚ: COMPUTADORA (LISTA VERTICAL FLOTANTE) --- */
.nav-menu .submenu {
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #242933;
    list-style: none;
    min-width: 210px;
    border-radius: 4px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.3);
    padding: 8px 0;
    
    /* Forzado en lista vertical estricta */
    display: flex !important;
    flex-direction: column !important; 
    
    opacity: 0;
    visibility: hidden;
    transform: translateY(8px);
    transition: all 0.25s ease-in-out;
    z-index: 100000;
}

/* Muestra el submenú de forma elástica al inyectar la clase activa en PC */
.nav-menu .submenu.submenu-active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.nav-menu .submenu li {
    width: 100%;
}

.nav-menu .submenu li a {
    display: block !important;
    width: 100%;
    padding: 11px 20px !important;
    font-size: 13px !important;
    color: #cbd5e1 !important;
    text-align: left !important;
    border-radius: 0;
}

.nav-menu .submenu li a:hover {
    background-color: rgba(92, 98, 214, 0.5) !important;
    color: #ffffff !important;
}

/* Rotación de flechita activa */
.has-submenu.pop-active .arrow-indicator {
    transform: rotate(180deg);
}

/* --- BOTÓN HAMBURGUESA MÓVIL --- */
.menu-toggle-btn {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 18px;
    background: transparent;
    border: none;
    cursor: pointer;
}

.menu-toggle-btn .menu-bar {
    width: 100%;
    height: 3px;
    background-color: #ffffff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

/* --- ADAPTABILIDAD CELULARES (MEDIA QUERY) --- */
@media (max-width: 768px) {
    .menu-toggle-btn {
        display: flex;
    }

    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #1a1d24;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.4s ease-in-out, opacity 0.3s ease;
        border-bottom: 2px solid #5c62d6;
    }

    .nav-menu.menu-abierto {
        max-height: 85vh !important;
        overflow-y: auto;
        opacity: 1;
        visibility: visible;
    }

    .nav-menu ul {
        flex-direction: column !important;
        padding: 15px 0;
        gap: 0;
    }

    .nav-menu ul li {
        width: 100%;
    }

    .nav-menu ul li a, 
    .nav-menu ul li .submenu-trigger {
        width: 100%;
        justify-content: center;
        padding: 14px 0;
        font-size: 16px;
        border-radius: 0;
    }

    /* --- COMPORTAMIENTO ACORDEÓN EN CELULAR --- */
    .nav-menu .submenu {
        position: static;
        background-color: #14161a;
        box-shadow: none;
        padding: 0;
        width: 100%;
        max-height: 0; /* Cerrado por defecto en móvil */
        transition: max-height 0.3s ease-out, opacity 0.2s ease;
    }

    .nav-menu .submenu.submenu-active {
        max-height: 220px; /* Despliegue elástico */
    }

    .nav-menu .submenu li a {
        padding: 12px 0 !important;
        font-size: 14px !important;
        text-align: center !important;
    }
    
    .menu-toggle-btn.btn-transformado .menu-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .menu-toggle-btn.btn-transformado .menu-bar:nth-child(2) { opacity: 0; }
    .menu-toggle-btn.btn-transformado .menu-bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }
}


/* --- INTERFAZ LISTADO DE LA BIBLIOTECA --- */
.library-container {
    max-width: 1000px;
    margin: 0 auto;
    width: 100%;
}

.library-header {
    text-align: center;
    margin-bottom: 50px;
}

.library-title {
    font-family: 'Playfair Display', serif;
    font-size: 52px;
    font-weight: 400;
    margin-bottom: 10px;
    letter-spacing: -0.5px;
    color: #cbd5e1;
}

.library-subtitle {
    font-size: 18px;
    color: #cbd5e1;
    font-weight: 400;
    letter-spacing: 0.5px;
}

.book-section {
    margin-bottom: 50px;
}

.book-title {
    font-family: 'Playfair Display', serif;
    font-size: 24px;
    font-weight: 400;
    padding-bottom: 15px;
    margin-bottom: 25px;
    border-bottom: 1px solid rgba(255, 255, 255, 0.4);
    letter-spacing: 0.5px;
}

.parasha-row {
    display: grid;
    grid-template-columns: 1.3fr 1fr;
    gap: 25px;
    margin-bottom: 18px;
    text-decoration: none;
    color: #ffffff;
}

.box-name, .box-verses {
    background-color: rgba(255, 255, 255, 0.04);
    border: 2px solid rgba(255, 255, 255, 0.6);
    border-radius: 12px;
    padding: 16px 25px;
    font-size: 18px;
    font-weight: 500;
    display: flex;
    align-items: center;
    transition: all 0.25s ease-in-out;
}

.box-name::before {
    content: '📜';
    margin-right: 15px;
    font-size: 18px;
    opacity: 0.8;
}

/* Efecto iluminado en morado al pasar el cursor (Fidelidad Canva) */
.parasha-row:hover .box-name {
    border-color: #8b5cf6; 
    background-color: rgba(139, 92, 246, 0.08);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

.parasha-row:hover .box-verses {
    border-color: #8b5cf6; 
    background-color: rgba(255, 255, 255, 0.08);
    box-shadow: 0 0 15px rgba(139, 92, 246, 0.3);
}

/* --- ADAPTABILIDAD EN CELULARES (MEDIA QUERY) --- */
@media (max-width: 768px) {
    .menu-toggle-btn { display: flex; }
    .nav-menu {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background-color: #1a1d24;
        max-height: 0;
        overflow: hidden;
        opacity: 0;
        visibility: hidden;
        transition: max-height 0.4s ease-in-out, opacity 0.3s ease;
        border-bottom: 2px solid #5c62d6;
    }
    .nav-menu.menu-abierto {
        max-height: 85vh !important;
        overflow-y: auto;
        opacity: 1;
        visibility: visible;
    }
    .nav-menu ul { flex-direction: column !important; padding: 15px 0; gap: 0; }
    .nav-menu ul li { width: 100%; }
    .nav-menu ul li a, .nav-menu ul li .submenu-trigger {
        width: 100%; justify-content: center; padding: 14px 0; font-size: 16px; border-radius: 0;
    }
    .nav-menu .submenu {
        position: static; background-color: #14161a; box-shadow: none; padding: 0; width: 100%; max-height: 0;
        transition: max-height 0.3s ease-out, opacity 0.2s ease;
    }
    .nav-menu .submenu.submenu-active { max-height: 220px; }
    .nav-menu .submenu li a { padding: 12px 0 !important; font-size: 14px !important; text-align: center !important; }
    
    .menu-toggle-btn.btn-transformado .menu-bar:nth-child(1) { transform: translateY(7px) rotate(45deg); }
    .menu-toggle-btn.btn-transformado .menu-bar:nth-child(2) { opacity: 0; }
    .menu-toggle-btn.btn-transformado .menu-bar:nth-child(3) { transform: translateY(-8px) rotate(-45deg); }

    /* Ajustes lista biblioteca en móvil */
    .library-title { font-size: 36px; }
    .library-subtitle { font-size: 15px; }
    .parasha-row { grid-template-columns: 1fr; gap: 10px; margin-bottom: 25px; }
    .box-name, .box-verses { padding: 14px 20px; font-size: 16px; }
}
