/**
 * Gigatek Smart Filters — Styles
 *
 * Layout: sidebar (280px) + products area
 * Mobile: full-screen drawer overlay
 *
 * @package Gigatek\SmartFilters
 */

/* ───── Archive Layout ───── */
.gsf-archive-layout {
    display: flex;
    gap: 1.5rem;
    max-width: 1440px;
    margin: 0 auto;
    padding: 0 1rem;
    align-items: flex-start;
}

/* ───── Mobile Trigger ───── */
.gsf-mobile-trigger {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.625rem 1.25rem;
    background: #0b2a48;
    color: #fff;
    border: none;
    border-radius: 8px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    margin-bottom: 0.75rem;
    min-height: 44px;
    transition: background 0.15s;
}

.gsf-mobile-trigger:hover {
    background: #2e6194;
}

/* ───── Backdrop ───── */
.gsf-backdrop {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 998;
    opacity: 0;
    transition: opacity 0.25s ease;
}

.gsf-backdrop.gsf-open {
    display: block;
    opacity: 1;
}

/* ───── Sidebar ───── */
.gsf-sidebar {
    position: fixed;
    top: 0;
    left: -320px;
    width: min(300px, 90vw);
    height: 100dvh;
    background: #fff;
    z-index: 999;
    overflow-y: auto;
    transition: left 0.25s ease;
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
}

.gsf-sidebar.gsf-open {
    left: 0;
}

/* Desktop: static sidebar */
@media (min-width: 1024px) {
    .gsf-sidebar {
        position: sticky;
        top: 100px;
        left: auto;
        width: 280px;
        min-width: 280px;
        height: auto;
        max-height: calc(100vh - 120px);
        overflow-y: auto;
        z-index: 1;
        box-shadow: none;
        border: 1px solid #e2e8f0;
        border-radius: 12px;
        background: #fff;
        scrollbar-width: thin;
        scrollbar-color: #cbd5e1 transparent;
    }

    .gsf-mobile-trigger {
        display: none !important;
    }
}

.gsf-sidebar-inner {
    padding: 1rem;
}

/* ───── Sidebar Header ───── */
.gsf-sidebar-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding-bottom: 0.75rem;
    margin-bottom: 0.75rem;
    border-bottom: 1px solid #e8edf3;
}

.gsf-sidebar-title {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 1rem;
    font-weight: 700;
    color: #0b2a48;
    margin: 0;
    line-height: 1;
}

.gsf-close-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    cursor: pointer;
    border-radius: 6px;
    color: #64748b;
    transition: background 0.15s, color 0.15s;
}

.gsf-close-btn:hover {
    background: #f1f5f9;
    color: #0b2a48;
}

@media (min-width: 1024px) {
    .gsf-close-btn {
        display: none;
    }
}

/* ───── Active Chips ───── */
.gsf-active-chips {
    margin-bottom: 0.75rem;
    padding-bottom: 0.75rem;
    border-bottom: 1px solid #e8edf3;
}

.gsf-chips-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 0.5rem;
}

.gsf-chips-label {
    font-size: 0.6875rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: #64748b;
}

.gsf-reset-btn {
    font-size: 0.75rem;
    color: #ef4444;
    background: none;
    border: none;
    cursor: pointer;
    font-weight: 500;
    text-decoration: underline;
    text-underline-offset: 2px;
    padding: 0;
}

.gsf-reset-btn:hover {
    color: #dc2626;
}

.gsf-chips-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.375rem;
}

.gsf-chip {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.5rem;
    font-size: 0.75rem;
    line-height: 1;
    background: #e8edf3;
    color: #0b2a48;
    border: none;
    border-radius: 20px;
    cursor: pointer;
    transition: background 0.15s;
    white-space: nowrap;
}

.gsf-chip:hover {
    background: #fecaca;
    color: #dc2626;
}

.gsf-chip svg {
    flex-shrink: 0;
}

/* ───── Filter Group ───── */
.gsf-filter-group {
    border-bottom: 1px solid #f1f5f9;
}

.gsf-filter-group:last-child {
    border-bottom: none;
}

.gsf-group-toggle {
    display: flex;
    align-items: center;
    width: 100%;
    padding: 0.75rem 0;
    border: none;
    background: transparent;
    cursor: pointer;
    font-size: 0.875rem;
    font-weight: 600;
    color: #0b2a48;
    text-align: left;
    gap: 0.5rem;
}

.gsf-group-toggle:hover {
    color: #2e6194;
}

.gsf-group-toggle span:first-child {
    flex: 1;
}

.gsf-count-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 5px;
    background: #2e6194;
    color: #fff;
    border-radius: 10px;
    font-size: 0.6875rem;
    font-weight: 600;
    line-height: 1;
}

.gsf-chevron {
    flex-shrink: 0;
    transition: transform 0.2s ease;
    color: #94a3b8;
}

.gsf-group-toggle[aria-expanded="true"] .gsf-chevron {
    transform: rotate(180deg);
}

