/*
 * Classic storefront theme layer.
 * Shared storefront structure, typography and colors live in /static/css/style.css.
 * Keep this file scoped to Classic-only additions so installing the theme does not
 * override the stable storefront visual baseline.
 */

.gb-storefront-app {
    --gb-classic-theme-loaded: 1;
}

.gb-storefront-app .gb-payment-methods-v31 {
    display: grid;
    gap: 10px;
}

.gb-storefront-app .gb-payment-method-v31 {
    position: relative;
    cursor: pointer;
}

.gb-storefront-app .gb-payment-method-v31 input[type="radio"] {
    position: absolute;
    opacity: 0;
    pointer-events: none;
}

/*
 * Preserve the original V31 payment card exactly:
 * soft gradient background, old border, old badge colors and old wording.
 * The hidden radio only adds gateway selection and must not redesign the card.
 */
.gb-storefront-app .gb-payment-method-v31.is-selected,
.gb-storefront-app .gb-payment-method-v31:has(input[type="radio"]:checked) {
    border-color: rgba(128, 26, 47, .2) !important;
    background: linear-gradient(180deg, #fff, #fff9fb) !important;
    box-shadow: none !important;
}

.gb-storefront-app .gb-payment-method-v31 em::after {
    content: "انتخاب";
}

.gb-storefront-app .gb-payment-method-v31.is-selected em,
.gb-storefront-app .gb-payment-method-v31:has(input[type="radio"]:checked) em {
    background: var(--gb-primary-soft) !important;
    color: var(--gb-primary) !important;
}

.gb-storefront-app .gb-payment-method-v31.is-selected em::after,
.gb-storefront-app .gb-payment-method-v31:has(input[type="radio"]:checked) em::after {
    content: "انتخاب شده";
}

.gb-storefront-app .gb-payment-method-v31:focus-within {
    outline: 2px solid color-mix(in srgb, var(--gb-primary) 22%, transparent);
    outline-offset: 3px;
}

/* =========================================================
   Classic storefront v14 — restored card sizing with uncropped imagery
   Direct media URLs are used deliberately here.  Product hover and detail
   gallery no longer depend on the global LazyLoad or Swiper lifecycle.
   ========================================================= */
body.gb-storefront-app .product-image-wrapper {
    position: relative !important;
    display: block !important;
    overflow: hidden !important;
    isolation: isolate;
}

body.gb-storefront-app .product-image-wrapper .product-image {
    position: absolute !important;
    inset: 0 !important;
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    will-change: opacity, transform;
    transition: opacity .28s ease, transform .38s ease !important;
}

body.gb-storefront-app .product-image-wrapper .product-image.front {
    z-index: 1 !important;
    opacity: 1 !important;
    transform: scale(1) !important;
}

body.gb-storefront-app .product-image-wrapper .product-image.back {
    z-index: 2 !important;
    opacity: 0 !important;
    transform: scale(1.015) !important;
    pointer-events: none !important;
}

@media (hover: hover) and (pointer: fine) {
    body.gb-storefront-app .product-image-wrapper.has-secondary-image:hover .product-image.front,
    body.gb-storefront-app .product-image-wrapper.has-secondary-image:focus-visible .product-image.front {
        opacity: 0 !important;
        transform: scale(1.035) !important;
    }

    body.gb-storefront-app .product-image-wrapper.has-secondary-image:hover .product-image.back,
    body.gb-storefront-app .product-image-wrapper.has-secondary-image:focus-visible .product-image.back {
        opacity: 1 !important;
        transform: scale(1.035) !important;
    }
}


/* Standalone classic product gallery. */
body.gb-storefront-app .gb-classic-product-gallery {
    padding: 12px !important;
    border-radius: 22px !important;
    overflow: hidden !important;
    outline: 0;
}

body.gb-storefront-app .gb-classic-gallery-layout {
    display: grid;
    grid-template-columns: 92px minmax(0, 1fr);
    gap: 14px;
    direction: ltr;
    align-items: start;
}

body.gb-storefront-app .gb-classic-product-gallery.is-single-image .gb-classic-gallery-layout {
    grid-template-columns: minmax(0, 1fr);
}

body.gb-storefront-app .gb-classic-gallery-stage {
    position: relative;
    min-width: 0;
    aspect-ratio: 1 / 1;
    overflow: hidden;
    border-radius: 20px;
    background: #f7f7f7;
    display: flex;
    align-items: center;
    justify-content: center;
}

body.gb-storefront-app .gb-classic-gallery-main-image {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    height: 100% !important;
    max-height: none !important;
    object-fit: contain !important;
    border-radius: 18px !important;
    background: #f7f7f7 !important;
    opacity: 1;
    transform: scale(1);
    transition: opacity .16s ease, transform .24s ease;
    cursor: zoom-in !important;
}

body.gb-storefront-app .gb-classic-gallery-main-image:focus-visible {
    outline: 3px solid color-mix(in srgb, var(--gb-primary) 55%, transparent);
    outline-offset: -4px;
}

body.gb-storefront-app .gb-classic-gallery-stage.is-loading .gb-classic-gallery-main-image {
    opacity: .35;
    transform: scale(.99);
}

body.gb-storefront-app .gb-classic-gallery-loader {
    position: absolute;
    top: 50%;
    left: 50%;
    width: 34px;
    height: 34px;
    margin: -17px 0 0 -17px;
    border: 3px solid rgba(0, 0, 0, .08);
    border-top-color: var(--gb-primary);
    border-radius: 50%;
    opacity: 0;
    pointer-events: none;
    animation: gbClassicGallerySpin .7s linear infinite;
    transition: opacity .15s ease;
}

body.gb-storefront-app .gb-classic-gallery-stage.is-loading .gb-classic-gallery-loader {
    opacity: 1;
}

@keyframes gbClassicGallerySpin {
    to { transform: rotate(360deg); }
}

body.gb-storefront-app .gb-classic-gallery-thumbs {
    display: flex;
    flex-direction: column;
    gap: 10px;
    max-height: min(520px, calc(100vw - 180px));
    overflow-x: hidden;
    overflow-y: auto;
    padding: 1px 2px 4px;
    scrollbar-width: thin;
    direction: rtl;
}

body.gb-storefront-app .gb-classic-gallery-thumb {
    position: relative;
    flex: 0 0 86px;
    width: 86px;
    height: 86px;
    min-height: 86px;
    padding: 5px !important;
    border: 1px solid #ececec !important;
    border-radius: 16px !important;
    background: #fff !important;
    box-shadow: none !important;
    cursor: pointer;
    overflow: hidden;
    transition: border-color .18s ease, box-shadow .18s ease, transform .18s ease;
}

body.gb-storefront-app .gb-classic-gallery-thumb img {
    display: block !important;
    visibility: visible !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    border-radius: 12px !important;
    background: #f5f5f5 !important;
}

body.gb-storefront-app .gb-classic-gallery-thumb:hover {
    border-color: color-mix(in srgb, var(--gb-primary) 45%, #ececec) !important;
    transform: translateY(-1px);
}

body.gb-storefront-app .gb-classic-gallery-thumb.is-active {
    border-color: var(--gb-primary) !important;
    box-shadow: inset 0 0 0 1px var(--gb-primary), 0 9px 20px rgba(0, 0, 0, .08) !important;
}

body.gb-storefront-app .gb-classic-gallery-nav {
    position: absolute;
    top: 50%;
    z-index: 4;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0 !important;
    border: 1px solid rgba(0, 0, 0, .08) !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, .94) !important;
    color: var(--gb-primary) !important;
    box-shadow: 0 9px 24px rgba(0, 0, 0, .13) !important;
    transform: translateY(-50%);
    cursor: pointer;
    transition: background .18s ease, color .18s ease, transform .18s ease;
}

body.gb-storefront-app .gb-classic-gallery-nav:hover {
    background: var(--gb-primary) !important;
    color: #fff !important;
    transform: translateY(-50%) scale(1.04);
}

body.gb-storefront-app .gb-classic-gallery-prev { right: 14px; }
body.gb-storefront-app .gb-classic-gallery-next { left: 14px; }

body.gb-storefront-app .gb-classic-gallery-counter {
    position: absolute;
    right: 50%;
    bottom: 13px;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: 52px;
    min-height: 28px;
    padding: 3px 10px;
    border: 1px solid rgba(0, 0, 0, .08);
    border-radius: 999px;
    background: rgba(255, 255, 255, .9);
    color: #333;
    font-size: 12px;
    font-weight: 900;
    justify-content: center;
    transform: translateX(50%);
    backdrop-filter: blur(8px);
}

body.gb-storefront-app .gb-classic-gallery-empty {
    min-height: 420px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 10px;
    border-radius: 18px;
    background: #f7f7f7;
    color: #777;
}

body.gb-storefront-app .gb-classic-gallery-empty i {
    font-size: 44px;
    color: var(--gb-primary);
}

@media (max-width: 767.98px) {
    body.gb-storefront-app .gb-classic-gallery-layout {
        display: flex;
        flex-direction: column;
        gap: 10px;
        direction: rtl;
    }

    body.gb-storefront-app .gb-classic-gallery-stage {
        width: 100%;
        order: 1;
    }

    body.gb-storefront-app .gb-classic-gallery-thumbs {
        width: 100%;
        order: 2;
        display: grid;
        grid-template-columns: repeat(5, minmax(0, 1fr));
        gap: 8px;
        max-height: none;
        overflow-x: auto;
        overflow-y: hidden;
        direction: rtl;
    }

    body.gb-storefront-app .gb-classic-gallery-thumb {
        width: 100%;
        height: 74px;
        min-height: 74px;
        flex-basis: auto;
        border-radius: 13px !important;
    }
}

@media (max-width: 479.98px) {
    body.gb-storefront-app .gb-classic-product-gallery { padding: 9px !important; }
    body.gb-storefront-app .gb-classic-gallery-thumbs { grid-template-columns: repeat(4, minmax(0, 1fr)); }
    body.gb-storefront-app .gb-classic-gallery-thumb { height: 64px; min-height: 64px; }
    body.gb-storefront-app .gb-classic-gallery-nav { width: 36px; height: 36px; }
    body.gb-storefront-app .gb-classic-gallery-prev { right: 10px; }
    body.gb-storefront-app .gb-classic-gallery-next { left: 10px; }
}


/* Classic V12 - full-image zoom viewer */
body.gb-classic-lightbox-open {
    overflow: hidden !important;
}

body.gb-storefront-app .gb-classic-image-lightbox {
    position: fixed;
    inset: 0;
    z-index: 2147483000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity .2s ease, visibility .2s ease;
}

body.gb-storefront-app .gb-classic-image-lightbox.is-open {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

body.gb-storefront-app .gb-classic-image-lightbox__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(9, 10, 16, .94);
    backdrop-filter: blur(8px);
}

body.gb-storefront-app .gb-classic-image-lightbox__dialog {
    position: relative;
    z-index: 1;
    width: min(94vw, 1500px);
    height: min(90vh, 1100px);
    display: flex;
    align-items: center;
    justify-content: center;
}

body.gb-storefront-app .gb-classic-image-lightbox__media {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    overflow: hidden;
}

body.gb-storefront-app .gb-classic-image-lightbox__image {
    display: block !important;
    width: auto !important;
    height: auto !important;
    max-width: 100% !important;
    max-height: 100% !important;
    object-fit: contain !important;
    object-position: center center !important;
    border-radius: 12px !important;
    background: transparent !important;
    box-shadow: 0 24px 80px rgba(0, 0, 0, .36);
    transition: opacity .16s ease;
}

body.gb-storefront-app .gb-classic-image-lightbox.is-loading .gb-classic-image-lightbox__image {
    opacity: .2;
}

body.gb-storefront-app .gb-classic-image-lightbox__close,
body.gb-storefront-app .gb-classic-image-lightbox__nav {
    position: absolute;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 46px;
    height: 46px;
    padding: 0 !important;
    border: 1px solid rgba(255, 255, 255, .2) !important;
    border-radius: 50% !important;
    background: rgba(255, 255, 255, .12) !important;
    color: #fff !important;
    box-shadow: none !important;
    backdrop-filter: blur(10px);
    cursor: pointer;
    transition: background .18s ease, transform .18s ease;
}

body.gb-storefront-app .gb-classic-image-lightbox__close:hover,
body.gb-storefront-app .gb-classic-image-lightbox__nav:hover {
    background: var(--gb-primary) !important;
    transform: scale(1.05);
}

body.gb-storefront-app .gb-classic-image-lightbox__close {
    top: 0;
    left: 0;
}

body.gb-storefront-app .gb-classic-image-lightbox__prev {
    right: 0;
    top: 50%;
    transform: translateY(-50%);
}

body.gb-storefront-app .gb-classic-image-lightbox__next {
    left: 0;
    top: 50%;
    transform: translateY(-50%);
}

body.gb-storefront-app .gb-classic-image-lightbox__prev:hover,
body.gb-storefront-app .gb-classic-image-lightbox__next:hover {
    transform: translateY(-50%) scale(1.05);
}

body.gb-storefront-app .gb-classic-image-lightbox__counter {
    position: absolute;
    right: 50%;
    bottom: 0;
    z-index: 3;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 5px;
    min-width: 64px;
    min-height: 34px;
    padding: 5px 13px;
    border: 1px solid rgba(255, 255, 255, .18);
    border-radius: 999px;
    background: rgba(0, 0, 0, .42);
    color: #fff;
    font-size: 13px;
    font-weight: 900;
    direction: ltr;
    transform: translateX(50%);
    backdrop-filter: blur(10px);
}

@media (max-width: 767.98px) {
    body.gb-storefront-app .gb-classic-image-lightbox {
        padding: 12px;
    }
    body.gb-storefront-app .gb-classic-image-lightbox__dialog {
        width: 100%;
        height: 92vh;
    }
    body.gb-storefront-app .gb-classic-image-lightbox__close,
    body.gb-storefront-app .gb-classic-image-lightbox__nav {
        width: 42px;
        height: 42px;
    }
    body.gb-storefront-app .gb-classic-image-lightbox__prev { right: 4px; }
    body.gb-storefront-app .gb-classic-image-lightbox__next { left: 4px; }
}

/* =========================================================
   Classic storefront v17 — native ranked products block
   ========================================================= */
body.gb-storefront-app .gb-classic-ranking-section {
    padding: 34px 0;
}

body.gb-storefront-app .gb-classic-ranking-panel {
    overflow: hidden;
    border: 1px solid var(--gb-line, #ececec);
    border-radius: 18px;
    background: #fff;
    padding: 20px 24px 8px;
}

body.gb-storefront-app .gb-classic-ranking-head {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 20px;
    padding: 0 0 14px;
    border-bottom: 1px solid var(--gb-line, #ececec);
}

body.gb-storefront-app .gb-classic-ranking-head > div {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

body.gb-storefront-app .gb-classic-ranking-icon {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    border-radius: 14px;
    background: var(--gb-primary-soft, #fff1f4);
    color: var(--gb-primary, #801a2f);
    font-size: 23px;
}

body.gb-storefront-app .gb-classic-ranking-head h2 {
    margin: 0;
    color: var(--gb-text, #262626);
    font-size: 20px;
    font-weight: 950;
    line-height: 1.5;
}

body.gb-storefront-app .gb-classic-ranking-head p {
    margin: 3px 0 0;
    color: var(--gb-muted, #777);
    font-size: 12px;
    font-weight: 700;
    line-height: 1.8;
}

body.gb-storefront-app .gb-classic-ranking-head > a {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    gap: 6px;
    color: var(--gb-primary, #801a2f);
    font-size: 12px;
    font-weight: 900;
}

body.gb-storefront-app .gb-classic-ranking-list {
    display: grid;
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 0 24px;
}

body.gb-storefront-app .gb-classic-ranking-item {
    display: grid;
    grid-template-columns: 36px 86px minmax(0, 1fr);
    align-items: center;
    gap: 12px;
    min-width: 0;
    min-height: 108px;
    padding: 10px 0;
    border-bottom: 1px solid var(--gb-line, #ededed);
    color: inherit;
    transition: color .18s ease, background .18s ease;
}

body.gb-storefront-app .gb-classic-ranking-item:hover {
    color: var(--gb-primary, #801a2f);
}

body.gb-storefront-app .gb-classic-ranking-rank {
    color: var(--gb-primary, #801a2f);
    font-size: 27px;
    font-weight: 950;
    line-height: 1;
    text-align: center;
}

body.gb-storefront-app .gb-classic-ranking-image {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 86px;
    height: 86px;
    overflow: hidden;
    border-radius: 13px;
    background: #f7f7f7;
}

body.gb-storefront-app .gb-classic-ranking-image img {
    display: block;
    width: 100%;
    height: 100%;
    padding: 5px;
    object-fit: contain;
    object-position: center;
}

body.gb-storefront-app .gb-classic-ranking-copy {
    display: flex;
    flex-direction: column;
    justify-content: center;
    gap: 5px;
    min-width: 0;
}

body.gb-storefront-app .gb-classic-ranking-copy strong {
    display: -webkit-box;
    overflow: hidden;
    color: #343434;
    font-size: 12px;
    font-weight: 900;
    line-height: 1.9;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
}

body.gb-storefront-app .gb-classic-ranking-copy small {
    overflow: hidden;
    color: var(--gb-muted, #858585);
    font-size: 10.5px;
    font-weight: 700;
    text-overflow: ellipsis;
    white-space: nowrap;
}

body.gb-storefront-app .gb-classic-empty-catalog > .container > div {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    min-height: 260px;
    gap: 10px;
    border: 1px dashed var(--gb-line, #dedede);
    border-radius: 18px;
    background: #fff;
    text-align: center;
}

body.gb-storefront-app .gb-classic-empty-catalog i {
    color: var(--gb-primary, #801a2f);
    font-size: 42px;
}

body.gb-storefront-app .gb-classic-empty-catalog h2,
body.gb-storefront-app .gb-classic-empty-catalog p {
    margin: 0;
}

body.gb-storefront-app .gb-classic-empty-catalog a {
    margin-top: 5px;
    color: var(--gb-primary, #801a2f);
    font-weight: 900;
}

@media (max-width: 991.98px) {
    body.gb-storefront-app .gb-classic-ranking-list {
        grid-template-columns: repeat(2, minmax(0, 1fr));
    }
}

@media (max-width: 767.98px) {
    body.gb-storefront-app .gb-classic-ranking-section {
        padding: 25px 0;
    }

    body.gb-storefront-app .gb-classic-ranking-panel {
        padding: 16px 14px 4px;
        border-radius: 14px;
    }

    body.gb-storefront-app .gb-classic-ranking-head {
        align-items: flex-start;
    }

    body.gb-storefront-app .gb-classic-ranking-head > a {
        display: none;
    }

    body.gb-storefront-app .gb-classic-ranking-list {
        grid-template-columns: 1fr;
    }

    body.gb-storefront-app .gb-classic-ranking-item {
        grid-template-columns: 30px 70px minmax(0, 1fr);
        min-height: 91px;
        gap: 10px;
    }

    body.gb-storefront-app .gb-classic-ranking-rank {
        font-size: 23px;
    }

    body.gb-storefront-app .gb-classic-ranking-image {
        width: 68px;
        height: 68px;
        border-radius: 11px;
    }
}
