/* ============================================================
   Panto Product Filters
   ============================================================ */

:root {
    --pf-red:      #8B1A1A;
    --pf-red-bg:   #f9f0f0;
    --pf-border:   #e0e0e0;
    --pf-text:     #2c2c2c;
    --pf-muted:    #555;
    --pf-radius:   8px;
    --pf-shadow:   0 4px 16px rgba(0,0,0,0.10);
}

/* ── Wrapper ── */
.panto-filters {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 10px;
    padding: 16px 0 24px;
}

.panto-filters-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--pf-text);
    white-space: nowrap;
    margin-right: 4px;
}

.panto-filters--center {
    justify-content: center;
}

/* ── Single filter group (label + dropdown) ── */
.panto-filter-group {
    display: flex;
    align-items: center;
    gap: 7px;
}

.panto-filter-label {
    font-size: 11px;
    font-weight: 700;
    color: var(--pf-text);
    text-transform: uppercase;
    letter-spacing: .04em;
    white-space: nowrap;
    line-height: 1;
    align-self: center;
}

/* ── Selected value text inside button ── */
.panto-filter-btn-text {
    line-height: 1;
    align-self: center;
}

/* White text (label + value) when button has red background */
.panto-filter-btn:hover .panto-filter-label,
.panto-filter-btn:hover .panto-filter-btn-text,
.panto-filter-dropdown.has-active .panto-filter-btn .panto-filter-label,
.panto-filter-dropdown.has-active .panto-filter-btn .panto-filter-btn-text {
    color: #fff !important;
}

/* Red text when dropdown is open but no filter selected */
.panto-filter-dropdown.is-open:not(.has-active) .panto-filter-btn .panto-filter-label,
.panto-filter-dropdown.is-open:not(.has-active) .panto-filter-btn .panto-filter-btn-text {
    color: var(--pf-red) !important;
}

/* ── Dropdown container ── */
.panto-filter-dropdown {
    position: relative;
}

/* ── Trigger button ── */
.panto-filter-btn {
    display: inline-flex !important;
    align-items: center !important;
    gap: 6px !important;
    height: 36px !important;
    padding: 0 14px !important;
    background: #FBF8F8 !important;
    border: 1.5px solid var(--pf-border) !important;
    border-radius: 10px !important;
    font-size: 13px !important;
    font-weight: 500 !important;
    color: var(--pf-text) !important;
    cursor: pointer !important;
    white-space: nowrap !important;
    transition: border-color .15s, background .15s, color .15s, box-shadow .15s;
    line-height: 1 !important;
    outline: none !important;
    font-family: inherit !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    box-shadow: none !important;
}

.panto-filter-btn:hover {
    border-color: var(--pf-red) !important;
    background: var(--pf-red) !important;
    color: #fff !important;
}

/* Active (filter applied) */
.panto-filter-dropdown.has-active .panto-filter-btn,
.panto-filter-dropdown.has-active .panto-filter-btn:hover,
.panto-filter-dropdown.has-active .panto-filter-btn:focus {
    background: var(--pf-red) !important;
    border-color: var(--pf-red) !important;
    color: #fff !important;
    box-shadow: none !important;
}

/* Open state — no active filter */
.panto-filter-dropdown.is-open:not(.has-active) .panto-filter-btn {
    border-color: var(--pf-red) !important;
    background: #FBF8F8 !important;
    color: var(--pf-red) !important;
    box-shadow: 0 0 0 3px rgba(139,26,26,.12) !important;
}

/* Open state — active filter selected (keep red fill visible) */
.panto-filter-dropdown.is-open.has-active .panto-filter-btn {
    background: var(--pf-red) !important;
    border-color: var(--pf-red) !important;
    color: #fff !important;
    box-shadow: 0 0 0 3px rgba(139,26,26,.20) !important;
}

.panto-filter-dropdown.is-open .panto-chevron {
    transform: rotate(180deg);
}

.panto-chevron {
    flex-shrink: 0;
    transition: transform .18s ease;
    opacity: .7;
}

.panto-filter-dropdown.has-active .panto-chevron {
    opacity: 1;
    color: #fff;
}

