/* ============================================
   Bigger eCommerce — Shop Page
   ============================================ */

.be-shop {
    font-family: var(--be-font);
    color: var(--be-text);
    box-sizing: border-box;
    max-width: var(--be-container, 1370px);
    margin: 16px auto;
    padding: 0 20px;
}
.be-shop * { box-sizing: border-box; }

.be-shop__bar {
    background: var(--be-bg-white);
    border-radius: var(--be-radius);
    padding: 12px 16px;
    margin-bottom: 12px;
    box-shadow: var(--be-shadow-sm);
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: 16px;
    justify-content: flex-start;
    position: sticky;
    top: 0;
    z-index: 50;
}
.be-shop__count {
    font-size: 14px;
    color: var(--be-text-secondary);
    white-space: nowrap;
}
.be-shop__count b {
    color: var(--be-brand);
    font-weight: 700;
}
.be-shop__filters {
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
    margin-right: 0px;
}

/* حاوية السمات الديناميكية: مخفية افتراضياً، تظهر فقط عند اختيار فئة */
#be-shop-attrs {
    display: none;
    flex-wrap: wrap;
    gap: 8px;
    align-items: center;
}
#be-shop-attrs.is-visible {
    display: flex;
}
/* fallback للمتصفحات الحديثة: إظهار تلقائي عند وجود محتوى */
#be-shop-attrs:has(.be-shop__select) {
    display: flex;
}
.be-shop__select {
    position: relative;
    display: inline-block;
}
.be-shop__select-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 7px 14px;
    border: 1px solid var(--be-border);
    border-radius: var(--be-radius-pill);
    background: var(--be-bg-white);
    font-size: 13px;
    font-weight: 500;
    color: var(--be-text);
    cursor: pointer;
    transition: border-color var(--be-transition-fast), color var(--be-transition-fast), background var(--be-transition-fast);
    white-space: nowrap;
    font-family: inherit;
}
.be-shop__select-btn:hover {
    border-color: var(--be-brand);
}
.be-shop__select-btn.is-active {
    border-color: var(--be-brand);
    color: var(--be-brand);
    background: var(--be-brand-light);
}
.be-shop__select.is-open .be-shop__select-btn svg:last-child {
    transform: rotate(180deg);
}
.be-shop__select-btn svg {
    transition: transform var(--be-transition);
}
.be-shop__dropdown {
    display: none;
    position: absolute;
    top: calc(100% + 6px);
    inset-inline-start: 0;
    min-width: 220px;
    background: var(--be-bg-white);
    border: 1px solid var(--be-border);
    border-radius: var(--be-radius);
    box-shadow: var(--be-shadow-md);
    padding: 12px;
    z-index: 100;
    max-height: 320px;
    overflow-y: auto;
}
.be-shop__select.is-open .be-shop__dropdown {
    display: block;
}
.be-shop__dropdown label {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 4px;
    font-size: 13px;
    cursor: pointer;
    border-radius: var(--be-radius-sm);
    transition: background var(--be-transition-fast);
}
.be-shop__dropdown label:hover {
    background: var(--be-bg-gray);
}
.be-shop__dropdown input[type=checkbox] {
    accent-color: var(--be-brand);
    width: 16px;
    height: 16px;
}
.be-shop__filter-count {
    color: var(--be-text-muted);
    font-size: 11px;
}
.be-shop__dropdown--price {
    min-width: 280px;
}
.be-shop__price-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}
.be-shop__price-input {
    flex: 1;
    min-width: 0;
    padding: 6px 10px;
    border: 1px solid var(--be-border);
    border-radius: var(--be-radius-sm);
    font-size: 13px;
    outline: none;
    font-family: inherit;
}
.be-shop__price-input:focus {
    border-color: var(--be-brand);
}
.be-shop__price-sep {
    color: var(--be-text-muted);
}
.be-shop__price-apply {
    width: 100%;
    padding: 8px;
    background: var(--be-brand);
    color: #fff;
    border: none;
    border-radius: var(--be-radius-sm);
    font-size: 13px;
    font-weight: 600;
    cursor: pointer;
    font-family: inherit;
}
.be-shop__price-apply:hover {
    background: var(--be-brand-hover);
}
.be-shop__sort {
    padding: 7px 14px;
    border: 1px solid var(--be-border);
    border-radius: var(--be-radius-pill);
    font-size: 13px;
    color: var(--be-text);
    background: var(--be-bg-white);
    cursor: pointer;
    outline: none;
    font-family: inherit;
}
.be-shop__sort:focus {
    border-color: var(--be-brand);
}

.be-shop__active-filters {
    display: flex;
    flex-wrap: wrap;
    gap: 6px;
    margin-bottom: 12px;
    min-height: 0;
}
.be-shop__active-filters:empty {
    margin-bottom: 0;
}
.be-shop__subcats {
    margin-bottom: 16px;
}
.be-shop__subcats:empty {
    display: none;
}

/* ===== الفئات الفرعية (تستخدم أنماط be-catgrid الموحّدة من home.css) ===== */
/* الفرق الوحيد: أسهم التنقّل لها خلفية/حدود مختلفة عن الرئيسية */
.be-shop__subcats .be-catgrid__arrow {
    width: 32px;
    height: 32px;
    background: var(--be-bg-white);
    border: 1px solid var(--be-border);
    border-radius: var(--be-radius-sm);
}
.be-shop__subcats .be-catgrid__arrow svg {
    width: 20px;
    height: 20px;
}

