/* Mobile store PDP — same visual structure as home-feed .feed-card */

body.rewall-pdp-store.product-seo-page {
    --msp-nav-h: 88px;
    --msp-buy-h: 72px;
    background: #f8fafc;
}

.rewall-msp {
    width: 100%;
    max-width: 100vw;
    overflow-x: hidden;
    padding: 10px 10px calc(var(--msp-nav-h, 88px) + var(--msp-buy-h, 72px) + env(safe-area-inset-bottom, 0px) + 16px);
    box-sizing: border-box;
    background: #f8fafc;
}

.rewall-msp *,
.rewall-msp *::before,
.rewall-msp *::after {
    box-sizing: border-box;
}

.rewall-msp .feed-card {
    border: 1px solid #e2e8f0;
    border-radius: 16px;
    background: #fff;
    overflow: hidden;
    box-shadow: 0 8px 22px rgba(15, 23, 42, 0.06);
    cursor: default;
}

.rewall-msp .feed-media {
    position: relative;
    background: #0f172a;
    aspect-ratio: 1 / 1;
    width: 100%;
    overflow: hidden;
    cursor: zoom-in;
}

.rewall-msp .feed-media-topbar {
    position: absolute;
    top: 8px;
    right: 8px;
    z-index: 3;
    display: flex;
    align-items: center;
    pointer-events: none;
}

.rewall-msp .feed-media-topbar .feed-shop {
    pointer-events: auto;
    background: rgba(15, 23, 42, 0.42);
    color: #fff;
    padding: 4px 8px;
    border-radius: 999px;
    margin: 0;
    max-width: min(82vw, 320px);
    font-size: 12px;
    font-weight: 700;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    text-decoration: none;
}

.rewall-msp .feed-shop-logo-wrap {
    flex-shrink: 0;
    width: 30px;
    height: 30px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    overflow: hidden;
    background: #fff;
    border: 1px solid rgba(255, 255, 255, 0.35);
}

.rewall-msp .feed-shop-logo {
    width: 100%;
    height: 100%;
    object-fit: contain;
    border-radius: 50%;
    display: block;
}

.rewall-msp .feed-shop-label {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    color: #fff;
}

.rewall-msp .feed-media-carousel {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    direction: ltr;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    overscroll-behavior-y: contain;
}

.rewall-msp .feed-media-carousel::-webkit-scrollbar {
    display: none;
}

.rewall-msp .feed-media-slide {
    flex: 0 0 100%;
    width: 100%;
    min-width: 100%;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    position: relative;
    overflow: hidden;
    background: #0f172a;
    display: flex;
    align-items: center;
    justify-content: center;
}

/* تصویر کامل داخل همان باکس مربعی — بدون کراپ؛ فضای خالی اطراف OK */
.rewall-msp .feed-media-slide > img {
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center center;
    display: block;
    background: transparent;
    pointer-events: none;
}

.rewall-msp .feed-media-slide > video {
    width: auto !important;
    height: auto !important;
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    object-position: center center;
    display: block;
    background: #000;
}

.rewall-msp .feed-video-slide {
    display: block;
}

.rewall-msp .feed-video-slide .feed-video-poster,
.rewall-msp .feed-video-slide video {
    position: absolute;
    inset: 0;
    width: 100% !important;
    height: 100% !important;
    max-width: none;
    max-height: none;
    object-fit: contain;
    object-position: center center;
    background: #0f172a;
}

.rewall-msp .feed-video-slide video {
    z-index: 1;
    pointer-events: auto;
}

.rewall-msp .msp-thumbs {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 10px 12px 0;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior-x: contain;
    touch-action: pan-x;
    direction: rtl;
}

.rewall-msp .msp-thumbs::-webkit-scrollbar {
    display: none;
}

.rewall-msp .msp-thumb {
    position: relative;
    flex: 0 0 56px;
    width: 56px;
    height: 56px;
    padding: 0;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
}

.rewall-msp .msp-thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
    pointer-events: none;
}

