/* =========================================================
   Product Single
   ========================================================= */

/* ── Header روی بنر (مثل صفحه اصلی ، با پس‌زمینه سفید) ── */
body.has-product-banner header#header,
body.has-product-banner .mobile-header {
    position: absolute;
    background: var(--white);
}

/* ── Banner ────────────────────────────────────────────── */
.wr-product-banner {
    height: 360px;
    overflow: hidden;
}

.wr-product-banner__img {
    display: block;
    width: 100%;
    /* style.css ارتفاع همه img ها را با important روی auto می‌گذارد */
    height: 100% !important;
    margin: 0;
    object-fit: cover;
}

.wr-product-top {
    padding-top: 48px;
}

/* کارت‌ها روی لبه پایینی بنر می‌نشینند */
.wr-product-top.has-banner {
    position: relative;
    z-index: 2;
    margin-top: -96px;
    padding-top: 0;
}


/* ── Gallery ───────────────────────────────────────────── */
.wr-gallery-main {
    background: var(--g6);
    border-radius: 32px;
    overflow: hidden;
}

.wr-product-top.has-banner .wr-gallery-main {
    box-shadow: 0 12px 32px rgba(7, 8, 9, .06);
}

.wr-gallery-main .swiper-slide {
    display: flex;
    align-items: center;
    justify-content: center;
    aspect-ratio: 1 / 1;
    padding: 2.5rem;
}

.wr-gallery-zoom {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
    cursor: zoom-in;
}

.wr-gallery-main__img {
    max-width: 100%;
    max-height: 100%;
    width: auto;
    height: auto;
    object-fit: contain;
}

.wr-gallery-empty {
    display: block;
    width: 100%;
    height: 100%;
}

.wr-gallery-nav {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: .75rem;
    margin-top: 1rem;
}

/* جا برای سه تامبنیل ؛ فلش‌ها کنار آن‌ها می‌نشینند */
.wr-gallery-thumbs {
    flex: 0 1 auto;
    width: 212px;
    min-width: 0;
    margin: 0;
}

.wr-gallery-thumbs .swiper-slide {
    width: 64px;
    height: 64px;
    padding: .35rem;
    border: 1px solid var(--g5);
    border-radius: 12px;
    background: var(--white);
    cursor: pointer;
    transition: border-color .2s ease, background .2s ease;
}

.wr-gallery-thumbs .swiper-slide-thumb-active {
    border-color: var(--primary);
    background: var(--g6);
}

.wr-gallery-thumbs__img {
    width: 100%;
    height: 100% !important;
    margin: 0;
    object-fit: contain;
    border-radius: 8px;
}


/* ── Slider buttons (زرد با حاشیه) ─────────────────────── */
.wr-slider-btn {
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    padding: 0;
    border: 2px solid var(--secondary);
    border-radius: 50%;
    background: var(--white);
    color: var(--black);
    font-size: 10px;
    transition: background .2s ease, color .2s ease;
}

.wr-slider-btn:hover {
    background: var(--secondary);
}

.wr-slider-btn.swiper-button-disabled {
    opacity: .4;
    cursor: default;
}

.wr-slider-btn.swiper-button-lock {
    display: none;
}


/* ── Summary ───────────────────────────────────────────── */
.wr-product-summary__title {
    margin-bottom: .5rem;
    font-size: 1.75rem;
    font-weight: 400;
    color: var(--black);
}

.wr-product-cats {
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    gap: .25rem .5rem;
    margin-bottom: 1.25rem;
    font-size: 12px;
    color: var(--g2);
}

.wr-product-cats a {
    color: var(--g1);
    transition: color .2s ease;
}

.wr-product-cats a:hover {
    color: var(--primary);
}

.wr-product-summary__desc {
    margin-bottom: 1.5rem;
    font-size: 14px;
    line-height: 2;
    color: var(--black);
}

.wr-catalog-btn {
    display: inline-flex;
    align-items: center;
    gap: 1.5rem;
    padding: .3rem .3rem .3rem 1.25rem;
    border: 1px solid var(--black);
    border-radius: 999px;
    font-size: 12px;
    color: var(--black);
    transition: background .2s ease, color .2s ease;
}

.wr-catalog-btn__icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    background: var(--black);
    color: var(--white);
    font-size: 8px;
    transition: background .2s ease;
}

.wr-catalog-btn:hover {
    background: var(--black);
    color: var(--white);
}

.wr-catalog-btn:hover .wr-catalog-btn__icon {
    background: var(--primary);
}


/* ── Content ───────────────────────────────────────────── */
.wr-product-content {
    margin-top: 2.5rem;
    padding-top: 2rem;
    border-top: 1px solid var(--g5);
    font-size: 14px;
    line-height: 2.1;
    color: var(--black);
}

.wr-product-content::after {
    content: '';
    display: table;
    clear: both;
}

