:root {
    --primary: #004144; /* Verde Teal Casa del Libro */
    --primary-light: #005f63;
    --accent: #E5A823; /* Dorado de acción */
    --accent-hover: #c9921e;
    --bg-light: #ffffff;
    --bg-soft: #f8fafc;
    --text-main: #1e293b;
    --text-muted: #64748b;
    --glass-border: rgba(0, 65, 68, 0.1);
    --success: #22c55e;
    --error: #ef4444;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    background-color: var(--bg-light);
    color: var(--text-main);
    min-height: 100vh;
    font-family: 'Outfit', sans-serif;
}

h1, h2, h3, .serif {
    font-family: 'Playfair Display', serif; /* Añadiremos esta fuente en el header */
    font-weight: 700;
}

/* Glassmorphism sutil para BiblioShare */
.glass-card {
    background: white;
    border: 1px solid var(--glass-border);
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.05);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.glass-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
}

.btn {
    padding: 0.8rem 1.5rem;
    border-radius: 8px;
    border: none;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
    display: inline-block;
    font-family: 'Outfit', sans-serif;
}

.btn-primary {
    background: var(--primary);
    color: white;
}

.btn-primary:hover {
    background: var(--primary-light);
}

.btn-accent {
    background: var(--accent);
    color: var(--primary);
}

.btn-accent:hover {
    background: var(--accent-hover);
}

.nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1rem 8%;
    position: sticky;
    top: 0;
    z-index: 100;
    background: white;
    border-bottom: 1px solid var(--glass-border);
}

.logo {
    font-size: 2rem;
    font-weight: 800;
    color: var(--primary);
    font-family: 'Playfair Display', serif;
}

/* Home Sections */
.genre-section {
    padding: 4rem 8%;
}

.section-title {
    font-size: 2.2rem;
    margin-bottom: 2rem;
    color: var(--primary);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-left: 6px solid var(--accent);
    padding-left: 1.5rem;
}

.books-roller {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 1.5rem;
}

/* Book Card Style Casa del Libro */
.book-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-align: center;
    height: 100%;
}

.book-card .btn {
    margin-top: auto;
}

