/*
 * Unified Layout Base - Complete System with Mobile v5.0
 * UNIFIED: All responsive behavior consolidated here
 * MOBILE: All mobile overrides from scattered locations
 */

/* Root CSS variables for consistent theming */
:root { 
  color-scheme: light dark; 
  --panel-gap: 16px;
  --panel-padding: 16px;
  --panel-border-radius: 10px;
  --header-height: 130px;
  --uniform-gap: 16px;
  
  /* Mobile breakpoints - standardized across all pages */
  --mobile-portrait: 768px;
  --mobile-landscape: 920px;
  --desktop-min: 901px;
}

/* Base body styles */
body { 
  transition: background-color .35s, color .35s; 
  margin: 0;
  font-family: 'Poppins', sans-serif;
  background: #f5f7fa; 
  color: #222; 
}

/* Ensure HTML and body handle viewport scaling properly */
html {
  box-sizing: border-box;
  height: 100%;
}

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

/* UNIFIED MOBILE CLASSES - Available for script usage when needed */
/* Removed empty rulesets - styles defined when implemented */

/* Mobile-only elements */
.mobile-only {
  display: none;
}

@media (max-width: 768px) {
  .mobile-only {
    display: block;
  }
}

/* Mobile viewer controls overlay */
#viewerControlsOverlay {
  position: absolute;
  bottom: 8px;
  right: 8px;
  display: flex;
  gap: 6px;
  z-index: 20;
}

#viewerControlsOverlay button {
  background: rgba(0,0,0,0.55);
  color: #fff;
  border: 1px solid rgba(255,255,255,0.25);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 11px;
  line-height: 1;
  min-width: 34px;
  backdrop-filter: blur(4px);
}

#viewerControlsOverlay button:active {
  transform: scale(.95);
}

/* Model select fullscreen overlay for mobile */
#modelSelectOverlay {
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.85);
  backdrop-filter: blur(6px);
  z-index: 3000;
  display: none;
  flex-direction: column;
  padding: 12px;
}

#modelSelectOverlay.active {
  display: flex;
}

#modelSelectOverlay header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: #fff;
  margin-bottom: 8px;
}

#modelSelectOverlay input[type="search"] {
  width: 100%;
  padding: 10px 12px;
  border-radius: 8px;
  border: 1px solid #334155;
  background: #1e293b;
  color: #f1f5f9;
  font-size: 15px;
}

#modelSelectOverlay .list {
  flex: 1 1 auto;
  overflow: auto;
  margin-top: 10px;
  border: 1px solid #334155;
  border-radius: 8px;
  background: #0f172a;
}

#modelSelectOverlay .item {
  padding: 10px 12px;
  border-bottom: 1px solid #1e293b;
  color: #e2e8f0;
  font-size: 14px;
  line-height: 1.25;
  cursor: pointer;
}

#modelSelectOverlay .item:hover,
#modelSelectOverlay .item:active {
  background: #1e293b;
}

#modelSelectOverlay .item:last-child {
  border-bottom: none;
}

#modelSelectOverlay .close-btn {
  margin-left: 12px;
  background: #dc2626;
  color: #fff;
  border: none;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}

/* Mobile-specific form adjustments */
@media (max-width: 768px) {
  #modelSelect[data-multiline="true"] {
    display: block;
    width: 100%;
    max-height: 260px;
    overflow: auto;
    -webkit-overflow-scrolling: touch;
    border: 1px solid #888;
    border-radius: 6px;
    padding: 4px;
  }
  
  #modelSelect[data-multiline="true"] option {
    padding: 6px 8px;
    font-size: 14px;
    line-height: 1.25;
  }
  
  #addCabinetToCart {
    margin-bottom: 4px !important;
  }
}

/* Mobile scroll fixes - unified from both pages */
.enable-mobile-scroll html,
.enable-mobile-scroll body {
  overflow-y: auto !important;
}

