:root {
    --naranja: #F28500;
    --fucsia: #F518D4;
    --celeste: #22C1F1;
    --negro: #141414;
    --fondo: #F9FAFB;
}

* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
    font-family: 'Nunito', sans-serif;
}

body {
    background-color: var(--fondo);
    color: var(--negro);
}

/* --- CABECERA Y MOSAICO --- */
.encabezado {
    position: relative;
    overflow: hidden;
    background: linear-gradient(135deg, var(--naranja) 0%, var(--fucsia) 55%, var(--celeste) 100%);
    color: white;
    text-align: center;
    padding: 2.5rem 1rem 3.5rem 1rem;
    border-bottom-left-radius: 36px;
    border-bottom-right-radius: 36px;
    box-shadow: 0 8px 25px rgba(245, 24, 212, 0.2);
}

.contenido-header {
    position: relative;
    z-index: 2;
    max-width: 700px;
    margin: 0 auto;
}

.libro-deco {
    position: absolute;
    width: 110px;
    height: 160px;
    object-fit: cover;
    border-radius: 8px;
    box-shadow: 0 8px 18px rgba(0, 0, 0, 0.25);
    z-index: 1;
}

.l1 { top: -10px; left: 2%; transform: rotate(-12deg); }
.l2 { top: 15px; left: 11%; transform: rotate(8deg); }
.l3 { bottom: -15px; left: 6%; transform: rotate(-6deg); }

.l4 { top: -10px; right: 11%; transform: rotate(-10deg); }
.l5 { top: 20px; right: 2%; transform: rotate(12deg); }
.l6 { bottom: -15px; right: 7%; transform: rotate(6deg); }

.logo-contenedor {
    width: 130px;
    height: 130px;
    background-color: #FFFFFF;
    border-radius: 50%;
    margin: 0 auto 1.2rem auto;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
    padding: 6px;
}

.encabezado h1 {
    font-family: 'Fredoka', sans-serif;
    font-size: 2.1rem;
    margin-bottom: 0.5rem;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.encabezado p {
    font-size: 1.1rem;
    margin-bottom: 1.5rem;
    font-weight: 600;
}

#buscador {
width: 100%;
max-width: 480px;
padding: 0.9rem 1.4rem;
border: 3px solid white;
border-radius: 30px;
font-size: 1rem;
outline: none;
box-shadow: 0 6px 15px rgba(0, 0, 0, 0.12);
transition: transform 0.2s ease, border-color 0.2s ease;
}

#buscador:focus {
transform: scale(1.02);
border-color: var(--celeste);
}

/* --- CATÁLOGO DE LIBROS --- */
.contenedor {
    max-width: 1200px;
    margin: 2.5rem auto;
    padding: 0 1.5rem;
}

.grid-libros {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
    gap: 2rem;
}

.sin-resultados {
    grid-column: 1 / -1;
    text-align: center;
    font-size: 1.1rem;
    color: #666677;
    padding: 2rem;
}

.tarjeta-libro {
    background: #FFFFFF;
    border-radius: 20px;
    overflow: hidden;
    border: 2px solid #F0F0F5;
    box-shadow: 0 8px 20px rgba(0, 0, 0, 0.05);
    transition: all 0.25s ease;
    display: flex;
    flex-direction: column;
}

.tarjeta-libro:hover {
    transform: translateY(-7px);
    border-color: var(--celeste);
    box-shadow: 0 12px 25px rgba(34, 193, 241, 0.18);
}

.contenedor-portada {
    position: relative;
    width: 100%;
    height: 300px;
    background-color: #F4F6F9;
}

.portada {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.badge-oferta {
    position: absolute;
    top: 12px;
    right: 12px;
    background-color: var(--naranja);
    color: white;
    font-family: 'Fredoka', sans-serif;
    font-size: 0.9rem;
    padding: 0.35rem 0.75rem;
    border-radius: 20px;
    box-shadow: 0 4px 10px rgba(242, 133, 0, 0.35);
    z-index: 2;
}

.info-libro {
    padding: 1.3rem;
    display: flex;
    flex-direction: column;
    flex-grow: 1;
}

.info-libro h3 {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.2rem;
    color: var(--negro);
    margin-bottom: 0.25rem;
}

.autor {
    color: #666677;
    font-size: 0.92rem;
    font-weight: 600;
    margin-bottom: 0.6rem;
}

/* --- INVENTARIO Y PRECIOS --- */
.stock-estado {
    font-size: 0.85rem;
    font-weight: 800;
    margin-bottom: 0.8rem;
    display: inline-block;
}

.en-stock { color: #2A9D8F; }
.poco-stock { color: var(--naranja); }
.sin-stock { color: #E63946; }

.bloque-precios {
    margin-top: auto;
    margin-bottom: 1rem;
    display: flex;
    align-items: baseline;
    gap: 0.6rem;
}

.precio-anterior {
    text-decoration: line-through;
    color: #9999A8;
    font-size: 0.95rem;
    font-weight: 700;
}

.precio {
    font-family: 'Fredoka', sans-serif;
    font-size: 1.45rem;
    color: var(--celeste);
}

/* --- BOTONES --- */
.btn-comprar {
    display: block;
    text-align: center;
    background-color: var(--fucsia);
    color: white;
    text-decoration: none;
    padding: 0.85rem;
    border-radius: 14px;
    font-weight: 800;
    font-size: 1rem;
    transition: background-color 0.25s ease, transform 0.15s ease;
    box-shadow: 0 4px 12px rgba(245, 24, 212, 0.25);
}

.btn-comprar:hover {
    background-color: var(--naranja);
    box-shadow: 0 4px 12px rgba(242, 133, 0, 0.3);
    transform: scale(1.02);
}

.tarjeta-agotada .portada {
    filter: grayscale(85%);
    opacity: 0.7;
}

.btn-agotado {
    background-color: #CBD5E1;
    color: #64748B;
    cursor: not-allowed;
    box-shadow: none;
    width: 100%;
    border: none;
}

.btn-agotado:hover {
    background-color: #CBD5E1;
    transform: none;
}

/* --- PIE DE PÁGINA --- */
.pie {
    text-align: center;
    padding: 2.5rem 1rem;
    margin-top: 3rem;
    background-color: #FFFFFF;
    border-top: 3px solid var(--celeste);
    color: var(--negro);
    font-size: 0.95rem;
}

/* --- ADAPTABILIDAD MÓVIL --- */
@media (max-width: 1024px) {
    .libro-deco { display: none; }
}
