/* ===========================================
   AlivioMind - Navigation Enhancements
   Active states, animations & effects
   =========================================== */

/* ===== Enhanced Navigation Links ===== */
.nav-link {
  position: relative;
  padding: var(--space-sm) var(--space-md);
  font-weight: 500;
  color: var(--text-secondary);
  transition: color 0.3s ease;
}

/* Animated Underline - Using ::after for clean implementation */
.nav-link::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 50%;
  width: 0;
  height: 2px;
  background: var(--primary-gradient);
  border-radius: var(--radius-full);
  transition:
    width 0.3s ease,
    left 0.3s ease;
}

/* Hover State - Expand from center */
.nav-link:hover {
  color: var(--primary);
}

.nav-link:hover::after {
  width: 70%;
  left: 15%;
}

/* Active State - Full underline */
.nav-link.active {
  color: var(--primary);
  font-weight: 600;
}

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

/* Subtle glow on hover for extra polish */
.nav-link:hover {
  text-shadow: 0 0 20px rgba(45, 140, 140, 0.3);
}

/* ===== Fixed Navigation CTA Button ===== */
.nav-cta {
  padding: var(--space-sm) var(--space-lg) !important;
  font-size: var(--text-xs) !important;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  white-space: nowrap;
}

/* Desktop CTA refinements */
@media (min-width: 992px) {
  .nav-cta {
    margin-left: var(--space-md);
  }
}

/* ===== Navigation Transition Feedback ===== */
.nav-link.navigating {
  pointer-events: none;
}

.nav-link.navigating::after {
  animation: navLoadingBar 1s ease infinite;
  width: 100%;
  left: 0;
}

@keyframes navLoadingBar {
  0% {
    transform: translateX(-100%);
  }
  50% {
    transform: translateX(0);
  }
  100% {
    transform: translateX(100%);
  }
}

/* ===== Mobile Navigation Enhancements ===== */
@media (max-width: 991px) {
  .nav {
    position: fixed;
    top: 0;
    right: 0;
    width: min(320px, 85vw);
    height: 100vh;
    height: 100dvh;
    background: var(--surface);
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: var(--space-3xl);
    transform: translateX(100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: -10px 0 40px rgba(0, 0, 0, 0.15);
    z-index: calc(var(--z-fixed) + 10);
  }

  .nav.active {
    transform: translateX(0);
  }

  .nav-list {
    flex-direction: column;
    gap: var(--space-sm);
    width: 100%;
    text-align: center;
  }

  .nav-link {
    font-size: var(--text-lg);
    padding: var(--space-md) var(--space-lg);
    border-radius: var(--radius-md);
    transition: all 0.3s ease;
    display: block;
    width: 100%;
  }

  .nav-link:hover,
  .nav-link.active {
    background: var(--bg-tertiary);
  }

  /* Hide bottom underline on mobile */
  .nav-link::after {
    display: none;
  }

  /* Left border indicator for active on mobile */
  .nav-link.active::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 4px;
    height: 60%;
    background: var(--primary-gradient);
    border-radius: var(--radius-full);
  }

  .nav-cta {
    width: 100%;
    margin-top: var(--space-lg);
    padding: var(--space-md) var(--space-xl) !important;
    font-size: var(--text-sm) !important;
  }
}

/* ===== Stagger Animation for Mobile Menu ===== */
.nav.active .nav-list li {
  animation: menuItemSlide 0.4s ease forwards;
  opacity: 0;
}

.nav.active .nav-list li:nth-child(1) {
  animation-delay: 0.05s;
}
.nav.active .nav-list li:nth-child(2) {
  animation-delay: 0.1s;
}
.nav.active .nav-list li:nth-child(3) {
  animation-delay: 0.15s;
}
.nav.active .nav-list li:nth-child(4) {
  animation-delay: 0.2s;
}
.nav.active .nav-list li:nth-child(5) {
  animation-delay: 0.25s;
}
.nav.active .nav-list li:nth-child(6) {
  animation-delay: 0.3s;
}
.nav.active .nav-list li:nth-child(7) {
  animation-delay: 0.35s;
}

@keyframes menuItemSlide {
  from {
    opacity: 0;
    transform: translateX(20px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

.nav.active .nav-cta {
  animation: menuItemSlide 0.4s ease 0.4s forwards;
  opacity: 0;
}