/* UI: Kill-switch for legacy dimension tooltip (now replaced by native title) */
.dim-tooltip{ display:none !important; visibility:hidden !important; opacity:0 !important; pointer-events:none !important; }

/* Mobile breathing room */
body::after {
  content: "";
  display: block;
  height: 90px;
}

/* Light theme panels (default) */
.panel-left, .panel-middle, .panel-right, #viewerContainer { 
  background: #fff;
  transition: background-color .35s, border-color .35s, box-shadow .35s;
  min-height: 520px;
  overflow-y: auto;
}

/* DESKTOP LAYOUT - UNIFIED GRID SYSTEM */
main#appMainLayout,
main#app,
main#appMainLayout,
div.main-3col-layout,
#appMainLayout.main-3col-layout,
#app.main-3col-layout,
.main-3col-layout {
  display: grid !important;
  grid-template-columns: 320px 1fr 300px !important;
  gap: var(--uniform-gap) !important;
  padding: var(--uniform-gap) !important;
  justify-content: start !important;
  align-items: start !important;
  min-height: 750px !important;
  height: calc(100vh - var(--header-height)) !important;
  max-width: none !important;
  margin: 0 !important;
  box-sizing: border-box !important;
}

/* Force grid override of any flexbox interference */
main#appMainLayout:not(.force-flexbox) {
  display: grid !important;
}

/* MOBILE RESPONSIVE SYSTEM - CONSOLIDATED FROM ALL SOURCES */

/* Mobile Portrait Mode - Stack vertically */
@media (max-width: 768px) and (orientation: portrait) {
  main#appMainLayout,
  main#app,
  main#appMainLayout,
  .main-3col-layout {
    display: flex !important;
    flex-direction: column !important;
    grid-template-columns: none !important;
    height: auto !important;
    min-height: auto !important;
  }
  
  .panel-left, .panel-middle, .panel-right {
    width: 100% !important;
    flex: none !important;
    min-height: auto !important;
    margin-bottom: var(--panel-gap);
  }
  
  /* Mobile viewer adjustments */
  #viewerContainer {
    min-height: 300px !important;
    margin: 4px 0 !important;
  }
  
  /* Mobile button adjustments */
  .btn-cart-primary {
    margin-bottom: 4px !important;
  }
}

/* Mobile Landscape Mode - Restore 3-column but smaller */
@media (max-width: 920px) and (orientation: landscape) {
  main#appMainLayout,
  main#app,
  .main-3col-layout {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    height: calc(100vh - 80px) !important; /* Smaller header on landscape */
  }
  
  .panel-left, .panel-right {
    flex: 0 0 26vw !important;
    max-width: 300px !important;
    width: 26vw !important;
  }
  
  .panel-middle {
    flex: 1 1 auto !important;
  }
  
  /* Prevent width overrides */
  .panel-left, .panel-middle, .panel-right {
    width: auto !important;
    height: auto !important;
  }
  
  #viewerContainer {
    min-height: calc(var(--vh, 1vh) * 70) !important;
  }
}

/* Tablet and larger desktop - Full grid layout */
@media (min-width: 901px) {
  .main-3col-layout {
    height: auto !important;
    min-height: 600px;
  }
  
  .panel-left, .panel-middle, .panel-right {
    height: auto !important;
  }
  
  /* Hide mobile-only elements */
  .mobile-only {
    display: none !important;
  }
  
  #viewerControlsOverlay {
    display: none !important;
  }
}
  main#app,
  main#appMainLayout {
    min-height: 750px !important; /* Force desktop height */
  }
  .main-3col-layout {
    min-height: 750px !important; /* Override mobile resets on desktop */
  }

/* Responsive breakpoint - maintain uniform spacing */
@media (max-width: 1400px) { 
  main#appMainLayout,
  main#app,
  main#appMainLayout {
    grid-template-columns: 300px 1fr 280px !important;
    gap: 10px !important; /* Tighter gap for smaller screens */
    padding: 10px !important; /* Uniform padding on all sides */
    min-height: 720px !important; /* Maintain tall height on smaller screens */
  }
}

