/* ==========================================================================
   JLHome - Layout 39 Responsive & Mobile Stylesheet
   File: catalog/view/theme/so_theme/template/css/layout39/responsive.css
   Purpose: Modular, dedicated responsive rules for mobile & tablet devices.
   ========================================================================== */

/* --------------------------------------------------------------------------
   0. Global Reset & Anti-Overflow Rules
   -------------------------------------------------------------------------- */
html, body {
  overflow-x: hidden !important;
  max-width: 100% !important;
}

*, *::before, *::after {
  box-sizing: border-box;
}

/* --------------------------------------------------------------------------
   1. Tablet Breakpoint (max-width: 991px)
   -------------------------------------------------------------------------- */
@media (max-width: 991px) {
  /* Sticky Mobile Header */
  .typeheader-39 .header-top {
    display: none !important;
  }

  .typeheader-39 .header-middle {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    height: 60px !important;
    z-index: 9999 !important;
    background: #ffffff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1) !important;
    padding: 0 12px !important;
    display: flex !important;
    align-items: center !important;
  }

  /* Safe content offset so sticky header NEVER covers any headline/banner */
  body.layout-39,
  body {
    padding-top: 60px !important;
  }

  .layout-39 #content {
    padding-top: 0 !important;
    margin-top: 0 !important;
  }

  /* Mobile header container & row layout in navbar */
  .typeheader-39 .header-middle .container-full {
    width: 100% !important;
    max-width: 100% !important;
    flex: 1 1 100% !important;
    padding: 0 4px !important;
    margin: 0 !important;
  }

  .typeheader-39 .custom-header-mobile {
    width: 100% !important;
    margin: 0 !important;
  }

  .typeheader-39 .mobile-header-row {
    display: flex !important;
    flex-direction: row !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    gap: 8px !important;
  }

  .typeheader-39 .mobile-left {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
  }

  .typeheader-39 .mobile-center {
    flex: 1 1 auto !important;
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    text-align: center !important;
  }

  .typeheader-39 .mobile-center .logo {
    display: flex !important;
    justify-content: center !important;
    align-items: center !important;
    margin: 0 auto !important;
    width: 100% !important;
    text-align: center !important;
  }

  .typeheader-39 .mobile-center .logo img {
    max-height: 40px !important;
    width: auto !important;
    margin: 0 auto !important;
    padding: 0 !important;
    display: block !important;
  }

  .typeheader-39 .mobile-right {
    flex: 0 0 auto !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-end !important;
    gap: 8px !important;
  }

  .typeheader-39 .mobile-right ul.lang-curr {
    margin: 0 !important;
    padding: 0 !important;
    display: flex !important;
    align-items: center !important;
  }

  .typeheader-39 .mobile-right ul.lang-curr li {
    display: flex !important;
    align-items: center !important;
  }

  .typeheader-39 .mobile-right ul.lang-curr .btn-group {
    display: flex !important;
    align-items: center !important;
  }

  .typeheader-39 .mobile-right a img {
    width: 28px !important;
    height: 28px !important;
    display: block !important;
    object-fit: contain !important;
  }

  /* Mobile Bottom Navigation Auto-Hide on Footer */
  .bottom-bar-mobile {
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.3s ease !important;
    will-change: transform, opacity;
  }
  .bottom-bar-mobile.hide-footer {
    transform: translateY(100%) !important;
    opacity: 0 !important;
    pointer-events: none !important;
  }
}

/* --------------------------------------------------------------------------
   Empty Cart Page UI (route=checkout/cart)
   -------------------------------------------------------------------------- */
#checkout-cart .jl-checkout-card:has(.jl-cart-empty-wrapper),
#checkout-cart .jl-cart-empty-wrapper {
  display: flex !important;
  flex-direction: column !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
}

#checkout-cart .jl-cart-empty-wrapper {
  padding: 40px 16px 48px !important;
  margin: 0 auto !important;
  max-width: 520px !important;
  width: 100% !important;
}

#checkout-cart .jl-cart-empty-icon {
  width: 88px !important;
  height: 88px !important;
  border-radius: 50% !important;
  background: linear-gradient(135deg, rgba(0, 153, 255, 0.12) 0%, rgba(0, 153, 255, 0.04) 100%) !important;
  border: 2px solid rgba(0, 153, 255, 0.22) !important;
  box-shadow: 0 8px 24px rgba(0, 153, 255, 0.12) !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  margin: 0 auto 20px auto !important;
  transition: transform 0.3s ease !important;
}

