/**
 * Universal Smart Filter — Popup / Off-Canvas Premium Styles
 *
 * Designed using Google Stitch for the 'Bharat Pansari' Premium App Design.
 * Layout: Strict Two-Column Tabbed Layout (Left Tab Nav, Right Content Pane).
 * Features: Plus Jakarta Sans typography, Emerald Green (#10B981) primary colors,
 * Accent Orange (#FF7A00) badges, rounded cards (20px), and soft glassmorphism.
 *
 * @package Universal_Smart_Filter
 * @since   2.2.0
 */

@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

/* ==========================================================================
   # Design System & Font Overrides
   ========================================================================== */
.usf-popup-panel,
.usf-popup-trigger {
    font-family: 'Plus Jakarta Sans', sans-serif !important;
}

/* ==========================================================================
   # Trigger Button
   ========================================================================== */
.usf-popup-trigger {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 5px 10px;
    border: 1.5px solid #bbcabf;
    border-radius: 100px; /* Pill shape */
    background: #ffffff;
    color: #161d19;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0px 4px 10px rgba(15, 23, 42, 0.04);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    -webkit-appearance: none;
    appearance: none;
    outline: none;
    position: relative;
}

.usf-popup-trigger:hover {
    border-color: #10b981;
    background: #f4fbf4;
    transform: translateY(-2px);
    box-shadow: 0px 8px 16px rgba(16, 185, 129, 0.12);
}

.usf-popup-trigger svg {
    flex-shrink: 0;
    stroke: #10b981;
}

/* Active filter count badge on trigger */
.usf-popup-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 20px;
    height: 20px;
    padding: 0 6px;
    border-radius: 10px;
    background: #fb7800; /* Vibrant Zest Orange */
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(251, 120, 0, 0.3);
}

/* ==========================================================================
   # Overlay (backdrop)
   ========================================================================== */
.usf-popup-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(22, 29, 25, 0.4); /* Dark muted slate */
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    z-index: 2147483646;
    opacity: 0;
    transition: opacity 0.35s ease;
}

.usf-popup-overlay.usf-popup-active {
    opacity: 1;
}

/* ==========================================================================
   # Panel — Mobile-first: Bottom Sheet (0–767px)
   ========================================================================== */
.usf-popup-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    width: 100%;
    height: 600px;
    max-height: 80vh;
    background: #ffffff;
    z-index: 2147483647;
    display: flex;
    flex-direction: column;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1);
    box-shadow: 0 -10px 40px rgba(15, 23, 42, 0.15);
    overflow: hidden;
}

.usf-popup-panel.usf-popup-active {
    transform: translateY(0);
}

/* ==========================================================================
   # Panel Header (Glassmorphic)
   ========================================================================== */
.usf-popup-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 18px 24px;
    background: rgba(255, 255, 255, 0.85);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-bottom: 1.5px solid rgba(187, 202, 191, 0.25);
    flex-shrink: 0;
    position: relative;
    z-index: 10;
}

.usf-popup-title {
    margin: 0;
    font-size: 20px;
    font-weight: 600;
    color: #0f172a; /* Deep Slate */
    letter-spacing: -0.02em;
}

.usf-popup-close {
    background: #e8f0e9;
    border: none;
    font-size: 22px;
    line-height: 1;
    color: #3c4a42;
    cursor: pointer;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    transition: all 0.2s ease;
}

.usf-popup-close:hover {
    background: #bbcabf;
    color: #161d19;
    transform: rotate(90deg);
}

/* ==========================================================================
   # Panel Body (Two-Column Flexbox Layout)
   ========================================================================== */
.usf-popup-body {
    display: flex;
    flex-direction: row;
    flex: 1;
    height: calc(100% - 69px - 88px); /* Height locked between header and footer */
    padding: 0 !important;
    overflow: hidden;
}

/* ==========================================================================
   # Left Tab Navigation (32% width, slate bg)
   ========================================================================== */
.usf-tab-nav {
    width: 25%;
    flex-shrink: 0;
    background: #f8fafc; /* Premium light slate */
    border-right: 1.5px solid rgba(187, 202, 191, 0.25);
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    scrollbar-width: none; /* Hide Firefox scrollbar */
}

.usf-tab-nav::-webkit-scrollbar {
    display: none; /* Hide Chrome/Safari scrollbar */
}

.usf-tab-trigger {
    width: 100%;
    border: none;
    background: transparent;
    padding: 18px 5px;
    text-align: left;
    font-size: 13px;
    font-weight: 600;
    color: #3c4a42;
    cursor: pointer;
    border-left: 4px solid transparent;
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
    outline: none !important;
    box-shadow: none !important;
    -webkit-appearance: none;
    appearance: none;
}

