@import url('https://fonts.googleapis.com/css2?family=Playfair+Display:wght@700;900&family=DM+Sans:wght@400;500;600&display=swap');

:root {
    --primary:       #eb7e25;
    --primary-dark:  #c96a1a;
    --primary-light: #fff3e8;
    --star-gold:     #f59e0b; /* COLOR DE ESTRELLAS MANTENIDO */
    --text:          #1a1a1a;
    --text-muted:    #6b7280;
    --bg:            #ffffff;
    --border:        #e5e7eb;
}

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'DM Sans', sans-serif; background: var(--bg); color: var(--text); line-height: 1.6; }

.notifications-container {
    display: none !important;
}

/* ── HERO ───────────────────────────────── */
.hero {
    position: relative;
    padding: 6rem 2rem;
    background: linear-gradient(135deg, #fffcf9 0%, #ffffff 100%);
    overflow: hidden;
    min-height: 85vh;
    display: flex;
    align-items: center;
}

.hero-bg {
    position: absolute; inset: 0;
    background: radial-gradient(circle at 80% 20%, rgba(235,126,37,0.08) 0%, transparent 50%);
}

.hero-container {
    max-width: 1300px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1.2fr 0.8fr;
    gap: 4rem;
    position: relative;
    z-index: 2;
}

.hero-badge {
    display: inline-block;
    padding: 0.5rem 1rem;
    background: var(--primary-light);
    color: var(--primary);
    border-radius: 50px;
    font-size: 0.75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
    margin-bottom: 1.5rem;
}

.hero-title {
    font-family: 'Playfair Display', serif;
    font-size: clamp(2.5rem, 5vw, 4.5rem);
    line-height: 1.1;
    margin-bottom: 1.5rem;
}

.hero-title .accent { color: var(--primary); font-style: italic; }

.hero-subtitle {
    font-size: 1.1rem;
    color: var(--text-muted);
    max-width: 500px;
    margin-bottom: 2.5rem;
}

/* BUSCADOR HERO */
.hero-search {
    display: flex;
    background: white;
    padding: 0.5rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.08);
    max-width: 550px;
    margin-bottom: 3rem;
    border: 1px solid var(--border);
}

.hero-search input {
    flex: 1;
    border: none;
    padding: 0.8rem 1rem;
    outline: none;
    font-size: 1rem;
}

.hero-search button {
    background: var(--primary);
    color: white;
    border: none;
    padding: 0 1.5rem;
    border-radius: 8px;
    cursor: pointer;
    transition: 0.3s;
}

.hero-search button:hover { background: var(--primary-dark); }

/* STATS */
.hero-stats { display: flex; gap: 3rem; }
.stat .num { display: block; font-size: 2rem; font-weight: 700; color: var(--primary); font-family: 'Playfair Display', serif; }
.stat .lab { font-size: 0.8rem; color: var(--text-muted); text-transform: uppercase; }

/* BOOK STACK ANIMATION */
.hero-visual-side { position: relative; }
.book-stack { position: relative; height: 400px; }

.floating-book {
    position: absolute;
    width: 180px;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 15px 35px rgba(0,0,0,0.2);
    animation: float 6s ease-in-out infinite;
    animation-delay: calc(var(--i) * -1.5s);
}

.floating-book img { width: 100%; display: block; }

.floating-book:nth-child(1) { top: 10%; left: 0; z-index: 3; }
.floating-book:nth-child(2) { top: 30%; left: 40%; z-index: 2; width: 160px; }
.floating-book:nth-child(3) { top: 0%; left: 60%; z-index: 1; width: 140px; }

@keyframes float {
    0%, 100% { transform: translateY(0) rotate(0); }
    50% { transform: translateY(-20px) rotate(2deg); }
}

/* ── CONTENT SECTION ────────────────────── */
.content-section { max-width: 1300px; margin: 4rem auto; padding: 0 2rem; }

.section-top {
    display: flex;
    justify-content: space-between;
    align-items: flex-end;
    margin-bottom: 2.5rem;
}

.section-top h2 { font-family: 'Playfair Display', serif; font-size: 2rem; }
.tag { color: var(--primary); font-weight: 700; font-size: 0.8rem; text-transform: uppercase; display: block; margin-bottom: 0.5rem; }

.view-all { color: var(--primary); text-decoration: none; font-weight: 600; transition: 0.3s; }
.view-all:hover { margin-right: -5px; padding-right: 5px; }

/* BOOKS GRID */
.books-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 2rem;
}

.home-book-card { transition: 0.3s; }
.card-img {
    position: relative;
    aspect-ratio: 2/3;
    border-radius: 12px;
    overflow: hidden;
    margin-bottom: 1rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.05);
}

.card-img img { width: 100%; height: 100%; object-fit: cover; transition: 0.5s; }

.card-overlay {
    position: absolute; inset: 0;
    background: rgba(0,0,0,0.4);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: 0.3s;
}

.home-book-card:hover .card-overlay { opacity: 1; }
.home-book-card:hover .card-img img { transform: scale(1.1); }

