/* ==========================================================================
   RESPONSIVE NAVIGATION & LAYOUT - XEYROX
   Refined to ensure complete desktop isolation for mobile drawer
   ========================================================================== */

/* Tablet & Intermediate Viewports (769px to 1024px) */
@media (min-width: 769px) and (max-width: 1024px) {
  .container {
    width: calc(100% - 40px);
  }

  .section-placeholder {
    min-height: 280px;
  }
}

/* ==========================================================================
   DESKTOP STRICT ISOLATION (1025px and above)
   Ensures mobile navigation drawer NEVER renders or leaks on desktop
   ========================================================================== */
@media (min-width: 1025px) {
  .mobile-nav-overlay,
  .mobile-nav-overlay.is-open,
  .mobile-nav,
  .mobile-menu-btn {
    display: none !important;
    visibility: hidden !important;
    pointer-events: none !important;
  }
}

/* ==========================================================================
   TABLET & MOBILE NAVIGATION SWITCH (max-width: 1024px)
   Uses hamburger menu drawer cleanly across tablet (e.g. 876px) and mobile
   ========================================================================== */
@media (max-width: 1024px) {
  .global-header {
    height: 64px;
  }

  .header-logo img {
    height: 26px;
  }

  /* Hide Desktop Nav & Actions */
  .main-navigation,
  .header-actions,
  .products-dropdown {
    display: none !important;
  }

  /* Show Mobile/Tablet Hamburger */
  .mobile-menu-btn {
    display: flex !important;
  }
}

/* ==========================================================================
   MOBILE BREAKPOINT (max-width: 768px)
   ========================================================================== */
@media (max-width: 768px) {
  .container {
    width: calc(100% - 32px);
  }

  .section-placeholder {
    min-height: 200px;
  }

  .grid {
    grid-template-columns: 1fr;
  }
}

/* ==========================================================================
   MOBILE NAVIGATION DRAWER OVERLAY (Base styles - Off-Canvas)
   ========================================================================== */
.mobile-nav-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  background: rgba(7, 19, 38, 0.45);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  z-index: 2000;
  pointer-events: none;
}

@media (max-width: 1024px) {
  .mobile-nav-overlay.is-open {
    display: block !important;
    pointer-events: auto;
  }
}

