/* --- RESETEO DE VARIABLES Y BASE --- */
:root { --red: #e50914; --black: #000000; --dark-bg: #141414; --card-bg: #1f1f1f; }
.biblio-premium { background: var(--dark-bg); color: #fff; min-height: 100vh; font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif; }

/* HERO Y HEADER */
.biblio-hero { background: linear-gradient(rgba(0,0,0,0.6), var(--dark-bg)), url('https://images.unsplash.com/photo-1512820790803-83ca734da794?q=80&w=2000'); background-size: cover; padding: 40px 5%; border-bottom: 1px solid #222; }
.biblio-nav-top { display: flex; justify-content: space-between; align-items: center; margin-bottom: 40px; }
.biblio-logo { font-size: 24px; font-weight: 900; color: var(--red); text-transform: uppercase; }
.biblio-menu-btn { background: #222; border: 1px solid #333; color: #fff; padding: 8px 15px; border-radius: 4px; cursor: pointer; font-weight: 600; }
.biblio-user-icon { color: #fff; background: #222; padding: 8px; border-radius: 50%; display: flex; align-items: center; justify-content: center; border: 1px solid #333; }
.biblio-hero-content { text-align: center; }
.hero-title { font-size: 38px; font-weight: 800; color: #fff; margin-bottom: 20px; }
.biblio-search-box { position: relative; max-width: 600px; margin: 0 auto; }
#biblio-search { width: 100%; padding: 15px 25px 15px 50px; border-radius: 4px; border: 1px solid #333; background: rgba(0,0,0,0.8); color: #fff; font-size: 16px; outline: none; }
.search-icon { position: absolute; left: 15px; top: 50%; transform: translateY(-50%); color: #666; font-size: 18px; pointer-events: none; }

/* GRID PRINCIPAL */
.biblio-main { padding: 40px 5%; }
.cat-row { margin-bottom: 40px; }
.row-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 10px; }
.row-header h2 { font-size: 20px; font-weight: 700; color: #e5e5e5; margin: 0; }
.view-all { background: none; border: none; color: #666; cursor: pointer; font-size: 12px; font-weight: bold; text-transform: uppercase; }
.carousel { display: flex; overflow-x: auto; gap: 10px; scrollbar-width: none; padding: 10px 0; }
.carousel::-webkit-scrollbar { display: none; }
.carousel .book-card { flex: 0 0 160px; }
.grid-view { display: grid; grid-template-columns: repeat(auto-fill, minmax(150px, 1fr)); gap: 20px; margin-top: 20px; }
.book-card { cursor: pointer; transition: transform 0.3s; }
.book-card:hover { transform: scale(1.05); z-index: 2; }
.book-img { aspect-ratio: 2/3; background: #222; border-radius: 4px; overflow: hidden; position: relative; }
.book-img img { width: 100%; height: 100%; object-fit: cover; }
.badge-libros { display:none; } 

/* =========================================
   MODAL BLINDADO (ESTILO DARK)
   ========================================= */

/* Fondo Modal */
.biblio-modal { 
    position: fixed; inset: 0; z-index: 99999 !important; 
    display: none; align-items: center; justify-content: center; padding: 20px; 
}
.biblio-modal.active { display: flex !important; }
.biblio-modal-backdrop { 
    position: absolute; inset: 0; 
    background: rgba(0,0,0,0.95) !important; 
    backdrop-filter: blur(5px); 
}

/* Tarjeta Principal */
.biblio-modal-card { 
    position: relative; 
    background: #000000 !important; /* NEGRO ABSOLUTO */
    width: 100%; max-width: 950px; height: 550px;
    border-radius: 8px; 
    overflow: hidden; 
    box-shadow: 0 50px 100px rgba(0,0,0,1) !important; 
    border: 1px solid #333;
    display: flex; 
    font-family: sans-serif !important; 
    text-align: left !important;
}

/* Columna Izquierda (Imagen) */
.modal-left {
    width: 38%; 
    background: #050505 !important;
    display: flex; align-items: center; justify-content: center;
    position: relative;
    border-right: 1px solid #1a1a1a;
}
.modal-cover-container { 
    width: 200px; 
    box-shadow: 0 0 50px rgba(0,0,0,0.8); 
    border-radius: 4px; 
}
.modal-cover-img { 
    width: 100%; display: block; border-radius: 4px; 
    border: 1px solid rgba(255,255,255,0.1);
}

/* Columna Derecha (Contenido) */
.modal-right {
    width: 62%;
    padding: 45px;
    display: flex; flex-direction: column;
    overflow-y: hidden; /* Importante para que el scroll sea interno */
    position: relative;
    background: #000000 !important;
}

/* Header Info */
.modal-header-info { margin-bottom: 30px; flex-shrink: 0; }

#biblio-modal-title { 
    font-family: 'Arial Black', sans-serif !important; 
    font-style: italic !important; 
    font-weight: 900 !important;
    font-size: 34px !important; 
    color: #ffffff !important; 
    text-transform: uppercase; 
    line-height: 1 !important; 
    margin: 0 0 10px 0 !important;
}

.modal-meta-row { display: flex; align-items: center; gap: 10px; margin-top: 10px; }

/* FIX CRÍTICO: El autor se veía azul en tu captura. Esto lo fuerza a ROJO */
#biblio-modal-author, 
#biblio-modal-author a { 
    color: #e50914 !important; 
    font-size: 14px !important;
    font-weight: 800 !important;
    margin: 0 !important; 
    text-transform: uppercase; 
    letter-spacing: 1px;
    text-decoration: none !important;
}

/* Botones */
.modal-actions { 
    display: grid; grid-template-columns: 1fr 1fr; gap: 15px; margin-bottom: 35px; flex-shrink: 0;
}
.btn-netflix, .btn-read { 
    display: flex !important; align-items: center; justify-content: center; gap: 10px;
    padding: 0 !important; height: 50px !important;
    border-radius: 4px !important; 
    font-weight: 800 !important; font-size: 14px !important; 
    text-transform: uppercase; 
    text-decoration: none !important; cursor: pointer; 
    line-height: 50px;
}
.btn-netflix { background: var(--red) !important; color: #fff !important; border: none !important; }
.btn-read { background: transparent !important; border: 2px solid #333 !important; color: #fff !important; }

/* Caja Sinopsis */
.synopsis-box {
    background: #111 !important; 
    border: 1px solid #222 !important;
    padding: 25px;
    border-radius: 6px;
    margin-top: auto;
    display: flex; flex-direction: column; 
    flex: 1; min-height: 0;
}
.synopsis-label { 
    color: #666 !important; 
    font-size: 11px !important; 
    font-weight: 900 !important; 
    letter-spacing: 2px; 
    margin: 0 0 15px 0 !important; 
    font-style: italic; 
    text-transform: uppercase;
    flex-shrink: 0;
}
.desc-scroll-area {
    overflow-y: auto;
    flex: 1;
    padding-right: 5px;
}
/* Scrollbar bonita */
.desc-scroll-area::-webkit-scrollbar { width: 5px; }
.desc-scroll-area::-webkit-scrollbar-thumb { background: #333; border-radius: 4px; }

/* FIX CRÍTICO: El texto se veía oscuro. Esto lo fuerza a CLARO */
#biblio-modal-desc { 
    color: #cccccc !important; 
    font-size: 15px !important; 
    line-height: 1.6 !important; 
    margin: 0 !important; 
    font-weight: 400 !important; 
}

/* Botón Cerrar */
.modal-close { 
    position: absolute; top: 20px; right: 20px; z-index: 100;
    width: 40px; height: 40px; 
    border-radius: 50%; background: #222 !important; 
    border: 1px solid #444 !important;
    color: #fff !important; font-size: 18px; 
    cursor: pointer; display: flex; align-items: center; justify-content: center;
}

/* RESPONSIVE MÓVIL (CORREGIDO PARA FONDO NEGRO) */
@media (max-width: 768px) {
    .biblio-modal { 
        align-items: flex-end; /* Pegado abajo en móvil */
        padding: 0; 
    }
    
    .biblio-modal-card { 
        flex-direction: column; 
        width: 100%; height: 100vh; max-height: 100vh; 
        border-radius: 0; border: none;
        overflow-y: auto;
    }
    .modal-left { 
        width: 100%; height: auto; min-height: 350px;
        padding: 50px 0 30px; 
        background: linear-gradient(to bottom, #111 0%, #000 100%) !important;
        border-right: none; border-bottom: 1px solid #222;
        flex-shrink: 0;
    }
    .modal-cover-container { width: 150px; box-shadow: 0 20px 50px rgba(0,0,0,0.9); }
    .modal-right { 
        width: 100%; padding: 30px 20px 80px; 
        background: #000 !important; 
        flex: 1;
        overflow: visible;
    }
    #biblio-modal-title { font-size: 28px !important; text-align: center; }
    .modal-meta-row { justify-content: center; }
    .modal-actions { grid-template-columns: 1fr; } 
    
    /* Forzar botón cerrar fijo en móvil */
    .modal-close { 
        position: fixed; 
        top: 15px; right: 15px; 
        background: rgba(0,0,0,0.8) !important;
    }
}

/* LECTOR/DRAWER (INTACTOS) */
.reader-container { position: fixed; inset: 0; background: #000; z-index: 25000; display: none; flex-direction: column; }
.reader-container.active { display: flex; }
.reader-frame { flex: 1; width: 100%; border: none; opacity: 1; }
.reader-close { position: absolute; top: 15px; right: 20px; background: #222; color: #fff; border: 1px solid #444; padding: 8px 15px; border-radius: 20px; cursor: pointer; z-index: 26000; }
.prep-overlay { position: fixed; inset: 0; background: #000; z-index: 30000; display: none; align-items: center; justify-content: center; color: #fff; }
.prep-overlay.active { display: flex; }
.prep-content h2 { font-size: 20px; color: #fff; }
.prep-progress-container { width: 200px; height: 3px; background: #333; margin-top: 15px; }
.prep-progress-bar { height: 100%; background: var(--red); width: 0%; }
.biblio-drawer { position: fixed; left: -320px; top: 0; height: 100%; width: 300px; background: #000; z-index: 10001; transition: 0.4s; padding: 30px; overflow-y: auto; border-right: 1px solid #222; }
.biblio-drawer.open { left: 0; }
.drawer-header { display: flex; justify-content: space-between; border-bottom: 1px solid #333; padding-bottom: 15px; margin-bottom: 20px; }
.drawer-item { padding: 12px 0; border-bottom: 1px solid #1a1a1a; color: #ccc; cursor: pointer; display:flex; justify-content:space-between; }
.drawer-overlay { position: fixed; inset: 0; background: rgba(0,0,0,0.8); display: none; z-index: 10000; }
.drawer-overlay.active { display: block; }