.wr-product-content h2,
.wr-product-content h3,
.wr-product-content h4 {
    margin: 2rem 0 .75rem;
    font-weight: 400;
    color: var(--black);
}

.wr-product-content > h2:first-child,
.wr-product-content > h3:first-child {
    margin-top: 0;
}

.wr-product-content h2 {
    font-size: 1.35rem;
}

.wr-product-content h3 {
    font-size: 1.15rem;
}

.wr-product-content p {
    margin-bottom: 1rem;
}

.wr-product-content a:not([class]) {
    color: var(--primary);
    text-decoration: underline;
    text-underline-offset: 3px;
}

.wr-product-content ul:not([class]) {
    margin: 0 0 1rem;
    padding: 0;
    list-style: none;
}

.wr-product-content ul:not([class]) > li {
    position: relative;
    margin-bottom: .35rem;
    padding-inline-start: 1.25rem;
}

.wr-product-content ul:not([class]) > li::before {
    content: '';
    position: absolute;
    inset-inline-start: 0;
    top: .8em;
    width: 7px;
    height: 7px;
    border-radius: 50%;
    background: var(--primary);
}

.wr-product-content ol:not([class]) {
    padding-inline-start: 1.25rem;
}

.wr-product-content ol:not([class]) > li::marker {
    color: var(--primary);
}

.wr-product-content img {
    max-width: 100%;
    height: auto;
    border-radius: 20px;
}

.wr-product-content figure {
    margin: 0 0 1rem;
}

.wr-product-content .alignright,
.wr-product-content .wp-block-image .alignright {
    float: right;
    width: 45%;
    margin: .35rem 0 1rem 1.5rem;
}

.wr-product-content .alignleft,
.wr-product-content .wp-block-image .alignleft {
    float: left;
    width: 45%;
    margin: .35rem 1.5rem 1rem 0;
}

.wr-product-content .alignright img,
.wr-product-content .alignleft img {
    width: 100%;
}

.wr-product-content .aligncenter {
    display: block;
    margin-inline: auto;
}

.wr-product-content .wp-block-media-text {
    margin-bottom: 1rem;
}


/* ── Analysis ──────────────────────────────────────────── */
.wr-product-analysis {
    margin-top: 2.5rem;
}

.wr-product-section-title {
    margin-bottom: 1rem;
    font-size: 1.35rem;
    font-weight: 400;
    color: var(--black);
}

.wr-analysis-card {
    max-width: 480px;
    padding: .75rem;
    border: 1px solid var(--g5);
    border-radius: 20px;
    background: var(--white);
}

.wr-analysis-table {
    width: 100%;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 13px;
    text-align: center;
}

.wr-analysis-table thead th {
    position: relative;
    padding: .6rem 1rem;
    background: var(--g6);
    font-weight: 400;
    color: var(--primary);
}

.wr-analysis-table thead th:first-child {
    border-radius: 12px 0 0 12px;
}

.wr-analysis-table thead th:last-child {
    border-radius: 0 12px 12px 0;
}

.wr-analysis-table thead th + th::before,
.wr-analysis-table tbody td + td::before {
    content: '';
    position: absolute;
    left: 0;
    top: 25%;
    height: 50%;
    border-left: 1px solid var(--g2);
}

.wr-analysis-table tbody td {
    position: relative;
    padding: .65rem 1rem;
    color: var(--black);
}

.wr-analysis-table tbody tr:first-child td {
    padding-top: 1rem;
}

.wr-analysis-table tbody td + td::before {
    top: 0;
    height: 100%;
}


/* ── Contact form (sidebar) ────────────────────────────── */
.wr-product-form {
    position: sticky;
    top: 100px;
    padding: 2rem 1.25rem;
}

.wr-product-top.has-banner .wr-product-form {
    background:
        linear-gradient(to bottom, rgba(141, 148, 106, .3) 0%, rgba(141, 148, 106, 0) 100%),
        var(--white);
}

.wr-product-form .title-bar {
    z-index: 0;
}

.wr-product-form .gform_wrapper .gfield--width-half {
    grid-column: span 12;
}


/* ── Sliders (محصولات مشابه / وبلاگ) ───────────────────── */
.wr-product-related {
    margin-top: 3rem;
}

.wr-slider {
    position: relative;
}

.wr-slider .wr-slider-btn--prev,
.wr-slider .wr-slider-btn--next {
    position: absolute;
    z-index: 5;
    top: 50%;
    width: 36px;
    height: 36px;
    font-size: 12px;
}

.wr-slider .wr-slider-btn--prev {
    left: 0;
    transform: translate(-50%, -50%);
}

.wr-slider .wr-slider-btn--next {
    right: 0;
    transform: translate(50%, -50%);
}

