/* ========================================================
   BIBLIOTECA VIRTUAL UNIVERSAL - ESTILOS PRINCIPALES
   ======================================================== */

:root {
    --gold: #b8975a;
    --gold-light: #dfc085;
    --gold-dark: #8a6c27;
    --gold-bg: rgba(184, 151, 90, 0.12);
    --gold-border: rgba(184, 151, 90, 0.3);
    --card-bg: rgba(22, 20, 18, 0.7);
    --card-border: rgba(255, 255, 255, 0.08);
    --card-hover-border: rgba(184, 151, 90, 0.45);
    --font-heading: 'Outfit', 'Inter', sans-serif;
    --font-serif: 'Playfair Display', Georgia, serif;
}

/* Abstract Subtle Glows */
.bg-glow-platform {
    position: fixed;
    top: 10%;
    left: 45%;
    transform: translate(-50%, -50%);
    width: 800px;
    height: 800px;
    background: radial-gradient(circle, rgba(184, 151, 90, 0.07) 0%, rgba(0, 0, 0, 0) 70%);
    z-index: 0;
    pointer-events: none;
}

/* Nav Bar Search Box */
.nav-search-wrapper {
    flex: 1;
    max-width: 420px;
    margin: 0 1rem;
    position: relative;
}

.nav-search-input {
    width: 100%;
    background: rgba(255, 255, 255, 0.06);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 50px;
    padding: 0.5rem 1rem 0.5rem 2.4rem;
    color: #fff;
    font-size: 0.88rem;
    font-family: inherit;
    outline: none;
    transition: all 0.25s ease;
}

.nav-search-input:focus {
    background: rgba(0, 0, 0, 0.8);
    border-color: var(--gold);
    box-shadow: 0 0 15px rgba(184, 151, 90, 0.25);
}

.nav-search-icon {
    position: absolute;
    left: 0.8rem;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gold);
    width: 16px;
    height: 16px;
    pointer-events: none;
}

/* Sidebar Styles */
.sidebar-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0.65rem 0.9rem;
    margin-bottom: 0.25rem;
    color: var(--muted, #aaa);
    text-decoration: none;
    border-radius: 8px;
    font-size: 0.88rem;
    transition: all 0.2s ease;
    cursor: pointer;
}

.sidebar-link:hover {
    background: rgba(184, 151, 90, 0.1);
    color: #fff;
    transform: translateX(3px);
}

.sidebar-link.active {
    background: linear-gradient(90deg, rgba(184, 151, 90, 0.25), rgba(184, 151, 90, 0.05));
    border-left: 3px solid var(--gold);
    color: #fff;
    font-weight: 600;
}

.sidebar-link i {
    width: 16px;
    height: 16px;
    margin-right: 0.6rem;
    color: var(--gold);
    flex-shrink: 0;
}

