/* Modern Floating Navbar Styling - Premium Look */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap');

:root {
  --navbar-height: 70px;
  --navbar-margin-top: 20px; /* Space from top for floating effect */
  --navbar-width: 94%; /* Width constraint for floating effect */
  --navbar-max-width: 1500px;
  --navbar-background: rgba(255, 255, 255, 0.75); /* More translucent background */
  --navbar-background-dark: rgba(255, 255, 255, 0.75);
  --navbar-background-scrolled: rgba(255, 255, 255, 0.9); /* More translucent when scrolled */
  --navbar-background-dark-scrolled: rgba(255, 255, 255, 0.9);
  --navbar-shadow: 0 8px 32px rgba(0, 0, 0, 0.06);
  --navbar-shadow-dark: 0 8px 32px rgba(0, 0, 0, 0.1);
  --navbar-border: rgba(0, 102, 204, 0.15); /* Light blue border color */
  --navbar-border-dark: rgba(0, 102, 204, 0.2);
  --navbar-text: #1a2b3c;
  --navbar-text-dark: #1a2b3c;
  --primary-color: #0066cc;
  --primary-color-dark: #0066cc;
  --accent-gradient: linear-gradient(135deg, #0066cc, #00a3ff);
  --navbar-border-radius: 16px;
}

/* Fixed container for floating navbar */
#navbar-container {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 1000;
  box-sizing: border-box;
  max-width: 100vw; /* Prevent overflow */
  display: flex;
  justify-content: center;
  padding-top: var(--navbar-margin-top);
  transition: padding-top 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

.modern-navbar {
  position: fixed;
  top: var(--navbar-margin-top);
  left: 50%;
  transform: translateX(-50%) translateY(-10px);
  opacity: 0;
  width: var(--navbar-width);
  max-width: var(--navbar-max-width);
  height: var(--navbar-height);
  z-index: 1000;
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  transition: all 0.6s cubic-bezier(0.16, 1, 0.3, 1);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  background: var(--navbar-background);
  box-shadow: var(--navbar-shadow);
  border-radius: var(--navbar-border-radius);
  border: 1px solid var(--navbar-border); /* Updated border with variable */
  box-sizing: border-box;
}

.navbar-container {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0 auto;
  padding: 0 2rem;
  height: 100%;
}

.modern-navbar.scrolled {
  top: 10px;
  height: 60px;
  background: var(--navbar-background-scrolled);
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  border-radius: calc(var(--navbar-border-radius) + 2px);
  border: 1.5px solid var(--navbar-border); /* Slightly more visible border when scrolled */
}

#navbar-container.scrolled {
  padding-top: 10px;
}

/* Navbar Sections */
.nav-section {
  display: flex;
  align-items: center;
  height: 100%;
}

.nav-left {
  flex: 1;
  min-width: 0; /* Prevent overflow */
}

.nav-middle {
  flex: 3;
  justify-content: center;
}

.nav-right {
  flex: 1;
  justify-content: flex-end;
  gap: 12px;
  min-width: 0; /* Prevent overflow */
}

/* Brand/Logo */
.nav-brand {
  display: flex;
  align-items: center;
  text-decoration: none;
  color: var(--navbar-text);
  transition: all 0.3s ease;
  white-space: nowrap; /* Prevent wrapping */
}

.nav-brand:hover {
  transform: translateY(-1px);
}

.nav-logo-img {
  height: 36px;
  width: auto;
  transition: all 0.3s ease;
}

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

