/**
 * VapeShop Smart Filter v3.5.0 — Stylesheet
 *
 * Designed to match WoodMart native widget styling exactly:
 *   - White sidebar background (#fff)
 *   - Sharp corners (0px border-radius globally)
 *   - Lato body / Poppins headings
 *   - Accent: #daaf48 (golden amber)
 *   - Text: #333 primary, #767676 secondary
 *   - Borders: rgba(0,0,0,0.105)
 *   - Form border: rgba(0,0,0,0.15)
 *
 * v3.5.0: Added sticky action bar with Apply Filters / Clear buttons.
 */

/* ================================================================
 *  Root container
 * ============================================================== */

.vsf-filter-root {
    font-family: "Lato", Arial, Helvetica, sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: #333;
}

/* ================================================================
 *  Panel — always visible (no toggle needed)
 * ============================================================== */

.vsf-panel {
    background: transparent;
}

/* Hide our mobile toggle — WoodMart handles it */
.vsf-mobile-toggle {
    display: none !important;
}

/* ================================================================
 *  Active Filters Bar (pills)
 * ============================================================== */

.vsf-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    padding: 0 0 15px;
    margin-bottom: 15px;
    border-bottom: 1px solid rgba(0,0,0,0.105);
}

.vsf-pill {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 12px;
    background: #daaf48;
    color: #fff;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: background 0.2s;
}

.vsf-pill:hover {
    background: #c49a30;
}

.vsf-pill-x {
    font-size: 13px;
    line-height: 1;
    font-weight: 700;
    opacity: 0.8;
}

.vsf-pill-x:hover {
    opacity: 1;
}

.vsf-clear-all {
    padding: 5px 12px;
    background: none;
    border: 1px solid rgba(0,0,0,0.15);
    color: #767676;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.02em;
    cursor: pointer;
    transition: all 0.2s;
}

.vsf-clear-all:hover {
    border-color: #daaf48;
    color: #daaf48;
}

/* ================================================================
 *  Section — each filter group
 *  Matches WoodMart: widget-title with border-bottom separator
 * ============================================================== */

.vsf-section {
    margin-bottom: 5px;
    padding-bottom: 5px;
}

.vsf-section:last-of-type {
    margin-bottom: 0;
}

/* Section header — matches WoodMart widget title exactly */
.vsf-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 0 10px;
    margin-bottom: 10px;
    border-bottom: 1px solid rgba(0,0,0,0.105);
    cursor: pointer;
    user-select: none;
}

.vsf-section-title {
    font-family: "Poppins", Arial, Helvetica, sans-serif;
    font-size: 14px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    color: #242424;
}

.vsf-section-header:hover .vsf-section-title {
    color: #daaf48;
}

.vsf-section-arrow {
    font-size: 9px;
    color: #999;
    transition: transform 0.3s ease;
    display: inline-block;
    line-height: 1;
}

.vsf-arrow-up {
    transform: rotate(180deg);
}

/* Section body (collapsible) */
.vsf-section-body {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease;
}

.vsf-section-body--open {
    max-height: 2000px;
    overflow: visible;
}

/* ================================================================
 *  Filter lists — matches WoodMart checkbox widgets
 * ============================================================== */

.vsf-list {
    list-style: none;
    margin: 0;
    padding: 0;
}

.vsf-sublist {
    list-style: none;
    margin: 0;
    padding: 0 0 0 20px;
}

.vsf-item {
    margin: 0;
    padding: 0;
}

.vsf-item label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 4px 0;
    cursor: pointer;
    font-size: 13px;
    font-weight: 400;
    color: #333;
    line-height: 1.5;
    transition: color 0.15s;
}

.vsf-item label:hover {
    color: #daaf48;
}

.vsf-item--child label {
    font-size: 12px;
    padding: 3px 0;
    color: #555;
}

/* Custom checkbox — matches WoodMart native checkboxes */
.vsf-item input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 14px;
    height: 14px;
    min-width: 14px;
    border: 1px solid rgba(0,0,0,0.2);
    border-radius: 2px;
    background: #fff;
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    margin: 0;
    flex-shrink: 0;
}

.vsf-item input[type="checkbox"]:checked {
    background: #daaf48;
    border-color: #daaf48;
}

.vsf-item input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    top: 1px;
    left: 4px;
    width: 4px;
    height: 8px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
}

.vsf-item input[type="checkbox"]:hover {
    border-color: #daaf48;
}