.book-img-container {
    position: relative;
    width: 100%;
    aspect-ratio: 2/3;
    overflow: hidden;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.book-img {
    width: 100%;
    height: 100%;
    object-fit: contain;
    background-color: transparent;
    transition: transform 0.5s ease;
}

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

.book-title {
    font-size: 1rem;
    font-weight: 700;
    margin-bottom: 0.3rem;
    color: var(--text-main);
}

.book-author {
    font-size: 0.85rem;
    color: var(--primary);
    margin-bottom: 1rem;
}

/* Form Styling */
.form-group {
    margin-bottom: 1.5rem;
}

.form-control {
    width: 100%;
    padding: 0.9rem;
    background: var(--bg-soft);
    border: 1px solid var(--glass-border);
    border-radius: 8px;
    color: var(--text-main);
    outline: none;
}

.form-control:focus {
    border-color: var(--primary);
    background: white;
}

/* ===== BUSCADOR INTELIGENTE AJAX ===== */

/* Trigger Button in Nav */
.search-trigger {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    padding: 0.55rem 1.2rem;
    border-radius: 30px;
    background: var(--bg-soft);
    border: 1px solid var(--glass-border);
    color: var(--text-muted);
    cursor: pointer;
    font-size: 0.9rem;
    font-family: 'Outfit', sans-serif;
    transition: all 0.3s ease;
    min-width: 220px;
}

.search-trigger:hover {
    border-color: var(--primary);
    background: white;
    box-shadow: 0 4px 15px rgba(0, 65, 68, 0.1);
}

.search-trigger kbd {
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 4px;
    background: white;
    border: 1px solid #ddd;
    color: var(--text-muted);
    font-family: monospace;
    margin-left: auto;
}

/* Full-screen Search Overlay */
.search-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 20, 22, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    z-index: 9999;
    display: none;
    align-items: flex-start;
    justify-content: center;
    padding-top: 8vh;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.search-overlay.active {
    display: flex;
    opacity: 1;
}

.search-overlay.fade-out {
    opacity: 0;
}

/* Search Container (Glass Card) */
.search-container {
    width: 100%;
    max-width: 720px;
    background: white;
    border-radius: 20px;
    box-shadow: 0 30px 100px rgba(0, 0, 0, 0.4);
    overflow: hidden;
    transform: translateY(-30px) scale(0.95);
    transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.search-overlay.active .search-container {
    transform: translateY(0) scale(1);
}

/* Search Input Area */
.search-input-wrapper {
    display: flex;
    align-items: center;
    padding: 1.2rem 1.8rem;
    border-bottom: 1px solid #eee;
    gap: 1rem;
}

.search-input-wrapper i.fa-search {
    color: var(--primary);
    font-size: 1.3rem;
    opacity: 0.7;
}

.search-input-wrapper input {
    flex: 1;
    border: none;
    outline: none;
    font-size: 1.25rem;
    font-family: 'Outfit', sans-serif;
    color: var(--text-main);
    background: transparent;
}

.search-input-wrapper input::placeholder {
    color: var(--text-muted);
    font-weight: 300;
}

.search-close-btn {
    background: var(--bg-soft);
    border: 1px solid #eee;
    width: 36px;
    height: 36px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    font-size: 0.8rem;
    color: var(--text-muted);
    transition: all 0.2s;
    font-family: monospace;
    font-weight: bold;
}

.search-close-btn:hover {
    background: var(--error);
    color: white;
    border-color: var(--error);
}

/* Filter Chips */
.search-filters {
    display: flex;
    gap: 0.5rem;
    padding: 0.8rem 1.8rem;
    border-bottom: 1px solid #f0f0f0;
    background: #fafbfc;
}

.filter-chip {
    padding: 0.4rem 1rem;
    border-radius: 20px;
    font-size: 0.82rem;
    font-family: 'Outfit', sans-serif;
    cursor: pointer;
    border: 1.5px solid #e0e0e0;
    background: white;
    color: var(--text-muted);
    transition: all 0.25s ease;
    font-weight: 500;
}

.filter-chip:hover {
    border-color: var(--primary);
    color: var(--primary);
}

.filter-chip.active {
    background: var(--primary);
    color: white;
    border-color: var(--primary);
    box-shadow: 0 3px 12px rgba(0, 65, 68, 0.3);
}

.filter-chip i {
    margin-right: 0.3rem;
}

/* Results Area */
.search-results {
    max-height: 55vh;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: var(--primary) transparent;
}

.search-results::-webkit-scrollbar {
    width: 5px;
}

.search-results::-webkit-scrollbar-thumb {
    background: var(--primary);
    border-radius: 10px;
}

/* Initial state / Empty state */
.search-placeholder {
    padding: 3rem 2rem;
    text-align: center;
    color: var(--text-muted);
}

.search-placeholder i {
    font-size: 2.5rem;
    margin-bottom: 1rem;
    display: block;
    color: var(--accent);
    opacity: 0.6;
}

.search-placeholder p {
    font-size: 0.95rem;
}

/* Loading spinner */
.search-loading {
    padding: 2.5rem;
    text-align: center;
}

.search-loading i {
    font-size: 1.8rem;
    color: var(--primary);
    animation: spin 0.8s linear infinite;
}

@keyframes spin {
    100% { transform: rotate(360deg); }
}

/* Result Item */
.search-result-item {
    display: flex;
    align-items: center;
    gap: 1.2rem;
    padding: 1rem 1.8rem;
    cursor: pointer;
    transition: background 0.2s ease;
    border-bottom: 1px solid #f5f5f5;
    text-decoration: none;
    color: inherit;
    animation: result-slide-in 0.25s ease forwards;
    opacity: 0;
    transform: translateY(8px);
}

@keyframes result-slide-in {
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.search-result-item:hover {
    background: linear-gradient(90deg, rgba(0, 65, 68, 0.04) 0%, transparent 100%);
}

.search-result-item:hover .result-cover {
    transform: scale(1.08);
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.result-cover {
    width: 55px;
    height: 80px;
    border-radius: 6px;
    object-fit: cover;
    background: #f0f0f0;
    flex-shrink: 0;
    transition: all 0.3s ease;
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.08);
}

.result-info {
    flex: 1;
    min-width: 0;
}

.result-title {
    font-family: 'Playfair Display', serif;
    font-size: 1.05rem;
    font-weight: 700;
    color: var(--text-main);
    margin-bottom: 0.2rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.result-meta {
    font-size: 0.82rem;
    color: var(--text-muted);
    display: flex;
    gap: 1rem;
    align-items: center;
    flex-wrap: wrap;
}

.result-meta span {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.result-genre-badge {
    display: inline-block;
    padding: 0.15rem 0.6rem;
    font-size: 0.72rem;
    border-radius: 12px;
    background: rgba(0, 65, 68, 0.08);
    color: var(--primary);
    font-weight: 600;
}

.result-rating {
    color: #FFD700 !important;
    font-size: 0.78rem;
    letter-spacing: 1px;
}

.result-arrow {
    color: var(--primary);
    opacity: 0;
    transition: all 0.3s ease;
    font-size: 1.1rem;
}

.search-result-item:hover .result-arrow {
    opacity: 1;
    transform: translateX(5px);
}

/* Results summary */
.search-summary {
    padding: 0.7rem 1.8rem;
    font-size: 0.8rem;
    color: var(--text-muted);
    background: #fafbfc;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.search-summary strong {
    color: var(--primary);
}

/* Highlight matched text */
.highlight-match {
    background: rgba(229, 168, 35, 0.25);
    color: var(--primary);
    font-weight: 700;
    padding: 0 2px;
    border-radius: 3px;
}

/* Responsive */
@media (max-width: 768px) {
    .search-container {
        margin: 0 1rem;
        border-radius: 16px;
    }

    .search-trigger {
        min-width: 44px;
        padding: 0.55rem;
    }

    .search-trigger span, .search-trigger kbd {
        display: none;
    }

    .search-result-item {
        padding: 0.8rem 1.2rem;
    }
}