/* فلش‌ها روی ناحیه تصویر کارت‌ها قرار می‌گیرند نه وسط کل کارت */
.wr-product-related .wr-slider .wr-slider-btn {
    top: calc(50% - 1.5rem);
}

.wr-product-blogs .wr-slider .wr-slider-btn {
    top: 6.5rem;
}

.wr-product-blogs .blog-img {
    aspect-ratio: 2 / 1;
    object-fit: cover;
}


/* ── FAQ ───────────────────────────────────────────────── */
.wr-product-faq .faq-accordion {
    counter-reset: faq;
    display: flex;
    flex-direction: column;
    gap: .75rem;
}

.wr-product-faq .accordion-item {
    counter-increment: faq;
    border: 1px solid var(--g5) !important;
    border-radius: 16px !important;
    overflow: hidden;
    background: var(--white);
    transition: background .2s ease;
}

.wr-product-faq .accordion-item:has(.accordion-collapse.show) {
    background: var(--g6);
    border-color: var(--g6) !important;
}

.wr-product-faq .accordion-header {
    display: block;
}

.wr-product-faq .accordion-button {
    gap: .75rem;
    padding: .9rem 1.25rem;
    background: transparent;
    box-shadow: none;
    font-size: 14px;
    color: var(--black);
}

.wr-product-faq .accordion-button::before {
    content: counter(faq, decimal-leading-zero);
    flex: 0 0 auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 30px;
    height: 24px;
    border-radius: 8px;
    background: rgba(141, 148, 106, .16);
    font-size: 12px;
    color: var(--primary);
    transition: background .2s ease, color .2s ease;
}

.wr-product-faq .accordion-button:not(.collapsed)::before {
    background: var(--secondary);
    color: var(--black);
}

.wr-product-faq .accordion-button:focus {
    box-shadow: none;
}

.wr-product-faq .accordion-body {
    padding: 0 1.25rem 1.25rem;
    font-size: 13px;
    line-height: 2;
    color: var(--g3);
}

.wr-product-faq .accordion-body > *:last-child {
    margin-bottom: 0;
}


/* ── Responsive ────────────────────────────────────────── */
@media (max-width: 991.98px) {
    .wr-product-form {
        position: static;
    }

    .wr-product-banner {
        height: 260px;
    }

    .wr-product-top.has-banner {
        margin-top: -64px;
    }
}

@media (max-width: 767.98px) {
    .wr-product-banner {
        height: 200px;
    }

    .wr-product-top.has-banner {
        margin-top: -40px;
    }

    .wr-product-summary__title {
        font-size: 1.4rem;
    }

    .wr-product-content .alignright,
    .wr-product-content .alignleft,
    .wr-product-content .wp-block-image .alignright,
    .wr-product-content .wp-block-image .alignleft {
        float: none;
        width: 100%;
        margin: 0 0 1rem;
    }

    .wr-product-top {
        padding-top: 24px;
    }

    /* گالری: کارت باریک‌تر و وسط‌چین */
    .wr-gallery {
        max-width: 300px;
        margin-inline: auto;
    }

    .wr-gallery-main .swiper-slide {
        padding: 2rem;
    }

    .wr-gallery-thumbs {
        width: 190px;
    }

    .wr-gallery-thumbs .swiper-slide {
        width: 56px;
        height: 56px;
    }

    .wr-product-content {
        margin-top: 2rem;
        padding-top: 1.5rem;
    }

    .wr-analysis-card {
        max-width: none;
    }

    /* فرم تماس در موبایل نمایش داده نمی‌شود */
    .wr-product-form-col {
        display: none;
    }

    .wr-product-related {
        margin-top: 1.5rem;
    }

    /* فلش‌های اسلایدر زیر اسلایدر و وسط‌چین */
    .wr-slider {
        display: flex;
        flex-wrap: wrap;
        justify-content: center;
        gap: 1rem .5rem;
    }

    .wr-slider > .swiper {
        flex: 0 0 100%;
        width: 100%;
    }

    .wr-slider .wr-slider-btn--prev,
    .wr-slider .wr-slider-btn--next,
    .wr-product-related .wr-slider .wr-slider-btn,
    .wr-product-blogs .wr-slider .wr-slider-btn {
        position: static;
        transform: none;
        width: 32px;
        height: 32px;
    }

    /* محصولات مشابه: کارت بعدی از لبه بیرون می‌زند ، فلش لازم نیست */
    .wr-product-related .wr-slider .wr-slider-btn {
        display: none;
    }

    .wr-product-related .wr-slider {
        margin-inline-end: calc(var(--bs-gutter-x, 1.5rem) * -.5);
    }

    .wr-product-faq .accordion-button {
        align-items: flex-start;
        padding: .85rem 1rem;
        font-size: 13px;
    }

    .wr-product-faq .accordion-body {
        padding: 0 1rem 1rem;
    }
}
