/* ==========================================================================
   MAIN NAVIGATION CONTAINER (.app-nav)
   ========================================================================== */

.app-nav {
  background-color: var(--color-secondary-bg);
  width: 100%;
  height: var(--nav-height);
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--border-color);
  box-shadow: var(--nav-bg-shadow);
  padding: 0;
  position: fixed;
  top: 0;
  left: 0;
  z-index: 1000;
  transition: height 0.3s ease;
}

.nav-container {
  display: flex;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
  gap: 1rem;
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  box-sizing: border-box;
}

/* --- Logo --- */
.nav-logo {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.nav-logo a {
  text-decoration: none;
}

.logo-image {
  width: 85px;
  height: auto;
  transition: width 0.3s ease;
}

/* --- Navigation Links Wrapper --- */
.nav-links {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-shrink: 1;
}

/* ==========================================================================
   NAV ITEMS & LINKS
   ========================================================================== */

.nav-item,
.nav-item.nav-button,
.nav-item-child {
  color: var(--color-primary);
  text-decoration: none;
  font-weight: bold;
  font-size: 17px;
  font-family: var(--font-main);
  letter-spacing: 0.5px;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  transition: color 0.3s ease;
}

/* Font sizing responsive adjustments */
.navbar-nav .nav-item-child {
  font-weight: bold !important;
  font-size: clamp(1.1em, 2vw, 1.5em);
}

.nav-item:hover,
.nav-item.nav-button:hover,
.nav-item-child:hover,
.nav-dropdown-link:hover {
  /* Added support for JS active state */
  color: var(--color-primary-dark);
  text-decoration: none;
}

/* ==========================================================================
   DROPDOWN MENU
   ========================================================================== */

.nav-dropdown {
  position: relative;
  display: inline-block;
}

.nav-dropdown-menu {
  display: block;
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
  position: absolute;
  left: 0;
  top: 100%;
  min-width: 240px;
  background: var(--bg-white);
  box-shadow: var(--nav-shadow);
  border-radius: var(--border-radius-md);
  z-index: 1001;
  padding: 0.5em 0;
  transform: translateY(10px);
  transition: opacity 0.25s cubic-bezier(.4, 0, .2, 1),
    transform 0.25s cubic-bezier(.4, 0, .2, 1),
    visibility 0.25s;
}

/* Desktop Hover/Focus Logic */
.nav-dropdown:hover .nav-dropdown-menu,
.nav-dropdown:focus-within .nav-dropdown-menu {
  opacity: 1;
  visibility: visible;
  pointer-events: auto;
  transform: translateY(0);
}

.nav-dropdown-link {
  display: block;
  padding: 0.7em 1.5em;
  color: var(--color-primary);
  text-decoration: none;
  font-weight: bold;
  border: none;
  background: none;
  white-space: nowrap;
  transition: background 0.2s, color 0.2s;
}

/* ==========================================================================
   HAMBURGER TOGGLE
   ========================================================================== */

.navbar-toggle {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 10px;
  position: relative;
  z-index: 1002;
  /* Higher than dropdowns */
  margin-left: auto;
  display: none;
  /* Hidden by default on desktop */
}

.navbar-toggle .toggle-icon {
  display: block;
  width: 25px;
  height: 3px;
  background-color: var(--color-primary);
  position: relative;
  transition: all 0.3s ease-in-out;
}

.navbar-toggle .toggle-icon::before,
.navbar-toggle .toggle-icon::after {
  content: '';
  position: absolute;
  width: 25px;
  height: 3px;
  background-color: var(--color-primary);
  transition: all 0.3s ease-in-out;
}

.navbar-toggle .toggle-icon::before {
  top: -8px;
}

.navbar-toggle .toggle-icon::after {
  top: 8px;
}

/* Active (Open) State for the Icon Animation */
.navbar-toggle.open .toggle-icon {
  background-color: transparent;
}

.navbar-toggle.open .toggle-icon::before {
  top: 0;
  transform: rotate(45deg);
}

.navbar-toggle.open .toggle-icon::after {
  top: 0;
  transform: rotate(-45deg);
}

/* ==========================================================================
   MEDIA QUERIES & RESPONSIVENESS
   ========================================================================== */

/* Large Screens */
@media (min-width: 1215px) {

  .nav-item-child,
  .nav-dropdown-link {
    font-size: 22px !important;
  }
}

@media (min-width: 1540px) {
  .nav-logo {
    margin-right: 4rem;
  }

  .logo-image {
    width: 90px;
  }

  .nav-item-child,
  .nav-dropdown-link {
    font-size: 28px !important;
  }
}

/* Prevent background color on smaller screens */
@media (min-width: 941px) {

  .nav-dropdown-link:hover,
  .nav-dropdown-link:focus {
    background: var(--color-secondary-bg);
    color: var(--color-primary-dark);
  }
}

/* Tablet & Mobile Breakpoint (Combined Logic) */
@media (max-width: 990px) {
  .app-nav {
    padding: 0.5rem 0;
    height: auto;
    min-height: 5rem;
  }

  .navbar-toggle {
    display: block;
  }

  /* --- Mobile Navigation Links --- */
  .nav-links {
    display: none;
    /* Hidden by default */
    flex-direction: column;
    align-items: center;
    text-align: center;
    position: absolute;
    top: 100%;
    left: 0;
    width: 100%;
    background-color: var(--color-secondary-bg);
    padding: 1rem 0;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    z-index: 9;
  }

  .nav-links.open {
    display: flex;
  }

  .nav-item-child {
    font-size: 18px !important;
  }

  /* --- Mobile Dropdown Logic --- */
  .nav-dropdown {
    width: 100%;
    display: flex;
    flex-direction: column;
    align-items: center;
  }

  /* 1. Hide parent 'INFO' link (flattening the menu) */
  .nav-dropdown>.nav-item-child {
    display: none;
  }

  /* Force dropdown content to be visible on mobile */
  .nav-dropdown-menu {
    display: block !important;
    opacity: 1 !important;
    visibility: visible !important;
    position: static !important;
    min-width: 0 !important;
    box-shadow: none !important;
    border-radius: 0 !important;
    background: transparent !important;
    padding: 0;
    pointer-events: auto !important;
    transform: none !important;
    transition: none !important;
    margin: 0;
    width: 100%;
  }

  /* Dropdown links styling */
  .nav-dropdown-link {
    display: block;
    padding: 1rem 0 0 0;
    color: var(--color-primary);
    font-size: 18px !important;
    width: 100%;
    text-align: center;
    margin: 0;
  }

  /* 2. Remove padding from the first link (WELCOME) to align it */
  .nav-dropdown-link:first-child {
    padding-top: 0;
  }

  /* Disable desktop hover effects on mobile */
  .nav-dropdown:hover .nav-dropdown-menu,
  .nav-dropdown:focus-within .nav-dropdown-menu {
    transform: none !important;
  }
}

/* Small adjustments for very small screens or tablets */
@media (max-width: 1000px) {
  .logo-image {
    width: 75px;
  }
}

@media (max-width: 347px) {
  .nav-container {
    gap: 0;
  }
}