/* ══════════════════════════════════════════════
   REEMCO — Mobile Responsive Fix (v4)
   Fixes layout overflow and scaling on mobile (< 768px).
   Desktop: untouched (no global html/body rules).
   Added: 2026-04-16
   Updated: 2026-04-18 — SR7: do not clip full-width canvas (black bar)
   Updated: 2026-04-18 — Products: woosw + grid spacing + list padding
   ══════════════════════════════════════════════ */

/* ─────────────────────────────────────────────
   1–2. ELEMENTOR + DOCUMENT — Viewport fit (mobile only)
   ───────────────────────────────────────────── */
@media (max-width: 767px) {

    html {
        -webkit-overflow-scrolling: touch;
    }

    /* Slider Revolution extends past column math; do not clip hero layers */
    .elementor-element:has(sr7-module),
    .e-con:has(sr7-module),
    .elementor-widget-slider_revolution,
    .elementor-widget-tp-slider-widget {
        overflow-x: visible !important;
    }

    /* Force all Elementor containers to respect viewport */
    .elementor-element,
    .e-con,
    .e-con-inner,
    .elementor-container,
    .elementor-widget-wrap,
    .elementor-widget,
    .elementor-section,
    .elementor-section-wrap,
    .elementor-top-section,
    .elementor-inner-section,
    .elementor-column,
    .elementor-column-wrap,
    .elementor-row {
        max-width: 100vw !important;
        overflow-x: hidden;
    }

    /* Elementor flex containers that are full-width */
    .e-con.e-con-full,
    .e-con[data-settings],
    body .elementor .e-con,
    body .elementor .e-con.e-parent,
    body .elementor .e-con.e-child {
        width: 100% !important;
        max-width: 100% !important;
        padding-left: 15px !important;
        padding-right: 15px !important;
        box-sizing: border-box !important;
    }

    /* Inner containers should also fit */
    .e-con-inner {
        width: 100% !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    /* ─────────────────────────────────────────
       3. SLIDER REVOLUTION 7 (sr7-*) + legacy RS6
       Hero JSON uses ws: nowrap — force wrap on small screens.
       ───────────────────────────────────────── */
    /*
     * SR7 full-width sliders position sr7-content at full viewport width
     * with negative offsets. overflow-x:hidden or max-width on sr7-content
     * clips layers and shows empty slide background (black) on one side.
     * Only clip at the outer Gutenberg wrapper if needed.
     */
    .wp-block-themepunch-revslider,
    .wp-block-developer-flavor-starter-starter {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: hidden !important;
        box-sizing: border-box !important;
    }

    sr7-module {
        width: 100% !important;
        max-width: 100% !important;
        overflow-x: visible !important;
    }

    sr7-content {
        overflow-x: visible !important;
        max-width: none !important;
    }

    /* Loosen strict paint containment so wrapped hero text is not clipped */
    sr7-slide {
        contain: layout style !important;
    }

    sr7-module sr7-txt.sr7-layer,
    sr7-module a.sr7-layer,
    sr7-module sr7-btn {
        white-space: normal !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        max-width: min(94vw, 36rem) !important;
        height: auto !important;
        min-height: 0 !important;
        line-height: 1.35 !important;
    }

    sr7-module sr7-img,
    sr7-module sr7-svg {
        max-width: 100% !important;
        height: auto !important;
        object-fit: contain;
    }

    /* RS6 legacy (if any shortcode remains) */
    rs-module-wrap,
    rs-module,
    .rs-module-wrap,
    #rev_slider_1_1_wrapper,
    [id*="rev_slider"],
    [class*="rev_slider"],
    rs-slides,
    rs-slide,
    rs-layer-wrap {
        max-width: 100vw !important;
        width: 100% !important;
        overflow: hidden !important;
    }

    rs-slide img,
    rs-layer img,
    .rs-slide img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* ─────────────────────────────────────────
       4. HEADER & LOGO — Mobile Scaling
       ───────────────────────────────────────── */
    .ast-site-identity {
        max-width: 60% !important;
    }

    .ast-site-identity img,
    .custom-logo {
        max-width: 140px !important;
        height: auto !important;
    }

    .ast-primary-header-bar {
        padding: 8px 12px !important;
    }

    .ast-mobile-header-wrap {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* Below header menu bar — HIDE on mobile */
    .ast-below-header-bar,
    .ast-below-header,
    .ast-below-header-wrap,
    .site-below-header-wrap,
    [data-section="section-below-header-builder"] {
        display: none !important;
        visibility: hidden !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    /* Above header — compact */
    .ast-above-header-bar {
        max-width: 100vw !important;
        overflow: hidden !important;
    }

    .ast-header-woo-cart .ast-woo-header-cart-info-wrap {
        display: none !important;
    }

    /* ─────────────────────────────────────────
       5. STICKY WRAPPER — HIDE on Mobile
       The sticky nav duplicates menu + search
       and takes too much space on mobile. Hide
       it entirely; the main header is enough.
       ───────────────────────────────────────── */
    .rc-sticky-wrapper,
    .rc-sticky-wrapper.is-sticky {
        display: none !important;
        visibility: hidden !important;
        transform: translateY(-200%) !important;
        pointer-events: none !important;
        height: 0 !important;
        overflow: hidden !important;
    }

    /* ─────────────────────────────────────────
       6. SEARCH BAR — Mobile Fix
       ───────────────────────────────────────── */
    .rc-header-search-row {
        padding: 8px 12px !important;
        max-width: 100vw !important;
        box-sizing: border-box !important;
    }

    .rc-search-wrap {
        max-width: 100% !important;
    }

    .rc-search-form {
        border-radius: 10px;
    }

    .rc-search-input {
        padding: 10px 12px !important;
        font-size: 0.85rem !important;
    }

    .rc-search-submit {
        width: 40px !important;
        height: 40px !important;
        border-radius: 8px !important;
    }

    /* ─────────────────────────────────────────
       7. HERO / SLIDER SECTION — Viewport Fit
       ───────────────────────────────────────── */
    .elementor-widget-heading .elementor-heading-title {
        font-size: clamp(1.2rem, 5vw, 2rem) !important;
        line-height: 1.4 !important;
        word-wrap: break-word !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
    }

    .elementor-widget-text-editor {
        font-size: clamp(0.8rem, 3.5vw, 1rem) !important;
    }

    .elementor-widget-image img {
        max-width: 100% !important;
        height: auto !important;
    }

    /* ─────────────────────────────────────────
       8. BRAND LOGOS SLIDER — Fix Sizing
       ───────────────────────────────────────── */
    .elementor-widget-image-carousel .swiper-slide img,
    .elementor-widget-image-carousel img,
    .elementor-image-carousel img {
        max-width: 120px !important;
        height: auto !important;
        margin: 0 auto !important;
    }

    .elementor-widget-image-carousel .swiper-container,
    .elementor-widget-image-carousel .swiper {
        max-width: 100% !important;
        padding: 0 !important;
    }

    .swiper-pagination {
        position: relative !important;
        bottom: 0 !important;
        margin-top: 10px !important;
    }

    /* ─────────────────────────────────────────
       9. PRODUCT GRID — 2 Columns on Mobile
       HIGH specificity to override Elementor
       ───────────────────────────────────────── */
    /* Override WooCommerce default grid */
    body .woocommerce ul.products,
    body ul.products,
    body.woocommerce ul.products,
    .woocommerce ul.products[class*="columns-"],
    body .elementor-widget-woocommerce-products ul.products,
    body .elementor-widget-wc-products ul.products,
    .elementor-element .elementor-widget-container ul.products {
        display: grid !important;
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 12px !important;
        padding: 0 !important;
        margin: 0 0 5.5rem !important;
    }

    /* Product items — full width within grid cell */
    body .woocommerce ul.products li.product,
    body ul.products li.product,
    body.woocommerce ul.products li.product,
    .woocommerce ul.products[class*="columns-"] li.product,
    body .elementor-widget-woocommerce-products ul.products li.product,
    body .elementor-widget-wc-products ul.products li.product {
        width: 100% !important;
        max-width: 100% !important;
        min-width: 0 !important;
        margin: 0 !important;
        padding: 0 !important;
        float: none !important;
        clear: none !important;
    }

    /* Product images responsive */
    body .woocommerce ul.products li.product .astra-shop-thumbnail-wrap,
    body .woocommerce ul.products li.product img {
        width: 100% !important;
        max-width: 100% !important;
        height: auto !important;
    }

    /* Tighten Astra card: remove huge gap between image block and summary */
    body .woocommerce ul.products li.product .astra-shop-thumbnail-wrap {
        margin-bottom: 0.35rem !important;
    }

    body .woocommerce ul.products li.product .astra-shop-summary-wrap {
        margin-top: 0 !important;
        padding-top: 0 !important;
    }

    body .woocommerce ul.products li.product .review-rating {
        margin-top: 0 !important;
        margin-bottom: 0.25rem !important;
    }

    /*
     * WPC Smart Wishlist on homepage / Elementor grids (when wishlist.css
     * did not load): keep label readable — never break Arabic per-character.
     */
    body .woocommerce ul.products li.product .woosw-btn,
    .elementor-widget-woocommerce-products .woosw-btn,
    .elementor-widget-wc-products .woosw-btn {
        white-space: nowrap !important;
        word-break: normal !important;
        overflow-wrap: normal !important;
        overflow: hidden !important;
        text-overflow: ellipsis !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
        line-height: 1.25 !important;
        padding-top: 8px !important;
        padding-bottom: 8px !important;
        padding-left: 6px !important;
        padding-right: 6px !important;
        font-size: clamp(0.62rem, 2.6vw, 0.78rem) !important;
    }

    /* Product title — compact */
    body .woocommerce ul.products li.product .woocommerce-loop-product__title,
    body .woocommerce ul.products li.product .woocommerce-loop-category__title,
    body .woocommerce ul.products li.product h2 {
        font-size: 0.78rem !important;
        line-height: 1.4 !important;
        margin-bottom: 4px !important;
        display: -webkit-box !important;
        -webkit-line-clamp: 2 !important;
        line-clamp: 2 !important;
        -webkit-box-orient: vertical !important;
        overflow: hidden !important;
    }

    /* Product price */
    body .woocommerce ul.products li.product .price {
        font-size: 0.8rem !important;
    }

    /* Add to cart / Wishlist buttons */
    body .woocommerce ul.products li.product .button,
    body .woocommerce ul.products li.product .add_to_cart_button,
    body .woocommerce ul.products li.product a.button {
        font-size: 0.72rem !important;
        padding: 6px 10px !important;
        width: 100% !important;
        box-sizing: border-box !important;
        text-align: center !important;
    }

    /* Elementor product widget grids — force 2 columns */
    body .elementor-widget-woocommerce-products .products,
    body .elementor-widget-wc-products .products,
    .elementor .elementor-widget-woocommerce-products .products,
    .elementor .elementor-widget-wc-products .products {
        grid-template-columns: repeat(2, 1fr) !important;
    }

    /* ─────────────────────────────────────────
       10. COOKIE CONSENT BANNER — Mobile Fix
       ───────────────────────────────────────── */
    .cky-consent-container,
    .cky-consent-bar,
    #cookie-law-info-bar,
    .cli-bar-container,
    .cli-bar-message,
    .cookie-law-info-bar {
        max-width: 100vw !important;
        width: 100% !important;
        box-sizing: border-box !important;
        left: 0 !important;
        right: 0 !important;
        padding: 12px 16px !important;
        font-size: 0.82rem !important;
    }

    .cky-btn-accept,
    .cky-btn-reject,
    .cky-btn-customize,
    .cli-bar-btn_container .cli-plugin-button,
    #cookie_action_close_header,
    .cookie_action_close_header {
        font-size: 0.78rem !important;
        padding: 8px 14px !important;
        min-width: auto !important;
    }

    .cky-notice-btn-wrapper,
    .cli-bar-btn_container {
        display: flex !important;
        flex-wrap: wrap !important;
        gap: 8px !important;
        justify-content: center !important;
        margin-top: 10px !important;
    }

    .cky-notice-des,
    .cli-bar-message {
        font-size: 0.78rem !important;
        line-height: 1.5 !important;
        text-align: center !important;
    }

    /* Cookie bar modal / preferences popup */
    .cky-modal,
    .cky-preference-center,
    .cli-modal {
        max-width: 95vw !important;
        width: 95vw !important;
        max-height: 85vh !important;
        margin: 0 auto !important;
        box-sizing: border-box !important;
    }

    /* ─────────────────────────────────────────
       11. FOOTER — Mobile Containment
       ───────────────────────────────────────── */
    .reemco-footer {
        max-width: 100vw !important;
        overflow-x: hidden !important;
        padding: 40px 0 0 0 !important;
    }

    .reemco-footer__container {
        padding: 0 16px !important;
        max-width: 100% !important;
        box-sizing: border-box !important;
    }

    .reemco-footer__grid {
        grid-template-columns: 1fr !important;
        gap: 24px !important;
    }

    .reemco-footer__brand-desc {
        max-width: 100% !important;
    }

    .reemco-footer__legal-info {
        max-width: 100% !important;
    }

    .reemco-footer__bottom {
        margin-top: 30px !important;
        padding: 16px 12px !important;
    }

    .reemco-footer__bottom p {
        font-size: 0.72rem !important;
    }

    /* ─────────────────────────────────────────
       12. WooCommerce SINGLE PRODUCT — Mobile
       ───────────────────────────────────────── */
    .woocommerce-product-gallery {
        max-width: 100% !important;
    }

    .woocommerce div.product div.images {
        max-width: 100% !important;
    }

    .woocommerce div.product .product_title {
        font-size: 1.2rem !important;
        line-height: 1.4 !important;
    }

    /* ─────────────────────────────────────────
       13. WHATSAPP & CHAT WIDGETS — Position
       ───────────────────────────────────────── */
    .whatsapp-floating-btn,
    .wa-chat-box,
    .joinchat,
    .joinchat__button {
        bottom: 12px !important;
        z-index: 9999 !important;
    }

    .joinchat {
        max-width: calc(100vw - 24px) !important;
    }

    /* ─────────────────────────────────────────
       14. TRANSLATEPRESS LANGUAGE SWITCHER
       ───────────────────────────────────────── */
    .trp-language-switcher,
    .trp-ls-shortcode-language {
        max-width: 100vw !important;
        z-index: 9998 !important;
    }

    .trp-floater-ls-wrap,
    #trp-floater-ls {
        max-width: 120px !important;
        font-size: 0.75rem !important;
    }

    /* ─────────────────────────────────────────
       15. GENERAL IMAGES & MEDIA
       ───────────────────────────────────────── */
    img,
    video,
    iframe,
    embed,
    object {
        max-width: 100% !important;
        height: auto;
    }

    table {
        display: block !important;
        overflow-x: auto !important;
        max-width: 100% !important;
        -webkit-overflow-scrolling: touch;
    }

    /* ─────────────────────────────────────────
       16. ASTRA THEME — Mobile Overrides
       ───────────────────────────────────────── */
    .ast-container,
    .site-content .ast-container {
        max-width: 100% !important;
        padding-left: 12px !important;
        padding-right: 12px !important;
    }

    #content,
    .site-content,
    #primary,
    .content-area {
        max-width: 100vw !important;
        overflow-x: hidden !important;
    }

    /* ─────────────────────────────────────────
       17. ELEMENTOR WIDGETS — Common Fixes
       ───────────────────────────────────────── */
    .elementor-widget-spacer {
        height: auto !important;
    }

    .elementor-widget-spacer .elementor-spacer {
        height: 20px !important;
    }

    .elementor-widget-icon-list .elementor-icon-list-text {
        word-break: break-word !important;
    }

    .elementor-widget-button .elementor-button {
        font-size: 0.85rem !important;
        padding: 10px 20px !important;
    }

    .elementor-widget-divider {
        max-width: 100% !important;
    }

    /* ─────────────────────────────────────────
       18. SALE BADGE / DISCOUNT TAG
       ───────────────────────────────────────── */
    .woocommerce span.onsale {
        font-size: 0.65rem !important;
        min-width: auto !important;
        min-height: auto !important;
        padding: 4px 8px !important;
        line-height: 1.3 !important;
    }

    /* ─────────────────────────────────────────
       19. WISHLIST BUTTON — Compact
       ───────────────────────────────────────── */
    .yith-wcwl-add-to-wishlist,
    .tinv-wraper,
    .tinvwl_add_to_wishlist_button {
        font-size: 0.75rem !important;
    }

    /* ─────────────────────────────────────────
       20. WooCommerce RELATED PRODUCTS
       ───────────────────────────────────────── */
    body .woocommerce .related.products ul.products,
    body .woocommerce .up-sells ul.products,
    body .woocommerce .cross-sells ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
    }
}

/* ─────────────────────────────────────────────
   SMALL MOBILE (< 480px) — Extra Compact
   ───────────────────────────────────────────── */
@media (max-width: 480px) {

    .ast-site-identity img,
    .custom-logo {
        max-width: 110px !important;
    }

    body .woocommerce ul.products li.product .woocommerce-loop-product__title,
    body .woocommerce ul.products li.product h2 {
        font-size: 0.7rem !important;
    }

    body .woocommerce ul.products li.product .price {
        font-size: 0.75rem !important;
    }

    .e-con.e-con-full,
    .e-con[data-settings],
    body .elementor .e-con {
        padding-left: 10px !important;
        padding-right: 10px !important;
    }

    .reemco-footer__container {
        padding: 0 12px !important;
    }

    /* Brand logos even smaller */
    .elementor-widget-image-carousel .swiper-slide img,
    .elementor-widget-image-carousel img {
        max-width: 100px !important;
    }
}

/* ─────────────────────────────────────────────
   VERY SMALL MOBILE (< 360px)
   ───────────────────────────────────────────── */
@media (max-width: 360px) {

    body .woocommerce ul.products,
    body ul.products {
        grid-template-columns: repeat(2, 1fr) !important;
        gap: 8px !important;
    }

    .elementor-widget-image-carousel .swiper-slide img,
    .elementor-widget-image-carousel img {
        max-width: 80px !important;
    }

    .ast-site-identity img,
    .custom-logo {
        max-width: 90px !important;
    }
}
