/* ============================================
   WATSON FILTER - Custom WooCommerce Filter
   Matches Figma Design Exactly
   ============================================ */

/* ---- Variables ---- */
:root {
    --watson-blue: #1a9ed4;
    --watson-border: #d1d1d1;
    --watson-text-dark: #1a1a1a;
    --watson-text-mid: #444;
    --watson-text-light: #888;
    --watson-bg: #ffffff;
    --watson-bg-light: #f7f7f7;
    --watson-purple: #7b5ea7;
    --watson-note-color: #b85c5c;
    --watson-checkbox-border: #bbb;
    --watson-pill-border: #c8c8c8;
    --watson-pill-active-bg: #1a1a1a;
    --watson-pill-active-text: #ffffff;
    --watson-dropdown-shadow: 0 4px 20px rgba(0,0,0,0.12);
    --filter-height: 72px;
}

/* ---- Wrapper ---- */
.watson-filter-wrapper {
    background: #fff;
    border-bottom: 1px solid #e5e5e5;
    position: sticky;
    top: 0;
    z-index: 999;
    width: 100%;
}

/* ============================================
   FILTER BAR (Top Row - Dropdowns)
   ============================================ */
.watson-filter-bar {
    display: flex;
    align-items: stretch;
    border-bottom: 1px solid #e8e8e8;
    min-height: var(--filter-height);
    position: relative;
}

/* Each filter column */
.watson-filter-item {
    flex: 1;
    border-right: 1px solid #e8e8e8;
    position: relative;
}

.watson-filter-item:last-of-type {
    border-right: none;
}

/* Dropdown Toggle Button */
.watson-filter-toggle {
    width: 100%;
    height: 100%;
    min-height: var(--filter-height);
    background: none;
    border: none;
    cursor: pointer;
    padding: 12px 20px;
    text-align: left;
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 3px;
    transition: background 0.15s ease;
    position: relative;
}

.watson-filter-toggle:hover {
    background: #fafafa;
}

.watson-filter-toggle.open {
    background: #fafafa;
}

.watson-filter-toggle.active .filter-label {
    color: var(--watson-blue);
}

/* Filter Label (COLLECTIONS, SECTOR etc.) */
.filter-label {
    display: block;
    font-size: 11px;
    font-weight: 700;
    letter-spacing: 0.08em;
    color: var(--watson-text-dark);
    text-transform: uppercase;
    font-family: 'Arial', sans-serif;
    line-height: 1;
}

/* Filter Value (All / selected value) */
.filter-value {
    display: block;
    font-size: 13px;
    font-weight: 400;
    color: var(--watson-text-mid);
    font-family: 'Arial', sans-serif;
    line-height: 1;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px;
}

/* Arrow Icon */
.filter-arrow {
    position: absolute;
    right: 16px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 12px;
    color: #888;
    transition: transform 0.2s ease;
    line-height: 1;
}

.watson-filter-toggle.open .filter-arrow {
    transform: translateY(-50%) rotate(180deg);
}

/* ============================================
   DROPDOWN PANEL
   ============================================ */
.watson-filter-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 1px);
    left: 0;
    min-width: 220px;
    background: #fff;
    border: 1px solid #e0e0e0;
    box-shadow: var(--watson-dropdown-shadow);
    z-index: 1000;
    animation: dropdownIn 0.15s ease;
}

.watson-filter-dropdown.open {
    display: block;
}

