@import url("https://fonts.googleapis.com/css2?family=Great+Vibes:wght@400&family=Inter:wght@300;400;500;600&display=swap");

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* Add proper spacing for content below navbar */
body {
  padding-top: 80px;
}

@media (max-width: 768px) {
  body {
    padding-top: 70px;
  }
}

/* Navbar Container - Fixed horizontal scrollbar issue */
.navbar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  transition: all 0.6s cubic-bezier(0.4, 0, 0.2, 1);
  padding: 0;
  width: 100%;
  /* Ensure no overflow */
  max-width: 100vw;
}

.navbar.initial {
  background: linear-gradient(
    135deg,
    rgba(192, 192, 192, 0.95) 0%,
    rgba(169, 169, 169, 0.95) 25%,
    rgba(211, 211, 211, 0.95) 50%,
    rgba(192, 192, 192, 0.95) 75%,
    rgba(169, 169, 169, 0.95) 100%
  );
  backdrop-filter: blur(10px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 4px 32px rgba(0, 0, 0, 0.1);
}

/* FIXED: Prevent horizontal overflow */
.navbar.scrolled {
  background: rgba(128, 128, 128, 0.15);
  backdrop-filter: blur(20px);
  border-radius: 50px;
  /* Use padding instead of margin to prevent overflow */
  padding: 0 2.5%;
  /* Remove width constraint that causes issues */
  border: 1px solid rgba(255, 255, 255, 0.2);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.2);
  /* Add top margin without affecting width */
  top: 20px;
}

.navbar-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 2rem;
  transition: all 0.6s ease;
  width: 100%;
  /* Prevent any overflow */
  max-width: 100%;
}

.navbar.scrolled .navbar-container {
  padding: 0.75rem 2rem;
  /* Ensure container stays within bounds */
  max-width: calc(100vw - 5%);
  margin: 0 auto;
  border-radius: 50px;
}

/* Logo */
.logo {
  font-family: "Great Vibes", cursive;
  font-size: 2.5rem;
  color: #2d3748;
  text-decoration: none;
  font-weight: 400;
  transition: all 0.3s ease;
  text-shadow: 2px 2px 4px rgba(0, 0, 0, 0.1);
  white-space: nowrap;
  flex-shrink: 0;
}

.navbar.scrolled .logo {
  font-size: 1.8rem;
  color: #ffffff;
  text-shadow: 2px 2px 8px rgba(0, 0, 0, 0.3);
}

.logo:hover {
  transform: scale(1.05);
  text-shadow: 3px 3px 6px rgba(0, 0, 0, 0.2);
}

/* Desktop Navigation */
.nav-links {
  display: flex;
  list-style: none;
  gap: 2.5rem;
  align-items: center;
  flex-wrap: nowrap;
}

.nav-links li {
  position: relative;
  flex-shrink: 0;
}

.nav-links a {
  text-decoration: none;
  color: #2d3748;
  font-weight: 500;
  font-size: 1.1rem;
  padding: 0.6rem 1.2rem;
  border-radius: 25px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  overflow: hidden;
  white-space: nowrap;
  display: block;
}

.nav-links a.active {
  color: #1a202c !important;
  background: rgba(255, 255, 255, 0.3);
  font-weight: 600;
}

.navbar.scrolled .nav-links a {
  color: #ffffff;
}

.navbar.scrolled .nav-links a.active {
  color: #ffffff !important;
  background: rgba(255, 255, 255, 0.4);
}

.nav-links a::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.3), transparent);
  transition: left 0.6s ease;
  z-index: 0;
}

.nav-links a:hover::before {
  left: 100%;
}

.nav-links a:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.15);
}

.navbar.scrolled .nav-links a:hover {
  background: rgba(255, 255, 255, 0.25);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.3);
}

/* Mobile Menu Button */
.mobile-menu-btn {
  display: none;
  flex-direction: column;
  cursor: pointer;
  padding: 0.5rem;
  z-index: 1001;
  transition: all 0.3s ease;
  position: relative;
  flex-shrink: 0;
}

.hamburger-line {
  width: 25px;
  height: 3px;
  background: #2d3748;
  margin: 3px 0;
  transition: all 0.4s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  border-radius: 2px;
}

.navbar.scrolled .hamburger-line {
  background: #ffffff;
}

.mobile-menu-btn.active .hamburger-line:nth-child(1) {
  transform: rotate(45deg) translate(6px, 6px);
  background: #ffffff;
}

.mobile-menu-btn.active .hamburger-line:nth-child(2) {
  opacity: 0;
  transform: translateX(-20px);
}

.mobile-menu-btn.active .hamburger-line:nth-child(3) {
  transform: rotate(-45deg) translate(6px, -6px);
  background: #ffffff;
}

