/* ===========================
   PRODUCTS PAGE
   =========================== */

.products-page {
    padding-top: 35px;
    padding-bottom: 80px;
}

.products-page-title {
    margin-bottom: 81px;
    color: #1a1a1a;
}

/* ===========================
   LAYOUT: sidebar + main
   =========================== */

.products-layout {
    display: grid;
    grid-template-columns: 240px 1fr;
    gap: 40px;
    align-items: start;
}

/* ===========================
   SIDEBAR FILTERS
   =========================== */

.products-sidebar {
    position: sticky;
    top: 140px;
    max-height: calc(100vh - 160px);
    overflow-y: auto;
    padding-right: 8px;
}

/* Sidebar header */
.sf-header {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin-bottom: 32px;
}

.sf-header-title {
    font-size: 1.1rem;
    font-weight: 700;
    color: #1a1a1a;
    text-transform: uppercase;
    letter-spacing: .06em;
}

.sf-reset-link {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    font-size: .9rem;
    color: #888;
    text-decoration: none;
    transition: color .15s;
}

.sf-reset-link:hover {
    color: #1a1a1a;
}

/* Active filter tags */
.sf-active-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 20px;
}

.sf-tag {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 4px 10px;
    border-radius: 6px;
    border: 1px solid #d0d0d0;
    background: #f0f0f0;
    font-size: .9rem;
    font-weight: 400;
    color: #333;
    cursor: pointer;
    transition: background .15s, border-color .15s;
    line-height: 1.5;
}

.sf-tag:hover {
    background: #e0e0e0;
    border-color: #bbb;
}

.sf-tag-x {
    font-size: .6rem;
    opacity: .5;
    order: -1;
}

.sf-section {
    margin-bottom: 24px;
}

.sf-section:last-child {
    margin-bottom: 0;
}

.sf-title {
    font-size: .9rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .06em;
    color: #1a1a1a;
    margin-bottom: 12px;
}

.sf-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.sf-check {
    margin: 0;
}

.sf-input {
    cursor: pointer;
}

.sf-label {
    font-size: 1rem;
    color: #333;
    cursor: pointer;
}

.sf-count {
    font-size: .8rem;
    color: #999;
    margin-left: 2px;
}

.sf-disabled {
    opacity: .35;
    pointer-events: none;
}

.sf-disabled .sf-label {
    cursor: default;
}

/* Show more button */
.sf-show-more-btn {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    padding: 4px 0;
    margin-top: 6px;
    font-size: .9rem;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: .04em;
    color: #1a1a1a;
    cursor: pointer;
}

.sf-show-more-btn:hover {
    opacity: .7;
}

.sf-sm-chevron {
    font-size: .8rem;
    transition: transform .2s ease;
}

.sf-sm-chevron.rotated {
    transform: rotate(180deg);
}

/* Tutti i filtri button */
.sf-tutti-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    padding: 0;
    font-size: .85rem;
    font-weight: 600;
    text-decoration: underline;
    text-underline-offset: 3px;
    color: #1a1a1a;
    cursor: pointer;
    margin-bottom: 20px;
}

.sf-tutti-chevron {
    transition: transform .2s ease;
    font-size: .8rem;
}

.sf-tutti-chevron.rotated {
    transform: rotate(180deg);
}

.sf-extra .sf-section:first-child {
    margin-top: 20px;
    padding-top: 0;
}

/* ===========================
   PRODUCTS MAIN AREA
   =========================== */

.products-main {
    min-width: 0;
}

/* Products grid — 3 cols within main area */
.products-grid {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.products-grid .cp-card {
    width: 100%;
}

/* Pagination */
.products-pagination {
    margin-top: 48px;
    display: flex;
    justify-content: center;
}

/* ===========================
   MOBILE DRAWER
   =========================== */

.sf-mobile-trigger {
    display: none;
}

.sf-drawer-header,
.sf-drawer-footer,
.sf-drawer-cancel-top {
    display: none;
}

.sf-drawer-body {
    /* on desktop: no wrapper styles needed, sidebar handles scroll */
}

.sf-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.45);
    z-index: 1050;
}

.sf-backdrop.sf-open {
    display: block;
}

/* ===========================
   RESPONSIVE
   =========================== */

@media (max-width: 1199px) {
    .products-layout {
        grid-template-columns: 210px 1fr;
        gap: 28px;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 991px) {
    .products-page-title {
        margin-bottom: 32px;
    }

    .products-layout {
        grid-template-columns: 1fr;
    }

    /* Sidebar becomes a fixed drawer */
    .products-sidebar {
        position: fixed;
        top: 0;
        right: 0;
        width: 420px;
        max-width: 100vw;
        height: 100vh;
        z-index: 1060;
        background: #fff;
        display: flex;
        flex-direction: column;
        transform: translateX(100%);
        transition: transform .3s ease;
        overflow: hidden;
        padding: 0;
        max-height: none;
    }

    .products-sidebar.sf-open {
        transform: translateX(0);
    }

    /* Drawer header */
    .sf-drawer-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 28px 24px 20px;
        flex-shrink: 0;
    }

    .sf-drawer-title {
        color: #1a1a1a;
    }

    .sf-drawer-close {
        background: none;
        border: none;
        color: #1a1a1a;
        cursor: pointer;
        padding: 0;
        line-height: 1;
        display: flex;
        align-items: center;
        justify-content: center;
        width: 20px;
        height: 20px;
        flex-shrink: 0;
    }

    /* Scrollable body */
    .sf-drawer-body {
        flex: 1;
        overflow-y: auto;
        padding: 0 24px 32px;
    }

    /* Desktop sidebar header hidden inside drawer (drawer header replaces it) */
    .sf-drawer-body .sf-header {
        display: none;
    }

    .sf-drawer-cancel-top {
        display: inline-flex;
        margin-bottom: 12px;
    }

    /* Mobile trigger button */
    .sf-mobile-trigger {
        display: inline-flex;
        align-items: center;
        gap: 8px;
        height: 44px;
        padding: 0 19px;
        border-radius: 10px;
        border: 1px solid #1a1a1a;
        background: transparent;
        font-size: 1rem;
        font-weight: 500;
        color: #1a1a1a;
        cursor: pointer;
        margin-bottom: 20px;
        transition: background .15s;
        width: auto;
        justify-self: start;
    }

    .sf-mobile-trigger:hover {
        background: #f5f5f5;
    }

    .sf-trigger-count {
        font-weight: 400;
        color: #666;
    }

    .products-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 620px) {
    .products-sidebar {
        grid-template-columns: 1fr;
    }

    .sf-extra {
        grid-template-columns: 1fr !important;
    }

    .products-grid {
        grid-template-columns: 1fr;
    }

    .products-grid .cp-card {
        max-width: 340px;
        margin: 0 auto;
    }
}
