/* DSS ACF Filters – Frontend Styles */

/* ============================================================
   Widget container
   ============================================================ */

.dss-acf-filters-widget {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    background: #ffffff;
    border: 1px solid #e8ecf0;
    border-radius: 16px;
    overflow: hidden;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.07), 0 1px 4px rgba(0, 0, 0, 0.04);
}

/* ============================================================
   Header
   ============================================================ */

.dss-acf-filters-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid #f1f5f9;
    background: #fafbfd;
}

.dss-acf-filters-title {
    margin: 0;
    font-size: 14px;
    font-weight: 700;
    color: #0f172a;
    text-transform: uppercase;
    letter-spacing: 0.06em;
}

.dss-acf-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

.dss-acf-clear-all {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    appearance: none;
    -webkit-appearance: none;
    background: none !important;
    border: none !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    color: #94a3b8;
    font-size: 12px;
    font-weight: 500;
    padding: 0 !important;
    margin: 0;
    cursor: pointer;
    transition: color 0.15s;
    text-decoration: none;
    line-height: 1;
}

.dss-acf-clear-all:hover {
    color: #ef4444;
}


/* ============================================================
   Filter groups
   ============================================================ */

.dss-acf-filter-group {
    border-bottom: 1px solid #f1f5f9;
}

.dss-acf-filter-group:last-child {
    border-bottom: none;
}

.dss-acf-filter-group.active .dss-acf-filter-title span:first-child {
    color: #2271b1;
}

.dss-acf-filter-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 13px 20px;
    cursor: pointer;
    user-select: none;
    transition: background 0.12s;
}

.dss-acf-filter-title:hover {
    background: #f8fafc;
}

.dss-acf-filter-title span:first-child {
    font-weight: 600;
    font-size: 13px;
    color: #334155;
    transition: color 0.15s;
}

.dss-acf-toggle-icon {
    font-size: 14px;
    width: 14px;
    height: 14px;
    color: #cbd5e1;
    transition: transform 0.25s ease, color 0.15s;
}

.dss-acf-filter-group.collapsed .dss-acf-toggle-icon {
    transform: rotate(-90deg);
}

.dss-acf-filter-body {
    padding: 2px 20px 16px;
    display: block;
}

.dss-acf-filter-group.collapsed .dss-acf-filter-body {
    display: none;
}

/* ============================================================
   Checkbox + Radio — pill / tag style
   ============================================================ */

.dss-acf-checkbox-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    max-height: 200px;
    overflow-y: auto;
    padding-right: 2px;
}

.dss-acf-radio-list {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
}

/* The label IS the pill */
.dss-acf-checkbox-item,
.dss-acf-radio-item {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 5px 13px;
    background: #f1f5f9;
    border: 1.5px solid transparent;
    border-radius: 50px;
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, box-shadow 0.15s;
    user-select: none;
}

.dss-acf-checkbox-item:hover,
.dss-acf-radio-item:hover {
    background: #e2e8f0;
}

/* Hide native input — force override theme styles */
.dss-acf-checkbox-item input[type="checkbox"],
.dss-acf-radio-item input[type="radio"] {
    position: absolute !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    margin: 0 !important;
    padding: 0 !important;
    pointer-events: none;
}

/* Checkmark / dot icons — hidden by default */
.dss-acf-checkmark,
.dss-acf-radio-dot {
    display: none;
    font-size: 11px;
    font-weight: 800;
    line-height: 1;
    flex-shrink: 0;
    color: #2271b1;
}

.dss-acf-checkmark::before { content: '✓'; }
.dss-acf-radio-dot::before  { content: '●'; font-size: 7px; }

/* Label text */
.dss-acf-checkbox-label,
.dss-acf-radio-label {
    font-size: 12.5px;
    font-weight: 500;
    color: #64748b;
    white-space: nowrap;
    line-height: 1.4;
    transition: color 0.15s;
}