/* Wide screens - keep inter-column gap and column widths consistent with <=1400px */
@media (min-width: 1401px) {
  main#appMainLayout,
  main#app,
  .main-3col-layout {
    grid-template-columns: 300px 1fr 280px !important; /* Match <=1400px widths */
    gap: 10px !important; /* Prevent wider spacing between left and middle columns */
    justify-content: start !important; /* Neutralize any space-between from legacy flex */
  }
  /* Trim touching-side paddings to visually tighten inter-column spacing */
  .panel-left { padding-right: 12px !important; }
  .panel-middle { padding-left: 12px !important; }
}

/* Defensive: if any page still has flex on .main-3col-layout, neutralize space distribution */
.main-3col-layout { justify-content: start !important; }

/* Mobile collapse point - Stay 3-column until 700px for better zoom control */
@media (max-width: 700px) { 
  main#appMainLayout,
  main#app,
  main#appMainLayout {
    grid-template-columns: 1fr !important; /* Single column on mobile */
    padding: 14px 14px 40px 14px;
    min-height: auto !important; /* Remove height constraint on mobile */
  }
  
  /* HIDE ONLY floating cart elements on mobile - Allow main cart sidebar to work */
  .floating-cart-button,
  #floatingCartSummary,
  #floatingCartSummaryIndex,
  .floating-cart,
  .cart-floating,
  [id*="cart"][id*="float"],
  [class*="cart"][class*="float"],
  .cart-summary-floating,
  .mobile-cart {
    display: none !important;
    visibility: hidden !important;
    opacity: 0 !important;
    width: 0 !important;
    height: 0 !important;
    right: -500px !important;
    left: -500px !important;
    top: -500px !important;
    z-index: -1 !important;
    pointer-events: none !important;
    transform: translateX(-200vw) !important;
  }
  
  /* Ensure main cart sidebar can still function on mobile */
  .cart-sidebar {
    display: flex !important; /* Override any display none */
    flex-direction: column !important; /* Ensure proper stacking */
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    transform: none !important;
    /* Mobile cart sidebar positioning */
    position: fixed !important;
    top: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-width: 400px !important;
    height: 100vh !important;
    z-index: 1000 !important;
  }
  
  /* Mobile cart layout - ensure footer/checkout stays visible */
  @media (max-width: 700px) {
    .cart-sidebar .cart-content {
      flex: 1 1 auto !important;
      overflow-y: auto !important;
      max-height: calc(100vh - 120px) !important; /* Leave room for header and footer */
    }
    
    .cart-sidebar .cart-footer {
      flex-shrink: 0 !important;
      margin-top: auto !important;
      position: sticky !important;
      bottom: 0 !important;
      background: inherit !important;
      padding: 15px !important;
      border-top: 1px solid rgba(255,255,255,0.1) !important;
    }
    
    .cart-sidebar .cart-actions {
      display: flex !important;
      gap: 10px !important;
      width: 100% !important;
    }
    
    .cart-sidebar .cart-actions button {
      flex: 1 !important;
      min-height: 44px !important; /* Touch-friendly on mobile */
    }
  }
}