#checkout-cart .jl-cart-empty-icon:hover {
  transform: scale(1.06) !important;
}

#checkout-cart .jl-cart-empty-icon svg {
  width: 44px !important;
  height: 44px !important;
  display: block !important;
  color: #0099ff !important;
}

#checkout-cart .jl-cart-empty-title {
  font-size: 22px !important;
  font-weight: 700 !important;
  color: #1e293b !important;
  margin: 0 0 10px 0 !important;
  line-height: 1.3 !important;
}

#checkout-cart .jl-cart-empty-text {
  font-size: 14.5px !important;
  color: #64748b !important;
  margin: 0 auto 24px auto !important;
  max-width: 340px !important;
  line-height: 1.5 !important;
}

#checkout-cart .jl-cart-empty-btn {
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  gap: 8px !important;
  padding: 12px 32px !important;
  border-radius: 9999px !important;
  background: linear-gradient(135deg, #0099ff 0%, #007acc 100%) !important;
  border: none !important;
  color: #ffffff !important;
  font-size: 15px !important;
  font-weight: 600 !important;
  box-shadow: 0 4px 15px rgba(0, 153, 255, 0.35) !important;
  transition: all 0.25s ease !important;
  text-decoration: none !important;
}

#checkout-cart .jl-cart-empty-btn:hover {
  background: linear-gradient(135deg, #0088e6 0%, #0066b3 100%) !important;
  box-shadow: 0 6px 20px rgba(0, 153, 255, 0.45) !important;
  transform: translateY(-2px) !important;
  color: #ffffff !important;
}

@media (max-width: 575.98px) {
  #checkout-cart .jl-checkout-layout {
    margin-top: 1rem !important;
    margin-bottom: 2rem !important;
  }
  #checkout-cart .jl-checkout-card {
    padding: 24px 16px !important;
    border-radius: 14px !important;
  }
  #checkout-cart .jl-cart-empty-wrapper {
    padding: 24px 12px 32px !important;
  }
  #checkout-cart .jl-cart-empty-icon {
    width: 76px !important;
    height: 76px !important;
    margin-bottom: 16px !important;
  }
  #checkout-cart .jl-cart-empty-icon svg {
    width: 38px !important;
    height: 38px !important;
  }
  #checkout-cart .jl-cart-empty-title {
    font-size: 19px !important;
  }
  #checkout-cart .jl-cart-empty-text {
    font-size: 13.5px !important;
    margin-bottom: 20px !important;
  }
  #checkout-cart .jl-cart-empty-btn {
    width: 100% !important;
    max-width: 260px !important;
    padding: 11px 24px !important;
    font-size: 14.5px !important;
  }
}


/* --------------------------------------------------------------------------
   2. Hero Banner Responsive Layout (max-width: 1023px)
   -------------------------------------------------------------------------- */
