/* Navigation */
nav {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 1000;
  display: flex;
  align-items: center;
  gap: 20px;
  background: rgba(255, 255, 255, 0.95);
  padding: 15px 25px;
  border-radius: 50px;
  backdrop-filter: blur(10px);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

nav a {
  color: #64748b;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 25px;
  transition: all 0.3s ease;
  position: relative;
}
nav a:hover,
nav a.active {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.nav-links {
  display: flex;
  gap: 20px;
}

.hamburger {
  display: none;
  font-size: 1.5rem;
  cursor: pointer;
  color: #64748b;
  padding: 10px;
  border-radius: 8px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  z-index: 1001;
  opacity: 1;
  visibility: visible;
}

.hamburger.active {
  opacity: 0;
  visibility: hidden;
}

.hamburger:hover {
  color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
  transform: scale(1.05);
}

.hamburger:active {
  transform: scale(0.95);
}

.hamburger i {
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.hamburger.active i {
  transform: rotate(90deg);
}

/* Mobile Overlay */
.mobile-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.mobile-overlay.active {
  opacity: 1;
  visibility: visible;
}
/* Hide mobile close button on desktop */
.mobile-close-btn {
  display: none !important;
}

/* Inside your mobile media query, override it */
@media (max-width: 768px) {
  .mobile-close-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 2;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: none; /* Still hidden by default on mobile */
  }

  /* Only show when mobile menu is active */
  .nav-links.active .mobile-close-btn {
    display: block !important;
  }
}
/* Mobile view */
@media (max-width: 768px) {
  nav {
    top: 20px;
    left: 20px;
    right: auto;
    padding: 15px 20px;
    border-radius: 25px;
    justify-content: flex-start;
  }

  .nav-links {
    position: fixed;
    top: 0;
    left: 0;
    height: 100vh;
    width: 280px;
    background: linear-gradient(
      135deg,
      rgba(255, 255, 255, 0.98) 0%,
      rgba(248, 250, 252, 0.98) 100%
    );
    padding: 100px 30px 50px 30px;
    backdrop-filter: blur(20px);
    border-right: 1px solid rgba(59, 130, 246, 0.1);
    box-shadow: 4px 0 20px rgba(0, 0, 0, 0.15);
    flex-direction: column;
    gap: 10px;
    z-index: 1000;

    /* Hide menu completely off-screen */
    transform: translateX(-100%);
    transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);

    /* Ensure it's completely hidden */
    left: -280px;
  }

  .nav-links.active {
    transform: translateX(280px);
  }

  .nav-links::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0;
  }

  .nav-links::after {
    content: "Navigation";
    position: absolute;
    top: 30px;
    left: 30px;
    color: white;
    font-size: 1.2rem;
    font-weight: 600;
    z-index: 1;
  }

  /* Close button inside mobile menu */
  .nav-links::before {
    content: "";
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 80px;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 0;
  }

  .mobile-close-btn {
    position: absolute;
    top: 30px;
    right: 30px;
    color: white;
    font-size: 1.2rem;
    cursor: pointer;
    z-index: 2;
    padding: 8px;
    border-radius: 50%;
    transition: all 0.3s ease;
    display: none;
  }
  /* Only show when mobile menu is active */
  .nav-links.active .mobile-close-btn {
    display: block;
  }

  .mobile-close-btn:hover {
    background: rgba(255, 255, 255, 0.2);
    transform: scale(1.1);
  }
  .nav-links a {
    padding: 18px 20px;
    text-align: left;
    border-radius: 15px;
    margin-bottom: 8px;
    font-weight: 500;
    color: #1e293b;
    text-decoration: none;
    display: block;
    position: relative;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    transform: translateX(-20px);
    opacity: 0;
    font-size: 1.1rem;
  }

  .nav-links.active a {
    transform: translateX(0);
    opacity: 1;
  }

  /* Staggered animation for menu items */
  .nav-links.active a:nth-child(1) {
    transition-delay: 0.1s;
  }
  .nav-links.active a:nth-child(2) {
    transition-delay: 0.15s;
  }
  .nav-links.active a:nth-child(3) {
    transition-delay: 0.2s;
  }
  .nav-links.active a:nth-child(4) {
    transition-delay: 0.25s;
  }
  .nav-links.active a:nth-child(5) {
    transition-delay: 0.3s;
  }

  .nav-links a:hover,
  .nav-links a.active {
    background: rgba(59, 130, 246, 0.1);
    color: #3b82f6;
    transform: translateX(10px);
    box-shadow: 0 4px 15px rgba(59, 130, 246, 0.2);
  }

  .nav-links a::before {
    content: "";
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 3px;
    height: 0;
    background: #3b82f6;
    border-radius: 2px;
    transition: height 0.3s ease;
  }

  .nav-links a:hover::before,
  .nav-links a.active::before {
    height: 100%;
  }

  .hamburger {
    display: block;
    order: -1;
    z-index: 1001;
  }
}
