/* Standardized Navigation Styles */
.nav-item[data-page] .nav-link.active {
  color: var(--primary-yellow);
  font-weight: 600;
}

.nav-item.active .nav-link:after {
  width: 100%;
}

/* Show the logo in the navigation by default */
.nav-logo {
  display: flex !important; /* Override the display:none in main.css */
  align-items: center;
  z-index: 1002;
}

.nav-logo-img {
  height: 50px;
  width: auto;
  object-fit: contain;
  transition: all 0.3s ease;
}

/* Ensure Font Awesome dropdown icons are properly sized and aligned */
.dropdown-icon.fa-solid {
  font-size: 0.75em;
  margin-left: 0.3rem;
  transition: transform 0.3s ease;
  display: inline-block;
  vertical-align: middle;
}

.nav-item.show-dropdown .dropdown-icon.fa-solid {
  transform: rotate(180deg);
}

/* Fix for contact link (supports both contact.html and contacts.html) */
.nav-item[data-page='contacts.html,contact.html'] .nav-link {
  position: relative;
}

/* Accessibility Improvements */
.nav-link {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

/* Focus states for better keyboard navigation */
.nav-link:focus {
  outline: 2px solid rgba(233, 163, 25, 0.5);
  outline-offset: -2px;
}

.hamburger:focus {
  outline: 2px solid rgba(255, 255, 255, 0.5);
  outline-offset: 2px;
}

/* Visual indicator for current page */
.nav-item.active {
  position: relative;
}

/* Animation for mobile menu */
@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.nav-menu.active {
  animation: fadeIn 0.3s ease-in-out;
}

/* Styles for the overlay when mobile menu is open */
.menu-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

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

/* Navbar scrolled styles for better UX */
.main-nav.nav-scrolled .nav-container {
  height: 60px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
}

.main-nav.nav-scrolled .nav-logo-img {
  height: 40px;
}

/* Navigation with drop shadow when scrolled */
.main-nav.nav-scrolled {
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

/* Improve nested dropdowns */
.dropdown-menu {
  padding: 0.5rem 0;
}

.dropdown-menu li {
  position: relative;
}

/* Ensure mobile menu works correctly for all screen sizes */
@media (max-width: 991px) {
  /* Mobile Navigation Container Adjustments */
  .nav-container {
    height: 65px;
    padding: 0 1rem;
  }

  /* Hamburger Button */
  .hamburger {
    display: flex !important; /* Override any display:none */
    z-index: 1002;
  }

  /* Mobile Menu Styling */
  .nav-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 350px;
    height: 100vh;
    background-color: var(--primary-dark);
    box-shadow: -5px 0 15px rgba(0, 0, 0, 0.2);
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: stretch;
    padding: 5rem 0 2rem;
    transition: right 0.3s ease;
    overflow-y: auto;
    z-index: 1001;
  }

  /* Active Mobile Menu */
  .nav-menu.active {
    right: 0;
  }

  /* Hamburger Animation */
  .hamburger.active .bar:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
  }

  .hamburger.active .bar:nth-child(2) {
    opacity: 0;
  }

  .hamburger.active .bar:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
  }

  /* Mobile Navigation List */
  .nav-list {
    flex-direction: column;
    width: 100%;
    gap: 0;
  }

  .nav-item {
    width: 100%;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  .nav-link {
    padding: 1rem 1.5rem;
    width: 100%;
    justify-content: space-between;
  }

  /* Mobile Dropdown Styling */
  .nav-item.show-dropdown .dropdown-menu {
    display: block;
    position: static;
    background: rgba(0, 0, 0, 0.15);
    box-shadow: none;
    padding: 0.5rem 0;
    border-radius: 0;
    border-top: none;
    opacity: 1;
    visibility: visible;
    transform: none;
    width: 100%;
  }

  .dropdown-menu li a {
    padding: 0.8rem 2.5rem;
    color: var(--text-light);
  }

  .dropdown-menu li a:hover {
    background-color: rgba(255, 255, 255, 0.1);
    color: var(--primary-yellow);
    padding-left: 3rem;
  }
}

/* Responsive Adjustments for Different Screen Sizes */

/* Extra Small Devices (phones, 576px and down) */
@media (max-width: 576px) {
  .nav-container {
    height: 60px;
    padding: 0 0.75rem;
  }

  .nav-logo-img {
    height: 40px;
  }

  .nav-menu {
    width: 90%;
    padding-top: 4rem;
  }

  .nav-link {
    font-size: 0.9rem;
  }

  /* Make close button more obvious on small screens */
  .hamburger.active {
    position: fixed;
    right: 15px;
    top: 15px;
    background-color: rgba(255, 255, 255, 0.15);
  }
}

/* Small to Medium Devices (tablets, 577px to 767px) */
@media (min-width: 577px) and (max-width: 767px) {
  .nav-container {
    height: 65px;
  }

  .nav-menu {
    width: 85%;
  }
}

/* Medium Devices (tablets, 768px to 991px) */
@media (min-width: 768px) and (max-width: 991px) {
  .nav-menu {
    width: 70%;
    max-width: 400px;
  }
}

/* Desktop and up (992px and above) - Override any mobile styles */
@media (min-width: 992px) {
  .nav-container {
    padding: 0 1.5rem;
  }

  .nav-logo {
    flex: 0 0 auto;
    margin-right: 1rem;
  }

  .nav-menu {
    flex: 1;
    display: flex !important;
    justify-content: flex-end;
  }

  .nav-list {
    display: flex;
    flex-direction: row;
    gap: 0.5rem;
  }

  .nav-item {
    border-bottom: none;
  }

  .nav-link {
    padding: 0.85rem 1rem;
    width: auto;
  }

  .hamburger {
    display: none !important;
  }

  /* Desktop Dropdown Behavior */
  .dropdown:hover .dropdown-menu {
    display: block;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: white;
    min-width: 220px;
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.1);
    border-top: 2px solid var(--primary-yellow);
    border-radius: 0 0 8px 8px;
    overflow: hidden;
  }

  .dropdown-menu li a {
    color: var(--text-dark);
    padding: 0.85rem 1.5rem;
  }

  .dropdown-menu li a:hover {
    background-color: #f5f5f5;
    padding-left: 1.8rem;
  }

  /* Desktop dropdown icon animation */
  .dropdown:hover .dropdown-icon.fa-solid {
    transform: rotate(180deg);
  }
}
