:root {
    --menu-overlap-offset: 0px;
}

.catalog_filtr {
    width: 280px;
    flex-shrink: 0;
    padding: 0;
    background-color: #ffffff;
    border: 1px solid #e5e5e5;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.04);
    font-family: system-ui, sans-serif;
    /* overflow: hidden потрібен для border-radius, але висота НЕ обмежена — фільтр не обрізається */
    overflow: hidden;
    margin-top: var(--menu-overlap-offset);
    position: sticky;
    top: calc(var(--menu-overlap-offset) + 24px);
    align-self: flex-start;
    z-index: 5;
}

@media (max-width: 900px) {
    .shop-page-responsive > .catalog_filtr {
        position: static;
        margin-top: 0;
        overflow: hidden;
        width: 100%;
        align-self: start;
        top: auto;
        z-index: auto;
    }
}
@media (min-width: 901px) {
    .shop-page-responsive > .catalog_filtr {
        position: sticky;
        top: 24px;
    }
}

.catalog_filtr form {
    display: flex;
    flex-direction: column;
}

.filtr-panel-title {
    margin: 0;
    padding: 16px 18px;
    font-size: 15px;
    font-weight: 700;
    color: #1e293b;
    border-bottom: 1px solid #f1f5f9;
}

.filter-group {
    margin: 0;
    padding: 0;
    border-bottom: 1px solid #f1f5f9;
}
.filter-group:last-of-type {
    border-bottom: none;
}

.h4-filtr {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    width: 100%;
    margin: 0;
    padding: 14px 18px;
    font-family: inherit;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.01em;
    color: #334155;
    background: #ffffff;
    border: none;
    text-align: left;
    cursor: pointer;
    user-select: none;
    transition: color 0.15s ease, background-color 0.15s ease;
}
.h4-filtr:hover {
    background: #fdf2f8;
    color: #db2777;
}
.filter-group.open .h4-filtr {
    color: #db2777;
}

.h4-filtr::after {
    content: "";
    width: 7px;
    height: 7px;
    flex-shrink: 0;
    border-right: 1.5px solid #94a3b8;
    border-bottom: 1.5px solid #94a3b8;
    transform: rotate(45deg);
    transition: transform 0.15s ease, border-color 0.15s ease;
}
.filter-group.open .h4-filtr::after {
    transform: rotate(-135deg);
    border-color: #db2777;
}

.h4-filtr-label {
    display: inline-flex;
    align-items: center;
    gap: 8px;
}
.h4-filtr-label::before {
    content: "";
    display: inline-block;
    width: 3px;
    height: 13px;
    border-radius: 2px;
    background: #db2777;
    flex-shrink: 0;
}
.filter-panel-body {
    display: none;
    padding: 4px 18px 16px;
}
.filter-group.open .filter-panel-body {
    display: block;
    animation: filtrSlideDown 0.15s ease-out;
}
@keyframes filtrSlideDown {
    from { opacity: 0; transform: translateY(-4px); }
    to   { opacity: 1; transform: translateY(0); }
}


.vid-do_div {
    display: flex;
    align-items: center;
    gap: 8px;
}
.vid-do {
    width: 100%;
    padding: 9px 10px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    font-size: 13px;
    color: #334155;
    background: #f8fafc;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.vid-do::placeholder {
    color: #94a3b8;
}
.vid-do:hover {
    border-color: #cbd5e1;
}
.vid-do:focus {
    outline: none;
    border-color: #db2777;
    background: #ffffff;
    box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.12);
}
.vid-do::-webkit-outer-spin-button,
.vid-do::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.checkbox-list {
    max-height: 220px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-right: -6px;
    padding-right: 6px;
}
.checkbox-list::-webkit-scrollbar {
    width: 5px;
}
.checkbox-list::-webkit-scrollbar-thumb {
    background: #e2e8f0;
    border-radius: 10px;
}

.brand_label {
    display: flex;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    font-size: 13.5px;
    color: #475569;
    padding: 6px 6px;
    border-radius: 6px;
    transition: background-color 0.15s ease, color 0.15s ease;
}
.brand_label:hover {
    background: #fdf2f8;
    color: #334155;
}

