﻿/* چیدمان فیلترها و محصولات */
.shop-layout {
    display: grid;
    grid-template-columns: 235px minmax(0, 1fr);
    align-items: start;
    gap: 28px;
}

.shop-results,
.shop-filter-sidebar {
    min-width: 0;
}

.shop-page [hidden] {
    display: none !important;
}

.shop-sr-only {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* جست‌وجو و مرتب‌سازی */
.shop-toolbar {
    flex-wrap: wrap;
}

.shop-search {
    flex: 1 1 250px;
    min-width: 0;
}

    .shop-search input,
    .shop-sort select,
    .shop-price-fields input {
        width: 100%;
        min-height: 44px;
        padding: 10px 12px;
        border: 1px solid #dedede;
        border-radius: 8px;
        background: #ffffff;
        color: #181818;
        font: inherit;
        font-size: 14px;
    }

        .shop-search input:focus,
        .shop-sort select:focus,
        .shop-price-fields input:focus {
            outline: 2px solid #107047;
            outline-offset: 2px;
        }

.shop-sort {
    display: flex;
    align-items: center;
    gap: 8px;
}

    .shop-sort label {
        margin: 0;
        color: #666666;
        font-size: 13px;
        white-space: nowrap;
    }

    .shop-sort select {
        width: auto;
        max-width: 100%;
    }

/* کادر فیلترها */
.shop-filters {
    padding: 18px;
    border: 1px solid #e8e8e8;
    border-radius: 10px;
    background: #ffffff;
}

.shop-filters-heading {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    margin-bottom: 8px;
}

    .shop-filters-heading h2,
    .shop-filter-dialog-header h2 {
        margin: 0;
        font-size: 18px;
        font-weight: 700;
    }

.shop-clear-button {
    min-height: 44px;
    padding: 6px;
    border: 0;
    background: transparent;
    color: #107047;
    font: inherit;
    font-size: 12px;
    cursor: pointer;
}

.shop-filter-group {
    border-bottom: 1px solid #eeeeee;
}

    .shop-filter-group:last-child {
        border-bottom: 0;
    }

    .shop-filter-group > summary {
        display: flex;
        align-items: center;
        justify-content: space-between;
        gap: 10px;
        min-height: 52px;
        padding: 12px 0;
        color: #181818;
        font-size: 14px;
        font-weight: 700;
        list-style: none;
        cursor: pointer;
    }

        .shop-filter-group > summary::-webkit-details-marker {
            display: none;
        }

        .shop-filter-group > summary::after {
            content: "+";
            color: #666666;
            font-size: 20px;
            font-weight: 400;
        }

    .shop-filter-group[open] > summary::after {
        content: "−";
    }

.shop-filter-options {
    min-width: 0;
    margin: 0;
    padding: 0 0 12px;
    border: 0;
}

.shop-filter-option {
    display: flex;
    align-items: center;
    gap: 9px;
    min-height: 44px;
    margin: 0;
    padding: 6px 0;
    color: #444444;
    font-size: 13px;
    cursor: pointer;
}

    .shop-filter-option input {
        flex-shrink: 0;
        width: 17px;
        height: 17px;
        margin: 0;
        accent-color: #107047;
    }

.shop-filter-option-count {
    margin-inline-start: auto;
    color: #777777;
    font-size: 12px;
}

/* محدودهٔ قیمت */
.shop-price-fields {
    display: grid;
    gap: 8px;
    padding-bottom: 16px;
}

    .shop-price-fields label {
        margin: 0;
        color: #666666;
        font-size: 12px;
    }

    .shop-price-fields input {
        direction: ltr;
        text-align: right;
    }

        .shop-price-fields input[aria-invalid="true"] {
            border-color: #b42318;
        }

.shop-price-error {
    margin: 4px 0 0;
    color: #b42318;
    font-size: 12px;
    line-height: 1.9;
}

/* فیلترهای انتخاب‌شده */
.shop-active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    margin-bottom: 22px;
}

.shop-filter-chip {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    min-height: 44px;
    padding: 8px 12px;
    border: 1px solid #d5e8dc;
    border-radius: 8px;
    background: #eff8f3;
    color: #107047;
    font: inherit;
    font-size: 13px;
    cursor: pointer;
}

    .shop-filter-chip span:last-child {
        font-size: 18px;
    }

/* نتیجهٔ خالی */
.shop-empty-state {
    padding: 56px 20px;
    border: 1px dashed #dddddd;
    border-radius: 10px;
    text-align: center;
}

    .shop-empty-state h2 {
        margin: 0 0 12px;
        font-size: 20px;
        line-height: 1.8;
    }

    .shop-empty-state p {
        color: #666666;
        font-size: 14px;
        line-height: 2;
    }

.shop-filter-action,
.shop-filter-open-button {
    min-height: 44px;
    padding: 10px 18px;
    border: 1px solid #107047;
    border-radius: 8px;
    background: #107047;
    color: #ffffff;
    font: inherit;
    font-size: 14px;
    cursor: pointer;
}

    .shop-filter-action:disabled {
        opacity: 0.5;
        cursor: not-allowed;
    }

.shop-filter-open-button {
    display: none;
}

.shop-page button:focus-visible,
.shop-filter-group > summary:focus-visible,
.shop-filter-option input:focus-visible {
    outline: 2px solid #107047;
    outline-offset: 3px;
}

/* پنل فیلتر موبایل */
.shop-filter-dialog {
    position: fixed;
    inset: 0 0 0 auto;
    width: min(420px, 100%);
    max-width: 100%;
    height: 100vh;
    height: 100dvh;
    max-height: none;
    margin: 0;
    padding: 0;
    overflow: hidden;
    border: 0;
    background: #ffffff;
    color: #181818;
}

    .shop-filter-dialog[open] {
        display: flex;
        flex-direction: column;
    }

    .shop-filter-dialog::backdrop {
        background: rgba(0, 0, 0, 0.42);
    }

.shop-filter-dialog-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
    flex-shrink: 0;
    padding: 14px 20px;
    padding-top: max(14px, env(safe-area-inset-top));
    border-bottom: 1px solid #eeeeee;
}

.shop-filter-close {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    padding: 0;
    border: 0;
    border-radius: 8px;
    background: #f5f5f5;
    color: #333333;
    font-size: 30px;
    cursor: pointer;
}

.shop-filter-dialog-body {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    overscroll-behavior: contain;
}

    .shop-filter-dialog-body .shop-filters {
        padding: 8px 20px 20px;
        border: 0;
        border-radius: 0;
    }

    .shop-filter-dialog-body .shop-filters-heading {
        display: none;
    }

.shop-filter-dialog-footer {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    flex-shrink: 0;
    padding: 16px 20px;
    padding-bottom: max(16px, env(safe-area-inset-bottom));
    border-top: 1px solid #eeeeee;
    background: #ffffff;
}

html.shop-filter-open,
html.shop-filter-open body {
    overflow: hidden;
}

/* موبایل */
@media (max-width: 768px) {
    .shop-layout {
        display: block;
    }

    .shop-filter-sidebar {
        display: none;
    }

    .shop-search {
        flex-basis: 100%;
    }

    .shop-sort {
        flex: 1 1 auto;
    }

        .shop-sort select {
            min-width: 0;
            flex: 1;
        }

    .shop-page[data-filters-ready="true"] .shop-filter-open-button {
        display: inline-flex;
        align-items: center;
        justify-content: center;
    }

    .shop-view-controls {
        margin-inline-start: auto;
    }

    .shop-empty-state {
        padding: 36px 16px;
    }
}