.nav-brand-text {
  font-weight: 700;
  font-size: 1.35rem;
  margin-left: 0.4rem;
  background: linear-gradient(135deg, #1a2b3c, #506580);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  letter-spacing: -0.01em;
  white-space: nowrap; /* Prevent wrapping */
}

.nav-brand-text .accent {
  background: linear-gradient(135deg, #0066cc, #00a3ff);
  background-clip: text;
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
}

/* Navigation Links - Modern Styling */
.nav-links {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0.6rem;
  margin: 0;
  padding: 0;
}

.nav-link {
  position: relative;
  color: var(--navbar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0.9rem;
  border-radius: 10px;
  display: flex;
  align-items: center;
  gap: 8px;
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  white-space: nowrap; /* Prevent wrapping */
  position: relative;
  z-index: 1;
  overflow: hidden;
}

.nav-link::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 102, 204, 0.08);
  border-radius: 10px;
  opacity: 0;
  transform: translateY(5px) scale(0.95);
  transition: all 0.3s cubic-bezier(0.25, 0.8, 0.25, 1);
  z-index: -1;
}

.nav-link:hover {
  color: var(--primary-color);
  transform: translateY(-2px);
}

.nav-link:hover::before {
  opacity: 1;
  transform: translateY(0) scale(1);
}

/* Enhanced specificity for active class to ensure it's not overridden */
.nav-link.active,
.nav-links .nav-link.active,
.nav-middle .nav-link.active,
.modern-navbar .nav-link.active {
  color: white !important;
  font-weight: 600;
  background: rgba(0, 102, 204, 0.15) !important;
  border-radius: 10px;
}

.nav-link.active::before,
.nav-links .nav-link.active::before,
.nav-middle .nav-link.active::before {
  background: var(--accent-gradient) !important;
  opacity: 1 !important;
  transform: translateY(0) scale(1) !important;
}

/* Force active tab to maintain its background color */
.nav-link.active:hover::before {
  background: var(--accent-gradient) !important;
}

/* Also ensure mobile nav active styles */
.mobile-nav-link.active {
  background: rgba(0, 102, 204, 0.15) !important;
  color: var(--primary-color) !important;
  font-weight: 600 !important;
}

/* Authentication Buttons */
.nav-button {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 0.55rem 1.1rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.25s ease;
  white-space: nowrap; /* Prevent wrapping */
}

.login-button {
  color: var(--navbar-text);
  background: rgba(0, 102, 204, 0.05);
  border: 1px solid rgba(0, 102, 204, 0.15);
}

.login-button:hover {
  background: rgba(0, 102, 204, 0.1);
  transform: translateY(-2px);
}

.signup-button {
  color: white;
  background: var(--accent-gradient);
  box-shadow: 0 4px 12px rgba(0, 102, 204, 0.2);
}

.signup-button:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(0, 102, 204, 0.3);
}

/* Contact Us Button Styling - Modern & Premium */
.contact-button {
  color: white;
  background: var(--accent-gradient);
  box-shadow: 0 6px 15px rgba(0, 102, 204, 0.2);
  border-radius: 12px;
  padding: 0.65rem 1.4rem;
  font-weight: 600;
  letter-spacing: 0.01em;
  position: relative;
  overflow: hidden;
  transition: all 0.4s cubic-bezier(0.25, 0.8, 0.25, 1);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.contact-button::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: linear-gradient(135deg, rgba(255,255,255,0.2), rgba(255,255,255,0));
  opacity: 0;
  transition: opacity 0.4s ease;
}

.contact-button:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 10px 25px rgba(0, 102, 204, 0.35);
}

.contact-button:hover::after {
  opacity: 1;
}

/* Ensure contact button text stays white on hover */
.contact-button:hover,
.contact-button:hover span,
.nav-right .contact-button:hover span,
.nav-button.contact-button:hover {
  color: white !important;
}

/* Mobile Menu Toggle Button - Modern Animated */
.menu-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  height: 20px;
  width: 30px;
  cursor: pointer;
  z-index: 1010;
  margin-left: 15px;
  position: relative;
  padding: 8px;
  background: rgba(0, 102, 204, 0.05);
  border-radius: 8px;
}

.menu-toggle span {
  height: 2px;
  width: 100%;
  background: var(--accent-gradient);
  border-radius: 4px;
  transition: all 0.4s cubic-bezier(0.68, -0.6, 0.32, 1.6);
}

.menu-toggle.active span:nth-child(1) {
  transform: translateY(8px) rotate(45deg);
  width: 100%;
}

.menu-toggle.active span:nth-child(2) {
  opacity: 0;
  transform: translateX(-10px);
}

.menu-toggle.active span:nth-child(3) {
  transform: translateY(-8px) rotate(-45deg);
  width: 100%;
}