.usf-tab-trigger:hover {
    background: rgba(16, 185, 129, 0.04);
    color: #161d19;
}

.usf-tab-trigger.usf-active {
    background: #ffffff;
    color: #10b981; /* Primary Emerald Green */
    font-weight: 800;
    border-left: 4px solid #10b981; /* Left Green Border Indicator */
}

/* ==========================================================================
   # Right Tab Content Panes (68% width, scrollable, white bg)
   ========================================================================== */
.usf-tab-content {
    width: 75%;
    background: #ffffff;
    display: flex;
    flex-direction: column;
    overflow-y: auto;
    height: 100%;
    scrollbar-width: none;
}

.usf-tab-content::-webkit-scrollbar {
    display: none;
}

.usf-tab-pane {
    display: none;
    padding: 24px 20px 40px; /* Generous top/bottom padding inside scrollable area */
    animation: usfFadeIn 0.35s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.usf-tab-pane.usf-active {
    display: block;
}

@keyframes usfFadeIn {
    from { opacity: 0; transform: translateY(6px); }
    to { opacity: 1; transform: translateY(0); }
}

.usf-pane-title {
    margin: 0 0 20px 0;
    font-size: 11px;
    font-weight: 600;
    color: #8b9d90; /* Soft sub-header label */
    text-transform: uppercase;
    letter-spacing: 0.08em;
}

/* ==========================================================================
   # Inside-Pane Components Styling
   ========================================================================== */

/* Sort By Section */
.usf-sort-chips {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.usf-sort-chip {
    padding: 14px 18px;
    background: #f8fafc;
    border: 1.5px solid rgba(187, 202, 191, 0.15);
    color: #3c4a42;
    border-radius: 14px;
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    text-align: left;
    transition: all 0.2s ease;
    width: 100%;
}

.usf-sort-chip:hover {
    background: #e8f0e9;
    color: #161d19;
}

.usf-sort-chip.usf-active {
    background: #f4fbf4;
    border-color: #10b981;
    color: #10b981;
    font-weight: 700;
    box-shadow: 0px 4px 12px rgba(16, 185, 129, 0.08);
}

/* Checkbox Lists */
.usf-facet-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.usf-checkbox-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1.5px solid rgba(187, 202, 191, 0.15);
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #0f172a;
    font-weight: 500;
}

.usf-checkbox-label:hover {
    background: #f4fbf4;
    border-color: rgba(16, 185, 129, 0.3);
}

.usf-checkbox-label:has(.usf-facet-checkbox:checked) {
    background: #f4fbf4;
    border-color: #10b981;
    font-weight: 700;
}

.usf-facet-checkbox {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: #10b981;
    border-radius: 6px;
    cursor: pointer;
    border: 1.5px solid #bbcabf;
    transition: all 0.15s ease;
}

.usf-checkbox-text {
    flex: 1;
}

.usf-checkbox-count {
    font-size: 11px;
    font-weight: 800;
    padding: 3px 8px;
    border-radius: 100px;
    background: #e8f0e9;
    color: #3c4a42;
}

.usf-checkbox-label:hover .usf-checkbox-count {
    background: #10b981;
    color: #ffffff;
}

.usf-checkbox-label:has(.usf-facet-checkbox:checked) .usf-checkbox-count {
    background: #fb7800;
    color: #ffffff;
}

/* Price Range Inputs */
.usf-price-inputs {
    display: flex;
    flex-direction: column;
    gap: 16px;
}

.usf-price-inputs .usf-price-min-wrapper,
.usf-price-inputs .usf-price-max-wrapper {
    background: #ffffff;
    border: 1.5px solid rgba(187, 202, 191, 0.4);
    border-radius: 16px;
    padding: 10px 16px;
    transition: all 0.25s ease;
}

.usf-price-inputs .usf-price-min-wrapper:focus-within,
.usf-price-inputs .usf-price-max-wrapper:focus-within {
    border-color: #10b981;
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.usf-price-inputs label {
    display: block;
    font-size: 9px;
    font-weight: 800;
    color: #3c4a42;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    margin-bottom: 4px;
}

.usf-price-min,
.usf-price-max {
    width: 100%;
    border: none !important;
    background: transparent;
    padding: 0;
    font-size: 16px;
    font-weight: 700;
    color: #0f172a;
    outline: none;
    box-shadow: none !important;
}

.usf-price-separator {
    display: none; /* Hide visual dash in vertical column price layout */
}

/* Rating Radios */
.usf-rating-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.usf-radio-label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 16px;
    border-radius: 14px;
    border: 1.5px solid rgba(187, 202, 191, 0.15);
    background: #ffffff;
    cursor: pointer;
    transition: all 0.2s ease;
    font-size: 14px;
    color: #0f172a;
    font-weight: 500;
}

.usf-radio-label:hover {
    background: #f4fbf4;
    border-color: rgba(16, 185, 129, 0.3);
}

.usf-radio-label:has(.usf-rating-radio:checked) {
    background: #f4fbf4;
    border-color: #10b981;
    font-weight: 700;
}

.usf-rating-radio {
    width: 20px;
    height: 20px;
    flex-shrink: 0;
    accent-color: #10b981;
    cursor: pointer;
    border: 1.5px solid #bbcabf;
    transition: all 0.15s ease;
}

.usf-rating-stars {
    color: #fb7800; /* Active badge orange */
    font-size: 15px;
    letter-spacing: 1px;
    line-height: 1;
}

.usf-radio-label:has(.usf-rating-radio:checked) .usf-rating-stars {
    color: #fb7800;
}

.usf-rating-text {
    font-size: 13px;
    font-weight: 600;
    color: #3c4a42;
    margin-left: auto;
}

/* ==========================================================================
   # Panel Footer (Sticky edge-to-edge footer)
   ========================================================================== */
.usf-popup-footer {
    display: flex;
    gap: 12px;
    padding: 18px 24px;
    background: #ffffff;
    border-top: 1.5px solid rgba(187, 202, 191, 0.25);
    position: relative;
    z-index: 15;
    flex-shrink: 0;
}

.usf-popup-clear {
    flex: 1;
    padding: 14px 20px;
    border: 1.5px solid #bbcabf;
    border-radius: 16px;
    background: #ffffff;
    color: #3c4a42;
    font-size: 14px;
    font-weight: 700;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 10px rgba(15, 23, 42, 0.04);
}

.usf-popup-clear:hover {
    border-color: #0f172a;
    background: #f4fbf4;
    color: #0f172a;
}

.usf-popup-apply {
    flex: 2;
    padding: 14px 20px;
    border: none;
    border-radius: 16px;
    background: #10b981; /* Premium Emerald */
    color: #ffffff;
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 12px;
    box-shadow: 0px 10px 24px rgba(16, 185, 129, 0.25);
    transition: all 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.usf-popup-apply:hover {
    background: #006c49;
    transform: translateY(-2px);
    box-shadow: 0px 14px 30px rgba(16, 185, 129, 0.35);
}

.usf-popup-apply:active {
    transform: translateY(0);
}

/* Badge inside apply button */
.usf-popup-apply .usf-apply-badge {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: #fb7800; /* Accent Orange */
    color: #ffffff;
    font-size: 11px;
    font-weight: 900;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(251, 120, 0, 0.4);
}

/* ==========================================================================
   # Tablet: Right Side Panel (768px – 1024px)
   ========================================================================== */
@media ( min-width: 768px ) {
    .usf-popup-panel {
        top: 0;
        bottom: 0;
        right: 0;
        left: auto;
        width: 420px; /* Slightly wider to easily accommodate two columns */
        max-width: 95vw;
        height: 100%;
        max-height: none;
        border-radius: 0;
        transform: translateX( 100% );
        box-shadow: -10px 0 40px rgba( 15, 23, 42, 0.15 );
    }

    .usf-popup-panel.usf-popup-active {
        transform: translateX( 0 );
    }
    
    .usf-popup-body {
        height: calc(100% - 69px - 88px);
    }
}

/* ==========================================================================
   # Desktop+: Center Floating Modal (1025px+)
   ========================================================================== */
@media ( min-width: 1025px ) {
    .usf-popup-panel {
        top: 50%;
        left: 50%;
        right: auto;
        bottom: auto;
        width: 520px; /* Slightly wider */
        max-width: 95vw;
        height: 520px;
        max-height: 85vh;
        border-radius: 24px;
        transform: translate( -50%, -45% ) scale( 0.96 );
        opacity: 0;
        box-shadow: 0 30px 70px rgba(15, 23, 42, 0.18);
    }

    .usf-popup-panel.usf-popup-active {
        transform: translate( -50%, -50% ) scale( 1 );
        opacity: 1;
    }
    
    .usf-popup-body {
        height: calc(100% - 69px - 88px);
    }
}
