/* css/biblioteca.css */
/* Arquitectura AAA - Clean UI, Minimalismo y Contenido como Rey */

.biblioteca-layout {
    position: absolute; inset: 0; display: flex;
    background: var(--bg-workspace); z-index: 10;
    opacity: 0; pointer-events: none; transition: opacity 0.3s ease;
}
.biblioteca-layout.active { opacity: 1; pointer-events: auto; }

/* ==========================================
   SIDEBAR INVISIBLE (Elegancia Pura)
   ========================================== */
.biblioteca-sidebar {
    width: 240px; padding: 40px 20px;
    background: transparent; border-right: 1px solid var(--glass-border);
    display: flex; flex-direction: column; gap: 4px; z-index: 5;
}

.biblio-tab {
    display: flex; align-items: center; gap: 12px;
    background: transparent; border: none; color: var(--text-dim);
    padding: 10px 15px; border-radius: 8px; cursor: pointer;
    font-size: 0.95rem; font-weight: 600; text-align: left; transition: 0.2s ease;
}
.biblio-tab svg { width: 18px; height: 18px; opacity: 0.7; transition: 0.2s; }
.biblio-tab:hover { background: rgba(128,128,128,0.08); color: var(--text-pure); }
.biblio-tab.active { background: var(--text-pure); color: var(--bg-deep); font-weight: 700; }
.biblio-tab.active svg { opacity: 1; color: var(--bg-deep); }
[data-theme="batman"] .biblio-tab.active { background: var(--accent-electric); color: #000; }
[data-theme="hellokitty"] .biblio-tab.active { background: var(--text-pure); color: #fff; }

/* ==========================================
   ÁREA DE CONTENIDO Y GRID DE LIBROS
   ========================================== */
.biblioteca-main-area { flex-grow: 1; padding: 40px 50px; overflow-y: auto; }

.biblio-view { display: none; animation: fadeInLib 0.4s ease; flex-direction: column; height: 100%; }
.biblio-view.active { display: flex; }
@keyframes fadeInLib { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); } }

.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 30px 20px; padding-bottom: 40px;
}

/* LA TARJETA DEL LIBRO (Clean UI) */
.book-card-pro {
    position: relative; display: flex; flex-direction: column; gap: 10px;
    transition: transform 0.3s ease;
}
.book-card-pro:hover { transform: translateY(-4px); }

.book-cover-pro {
    width: 100%; aspect-ratio: 2/3;
    border-radius: 6px; background-size: cover; background-position: center;
    background-color: rgba(128,128,128,0.1);
    box-shadow: 0 4px 15px rgba(0,0,0,0.15);
    position: relative; cursor: pointer; overflow: hidden;
    border: 1px solid rgba(255,255,255,0.05);
}
[data-theme="batman"] .book-cover-pro { box-shadow: 0 8px 20px rgba(0,0,0,0.4); }

/* Overlay Play Icon on Hover */
.book-cover-overlay {
    position: absolute; inset: 0; background: rgba(0,0,0,0.4); backdrop-filter: blur(2px);
    display: flex; justify-content: center; align-items: center;
    opacity: 0; transition: opacity 0.2s ease;
}
.book-cover-pro:hover .book-cover-overlay { opacity: 1; }
.book-cover-overlay svg { width: 40px; height: 40px; fill: white; filter: drop-shadow(0 2px 5px rgba(0,0,0,0.5)); }