/* Mobile Menu - Modern Floating Design */
.mobile-menu {
  position: fixed;
  top: calc(var(--navbar-height) + var(--navbar-margin-top) + 10px);
  left: 50%;
  transform: translateX(-50%) translateY(-110%);
  width: 90%;
  max-width: 400px;
  max-height: 85vh;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  padding: 2rem 1.5rem;
  z-index: 999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.5s cubic-bezier(0.19, 1, 0.22, 1);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
  border-radius: 16px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(255, 255, 255, 0.2);
}

.scrolled .mobile-menu {
  top: calc(var(--navbar-height) + 10px);
}

.mobile-menu.active {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 0.8rem;
}

.mobile-nav-link {
  display: flex;
  align-items: center;
  gap: 12px;
  color: var(--navbar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 1.1rem;
  padding: 1rem 0.8rem;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.mobile-nav-link:hover, 
.mobile-nav-link.active {
  background: rgba(0, 102, 204, 0.08);
  color: #0066cc;
  transform: translateX(5px);
}

.mobile-auth-buttons {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 2rem;
}

.mobile-button {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 1rem;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  text-decoration: none;
  transition: all 0.3s ease;
}

.mobile-login {
  background: rgba(0, 102, 204, 0.05);
  border: 1px solid rgba(0, 102, 204, 0.15);
  color: #1a2b3c;
}

.mobile-signup {
  background: var(--accent-gradient);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 102, 204, 0.2);
}

/* Add consistent body spacing for floating navbar */
body {
  padding-top: calc(var(--navbar-height) + var(--navbar-margin-top));
}

.nav-link-text {
  font-size: 1rem;
  font-weight: 500;
  color: var(--navbar-text);
  transition: all 0.3s ease;
  letter-spacing: 0.01em;
}

/* Active link and hover styles */
.nav-link.active .nav-link-text,
.nav-link.active .nav-link-icon {
  color: white;
  font-weight: 600;
}

.nav-link:hover .nav-link-text,
.nav-link:hover .nav-link-icon {
  color: var(--primary-color);
}

/* Make sure active styles have higher specificity */
.nav-middle .nav-link.active,
.nav-links .nav-link.active {
  background: rgba(0, 102, 204, 0.12);
  color: var(--primary-color);
}

/* NEW: Ensure active links keep white text on hover */
.nav-link.active:hover .nav-link-text,
.nav-link.active:hover .nav-link-icon,
.nav-links .nav-link.active:hover .nav-link-text,
.nav-middle .nav-link.active:hover .nav-link-text {
  color: white !important;
}

/* Responsive Styles for Floating Navbar */
@media (max-width: 1024px) {
  :root {
    --navbar-width: 96%; /* Wider on smaller screens */
    --navbar-margin-top: 15px; /* Slightly closer to top */
  }
  
  .nav-link {
    padding: 0.5rem 0.8rem;
  }
  
  .nav-link-text {
    font-size: 0.95rem;
  }

  /* Active styles for tablet */
  .nav-link.active::before {
    background: var(--accent-gradient);
  }

  /* Navbar border should be a bit more prominent on smaller screens */
  .modern-navbar {
    border: 1px solid rgba(0, 102, 204, 0.2);
  }
}

@media (max-width: 768px) {
  :root {
    --navbar-width: 94%; /* Slightly wider on mobile */
    --navbar-margin-top: 12px; /* Closer to top on mobile */
  }

  .nav-middle,
  .nav-right {
    display: none;
  }
  
  .menu-toggle {
    display: flex;
  }
  
  .navbar-container {
    padding: 0 1.2rem;
    justify-content: space-between;
    width: 100%;
  }
  
  .nav-left {
    flex: 1;
  }
}

@media (max-width: 576px) {
  :root {
    --navbar-height: 64px;
  }
  
  .modern-navbar {
    height: 64px;
  }
  
  .nav-logo-img {
    height: 32px;
  }
  
  .nav-brand-text {
    font-size: 1.2rem;
  }
  
  .mobile-menu {
    top: 64px;
    height: calc(100vh - 64px);
  }
  
  body {
    padding-top: 64px;
  }
  
  #navbar-container {
    overflow: hidden;
  }
}