/* Force 3-column layout on landscape orientation regardless of width */
@media (orientation: landscape) and (max-width: 1000px) {
  /* Maximum zoom out capability - disable all zoom restrictions */
  html {
    -webkit-text-size-adjust: none !important; /* Prevent iOS text scaling */
    text-size-adjust: none !important;
    -ms-text-size-adjust: none !important;
  }
  
  body {
    zoom: 1 !important; /* Reset any zoom restrictions */
    -webkit-text-size-adjust: none !important;
    text-size-adjust: none !important;
    transform-origin: top left !important;
    min-width: auto !important;
    overflow-x: auto !important;
  }
  
  /* Ultra-compact layout for maximum zoom flexibility */
  main#appMainLayout,
  main#app {
    grid-template-columns: 200px 1fr 180px !important; /* Ultra-narrow sidebars */
    gap: 4px !important; /* Minimal gaps */
    padding: 4px !important; /* Minimal padding */
    font-size: 11px !important; /* Very small text */
    min-height: auto !important;
  }
  
  /* Ultra-compact panels */
  .panel-left, .panel-middle, .panel-right {
    padding: 6px !important; /* Ultra-compact padding */
    font-size: 10px !important; /* Tiny text in panels */
    border-radius: 4px !important; /* Smaller border radius */
  }
  
  /* Micro form elements */
  .panel-left select,
  .panel-left input[type=text],
  .panel-left input[type=number],
  .panel-left button {
    height: 24px !important;
    font-size: 9px !important;
    padding: 2px 4px !important;
    border-radius: 3px !important;
    line-height: 1 !important;
  }
  
  /* Micro labels and text */
  .panel-left label,
  .panel-left h3,
  .panel-right h3 {
    font-size: 10px !important;
    margin: 2px 0 !important;
    line-height: 1.2 !important;
  }
  
  /* Extra compact layer buttons */
  #btn-doors,
  #btn-drawers,
  #btn-hardware,
  #btn-wireframe {
    height: 18px !important;
    font-size: 8px !important;
    padding: 1px 2px !important;
  }
}

/* Center button text for layer control buttons */
#btn-doors,
#btn-drawers,
#btn-hardware,
#btn-wireframe {
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  text-align: center !important;
  line-height: 1 !important;
}

/* Smart wireframe button styling */
#btn-wireframe.wireframe-active {
  background: #007cba !important;
  color: #fff !important;
  border: 1px solid #005a9a !important;
}

#btn-wireframe.wireframe-active:hover {
  background: #005a9a !important;
}

/* Panel base styles - no scrollbars, proper height */
.panel-left, .panel-middle, .panel-right {
  padding: 16px !important;
  margin: 0 !important; /* Ensure no inherited margins */
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  /* FORCE override flexbox constraints from layout-panels.css */
  width: auto !important;
  flex: initial !important;
  height: auto !important;
  min-height: auto !important;
  max-height: none !important;
  /* Remove scrollbars - let layout container handle height */
  overflow: visible !important;
}

/* CRITICAL: Override all layout-panels.css flexbox styling */
main#appMainLayout .panel-left,
main#appMainLayout .panel-middle, 
main#appMainLayout .panel-right,
main#app .panel-left,
main#app .panel-middle, 
main#app .panel-right,
main#appMainLayout .panel-left,
main#appMainLayout .panel-middle,
main#appMainLayout .panel-right {
  width: auto !important;
  flex: initial !important;
  position: static !important;
  display: block !important;
  overflow: visible !important;
  height: auto !important;
}

/* Dark mode panel styling */
body.theme-dark .panel-left, 
body.theme-dark .panel-middle, 
body.theme-dark .panel-right, 
body.theme-dark #viewerContainer { 
  background: #1c2330;
  border-color: #2a3442;
  box-shadow: 0 2px 6px rgba(0,0,0,0.4);
}

/* Ensure consistent top bar styling - align with grid gaps */
#appTopBar, #topBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--panel-gap); /* Use consistent panel gap */
  margin: 0; /* Remove extra margins to align with grid gaps */
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  flex-wrap: wrap;
  gap: 18px;
  transition: background-color .35s, color .35s, box-shadow .35s;
}

/* Top bar responsive - align with grid gaps */
@media (max-width: 1400px) { 
  #appTopBar, #topBar {
    margin: 0; /* Remove extra margins to align with grid gaps */
    padding: 10px 14px;
  }
}

/* Dark mode top bar styling */
body.theme-dark #appTopBar, 
body.theme-dark #topBar {
  background: #1c2330;
  color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Ensure viewer scales while keeping minimum - NO SCROLL, perfect fit */
