/* ===================================================================
   FILE: MOBILE-MENU-ENHANCED.CSS
   DESCRIPTION: Enhanced and fixed styles for the mobile menu.
   =================================================================== */

/* --- Specific variables for the menu --- */
:root {
  --header-height: 80px;
  --menu-transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  --menu-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  --menu-backdrop: rgba(0, 0, 0, 0.4);
}

/* --- Base Styles --- */
.menu-toggle {
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  margin: 0;
  display: none; /* Hidden by default, shown on mobile */
}

.menu {
  list-style: none;
  margin: 0;
  padding: 0;
}

/* =================================
   1. Desktop Styles (Default)
   ================================= */
@media (min-width: 901px) {
  .menu-toggle {
    display: none !important; /* Force hide */
  }

  .menu {
    display: flex !important; /* Force display */
    position: static;
    flex-direction: row;
    background: none;
    box-shadow: none;
    padding: 0;
    opacity: 1;
    transform: none;
    gap: 2rem;
    width: auto;
  }

  .menu li {
    width: auto;
    border: none;
  }

  .menu a {
    padding: 0.5rem 0;
    position: relative;
    color: var(--color-dark);
    font-weight: 600;
    text-decoration: none;
  }

  .menu a:hover,
  .menu a.active {
    color: var(--color-primary);
  }

  .menu a::after {
    content: "";
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -2px;
    left: 0;
    background-color: var(--color-primary);
    transition: width 0.3s ease;
  }

  .menu a:hover::after,
  .menu a.active::after {
    width: 100%;
  }
}

/* =================================
   2. Mobile Styles
   ================================= */
@media (max-width: 900px) {
  /* Hamburger button */
  .menu-toggle {
    display: flex !important; /* Force display */
    align-items: center;
    justify-content: center;
    width: 48px;
    height: 48px;
    z-index: 1002;
    transition: var(--menu-transition);
    border-radius: 8px;
  }

  .menu-toggle:hover {
    background: rgba(171, 142, 117, 0.1);
  }

  .menu-toggle i {
    font-size: 1.5rem;
    color: var(--color-primary);
    transition: transform 0.3s ease, color 0.3s ease;
  }

  .menu-toggle.active i {
    color: var(--color-dark);
    transform: rotate(90deg);
  }

  /* Mobile menu panel */
  .menu {
    display: none;
    position: fixed;
    top: var(--header-height);
    left: 0;
    width: 100%;
    background: white;
    padding-bottom: 1rem;
    box-shadow: var(--menu-shadow);
    z-index: 1001;
    opacity: 0;
    transform: translateY(-10px);
    transition: transform 0.3s ease, opacity 0.3s ease;
    max-height: calc(100vh - var(--header-height));
    overflow-y: auto;
  }

  /* Active menu state */
  .menu.active {
    display: flex !important;
    flex-direction: column;
    opacity: 1;
    transform: translateY(0);
  }

  /* Menu items animation */
  .menu li {
    width: 100%;
    border-bottom: 1px solid #f0f0f0;
    opacity: 0;
    transform: translateX(-20px);
    animation: slideInLeft 0.4s ease forwards;
  }

  .menu li:last-child {
    border-bottom: none;
  }
  
  /* Staggered animation delays */
  .menu.active li:nth-child(1) { animation-delay: 0.1s; }
  .menu.active li:nth-child(2) { animation-delay: 0.15s; }
  .menu.active li:nth-child(3) { animation-delay: 0.2s; }
  .menu.active li:nth-child(4) { animation-delay: 0.25s; }
  .menu.active li:nth-child(5) { animation-delay: 0.3s; }

  /* Menu links */
  .menu a {
    display: block;
    padding: 1.2rem 2rem;
    color: var(--color-dark);
    font-weight: 600;
    text-decoration: none;
    transition: color 0.3s ease, background-color 0.3s ease, padding-left 0.3s ease;
  }

  .menu a:hover,
  .menu a.active {
    background: var(--color-light-gray);
    color: var(--color-primary);
    padding-left: 2.5rem;
  }

  /* Backdrop overlay */
  .menu.active::before {
    content: "";
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background: var(--menu-backdrop);
    z-index: -1;
    animation: fadeInBackdrop 0.3s ease forwards;
  }
}

/* =================================
   3. Animations & Accessibility
   ================================= */
@keyframes slideInLeft {
  to { opacity: 1; transform: translateX(0); }
}

@keyframes fadeInBackdrop {
  to { opacity: 1; }
}

/* Accessibility: Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .menu-toggle,
  .menu,
  .menu li {
    transition: none !important;
    animation: none !important;
  }
}