/* ── Dropdown panel ── */
.panto-filter-panel {
    display: none;
    position: absolute;
    top: calc(100% + 8px);
    left: 0;
    min-width: 200px;
    max-height: 280px;
    overflow-y: auto;
    background: #fff;
    border: 1.5px solid var(--pf-border);
    border-radius: var(--pf-radius);
    box-shadow: var(--pf-shadow);
    padding: 6px 0;
    z-index: 9999;
}

/* Scrollbar */
.panto-filter-panel::-webkit-scrollbar       { width: 4px; }
.panto-filter-panel::-webkit-scrollbar-track  { background: transparent; }
.panto-filter-panel::-webkit-scrollbar-thumb  { background: #ddd; border-radius: 4px; }

.panto-filter-dropdown.is-open .panto-filter-panel {
    display: block;
    animation: pfSlideIn .14s ease;
}

@keyframes pfSlideIn {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* ── Option row ── */
.panto-filter-option {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 8px 16px;
    cursor: pointer;
    font-size: 13px;
    color: var(--pf-text);
    transition: background .1s;
    margin: 0;
    user-select: none;
}

.panto-filter-option:hover {
    background: var(--pf-red-bg);
}

/* Hide native checkbox */
.panto-filter-option input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}

/* Custom checkbox */
.panto-check-box {
    flex-shrink: 0;
    width: 16px;
    height: 16px;
    border: 1.5px solid var(--pf-border);
    border-radius: 4px;
    background: #fff;
    transition: border-color .12s, background .12s;
    position: relative;
}

.panto-filter-option input:checked ~ .panto-check-box {
    background: var(--pf-red);
    border-color: var(--pf-red);
}

.panto-filter-option input:checked ~ .panto-check-box::after {
    content: '';
    display: block;
    position: absolute;
    left: 4px;
    top: 1px;
    width: 5px;
    height: 9px;
    border: 2px solid #fff;
    border-top: none;
    border-left: none;
    transform: rotate(45deg);
}

.panto-option-name {
    line-height: 1.3;
}

/* ── Clear All button ── */
.panto-filter-clear {
    height: 36px;
    padding: 0 14px;
    background: transparent !important;
    border: 1.5px dashed var(--pf-border) !important;
    border-radius: 10px;
    font-size: 12px;
    font-weight: 500;
    color: var(--pf-muted) !important;
    cursor: pointer;
    transition: border-color .15s, color .15s;
    white-space: nowrap;
    line-height: 1;
    outline: none;
    text-decoration: none !important;
}

.panto-filter-clear:hover,
.panto-filter-clear:focus {
    border-color: var(--pf-red) !important;
    border-style: solid !important;
    color: var(--pf-red) !important;
    background: transparent !important;
    box-shadow: none !important;
}

/* ── Loading state ── */
.panto-loop-grid {
    transition: opacity .2s;
}

.panto-loop-grid.panto-loading {
    opacity: .4;
    pointer-events: none;
}

/* ── Tablet (768px – 1024px) ── */
@media (max-width: 1024px) {
    .panto-filter-label {
        font-size: 11px;
    }

    .panto-filter-btn {
        font-size: 12px;
        padding: 0 12px;
    }

    /* Prevent panel going off right edge on tablet */
    .panto-filter-group:last-child .panto-filter-panel,
    .panto-filter-group:nth-last-child(2) .panto-filter-panel {
        left: auto;
        right: 0;
    }
}

/* ── Mobile (max 767px) ── */
@media (max-width: 767px) {
    .panto-filters {
        gap: 6px;
        padding: 10px 0 18px;
    }

    /* Hide text labels — buttons are self-explanatory */
    .panto-filter-label {
        display: none;
    }

    .panto-filter-btn {
        font-size: 12px;
        height: 32px;
        padding: 0 11px;
        gap: 5px;
    }

    .panto-filter-clear {
        height: 32px;
        font-size: 11px;
        padding: 0 11px;
    }

    /* Panel: cap width so it never overflows viewport */
    .panto-filter-panel {
        min-width: 160px;
        max-width: min(200px, calc(100vw - 24px));
    }

    /* Last two groups: open panel to the left of button, not right */
    .panto-filter-group:last-child .panto-filter-panel,
    .panto-filter-group:nth-last-child(2) .panto-filter-panel {
        left: auto;
        right: 0;
    }
}