#viewerContainer { 
  min-height: 520px !important; /* Reduced to ensure no scroll */
  height: 100% !important; 
  max-height: 580px !important; /* Controlled max to fit perfectly within grid */
  width: 100% !important;
  order: 3 !important;
  overflow: hidden !important; /* Prevent internal scrolling */
}

@media (min-height: 900px) { 
  #viewerContainer { 
    min-height: 560px !important; /* Controlled increase for larger screens */
    max-height: 620px !important;
  } 
}

@media (min-height: 1100px) { 
  #viewerContainer { 
    min-height: 600px !important; /* Maximum for very large screens */
    max-height: 680px !important;
  } 
}

/* Panel scroll behavior - allow natural page scroll on mobile */
@media (max-width: 900px) { 
  .panel-left, .panel-middle, .panel-right { 
    overflow: visible;
    max-height: none; /* Remove height constraint on mobile */
  } 
}

/* Form control sizing for consistency */
.panel-left select,
.panel-left input[type=text],
.panel-left input[type=number] {
  height: 32px;
  line-height: 32px;
  width: 100%;
  box-sizing: border-box;
  padding: 8px 12px;
  border: 1px solid #ced4da;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  transition: border-color 0.3s ease;
}

.panel-left select:focus,
.panel-left input[type=text]:focus,
.panel-left input[type=number]:focus {
  outline: none;
  border-color: #1a5a99;
  box-shadow: 0 0 0 3px rgba(26, 90, 153, 0.1);
}

.panel-left select:hover,
.panel-left input[type=text]:hover,
.panel-left input[type=number]:hover {
  border-color: #adb5bd;
}

/* Button standardization */
.order-actions button {
  height: 32px !important;
  line-height: 32px !important;
}

/* Mobile/Embedded overrides for scroll behavior - Match mobile breakpoint */
@media (max-width: 700px) {
  html, body { 
    height: auto !important; 
    min-height: 100% !important; 
    overflow-y: auto !important; 
    overflow-x: hidden !important; 
    -webkit-overflow-scrolling: touch; 
    touch-action: pan-y; 
  }
  
  #app, main#appMainLayout { 
    max-height: none !important; 
    height: auto !important; 
    overflow: visible !important; 
  }
  
  .panel-left, .panel-middle, .panel-right { 
    height: auto !important; 
    overflow: visible !important; 
  }
  
  #viewerContainer { 
    order: 3; 
    width: 100% !important; 
    height: auto !important; 
    min-height: 300px !important; 
  }
  
  /* Add breathing room for mobile browser UI */
  body::after { 
    content: ""; 
    display: block; 
    height: 90px; 
  }
}

/* JavaScript hook for mobile scroll enabling */
.enable-mobile-scroll html, 
.enable-mobile-scroll body { 
  overflow-y: auto !important; 
}

/* Ensure consistent top bar styling */
#appTopBar, #topBar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 10px var(--panel-gap);
  margin: 0; /* Remove margins to align with grid gaps */
  background: #fff;
  border-radius: var(--panel-border-radius);
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  flex-wrap: wrap;
  gap: 18px;
  transition: background-color .35s, color .35s, box-shadow .35s;
}

/* Dark mode top bar styling */
body.theme-dark #appTopBar, 
body.theme-dark #topBar {
  background: #1c2330;
  color: #e2e8f0;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

/* Top bar labels and selects dark mode */
body.theme-dark #appTopBar label,
body.theme-dark #topBar label {
  color: #e2e8f0;
}

body.theme-dark #appTopBar select,
body.theme-dark #topBar select {
  background: #243142;
  color: #e2e8f0;
  border-color: #364b63;
}

body.theme-dark #appTopBar select:focus,
body.theme-dark #topBar select:focus {
  border-color: #1a84d8;
  box-shadow: 0 0 0 3px rgba(26, 132, 216, 0.1);
}