@media (max-width: 1023px) {
  .banner-slider {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    min-height: 640px !important;
    position: relative !important;
    overflow: hidden !important;
    padding: 20px 0 35px 0 !important;
    box-sizing: border-box !important;
  }

  .slider-wrapper {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    z-index: 1 !important;
  }

  .banner-slider > .static-slide-content {
    position: relative !important;
    top: auto !important;
    left: auto !important;
    transform: none !important;
    width: 100% !important;
    max-width: 520px !important;
    margin: 10px auto 0 auto !important;
    padding: 0 16px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    z-index: 3 !important;
    pointer-events: auto !important;
    box-sizing: border-box !important;
  }

  .inner-content {
    flex-direction: column !important;
    gap: 12px !important;
    width: 100% !important;
    align-items: center !important;
    text-align: center !important;
  }

  .text-col {
    flex: 1 1 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    text-align: center !important;
    align-items: center !important;
  }

  .text-col .headerbannertext {
    font-size: clamp(24px, 5.5vw, 32px) !important;
    line-height: 1.25 !important;
    font-weight: 800 !important;
    margin-bottom: 6px !important;
    text-shadow: 0 2px 10px rgba(0, 0, 0, 0.7) !important;
    letter-spacing: -0.2px !important;
  }

  .text-col .content-top .normaltext {
    font-size: clamp(14px, 3.5vw, 16.5px) !important;
    line-height: 1.42 !important;
    max-width: 360px !important;
    margin: 0 auto 10px auto !important;
    color: #e2e8f0 !important;
    text-shadow: 0 1px 6px rgba(0, 0, 0, 0.7) !important;
  }

  .hero-badges-group {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    gap: 6px !important;
    margin: 8px 0 14px 0 !important;
  }

  .hero-badge-item {
    font-size: 11.5px !important;
    padding: 4px 11px !important;
    background: rgba(15, 23, 42, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.35) !important;
    border-radius: 9999px !important;
    color: #ffffff !important;
    backdrop-filter: blur(4px) !important;
    white-space: nowrap !important;
  }

  .hero-badge-item i {
    color: #38bdf8 !important;
    margin-right: 4px !important;
  }

  .hero-actions {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    width: 100% !important;
    gap: 8px !important;
    margin-top: 6px !important;
  }

  .hero-btn {
    width: 100% !important;
    max-width: 280px !important;
    padding: 10px 18px !important;
    font-size: 14px !important;
    text-align: center !important;
    border-radius: 9999px !important;
  }

  .product-image {
    flex: 1 1 100% !important;
    width: 100% !important;
    margin-top: 10px !important;
    display: flex !important;
    justify-content: center !important;
  }

  .product-image img {
    max-height: clamp(160px, 26vh, 220px) !important;
    width: auto !important;
    margin: 0 auto !important;
    object-fit: contain !important;
    filter: drop-shadow(0 8px 20px rgba(0, 0, 0, 0.5)) !important;
  }

  .slider-dots {
    bottom: 12px !important;
  }

  .prev-btn, .next-btn {
    width: 36px !important;
    height: 36px !important;
    top: 50% !important;
    opacity: 0.65 !important;
  }
}

/* --------------------------------------------------------------------------
   3. How-To Section ("การทำงานของอุปกรณ์") - Mobile Friendly (max-width: 767px)
   -------------------------------------------------------------------------- */
@media (max-width: 767px) {
  .howto-container {
    padding: 1.25rem 0.75rem !important;
    overflow-x: hidden !important;
  }

  .head-group {
    padding: 1rem 0.5rem 0.5rem 0.5rem !important;
    margin-bottom: 1rem !important;
  }

  .headtext {
    font-size: 24px !important;
    line-height: 1.25 !important;
  }

  .underline {
    width: 70px !important;
    height: 3.5px !important;
    margin: 4px auto 0 auto !important;
  }

  /* Step badges (1. ลูกค้าเปิดสั่งงานระบบ...) */
  .bordertext {
    display: block !important;
    margin: 1rem auto 0.75rem auto !important;
    padding: 0.5rem 1.25rem !important;
    font-size: 15px !important;
    font-weight: 600 !important;
    border-radius: 6px !important;
    max-width: 90% !important;
    width: fit-content !important;
    text-align: center !important;
  }

  .howto-container > .normaltext:not(.bordertext) {
    font-size: 13.5px !important;
    line-height: 1.4 !important;
    padding: 0 0.5rem !important;
    margin-bottom: 0.75rem !important;
    color: #cbd5e1 !important;
  }

  /* Step 1 Cards: Stacked vertically with high legibility */
  .howto1-container {
    width: 100% !important;
    max-width: 420px !important;
    margin: 1.25rem auto 1rem auto !important;
    padding: 0 8px !important;
  }

  .howto1-container .row {
    display: flex !important;
    flex-direction: column !important;
    flex-wrap: wrap !important;
    gap: 34px !important;
    margin: 0 !important;
    padding: 22px 0 0 0 !important;
  }

  .howto1-container .col-12.col-md-4 {
    flex: 1 1 100% !important;
    width: 100% !important;
    max-width: 100% !important;
    padding: 0 !important;
    margin: 0 !important;
  }

  .howto1-group {
    position: relative !important;
    width: 100% !important;
    height: 320px !important;
    border-radius: 14px !important;
    overflow: visible !important;
    background: #1e1b24 !important;
    border: 1.5px solid rgba(255, 255, 255, 0.18) !important;
    box-shadow: 0 6px 20px rgba(0, 0, 0, 0.5) !important;
    margin: 0 !important;
  }

  .howto1-image {
    position: absolute !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    object-fit: cover !important;
    object-position: center bottom !important;
    border-radius: 13px !important;
    display: block !important;
    z-index: 1 !important;
  }

  .howto1-group::before {
    content: '' !important;
    display: block !important;
    position: absolute !important;
    inset: 0 !important;
    border-radius: 13px !important;
    background: linear-gradient(180deg, rgba(18, 16, 22, 0.92) 0%, rgba(18, 16, 22, 0.6) 42%, rgba(0, 0, 0, 0.08) 68%, rgba(0, 0, 0, 0.5) 100%) !important;
    z-index: 2 !important;
    pointer-events: none !important;
  }

  .howto1-icon {
    position: absolute !important;
    top: -24px !important;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 48px !important;
    height: 48px !important;
    min-width: 48px !important;
    border-radius: 50% !important;
    background-color: #0099ff !important;
    border: 2.5px solid rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 4px 12px rgba(0, 153, 255, 0.5) !important;
    z-index: 5 !important;
    background-size: cover !important;
    background-position: center !important;
  }

  .howto1-textgroup {
    position: absolute !important;
    top: 32px !important;
    left: 0 !important;
    right: 0 !important;
    padding: 0 14px !important;
    z-index: 4 !important;
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    gap: 5px !important;
    text-align: center !important;
    pointer-events: none !important;
  }

  .howto1-textgroup .normaltext {
    font-size: 16.5px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
    color: #ffffff !important;
    text-shadow: 0 2px 6px rgba(0, 0, 0, 0.9) !important;
    margin: 0 !important;
  }

  .howto1-textgroup .subtext {
    font-size: 13.5px !important;
    font-weight: 400 !important;
    line-height: 1.35 !important;
    color: #cbd5e1 !important;
    text-shadow: 0 1px 4px rgba(0, 0, 0, 0.9) !important;
    margin: 0 !important;
  }

  /* Steps 2-5 Media: contained, high performance */
  .image-wrap {
    width: 100% !important;
    max-width: 420px !important;
    margin: 0.5rem auto 0 auto !important;
  }

  .image-video {
    width: 100% !important;
    max-width: 100% !important;
    height: auto !important;
    max-height: 240px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 0 auto !important;
    border-radius: 0 !important;
  }
}