/* ───── Group Content — Collapsible ───── */
.gsf-group-content {
    overflow: hidden;
    max-height: 600px;
    transition: max-height 0.25s ease, opacity 0.2s ease, padding 0.25s ease;
    opacity: 1;
    padding-bottom: 0.75rem;
}

.gsf-group-content.collapsed {
    max-height: 0;
    opacity: 0;
    padding-bottom: 0;
    pointer-events: none;
}

/* ───── Sorting Radios ───── */
.gsf-sort-list {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
}

.gsf-sort-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8125rem;
    color: #334155;
    transition: background 0.15s;
}

.gsf-sort-label:hover {
    background: #f1f5f9;
}

.gsf-sort-label input[type="radio"] {
    accent-color: #2e6194;
    width: 14px;
    height: 14px;
    margin: 0;
}

/* ───── Price Slider ───── */
.gsf-price-slider {
    padding: 0 0.25rem;
}

.gsf-price-inputs {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-bottom: 0.75rem;
}

.gsf-price-input-wrap {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    padding: 0.375rem 0.5rem;
}

.gsf-price-currency {
    font-size: 0.8125rem;
    font-weight: 600;
    color: #64748b;
}

.gsf-price-input {
    width: 100%;
    border: none;
    background: transparent;
    font-size: 0.8125rem;
    color: #0b2a48;
    font-weight: 500;
    outline: none;
    -moz-appearance: textfield;
}

.gsf-price-input::-webkit-outer-spin-button,
.gsf-price-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.gsf-price-sep {
    color: #94a3b8;
    font-weight: 500;
}

/* Range track */
.gsf-range-track {
    position: relative;
    height: 6px;
    background: #e2e8f0;
    border-radius: 3px;
    margin: 0.5rem 0;
}

.gsf-range-fill {
    position: absolute;
    top: 0;
    height: 100%;
    background: linear-gradient(90deg, #2e6194, #0b2a48);
    border-radius: 3px;
    pointer-events: none;
}

.gsf-range-input {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: transparent;
    pointer-events: none;
    margin: 0;
}

.gsf-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 18px;
    height: 18px;
    background: #fff;
    border: 2px solid #2e6194;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: transform 0.15s, box-shadow 0.15s;
}

.gsf-range-input::-webkit-slider-thumb:hover {
    transform: scale(1.15);
    box-shadow: 0 2px 8px rgba(46, 97, 148, 0.3);
}

.gsf-range-input::-moz-range-thumb {
    width: 18px;
    height: 18px;
    background: #fff;
    border: 2px solid #2e6194;
    border-radius: 50%;
    cursor: pointer;
    pointer-events: auto;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

/* ───── Checkboxes ───── */
.gsf-checkbox-list {
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.gsf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.5rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 0.8125rem;
    color: #334155;
    transition: background 0.12s;
    user-select: none;
}

.gsf-checkbox-label:hover {
    background: #f1f5f9;
}

.gsf-checkbox-label input[type="checkbox"] {
    display: none;
}

.gsf-checkmark {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    border: 1.5px solid #cbd5e1;
    border-radius: 4px;
    background: #fff;
    transition: all 0.15s ease;
}

.gsf-checkbox-label input:checked + .gsf-checkmark {
    background: #2e6194;
    border-color: #2e6194;
}

.gsf-checkbox-label input:checked + .gsf-checkmark::after {
    content: '';
    display: block;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translateY(-1px);
}

.gsf-term-name {
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ───── Term Search ───── */
.gsf-search-wrap {
    margin-bottom: 0.5rem;
}

.gsf-term-search {
    width: 100%;
    padding: 0.375rem 0.5rem;
    border: 1px solid #e2e8f0;
    border-radius: 6px;
    font-size: 0.8125rem;
    color: #334155;
    background: #f8fafc;
    outline: none;
    transition: border-color 0.15s;
}

.gsf-term-search:focus {
    border-color: #2e6194;
}

/* ───── Products Wrap ───── */
.gsf-products-wrap {
    flex: 1;
    min-width: 0;
    position: relative;
    transition: opacity 0.15s ease;
}

.gsf-products-wrap.gsf-loading {
    opacity: 0.4;
    pointer-events: none;
}

.gsf-products-wrap.gsf-loading::after {
    content: '';
    position: absolute;
    top: 120px;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 32px;
    border: 3px solid #e2e8f0;
    border-top-color: #2e6194;
    border-radius: 50%;
    animation: gsf-spin 0.6s linear infinite;
    z-index: 10;
}

@keyframes gsf-spin {
    to { transform: translateX(-50%) rotate(360deg); }
}

/* ───── No Results ───── */
.gsf-no-results {
    font-size: 1rem;
    color: #64748b;
}

/* ───── Pagination override ───── */
.woocommerce-pagination {
    margin-top: 1.5rem;
}

/* ───── Print ───── */
@media print {
    .gsf-sidebar,
    .gsf-mobile-trigger,
    .gsf-backdrop {
        display: none !important;
    }
}