/* Count badge — matches WoodMart count styling */
.vsf-count {
    color: #767676;
    font-size: 13px;
    font-weight: 400;
    margin-left: auto;
    white-space: nowrap;
}

/* ================================================================
 *  Search within filter — matches WoodMart search input
 * ============================================================== */

.vsf-search-input {
    width: 100%;
    height: 38px;
    padding: 0 12px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 0;
    color: #333;
    font-family: inherit;
    font-size: 13px;
    margin-bottom: 10px;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.vsf-search-input:focus {
    border-color: rgba(0,0,0,0.3);
}

.vsf-search-input::placeholder {
    color: rgba(0,0,0,0.4);
}

/* ================================================================
 *  Show More / Show Less
 * ============================================================== */

.vsf-show-more {
    display: block;
    width: 100%;
    padding: 8px 0;
    margin-top: 2px;
    background: #f7f7f7;
    border: none;
    border-top: 1px solid rgba(0,0,0,0.06);
    color: #333;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.03em;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.vsf-show-more:hover {
    background: #eee;
    color: #daaf48;
}

/* ================================================================
 *  Price Range Slider
 * ============================================================== */

.vsf-price-range {
    padding: 4px 0 0;
}

.vsf-price-display {
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 13px;
    color: #333;
    font-weight: 400;
    margin-bottom: 14px;
}

.vsf-price-display span {
    font-weight: 600;
    color: #daaf48;
}

.vsf-price-sliders {
    position: relative;
    height: 30px;
}

.vsf-price-slider {
    position: absolute;
    width: 100%;
    top: 8px;
    pointer-events: none;
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    background: transparent;
    outline: none;
    margin: 0;
    padding: 0;
}

.vsf-price-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #daaf48;
    cursor: pointer;
    pointer-events: all;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
    position: relative;
    z-index: 2;
}

.vsf-price-slider::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #daaf48;
    cursor: pointer;
    pointer-events: all;
    border: 2px solid #fff;
    box-shadow: 0 1px 3px rgba(0,0,0,0.25);
}

.vsf-price-min {
    z-index: 3;
}

.vsf-price-slider::-webkit-slider-runnable-track {
    height: 4px;
    background: #e0e0e0;
    border-radius: 4px;
}

.vsf-price-slider::-moz-range-track {
    height: 4px;
    background: #e0e0e0;
    border-radius: 4px;
}

/* ================================================================
 *  Sort Select — matches WoodMart form inputs
 * ============================================================== */

.vsf-sort-select {
    width: 100%;
    height: 42px;
    padding: 0 30px 0 12px;
    background: #fff;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 0;
    color: #333;
    font-family: inherit;
    font-size: 13px;
    outline: none;
    cursor: pointer;
    transition: border-color 0.2s;
    -webkit-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath fill='%23333' d='M5 6L0 0h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    background-size: 10px 6px;
}

.vsf-sort-select:focus {
    border-color: rgba(0,0,0,0.3);
}

.vsf-sort-select option {
    background: #fff;
    color: #333;
}

/* ================================================================
 *  Reset / Clear All Filters button
 * ============================================================== */

.vsf-reset-wrap {
    padding: 15px 0 5px;
}

.vsf-reset-btn {
    display: block;
    width: 100%;
    padding: 10px 15px;
    background: #f7f7f7;
    border: 1px solid rgba(0,0,0,0.15);
    border-radius: 0;
    color: #333;
    font-family: inherit;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.05em;
    text-align: center;
    cursor: pointer;
    transition: all 0.2s;
}

.vsf-reset-btn:hover {
    background: #daaf48;
    border-color: #daaf48;
    color: #fff;
}

/* ================================================================
 *  Loading Overlay
 * ============================================================== */

.vsf-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 99;
}

.vsf-spinner {
    width: 28px;
    height: 28px;
    border: 3px solid #e0e0e0;
    border-top-color: #daaf48;
    border-radius: 50%;
    animation: vsf-spin 0.7s linear infinite;
}

@keyframes vsf-spin {
    to { transform: rotate(360deg); }
}

/* ================================================================
 *  No Results
 * ============================================================== */

.vsf-no-results {
    text-align: center;
    padding: 40px 20px;
    color: #767676;
    font-size: 14px;
}

.vsf-no-results p {
    margin: 0;
}

/* ================================================================
 *  Scrollbar — subtle, for long filter lists
 * ============================================================== */

.vsf-scrollable::-webkit-scrollbar {
    width: 3px;
}

.vsf-scrollable::-webkit-scrollbar-track {
    background: transparent;
}

