/* ==============================================
   Strains Filter v2 — Dark "Digital Botanical" Theme
   Loaded after styles_v2.css; uses its CSS custom properties.
   Same class names as strains-filter.css, re-themed for dark UI.
   ============================================== */

/* --- Filter wrapper --- */
.sf-filter {
    margin-bottom: 24px;
}

/* --- Chips container --- */
.sf-chips {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 12px;
    min-height: 0;
}

.sf-chips:empty {
    display: none;
}

.sf-chip {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 10px 5px 12px;
    border: 1.5px solid var(--accent-green);
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    color: var(--accent-green);
    background: var(--accent-green-dim);
    cursor: default;
    line-height: 1.3;
}

.sf-chip__remove {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: var(--accent-green);
    color: var(--bg-primary);
    font-size: 10px;
    line-height: 1;
    cursor: pointer;
    flex-shrink: 0;
    transition: background 0.15s var(--ease-out);
}

.sf-chip__remove:hover {
    background: var(--accent-nature);
}

.sf-chip__remove svg {
    width: 8px;
    height: 8px;
}

/* --- Filter bar (row of buttons) --- */
.sf-bar {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: flex-start;
}

/* --- Single filter group --- */
.sf-group {
    position: relative;
}

/* --- Dropdown trigger button --- */
.sf-btn {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 8px 14px;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    background: var(--bg-card);
    font-size: 13px;
    font-weight: 600;
    color: var(--text-secondary);
    cursor: pointer;
    white-space: nowrap;
    transition: border-color 0.15s var(--ease-out),
                box-shadow 0.15s var(--ease-out),
                background 0.15s var(--ease-out),
                color 0.15s var(--ease-out);
    line-height: 1.3;
}

.sf-btn:hover {
    border-color: var(--accent-green);
    color: var(--text-primary);
}

.sf-btn.is-open {
    border-color: var(--accent-green);
    box-shadow: 0 0 0 1px var(--accent-green);
    color: var(--text-primary);
}

.sf-btn.has-active {
    border-color: var(--accent-green);
    background: var(--accent-green-dim);
    color: var(--accent-green);
}

.sf-btn__chevron {
    width: 10px;
    height: 10px;
    flex-shrink: 0;
    transition: transform 0.2s var(--ease-out);
    color: var(--text-muted);
}

.sf-btn.is-open .sf-btn__chevron {
    transform: rotate(180deg);
    color: var(--accent-green);
}

.sf-btn.has-active .sf-btn__chevron {
    color: var(--accent-green);
}

/* --- Dropdown panel --- */
.sf-dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    min-width: 200px;
    max-height: 320px;
    overflow-y: auto;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    padding: 10px;
    z-index: 150;
}

.sf-dropdown.is-open {
    display: block;
}

/* Wider dropdown for groups with many items */
.sf-dropdown--wide {
    min-width: 280px;
    columns: 2;
    column-gap: 8px;
}

/* Dark scrollbar inside dropdowns */
.sf-dropdown::-webkit-scrollbar {
    width: 6px;
}

.sf-dropdown::-webkit-scrollbar-track {
    background: transparent;
}

.sf-dropdown::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.12);
    border-radius: 3px;
}

.sf-dropdown::-webkit-scrollbar-thumb:hover {
    background: rgba(255, 255, 255, 0.2);
}

/* Firefox scrollbar */
.sf-dropdown {
    scrollbar-width: thin;
    scrollbar-color: rgba(255, 255, 255, 0.12) transparent;
}

/* --- Checkbox items inside dropdown --- */
.sf-check {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 5px 6px;
    border-radius: 6px;
    cursor: pointer;
    font-size: 13px;
    color: var(--text-secondary);
    transition: background 0.1s var(--ease-out),
                color 0.1s var(--ease-out);
    break-inside: avoid;
    line-height: 1.3;
}

.sf-check:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.sf-check input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