.be-shop__chip {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 10px;
    background: var(--be-brand-light);
    border-radius: var(--be-radius-pill);
    font-size: 12px;
    color: var(--be-brand);
    cursor: pointer;
    transition: background var(--be-transition-fast), color var(--be-transition-fast);
}
.be-shop__chip:hover {
    background: var(--be-brand);
    color: #fff;
}
.be-shop__chip svg {
    width: 12px;
    height: 12px;
}
.be-shop__chip--clear {
    background: var(--be-bg-gray);
    color: var(--be-text-secondary);
}
.be-shop__chip--clear:hover {
    background: var(--be-text);
    color: #fff;
}

.be-shop__grid {
    display: grid;
    gap: 12px;
    min-height: 400px;
}
.be-shop__empty {
    grid-column: 1 / -1;
    text-align: center;
    padding: 60px 20px;
    color: var(--be-text-muted);
}
.be-shop__empty svg {
    margin: 0 auto 12px;
    display: block;
    opacity: 0.3;
}
.be-shop__empty h3 {
    font-size: 16px;
    font-weight: 600;
    color: var(--be-text-secondary);
    margin: 0 0 4px;
}
.be-shop__empty p {
    font-size: 14px;
    margin: 0;
}
.be-shop__loading-text {
    text-align: center;
    padding: 20px 0;
    color: var(--be-text-muted);
    font-size: 14px;
    display: none;
}
.be-shop__spin {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2px solid var(--be-brand-light);
    border-top-color: var(--be-brand);
    border-radius: 50%;
    animation: be-shop-spin 0.6s linear infinite;
    vertical-align: middle;
    margin-inline-end: 6px;
}
@keyframes be-shop-spin {
    to { transform: rotate(360deg); }
}

.be-shop__loadmore-wrap {
    text-align: center;
    padding: 16px 0;
}
.be-shop__loadmore {
    padding: 12px 40px;
    border: 2px solid var(--be-brand);
    background: var(--be-bg-white);
    color: var(--be-brand);
    border-radius: var(--be-radius);
    font-size: 15px;
    font-weight: 700;
    cursor: pointer;
    font-family: inherit;
    transition: background var(--be-transition), color var(--be-transition);
}
.be-shop__loadmore:hover {
    background: var(--be-brand);
    color: #fff;
}
.be-shop__loadmore:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.be-shop__pager {
    text-align: center;
    padding: 20px 0;
    display: flex;
    justify-content: center;
    gap: 8px;
    flex-wrap: wrap;
}
.be-shop__page {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    min-width: 40px;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--be-border);
    border-radius: var(--be-radius);
    font-size: 14px;
    color: var(--be-text);
    cursor: pointer;
    text-decoration: none;
    transition: border-color var(--be-transition-fast), color var(--be-transition-fast), background var(--be-transition-fast);
    font-family: inherit;
}
.be-shop__page:hover {
    border-color: var(--be-brand);
    color: var(--be-brand);
}
.be-shop__page.is-current {
    background: var(--be-brand);
    color: #fff;
    border-color: var(--be-brand);
}
.be-shop__page.is-disabled {
    opacity: 0.4;
    cursor: default;
    pointer-events: none;
}

/* ===== Responsive ===== */
@media (max-width: 1024px) {
    .be-shop__bar {
        position: static;
        flex-wrap: wrap;
    }
    .be-shop__count {
        width: 100%;
        margin-bottom: 4px;
    }
    .be-shop__filters {
        margin-inline-start: 0;
        flex-wrap: wrap;
    }
}
@media (max-width: 768px) {
    .be-shop {
        padding: 0 12px;
    }
    .be-shop__bar {
        flex-direction: column;
        align-items: stretch;
        padding: 10px;
    }
    .be-shop__count {
        display: none;
    }
    .be-shop__filters {
        width: 100%;
        gap: 6px;
        overflow-x: auto;
        flex-wrap: nowrap;
        padding-bottom: 4px;
        -webkit-overflow-scrolling: touch;
    }
    .be-shop__filters::-webkit-scrollbar {
        display: none;
    }
    .be-shop__select-btn {
        font-size: 13px;
        padding: 6px 12px;
        flex: 0 0 auto;
    }
    .be-shop__sort {
        font-size: 13px;
        padding: 6px 12px;
        flex: 0 0 auto;
        min-width: 120px;
    }
    .be-shop__dropdown {
        position: fixed;
        inset-inline-start: 10px;
        inset-inline-end: 10px;
        bottom: auto;
        top: 50%;
        transform: translateY(-50%);
        min-width: auto;
        width: auto;
        z-index: 200;
    }
    .be-shop__dropdown--price {
        min-width: auto;
    }
    .be-shop__grid {
        grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
        gap: 8px;
    }
    .be-shop__page {
        min-width: 36px;
        height: 36px;
        padding: 0 8px;
        font-size: 13px;
    }
}
@media (max-width: 480px) {
    .be-shop__filters {
        gap: 4px;
    }
    .be-shop__select-btn {
        font-size: 12px;
        padding: 5px 10px;
    }
    .be-shop__sort {
        font-size: 12px;
        padding: 5px 10px;
        min-width: 100px;
    }
    .be-shop__grid {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px;
    }
    .be-shop__pager {
        gap: 4px;
        padding: 16px 0;
    }
    .be-shop__page {
        min-width: 32px;
        height: 32px;
        font-size: 12px;
        padding: 0 6px;
    }
    .be-shop__empty {
        padding: 40px 16px;
    }
}
