/* --- Libros Section --- */

/* Results Header */
.results-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
}

@media (max-width: 576px) {
    .results-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        margin-bottom: 1.5rem;
    }
}

.results-count {
    font-size: 0.9rem;
    color: var(--text-muted);
}

.results-sort {
    padding: 10px 20px;
    border: 1px solid #e2e8f0;
    border-radius: 50px;
    color: var(--text-main);
    font-size: 0.9rem;
    font-weight: 600;
    background-color: white;
    cursor: pointer;
    outline: none;
    transition: var(--transition);
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 15px center;
    padding-right: 40px;
}

.results-sort:hover {
    border-color: var(--primary-light);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.results-sort:focus {
    border-color: var(--primary);
}

/* Grid de Libros */
.results-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 2rem;
}

/* Media Queries para Responsive Grid */
@media (max-width: 1200px) {
    .results-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 1.5rem;
    }
}

@media (max-width: 992px) {
    .results-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 1.25rem;
    }
}

@media (max-width: 576px) {
    .results-grid {
        grid-template-columns: 1fr;
        gap: 1.5rem;
    }
}

/* Book Card Premium */
.book-card {
    background: white;
    border-radius: 12px;
    overflow: hidden;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.05);
    transition: all 0.4s cubic-bezier(0.165, 0.84, 0.44, 1);
    border: 1px solid #f1f5f9;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    position: relative;
}

.book-card:hover {
    transform: translateY(-8px);
    box-shadow: 0 12px 30px rgba(0, 0, 0, 0.12);
}

/* Portada */
.book-cover-wrapper {
    position: relative;
    padding-top: 150%;
    background: #f1f5f9;
    overflow: hidden;
}

.book-cover {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    object-position: center top;
}

/* --- Overlay de Información --- */
.book-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(to bottom, rgba(0, 0, 0, 0.05) 0%, rgba(0, 0, 0, 0.7) 100%);
    display: flex;
    flex-direction: column;
    justify-content: flex-end;
    padding: 1.2rem;
    opacity: 0;
    transition: all 0.3s ease;
    z-index: 2;
}

.book-card:hover .book-overlay {
    opacity: 1;
}

.center-action-area {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.8);
    opacity: 0;
    transition: all 0.4s cubic-bezier(0.175, 0.885, 0.32, 1.275);
    z-index: 5;
}

.book-card:hover .center-action-area {
    opacity: 1;
    transform: translate(-50%, -50%) scale(1);
}

.overlay-details {
    color: white;
    transform: translateY(15px);
    transition: transform 0.4s ease;
}

.book-card:hover .overlay-details {
    transform: translateY(0);
}

/* Tags del overlay */
.overlay-tag {
    display: inline-block;
    padding: 4px 10px;
    border-radius: 20px;
    font-size: 0.72rem;
    font-weight: 600;
    margin-bottom: 5px;
    backdrop-filter: blur(4px);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

.tag-autor {
    background: rgba(16, 185, 129, 0.2);
    color: #6ee7b7;
    border: 1px solid rgba(16, 185, 129, 0.3);
}

.tag-editorial {
    background: rgba(148, 163, 184, 0.2);
    color: #cbd5e1;
    border: 1px solid rgba(148, 163, 184, 0.3);
}

.tag-categoria {
    background: rgba(56, 189, 248, 0.2);
    color: #7dd3fc;
    border: 1px solid rgba(56, 189, 248, 0.3);
}

/* Botón Favoritos */
.btn-favorite {
    position: absolute;
    top: 12px;
    right: 12px;
    width: 35px;
    height: 35px;
    background: white;
    border: none;
    border-radius: 50%;
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    z-index: 10;
    opacity: 0;
    transform: scale(0.8);
}

.book-card:hover .btn-favorite {
    opacity: 1;
    transform: scale(1);
}

.btn-favorite i {
    width: 18px;
    color: var(--primary);
    transition: all 0.3s ease;
}

.btn-favorite:hover {
    transform: scale(1.15) !important;
}

.btn-favorite:hover i {
    color: #ef4444;
    fill: #ef4444;
}

/* Botón Vista Rápida - Estilo Ojo con fondo semi-transparente */
.btn-quick-view {
    background: rgba(255, 255, 255, 0.85);
    /* Blanco semi-transparente */
    backdrop-filter: blur(4px);
    color: var(--primary);
    border: none;
    height: 50px;
    width: 50px;
    border-radius: 50px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    overflow: hidden;
    white-space: nowrap;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    padding: 0;
}

.btn-quick-view .eye-icon {
    width: 24px;
    height: 24px;
    flex-shrink: 0;
    transition: transform 0.3s ease;
}

.btn-quick-view .view-text {
    max-width: 0;
    opacity: 0;
    font-size: 0.9rem;
    font-weight: 700;
    transition: all 0.4s ease;
    margin-left: 0;
}

/* Al pasar el mouse sobre el OJO */
.btn-quick-view:hover {
    width: 160px;
    padding: 0 1.5rem;
    background: white;
    color: var(--primary);
}

.btn-quick-view:hover .view-text {
    max-width: 120px;
    opacity: 1;
    margin-left: 10px;
}

/* Info del Libro */
.book-info {
    padding: 1rem 1.2rem;
    background: white;
    transition: all 0.3s ease;
    flex: 1;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.book-card:hover .book-info {
    background: var(--primary);
}

.book-title {
    font-size: 0.9rem;
    font-weight: 700;
    color: var(--text-main);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    transition: color 0.3s ease;
    margin: 0;
}

.book-card:hover .book-title {
    color: white;
}