.sf-check__box {
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--border-light);
    border-radius: 4px;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s var(--ease-out);
    background: var(--bg-secondary);
}

.sf-check input:checked + .sf-check__box {
    background: var(--accent-green);
    border-color: var(--accent-green);
}

.sf-check input:checked + .sf-check__box svg {
    display: block;
}

.sf-check__box svg {
    display: none;
    width: 10px;
    height: 10px;
    color: var(--bg-primary);
}

.sf-check__label {
    user-select: none;
}

/* --- THC Segment Buttons --- */
.sf-thc {
    position: absolute;
    top: calc(100% + 4px);
    left: 0;
    background: var(--bg-card);
    border: 1px solid var(--border-light);
    border-radius: 10px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
    padding: 10px;
    z-index: 150;
    display: none;
}

.sf-thc.is-open {
    display: block;
}

.sf-segments {
    display: flex;
    gap: 0;
    border: 1.5px solid var(--border-light);
    border-radius: var(--radius-sm);
    overflow: hidden;
}

.sf-seg {
    flex: 1;
    padding: 8px 14px;
    font-size: 13px;
    font-weight: 500;
    text-align: center;
    color: var(--text-secondary);
    background: var(--bg-card);
    cursor: pointer;
    border: none;
    border-right: 1px solid var(--border-subtle);
    white-space: nowrap;
    transition: background 0.15s var(--ease-out),
                color 0.15s var(--ease-out);
    user-select: none;
    line-height: 1.3;
}

.sf-seg:last-child {
    border-right: none;
}

.sf-seg:hover {
    background: rgba(255, 255, 255, 0.06);
    color: var(--text-primary);
}

.sf-seg.is-active {
    background: var(--accent-green);
    color: var(--bg-primary);
}

.sf-seg.is-active:hover {
    background: var(--accent-nature);
}

/* --- Reset link --- */
.sf-reset {
    display: none;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border: none;
    background: none;
    font-size: 13px;
    font-weight: 500;
    color: #ef4444;
    cursor: pointer;
    white-space: nowrap;
    transition: opacity 0.15s var(--ease-out);
}

.sf-reset:hover {
    text-decoration: underline;
}

.sf-reset.is-visible {
    display: inline-flex;
}

/* --- Focus-visible for keyboard navigation --- */
.sf-btn:focus-visible,
.sf-check:focus-visible,
.sf-seg:focus-visible,
.sf-reset:focus-visible,
.sf-chip__remove:focus-visible {
    outline: 2px solid var(--accent-green);
    outline-offset: 2px;
}

/* --- Responsive: Mobile --- */
@media screen and (max-width: 640px) {
    .sf-bar {
        gap: 6px;
    }

    .sf-btn {
        padding: 7px 10px;
        font-size: 12px;
    }

    .sf-dropdown,
    .sf-thc {
        position: fixed;
        top: auto;
        bottom: 0;
        left: 0;
        right: 0;
        min-width: 100%;
        max-height: 60vh;
        border-radius: var(--radius-lg) var(--radius-lg) 0 0;
        box-shadow: 0 -4px 24px rgba(0, 0, 0, 0.5);
        z-index: 200;
    }

    .sf-dropdown--wide {
        columns: 1;
    }

    /* Backdrop overlay for mobile */
    .sf-backdrop {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(0, 0, 0, 0.55);
        z-index: 199;
    }

    .sf-backdrop.is-visible {
        display: block;
    }
}

/* --- Responsive: Tablet+ --- */
@media screen and (min-width: 641px) {
    .sf-backdrop {
        display: none !important;
    }
}

/* --- Reduced motion --- */
@media (prefers-reduced-motion: reduce) {
    .sf-btn,
    .sf-btn__chevron,
    .sf-chip__remove,
    .sf-check,
    .sf-check__box,
    .sf-seg,
    .sf-reset {
        transition: none;
    }
}
