/* ============================================================
   FILTERS — desktop two-row layout
   ============================================================ */

/* Form: dwa rzędy ustawione kolumnowo */
.filters-form {
    display: flex;
    flex-direction: column;
}

/* Rząd pomocniczy: licznik / sortowanie / wyczyść */
.filters-utility {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 0.3rem 0;
    font-size: 0.875rem;
}

/* Rząd dropdownów filtrów */
.filters-row {
    --filters-per-row: 6;
    display: flex;
    align-items: stretch;
    flex-wrap: wrap;
}

/* ============================================================
   FILTER ATTRIBUTE (wrapper dropdownu)
   ============================================================ */

.filter-attribute {
    position: relative;
    flex: 1 0 calc(100% / var(--filters-per-row));
    display: flex;
    align-items: stretch;
    justify-content: flex-start;
}

/* Przycisk-toggle */
.filter-toggle {
    background: none;
    border: none;
    outline: none;
    box-shadow: none;
    padding: 0.55rem 0.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 0.35rem;
    cursor: pointer;
    font-size: 0.875rem;
    white-space: nowrap;
    width: 100%;
    height: 100%;
    color: inherit;
}


.filter-arrow {
    font-size: 0.7rem;
    margin-left: 0.15rem;
    transition: transform 0.2s;
    color: #888;
}

.filter-toggle.active .filter-arrow {
    transform: rotate(180deg);
}

/* Licznik aktywnych wyborów */
.filter-count {
    font-size: 0.75rem;
    font-weight: 600;
    color: #fff;
    background: #000;
    border-radius: 10px;
    padding: 0 5px;
    line-height: 1.5;
    min-width: 18px;
    text-align: center;
}

/* ============================================================
   DROPDOWN FILTRA
   ============================================================ */

.filter-collapse {
    display: none;
    position: absolute;
    left: 0;
    top: 100%;
    background: #fff;
    border: 1px solid #e8e8e8;
    border-top: none;
    border-radius: 0 0 0.5rem 0.5rem;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.08);
    min-width: 220px;
    max-width: 300px;
    width: max-content;
    z-index: 200;
    padding: 1rem;
}

.filter-collapse.show {
    display: block;
}

/* ============================================================
   OPCJE FILTRA
   ============================================================ */

.filter-options {
    max-height: none;
    overflow-y: visible;
    margin-bottom: 0.5rem;
}

.filter-attribute .filter-options > li {
    margin-bottom: 0.5rem;
}

.filter-attribute .filter-options > li:last-child {
    margin-bottom: 0;
}

.filter-attribute .filter-scroll.is-scroll {
    max-height: calc(var(--filter-item-h, 36px) * var(--max-visible, 1));
    overflow-y: auto;
    overscroll-behavior: contain;
    -webkit-overflow-scrolling: touch;
    scrollbar-gutter: stable both-edges;
}

/* Przyciski wewnątrz dropdownu */
.filter-apply {
    font-size: 0.875rem;
    padding: 0.4rem 0;
}

.filter-apply:hover {
    background-color: #000;
    color: #fff;
}

/* ============================================================
   SIATKA KOLORÓW
   ============================================================ */

.color-swatch {
    cursor: pointer;
    position: relative;
}

input[type="checkbox"]:checked + .color-swatch::after {
    content: "✓";
    color: #555555;
    font-size: 14px;
    position: absolute;
    top: 6px;
    left: 10px;
}

.color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 8px;
    padding: 0;
}

.color-grid li {
    margin: 0;
    list-style: none;
    display: flex;
    justify-content: center;
}

/* ============================================================
   CHECKBOXY
   ============================================================ */

input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border: 1px solid #666;
    border-radius: 2px;
    background-color: #fff;
    cursor: pointer;
    flex-shrink: 0;
}

input[type="checkbox"]:checked {
    background-color: #000;
}