.mobile-nav {
  position: fixed;
  top: 0;
  right: 0;
  width: min(380px, 86vw);
  height: 100vh;
  height: 100dvh;
  background: var(--x-white, #FFFFFF);
  z-index: 2001;
  transform: translateX(100%);
  transition: transform 260ms cubic-bezier(0.16, 1, 0.3, 1);
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  box-shadow: -8px 0 32px rgba(11, 23, 51, 0.12);
}

.mobile-nav-overlay.is-open .mobile-nav {
  transform: translateX(0);
}

/* Mobile Nav Header */
.mobile-nav-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  border-bottom: 1px solid var(--x-border, #DCE6F2);
  flex-shrink: 0;
}

.mobile-nav-header a {
  display: flex;
  align-items: center;
}

.mobile-nav-close {
  background: none;
  border: none;
  cursor: pointer;
  width: 44px;
  height: 44px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  color: var(--x-text, #0B1733);
  border-radius: 8px;
  transition: background-color 160ms ease;
}

.mobile-nav-close:hover {
  background-color: var(--x-surface-2, #F1F6FC);
}

.mobile-nav-close:focus-visible {
  outline: 2px solid var(--x-green-500, #19C88B);
  outline-offset: 2px;
}

/* Mobile Nav Body */
.mobile-nav-body {
  padding: 24px;
  display: flex;
  flex-direction: column;
  flex: 1;
}

.mobile-nav-list {
  list-style: none;
  margin: 0;
  padding: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.mobile-nav-item {
  border-bottom: 1px solid #F1F5F9;
}

.mobile-nav-link,
.mobile-nav-trigger {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  padding: 14px 0;
  font-family: var(--font-primary, "Be Vietnam Pro", sans-serif);
  font-size: 16px;
  font-weight: 600;
  color: var(--x-text, #0B1733);
  text-decoration: none;
  background: none;
  border: none;
  text-align: left;
  cursor: pointer;
  min-height: 44px;
  transition: color 160ms ease;
}

.mobile-nav-link:hover,
.mobile-nav-trigger:hover {
  color: var(--x-green-500, #19C88B);
}

.mobile-chevron {
  transition: transform 220ms ease;
  color: var(--x-text-muted, #71809A);
}

.mobile-nav-trigger.is-open .mobile-chevron {
  transform: rotate(180deg);
  color: var(--x-green-500, #19C88B);
}

/* Mobile Submenu Accordion */
.mobile-submenu {
  display: none;
  overflow: hidden;
}

.mobile-submenu.is-open {
  display: block;
}

.mobile-products-list {
  list-style: none;
  margin: 0;
  padding: 6px 0 16px;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.mobile-product-card {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 10px;
  border-radius: 10px;
  text-decoration: none;
  transition: background-color 160ms ease;
  min-height: 44px;
}

.mobile-product-card:hover {
  background-color: var(--x-surface, #F8FAFC);
}

.mobile-product-icon {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.mobile-product-icon img {
  width: 20px;
  height: 20px;
  object-fit: contain;
}

.mobile-product-info {
  display: flex;
  flex-direction: column;
}

.mobile-product-name {
  font-family: var(--font-primary, "Be Vietnam Pro", sans-serif);
  font-size: 14.5px;
  font-weight: 600;
  color: var(--x-text, #0B1733);
  line-height: 1.2;
}

.mobile-product-desc {
  font-family: var(--font-primary, "Be Vietnam Pro", sans-serif);
  font-size: 12px;
  color: var(--x-text-muted, #71809A);
  line-height: 1.3;
}

/* Mobile Actions */
.mobile-nav-actions {
  margin-top: auto;
  padding-top: 28px;
  display: flex;
  flex-direction: column;
  gap: 14px;
}

.btn-mobile-cta {
  width: 100%;
  padding: 13px 20px;
  font-size: 15px;
  text-align: center;
}

.mobile-signin-link {
  display: block;
  text-align: center;
  font-family: var(--font-primary, "Be Vietnam Pro", sans-serif);
  font-size: 15px;
  font-weight: 600;
  color: var(--x-text, #0B1733);
  text-decoration: none;
  padding: 10px;
  transition: color 160ms ease;
}

.mobile-signin-link:hover {
  color: var(--x-green-500, #19C88B);
}

/* ==========================================================================
   GLOBAL MOBILE RESPONSIVENESS & TOUCH OPTIMIZATIONS
   ========================================================================== */
html,
body {
  overflow-x: hidden;
  overflow-x: clip;
  max-width: 100%;
}

img,
svg,
video,
canvas {
  max-width: 100%;
  height: auto;
}

@media (max-width: 768px) {
  /* Prevent horizontal scroll */
  body {
    position: relative;
    width: 100%;
  }

  /* Consistent mobile container padding */
  .container {
    width: 100% !important;
    max-width: 100% !important;
    padding-left: 20px !important;
    padding-right: 20px !important;
    box-sizing: border-box !important;
  }

  /* Typography fluid scaling */
  h1,
  .hero-title,
  .section-title {
    word-break: break-word;
    hyphens: auto;
  }

  /* Form inputs: min 16px to prevent iOS auto-zoom */
  input,
  select,
  textarea {
    font-size: 16px !important;
  }

  /* Touch-friendly interactive buttons */
  .btn,
  .button,
  button {
    min-height: 44px;
  }

  /* Multi-column grids fallback to single column */
  .grid-2,
  .grid-3,
  .grid-4,
  .grid-cols-2,
  .grid-cols-3,
  .grid-cols-4 {
    grid-template-columns: 1fr !important;
  }

  /* Tables and code blocks scroll horizontally if wide */
  table,
  pre {
    display: block;
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
  }
}

@media (max-width: 480px) {
  .container {
    padding-left: 16px !important;
    padding-right: 16px !important;
  }
}