/* Mobile Menu Overlay */
.mobile-menu {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100vh;
  background: linear-gradient(
    135deg,
    rgba(45, 55, 72, 0.98) 0%,
    rgba(74, 85, 104, 0.98) 50%,
    rgba(45, 55, 72, 0.98) 100%
  );
  backdrop-filter: blur(20px);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  transform: translateX(-100%);
  transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
  z-index: 999;
  /* Prevent any overflow */
  overflow: hidden;
}

.mobile-menu.active {
  transform: translateX(0);
}

.mobile-menu-links {
  list-style: none;
  text-align: center;
}

.mobile-menu-links li {
  margin: 1.5rem 0;
  opacity: 0;
  transform: translateY(30px);
  transition: all 0.6s cubic-bezier(0.68, -0.55, 0.265, 1.55);
}

.mobile-menu.active .mobile-menu-links li {
  opacity: 1;
  transform: translateY(0);
}

.mobile-menu.active .mobile-menu-links li:nth-child(1) {
  transition-delay: 0.1s;
}
.mobile-menu.active .mobile-menu-links li:nth-child(2) {
  transition-delay: 0.2s;
}
.mobile-menu.active .mobile-menu-links li:nth-child(3) {
  transition-delay: 0.3s;
}
.mobile-menu.active .mobile-menu-links li:nth-child(4) {
  transition-delay: 0.4s;
}
.mobile-menu.active .mobile-menu-links li:nth-child(5) {
  transition-delay: 0.5s;
}
.mobile-menu.active .mobile-menu-links li:nth-child(6) {
  transition-delay: 0.6s;
}

.mobile-menu-links a {
  text-decoration: none;
  color: #ffffff;
  font-size: 2rem;
  font-weight: 300;
  padding: 1.5rem 3rem;
  display: block;
  border-radius: 15px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.mobile-menu-links a.active {
  color: #ffd700 !important;
  background: rgba(255, 255, 255, 0.2);
  font-weight: 500;
}

.mobile-menu-links a::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transition: left 0.6s ease;
  z-index: 0;
}

.mobile-menu-links a:hover::before {
  left: 100%;
}

.mobile-menu-links a:hover {
  background: rgba(255, 255, 255, 0.15);
  transform: scale(1.05);
  text-shadow: 0 0 20px rgba(255, 255, 255, 0.5);
}

/* Close Button - Enhanced for better functionality */
.close-btn {
  position: absolute;
  top: 2rem;
  right: 2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  color: #ffffff;
  font-size: 2rem;
  cursor: pointer;
  padding: 0.8rem;
  border-radius: 50%;
  transition: all 0.3s ease;
  width: 60px;
  height: 60px;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1002;
  line-height: 1;
  /* Ensure it's clickable */
  pointer-events: auto;
}

.close-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.5);
  transform: rotate(90deg) scale(1.1);
}

.close-btn:active {
  background: rgba(255, 255, 255, 0.35);
  transform: rotate(90deg) scale(0.95);
}

/* Responsive breakpoints - Fixed to prevent overflow */
@media (max-width: 1200px) {
  .nav-links {
    gap: 1.5rem;
  }

  .nav-links a {
    font-size: 1rem;
    padding: 0.5rem 1rem;
  }
  
  /* Adjust scrolled navbar for smaller screens */
  .navbar.scrolled {
    padding: 0 1.5%;
  }
}

@media (max-width: 900px) {
  .nav-links {
    display: none;
  }

  .mobile-menu-btn {
    display: flex;
  }
  
  /* Reset navbar styling for mobile */
  .navbar.scrolled {
    padding: 0;
    top: 10px;
  }
  
  .navbar.scrolled .navbar-container {
    margin: 0 2.5%;
    max-width: 95%;
  }
}

@media (max-width: 768px) {
  .navbar-container {
    padding: 1rem;
  }

  .logo {
    font-size: 2rem;
  }

  .navbar.scrolled .logo {
    font-size: 1.8rem;
  }
}

@media (max-width: 480px) {
  .mobile-menu-links a {
    font-size: 1.5rem;
    padding: 1rem 2rem;
  }

  .logo {
    font-size: 1.8rem;
  }

  .navbar.scrolled .logo {
    font-size: 1.6rem;
  }

  .navbar-container {
    padding: 0.8rem;
  }
  
  .navbar.scrolled .navbar-container {
    margin: 0 1%;
    max-width: 98%;
  }
}

@media (max-height: 600px) {
  .mobile-menu-links a {
    font-size: 1.3rem;
    padding: 0.8rem 2rem;
    margin: 0.5rem 0;
  }

  .close-btn {
    top: 1rem;
    right: 1rem;
    font-size: 1.8rem;
    width: 50px;
    height: 50px;
  }
}

@media (max-height: 500px) {
  .mobile-menu-links a {
    font-size: 1.1rem;
    padding: 0.6rem 1.5rem;
    margin: 0.3rem 0;
  }
}

/* Smooth Scrolling */
html {
  scroll-behavior: smooth;
}