/* Responsive Navbar Styles */

/* Hamburger Menu */
.hamburger-menu {
  display: none;
  cursor: pointer;
  z-index: 1001;
  width: 30px;
  height: 30px;
  padding: 5px;
  box-sizing: content-box;
}

.bar1, .bar2, .bar3 {
  width: 30px;
  height: 3px;
  background-color: var(--text-color);
  margin: 6px 0;
  transition: 0.4s;
  border-radius: 2px;
}

/* Transformed hamburger menu (X shape) */
.hamburger-menu.active .bar1 {
  transform: rotate(-45deg) translate(-5px, 6px);
  background-color: var(--primary-color);
}

.hamburger-menu.active .bar2 {
  opacity: 0;
}

.hamburger-menu.active .bar3 {
  transform: rotate(45deg) translate(-5px, -6px);
  background-color: var(--primary-color);
}

/* First, ensure proper desktop layout above 768px */
@media screen and (min-width: 769px) {
  .hamburger-menu {
    display: none;
  }
  
  .navbar .container {
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  
  .nav-links {
    position: static !important; /* Override any fixed positioning */
    width: auto !important;
    height: auto !important;
    padding: 0 !important;
    background-color: transparent !important;
    box-shadow: none !important;
    overflow: visible !important;
    display: flex !important;
    flex-direction: row !important;
    justify-content: center !important;
    flex: 1 !important;
  }
  
  .nav-links ul {
    display: flex !important;
    flex-direction: row !important;
    gap: 35px !important;
  }
}

/* Media query for screens smaller than 768px */
@media screen and (max-width: 768px) {
  .hamburger-menu {
    display: block;
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
  }
  
  .navbar .container {
    position: relative; /* For absolute positioning context */
    height: 70px; /* Maintain height in mobile */
  }
  
  .logo-container {
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
  }
  
  /* Mobile navigation styles */
  .nav-links {
    position: fixed;
    left: -300px; /* Start off-screen */
    top: 0;
    width: 280px;
    height: 100vh;
    background-color: var(--background-color);
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    transition: left 0.3s ease;
    z-index: 1000;
    padding: 80px 0 80px 0; /* Add bottom padding for the button */
    overflow-y: auto;
    display: flex;
    flex-direction: column;
  }
  
  .nav-links ul {
    display: flex;
    flex-direction: column;
    gap: 20px;
    padding: 20px;
  }
  
  @media screen and (max-width: 768px) {
    /* Position the main navbar button (not the mobile menu one) */
    .join-button:not(.mobile-join-button) {
      position: absolute;
      right: 70px;
      top: 50%;
      transform: translateY(-50%);
    }
    
    /* Mobile menu join button positioning */
    .mobile-join-button {
      position: absolute;
      bottom: 50px;
      left: 0;
      width: 100%;
      padding: 0 20px;
      box-sizing: border-box;
    }
  }
  
  .nav-links.active {
    left: 0; /* Slide in when active */
  }
  
  .nav-links ul {
    flex-direction: column;
    gap: 20px;
    padding: 20px;
  }
  
  /* Join button positioning at tablet size */
  .join-button {
    position: absolute;
    right: 60px; /* Position to the left of hamburger */
    top: 15px;
    margin: 0;
    z-index: 900;
  }
  
  /* Mobile join button styling */
  .navbar .container .join-button a {
    font-size: 14px;
    padding: 6px 12px;
  }
  
  /* Add mobile navigation join button */
  .nav-links .mobile-join-button {
    display: none !important; /* Hidden by default */
    position: absolute;
    bottom: 30px;
    left: 0;
    width: 100%;
    padding: 0 20px;
    box-sizing: border-box;
  }
  
  /* Only show when menu is active */
  .nav-links.active .mobile-join-button {
    display: block !important;
  }
  
  .nav-links .mobile-join-button a {
    display: flex;
    width: 100%;
    text-align: center;
    padding: 10px 20px;
    font-size: 15px;
    font-weight: 500;
    justify-content: center;
    align-items: center;
    height: 40px;
    background-color: var(--primary-color);
    color: var(--light-text);
    border-radius: 50px;
    box-sizing: border-box;
  }
}

/* Overlay when mobile menu is open */
.menu-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

.menu-overlay.active {
  display: block;
}

/* Force display for debugging */
#mobile-menu.active {
  left: 0 !important;
  display: block !important;
}

/* Additional mobile styling for the button */
.mobile-join-button {
  display: none !important; /* Hide on desktop */
}

@media screen and (max-width: 768px) {
  /* Only show the mobile join button when the mobile menu is active AND we're at small screens */
  .nav-links.active .mobile-join-button {
    display: none !important; /* Keep hidden at 768px */
  }
  
  #hamburger-menu {
    display: block;
  }
  
  /* Ensure navigation links are hidden in mobile until activated */
  .nav-links:not(.active) {
    left: -300px;
  }
}

/* Hide navbar button below 425px */
@media screen and (max-width: 425px) {
  .navbar .container .join-button:not(.mobile-join-button) {
    display: none !important;
  }
  
  /* Adjust hamburger position for smaller screens */
  .hamburger-menu {
    right: 15px;
  }
  
  /* Only show the mobile join button in small screens */
  .nav-links.active .mobile-join-button {
    display: block !important;
  }
}

/* Specific fixes for button at 768px */
@media screen and (max-width: 768px) {
  /* Make sure mobile join button is hidden until menu is active */
  .nav-links .mobile-join-button {
    display: none !important;
  }
  
  .nav-links.active .mobile-join-button {
    display: block !important;
  }
}