.cat-nav-text {
    flex: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.cat-nav-badge {
    font-size: 0.72rem;
    background: rgba(255, 255, 255, 0.08);
    color: var(--muted, #888);
    padding: 0.15rem 0.45rem;
    border-radius: 12px;
    font-weight: 500;
    margin-left: 0.5rem;
}

.sidebar-link.active .cat-nav-badge {
    background: var(--gold);
    color: #000;
    font-weight: 700;
}

/* Catálogo Header Banner */
.catalogo-header-bar {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    flex-wrap: wrap;
    gap: 1.2rem;
    margin-bottom: 2rem;
    padding-bottom: 1.2rem;
    border-bottom: 1px solid var(--card-border);
}

.catalogo-header-title {
    font-family: var(--font-heading);
    font-size: 2rem;
    font-weight: 800;
    color: var(--ink, #fff);
    margin: 0;
    line-height: 1.2;
}

.catalogo-header-count {
    display: inline-block;
    font-size: 0.85rem;
    color: var(--gold);
    background: var(--gold-bg);
    border: 1px solid var(--gold-border);
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    margin-top: 0.4rem;
    font-weight: 600;
}

.catalogo-filters-bar {
    display: flex;
    align-items: center;
    gap: 0.8rem;
    flex-wrap: wrap;
}

.custom-select-catalog {
    background: rgba(0, 0, 0, 0.5);
    border: 1px solid var(--card-border);
    color: #fff;
    padding: 0.5rem 0.9rem;
    border-radius: 8px;
    font-size: 0.85rem;
    outline: none;
    cursor: pointer;
    font-family: inherit;
    transition: border-color 0.2s;
}

.custom-select-catalog:focus {
    border-color: var(--gold);
}

/* Grilla de Tarjetas de Libros */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.book-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 12px;
    padding: 0;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    position: relative;
    transition: all 0.3s cubic-bezier(0.16, 1, 0.3, 1);
    backdrop-filter: blur(12px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.book-cover-wrapper {
    width: 100%;
    aspect-ratio: 2/3;
    background: #111;
    overflow: hidden;
    position: relative;
}

.book-cover-img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.4s ease;
}

.book-card:hover .book-cover-img {
    transform: scale(1.05);
}

.book-card-content {
    padding: 1rem;
    display: flex;
    flex-direction: column;
    flex: 1;
}

.book-card::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 4px;
    height: 100%;
    border-radius: 16px 0 0 16px;
    background: transparent;
    transition: background 0.3s ease;
}

.book-card:hover {
    transform: translateY(-5px);
    border-color: var(--card-hover-border);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.5), 0 0 20px rgba(184, 151, 90, 0.12);
}

.book-card:hover::before {
    background: var(--gold);
}

.book-card-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    gap: 0.5rem;
    margin-bottom: 1rem;
}