.rewall-msp .msp-thumb.is-active {
    border-color: #4f46e5;
    box-shadow: 0 0 0 2px rgba(79, 70, 229, 0.25);
}

.rewall-msp .msp-thumb__play {
    position: absolute;
    inset: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    background: rgba(15, 23, 42, 0.35);
    color: #fff;
    font-size: 18px;
    pointer-events: none;
}

.rewall-msp .feed-content {
    padding: 10px 12px 12px;
    text-align: right;
}

.rewall-msp .feed-meta-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    direction: rtl;
    gap: 6px;
    margin-bottom: 4px;
}

.rewall-msp .feed-content-top-actions {
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    direction: rtl;
}

.rewall-msp .feed-top-follow-btn {
    border: none;
    border-radius: 999px;
    font-size: 10px;
    font-weight: 800;
    padding: 4px 8px;
    cursor: pointer;
    line-height: 1;
    background: #fff;
    color: #1f2937;
    border: 1px solid #e2e8f0;
}

.rewall-msp .feed-top-follow-btn.following {
    background: #fee2e2;
    color: #b91c1c;
    border-color: #fecaca;
}

.rewall-msp .feed-price-block {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    gap: 6px;
    margin: 2px 0 6px;
}

.rewall-msp .feed-price-old-row {
    display: flex;
    flex-direction: row;
    align-items: center;
    flex-wrap: wrap;
    gap: 8px;
}

.rewall-msp .feed-price-old {
    font-size: 13px;
    color: #94a3b8;
    text-decoration: line-through;
    font-weight: 600;
}

.rewall-msp .feed-discount-badge {
    font-size: 13px;
    color: #ef4444;
    background: transparent;
    border-radius: 0;
    padding: 0;
    font-weight: 800;
}

.rewall-msp .feed-price {
    margin-top: 0;
    font-size: 16px;
    color: #0f172a;
    font-weight: 800;
    line-height: 1.3;
}

.rewall-msp .feed-price--sale {
    font-size: 20px;
    color: #ef4444;
    font-weight: 800;
}

.rewall-msp .feed-price-block .rewall-pdp-installment-offer {
    align-items: flex-start;
    margin-top: 2px;
    gap: 6px;
}

.rewall-msp .feed-price-block .rewall-pdp-installment-offer__logos {
    justify-content: flex-start;
}

.rewall-msp .feed-price-block .rewall-pdp-installment-offer__body,
.rewall-msp .feed-price-block .rewall-pdp-installment-offer__footnote {
    align-items: flex-start;
    text-align: right;
}

.rewall-msp .msp-product-title {
    margin: 8px 0 0;
    font-size: 15px;
    font-weight: 800;
    color: #0f172a;
    line-height: 1.45;
}

.rewall-msp .msp-seo-block {
    margin-top: 10px;
}

.rewall-msp .msp-seo-label {
    margin: 0 0 8px;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    font-size: 12px;
    font-weight: 800;
    color: #3730a3;
}

.rewall-msp .msp-seo-label i {
    font-size: 13px;
}

.rewall-msp .msp-seo-text {
    margin: 0;
    padding: 12px 14px;
    border-radius: 14px;
    border: 1px solid #e2e8f0;
    background: #f8fafc;
    font-size: 13px;
    font-weight: 600;
    color: #334155;
    line-height: 1.85;
}

.rewall-msp .msp-handmade-notice {
    margin: 10px 0 0;
    padding: 8px 10px;
    border-radius: 10px;
    background: #fff7ed;
    border: 1px solid #fed7aa;
    color: #9a3412;
    font-size: 11px;
    font-weight: 700;
    line-height: 1.6;
}

/* Fixed order/detail bar above floating nav */
.msp-buybar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: calc(var(--msp-nav-h, 88px) + env(safe-area-inset-bottom, 0px));
    z-index: 9980;
    padding: 10px 12px;
    background: rgba(255, 255, 255, 0.96);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -6px 20px rgba(15, 23, 42, 0.08);
}

