.rendicion-grid {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
    flex-wrap: wrap;
    justify-content: center;
    gap: 30px;
    padding: 20px 0;
    perspective: 1000px;
}

.rendicion-item {
    position: relative;
    width: 200px;
    height: 340px;
    perspective: 1000px;
    cursor: pointer;
    text-align: center;
    display: flex;
    flex-direction: column;
    align-items: center;
    margin: auto;
}

/* --- HOJA VIEJA CON TEXTO "Rendición de cuentas" --- */
.rendicion-item::before {
    content: "Rendición de cuentas"; /* Texto añadido */
    position: absolute;
    bottom: 0;           
    left: 0;
    width: 100%;
    height: 280px;       
    background: #e9e0d1; 
    box-shadow: inset 2px 0 5px rgba(0,0,0,0.1);
    z-index: 0;
    border: 1px solid #d4cbb7;
    border-radius: 0 5px 5px 0;
    
    /* Estilos para centrar el texto dentro de la hoja */
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    box-sizing: border-box;
    font-family: 'Montserrat', sans-serif;
    font-size: 1rem;
    font-weight: 500;
    color: #6d5f47; /* Color café suave para estilo antiguo */
    text-transform: uppercase;
    line-height: 1.2;
}

.year-label {
    font-weight: 600;
    font-family: 'Montserrat', sans-serif;
    font-size: 1.3rem;
    color: #1e40af;
    margin-top: 15px;
    z-index: 2; 
}

/* --- 3. Efecto 3D del Libro --- */
.book-cover {
    width: 100%;
    height: 280px; 
    position: relative;
    transform-style: preserve-3d;
    transition: transform 0.6s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: left;
    background: #f5f5f5;
    box-shadow: 5px 5px 15px rgba(0, 0, 0, 0.3);
    z-index: 1;
}

.book-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover; 
    position: absolute;
    top: 0;
    left: 0;
    transform: translateZ(1px); 
    border-radius: 5px;
}

.book-cover::before {
    content: '';
    position: absolute;
    top: 0;
    right: 0;
    width: 10px;
    height: 100%;
    background: linear-gradient(to right, #ccc 0%, #eee 100%);
    transform: rotateY(90deg) translateZ(5px); 
    transform-origin: 0 0;
    box-shadow: -2px 0 5px rgba(0, 0, 0, 0.3);
}

/* --- EL EFECTO HOVER --- */
.rendicion-item:hover .book-cover {
    transform: rotateY(-90deg); 
}

/* --- 4. Estilos para el Modal Adaptado --- */
.book-modal {
    display: none;
    position: fixed;
    z-index: 10000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.book-modal-content {
    background-color: #fff;
    margin: 1vh auto;
    width: 96%;
    height: 98vh;
    position: relative;
    box-shadow: 0 0 50px rgba(0, 0, 0, 0.5);
    border-radius: 5px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.pdf-selector-bar {
    display: flex;
    background: #1e40af;
    padding: 12px 65px 12px 15px;
    gap: 10px;
    overflow-x: auto;
    white-space: nowrap;
    scrollbar-width: thin;
    border-radius: 5px;
}

.pdf-selector-bar::-webkit-scrollbar {
    height: 4px;
}

.pdf-btn {
    flex-shrink: 0;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 8px 18px;
    cursor: pointer;
    border-radius: 5px;
    font-size: 12px;
    font-family: 'Montserrat', sans-serif;
    transition: all 0.3s;
}

.pdf-btn.active {
    background: #f6303a;
    border-color: #f6303a;
    font-weight: bold;
}

.pdf-btn:hover:not(.active) {
    background: rgba(255, 255, 255, 0.4);
}

.close-btn {
    position: absolute;
    top: 10px;
    right: 15px;
    color: #333;
    font-size: 22px;
    font-weight: bold;
    background: #fff;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 1px solid #ddd;
    cursor: pointer;
    z-index: 10001;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
    transition: all 0.2s;
}

.close-btn:hover {
    background: #f6303a;
    color: white;
    border-color: #f6303a;
}

#pdfViewerContainer {
    flex-grow: 1;
    width: 100%;
    background-color: #eee;
}

#pdfViewerContainer iframe {
    width: 100%;
    height: 100%;
    border: none;
}

/* --- 5. Media Queries --- */
@media (max-width: 768px) {
    .rendicion-grid { gap: 20px; }
    .rendicion-item { width: 150px; height: 260px; } /* Ajuste de tamaño base */
    .year-label { font-size: 1.1rem; }
    
    /* Ajuste de la hoja interna para móvil */
    .rendicion-item::before {
        height: 210px; /* Proporcional al nuevo tamaño del item */
        font-size: 0.7rem;
        padding: 10px;
    }

    /* Ajuste de la tapa para móvil */
    .book-cover {
        height: 210px;
    }
    
    .book-modal-content {
        width: 100%;
        height: 100vh;
        margin: 0;
        border-radius: 0;
    }
    
    .pdf-selector-bar {
        padding-right: 55px;
    }
}

@media (max-width: 480px) {
    .rendicion-item { width: 130px; height: 230px; }
    
    .rendicion-item::before {
        height: 180px;
        font-size: 0.6rem;
    }

    .book-cover {
        height: 180px;
    }

    .year-label { font-size: 1rem; margin-top: 10px; }

    .pdf-btn {
        padding: 6px 12px;
        font-size: 11px;
    }
}