.vsf-scrollable::-webkit-scrollbar-thumb {
    background: rgba(0,0,0,0.15);
    border-radius: 3px;
}

.vsf-scrollable::-webkit-scrollbar-thumb:hover {
    background: #daaf48;
}

/* ================================================================
 *  Smooth transitions for filter interactions
 * ============================================================== */

.vsf-item {
    transition: opacity 0.15s ease;
}

.vsf-item.vsf-hidden {
    display: none;
}

/* Zero-count items — hidden smoothly */
.vsf-item.vsf-count-zero {
    display: none !important;
}

/* Empty sections — entire section hidden */
.vsf-section.vsf-section-empty {
    display: none !important;
}

/* Count badge transition for faceted updates */
.vsf-count {
    transition: opacity 0.15s ease;
}

/* Checkbox label active state */
.vsf-item label.vsf-active {
    color: #daaf48;
    font-weight: 500;
}

/* ================================================================
 *  Sticky Action Bar — Apply Filters / Clear (v3.5.0)
 *
 *  Sits fixed at the bottom of the viewport. Slides up when
 *  the user selects checkboxes, shows filter count + Apply button.
 *  After applying, shows "Filters Applied ✓" confirmation.
 * ============================================================== */

.vsf-action-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 99999;
    background: #1a1a1a;
    border-top: 2px solid #daaf48;
    box-shadow: 0 -4px 20px rgba(0,0,0,0.35);
    transform: translateY(100%);
    opacity: 0;
    transition: transform 0.35s cubic-bezier(0.22, 0.61, 0.36, 1),
                opacity 0.35s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform, opacity;
    font-family: "Lato", Arial, Helvetica, sans-serif;
}

.vsf-action-bar--visible {
    transform: translateY(0);
    opacity: 1;
}

.vsf-action-bar-inner {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 12px 20px;
    gap: 12px;
}

/* ── Summary text ── */
.vsf-action-summary {
    color: #f0e6d0;
    font-size: 14px;
    font-weight: 400;
    line-height: 1.4;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 1;
    min-width: 0;
}

.vsf-action-summary strong {
    color: #daaf48;
    font-weight: 700;
}

/* ── Button group ── */
.vsf-action-buttons {
    display: flex;
    align-items: center;
    gap: 10px;
    flex-shrink: 0;
}

/* ── Clear button ── */
.vsf-action-clear {
    padding: 10px 18px;
    background: transparent;
    border: 1px solid rgba(240, 230, 208, 0.25);
    color: #f0e6d0;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
}

.vsf-action-clear:hover {
    border-color: #daaf48;
    color: #daaf48;
}

/* ── Apply Filters button ── */
.vsf-action-apply {
    padding: 10px 24px;
    background: #daaf48;
    border: none;
    color: #1a1a1a;
    font-family: inherit;
    font-size: 13px;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.04em;
    cursor: pointer;
    transition: all 0.2s ease;
    white-space: nowrap;
    position: relative;
    overflow: hidden;
}

.vsf-action-apply:hover {
    background: #e8bf5a;
    box-shadow: 0 2px 8px rgba(218, 175, 72, 0.4);
}

.vsf-action-apply:active {
    transform: scale(0.97);
}

/* ── Pulse animation — draws attention when filters changed ── */
.vsf-action-apply--pulse {
    animation: vsf-pulse 1.8s ease-in-out infinite;
}

@keyframes vsf-pulse {
    0%, 100% {
        box-shadow: 0 0 0 0 rgba(218, 175, 72, 0.5);
    }
    50% {
        box-shadow: 0 0 0 8px rgba(218, 175, 72, 0);
    }
}

/* ── "Filters Applied ✓" confirmation state ── */
.vsf-action-apply:not(.vsf-action-apply--pulse) {
    background: #2e7d32;
    color: #fff;
    cursor: default;
}

.vsf-action-apply:not(.vsf-action-apply--pulse):hover {
    background: #2e7d32;
    box-shadow: none;
}

/* ================================================================
 *  Mobile — off-canvas sidebar support + action bar
 * ============================================================== */