.msp-buybar__inner {
    display: flex;
    align-items: center;
    gap: 8px;
    max-width: 560px;
    margin: 0 auto;
}

.rewall-msp .feed-btn {
    border: none;
    border-radius: 10px;
    min-height: 32px;
    font-size: 11px;
    font-weight: 700;
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
}

.msp-buybar .feed-btn-order {
    flex: 1.35;
    min-height: 44px;
    font-size: 13px;
    background: linear-gradient(135deg, #ff2d55, #ff5f84);
    color: #fff;
    box-shadow: 0 8px 20px rgba(255, 45, 85, 0.35);
}

.msp-buybar .feed-btn-order.is-oos,
.msp-buybar .feed-btn-order:disabled {
    background: #94a3b8;
    box-shadow: none;
    cursor: not-allowed;
    opacity: 0.95;
}

.msp-buybar .feed-btn-detail {
    flex: 0.72;
    min-height: 44px;
    font-size: 12px;
    background: #f1f5f9;
    color: #334155;
    border: 1px solid #cbd5e1;
}

.rewall-msp .feed-btn-share,
.rewall-msp .feed-btn-like,
.rewall-msp .feed-btn-bookmark {
    width: 32px;
    min-width: 32px;
    border-radius: 9px;
    background: #e2e8f0;
    color: #0f172a;
    padding: 0;
}

.rewall-msp .feed-btn-like {
    font-size: 16px;
    color: #64748b;
}

.rewall-msp .feed-btn-bookmark {
    font-size: 15px;
    color: #64748b;
}

.rewall-msp .feed-btn-like.liked {
    background: #fecaca;
    color: #dc2626;
}

.rewall-msp .feed-btn-bookmark.bookmarked {
    background: #dbeafe;
    color: #1d4ed8;
}

.rewall-msp .feed-btn-share svg {
    width: 16px;
    height: 16px;
    stroke: currentColor;
    fill: none;
    stroke-width: 2;
    stroke-linecap: round;
    stroke-linejoin: round;
}

/* جزئیات بدون گالری روی PDP فروشگاهی */
#product-detail.product-detail--no-gallery #product-popup-gallery,
#product-detail.product-detail--no-gallery .product-popup-separator {
    display: none !important;
}

/* بدون گالری: ارتفاع از محتوا؛ بزرگ‌تر از ویوپورت نشود */
#product-detail.product-detail--no-gallery .product-popup-scroll {
    flex: 0 1 auto;
}

@media (max-width: 767.98px) {
    html:has(body.rewall-pdp-store),
    body.rewall-pdp-store {
        overflow-x: clip;
        overscroll-behavior-y: none;
        overscroll-behavior-x: none;
    }

    body.rewall-pdp-store {
        --msp-header-h: 62px;
    }

    body.rewall-pdp-store #product-detail {
        padding: 0;
        align-items: flex-end;
        justify-content: flex-end;
    }

    body.rewall-pdp-store #product-detail .popup-box {
        width: 100%;
        max-width: 100%;
        height: auto;
        max-height: calc(100dvh - env(safe-area-inset-top, 0px) - 8px);
        border-radius: 24px 24px 0 0;
        box-sizing: border-box;
    }

    body.rewall-pdp-store #product-detail.product-detail--no-gallery .popup-box {
        max-height: min(92dvh, calc(100dvh - env(safe-area-inset-top, 0px) - 8px));
    }

    /* fixed header — sticky روی موبایل با گالری افقی می‌لرزد/جابه‌جا می‌شود */
    body.rewall-pdp-store .rewall-pdp-mobile-header {
        position: fixed !important;
        top: 0;
        left: 0;
        right: 0;
        width: 100%;
        z-index: 1050;
        padding-top: env(safe-area-inset-top, 0px);
        background: rgba(255, 255, 255, 0.96);
        backdrop-filter: blur(10px);
        -webkit-backdrop-filter: blur(10px);
        border-bottom: 1px solid #e2e8f0;
        transform: translateZ(0);
        -webkit-transform: translateZ(0);
    }

    body.rewall-pdp-store .rewall-pdp-mobile-header .app-mobile-header {
        position: relative;
        top: auto;
        background: transparent;
        border-bottom: none;
        backdrop-filter: none;
        -webkit-backdrop-filter: none;
    }

    body.rewall-pdp-store .product-seo-app {
        padding-top: calc(var(--msp-header-h) + env(safe-area-inset-top, 0px));
        background: #f8fafc;
        min-height: 100dvh;
    }

    body.rewall-pdp-store .cmn-wrap.d-md-none {
        display: block;
        z-index: 1060 !important;
    }

    body.rewall-pdp-store .feed-desk-footer,
    body.rewall-pdp-store .footer-desktop {
        display: none !important;
    }

    body.rewall-pdp-store .pending-order-toast,
    body.rewall-pdp-store .shop-fulfillment-toast,
    body.rewall-pdp-store .toast-slow-net,
    body.rewall-pdp-store #toast.toast {
        bottom: calc(var(--msp-nav-h, 88px) + var(--msp-buy-h, 72px) + env(safe-area-inset-bottom, 0px) + 12px) !important;
        z-index: 10050 !important;
    }
}

