/**
 * Webgentic - Mobile Menu System
 * Full-screen mobile navigation with slide-in animation
 */

/* ================================
   MOBILE MENU BASE
   ================================ */

/* Only apply mobile menu styles on screens smaller than 768px */
@media (max-width: 767px) {

  /* Prevent body scroll when menu is open */
  body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
  }

  /* Keep logo and contact button visible above mobile menu */
  .site-header__logo-link {
    position: relative;
    z-index: 1001;
  }

  .site-header__container > .site-nav__contact {
    position: relative;
    z-index: 1001;
  }

  /* Mobile Navigation Container */
  .site-nav {
    position: fixed;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100vh;
    background: #ffffff;
    z-index: 999;
    overflow-y: auto;
    transition: left 0.3s ease-in-out;
    display: flex !important;
    flex-direction: column;
    justify-content: flex-start;
    padding: 80px 0 24px 0;
  }

  .site-nav--open {
    left: 0;
  }

  /* Navigation Links Container */
  .site-nav__links {
    flex-direction: column;
    gap: 0;
    padding: 0;
    width: 100%;
  }

  /* ================================
     MOBILE MENU TOGGLE (HAMBURGER)
     ================================ */

  .menu-toggle {
    position: relative;
    z-index: 1000;
    width: 44px;
    height: 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    cursor: pointer;
    padding: 8px;
  }

  .menu-toggle__line {
    width: 24px;
    height: 2px;
    background: var(--color-primary);
    transition: all 0.3s ease;
    transform-origin: center;
  }

  /* Hamburger to X Animation */
  .menu-toggle--active .menu-toggle__line:nth-child(1) {
    transform: translateY(7px) rotate(45deg);
  }

  .menu-toggle--active .menu-toggle__line:nth-child(2) {
    opacity: 0;
    transform: scaleX(0);
  }

  .menu-toggle--active .menu-toggle__line:nth-child(3) {
    transform: translateY(-7px) rotate(-45deg);
  }

  /* ================================
     MOBILE NAVIGATION LINKS
     ================================ */

  .site-nav__link {
    display: block;
    padding: 16px 24px;
    width: 100%;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    font-size: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
  }

  .site-nav__link::after {
    display: none;
  }

  /* ================================
     MOBILE DROPDOWNS
     ================================ */

  .site-nav__dropdown {
    width: 100%;
  }

  .site-nav__link--dropdown {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 16px 24px;
    width: 100%;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
  }

  .dropdown-arrow {
    transition: transform 0.3s ease;
  }

  .site-nav__dropdown.dropdown-open .dropdown-arrow {
    transform: rotate(180deg);
  }

  /* Dropdown Menu Mobile */
  .site-nav__dropdown-menu {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background: rgba(0, 0, 0, 0.02);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .site-nav__dropdown.dropdown-open .site-nav__dropdown-menu {
    max-height: 500px;
  }

  .dropdown-item {
    padding: 12px 24px 12px 40px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
  }

  .dropdown-item__title {
    font-size: 0.9375rem;
    font-weight: var(--weight-medium);
  }

  .dropdown-item__metric {
    font-size: 0.6875rem;
    margin-top: 2px;
  }

  /* ================================
     MOBILE MEGA-MENU
     ================================ */

  .site-nav__dropdown--mega {
    position: relative;
  }

  .site-nav__mega-menu {
    position: static;
    transform: none;
    opacity: 1;
    visibility: visible;
    margin: 0;
    border: none;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
    background: rgba(0, 0, 0, 0.02);
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.4s ease;
    display: block !important;
    grid-template-columns: none !important;
  }

  .site-nav__dropdown--mega.dropdown-open .site-nav__mega-menu {
    max-height: 2000px;
  }

  .mega-menu__section {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
    display: block !important;
    width: 100%;
  }

  .mega-menu__section:last-child {
    border-bottom: none;
  }

  .mega-menu__title {
    padding: 14px 24px 14px 40px;
    margin: 0;
    font-size: 0.8125rem;
    font-weight: var(--weight-semibold);
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: flex;
    justify-content: space-between;
    align-items: center;
    cursor: pointer;
    background: rgba(0, 0, 0, 0.02);
    transition: background 0.2s ease;
  }

  .mega-menu__title:hover {
    background: rgba(0, 0, 0, 0.04);
  }

  .mega-menu__title-arrow {
    transition: transform 0.3s ease;
    width: 12px;
    height: 12px;
  }

  .mega-menu__section.section-open .mega-menu__title-arrow {
    transform: rotate(180deg);
  }

  .mega-menu__items {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.3s ease;
  }

  .mega-menu__section.section-open .mega-menu__items {
    max-height: 1000px;
  }

  .mega-menu__item {
    padding: 10px 24px 10px 40px;
  }

  .mega-menu__item-title {
    font-size: 0.9375rem;
    font-weight: var(--weight-medium);
  }

  .mega-menu__item-desc {
    font-size: 0.8125rem;
    margin-top: 2px;
  }

  /* ================================
     MOBILE MENU SOCIAL LINKS
     ================================ */

  /* Hide desktop social links, show mobile ones */
  .social-links--desktop {
    display: none !important;
  }

  .social-links--mobile {
    display: flex !important;
    justify-content: center;
    align-items: center;
    gap: 16px;
    padding: 24px 24px 80px 24px;
    margin-top: auto;
    border-top: 1px solid rgba(0, 0, 0, 0.08);
  }

  .social-links--mobile .social-links__link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    color: var(--color-primary);
    background: rgba(0, 0, 0, 0.04);
    border-radius: 50%;
    transition: all 0.3s ease;
  }

  .social-links--mobile .social-links__link:hover {
    background: var(--color-primary);
    color: #ffffff;
    transform: translateY(-2px);
  }

  .social-links--mobile .social-links__link svg {
    width: 24px;
    height: 24px;
  }

  /* ================================
     MOBILE CONTACT BUTTON
     ================================ */

  .site-nav__contact {
    margin-top: 0;
    padding: 4px;
  }

  .site-nav__contact .btn--nav {
    width: 100%;
    justify-content: center;
    padding: 4px 14px;
    font-size: 1rem;
  }

  /* ================================
     STATUS DOT IN MOBILE
     ================================ */

  .site-nav__link--status {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 8px;
  }

  .status-dot {
    display: inline-block;
  }

  /* ================================
     MOBILE MENU OVERLAY BACKDROP
     ================================ */

  .mobile-menu-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100vh;
    background: rgba(0, 0, 0, 0.5);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
  }

  .mobile-menu-backdrop.active {
    opacity: 1;
    visibility: visible;
  }
}

/* ================================
   DESKTOP - RESET MOBILE STYLES
   ================================ */

@media (min-width: 768px) {
  /* Hide mobile-only elements on desktop */
  .mega-menu__title-arrow {
    display: none;
  }

  .mega-menu__items {
    max-height: none;
    overflow: visible;
  }

  .mega-menu__title {
    cursor: default;
    background: transparent;
    padding: 0 24px 8px 40px;
    margin-bottom: 8px;
    font-size: 0.6875rem;
    border-bottom: 1px solid rgba(0, 0, 0, 0.08);
    display: block;
  }

  .mega-menu__section {
    padding: 16px 0;
  }
}

/* ================================
   TABLET ADJUSTMENTS (768px - 1024px)
   ================================ */

@media (min-width: 768px) and (max-width: 1024px) {
  /* Ensure desktop navigation works on tablets */
  .site-nav {
    position: static;
    height: auto;
    overflow: visible;
    flex-direction: row;
  }

  .site-nav__links {
    flex-direction: row;
    gap: 24px;
  }

  .menu-toggle {
    display: none;
  }
}
