/**
 * صفحه اصلی — موبایل / viewport باریک (≤991px)
 */

@media (max-width: 991.98px) {
    body.home,
    body.page-id-159241,
    .home-mega-app {
        --hm-brand: #812990;
        --hm-brand-deep: #5c1d66;
        --hm-surface: #f4f6fb;
        --hm-card: #ffffff;
        --hm-text: #0f172a;
        --hm-muted: #64748b;
        --hm-border: rgba(15, 23, 42, 0.08);
        --hm-radius: 16px;
        --hm-shadow: 0 8px 28px rgba(15, 23, 42, 0.08);
        background: var(--hm-surface);
    }

    body.home main .container {
        padding-inline: 12px;
    }

    /* ─── هدر: full-bleed بدون کادر سفید و بدون فاصله دوبل ─── */
    #hpb-site-header.hpb-header-builder,
    .hpb-header.hpb-header-builder:not(.hpb-lb-sticky-bottom-host) {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        right: 0 !important;
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        z-index: 9990 !important;
        transform: none !important;
        background: #fff !important;
        box-shadow: 0 2px 14px rgba(15, 23, 42, 0.08) !important;
    }

    body.hpb-has-site-header .hd-mobile-top-spacer,
    body.hpb-has-site-header .hpb-lb-mobile-spacer,
    body.home:has(#hpb-site-header) .hd-mobile-top-spacer,
    body.home:has(#hpb-site-header) .hpb-lb-mobile-spacer {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
    }

    .hpb-lb-sticky-bottom-host {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
    }

    #hpb-site-header .mobile_top_bar,
    .mobile_top_bar {
        width: 100% !important;
        max-width: 100% !important;
        margin: 0 !important;
        border: none !important;
        border-radius: 0 !important;
        box-sizing: border-box !important;
    }

    #hpb-site-header .hpb-lb-row-inner {
        max-width: 100% !important;
    }

    body.hpb-has-site-header,
    body:has(#hpb-site-header),
    body.home:has(#hpb-site-header),
    body.hpb-has-sticky-bottom-nav {
        padding-top: calc(56px + env(safe-area-inset-top, 0)) !important;
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0)) !important;
    }

    body.home main.home-mega-app,
    body.home .home-mega-app {
        padding-top: 0 !important;
        margin-top: 0 !important;
    }

    header.elementor-location-header,
    .elementor-location-header {
        display: none !important;
    }

    /* شاخه دسکتاپ روی viewport باریک: app bar = middle row */
    #hpb-site-header.hpb-lb--desktop .hpb-lb-row--top {
        display: none !important;
    }

    #hpb-site-header.hpb-lb--desktop .hpb-lb-row--middle {
        display: block !important;
        min-height: 56px;
        background: #fff;
        border-bottom: 1px solid var(--hm-border);
    }

    /* شاخه موبایل HPB: app bar = top row (mobile_top_bar) */
    #hpb-site-header.hpb-lb--mobile .hpb-lb-row--top {
        display: block !important;
        min-height: 56px;
        background: #fff;
        border-bottom: 1px solid var(--hm-border);
    }

    #hpb-site-header.hpb-lb--mobile .hpb-lb-row--middle,
    #hpb-site-header.hpb-lb--mobile .hpb-lb-row--bottom {
        display: none !important;
    }

    #hpb-site-header .hpb-lb-row--middle .hpb-lb-logo-img,
    #hpb-site-header.hpb-lb--mobile .hpb-lb-row--top .hpb-lb-logo-img {
        max-height: 38px !important;
    }

    #hpb-site-header .woocommerce-mini-cart__empty-message,
    #hpb-site-header .widget_shopping_cart_content .woocommerce-mini-cart,
    #hpb-site-header .cart_list {
        display: none !important;
    }

    #hpb-site-header .hamta-dynamic-slot {
        min-height: 36px;
        max-width: none;
        display: inline-flex;
        align-items: center;
        justify-content: flex-end;
    }

    #hpb-site-header .hamta-dynamic-skeleton {
        width: 40px;
        height: 36px;
        border-radius: 12px;
    }

    #hpb-site-header .hpb-lb-row--top .hpb-lb-cell--2 {
        padding-inline-start: 4px !important;
        padding-inline-end: 10px !important;
        justify-content: flex-end !important;
    }

    #hpb-site-header .hamta-dynamic-slot,
    #hpb-site-header .hamta-mini-cart {
        max-width: none;
        overflow: visible;
    }

    /* هدر ابزارها: یک ردیف ثابت — جلوگیری از wrap / CLS */
    #hpb-site-header .hpb-lb-cell {
        flex-wrap: nowrap !important;
        align-items: center !important;
        min-width: 0;
    }

    #hpb-site-header .hpb-lb-cell > * {
        max-width: none;
        flex-shrink: 0;
    }

    #hpb-site-header .hpb-lb-cell > .hpb-lb-logo-link,
    #hpb-site-header .hpb-lb-cell > .hpb-lb-render-block--logo,
    #hpb-site-header .hpb-lb-logo-link {
        flex-shrink: 1;
        min-width: 0;
        max-width: 46vw;
    }

    #hpb-site-header .hamta-cart-info {
        display: none !important;
    }

    #hpb-site-header .hamta-mini-cart {
        width: 40px !important;
        height: 40px !important;
        max-width: 40px !important;
        flex: 0 0 40px !important;
        position: relative;
        overflow: visible;
    }

    #hpb-site-header .hamta-mini-cart-link {
        width: 40px !important;
        height: 40px !important;
        padding: 0 !important;
        border-radius: 50% !important;
        gap: 0 !important;
    }

    #hpb-site-header .hamta-mini-cart-dropdown,
    #hpb-site-header .hamta-mini-cart-overlay {
        position: fixed !important;
    }

    #hpb-site-header .hamta-mini-cart:not(.dropdown-open) .hamta-mini-cart-dropdown {
        visibility: hidden !important;
        pointer-events: none !important;
        transform: translate3d(0, 110%, 0) !important;
    }

    #hpb-site-header .hamta-header-lists,
    #hpb-site-header .hamta-dynamic-slot {
        display: inline-flex !important;
        align-items: center;
        flex: 0 0 auto;
        flex-wrap: nowrap;
        gap: 4px;
        max-width: none !important;
    }

    /* بلانتون موبایل — فلش داخل عرض؛ بدون بهم‌ریختن عرض صفحه */
    body.home,
    body.home main,
    body.home .home-mega-app,
    body.home .crafto-section,
    body.home .crafto-blanton-grid,
    body.home .crafto-blanton-grid__viewport {
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    body.home {
        overflow-x: clip;
    }

    body.home .hpb-grid--blanton,
    body.home .hpb-grid--blanton-carousel {
        max-width: 100% !important;
        width: 100% !important;
        box-sizing: border-box !important;
    }

    body.home .hpb-grid--blanton-carousel {
        padding-inline: 0 !important;
        overflow-x: clip !important;
        overflow-y: visible !important;
    }

    body.home .hpb-blanton-nav {
        display: flex !important;
        width: 32px !important;
        height: 32px !important;
        font-size: 13px !important;
        top: 42% !important;
        box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1) !important;
    }

    body.home .hpb-blanton-nav--prev {
        right: 4px !important;
        left: auto !important;
    }

    body.home .hpb-blanton-nav--next {
        left: 4px !important;
        right: auto !important;
    }

    body.home .hpb-blanton-pager {
        display: none !important;
    }

    body.home .hpb-grid--blanton .hpb-blanton-grid {
        display: grid !important;
        grid-template-columns: repeat(2, minmax(0, 1fr)) !important;
        gap: 14px 12px !important;
        justify-content: stretch !important;
        width: 100% !important;
    }

    body.home .hpb-grid--blanton .hpb-blanton-card {
        flex: none !important;
        width: 100% !important;
        max-width: none !important;
        margin: 0 !important;
    }

    body.home .hpb-grid--blanton .hpb-blanton-card__wrapper {
        height: 110px !important;
        overflow: hidden !important;
    }

    body.home .hpb-grid--blanton .hpb-blanton-card__circle {
        left: 16% !important;
        right: 16% !important;
        bottom: 22px !important;
        height: 50% !important;
        border-radius: 16px !important;
        transform: rotate(-18deg) !important;
    }

    body.home .hpb-grid--blanton .hpb-blanton-card__img {
        max-width: 100px !important;
        max-height: 100px !important;
    }

    body.home .hpb-grid--blanton .hpb-blanton-card__label {
        margin-top: 8px !important;
        font-size: 12.5px !important;
        min-height: 2.5em;
    }

    body.home main .slider_home_mega .hpb-slider,
    body.home main .slider_home_mega .hpb-slider__swiper,
    body.home main .slider_home_mega .swiper-slide,
    body.home main .slider_home_mega .hpb-slide__bg {
        max-width: 100% !important;
        overflow: hidden !important;
    }

    #hpb-site-header .hamta-shop-search-mobile .hamta-mobile-search-toggle {
        width: 40px;
        height: 40px;
        border-radius: 12px;
        border: 1px solid var(--hm-border);
        background: #fff;
    }

    /* ─── اسلایدر ─── */
    body.home main .slider_home_mega {
        margin-top: 0;
    }

    body.home main .slider_home_mega .hpb-slider,
    body.home main .slider_home_mega .hpb-slider__swiper {
        border-radius: var(--hm-radius);
        overflow: hidden;
        box-shadow: var(--hm-shadow);
    }

    body.home main .slider_home_mega .hpb-slider__swiper {
        min-height: 160px;
        aspect-ratio: 16 / 9;
    }

    body.home main .slider_home_mega .swiper-button-prev,
    body.home main .slider_home_mega .swiper-button-next {
        width: 32px !important;
        height: 32px !important;
        background: rgba(255, 255, 255, 0.92) !important;
        border-radius: 50% !important;
        color: var(--hm-brand) !important;
    }

    /* ─── دکمه‌های مصرف‌کننده / نمایندگی ─── */
    body.home .home-segment-pills {
        margin: 10px 0 8px;
    }

    body.home .home-segment-pills__row {
        display: grid;
        grid-template-columns: 1fr 1fr;
        gap: 10px;
    }

    body.home .home-segment-pills__btn {
        display: flex;
        align-items: center;
        justify-content: center;
        min-height: 46px;
        padding: 10px 8px;
        border-radius: 14px;
        font-size: 13px;
        font-weight: 800;
        text-decoration: none;
        text-align: center;
        line-height: 1.35;
        border: 1px solid transparent;
    }

    body.home .home-segment-pills__btn--consumer {
        background: linear-gradient(135deg, var(--hm-brand) 0%, #9b3aab 100%);
        color: #fff;
        box-shadow: 0 4px 14px rgba(129, 41, 144, 0.2);
    }

    body.home .home-segment-pills__btn--branch {
        background: var(--hm-card);
        color: var(--hm-brand-deep);
        border-color: rgba(129, 41, 144, 0.22);
    }

    /* ─── گرید دسته‌بندی — ارتفاع بهینه ─── */
    body.home main .home_mega_categoies .hpb-grid__inner {
        grid-auto-rows: minmax(0, auto) !important;
        gap: 10px !important;
    }

    body.home main .home_mega_categoies .hpb-grid__item {
        min-height: 0;
    }

    body.home main .home_mega_categoies .hpb-cat-card {
        border-radius: 14px;
        box-shadow: 0 2px 10px rgba(15, 23, 42, 0.06);
        min-height: 0;
    }

    body.home main .home_mega_categoies .hpb-cat-card__media {
        aspect-ratio: 1 / 1;
        max-height: 72px;
        padding: 8px;
    }

    body.home main .home_mega_categoies .hpb-cat-card__media img {
        object-fit: contain;
        max-height: 56px;
        width: auto;
        margin: 0 auto;
    }

    body.home main .home_mega_categoies .hpb-cat-card__icon {
        font-size: 1.75rem;
        padding: 8px;
    }

    body.home main .home_mega_categoies .hpb-cat-card__body {
        padding: 8px 10px 12px;
    }

    body.home main .home_mega_categoies .hpb-cat-card__title {
        font-size: 0.78rem;
        line-height: 1.35;
        -webkit-line-clamp: 2;
    }

    /* ─── بنر دریافت نمایندگی ─── */
    body.home main .freebox_image {
        display: flex !important;
        flex-direction: column !important;
        align-items: center;
        text-align: center;
        gap: 12px;
        margin: 16px 0;
        padding: 20px 16px;
        min-height: 0;
        height: auto;
        border-radius: 20px;
        background: linear-gradient(135deg, #812990 0%, #673ab7 55%, #5ec8f0 100%);
        box-shadow: var(--hm-shadow);
        overflow: hidden;
    }

    body.home main .freebox_image .col-6 {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
        padding: 0 !important;
    }

    body.home main .freebox_image .circle {
        display: none !important;
    }

    body.home main .freebox_image h2 {
        margin: 0 0 8px;
        font-size: 1.05rem;
        font-weight: 800;
        color: #fff;
        text-shadow: 0 1px 2px rgba(0, 0, 0, 0.15);
    }

    body.home main .freebox_image .content,
    body.home main .freebox_image p {
        margin: 0 0 12px;
        font-size: 0.88rem;
        line-height: 1.65;
        color: rgba(255, 255, 255, 0.92);
    }

    body.home main .freebox_image a {
        display: inline-flex;
        align-items: center;
        justify-content: center;
        background: #fff;
        color: var(--hm-brand-deep);
        font-weight: 700;
        font-size: 0.9rem;
        padding: 10px 22px;
        border-radius: 999px;
        text-decoration: none;
        box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
    }

    body.home main .freebox_image .image_branch {
        display: flex;
        justify-content: center;
        max-width: 180px;
        margin: 0 auto;
        height: auto;
    }

    body.home main .freebox_image .image_branch img {
        width: 100%;
        max-width: 160px;
        height: auto;
        filter: drop-shadow(0 8px 20px rgba(255, 255, 255, 0.35));
    }

    /* ─── فرم درخواست مشاوره — موبایل‌فرندلی ─── */
    body.home main .request_consultant {
        display: flex !important;
        flex-direction: column !important;
        margin: 16px 0;
        padding: 0;
        border-radius: 18px;
        overflow: hidden;
        background: linear-gradient(145deg, #7b1fa2 0%, #512da8 100%);
        border: none;
        box-shadow: var(--hm-shadow);
        position: relative;
    }

    body.home main .request_consultant::before,
    body.home main .request_consultant::after {
        display: none;
    }

    body.home main .request_consultant .col-6,
    body.home main .request_consultant .form_boxer,
    body.home main .request_consultant .the_form_container {
        width: 100% !important;
        max-width: 100% !important;
        flex: 0 0 100% !important;
    }

    body.home main .request_consultant .form_boxer {
        padding: 18px 16px 8px;
        color: #fff;
    }

    body.home main .request_consultant .inner_title > div,
    body.home main .request_consultant .inner_title {
        font-size: 1.05rem;
        font-weight: 800;
        color: #fff;
        margin-bottom: 8px;
    }

    body.home main .request_consultant .form_boxer p {
        margin: 0;
        font-size: 0.85rem;
        line-height: 1.7;
        color: rgba(255, 255, 255, 0.9);
    }

    body.home main .request_consultant .the_form_container {
        padding: 8px 16px 18px;
        display: flex;
        flex-direction: column;
        gap: 8px;
    }

    body.home main .request_consultant .hpb-home-consultation-form {
        display: flex;
        flex-direction: column;
        gap: 8px;
        margin: 0;
    }

    body.home main .request_consultant .hpb-home-consultation-form.is-loading button[type="submit"] {
        opacity: 0.75;
        pointer-events: none;
    }

    body.home main .request_consultant .hpb-cta-newsletter__form-message {
        display: none;
        margin-top: 4px;
        padding: 10px 12px;
        border-radius: 12px;
        font-size: 0.82rem;
        line-height: 1.6;
    }

    body.home main .request_consultant .hpb-cta-newsletter__form-message.is-visible.is-success {
        display: block;
        background: rgba(255, 255, 255, 0.95);
        color: #166534;
    }

    body.home main .request_consultant .hpb-cta-newsletter__form-message.is-visible.is-error {
        display: block;
        background: rgba(255, 255, 255, 0.95);
        color: #b91c1c;
    }

    body.home main .request_consultant label {
        display: block;
        font-size: 0.82rem;
        font-weight: 600;
        color: rgba(255, 255, 255, 0.95);
        margin: 4px 0 2px;
    }

    body.home main .request_consultant input,
    body.home main .request_consultant select {
        width: 100% !important;
        min-height: 46px !important;
        padding: 10px 12px !important;
        border-radius: 12px !important;
        border: 1px solid rgba(255, 255, 255, 0.25) !important;
        background: #fff !important;
        font-size: 14px !important;
        box-sizing: border-box;
    }

    body.home main .request_consultant button {
        width: 100%;
        min-height: 48px;
        margin-top: 8px;
        padding: 12px 20px;
        border: none;
        border-radius: 12px;
        background: #fff;
        color: var(--hm-brand-deep);
        font-size: 15px;
        font-weight: 800;
        cursor: pointer;
    }

    /* ─── کاروسل‌ها — یکدست با محصولات، بدون progress bar ─── */
    .home-mega-app .home_mega_categoies,
    .home-mega-app section {
        margin-bottom: 14px;
    }

    .home-mega-app .hpb-mega-top-arrow-header,
    .home-mega-app .hpb-module-title {
        display: flex !important;
        align-items: center !important;
        justify-content: space-between !important;
        gap: 8px !important;
        margin-bottom: 10px !important;
    }

    .home-mega-app .hpb-mega-top-arrow-header__title,
    .home-mega-app .hpb-module-title__heading {
        font-size: 1.05rem !important;
        font-weight: 800 !important;
        color: var(--hm-brand-deep) !important;
        margin: 0 !important;
    }

    .home-mega-app .hpb-module-title__link,
    .home-mega-app .hpb-mega-top-arrow-header__tools a {
        font-size: 0.82rem !important;
        font-weight: 700 !important;
        color: var(--hm-brand) !important;
        text-decoration: none !important;
        white-space: nowrap;
    }

    /* عنوان راست + لینک «+ همه» چپ، یک ردیف */
    body.home .crafto-products__header,
    .home-mega-app .crafto-products__header {
        display: flex !important;
        flex-direction: row !important;
        align-items: center !important;
        justify-content: space-between !important;
        flex-wrap: nowrap !important;
        gap: 8px !important;
    }

    body.home .crafto-products__title,
    .home-mega-app .crafto-products__title {
        margin: 0 !important;
        flex: 1 1 auto;
        min-width: 0;
    }

    body.home .crafto-view-all,
    .home-mega-app .crafto-view-all {
        display: inline-flex !important;
        align-items: center !important;
        margin-inline-start: auto !important;
        white-space: nowrap !important;
        text-align: start !important;
        font-size: 0.82rem !important;
        font-weight: 700 !important;
        color: var(--hm-brand) !important;
        text-decoration: none !important;
    }

    .home-mega-app .hpb-carousel__pagination,
    .home-mega-app .swiper-pagination-progressbar,
    .home-mega-app .hpb-mega-top-arrow-pagination,
    .home-mega-app .hpb-carousel--pag-progressbar .hpb-carousel__pagination {
        display: none !important;
        height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        visibility: hidden !important;
    }

    .home-mega-app .hpb-carousel .swiper-button-prev,
    .home-mega-app .hpb-carousel .swiper-button-next {
        display: none !important;
    }

    .home-mega-app .hpb-carousel-mega-product .hpb-card,
    .home-mega-app .hpb-carousel .hpb-card {
        border-radius: 14px;
        box-shadow: 0 2px 12px rgba(15, 23, 42, 0.06);
    }

    /* ─── نوار پایین ثابت ─── */
    .hpb-sticky-bottom-nav-shell.mobile-bottom-nav-shell {
        position: fixed !important;
        left: 0 !important;
        right: 0 !important;
        bottom: 0 !important;
        z-index: 10060 !important;
    }

    body.hpb-has-sticky-bottom-nav,
    body.has-mobile-bottom-nav {
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0)) !important;
    }

    body.hpb-has-sticky-bottom-nav:has(.hpb-sticky-bottom-nav-shell--has-search),
    body.has-mobile-bottom-nav:has(.hpb-sticky-bottom-nav-shell--has-search) {
        padding-bottom: calc(10px + env(safe-area-inset-bottom, 0)) !important;
    }

    /* ─── فوتر جمع‌وجور ─── */
    body.home #hpb-site-footer {
        margin-bottom: 0 !important;
        padding-bottom: 0 !important;
    }

    body.home #hpb-site-footer .hpb-fb-row--middle,
    body.home #hpb-site-footer .hpb-fb-row--bottom {
        display: none !important;
        height: 0 !important;
        min-height: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        overflow: hidden !important;
        visibility: hidden !important;
    }

    /* offcanvas منو — خارج از جریان سند (جلوگیری از اسکرول سفید زیر فوتر) */
    .hpb-sticky-offcanvas.offcanvas,
    .offcanvas.mobile-menu-offcanvas {
        position: fixed !important;
        inset: 0 0 0 auto !important;
        width: min(100vw, 420px) !important;
        max-width: 100vw !important;
        height: 100% !important;
        visibility: hidden !important;
        pointer-events: none !important;
        z-index: 1050 !important;
    }

    .hpb-sticky-offcanvas.offcanvas.show,
    .offcanvas.mobile-menu-offcanvas.show {
        visibility: visible !important;
        pointer-events: auto !important;
    }

    body.home {
        min-height: 0 !important;
    }
}

@media (min-width: 992px) {
    .hpb-sticky-bottom-nav-shell.mobile-bottom-nav-shell {
        display: none !important;
    }
}