@media (max-width: 1024px) {
    /* In WoodMart off-canvas sidebar, ensure everything is visible */
    .vsf-section-body--open {
        max-height: none;
        overflow: visible;
    }

    .vsf-filter-root {
        padding: 0;
    }

    /* Action bar: full-width stacked layout on mobile */
    .vsf-action-bar-inner {
        flex-direction: column;
        padding: 10px 16px 14px;
        gap: 8px;
        text-align: center;
    }

    .vsf-action-summary {
        font-size: 13px;
        white-space: normal;
    }

    .vsf-action-buttons {
        width: 100%;
        gap: 8px;
    }

    .vsf-action-clear {
        flex: 1;
        padding: 10px 12px;
        font-size: 12px;
        text-align: center;
    }

    .vsf-action-apply {
        flex: 2;
        padding: 10px 16px;
        font-size: 13px;
        text-align: center;
    }
}

/* Small phones */
@media (max-width: 480px) {
    .vsf-action-bar-inner {
        padding: 8px 12px 12px;
    }

    .vsf-action-summary {
        font-size: 12px;
    }

    .vsf-action-clear {
        font-size: 11px;
        padding: 9px 10px;
    }

    .vsf-action-apply {
        font-size: 12px;
        padding: 9px 14px;
    }
}

/* ================================================================
 *  WoodMart integration overrides
 * ============================================================== */

/* Match widget spacing to WoodMart native */
.widget.vsf-widget {
    margin-bottom: 25px;
    padding-bottom: 0;
}

/* Widget title — use WoodMart's own variables */
.widget.vsf-widget .widget-title {
    font-family: "Poppins", Arial, Helvetica, sans-serif !important;
    font-size: var(--wd-widget-title-font-size, 16px) !important;
    font-weight: var(--wd-widget-title-font-weight, 600) !important;
    text-transform: var(--wd-widget-title-transform, uppercase) !important;
    color: var(--wd-widget-title-color, #333) !important;
    margin-bottom: 20px !important;
    padding-bottom: 0 !important;
    border-bottom: none !important;
    letter-spacing: 0.03em !important;
}

/* Clean WoodMart overrides */
.vsf-filter-root ul {
    list-style: none !important;
    margin: 0 !important;
    padding: 0 !important;
}

.vsf-filter-root li {
    margin: 0 !important;
    padding: 0 !important;
    border: none !important;
    background: none !important;
}

.vsf-filter-root label {
    margin: 0 !important;
    font-weight: 400 !important;
}

.vsf-filter-root input[type="checkbox"] {
    margin: 0 !important;
    box-shadow: none !important;
}

/* Ensure panel displays inside WoodMart off-canvas */
.wd-side-hidden .vsf-panel {
    display: block !important;
}

/* ================================================================
 *  Results count badge (floating)
 * ============================================================== */

.vsf-results-count {
    display: inline-block;
    padding: 3px 10px;
    background: #daaf48;
    color: #fff;
    font-size: 11px;
    font-weight: 700;
    text-align: center;
    margin-top: 8px;
    letter-spacing: 0.02em;
}

/* ================================================================
 *  Toast Notification — "Showing X products" (v3.5.0)
 *  Slides down from top of viewport after Apply Filters.
 * ============================================================== */

.vsf-toast {
    position: fixed;
    top: 0;
    left: 50%;
    transform: translateX(-50%) translateY(-100%);
    z-index: 999999;
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 28px;
    background: #1a1a1a;
    border-bottom: 2px solid #daaf48;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    opacity: 0;
    transition: transform 0.4s cubic-bezier(0.22, 0.61, 0.36, 1),
                opacity 0.4s cubic-bezier(0.22, 0.61, 0.36, 1);
    will-change: transform, opacity;
    font-family: "Lato", Arial, Helvetica, sans-serif;
    pointer-events: none;
}

.vsf-toast--visible {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.vsf-toast-icon {
    font-size: 18px;
    color: #daaf48;
    line-height: 1;
    flex-shrink: 0;
}

.vsf-toast-text {
    color: #f0e6d0;
    font-size: 14px;
    font-weight: 600;
    letter-spacing: 0.02em;
    white-space: nowrap;
}

@media (max-width: 480px) {
    .vsf-toast {
        left: 12px;
        right: 12px;
        transform: translateX(0) translateY(-100%);
        justify-content: center;
        padding: 12px 20px;
    }

    .vsf-toast--visible {
        transform: translateX(0) translateY(0);
    }

    .vsf-toast-text {
        font-size: 13px;
    }
}

/* ================================================================
 *  Ensure action bar doesn't overlap site footer on scroll
 *  Add bottom padding to page when bar is visible
 * ============================================================== */

body.vsf-bar-active {
    padding-bottom: 70px;
}

@media (max-width: 1024px) {
    body.vsf-bar-active {
        padding-bottom: 90px;
    }
}