.btn-quick {
    background: white; color: var(--text); padding: 0.6rem 1.2rem;
    border-radius: 8px; text-decoration: none; font-weight: 600; font-size: 0.85rem;
}

.card-info .genre { font-size: 0.7rem; color: var(--primary); font-weight: 700; text-transform: uppercase; }
.card-info h3 { font-size: 1rem; margin: 0.3rem 0; font-weight: 600; }
.card-info .author { font-size: 0.85rem; color: var(--text-muted); }

/* GENRES STRIP */
.genres-section { background: var(--primary-light); padding: 4rem 0; }
.genres-pills { display: flex; flex-wrap: wrap; gap: 1rem; }

.genre-item {
    background: white;
    padding: 0.8rem 1.5rem;
    border-radius: 50px;
    text-decoration: none;
    color: var(--text);
    display: flex;
    align-items: center;
    gap: 10px;
    font-weight: 600;
    transition: 0.3s;
    border: 1px solid var(--border);
}

.genre-item:hover {
    border-color: var(--primary);
    transform: translateY(-3px);
    box-shadow: 0 5px 15px rgba(235,126,37,0.1);
}

/* FOOTER */
.main-footer { text-align: center; padding: 3rem; border-top: 1px solid var(--border); color: var(--text-muted); font-size: 0.9rem; }

@media (max-width: 900px) {
    .hero-container { grid-template-columns: 1fr; text-align: center; }
    .hero-search, .hero-subtitle { margin-left: auto; margin-right: auto; }
    .hero-visual-side { display: none; }
    .hero-stats { justify-content: center; }
}

@media (max-width: 768px) {

    /* ── 1. AJUSTES DEL HERO EN MÓVIL ── */
    .hero {
        padding: 3rem 1rem;
        min-height: auto;
        text-align: center;
    }

    .hero-container {
        grid-template-columns: 1fr;
        gap: 2rem;
    }

    .hero-badge {
        font-size: 0.7rem;
        margin-bottom: 1rem;
    }

    .hero-subtitle {
        font-size: 1rem;
        margin-bottom: 1.5rem;
        padding: 0 0.5rem;
    }

    .hero-search {
        margin: 0 auto 2rem auto;
        width: 100%;
    }

    /* Estadísticas agrupadas en móvil */
    .hero-stats {
        justify-content: center;
        gap: 1.5rem;
    }

    .stat .num {
        font-size: 1.6rem;
    }

    .stat .lab {
        font-size: 0.7rem;
    }

    /* Ocultamos los libros flotantes decorativos para optimizar espacio */
    .hero-visual-side {
        display: none !important;
    }

    /* ── 2. SECCIÓN CATÁLOGO (Carrusel con Enlace Nativo) ── */
    .content-section {
        margin: 2rem auto;
        padding: 0 0 0 1rem; 
        overflow: hidden;
    }

    .section-top {
        padding-right: 1rem;
        margin-bottom: 1.5rem;
    }

    .section-top h2 {
        font-size: 1.6rem;
    }

    .view-all {
        font-size: 0.85rem;
    }

    /* CONVERSIÓN A CARRUSEL HORIZONTAL TÁCTIL */
    .books-grid {
        display: flex !important;
        flex-direction: row !important;
        overflow-x: auto !important; 
        scroll-snap-type: x mandatory !important; 
        gap: 1.2rem !important;
        padding: 10px 0 !important;
        width: 100% !important;
        -webkit-overflow-scrolling: touch; 
    }

    .books-grid::-webkit-scrollbar {
        display: none !important;
    }

    /* El enlace contenedor es el que ahora maneja el tamaño del carrusel */
    .book-card-link {
        flex: 0 0 85% !important; 
        scroll-snap-align: start !important;
        box-sizing: border-box;
    }

    /* La tarjeta pasa a ocupar todo el espacio de su enlace */
    .home-book-card {
        width: 100% !important;
        margin: 0 !important;
    }

    .card-img {
        box-shadow: 0 6px 16px rgba(0,0,0,0.08);
        margin-bottom: 0.8rem;
    }

    /* Ocultamos por completo la capa del botón viejo, ya no hace falta */
    .card-overlay {
        display: none !important;
    }

    .card-info h3 {
        font-size: 1.05rem;
    }

    /* ── 3. SECCIÓN DE GÉNEROS (Scroll Horizontal Limpio) ── */
    .genres-section {
        padding: 2.5rem 0;
    }

    .genres-pills {
        display: flex !important;
        flex-direction: row !important;
        flex-wrap: nowrap !important; /* Evita que salten hacia abajo */
        overflow-x: auto !important;
        gap: 0.8rem !important;
        padding: 5px 0 15px 0 !important;
        -webkit-overflow-scrolling: touch;
    }

    .genres-pills::-webkit-scrollbar {
        display: none !important;
    }

    .genre-item {
        flex: 0 0 auto !important; /* Impide que las píldoras se achiquen */
        padding: 0.6rem 1.2rem;
        font-size: 0.9rem;
    }

    /* ── 4. FOOTER ── */
    .main-footer {
        padding: 2rem 1rem;
        font-size: 0.85rem;
    }
}
