/* ==========================================================
   ULTIMATE LAST OVERRIDES
   Loaded after every other CSS file.
   ========================================================== */

/* ----------------------------------------------------------
   A) DESKTOP PRODUCT DROPDOWN / SUBDROPDOWN FIX
   ---------------------------------------------------------- */
@media (min-width: 981px) {
  body .products-dropdown {
    position: relative !important;
  }

  body .products-horizontal-menu {
    overflow: visible !important;
    max-width: calc(100vw - 40px) !important;
    z-index: 5000 !important;
  }

  body .products-dropdown:hover > .products-horizontal-menu,
  body .products-dropdown:focus-within > .products-horizontal-menu {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }

  body .product-tab {
    position: relative !important;
    overflow: visible !important;
  }

  body .product-tab-title::after,
  body .product-tab::after {
    content: none !important;
    display: none !important;
  }

  body .product-submenu {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: auto !important;

    display: none !important;
    flex-direction: column !important;

    width: max-content !important;
    min-width: 100% !important;
    max-width: none !important;

    background: rgba(143, 157, 157, 0.98) !important;
    box-shadow: 0 10px 22px rgba(0,0,0,0.28) !important;
    z-index: 7000 !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  body .product-tab:hover > .product-submenu,
  body .product-tab:focus-within > .product-submenu {
    display: flex !important;
  }

  body .product-submenu a {
    display: block !important;
    width: 100% !important;
    min-width: max-content !important;
    white-space: nowrap !important;
    padding: 10px 14px !important;
    color: #fff !important;
    text-align: left !important;
    font-size: 14px !important;
    font-weight: 700 !important;
  }

  body .product-submenu a:hover {
    background: rgba(0,0,0,0.18) !important;
  }

  html[lang="ar"] body .product-submenu {
    left: auto !important;
    right: 0 !important;
  }

  html[lang="ar"] body .product-submenu a {
    text-align: right !important;
  }
}

/* ----------------------------------------------------------
   B) MOBILE: REMOVE PRODUCT DROPDOWN EFFECT
   Products button should go to products page directly.
   ---------------------------------------------------------- */
@media (max-width: 980px) {
  body .products-dropdown .products-horizontal-menu,
  body .products-dropdown:hover .products-horizontal-menu,
  body .products-dropdown:focus-within .products-horizontal-menu,
  body .products-dropdown.is-open .products-horizontal-menu {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* ----------------------------------------------------------
   C) MOBILE PRODUCT HOMEPAGE SLIDESHOW ARROWS
   Force arrows visible in Turkish / English / Russian / Arabic.
   ---------------------------------------------------------- */
@media (max-width: 980px) {
  body .products-section {
    overflow: hidden !important;
  }

  body .products-section .slideshow-container.product-home-slider {
    position: relative !important;
    width: 100% !important;
    max-width: 100% !important;

    height: auto !important;
    min-height: 720px !important;
    max-height: none !important;

    padding: 0 48px !important;
    box-sizing: border-box !important;
    overflow: visible !important;
  }

  body .products-section .slideshow-container.product-home-slider .slide {
    position: relative !important;
    inset: auto !important;

    display: none !important;
    width: 100% !important;
    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
  }

  body .products-section .slideshow-container.product-home-slider .slide.visible {
    display: block !important;
  }

  body .products-section .slideshow-container.product-home-slider .product-slide-image-frame,
  html[lang="ar"] body .products-section .slideshow-container.product-home-slider .product-slide-image-frame {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;

    width: min(92vw, 620px) !important;
    height: min(70vw, 420px) !important;
    min-width: 0 !important;
    min-height: 260px !important;
    max-width: min(92vw, 620px) !important;
    max-height: 420px !important;

    margin: 0 auto 22px !important;
    overflow: visible !important;
  }

  body .products-section .slideshow-container.product-home-slider .product-slide-image-frame img {
    width: 100% !important;
    height: 100% !important;
    object-fit: contain !important;
  }

  body .products-section .slideshow-container.product-home-slider .slide .text,
  html[lang="ar"] body .products-section .slideshow-container.product-home-slider .slide .text {
    position: relative !important;
    left: auto !important;
    right: auto !important;
    top: auto !important;
    transform: none !important;

    width: min(92vw, 620px) !important;
    min-width: 0 !important;
    max-width: min(92vw, 620px) !important;

    height: auto !important;
    min-height: 0 !important;
    max-height: none !important;

    margin: 0 auto !important;
  }

  body .products-section .slideshow-container.product-home-slider > .product-slider-arrow {
    display: grid !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;

    position: absolute !important;
    top: 210px !important;
    transform: translateY(-50%) !important;
    z-index: 99999 !important;

    width: 40px !important;
    height: 58px !important;
    min-width: 40px !important;
    min-height: 58px !important;

    place-items: center !important;

    background: rgba(0,0,0,0.22) !important;
    color: #fff !important;
    border: 0 !important;
    border-radius: 5px !important;

    font-size: 48px !important;
    font-weight: 900 !important;
    line-height: 1 !important;
    text-shadow: 0 2px 6px rgba(0,0,0,0.5) !important;
  }

  body .products-section .slideshow-container.product-home-slider > .product-slider-arrow.prev {
    left: 4px !important;
    right: auto !important;
  }

  body .products-section .slideshow-container.product-home-slider > .product-slider-arrow.next {
    right: 4px !important;
    left: auto !important;
  }

  html[lang="ar"] body .products-section .slideshow-container.product-home-slider > .product-slider-arrow.prev {
    right: 4px !important;
    left: auto !important;
  }

  html[lang="ar"] body .products-section .slideshow-container.product-home-slider > .product-slider-arrow.next {
    left: 4px !important;
    right: auto !important;
  }
}

/* ----------------------------------------------------------
   D) SEARCH PAGE: show only results
   ---------------------------------------------------------- */
body.search-active .products-sidebar,
body.search-active .product-category-view,
body.search-active .product-detail,
body.search-active .product-category-header,
body.search-active .products-breadcrumb {
  display: none !important;
}

body.search-active .products-shell {
  display: block !important;
  width: min(100% - 40px, 1280px) !important;
  margin: 0 auto !important;
}

body.search-active .products-main {
  width: 100% !important;
}

/* ----------------------------------------------------------
   E) Arabic footer mobile stacking
   ---------------------------------------------------------- */
@media (max-width: 980px) {
  html[lang="ar"] body .footer {
    direction: rtl !important;
    overflow: visible !important;
  }

  html[lang="ar"] body .footer-container {
    width: min(100% - 28px, 760px) !important;
    max-width: min(100% - 28px, 760px) !important;
  }

  html[lang="ar"] body .footer-menu {
    display: grid !important;
    grid-template-columns: 1fr !important;
    width: 100% !important;
    max-width: 100% !important;
    row-gap: 28px !important;
    column-gap: 0 !important;
    text-align: right !important;
    direction: rtl !important;
  }

  html[lang="ar"] body .footer-col {
    width: 100% !important;
    max-width: 100% !important;
    text-align: right !important;
  }

  html[lang="ar"] body .footer-bottom {
    width: 100% !important;
    max-width: 100% !important;
    text-align: right !important;
  }
}

/* ----------------------------------------------------------
   F) WhatsApp mobile position:
   TR/EN/RU right, AR left.
   ---------------------------------------------------------- */
@media (max-width: 760px) {
  html:not([lang="ar"]) body .whatsapp-float {
    right: 18px !important;
    left: auto !important;
    bottom: 18px !important;
  }

  html[lang="ar"] body .whatsapp-float {
    left: 18px !important;
    right: auto !important;
    bottom: 18px !important;
  }
}