body.theme-dark #appTopBar select:hover,
body.theme-dark #topBar select:hover {
  border-color: #4a6680;
}

/* Top bar buttons dark mode */
body.theme-dark #appTopBar .btn-secondary-lite,
body.theme-dark #topBar .btn-secondary-lite {
  background: #364b63;
  color: #e2e8f0;
  border-color: #4a6680;
}

body.theme-dark #appTopBar .btn-secondary-lite:hover,
body.theme-dark #topBar .btn-secondary-lite:hover {
  background: #4a6680;
  border-color: #5a7a9a;
}

/* Responsive top bar */
@media (max-width: 768px) {
  #appTopBar, #topBar {
    margin: 0 10px 15px 10px;
    padding: 12px;
  }
}

/* =======================================================================
   MOBILE SCROLL FIXES - CONSOLIDATED FROM ALL PAGES
   ======================================================================= */

/* Mobile/Embedded (Wix) Overrides: allow scroll & prevent overlap */
@media (max-width: 920px) {
  html, body { 
    height: auto !important; 
    min-height: 100% !important; 
    overflow-y: auto !important; 
    overflow-x: hidden !important; 
    -webkit-overflow-scrolling: touch; 
    touch-action: pan-y; 
  }
  
  #app, #main, #content { 
    max-height: none !important; 
    height: auto !important; 
    overflow: visible !important; 
  }
  
  .main-3col-layout { 
    height: auto !important; 
    min-height: 0 !important; 
  }
  
  .panel-left, .panel-middle, .panel-right { 
    height: auto !important; 
    overflow: visible !important; 
  }
  
  #priceBreakdown { 
    max-height: none !important; 
    overflow: visible !important; 
    padding-bottom: 40px; 
  }
  
  /* Breathing room so bottom content not hidden behind mobile browser UI */
  body::after { 
    content: ""; 
    display: block; 
    height: 90px; 
  }
}
  
  /* Force main content to flow naturally after static headers */
  main, #app, #main, .main-3col-layout {
    margin-top: 0 !important;
    padding-top: 0 !important;
  }
  
  /* Ensure cart sidebar checkout button is visible on mobile */
  .cart-sidebar .cart-footer,
  .cart-sidebar .cart-actions,
  .cart-sidebar button[class*="checkout"],
  .cart-sidebar .btn-checkout,
  .cart-sidebar .checkout-btn,
  .cart-sidebar [data-action*="checkout"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
  }
 

/* ================================
   MOBILE-FIRST AGGRESSIVE OVERRIDES - Force mobile behavior on actual devices
   ================================ */

