/**
 * أزرار المنتج والصور — يعتمد على متغيرات CSS (نفس الأسماء في global-admin.css :root).
 * تُحدَّث القيم من Firestore عبر store-product-display.js على عنصر html.
 */
:root {
    --dedo-buy-now-bg: #ea580c;
    --dedo-buy-now-text: #ffffff;
    --dedo-buy-now-border: #c2410c;
}

.btn-buy-now-store,
a.btn-buy-now-store,
.home-prod-card .btn-buy-now-store,
button.btn-buy-now-store {
    background: var(--dedo-buy-now-bg) !important;
    background-image: none !important;
    color: var(--dedo-buy-now-text) !important;
    border: 2px solid var(--dedo-buy-now-border) !important;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.14) !important;
}

/* إخفاء الزر على المتجر فقط (لوحة التحكم تبقى للمعاينة) */
body:not(.merchant-dashboard).dedo-buy-now-off .btn-buy-now-store,
body:not(.merchant-dashboard).dedo-buy-now-off a.btn-buy-now-store {
    display: none !important;
}

/* بطاقات القائمة: إظهار الزر عند التمرير فقط — دون تعطيل النقر (كان pointer-events:none يمنع الضغط المباشر على الزر) */
body:not(.merchant-dashboard).dedo-buy-now-card-hover .card-product:not(:hover) .btn-buy-now-store,
body:not(.merchant-dashboard).dedo-buy-now-card-hover .home-prod-card:not(:hover) .btn-buy-now-store {
    opacity: 0;
    transition: opacity 0.22s ease;
}

body:not(.merchant-dashboard).dedo-buy-now-card-hover .card-product:hover .btn-buy-now-store,
body:not(.merchant-dashboard).dedo-buy-now-card-hover .home-prod-card:hover .btn-buy-now-store {
    opacity: 1;
}

@media (hover: none) {
    body:not(.merchant-dashboard).dedo-buy-now-card-hover .card-product:not(:hover) .btn-buy-now-store,
    body:not(.merchant-dashboard).dedo-buy-now-card-hover .home-prod-card:not(:hover) .btn-buy-now-store {
        opacity: 1;
    }
}

/* أزرار الإجراء فوق أي طبقات ضمن البطاقة */
.product-card-actions,
.home-prod-card-actions {
    position: relative;
    z-index: 2;
}

/* تكبير صورة المنتج عند التمرير */
body.dedo-product-zoom-hover .product-main-img,
body.dedo-product-zoom-hover .home-prod-card-media-link img,
body.dedo-product-zoom-hover .pd-main-img,
body.dedo-product-zoom-hover .pd-related-card img {
    transition: transform 0.45s cubic-bezier(0.4, 0, 0.2, 1);
    transform-origin: center center;
}

body.dedo-product-zoom-hover a.product-card-hit:hover .product-main-img,
body.dedo-product-zoom-hover .card-product:hover .product-main-img,
body.dedo-product-zoom-hover .home-prod-card:hover .home-prod-card-media-link img,
body.dedo-product-zoom-hover .pd-main-img:hover,
body.dedo-product-zoom-hover .pd-related-card:hover img {
    transform: scale(1.07);
}

/* ——— إعدادات عرض الأقسام (sectionsLayout في appearance) ——— */
body:not(.merchant-dashboard).dedo-sec-layout-grid .home-prod-grid {
    display: grid;
    grid-template-columns: repeat(2, minmax(0, 1fr));
    gap: 1rem;
}
@media (min-width: 480px) {
    body:not(.merchant-dashboard).dedo-sec-layout-grid .home-prod-grid {
        grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    }
}

body:not(.merchant-dashboard).dedo-sec-layout-horizontal .home-prod-grid,
body:not(.merchant-dashboard).dedo-sec-layout-horizontal .store-cat-products-block .product-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    overflow-y: hidden;
    gap: 1rem;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    grid-template-columns: unset;
}

body:not(.merchant-dashboard).dedo-sec-layout-horizontal .home-prod-grid > .home-prod-card,
body:not(.merchant-dashboard).dedo-sec-layout-horizontal .store-cat-products-block .product-grid > .card-product {
    flex: 0 0 min(46vw, 200px);
    max-width: min(46vw, 200px);
    scroll-snap-align: start;
}

body:not(.merchant-dashboard).dedo-sec-layout-horizontal .home-featured-grid {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    overflow-x: auto;
    gap: 1.15rem;
    padding-bottom: 10px;
    -webkit-overflow-scrolling: touch;
    scroll-snap-type: x mandatory;
    grid-template-columns: unset;
}

body:not(.merchant-dashboard).dedo-sec-layout-horizontal .home-featured-grid > .home-prod-card {
    flex: 0 0 min(46vw, 200px);
    max-width: min(46vw, 200px);
    scroll-snap-align: start;
}

/* محاذاة عنوان القسم (يتجاوز أنماط الصفحة الداخلية) */
body:not(.merchant-dashboard).dedo-sec-title-center #home-sections-root .home-sec-title,
body:not(.merchant-dashboard).dedo-sec-title-center .store-cat-heading {
    text-align: center !important;
}
body:not(.merchant-dashboard).dedo-sec-title-right #home-sections-root .home-sec-title,
body:not(.merchant-dashboard).dedo-sec-title-right .store-cat-heading {
    text-align: right !important;
}
body:not(.merchant-dashboard).dedo-sec-title-left #home-sections-root .home-sec-title,
body:not(.merchant-dashboard).dedo-sec-title-left .store-cat-heading {
    text-align: left !important;
}

body:not(.merchant-dashboard).dedo-sec-title-center .home-featured-head {
    justify-content: center;
}
body:not(.merchant-dashboard).dedo-sec-title-center .home-featured-head .sub {
    text-align: center;
}
body:not(.merchant-dashboard).dedo-sec-title-right .home-featured-head {
    justify-content: flex-end;
}
body:not(.merchant-dashboard).dedo-sec-title-right .home-featured-head .sub {
    text-align: right;
}
body:not(.merchant-dashboard).dedo-sec-title-left .home-featured-head {
    justify-content: flex-start;
}
body:not(.merchant-dashboard).dedo-sec-title-left .home-featured-head .sub {
    text-align: left;
}

.store-cat-more-link {
    display: inline-block;
    margin-top: 0.85rem;
    font-weight: 900;
    font-size: 0.95rem;
    color: var(--primary-color, #2563eb);
    text-decoration: none;
}
.store-cat-more-link:hover {
    text-decoration: underline;
}
