@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@400;600;700;800&display=swap');

body {
    font-family: 'Nunito', 'Arial', sans-serif;
}

:root {
    --card-bg-browse: #fff;
    --text-primary-browse: #2d3748;
    --border-radius-main: 8px;
    --shadow-main: 0 8px 16px rgba(0,0,0,.05);
    --color-terciario: #79829c;
    --color-peligro: #dc3545;
    --color-primario: #5867dd;
    --color-acento: #34d399;
}

.books-grid {
    display: flex;
    gap: 1.2rem;
}

.books-grid-flat {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
    gap: 1.5rem;
    padding-top: 1rem;
}

.books-grid-flat .book-card-browse {
    width: 100%;
    height: auto;
    aspect-ratio: 2 / 3;
    flex-shrink: 1;
}

/* --- INICIO: MEJORA RESPONSIVE MÓVIL --- */
@media (max-width: 767px) {
    .books-grid-flat {
        grid-template-columns: repeat(2, 1fr);
        gap: 1rem;
    }
}
/* --- FIN: MEJORA RESPONSIVE MÓVIL --- */

.book-card-browse {
    display: inline-block;
    width: 170px;
    height: 255px;
    background-color: var(--card-bg-browse);
    border-radius: var(--border-radius-main);
    overflow: hidden;
    position: relative;
    cursor: default;
    transition: transform .2s ease,box-shadow .2s ease;
    box-shadow: 0 6px 12px rgba(0,0,0,.08);
    flex-shrink: 0;
}

.book-card-browse:hover {
    transform: scale(1.05) translateY(-5px);
    box-shadow: 0 10px 25px rgba(0,0,0,.12);
}

.book-card-clickable-area {
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    cursor: pointer;
}

.book-card-browse img.book-cover-browse {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.book-card-browse .book-title-browse {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(to top,rgba(0,0,0,.85) 20%,transparent 100%);
    color: #fff;
    padding: 1rem .6rem .6rem .6rem;
    font-size: .95rem;
    font-weight: 600;
    text-align: center;
    white-space: normal;
    max-height: 45%;
    overflow: hidden;
    text-overflow: ellipsis;
}

.book-actions-browse {
    position: absolute;
    top: 8px;
    right: 8px;
    display: flex;
    flex-direction: column;
    gap: .6rem;
    z-index: 10;
}

.book-action-btn {
    background: rgba(30,41,59,.6);
    border: none;
    cursor: pointer;
    padding: .4rem;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    transition: background-color .2s ease,transform .2s ease;
    box-shadow: 0 1px 3px rgba(0,0,0,.1);
    width: 30px; /* Tamaño fijo para el botón */
    height: 30px; /* Tamaño fijo para el botón */
}

.book-action-btn:hover {
    background-color: rgba(30,41,59,.8);
    transform: scale(1.1);
}

.book-action-btn svg {
    width: 18px;
    height: 18px;
    fill: #fff;
    transition: fill .2s ease;
}

.book-action-btn.delete-btn svg {
    fill: var(--color-terciario);
}

.book-action-btn.delete-btn:hover svg {
    fill: var(--color-peligro);
}

/* --- INICIO DE ESTILOS PARA DESCARGA --- */
.book-action-btn.download-btn svg {
    fill: #a0aec0; /* Color gris por defecto */
}

.book-action-btn.download-btn:hover:not(.downloaded) {
    background-color: rgba(88, 103, 221, 0.8);
}

.book-action-btn.download-btn:hover:not(.downloaded) svg {
    fill: #fff; /* Icono blanco al pasar el ratón */
}

.book-action-btn.download-btn.downloaded {
    background: rgba(52, 211, 153, 0.8); /* Fondo verde */
}

.book-action-btn.download-btn.downloaded svg {
    fill: #fff; /* Icono blanco para el verificado */
}

.book-action-btn.download-btn.downloaded:hover {
    background: rgba(220, 53, 69, 0.8); /* Fondo rojo sutil al pasar el ratón */
}

.book-action-btn.download-btn.downloaded:hover svg {
    fill: #fff; /* Icono blanco al pasar el ratón para eliminar */
}

/* Spinner de Carga */
.spinner {
    animation: rotate 2s linear infinite;
    width: 18px;
    height: 18px;
}

.path {
    stroke: #fff;
    stroke-linecap: round;
    animation: dash 1.5s ease-in-out infinite;
}

@keyframes rotate {
    100% {
        transform: rotate(360deg);
    }
}

@keyframes dash {
    0% {
        stroke-dasharray: 1, 150;
        stroke-dashoffset: 0;
    }
    50% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -35;
    }
    100% {
        stroke-dasharray: 90, 150;
        stroke-dashoffset: -124;
    }
}
/* --- FIN DE ESTILOS PARA DESCARGA --- */
