/* style.css */
html {
    background: #0d0913;
    min-height: 100%;
    display: grid;
    place-items: center;
    margin: 0;
    padding: 0;
    user-select: none;
    -webkit-user-select: none;
    overflow-x: hidden;
}

body {
    margin: 0;
    padding: 0;
    width: 100%;
    min-height: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
    font-family: 'Montserrat', sans-serif;
}

.level {
    position: relative;
    width: 85vw;
    min-height: 90vh;
    margin: 60px 0;
    padding: 1em 2em;
    border-radius: 2em;
    color: #ffffff;
    background-color: #0d0913;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;
}

.level::before {
    content: "";
    position: absolute;
    inset: -0.8em; 
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(52deg, #ffed70, #e00df2);
    filter: blur(0.6em); 
}

/* TOOLBAR */
.toolbar-container {
    position: relative;
    display: flex;
    gap: 20px;
    margin-top: 50px;
    width: 90%;
    max-width: 800px;
    justify-content: center;
    margin-bottom: 20px;
}

.glow-item {
    position: relative;
    z-index: 10;
    display: flex;
    border-radius: 2em;
}

.glow-item::before {
    content: "";
    position: absolute;
    inset: -0.2em;
    z-index: -1;
    border-radius: inherit;
    background: linear-gradient(52deg, #ffed70, #e00df2);
    filter: blur(0.1em);
}

.search-input, .filter-btn {
    appearance: none;
    border: none; outline: none;
    padding: 1em 2em;
    border-radius: inherit;
    color: #ffffff;
    font-weight: 700;
    background-color: #0d0913;
    width: 100%;
}

.filter-btn { display: flex; align-items: center; gap: 10px; cursor: pointer; }

/* PANEL FILTROS */
.filter-panel {
    position: absolute;
    top: 125%; right: 0; width: 100%;
    z-index: 1000;
    border-radius: 2em;
    background: linear-gradient(52deg, #ffed70, #e00df2);
    padding: 0.2em;
    opacity: 0; visibility: hidden;
    transform: translateY(-20px);
    transition: all 0.4s ease;
}

.filter-panel.visible { opacity: 1; visibility: visible; transform: translateY(0); }
.filter-inner { background-color: #0d0913; border-radius: 1.8em; padding: 2em; }
.filter-row { display: flex; gap: 2em; margin-bottom: 1.5em; }
.filter-group { display: flex; flex-direction: column; flex: 1; gap: 0.8em; }
.filter-group label { color: #ffed70; font-size: 0.9em; text-transform: uppercase; }
.filter-group input { padding: 12px; border-radius: 1em; border: 1px solid #3d344d; background: #1a1423; color: white; }
.genre-checkboxes { display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 10px; }
.genre-item { display: flex; align-items: center; gap: 8px; font-size: 0.85em; color: #fff; }

.filter-actions { display: flex; gap: 1em; width: 100%; margin-top: 1em; }
.apply-filters-btn, .reset-filters-btn { 
    flex: 1; padding: 1.2em; border-radius: 2em; border: none; 
    font-weight: 900; cursor: pointer; text-transform: uppercase; 
}
.apply-filters-btn { background: linear-gradient(52deg, #ffed70, #e00df2); color: #0d0913; }
.reset-filters-btn { background-color: #1a1423; color: #ffffff; border: 1px solid #ffed70; }

/* GRID Y LIBROS */
.book-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 30px; width: 100%; margin-top: 30px;
}

.book-item-wrapper { display: flex; flex-direction: column; align-items: center; margin-bottom: 20px; }
.book-container { width: 160px; height: 240px; perspective: 1000px; position: relative; }

.book {
    transform: rotateY(-30deg);
    position: relative;
    transform-style: preserve-3d;
    width: 100%; height: 100%;
    cursor: pointer;
    transition: transform 0.5s;
}

/* RELLENO DE HOJAS BLANCAS */
.book::before {
    content: ' ';
    background: #fff;
    height: calc(240px - 2 * 3px);
    width: 40px;
    top: 3px;
    position: absolute;
    transform: translateX(calc(160px - 40px / 2 - 3px)) rotateY(90deg) translateX(calc(40px / 2));
    z-index: 1;
}

.book img:not(.plus-icon-btn) {
    position: absolute;
    width: 100%; height: 100%;
    z-index: 2; object-fit: cover;
    border-radius: 0 3px 3px 0;
    box-shadow: 5px 5px 20px rgba(0,0,0,0.5);
}

.plus-icon-btn {
    position: absolute; top: 10px; right: 10px;
    width: 25px !important; height: 25px !important;
    z-index: 10; transform: translateZ(20px);
}

/* POPUPS */
.book-info-popup {
    position: absolute; top: 40px; right: -20px;
    width: 210px; background: #1a1423; border: 1px solid #ffed70;
    border-radius: 12px; padding: 12px; z-index: 1000;
    opacity: 0; visibility: hidden;
    transition: opacity 0.3s ease;
    box-shadow: 0 10px 30px rgba(0,0,0,0.9);
    transform: rotateY(30deg) translateZ(80px);
    pointer-events: none;
}
.book-info-popup.show { opacity: 1; visibility: visible; }
.book-info-popup p { margin: 5px 0; font-size: 0.75rem; color: #fff; text-align: left; line-height: 1.2; }
.book-info-popup strong { color: #ffed70; display: block; font-size: 0.65rem; text-transform: uppercase; }

.book-title { margin-top: 15px; color: #ffffff; text-align: center; font-size: 0.9rem; max-width: 160px; font-weight: 600; }

/* PAGINACIÓN */
.pagination-wrapper { display: flex; justify-content: center; align-items: center; gap: 8px; padding: 20px 0; width: 100%; }
.page-btn { background: #1a1423; color: white; border: 1px solid #3d344d; padding: 8px 12px; border-radius: 8px; cursor: pointer; font-size: 0.85rem; font-family: 'Montserrat', sans-serif; transition: 0.3s; }
.page-btn:disabled { opacity: 0.3; cursor: not-allowed; }
.page-btn.active { background: linear-gradient(52deg, #ffed70, #e00df2); color: #0d0913; border: none; font-weight: bold; }

/* NO ENCONTRADO */
.no-results-container { grid-column: 1 / -1; text-align: center; padding: 40px; color: #ffed70; }
.request-link { color: #e00df2; text-decoration: underline; font-weight: 900; cursor: pointer; }

/* OVERLAY DE DESCARGA (CIRCULAR) */
.download-overlay {
    position: fixed; inset: 0; background: rgba(0, 0, 0, 0.9);
    display: none; justify-content: center; align-items: center; z-index: 9999;
}
.download-card {
    background: #1a1423; width: 300px; height: 300px; border-radius: 50%;
    border: 4px solid #ffed70; text-align: center;
    display: flex; flex-direction: column; justify-content: center; align-items: center;
    transition: border-color 0.3s ease; padding: 20px; box-sizing: border-box;
}
.download-card.success-border { border-color: #2ecc71; }
.spinner {
    width: 60px; height: 60px; border: 5px solid rgba(255, 237, 112, 0.2);
    border-top: 5px solid #ffed70; border-radius: 50%;
    margin-bottom: 20px; animation: spin 1s linear infinite;
}
@keyframes spin { 100% { transform: rotate(360deg); } }
#downloadStatus { color: #ffed70; font-size: 1.1rem; font-weight: 900; margin: 0; text-transform: uppercase; }

/* FORMULARIO SOLICITAR */
.request-overlay {
    position: fixed; inset: 0; background: rgba(13, 9, 19, 0.98);
    z-index: 3000; display: flex; justify-content: flex-end;
    visibility: hidden; overflow: hidden;
}
.request-overlay.active { visibility: visible; }
.request-content {
    width: 100%; max-width: 450px; height: 100vh;
    background: #0d0913; border-left: 3px solid #ffed70;
    padding: 3vh 30px; box-sizing: border-box;
    transform: translateX(100%); transition: transform 0.4s ease-in-out;
    display: flex; flex-direction: column;
}
.request-overlay.active .request-content { transform: translateX(0); }
.form-main-title { font-family: 'Amatic SC', cursive; font-size: 7vh; color: #ffed70; text-align: center; margin-bottom: 2vh; }
.request-form { display: flex; flex-direction: column; height: 100%; justify-content: space-between; }

.form-group {
    display: flex;
    flex-direction: column;
    gap: 0.8vh; /* Más espacio entre el título y el campo */
    margin-bottom: 2.2vh; /* Más espacio entre grupos de campos */
}
.form-group label {
    color: #e00df2;
    font-size: 1.4vh; /* Ligeramente más pequeño para compensar el aire */
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}
.form-group input, .form-group textarea {
    padding: 1.5vh; /* Campos más altos y cómodos */
    border-radius: 12px;
    border: 1px solid #3d344d;
    background: #1a1423;
    color: white;
    font-size: 1.7vh;
    transition: border-color 0.3s;
}
.form-group input:focus, .form-group textarea:focus {
    border-color: #ffed70;
    outline: none;
}

.char-counter { text-align: right; font-size: 1.3vh; color: #ffed70; }
.form-actions-bottom { display: flex; gap: 15px; margin-top: auto; padding-bottom: 2vh; }
.btn-enviar { flex: 1; padding: 1.8vh 0; border-radius: 30px; border: none; font-weight: 900; background: linear-gradient(52deg, #ffed70, #e00df2); color: #0d0913; cursor: pointer; font-size: 1.7vh; }
.btn-cancelar { flex: 1; padding: 1.8vh 0; border-radius: 30px; border: 1px solid #ffed70; background: #1a1423; color: white; cursor: pointer; font-size: 1.7vh; }