/* ============================================================================
   [ANTIGRAVITY] Full-Page Animated Mobile Menu Stylesheet (v2)
   File: main_assets/css/ag-mobile-menu.css
   Author: Antigravity AI
   Description: Full-screen mobile menu (100% width & 100dvh height) with
                smooth spring drawer reveal, category switch slide animation,
                accordion expand motion, and staggered product chip entrance.
                Note: Never apply transform/filter to ul.menu-list, li, or .cat-name
                so .menu-dropdown stays anchored to .menu-items without clipping.
   ============================================================================ */

@media (max-width: 768px) {
  /* Keyframe Animations */
  @keyframes agMobPanelSlideIn {
    0% {
      opacity: 0;
      transform: translate3d(18px, 0, 0);
    }
    100% {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }

  @keyframes agMobAccReveal {
    0% {
      opacity: 0;
      transform: translate3d(0, -8px, 0);
    }
    100% {
      opacity: 1;
      transform: translate3d(0, 0, 0);
    }
  }

  @keyframes agMobChipPop {
    0% {
      opacity: 0;
      transform: translate3d(0, 10px, 0) scale(0.94);
    }
    100% {
      opacity: 1;
      transform: translate3d(0, 0, 0) scale(1);
    }
  }

  @keyframes agMobIconBounceIn {
    0% {
      opacity: 0;
      transform: translate3d(-10px, 0, 0) scale(0.88);
    }
    100% {
      opacity: 1;
      transform: translate3d(0, 0, 0) scale(1);
    }
  }

  /* 1. Full-Page Menu Drawer (100% Width & Height) */
  .menu {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    max-width: 100vw !important;
    height: 100vh !important;
    height: 100dvh !important;
    z-index: 2147483647 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    opacity: 0 !important;
    visibility: hidden !important;
    transform: translate3d(-100%, 0, 0) scale(0.98) !important;
    -webkit-transform: translate3d(-100%, 0, 0) scale(0.98) !important;
    transition: transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
                opacity 0.3s ease,
                visibility 0.38s !important;
    -webkit-transition: -webkit-transform 0.38s cubic-bezier(0.16, 1, 0.3, 1),
                        opacity 0.3s ease,
                        visibility 0.38s !important;
    will-change: transform, opacity;
  }

  .menu.open {
    opacity: 1 !important;
    visibility: visible !important;
    transform: translate3d(0, 0, 0) scale(1) !important;
    -webkit-transform: translate3d(0, 0, 0) scale(1) !important;
  }

  /* Drawer Top Header & Close Button Motion */
  .mobile-drawer-header {
    height: 60px !important;
    min-height: 60px !important;
    padding: 0 16px !important;
    padding-top: env(safe-area-inset-top) !important;
    background: linear-gradient(135deg, #0d3664 0%, #1e40af 60%, #2563eb 100%) !important;
    box-shadow: 0 4px 14px rgba(13, 54, 100, 0.2) !important;
  }

  .mobile-drawer-header .drawer-close-btn {
    width: 38px !important;
    height: 38px !important;
    font-size: 24px !important;
    transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease !important;
  }

  .mobile-drawer-header .drawer-close-btn:active {
    transform: rotate(90deg) scale(0.9) !important;
    background: rgba(255, 255, 255, 0.35) !important;
  }

  /* Body Height Adjust for Full Page */
  .menu .menu-items {
    position: relative !important;
    height: calc(100% - 60px) !important;
  }

  /* 2. Left Column: MUST remain static & transform-free so .menu-dropdown is NEVER clipped */
  .menu .menu-items ul.menu-list {
    position: static !important;
    transform: none !important;
    width: 96px !important;
    min-width: 96px !important;
    max-width: 96px !important;
    background: #f8fafc !important;
  }

  .menu .menu-items ul.menu-list > li,
  .menu .menu-items ul.menu-list > li .cat-name {
    position: static !important;
    transform: none !important;
    filter: none !important;
    will-change: auto !important;
  }

  .menu .menu-items ul.menu-list > li {
    transition: background 0.22s ease !important;
  }

  /* Animate ONLY inner .cat-icon and label (never parent li / .cat-name) */
  .menu.open .menu-items ul.menu-list > li .cat-icon,
  .menu.open .menu-items ul.menu-list > li label.cat-label {
    animation: agMobIconBounceIn 0.36s cubic-bezier(0.16, 1, 0.3, 1) both;
  }
  .menu.open .menu-items ul.menu-list > li:nth-child(1) .cat-icon,
  .menu.open .menu-items ul.menu-list > li:nth-child(1) label.cat-label { animation-delay: 0.04s; }
  .menu.open .menu-items ul.menu-list > li:nth-child(2) .cat-icon,
  .menu.open .menu-items ul.menu-list > li:nth-child(2) label.cat-label { animation-delay: 0.08s; }
  .menu.open .menu-items ul.menu-list > li:nth-child(3) .cat-icon,
  .menu.open .menu-items ul.menu-list > li:nth-child(3) label.cat-label { animation-delay: 0.12s; }
  .menu.open .menu-items ul.menu-list > li:nth-child(4) .cat-icon,
  .menu.open .menu-items ul.menu-list > li:nth-child(4) label.cat-label { animation-delay: 0.16s; }
  .menu.open .menu-items ul.menu-list > li:nth-child(5) .cat-icon,
  .menu.open .menu-items ul.menu-list > li:nth-child(5) label.cat-label { animation-delay: 0.20s; }
  .menu.open .menu-items ul.menu-list > li:nth-child(6) .cat-icon,
  .menu.open .menu-items ul.menu-list > li:nth-child(6) label.cat-label { animation-delay: 0.24s; }
  .menu.open .menu-items ul.menu-list > li:nth-child(7) .cat-icon,
  .menu.open .menu-items ul.menu-list > li:nth-child(7) label.cat-label { animation-delay: 0.28s; }
  .menu.open .menu-items ul.menu-list > li:nth-child(8) .cat-icon,
  .menu.open .menu-items ul.menu-list > li:nth-child(8) label.cat-label { animation-delay: 0.32s; }

  .menu .menu-items ul.menu-list > li .cat-icon {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1),
                border-color 0.25s ease,
                box-shadow 0.25s ease !important;
  }

  .menu .menu-items ul.menu-list > li.active .cat-icon {
    transform: scale(1.08) !important;
    border-color: #2563eb !important;
    box-shadow: 0 4px 12px rgba(37, 99, 235, 0.22), 0 0 0 3px rgba(37, 99, 235, 0.12) !important;
  }

  /* 3. Right Panel Full Remaining Width + Slide-In Motion */
  .menu .menu-dropdown {
    position: absolute !important;
    left: 96px !important;
    right: 0 !important;
    top: 0 !important;
    bottom: 0 !important;
    width: calc(100% - 96px) !important;
    height: 100% !important;
    padding: 16px 14px max(28px, env(safe-area-inset-bottom)) !important;
  }

  .menu .menu-items ul.menu-list > li.active .menu-dropdown {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    animation: agMobPanelSlideIn 0.32s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  /* 4. Accordion Card & Expand Animation */
  .menu .menu-dropdown .sub-menu-list > li {
    transition: transform 0.2s ease, box-shadow 0.22s ease, border-color 0.22s ease !important;
  }

  .menu .menu-dropdown .sub-menu-list > li.active {
    border-color: #bfdbfe !important;
    box-shadow: 0 6px 18px -4px rgba(37, 99, 235, 0.12) !important;
  }

  .menu .menu-dropdown .sub-menu-list > li > a.sub-cat-head,
  .menu .menu-dropdown .sub-menu-list > li > a.category {
    transition: background 0.2s ease, color 0.2s ease, padding-left 0.22s ease !important;
  }

  .menu .menu-dropdown .sub-menu-list > li .sub-cat-arrow {
    transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), border-color 0.2s ease !important;
  }

  /* Accordion Body Reveal + Staggered Product Chips */
  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu {
    display: grid !important;
    animation: agMobAccReveal 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
  }

  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu > li.prod-item {
    animation: agMobChipPop 0.3s cubic-bezier(0.16, 1, 0.3, 1) both;
  }

  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu > li.prod-item:nth-child(2)  { animation-delay: 0.03s; }
  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu > li.prod-item:nth-child(3)  { animation-delay: 0.06s; }
  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu > li.prod-item:nth-child(4)  { animation-delay: 0.09s; }
  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu > li.prod-item:nth-child(5)  { animation-delay: 0.12s; }
  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu > li.prod-item:nth-child(6)  { animation-delay: 0.15s; }
  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu > li.prod-item:nth-child(7)  { animation-delay: 0.18s; }
  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu > li.prod-item:nth-child(8)  { animation-delay: 0.21s; }
  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu > li.prod-item:nth-child(9)  { animation-delay: 0.24s; }
  .menu .menu-dropdown .sub-menu-list > li.active > ul.inner-menu > li.prod-item:nth-child(10) { animation-delay: 0.27s; }

  .menu .menu-dropdown .sub-menu-list > li > ul.inner-menu > li.prod-item > a {
    transition: transform 0.18s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.18s ease,
                border-color 0.18s ease,
                box-shadow 0.18s ease !important;
  }

  .menu .menu-dropdown .sub-menu-list > li > ul.inner-menu > li.prod-item > a:active {
    transform: scale(0.95) !important;
    background: #dbeafe !important;
    border-color: #60a5fa !important;
  }
}

@media (max-width: 380px) {
  .menu {
    width: 100% !important;
    max-width: 100vw !important;
  }
  .menu .menu-items ul.menu-list {
    width: 84px !important;
    min-width: 84px !important;
    max-width: 84px !important;
  }
  .menu .menu-dropdown {
    left: 84px !important;
    width: calc(100% - 84px) !important;
  }
}
