/* GGS Product Filters - Frontend */

.ggs-filters {
    font-family: inherit;
}

/* Pasek aktywnych filtrow — w tym samym wierszu co sortowanie, po lewej.
   Zgloszenie klienta z 09.11.2026: znaczniki mialy byc przy kontrolce
   sortowania, a nie nad menu filtrow w lewej kolumnie.
   Formularz sortowania jest dosuniety do prawej, wiec pasek plynie w lewo
   i oba elementy dziela jedna linie. */
#ggs-active-filters-bar {
    float: left;
    max-width: 65%;
    margin: 0 0 15px 0;
    padding-top: 4px;
}
#ggs-active-filters-bar:empty {
    display: none;
}
#ggs-active-filters-bar .ggs-active-filters {
    border-bottom: none;
    padding-bottom: 0;
    margin-bottom: 0;
}

/* Na waskich ekranach znaczniki i sortowanie ustawiaja sie jedno pod drugim. */
@media (max-width: 768px) {
    #ggs-active-filters-bar {
        float: none;
        max-width: 100%;
        margin-bottom: 10px;
    }
}

/* Active filters chips */
.ggs-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 15px;
    padding-bottom: 15px;
    border-bottom: 1px solid #e0e0e0;
}
.ggs-active-filter {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    background: #f5f5f5;
    border: 1px solid #ddd;
    border-radius: 3px;
    padding: 4px 8px;
    font-size: 13px;
    line-height: 1.3;
}
.ggs-remove-filter {
    background: none;
    border: none;
    cursor: pointer;
    font-size: 16px;
    line-height: 1;
    color: #999;
    padding: 0 2px;
}
.ggs-remove-filter:hover {
    color: #333;
}

/* Filter group */
.ggs-filter-group {
    margin-bottom: 5px;
}
.ggs-filter-title {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 16px;
    font-weight: 700;
    margin: 0;
    padding: 12px 0 10px;
    border-bottom: 2px solid #222;
    cursor: pointer;
    user-select: none;
    line-height: 1.3;
}
.ggs-filter-title:hover {
    opacity: 0.8;
}
.ggs-toggle-arrow {
    font-size: 12px;
    transition: transform 0.2s;
}

/* Collapsed state */
.ggs-filter-group fieldset,
.ggs-filter-group .ggs-sale-toggle {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease, padding 0.3s ease;
    padding: 0;
    margin: 0;
    border: 0;
}
.ggs-filter-group.open fieldset,
.ggs-filter-group.open .ggs-sale-toggle {
    max-height: 1000px;
    padding-top: 12px;
}

/* Screen reader only */
.ggs-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Checkbox list */
.ggs-checkbox-list {
    list-style: none;
    padding: 0;
    margin: 0;
}
.ggs-checkbox-list li {
    margin-bottom: 8px;
}
.ggs-checkbox {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 15px;
    line-height: 1.3;
}
.ggs-checkbox input[type="checkbox"] {
    position: absolute;
    opacity: 0;
    width: 0;
    height: 0;
}
.ggs-checkbox-control {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    min-width: 20px;
    border: 2px solid #ccc;
    border-radius: 3px;
    background: #fff;
    transition: all 0.15s ease;
}
.ggs-checkbox input[type="checkbox"]:checked + .ggs-checkbox-control {
    background: #222;
    border-color: #222;
}
.ggs-checkbox input[type="checkbox"]:checked + .ggs-checkbox-control::after {
    content: '';
    display: block;
    width: 5px;
    height: 10px;
    border: solid #fff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    margin-top: -2px;
}
.ggs-checkbox input[type="checkbox"]:focus + .ggs-checkbox-control {
    box-shadow: 0 0 0 2px rgba(0, 0, 0, 0.1);
}
.ggs-checkbox-label {
    flex: 1;
}

/* Sale toggle */
.ggs-sale-toggle {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
}
.ggs-sale-button {
    padding: 8px 16px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    cursor: pointer;
    font-size: 14px;
    transition: all 0.15s ease;
}
.ggs-sale-button:hover {
    border-color: #999;
}
.ggs-sale-button.active {
    background: #222;
    color: #fff;
    border-color: #222;
}

/* Pagination */
.ggs-pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 4px;
    margin: 30px 0 20px;
    padding-top: 20px;
    flex-wrap: wrap;
}
.ggs-page-link {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 36px;
    height: 36px;
    padding: 0 10px;
    border: 1px solid #ddd;
    border-radius: 3px;
    background: #fff;
    color: #333;
    text-decoration: none;
    font-size: 14px;
    transition: all 0.15s ease;
}
.ggs-page-link:hover {
    border-color: #222;
    color: #222;
}
.ggs-page-link.ggs-active {
    background: #222;
    color: #fff;
    border-color: #222;
    pointer-events: none;
}
.ggs-dots {
    padding: 0 4px;
    color: #999;
}
.ggs-prev,
.ggs-next {
    font-size: 13px;
}

/* Loading state */
.ggs-loading {
    position: relative;
    pointer-events: none;
}
.ggs-loading::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(255, 255, 255, 0.7);
    z-index: 10;
}
.ggs-loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 40px;
    height: 40px;
    margin: -20px 0 0 -20px;
    border: 3px solid #ddd;
    border-top-color: #222;
    border-radius: 50%;
    animation: ggs-spin 0.6s linear infinite;
    z-index: 11;
}
@keyframes ggs-spin {
    to { transform: rotate(360deg); }
}

/* Responsive */
@media (max-width: 768px) {
    .ggs-filter-title {
        font-size: 15px;
        padding: 10px 0 8px;
    }
    .ggs-checkbox {
        font-size: 14px;
    }
    .ggs-sale-button {
        font-size: 13px;
        padding: 6px 12px;
    }
    .ggs-pagination {
        gap: 3px;
    }
    .ggs-page-link {
        min-width: 32px;
        height: 32px;
        font-size: 13px;
    }
}

/* Override global button hover/focus styles for remove-filter buttons */
button.ggs-remove-filter,
button.ggs-remove-filter:hover,
button.ggs-remove-filter:focus,
button.ggs-remove-filter:active,
#ggs-active-filters-bar button.ggs-remove-filter,
#ggs-active-filters-bar button.ggs-remove-filter:hover,
#ggs-active-filters-bar button.ggs-remove-filter:focus,
.ggs-filters button.ggs-remove-filter,
.ggs-filters button.ggs-remove-filter:hover,
.ggs-filters button.ggs-remove-filter:focus {
    background: none !important;
    background-color: transparent !important;
    color: #999 !important;
    border: none !important;
    box-shadow: none !important;
    outline: none !important;
    padding: 0 2px !important;
    min-height: 0 !important;
    line-height: 1 !important;
}
#ggs-active-filters-bar button.ggs-remove-filter:hover,
.ggs-filters button.ggs-remove-filter:hover,
button.ggs-remove-filter:hover {
    color: #333 !important;
    background: none !important;
    background-color: transparent !important;
}