@media (min-width: 768px) {
    .rewall-msp,
    .msp-buybar,
    .msp-lightbox {
        display: none !important;
    }
}

/* Fullscreen gallery lightbox (mobile store) */
.msp-lightbox {
    position: fixed;
    inset: 0;
    z-index: 12000;
    display: none;
    flex-direction: column;
    background: rgba(2, 6, 23, 0.96);
    color: #fff;
    padding: env(safe-area-inset-top, 0px) 0 env(safe-area-inset-bottom, 0px);
    box-sizing: border-box;
}

.msp-lightbox.is-open {
    display: flex;
}

.msp-lightbox__chrome {
    flex: 0 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 10px 14px;
}

.msp-lightbox__close {
    width: 42px;
    height: 42px;
    border: none;
    border-radius: 12px;
    background: rgba(255, 255, 255, 0.12);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
}

.msp-lightbox__counter {
    font-size: 13px;
    font-weight: 700;
    color: rgba(255, 255, 255, 0.85);
}

.msp-lightbox__stage {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    display: flex;
    align-items: center;
}

.msp-lightbox__viewport {
    display: flex;
    width: 100%;
    height: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    scroll-snap-type: x mandatory;
    scroll-behavior: smooth;
    direction: ltr;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    overscroll-behavior: contain;
}

.msp-lightbox__viewport::-webkit-scrollbar {
    display: none;
}

.msp-lightbox__slide {
    flex: 0 0 100%;
    width: 100%;
    height: 100%;
    scroll-snap-align: start;
    scroll-snap-stop: always;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 8px 12px;
    box-sizing: border-box;
}

.msp-lightbox__slide img,
.msp-lightbox__slide video {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
    border-radius: 10px;
    background: #000;
}

.msp-lightbox__nav {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    z-index: 2;
    width: 44px;
    height: 44px;
    border: none;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.16);
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
}

.msp-lightbox__nav--prev {
    right: 10px;
}

.msp-lightbox__nav--next {
    left: 10px;
}

.msp-lightbox__thumbs {
    flex: 0 0 auto;
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 12px 14px 16px;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    direction: rtl;
}

.msp-lightbox__thumbs::-webkit-scrollbar {
    display: none;
}

.msp-lightbox__thumb {
    position: relative;
    flex: 0 0 58px;
    width: 58px;
    height: 58px;
    padding: 0;
    border: 2px solid rgba(255, 255, 255, 0.25);
    border-radius: 12px;
    overflow: hidden;
    background: #0f172a;
}

.msp-lightbox__thumb img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

.msp-lightbox__thumb.is-active {
    border-color: #818cf8;
    box-shadow: 0 0 0 2px rgba(129, 140, 248, 0.35);
}

body.msp-lightbox-open {
    overflow: hidden !important;
}