/* Checked state — using :has() for modern browsers */
.dss-acf-checkbox-item:has(input:checked),
.dss-acf-radio-item:has(input:checked) {
    background: #eff6ff;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}

.dss-acf-checkbox-item:has(input:checked) .dss-acf-checkmark,
.dss-acf-radio-item:has(input:checked) .dss-acf-radio-dot {
    display: inline;
}

.dss-acf-checkbox-item:has(input:checked) .dss-acf-checkbox-label,
.dss-acf-radio-item:has(input:checked) .dss-acf-radio-label {
    color: #1d5fa8;
    font-weight: 600;
}

/* ============================================================
   Select
   ============================================================ */

.dss-acf-select {
    width: 100%;
    padding: 9px 34px 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    font-weight: 500;
    color: #334155;
    background-color: #fff !important;
    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 d='M1 1l4 4 4-4' fill='none' stroke='%2394a3b8' stroke-width='1.5' stroke-linecap='round' stroke-linejoin='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 12px center !important;
    background-size: 10px 6px !important;
    -webkit-appearance: none !important;
    appearance: none !important;
    cursor: pointer;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dss-acf-select:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

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

.dss-acf-range-slider {
    padding: 4px 2px 0;
}

.dss-acf-range-track {
    position: relative;
    height: 4px;
    background: #e9eef4;
    border-radius: 2px;
    margin: 18px 0 12px;
}

.dss-acf-range-fill {
    position: absolute;
    height: 100%;
    background: linear-gradient(90deg, #3b82f6, #2271b1);
    border-radius: 2px;
    pointer-events: none;
}

.dss-range-input {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    width: 100%;
    height: 4px;
    margin: 0;
    background: transparent;
    -webkit-appearance: none;
    appearance: none;
    pointer-events: none;
    outline: none;
}

.dss-range-input::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid #2271b1;
    box-shadow: 0 1px 6px rgba(34, 113, 177, 0.3);
    cursor: pointer;
    pointer-events: all;
    transition: border-color 0.15s, box-shadow 0.15s, transform 0.15s;
}

.dss-range-input::-moz-range-thumb {
    width: 20px;
    height: 20px;
    border-radius: 50%;
    background: #fff;
    border: 2.5px solid #2271b1;
    box-shadow: 0 1px 6px rgba(34, 113, 177, 0.3);
    cursor: pointer;
    pointer-events: all;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dss-range-input::-webkit-slider-thumb:hover,
.dss-range-input:active::-webkit-slider-thumb {
    border-color: #1a5a91;
    box-shadow: 0 0 0 5px rgba(34, 113, 177, 0.14);
    transform: scale(1.15);
}

.dss-range-input::-moz-range-track {
    background: transparent;
    border: none;
}

.dss-acf-range-values {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    color: #94a3b8;
    margin-top: 8px;
}

.dss-range-val-min,
.dss-range-val-max {
    font-weight: 700;
    color: #2271b1;
    min-width: 30px;
    background: #eff6ff;
    padding: 2px 8px;
    border-radius: 5px;
    font-size: 12px;
}

.dss-range-val-min { text-align: left; }
.dss-range-val-max { text-align: right; }
.dss-range-val-sep { color: #dde3ea; }

/* ============================================================
   Toggle
   ============================================================ */

.dss-acf-toggle {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
}

.dss-acf-toggle input {
    display: none;
}

.dss-acf-toggle-slider {
    position: relative;
    width: 42px;
    height: 24px;
    background: #e2e8f0;
    border-radius: 12px;
    transition: background 0.25s;
    flex-shrink: 0;
}

.dss-acf-toggle-slider::after {
    content: '';
    position: absolute;
    top: 3px;
    left: 3px;
    width: 18px;
    height: 18px;
    background: #fff;
    border-radius: 50%;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1);
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
}

.dss-acf-toggle input:checked + .dss-acf-toggle-slider {
    background: #2271b1;
}

.dss-acf-toggle input:checked + .dss-acf-toggle-slider::after {
    transform: translateX(18px);
}

.dss-acf-toggle-text {
    font-size: 13px;
    font-weight: 500;
    color: #475569;
}

/* ============================================================
   Search
   ============================================================ */

.dss-acf-search-wrap {
    position: relative;
}

.dss-acf-search-input {
    width: 100%;
    padding: 9px 40px 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    color: #334155;
    background: #fff;
    transition: border-color 0.15s, box-shadow 0.15s;
    box-sizing: border-box;
}

.dss-acf-search-input::placeholder {
    color: #cbd5e1;
}

.dss-acf-search-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.dss-acf-search-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    padding: 4px;
    cursor: pointer;
    color: #94a3b8;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 6px;
    transition: color 0.15s, background 0.15s;
}

.dss-acf-search-btn:hover {
    color: #2271b1;
    background: #f1f5f9;
}

/* ============================================================
   Date Range Picker
   ============================================================ */

.dss-acf-date-range-wrap {
    position: relative;
}

.dss-acf-daterange-input {
    width: 100%;
    padding: 9px 32px 9px 12px;
    border: 1.5px solid #e2e8f0;
    border-radius: 10px;
    font-size: 13px;
    color: #334155;
    background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%23cbd5e1' stroke-width='2'%3E%3Crect x='3' y='4' width='18' height='18' rx='2'/%3E%3Cline x1='16' y1='2' x2='16' y2='6'/%3E%3Cline x1='8' y1='2' x2='8' y2='6'/%3E%3Cline x1='3' y1='10' x2='21' y2='10'/%3E%3C/svg%3E") no-repeat right 10px center;
    cursor: pointer;
    box-sizing: border-box;
    transition: border-color 0.15s, box-shadow 0.15s;
}

.dss-acf-daterange-input:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 3px rgba(34, 113, 177, 0.1);
}

.dss-acf-date-clear {
    position: absolute;
    right: 30px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    padding: 0;
    color: #cbd5e1;
    line-height: 1;
    transition: color 0.15s;
}

.dss-acf-date-clear:hover { color: #ef4444; }
.dss-acf-date-clear .dashicons { font-size: 14px; width: 14px; height: 14px; }

/* Flatpickr overrides */
.flatpickr-calendar {
    border-radius: 12px !important;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12) !important;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    border: 1px solid #e8ecf0 !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #2271b1 !important;
    border-color: #2271b1 !important;
}

.flatpickr-day.inRange {
    background: #dbeafe !important;
    border-color: #dbeafe !important;
    box-shadow: -5px 0 0 #dbeafe, 5px 0 0 #dbeafe !important;
}

/* ============================================================
   Status bar
   ============================================================ */

.dss-acf-filters-status {
    margin: 0;
    padding: 10px 20px;
    border-top: 1px solid #f1f5f9;
    font-size: 12.5px;
    color: #64748b;
    font-weight: 500;
    background: #fafbfd;
}

.dss-acf-filters-status .dss-acf-count {
    color: #2271b1;
    font-weight: 700;
}

/* ============================================================
   Loading / Preloader
   ============================================================ */

.dss-acf-loading {
    position: relative;
    pointer-events: none;
}

.dss-acf-loading::after {
    content: '';
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
}

.dss-acf-grid-preloader {
    position: absolute;
    inset: 0;
    background: rgba(255, 255, 255, 0.75);
    z-index: 99;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 8px;
    backdrop-filter: blur(3px);
    -webkit-backdrop-filter: blur(3px);
}

.dss-acf-spinner {
    width: 36px;
    height: 36px;
    border: 3px solid #e2e8f0;
    border-top-color: #2271b1;
    border-radius: 50%;
    animation: dss-spin 0.65s linear infinite;
}

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

/* ============================================================
   Empty / no results
   ============================================================ */

.dss-acf-empty {
    color: #cbd5e1;
    font-size: 12.5px;
    font-style: italic;
    margin: 0;
}

.dss-acf-no-results {
    text-align: center;
    padding: 48px 20px;
    color: #94a3b8;
    font-size: 14px;
}

/* ============================================================
   Scrollbar (checkbox list)
   ============================================================ */

.dss-acf-checkbox-list::-webkit-scrollbar {
    width: 4px;
}

.dss-acf-checkbox-list::-webkit-scrollbar-track {
    background: transparent;
}

.dss-acf-checkbox-list::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 2px;
}