/* Metadata del Libro */
.book-meta-pro { display: flex; flex-direction: column; padding: 0 4px; position: relative; }
.book-title-pro { margin: 0; font-size: 0.95rem; font-weight: 700; color: var(--text-pure); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; line-height: 1.2; }
.book-author-pro { margin: 2px 0 0 0; font-size: 0.8rem; color: var(--text-dim); font-weight: 500; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Botón de Opciones (Tres puntos) */
.book-options-btn {
    position: absolute; top: 0; right: 0;
    background: transparent; border: none; color: var(--text-dim);
    font-size: 1.2rem; line-height: 1; padding: 0 5px; cursor: pointer; transition: color 0.2s;
}
.book-options-btn:hover { color: var(--text-pure); }

/* Formato pequeño (PDF/EPUB) */
.format-tag-pro {
    position: absolute; top: 8px; left: 8px;
    background: rgba(0,0,0,0.6); backdrop-filter: blur(4px);
    color: white; font-size: 0.6rem; font-weight: 800; padding: 3px 6px; border-radius: 4px;
}

/* ==========================================
   MENÚ CONTEXTUAL ELEGANTE
   ========================================== */
.context-menu-pro {
    position: absolute; bottom: 100%; right: 0; margin-bottom: 5px;
    background: var(--bg-secondary); border: 1px solid var(--glass-border);
    border-radius: 8px; box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    min-width: 180px; padding: 5px; z-index: 100;
    opacity: 0; pointer-events: none; transform: translateY(5px); transition: all 0.2s;
}
[data-theme="batman"] .context-menu-pro { background: #111; box-shadow: 0 10px 25px rgba(0,0,0,0.6); }
[data-theme="hellokitty"] .context-menu-pro { background: #fff; box-shadow: 0 10px 25px rgba(219,39,119,0.1); }
.context-menu-pro.show { opacity: 1; pointer-events: auto; transform: translateY(0); }

.menu-item-pro {
    display: flex; align-items: center; gap: 10px; width: 100%;
    background: transparent; border: none; color: var(--text-pure);
    padding: 8px 12px; font-size: 0.85rem; font-weight: 500; font-family: 'Outfit', sans-serif;
    text-align: left; border-radius: 5px; cursor: pointer; transition: 0.2s;
}
.menu-item-pro svg { width: 16px; height: 16px; fill: currentColor; opacity: 0.7; }
.menu-item-pro:hover { background: rgba(128,128,128,0.1); color: var(--accent-electric); }
.menu-item-pro.danger:hover { background: rgba(239,68,68,0.1); color: #ef4444; }

/* ==========================================
   LECTORES (HUD Minimalista)
   ========================================== */
.reader-overlay-pro {
    position: fixed; inset: 0; background: var(--bg-deep);
    z-index: 10000; display: flex; flex-direction: column;
}

.reader-hud-bar {
    position: absolute; top: 0; left: 0; right: 0; height: 60px;
    background: linear-gradient(to bottom, rgba(0,0,0,0.5), transparent);
    display: flex; justify-content: space-between; align-items: center; padding: 0 30px;
    opacity: 0; transition: opacity 0.3s; z-index: 10010;
}
.reader-overlay-pro:hover .reader-hud-bar { opacity: 1; }

.reader-title-pro { color: white; font-size: 1rem; font-weight: 600; text-shadow: 0 1px 3px rgba(0,0,0,0.8); margin: 0; }

.hud-controls { display: flex; align-items: center; gap: 15px; }
.hud-btn {
    background: rgba(255,255,255,0.1); backdrop-filter: blur(4px);
    border: none; color: white; width: 36px; height: 36px; border-radius: 50%;
    display: flex; justify-content: center; align-items: center; cursor: pointer; transition: 0.2s;
}
.hud-btn:hover { background: rgba(255,255,255,0.3); transform: scale(1.1); }
.hud-close { background: rgba(239,68,68,0.8); }
.hud-close:hover { background: #ef4444; }

.reader-canvas-wrapper { flex-grow: 1; height: 100vh; display: flex; justify-content: center; align-items: center; padding: 0; }
#pdfRenderCanvas { max-height: 100vh; object-fit: contain; background: white; transition: filter 0.3s; }
#pdfRenderCanvas.dark-mode-pdf { filter: invert(0.9) hue-rotate(180deg); }
#epubViewer { width: 100%; height: 100%; max-width: 800px; background: transparent; padding: 40px 0; }