/**
 * Filter Sidebar - Modern E-commerce Design
 * Smooth slide-in/out animations with grid layout
 * Mobile-first approach
 */

/* ============================================================================
   FILTER TOGGLE BUTTON
   ========================================================================== */

/* Shop Controls - Filter toggle + Ordering row */
.shop-controls {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 1rem;
    margin-bottom: 1.5rem;
}

.shop-controls .woocommerce-ordering {
    margin: 0;
    width: auto;
    flex-shrink: 0;
}

.filter-toggle-wrapper {
    flex-shrink: 0;
}

.filter-toggle-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.625rem;
    padding: 0.75rem 1.25rem;
    background: white;
    border: 1.5px solid var(--dark-grey);
    border-radius: 24px;
    font-family: var(--font-display);
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--dark-grey);
    cursor: pointer;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-toggle-btn:hover {
    background: var(--dark-grey);
    color: white;
    transform: translateY(-1px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.filter-toggle-btn:active {
    transform: translateY(0);
}

.filter-toggle-icon {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
}

.filter-toggle-text .hide-text {
    display: none;
}

.filter-toggle-btn[aria-expanded="true"] .show-text {
    display: none;
}

.filter-toggle-btn[aria-expanded="true"] .hide-text {
    display: inline;
}

/* ============================================================================
   SHOP LAYOUT - FLEXIBLE GRID
   ========================================================================== */

.shop-layout {
    display: grid;
    grid-template-columns: 1fr;
    gap: 0;
    position: relative;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* When filters are active - Mobile: overlay mode */
.shop-layout.filters-active {
    /* On mobile, sidebar overlays the content */
}

/* ============================================================================
   FILTER SIDEBAR - MOBILE (OVERLAY)
   ========================================================================== */

.filter-sidebar {
    position: fixed;
    top: 0;
    left: 0;
    bottom: 0;
    width: 85%;
    max-width: 320px;
    background: white;
    z-index: 1000;
    overflow-y: auto;
    box-shadow: 2px 0 16px rgba(0, 0, 0, 0.15);
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.filter-sidebar[aria-hidden="false"] {
    transform: translateX(0);
}

/* Backdrop for mobile */
.shop-layout.filters-active::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.5);
    z-index: 999;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.shop-layout.filters-active .filter-sidebar[aria-hidden="false"] ~ * {
    /* Show backdrop when sidebar is open on mobile */
}

.shop-layout.filters-active::before {
    opacity: 1;
    pointer-events: auto;
}

/* ============================================================================
   FILTER SIDEBAR HEADER
   ========================================================================== */

.filter-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1.5rem;
    border-bottom: 1px solid #e9ecef;
    position: sticky;
    top: 0;
    background: white;
    z-index: 10;
}

.filter-sidebar-title {
    font-family: var(--font-heading);
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--dark-grey);
    margin: 0;
}

.filter-sidebar-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    background: transparent;
    border: none;
    border-radius: 50%;
    color: var(--dark-grey);
    cursor: pointer;
    transition: all 0.3s ease;
}

.filter-sidebar-close:hover {
    background: #f8f9fa;
    color: var(--forest-green);
}

/* ============================================================================
   FILTER SIDEBAR CONTENT
   ========================================================================== */

.filter-sidebar-content {
    padding: 1.5rem;
}

/* ============================================================================
   SHOP MAIN (PRODUCT GRID AREA)
   ========================================================================== */

.shop-main {
    display: block;
    width: 100%;
    min-width: 0;
    transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ============================================================================
   TABLET (768px+) - Keep overlay mode
   ========================================================================== */

@media (min-width: 768px) {
    .filter-sidebar {
        max-width: 380px;
    }
}

/* ============================================================================
   DESKTOP (1024px+) - SIDE-BY-SIDE LAYOUT
   ========================================================================== */

@media (min-width: 1024px) {
    .shop-layout {
        grid-template-columns: 0 1fr;
        gap: 0;
        align-items: start;
    }

    .shop-layout.filters-active {
        grid-template-columns: 280px 1fr;
        gap: 2rem;
    }

    /* Sidebar transforms to inline position */
    .filter-sidebar {
        position: sticky;
        top: 2rem;
        left: auto;
        bottom: auto;
        width: 280px;
        max-width: none;
        height: auto;
        max-height: calc(100vh - 4rem);
        box-shadow: none;
        border: 1px solid #e9ecef;
        border-radius: 12px;
        overflow: hidden;
        transform: translateX(0);
        opacity: 0;
        visibility: hidden;
        transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .filter-sidebar[aria-hidden="false"] {
        opacity: 1;
        visibility: visible;
    }

    .filter-sidebar-content {
        overflow-y: auto;
        max-height: calc(100vh - 8rem);
    }

    /* Remove backdrop on desktop */
    .shop-layout::before {
        display: none;
    }

    /* Close button hidden on desktop (filters stay open) */
    .filter-sidebar-close {
        display: none;
    }

    .filter-sidebar-header {
        padding: 1.25rem 1.5rem;
    }
}

/* ============================================================================
   LARGE DESKTOP (1440px+)
   ========================================================================== */

@media (min-width: 1440px) {
    .shop-layout.filters-active {
        grid-template-columns: 320px 1fr;
        gap: 2.5rem;
    }

    .shop-layout.filters-active .filter-sidebar {
        width: 320px;
    }
}