.dss-acf-checkbox-list::-webkit-scrollbar-thumb:hover {
    background: #cbd5e1;
}

/* ============================================================
   Header actions (close + clear on mobile)
   ============================================================ */

.dss-acf-header-actions {
    display: flex;
    align-items: center;
    gap: 8px;
}

/* Close button – hidden on desktop */
.dss-acf-offcanvas-close {
    display: none;
}

/* FAB – hidden on desktop */
.dss-acf-mobile-fab {
    display: none;
}

/* ============================================================
   Mobile: FAB + Offcanvas
   ============================================================ */

@media (max-width: 768px) {

    /* FAB entrance animation — slides in from left edge */
    @keyframes dss-fab-enter {
        from {
            opacity: 0;
            transform: translateY(-50%) translateX(-100%);
        }
        to {
            opacity: 1;
            transform: translateY(-50%) translateX(0);
        }
    }

    /* FAB exit animation — slides out to left */
    @keyframes dss-fab-exit {
        from {
            opacity: 1;
            transform: translateY(-50%) translateX(0);
        }
        to {
            opacity: 0;
            transform: translateY(-50%) translateX(-100%);
        }
    }

    /* FAB button — left-center tab */
    .dss-acf-mobile-fab {
        overflow: visible;
        display: flex;
        flex-direction: column;
        align-items: center;
        position: fixed;
        left: 0;
        top: 50%;
        transform: translateY(-50%);
        z-index: 1000;
        background: #2271b1;
        color: #fff;
        border: none;
        border-radius: 0 12px 12px 0;
        padding: 16px 12px;
        font-size: 11px;
        font-weight: 700;
        cursor: pointer;
        box-shadow: 3px 0 18px rgba(34, 113, 177, 0.35);
        white-space: nowrap;
        letter-spacing: 0.03em;
        text-transform: uppercase;
        animation: dss-fab-enter 0.4s cubic-bezier(0.34, 1.56, 0.64, 1) both;
        transition: background 0.2s, box-shadow 0.2s, padding 0.2s;
        will-change: transform, opacity;
    }

    .dss-acf-mobile-fab:hover {
        background: #1a5a9e;
        box-shadow: 4px 0 22px rgba(34, 113, 177, 0.5);
        padding-left: 16px;
    }

    .dss-acf-mobile-fab:active {
        background: #164e87;
        box-shadow: 2px 0 10px rgba(34, 113, 177, 0.35);
    }

    /* Icon wrapper — relative container so badge positions against SVG */
    .dss-acf-fab-icon-wrap {
        position: relative;
        display: inline-flex;
    }

    .dss-acf-fab-icon {
        display: block;
        flex-shrink: 0;
    }

    /* FAB hides when offcanvas open */
    .dss-acf-mobile-fab.is-hiding {
        animation: dss-fab-exit 0.25s cubic-bezier(0.4, 0, 0.6, 1) both;
        pointer-events: none;
    }

    /* Active filter count badge — corner of SVG icon */
    .dss-acf-fab-count {
        position: absolute;
        top: -6px;
        right: -6px;
        background: #ef4444;
        color: #fff;
        font-size: 10px;
        font-weight: 800;
        border-radius: 50%;
        min-width: 18px;
        height: 18px;
        display: inline-flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
        padding: 0 4px;
        letter-spacing: 0;
        box-shadow: 0 1px 4px rgba(0,0,0,0.25);
        pointer-events: none;
    }

    /* Overlay */
    .dss-acf-offcanvas-overlay {
        display: none;
        position: fixed;
        inset: 0;
        background: rgba(15, 23, 42, 0.45);
        z-index: 1099;
        backdrop-filter: blur(3px);
        -webkit-backdrop-filter: blur(3px);
    }

    .dss-acf-offcanvas-overlay.is-open {
        display: block;
    }

    /* Widget becomes offcanvas panel */
    .dss-acf-filters-widget {
        position: fixed;
        top: 0;
        left: 0;
        width: min(320px, 90vw);
        height: 100dvh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        z-index: 1100;
        border-radius: 0;
        border: none;
        border-right: 1px solid #e8ecf0;
        box-shadow: 8px 0 40px rgba(0, 0, 0, 0.15);
        transform: translateX(-100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .dss-acf-filters-widget.is-open {
        transform: translateX(0);
    }

    /* Close button visible on mobile */
    .dss-acf-offcanvas-close {
        display: flex;
        align-items: center;
        justify-content: center;
        background: none;
        border: none;
        border-radius: 6px;
        width: 28px;
        height: 28px;
        cursor: pointer;
        color: #94a3b8;
        padding: 0;
        transition: background 0.15s, color 0.15s;
        flex-shrink: 0;
    }

    .dss-acf-offcanvas-close:hover {
        background: #fef2f2;
        color: #ef4444;
    }

    /* Lock body scroll when open */
    body.dss-offcanvas-open {
        overflow: hidden;
    }

}