/* CRITICAL: Mobile device detection - override desktop-first CSS */
@media screen and (max-width: 768px),
       screen and (max-device-width: 768px),
       screen and (-webkit-device-pixel-ratio: 2),
       screen and (-webkit-device-pixel-ratio: 3),
       only screen and (max-width: 768px) {

  /* FORCE static headers on actual mobile devices */
  .nav-header, .top-bar, #appTopBar, header, .header,
  [class*="header"], [id*="header"], [class*="nav"], [id*="nav"],
  .top-bar-inner, .nav-container, .main-header,
  /* Target any sticky/fixed positioned elements */
  *[style*="position: sticky"],
  *[style*="position: fixed"]:not(#inno-toast):not(#cartToast):not(#inno-toast-fx),
  .inl-671500c0,
  [class*="inl-"] {
    position: static !important;
    top: auto !important;
    left: auto !important;
    right: auto !important;
    bottom: auto !important;
    transform: none !important;
    z-index: auto !important;
    float: none !important;
    /* Prevent re-sticking */
    will-change: auto !important;
    backface-visibility: visible !important;
  }

  /* Force main content flow naturally */
  main, #app, #main, .main-3col-layout, body {
    margin-top: 0 !important;
    padding-top: 0 !important;
    overflow-y: visible !important;
    position: relative !important;
  }

  /* AGGRESSIVE cart checkout button visibility fixes
     NOTE: Scope strictly to actual cart containers to avoid affecting
     the small header cart button (".header-cart") or other elements
     whose class names contain "cart". This fixes the deployed issue
     where the header cart button became a tall bar on some devices. */
  .cart-sidebar,
  .cart-ui {
    /* Ensure cart is scrollable and not blocking */
    position: fixed !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
    height: 100vh !important;
    max-height: 100vh !important;
  }

  /* Force checkout buttons to be visible */
  .cart-sidebar .cart-footer,
  .cart-sidebar .cart-actions,
  .cart-sidebar button[class*="checkout"],
  .cart-sidebar .btn-checkout,
  .cart-sidebar .checkout-btn,
  .cart-sidebar [data-action*="checkout"],
  .cart-sidebar .cart-checkout-section,
  .cart-sidebar .go-to-checkout,
  .cart-sidebar [class*="go-to"],
  .cart-sidebar [id*="checkout"],
  .cart-ui .checkout-btn,
  .cart-ui [class*="checkout"] {
    display: flex !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: relative !important;
    z-index: 10 !important;
    background: #007cba !important;
    color: white !important;
    padding: 12px 20px !important;
    border-radius: 8px !important;
    font-weight: 600 !important;
    min-height: 44px !important; /* iOS touch target */
    width: 100% !important;
    margin: 8px 0 !important;
    border: none !important;
  }

  /* Fix Chrome mobile cart overlay issues */
  .cart-overlay {
    pointer-events: auto !important;
    z-index: 999 !important;
  }

  .cart-sidebar.active .cart-overlay {
    display: block !important;
    background: rgba(0,0,0,0.5) !important;
  }

  /* Prevent Chrome from making cart unclosable */
  .cart-sidebar .close-cart,
  .cart-sidebar .cart-close,
  .cart-sidebar [data-action="close"],
  .cart-ui .close,
  .cart-ui .cart-close {
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    pointer-events: auto !important;
    position: absolute !important;
    top: 10px !important;
    right: 15px !important;
    z-index: 1000 !important;
    font-size: 24px !important;
    color: #666 !important;
    background: transparent !important;
    border: none !important;
    cursor: pointer !important;
    min-height: 44px !important;
    min-width: 44px !important;
  }
}

/* WEBKIT MOBILE SPECIFIC FIXES */
@media screen and (-webkit-min-device-pixel-ratio: 1) and (max-width: 768px) {
  /* iOS Safari specific overrides */
  body {
    -webkit-overflow-scrolling: touch !important;
    overflow-y: auto !important;
  }
  
  .nav-header, .top-bar, #appTopBar {
    -webkit-transform: none !important;
    transform: none !important;
    position: static !important;
  }
}

/* ================================
   GLOBAL Header Positioning - Force Static on ALL Screen Sizes  
   ================================ */
/* COMPREHENSIVE header positioning - force static on ALL headers (desktop + mobile) */
.nav-header, .top-bar, #appTopBar, header, .header, 
[class*="header"], [id*="header"], [class*="nav"], [id*="nav"],
.top-bar-inner, .nav-container,
/* Force override ANY inline styles causing sticky/fixed positioning */
.inl-671500c0,
[class*="inl-"],
*[style*="position: sticky"],
*[style*="position: fixed"]:not(#inno-toast):not(#cartToast):not(#inno-toast-fx) {
  position: static !important;
  top: auto !important;
  left: auto !important;
  right: auto !important;
  bottom: auto !important;
  transform: none !important;
  z-index: auto !important;
  float: none !important;
}

/* Force main content to flow naturally after static headers */
main, #app, #main, .main-3col-layout {
  margin-top: 0 !important;
  padding-top: 0 !important;
}

/* Fallback JS hook (class applied by script if needed) */
.enable-mobile-scroll html, 
.enable-mobile-scroll body { 
  overflow-y: auto !important; 
}