.brand_label input[type="checkbox"] {
    appearance: none;
    -webkit-appearance: none;
    flex-shrink: 0;
    width: 17px;
    height: 17px;
    border: 1.5px solid #cbd5e1;
    border-radius: 5px;
    background: #ffffff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.15s ease, background-color 0.15s ease;
}
.brand_label input[type="checkbox"]:hover {
    border-color: #db2777;
}
.brand_label input[type="checkbox"]:focus-visible {
    outline: 2px solid #db2777;
    outline-offset: 2px;
}
.brand_label input[type="checkbox"]:checked {
    background: #db2777;
    border-color: #db2777;
}
.brand_label input[type="checkbox"]:checked::after {
    content: "";
    width: 5px;
    height: 9px;
    border: solid #ffffff;
    border-width: 0 2px 2px 0;
    transform: rotate(45deg) translate(-1px, -1px);
}
.brand_label:has(input[type="checkbox"]:checked) {
    color: #db2777;
    font-weight: 500;
}

.filter-actions {
    padding: 16px 18px;
}

.button_save_filtr {
    width: 100%;
    background: #db2777;
    color: #fff;
    border: none;
    padding: 11px;
    border-radius: 8px;
    cursor: pointer;
    font-weight: 600;
    font-size: 13.5px;
    transition: background-color 0.15s ease, transform 0.05s ease;
}
.button_save_filtr:hover {
    background: #be185d;
}
.button_save_filtr:active {
    transform: scale(0.98);
}

.remove-filtr {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    text-align: center;
    text-decoration: none;
    color: #64748b;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    font-size: 13px;
    font-weight: 500;
    padding: 10px 12px;
    border-radius: 8px;
    transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}
.remove-filtr::before {
    content: "×";
    font-size: 15px;
    line-height: 1;
}
.remove-filtr:hover {
    background: #ffe4e6;
    color: #b91c1c;
    border-color: #fecdd3;
}

#sortSelect {
    width: 100%;
    max-width: 260px;
    padding: 9px 12px;
    margin: 0 0 20px;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
    background: #ffffff;
    color: #334155;
    font-size: 13.5px;
    font-family: system-ui, sans-serif;
    cursor: pointer;
    transition: border-color 0.15s ease;
}
#sortSelect:hover {
    border-color: #cbd5e1;
}
#sortSelect:focus {
    outline: none;
    border-color: #db2777;
    box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.12);
}

@media (max-width: 900px) {
    .catalog_filtr {
        width: 100%;
        position: static;
        margin-top: 0;

    }
}

.catalog_filtr,
.catalog_filtr *,
#sortSelect {
    box-sizing: border-box;
}

@media (max-width: 600px) {
    .catalog_filtr {
        width: 100%;
        max-width: none;
        margin-top: 0;
        position: static;
        border-radius: 10px;
    }

    .catalog_filtr .filter-panel-body {
        padding-left: 12px;
        padding-right: 12px;
    }

    .vid-do_div {
        width: 100%;
    }

    .vid-do {
        min-width: 0;
    }

    #sortSelect {
        width: 100%;
        max-width: none;
    }
}

@media (min-width: 601px) and (max-width: 900px) {
    .catalog_filtr {
        width: 100%;
        max-width: none;
        margin-top: 0;
        position: static;
    }

    #sortSelect {
        max-width: 320px;
    }
}

@media (min-width: 901px) and (max-width: 1280px) {
    .catalog_filtr {
        width: 230px;
        margin-top: var(--menu-overlap-offset);
        position: sticky;
        top: calc(var(--menu-overlap-offset) + 24px);
    }
}

@media (min-width: 1281px) and (max-width: 1920px) {
    .catalog_filtr {
        width: 260px;
    }
}

@media (min-width: 1921px) and (max-width: 3840px) {
    .catalog_filtr {
        width: 300px;
    }
}

@media (min-width: 3841px) {
    .catalog_filtr {
        width: 320px;
    }
}

@media (max-width: 360px) {
    .catalog_filtr {
        border-radius: 8px;
    }

    .filtr-panel-title {
        padding: 13px 14px;
        font-size: 14px;
    }

    .h4-filtr {
        padding: 12px 14px;
        font-size: 12.5px;
    }

    .filter-actions {
        padding: 12px 14px;
    }
}