body{
    overflow: hidden;
}
.custom-row{
    height: 100vh;
    width: 100%;
    display: flex;
    align-items: center;
    flex-direction: row;
}

.nav-menu{
    height: 100%;
    width: 10vw;
    min-width: 140px;
    background-color: #FFFDF7;
    display: flex;
    align-items: center;
    flex-direction: column;
    overflow: hidden; /* el scroll lo maneja filters-wrapper, no el nav */
}

.nav-logo{
    box-sizing: border-box;
    width: 100%;
    height: 10vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 10px;
    flex-direction: column;
    flex-shrink: 0;
}

.logo-container{
    height: 100%;
    width: 6.5vw;
    min-width: 70px;
    display: flex;
    align-items: center;
    justify-content: center;
    padding-top: 1.5vw;
}

.nav-logo img{
    height: auto;
    width: 100%;
    object-fit: contain;
    filter: drop-shadow(0 0 3px #fff);
}

.menu-item{
    height: fit-content;
    width: 100%;
    padding: 10px 0px 10px 10px;
    display: flex;
    align-items: center;
    justify-content: start;
    gap: 1rem;
    flex-direction: row;
    color: #000;
    box-sizing: border-box;
    flex-shrink: 0;
}

.menu-item:hover{
    background-color: #eef7f1;
    color: #133620;
    cursor: pointer;  
}

.menu-item.active{
    background-color: #eef7f1;
    color: #133620;
}

.icon{
    width: clamp(14px, 1vw, 24px);
    height: auto;
    flex-shrink: 0;
}

.menu-item p{
    font-size: clamp(14px, 1vw, 24px);
}

svg{
    flex: 0 0 auto;
}

.nav-header{
    padding: 10px;
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    box-sizing: border-box;
    flex-shrink: 0;
}

/* ── ZONA DE FILTROS SCROLLEABLE ── */
.filters-wrapper {
    width: 100%;
    flex: 1 1 0;       /* ocupa todo el espacio restante */
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: #c8c5b0 transparent;
}
.filters-wrapper::-webkit-scrollbar { width: 4px; }
.filters-wrapper::-webkit-scrollbar-thumb { background: #c8c5b0; border-radius: 2px; }

/* ── ACORDEÓN ── */
.filter-item {
    width: 100%;
    box-sizing: border-box;
    border-bottom: 0.5px solid #e0dece;
}

.filter-header {
    width: 100%;
    padding: 10px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    cursor: pointer;
    user-select: none;
    box-sizing: border-box;
}
.filter-header:hover {
    background-color: #eef7f1;
    color: #133620;
}
.filter-header p {
    font-size: clamp(14px, 0.8vw, 18px);
    font-weight: 500;
}

.arrow-container {
    transition: transform 0.25s ease;
    display: flex;
    align-items: center;
}
.arrow-container.active {
    transform: rotate(180deg);
}

/* El cuerpo colapsa con max-height */
.filter-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
}
.filter-body.open {
    max-height: 260px;
}

/* ── LISTA DE GÉNEROS ── */
.filter-search {
    padding: 6px 8px 4px;
}
.filter-search input {
    width: 100%;
    padding: 5px 8px;
    border: 0.5px solid #d0cfc3;
    border-radius: 5px;
    font-size: 11px;
    background: #f5f3ea;
    font-family: 'Plus Jakarta Sans', sans-serif;
    color: #333;
    outline: none;
    box-sizing: border-box;
}
.filter-search input:focus {
    border-color: #1B4D2E;
}

.genre-list {
    max-height: 200px;
    overflow-y: auto;
    padding: 2px 0 8px;
    scrollbar-width: thin;
    scrollbar-color: #c8c5b0 transparent;
}
.genre-list::-webkit-scrollbar { width: 3px; }
.genre-list::-webkit-scrollbar-thumb { background: #c8c5b0; border-radius: 2px; }

.genre-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 12px;
    font-size: clamp(12px, 0.7vw, 16px);
    color: #444;
    cursor: pointer;
}
.genre-item:hover {
    background-color: #eef7f1;
    color: #133620;
}
.genre-item input[type="checkbox"] {
    accent-color: #1B4D2E;
    width: 12px;
    height: 12px;
    flex-shrink: 0;
    cursor: pointer;
}

/* ── PRECIO ── */
.price-inputs {
    padding: 6px 12px 10px;
}
.price-row {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    color: #888;
}
.price-row input[type="number"] {
    width: 0;
    flex: 1 1 0;
    padding: 5px 7px;
    border: 0.5px solid #d0cfc3;
    border-radius: 5px;
    font-size: 12px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    background: #f5f3ea;
    color: #333;
    outline: none;
    box-sizing: border-box;
    -moz-appearance: textfield;
}
.price-row input[type="number"]:focus {
    border-color: #1B4D2E;
}
.price-row input[type="number"]::-webkit-outer-spin-button,
.price-row input[type="number"]::-webkit-inner-spin-button {
    -webkit-appearance: none;
}

/* ── DISPONIBILIDAD ── */
.avail-chips {
    padding: 6px 12px 10px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}
.avail-chip {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    font-size: clamp(11px, 0.7vw, 14px);
    color: #444;
    cursor: pointer;
}
.avail-chip input[type="checkbox"] {
    accent-color: #1B4D2E;
    width: 12px;
    height: 12px;
}

.product-header{
    width: 100%;
    height: fit-content;
    align-items: center;
    justify-content: start;
    flex-direction: column;
    padding-right: 0.5rem;
    flex-shrink: 0;
    margin-bottom: 0.25rem;
}
.product-header h1{
    color: #F0C05F;
    
}
.product-header h3{
    color: #EBE9DA;
}

.product-header hr{
    margin: 0.5rem 0px;
}
.product-header .row{
    width: 100%;
    display: flex;
    flex-direction: row !important;
    justify-content: space-between;
    align-items: center;
}
.product-header .column{
    display: flex;
    flex-direction: column;
}
.sort-select {
    margin-top: 1.5vh;
    height: fit-content;
    font-size: 16px;
    font-family: 'Plus Jakarta Sans', sans-serif;
    padding: 8px 14px;
    border: 0.5px solid #EBE9DA;
    border-radius: 7px;
    background: #FFFDF7;
    color: #333;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s;
}

/* Catalog searchbar overrides */
.catalogue-searchbar {
    margin-top: 1.5vh;
    margin-right: 1rem;
    --width-of-input: clamp(150px, 20vw, 350px);
    --height-of-input: clamp(30px, 3vw, 50px);
}


.product-shell{
    box-sizing: border-box;
    padding: 1.25rem 1.5rem 1rem 1.5rem;
    background-color: #1a4d2e;
    height: 100vh;
    width: 100%;
    overflow: hidden;
    display: flex;
    flex-direction: column;
}
.main-wrapper{
    flex: 1 1 0;
    width: 100%;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: thin;
    scrollbar-color: rgba(240,192,95,0.35) transparent;
    padding-right: 0.5rem;
}
.main-wrapper::-webkit-scrollbar { width: 5px; }
.main-wrapper::-webkit-scrollbar-thumb {
    background: rgba(240,192,95,0.4);
    border-radius: 3px;
}
.main-wrapper::-webkit-scrollbar-thumb:hover {
    background: rgba(240,192,95,0.7);
}
/* ── PRODUCT BODY ── */
.product-body {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
    grid-auto-rows: 240px;
    row-gap: 1.5rem;
    column-gap: 1.25rem;
    width: 100%;
    padding: 1.25rem 0.5rem 2rem 0;
    background-color: transparent;
    align-content: start;
}

/* ── PRODUCT CARD ── */
.product-card {
    height: 240px;
    background-color: #FFFDF7;
    border-radius: 12px;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    cursor: pointer;
    transition: transform 0.2s ease, box-shadow 0.2s ease;
    box-shadow: 0 4px 14px rgba(0,0,0,0.3);
    position: relative;
}

.product-card:hover {
    transform: translateY(-4px);
    box-shadow: 0 8px 24px rgba(0,0,0,0.35);
}

/* Cover area — fixed height */
.product-card .card-cover {
    width: 100%;
    height: 168px;
    flex-shrink: 0;
    background-color: #2a6644;
    position: relative;
    overflow: hidden;
}

/* Decorative spine line */
.product-card .card-cover::before {
    content: '';
    position: absolute;
    left: 14%;
    top: 0;
    bottom: 0;
    width: 2px;
    background: rgba(240,192,95,0.25);
}

/* Placeholder book title on cover */
.product-card .card-cover::after {
    content: '';
    position: absolute;
    inset: 16px 20px;
    border-radius: 3px;
}

/* Info area — fills remaining 100px */
.product-card .card-info {
    flex: 1 1 0;
    min-height: 0;
    padding: 10px 12px 28px;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    border-top: 1.5px solid #e8e4d4;
    overflow: hidden;
    position: relative;
}

.product-card .card-title {
    font-family: 'Fraunces', serif;
    font-size: clamp(15px, 0.85vw, 18px);
    font-weight: 600;
    color: #1a3a26;
    line-height: 1.35;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.product-card .card-author {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(14px, 0.65vw, 17px);
    color: #6b7c6e;
    margin-top: 3px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.product-card .card-price {
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: clamp(12px, 0.8vw, 14px);
    font-weight: 700;
    color: #1a4d2e;
    position: absolute;
    bottom: 10px;
    left: 12px;
}

/* Add to cart button — appears on hover */
.product-card .card-btn {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background: #F0C05F;
    color: #1a3a26;
    font-family: 'Plus Jakarta Sans', sans-serif;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.04em;
    text-transform: uppercase;
    padding: 8px;
    text-align: center;
    opacity: 0;
    transform: translateY(100%);
    transition: opacity 0.2s ease, transform 0.2s ease;
}

.product-card:hover .card-btn {
    opacity: 1;
    transform: translateY(0);
}

/* ── FOOTER PAGES ── */
.footer-pages {
    flex-shrink: 0;
    width: 100%;
    background-color: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 0.75rem 0 0.5rem;
    font-family: 'Plus Jakarta Sans', sans-serif;
}

.page-btn {
    width: 32px;
    height: 32px;
    border-radius: 6px;
    border: 1px solid rgba(255,253,247,0.25);
    background: transparent;
    color: #FFFDF7;
    font-size: 13px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.page-btn:hover, .page-btn.active {
    background: #F0C05F;
    color: #1a3a26;
    border-color: #F0C05F;
    font-weight: 700;
}

@media (min-width: 600px) {
    .product-body {
        grid-template-columns: repeat(auto-fill, minmax(175px, 1fr));
        grid-auto-rows: 270px;
    }
    .product-card { height: 270px; }
    .product-card .card-cover { height: 189px; }
}

@media (min-width: 900px) {
    .product-body {
        grid-template-columns: repeat(auto-fill, minmax(176px, 1fr));
        grid-auto-rows: 310px;
    }
    .product-card { height: 310px; }
    .product-card .card-cover { height: 217px; }
}

@media (min-width: 1200px) {
    .product-body {
        grid-template-columns: repeat(auto-fill, minmax(190px, 1fr));
        grid-auto-rows: 340px;
    }
    .product-card { height: 340px; }
    .product-card .card-cover { height: 240px; }
}

@media (min-width: 1400px) {
    .product-body {
        grid-template-columns: repeat(auto-fill, minmax(210px, 1fr));
        grid-auto-rows: 360px;
    }
    .product-card { height: 360px; }
    .product-card .card-cover { height: 258px; }
}

@media (min-width: 1800px) {
    .product-body {
        grid-template-columns: repeat(auto-fill, minmax(230px, 1fr));
        grid-auto-rows: 380px;
    }
    .product-card { height: 380px; }
    .product-card .card-cover { height: 272px; }
}

@media (min-width: 768px) {
    .nav-logo { height: 15vh; }
}


/* ══════════════════════════════════════════════════════════════
   MOBILE TOP BAR
══════════════════════════════════════════════════════════════ */
.mobile-topbar {
    display: none;
    position: fixed;
    top: 0; left: 0; right: 0;
    height: 56px;
    z-index: 900;
    background-color: #FFFDF7;
    align-items: center;
    justify-content: space-between;
    padding: 0 12px;
    border-bottom: 1px solid #e0dece;
    box-shadow: 0 2px 10px rgba(0,0,0,0.08);
}

.mobile-logo-wrap {
    display: flex;
    align-items: center;
}

.mobile-logo-wrap img {
    height: 40px;
    width: auto;
    object-fit: contain;
    filter: drop-shadow(0 0 2px #fff);
}

.mobile-hamburger {
    background: none;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px;
    border-radius: 7px;
    color: #1a4d2e;
    -webkit-tap-highlight-color: transparent;
}
.mobile-hamburger:hover,
.mobile-hamburger:active { background: #eef7f1; }


/* ══════════════════════════════════════════════════════════════
   MOBILE OVERLAY
══════════════════════════════════════════════════════════════ */
.mobile-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 950;
    backdrop-filter: blur(2px);
    -webkit-backdrop-filter: blur(2px);
}
.mobile-overlay.visible { display: block; }

/* ══════════════════════════════════════════════════════════════
   DRAWER CLOSE BUTTON  (hidden on desktop)
══════════════════════════════════════════════════════════════ */
.nav-drawer-close {
    display: none;
}

/* ══════════════════════════════════════════════════════════════
   MOBILE LAYOUT  (≤ 767 px)
══════════════════════════════════════════════════════════════ */
@media (max-width: 767px) {

    /* ── Body ── */
    body { overflow: auto; }
    body.drawer-open { overflow: hidden; }

    /* ── Show topbar ── */
    .mobile-topbar { display: flex; }

    /* ── Main row stacks vertically ── */
    .custom-row {
        flex-direction: column;
        height: auto;
        min-height: 100svh;
        padding-top: 56px; /* height of fixed topbar */
    }

    /* ── Nav becomes an off-canvas drawer ── */
    .nav-menu {
        position: fixed;
        top: 56px;
        left: -100%;
        width: 80%;
        max-width: 280px;
        height: 100%;
        z-index: 960;
        transition: left 0.3s ease;
        box-shadow: 4px 0 20px rgba(0, 0, 0, 0.18);
        overflow-y: auto;
        overflow-x: hidden;
        /* ensure it scrolls on iOS */
        -webkit-overflow-scrolling: touch;
    }
    .nav-menu.open { left: 0; }

    /* ── Drawer close button ── */
    .nav-drawer-close {
        display: flex;
        align-items: center;
        justify-content: flex-end;
        width: 100%;
        padding: 10px 10px 2px;
        background: none;
        border: none;
        cursor: pointer;
        color: #1a4d2e;
        box-sizing: border-box;
        flex-shrink: 0;
        -webkit-tap-highlight-color: transparent;
    }
    .nav-drawer-close:hover,
    .nav-drawer-close:active { color: #133620; }

    /* Desktop logo hidden — logo shown in topbar instead */
    .nav-logo { display: none; }

    /* Bigger tap targets in drawer */
    .menu-item { padding: 13px 10px 13px 14px; }
    .menu-item p { font-size: 15px; }
    .filter-header { padding: 13px 10px; }

    /* ── Product shell fills full width ── */
    .product-shell {
        width: 100%;
        height: auto;
        min-height: calc(100svh - 56px);
        overflow: visible;
        padding: 0.85rem 0.85rem 1rem;
    }

    /* ── Let the page scroll naturally ── */
    .main-wrapper {
        overflow: visible;
        height: auto;
        flex: none;
        padding-right: 0;
    }

    /* ── Product header: stack title, then search + sort ── */
    .product-header {
        padding-right: 0;
        margin-bottom: 0.5rem;
    }
    .product-header .row {
        flex-wrap: wrap;
        gap: 0.5rem;
        align-items: flex-start;
    }
    .product-header .column {
        flex: 0 0 100%;
    }
    .product-header h1 {
        font-size: clamp(24px, 7vw, 36px);
        line-height: 1.15;
    }
    .product-header h3 {
        font-size: clamp(12px, 3.5vw, 15px);
        margin-top: 2px;
    }
    .product-header hr {
        margin: 0.4rem 0;
    }

    .catalogue-searchbar {
        flex: 1 1 auto;
        margin: 0;
        --width-of-input: 100%;
        --height-of-input: 36px;
    }
    .sort-select {
        flex: 0 0 auto;
        margin: 0;
        font-size: 13px;
        padding: 7px 10px;
    }

    /* ── Product grid: 2 columns ── */
    .product-body {
        grid-template-columns: repeat(2, 1fr);
        grid-auto-rows: 250px;
        gap: 0.7rem;
        padding: 0.6rem 0 1.5rem;
    }
    .product-card { height: 250px; }
    .product-card .card-cover { height: 150px; }

    /* Touch: always show the cart button */
    .product-card .card-btn {
        opacity: 1;
        transform: translateY(0);
        font-size: 9px;
        padding: 5px;
    }
    /* Lift price above the always-visible btn */
    .product-card .card-price { bottom: 28px; left: unset; right: 10px;}

    /* Slightly smaller title on small cards */
    .product-card .card-title { font-size: 13px; }
    .product-card .card-author { font-size: 11px; }

    /* ── Pagination ── */
    .footer-pages {
        padding: 0.5rem 0 1.5rem;
        flex-wrap: wrap;
    }
    .page-btn {
        width: 36px;
        height: 36px;
        font-size: 14px;
    }
}

/* Slightly taller cards on bigger phones */
@media (min-width: 400px) and (max-width: 767px) {
    .product-body {
        grid-auto-rows: 245px;
    }
    .product-card { height: 245px; }
    .product-card .card-cover { height: 165px; }
    .product-card .card-price { bottom: 28px; }
}