@keyframes dropdownIn {
    from { opacity: 0; transform: translateY(-6px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* Scrollable list */
.filter-checklist {
    list-style: none;
    margin: 0;
    padding: 8px 0;
    max-height: 260px;
    overflow-y: auto;
    scrollbar-width: thin;
    scrollbar-color: #ccc #f5f5f5;
}

.filter-checklist::-webkit-scrollbar {
    width: 4px;
}
.filter-checklist::-webkit-scrollbar-track {
    background: #f5f5f5;
}
.filter-checklist::-webkit-scrollbar-thumb {
    background: #ccc;
    border-radius: 2px;
}

/* Scrollbar line on right side (Figma style) */
.filter-checklist::after {
    content: '';
    position: absolute;
    right: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: #e0e0e0;
    pointer-events: none;
}

.filter-checklist li {
    padding: 0;
}

.filter-checklist label {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 9px 16px;
    cursor: pointer;
    font-size: 14px;
    font-family: 'Arial', sans-serif;
    color: var(--watson-text-dark);
    transition: background 0.1s;
    user-select: none;
}

.filter-checklist label:hover {
    background: #f5f5f5;
}

/* Custom Checkbox */
.filter-checklist input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--watson-checkbox-border);
    border-radius: 2px;
    cursor: pointer;
    flex-shrink: 0;
    position: relative;
    transition: border-color 0.15s, background 0.15s;
}

.filter-checklist input[type="checkbox"]:checked {
    background: var(--watson-text-dark);
    border-color: var(--watson-text-dark);
}

.filter-checklist input[type="checkbox"]:checked::after {
    content: '';
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

/* Lead time note */
.lead-time-note {
    padding: 10px 16px 12px;
    font-size: 12px;
    color: var(--watson-note-color);
    font-family: 'Arial', sans-serif;
    border-top: 1px solid #f0f0f0;
    margin: 0;
    line-height: 1.5;
}

.lead-time-note strong {
    font-style: italic;
}

/* ============================================
   APPLY / RESET BUTTONS
   ============================================ */
.watson-filter-actions {
    display: flex;
    align-items: center;
    padding: 0 16px;
    gap: 10px;
    flex-shrink: 0;
}

.watson-apply-btn {
    background: var(--watson-text-dark);
    color: #fff;
    border: none;
    padding: 8px 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: 'Arial', sans-serif;
    letter-spacing: 0.05em;
    cursor: pointer;
    text-transform: uppercase;
    transition: background 0.15s;
}

.watson-apply-btn:hover {
    background: #333;
}

.watson-reset-btn {
    font-size: 12px;
    color: #888;
    text-decoration: underline;
    font-family: 'Arial', sans-serif;
    cursor: pointer;
    background: none;
    border: none;
    padding: 0;
    letter-spacing: 0.02em;
}

.watson-reset-btn:hover {
    color: #444;
}

/* ============================================
   QUICK FILTER PILL TAGS (Second Row)
   ============================================ */
.watson-quick-filters {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 14px 24px;
    overflow-x: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    flex-wrap: nowrap;
}

.watson-quick-filters::-webkit-scrollbar {
    display: none;
}

.watson-quick-tag {
    display: inline-flex;
    align-items: center;
    white-space: nowrap;
    padding: 8px 18px;
    border: 1.5px solid var(--watson-pill-border);
    border-radius: 50px;
    background: #fff;
    font-size: 13px;
    font-family: 'Arial', sans-serif;
    color: var(--watson-text-dark);
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.watson-quick-tag:hover {
    border-color: #999;
    background: #f9f9f9;
}

.watson-quick-tag.active {
    background: var(--watson-pill-active-bg);
    border-color: var(--watson-pill-active-bg);
    color: var(--watson-pill-active-text);
}

/* Used by Type -> Subcategory cascade filter (JS toggles this) */
.watson-quick-tag.watson-hidden {
    display: none !important;
}

/* ============================================
   OVERLAY (closes dropdown on outside click)
   ============================================ */
.watson-overlay {
    display: none;
    position: fixed;
    inset: 0;
    z-index: 998;
}

.watson-overlay.active {
    display: block;
}

/* ============================================
   MOBILE RESPONSIVE
   ============================================ */
@media (max-width: 900px) {
    .watson-filter-bar {
        flex-wrap: nowrap;
        overflow-x: auto;
        scrollbar-width: none;
    }

    .watson-filter-item {
        min-width: 130px;
    }

    .watson-filter-actions {
        min-width: 100px;
    }

    .filter-value {
        max-width: 100px;
    }
}

@media (max-width: 600px) {
    .watson-filter-wrapper {
        position: relative;
    }

    .watson-filter-bar {
        min-height: 56px;
    }

    .watson-filter-toggle {
        min-height: 56px;
        padding: 10px 12px;
    }

    .filter-label {
        font-size: 10px;
    }

    .filter-value {
        font-size: 12px;
        max-width: 80px;
    }

    .watson-quick-filters {
        padding: 10px 14px;
        gap: 8px;
        -webkit-overflow-scrolling: touch;
    }

    .watson-quick-tag {
        font-size: 12px;
        padding: 7px 14px;
    }

    .watson-filter-actions {
        padding: 0 10px;
    }

    .watson-apply-btn {
        padding: 8px 14px;
        font-size: 11px;
    }

    .watson-reset-btn {
        font-size: 11px;
    }
}

/* ============================================
   MOBILE BOTTOM-SHEET DROPDOWN
   Dropdown becomes a full-width, easy-to-tap
   sheet instead of a tiny floating box
   ============================================ */
@media (max-width: 640px) {
    .watson-filter-dropdown {
        position: fixed !important;
        left: 12px !important;
        right: 12px !important;
        top: auto !important;
        bottom: 12px;
        min-width: 0;
        width: auto;
        max-height: 65vh;
        border-radius: 14px;
        box-shadow: 0 -4px 24px rgba(0,0,0,0.18);
        animation: watsonSheetUp 0.18s ease;
    }

    .filter-checklist {
        max-height: calc(65vh - 70px);
    }

    .filter-checklist label {
        padding: 12px 16px;
        font-size: 15px;
    }

    .filter-checklist input[type="checkbox"] {
        width: 18px;
        height: 18px;
    }

    .lead-time-note {
        font-size: 11.5px;
    }
}

@keyframes watsonSheetUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}