/* --------------------------------------------------------------------------
   4. Ultra Small Screen Tuning (max-width: 380px)
   -------------------------------------------------------------------------- */
@media (max-width: 380px) {
  .text-col .headerbannertext {
    font-size: 22px !important;
  }

  .text-col .content-top .normaltext {
    font-size: 13px !important;
  }

  .hero-badge-item {
    font-size: 11px !important;
    padding: 3px 9px !important;
  }

  .hero-btn {
    max-width: 250px !important;
    padding: 9px 14px !important;
    font-size: 13px !important;
  }

  .howto1-group {
    height: 290px !important;
  }

  .howto1-textgroup .normaltext {
    font-size: 15.5px !important;
  }

  .howto1-textgroup .subtext {
    font-size: 12.5px !important;
  }
}

/* --------------------------------------------------------------------------
   5. JL HOME - FAQ Section High Contrast & Legibility Fix (Right-side up blue sky)
   -------------------------------------------------------------------------- */
.faq-bg-wrap .head-group {
  padding: 2.5rem 1rem 1rem 1rem !important;
}

.faq-bg-wrap .headtext {
  --text-color: #ffffff !important;
  color: #ffffff !important;
  font-weight: 800 !important;
  font-size: clamp(28px, 3.2vw, 40px) !important;
  line-height: 1.25 !important;
  text-shadow: 0 2px 10px rgba(0, 20, 50, 0.6) !important;
}

.headtext.textbluewhite:not(.faq-bg-wrap *),
.textbluewhite:not(.faq-bg-wrap *) {
  --text-color: #0f172a !important;
  color: #0f172a !important;
  font-weight: 800 !important;
  font-size: clamp(26px, 3.2vw, 38px) !important;
  line-height: 1.25 !important;
}

.faq-bg-wrap .underline {
  width: 76px !important;
  max-width: 76px !important;
  height: 4px !important;
  background-color: #38bdf8 !important;
  border-radius: 9999px !important;
  box-shadow: 0 2px 10px rgba(56, 189, 248, 0.6) !important;
  margin: 6px auto 24px auto !important;
}

/* Ensure hero badges group is cleanly hidden */
.hero-badges-group {
  display: none !important;
}