.book-cat-tag {
    display: inline-flex;
    align-items: center;
    gap: 0.35rem;
    font-size: 0.72rem;
    font-weight: 700;
    color: var(--gold);
    background: var(--gold-bg);
    border: 1px solid var(--gold-border);
    padding: 0.2rem 0.55rem;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    max-width: 80%;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-fav-btn {
    background: transparent;
    border: none;
    color: var(--muted, #666);
    cursor: pointer;
    padding: 0.2rem;
    transition: transform 0.2s, color 0.2s;
    display: flex;
    align-items: center;
    justify-content: center;
}

.book-fav-btn:hover {
    transform: scale(1.25);
    color: #f59e0b;
}

.book-fav-btn.active {
    color: #f59e0b;
}

.book-card-body {
    cursor: pointer;
    flex: 1;
    margin-bottom: 1.2rem;
}

.book-card-title {
    font-family: var(--font-serif);
    font-size: 1.18rem;
    font-weight: 600;
    color: var(--ink, #fff);
    line-height: 1.35;
    margin-bottom: 0.45rem;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.book-card-author {
    font-size: 0.85rem;
    color: var(--muted, #999);
    font-weight: 500;
}

.book-card-actions {
    display: flex;
    gap: 0.6rem;
    margin-top: auto;
}

.btn-read-book {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    background: linear-gradient(135deg, var(--gold), var(--gold-dark));
    color: #000;
    font-weight: 700;
    font-size: 0.82rem;
    padding: 0.55rem 0.8rem;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-read-book:hover {
    background: linear-gradient(135deg, var(--gold-light), var(--gold));
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(184, 151, 90, 0.35);
}

.btn-open-pdf {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--ink, #fff);
    font-size: 0.82rem;
    padding: 0.55rem 0.8rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-open-pdf:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(184, 151, 90, 0.1);
}

/* Paginación */
.pagination-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.4rem;
    margin: 2rem 0;
    flex-wrap: wrap;
}

.btn-page, .btn-page-num {
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--ink, #fff);
    font-size: 0.85rem;
    padding: 0.5rem 0.85rem;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.2s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.3rem;
}

.btn-page:hover:not(:disabled), .btn-page-num:hover {
    border-color: var(--gold);
    color: var(--gold);
    background: rgba(184, 151, 90, 0.1);
}

.btn-page-num.active {
    background: var(--gold);
    border-color: var(--gold);
    color: #000;
    font-weight: 700;
}

.btn-page:disabled {
    opacity: 0.4;
    cursor: not-allowed;
}

.page-dots {
    color: var(--muted, #666);
    padding: 0 0.4rem;
}

/* Empty State */
.empty-state-catalogo {
    grid-column: 1 / -1;
    text-align: center;
    padding: 4rem 1rem;
    background: var(--card-bg);
    border: 1px dashed var(--card-border);
    border-radius: 16px;
    color: var(--muted, #aaa);
}

.empty-state-catalogo h3 {
    color: #fff;
    margin-bottom: 0.5rem;
    font-size: 1.3rem;
}

/* ========================================================
   VISTA LECTOR INTERACTIVO DE LIBRO
   ======================================================== */
.lector-container {
    display: none;
}

.lector-container.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

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

.lector-top-header {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.5rem 1.8rem;
    margin-bottom: 1.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: wrap;
    gap: 1rem;
    backdrop-filter: blur(12px);
}

.lector-btn-volver {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid var(--card-border);
    color: var(--gold);
    padding: 0.5rem 1rem;
    border-radius: 50px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

.lector-btn-volver:hover {
    background: var(--gold-bg);
    border-color: var(--gold);
    transform: translateX(-2px);
}

.lector-book-info {
    flex: 1;
    min-width: 250px;
}

.lector-book-info h1 {
    font-family: var(--font-serif);
    font-size: 1.8rem;
    font-weight: 700;
    color: var(--ink, #fff);
    margin: 0.3rem 0;
    line-height: 1.25;
}

.lector-book-info p {
    color: var(--gold);
    font-size: 0.95rem;
    margin: 0;
}

.lector-pdf-frame-wrapper {
    background: #000;
    border: 1px solid var(--card-border);
    border-radius: 16px;
    overflow: hidden;
    height: 780px;
    position: relative;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.6);
    margin-bottom: 2rem;
}

.lector-pdf-iframe {
    width: 100%;
    height: 100%;
    border: none;
    background: #1e1e1e;
}

/* Panel de Notas / Tu Espejo */
.lector-companion-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 1.5rem;
    margin-bottom: 3rem;
}

.lector-companion-card {
    background: var(--card-bg);
    border: 1px solid var(--card-border);
    border-radius: 16px;
    padding: 1.6rem;
    backdrop-filter: blur(12px);
}

.lector-companion-card h3 {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    margin-bottom: 0.5rem;
    color: #fff;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.lector-companion-card p.desc {
    font-size: 0.85rem;
    color: var(--muted, #888);
    margin-bottom: 1rem;
}

.lector-textarea-notas {
    width: 100%;
    min-height: 160px;
    background: rgba(0, 0, 0, 0.4);
    border: 1px solid var(--card-border);
    border-radius: 10px;
    padding: 1rem;
    color: #fff;
    font-family: var(--font-serif);
    font-size: 1rem;
    line-height: 1.6;
    outline: none;
    resize: vertical;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.lector-textarea-notas:focus {
    border-color: var(--gold);
}

.ai-prompt-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    background: rgba(184, 151, 90, 0.08);
    border: 1px solid var(--gold-border);
    color: #e5d8c3;
    padding: 0.45rem 0.8rem;
    border-radius: 20px;
    font-size: 0.82rem;
    cursor: pointer;
    margin: 0.3rem 0.3rem 0.3rem 0;
    transition: all 0.2s;
}

.ai-prompt-chip:hover {
    background: var(--gold);
    color: #000;
    font-weight: 600;
}@media (max-width: 900px) {
    .lector-companion-grid {
        grid-template-columns: 1fr;
    }
    .lector-pdf-frame-wrapper {
        height: 520px;
    }
    .catalogo-header-bar {
        flex-direction: column;
        align-items: flex-start;
    }
    .nav-search-wrapper {
        display: none;
    }
}

@media (max-width: 600px) {
    .lector-top-header {
        flex-direction: column;
        align-items: flex-start;
        padding: 1rem;
        gap: 1rem;
        border-radius: 12px;
    }
    
    .lector-btn-volver {
        padding: 0.4rem 0.8rem;
    }
    
    .lector-book-info h1 {
        font-size: 1.25rem;
        margin-top: 0.2rem;
    }
    
    .lector-actions-wrapper {
        position: fixed;
        bottom: 0;
        left: 0;
        width: 100%;
        background: rgba(22, 20, 18, 0.95);
        backdrop-filter: blur(15px);
        border-top: 1px solid var(--card-border);
        display: flex;
        justify-content: space-around;
        padding: 0.8rem 0.5rem;
        z-index: 1000;
        box-shadow: 0 -5px 20px rgba(0,0,0,0.5);
    }
    
    .icon-btn, .btn-open-pdf, #btn-notas-comunidad {
        flex-direction: column;
        gap: 0.3rem;
        font-size: 0.7rem;
        background: transparent !important;
        border: none !important;
        padding: 0;
        color: var(--muted);
    }
    
    .icon-btn i, .btn-open-pdf i, #btn-notas-comunidad i {
        width: 20px;
        height: 20px;
        margin: 0;
    }
    
    .hide-mobile {
        display: block !important;
    }

    .lector-pdf-frame-wrapper {
        height: 75vh;
        border-radius: 8px;
        margin-bottom: 5rem; /* space for bottom bar */
    }
}

/* Nuevos Estilos Profesionales para Tarjeta de Libro */
.book-card-year {
    font-size: 0.7rem;
    color: var(--gold);
    margin-bottom: 0.4rem;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 0.05em;
    display: flex;
    align-items: center;
    gap: 0.3rem;
    opacity: 0.8;
}

.book-card-author-wrapper {
    margin-top: 0.8rem;
    padding-top: 0.6rem;
    border-top: 1px dashed rgba(255,255,255,0.1);
}

.author-label {
    display: block;
    font-size: 0.65rem;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom: 0.2rem;
}

.book-card-title {
    font-size: 1.05rem;
    font-weight: 700;
    line-height: 1.3;
    margin-bottom: 0.2rem;
}

@media (max-width: 600px) {
    .books-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 0.8rem;
    }
    
    .book-card-content {
        padding: 0.8rem;
    }
    
    .book-card-title {
        font-size: 0.9rem;
    }
    
    .btn-read-book, .btn-open-pdf {
        padding: 0.4rem 0.5rem;
        font-size: 0.75rem;
    }
    
    .book-card-actions {
        flex-direction: column;
        gap: 0.4rem;
    }
}


/* Hero Slider */
.hero-slider {
    position: relative;
    border-radius: 16px;
    margin-bottom: 2rem;
    overflow: hidden;
    height: 320px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.hero-slide {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
    padding: 3rem 4rem;
    color: #333;
    opacity: 0;
    transition: opacity 0.8s ease-in-out, transform 0.8s ease-in-out;
    transform: scale(1.01);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1;
    text-align: center;
}

.hero-slide.active {
    opacity: 1;
    transform: scale(1);
    z-index: 2;
}

/* Themes for slides */
.slide-theme-gold {
    background: #fdfbf7; /* Beige muy suave */
}
.slide-theme-blue {
    background: #f4f8fb; /* Azul muy suave */
}
.slide-theme-purple {
    background: #f9f6fc; /* Lila muy suave */
}
.slide-theme-green {
    background: #f5faf8; /* Verde muy suave */
}

.hero-content {
    position: relative;
    z-index: 3;
    max-width: 700px;
}

.hero-content h2 {
    font-size: 3.5rem;
    font-weight: 500;
    margin-bottom: 1rem;
    font-family: var(--font-serif);
    line-height: 1.1;
    color: #4a3c31; /* Marrón oscuro editorial */
    letter-spacing: -0.5px;
}

.hero-content p {
    font-size: 1.1rem;
    opacity: 0.8;
    margin-bottom: 2rem;
    line-height: 1.6;
    color: #444;
}

.hero-btn {
    background: transparent;
    color: #b8975a;
    border: 1px solid #b8975a;
    padding: 0.75rem 2rem;
    border-radius: 4px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    font-family: var(--font-heading);
    text-transform: uppercase;
    letter-spacing: 1px;
    font-size: 0.85rem;
}

.hero-btn:hover {
    background: #b8975a;
    color: white;
}

.hero-slider-dots {
    position: absolute;
    bottom: 1.5rem;
    left: 50%;
    transform: translateX(-50%);
    z-index: 10;
    display: flex;
    gap: 0.6rem;
}

.hero-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.15);
    cursor: pointer;
    transition: background 0.3s, transform 0.3s;
}

.hero-dot.active {
    background: #b8975a;
    transform: scale(1.2);
}

@media (max-width: 768px) {
    .hero-slider { height: 350px; }
    .hero-slide { padding: 2rem; }
    .hero-content h2 { font-size: 2.4rem; }
}

/* Categories Carousel */
.categories-carousel-wrapper {
    position: sticky;
    top: 73px; /* Just below the nav-bar */
    z-index: 90;
    margin-bottom: 2rem;
    display: flex;
    align-items: center;
    background: var(--paper); /* Ensures solid background when scrolling */
    padding: 1rem 0;
    margin-top: -1rem; /* Visual compensation */
    border-bottom: 1px solid var(--card-border);
    transition: box-shadow 0.3s ease;
}

/* Mobile specific sticky adjustment */
@media (max-width: 768px) {
    .categories-carousel-wrapper {
        top: 0px; /* On mobile, the top nav is at the bottom, so categories stick to the very top */
        padding-top: 1.5rem;
    }
}

.categories-carousel {
    display: flex;
    overflow-x: auto;
    gap: 1rem;
    padding: 0.5rem;
    scroll-behavior: smooth;
    scrollbar-width: none; /* Firefox */
}

.categories-carousel::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.category-pill {
    background: transparent;
    color: var(--ink);
    border: 1px solid var(--card-border);
    padding: 0.6rem 1.4rem;
    border-radius: 30px;
    white-space: nowrap;
    font-weight: 600;
    font-size: 0.95rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.category-pill:hover {
    background: rgba(15, 129, 228, 0.05); /* Planeta blue faint background */
    border-color: var(--gold);
    color: var(--gold);
}

.category-pill.active {
    background: var(--gold);
    color: white;
    border-color: var(--gold);
    box-shadow: 0 4px 10px rgba(15, 129, 228, 0.3);
}

.carousel-arrow {
    background: white;
    border: 1px solid var(--card-border);
    color: var(--ink);
    width: 35px;
    height: 35px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    position: absolute;
    z-index: 10;
    box-shadow: 0 2px 5px rgba(0,0,0,0.05);
}

.carousel-arrow.left { left: -15px; }
.carousel-arrow.right { right: -15px; }



/* Books Carousel */
.carousel-section {
    margin-bottom: 3rem;
}

.carousel-section-title {
    font-size: 1.5rem;
    font-weight: 700;
    margin-bottom: 1rem;
    color: var(--ink);
    border-bottom: 2px solid var(--card-border);
    padding-bottom: 0.5rem;
    display: inline-block;
}

.books-carousel-wrapper {
    position: relative;
    width: 100%;
}

.books-carousel {
    display: flex;
    overflow-x: auto;
    gap: 1.5rem;
    padding-bottom: 1rem;
    scroll-behavior: smooth;
    scrollbar-width: thin;
    scrollbar-color: var(--gold) var(--paper-dark);
}

.books-carousel::-webkit-scrollbar {
    height: 8px;
}

.books-carousel::-webkit-scrollbar-track {
    background: var(--paper-dark);
    border-radius: 4px;
}

.books-carousel::-webkit-scrollbar-thumb {
    background-color: var(--gold);
    border-radius: 4px;
}

.books-carousel .book-card {
    flex: 0 0 240px; /* Fixed width for carousel items */
}

