/* src/components/Navbar/Navbar.css */

/* Common Navbar Styles */
.navbar {
  width: 100%;
  background-color: var(--navbar-bg);
  transition: background-color 0.3s ease, border-color 0.3s ease;
  border-bottom: 5px solid var(--card-border);
}

.cred {
  color: #3B9AF8;
}

.period {
  color: black;
}

.blue {
  color: #004F84;
}

.dark-mode .cred {
  color: #c7c7c7;
}

.dark-mode .period {
  color: #fff;
}

.dark-mode .blue {
  color: #3B9AF8;
}

.navbar-container {
  max-width: 1000px;
  margin: 0 auto; /* Center the content */
  padding: 0 20px; /* Horizontal padding */
  display: flex;
  align-items: center;
  justify-content: space-between; /* Distribute space between left and right sections */
  height: 84px;
  box-sizing: border-box;
}

/* Left Section: Logo and Links */
.navbar-left {
  display: flex;
  align-items: center;
}

.navbar-logo a {
  font-size: 1.5rem;
  font-weight: bold;
  color: #3B9AF8; /* Blue color for the logo */
  text-decoration: none;
  transition: color 0.3s ease;
}

.navbar-links {
  font-weight: bold;
  margin-top: 2px;
}

.navbar-links ul {
  list-style: none;
  display: flex;
  margin: 0;
  padding: 0;
  margin-left: 20px; /* Spacing between logo and links */
}

.navbar-links ul li {
  margin-left: 20px; /* Spacing between links */
}

.navbar-links ul li a {
  text-decoration: none;
  color: #004f84; /* Dark blue color for links */
  font-size: 1rem;
  transition: color 0.3s ease;
}

.navbar-links ul li {
  margin-left: 20px; /* Consistent spacing between all links */
  position: relative;
  display: flex;
  align-items: center;
}

.navbar-links ul li a:hover {
  color: #3B9AF8; /* Change color on hover */
}

/* Right Section: Actions */
.navbar-actions {
  display: flex;
  align-items: center;
  gap: 0.3em;
}

/* Theme toggle and icon styles */
.theme-toggle-button {
  background: none;
  border: none;
  cursor: pointer;
  display: inline-flex;
  scale: 1.3;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: #004f84;
  transition: color 0.2s ease;
  font-size: 1.6em;
}

.theme-toggle-button:hover {
  color: var(--primary-color);
  background: none;
}

.dark-mode .theme-toggle-button {
  color: #ffffff;
}

.theme-toggle-button svg {
  margin-right: 5px; /* Space between icon and text */
}

/* Icon styles */
.nav-icon {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: #004f84;
  transition: color 0.2s ease;
  scale: 1.3;
}

.dark-mode .nav-icon {
  color: #ffffff;
}

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

.nav-icon-discord {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0.5rem;
  color: #004f84;
  transition: color 0.2s ease;
  scale: 1.3;
}

.dark-mode .nav-icon-discord {
  color: #ffffff;
}

.nav-icon-discord:hover {
  color: var(--primary-color);
}

.icon {
  width: 1.25rem;
  height: 1.25rem;
}

/* Button styles */
.auth-button.login-button {
  padding: 7px 14px;
}

.logout-button {
  background-color: #dc3545; /* Red background */
  color: #ffffff; /* White text */
}

.logout-button:hover {
  background-color: #c82333; /* Darker red on hover */
}

.disabled-button {
  background-color: gray;
  color: white;
  cursor: not-allowed;
}

.dark-mode .navbar-logo a {
  color: #f5f5f5; /* Light color for logo */
}

.dark-mode .navbar-links ul li a {
  color: #f5f5f5; /* Light gray for links */
}

.dark-mode .navbar-links ul li a:hover {
  color: #66b2ff; /* Lighter blue on hover */
}

.dark-mode .auth-button {
  transition: background-color 0.3s ease, color 0.3s ease;
}

.dark-mode .login-button {
  background-color: #3B9AF8; /* Blue background */
  color: #f5f5f5; /* Light text */
}

.dark-mode .login-button:hover {
  background-color: #004F84; /* Darker blue on hover */
}

.dark-mode .logout-button {
  background-color: #ff6b6b; /* Light red background */
  color: #f5f5f5; /* Light text */
}

.dark-mode .logout-button:hover {
  background-color: #ff4c4c; /* Darker red on hover */
}

.navbar-logo {
  display: flex;
  align-content: center;
  justify-content: center;
  gap: 4px;
  margin-top: 3.5px;
}

.beta-badge {
  align-content: center;
  background: gray;
  border-radius: 4px;
  padding: 3px 5px;
  color: white;
  text-transform: uppercase;
  font-size: 0.6em;
  font-weight: 600;
  margin-bottom: 5.3px;
  margin-left: 4.9px;
}

.navbar-auth-button {
  display: none;
}

.navbar-support-button-container {
  font-size: 0.9em;
  margin-left: 10.2px;
}

/* ---------------------------------- */
/* Dropdown Menu Styles */
/* ---------------------------------- */
.dropdown-container {
  position: relative;
}

.dropdown-trigger {
  position: relative;
  display: inline-flex;
  align-items: center;
  white-space: nowrap;
  padding-right: 1.2em; /* Add padding to accommodate the triangle */
}

.dropdown-trigger::after {
  content: '▼';
  font-size: 0.6em;
  display: inline-block;
  margin-left: 0.4em;
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  transition: transform 0.2s ease;
}


.dropdown-container:hover .dropdown-trigger::after {
  transform: translateY(-50%) rotate(180deg);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  left: 0;
  background-color: var(--navbar-bg);
  border: 1px solid var(--card-border);
  border-radius: 4px;
  min-width: 180px;
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  padding: 8px 0;
  margin-top: 8px;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px);
  transition: opacity 0.2s ease, transform 0.2s ease, visibility 0.2s;
  display: flex;
  flex-direction: column; /* Ensure items are in a column */
}

.dropdown-container:hover .dropdown-menu {
  opacity: 1;
  visibility: visible;
  transform: translateY(0);
}

.dropdown-menu li {
  margin: 0 !important;
  padding: 0;
  display: block; /* Force items to be blocks in a column */
  width: 100%;
}

.dropdown-menu li a {
  display: block;
  padding: 8px 16px;
  color: var(--text);
  text-decoration: none;
  transition: background-color 0.2s ease;
  white-space: nowrap;
  width: 100%;
  box-sizing: border-box;
  text-align: left; /* Align text to the left */
}

.dropdown-menu {
  padding-top: 10px !important;
  padding-bottom: 10px !important;
}

.nav-icon-discord {
  align-items: center;
  color: #004f84;
  display: inline-flex;
  justify-content: center;
  padding: .5rem;
  scale: 1.7;
  padding-right: 10px;
  transition: color .2s ease;
}

/* Adjust hover state for dropdown items */
.dropdown-menu li a:hover {
  background-color: rgba(59, 154, 248, 0.1);
  color: #3B9AF8;
  width: 100%;
}

/* Ensure that non-dropdown links don't get affected by these changes */
.navbar-links ul li a:not(.dropdown-trigger) {
  display: inline-block;
}

/* Extra rule to ensure dropdown container doesn't affect layout */
.dropdown-container {
  position: relative;
}

/* Dark mode adjustments for dropdown */
.dark-mode .dropdown-menu {
  background-color: var(--navbar-bg);
  border-color: var(--card-border);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.3);
}

.dark-mode .dropdown-menu li a:hover {
  background-color: rgba(59, 154, 248, 0.2);
  color: #66b2ff;
}

/* ---------------------------------- */
/* Responsive Design Styles */
/* ---------------------------------- */
@media (max-width: 940px) {
  /* Navbar container adjustments */
  .navbar-container {
    flex-direction: column;
    align-items: center;
    height: auto;
    justify-content: center;
    row-gap: 23px;
    margin-top: 27px;
    margin-bottom: 27px;
    box-sizing: border-box;
    max-width: 1200px;
    padding: 0 20px;
  }
  
  /* Logo adjustments */
  .navbar-logo {
    text-align: center;
  }
  
  .navbar-logo a {
    font-size: 2.5em;
  }
  
  .beta-badge {
    font-size: 0.75em;
    font-weight: 600;
    margin: 11px;
    padding: 4px 7px;
    margin-right: 0px;
  }
  
  /* Left section adjustments */
  .navbar-left {
    align-items: center;
    display: block;
  }
  
  /* Links adjustments */
  .navbar-links {
    font-weight: 700;
    margin-top: 15px;
    text-align: center;
    width: 100%;
  }
  
  .navbar-links ul {
    display: flex;
    justify-content: center;
    flex-wrap: wrap;
    padding: 0;
    list-style: none;
    margin: 0px;
  }
  
  .navbar-links ul li {
    margin: 0 10px;
    position: relative;
  }
  
  /* Actions adjustments */
  .navbar-actions {
    align-items: center;
    display: flex;
    gap: 5px;
    justify-content: center;
  }
  
  .navbar-support-button-container {
    margin-left: 0px;
  }
  
  /* Dropdown adjustments for mobile */
  .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    display: none;
    box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
    min-width: 180px;
    width: auto;
    margin-top: 8px;
    margin-bottom: 8px;
    padding: 8px 0;
    background-color: var(--navbar-bg);
    border: 1px solid var(--card-border);
    border-radius: 4px;
    z-index: 1000;
    max-width: 90vw; /* Prevent extending beyond viewport */
  }
  
  /* Prevent dropdowns from going off-screen */
  .navbar-links ul li:last-child .dropdown-menu {
    left: auto;
    right: 0;
    transform: none;
  }
  
  .navbar-links ul li:first-child .dropdown-menu {
    left: 0;
    right: auto;
    transform: none;
  }
  
  .dropdown-container:hover .dropdown-menu,
  .dropdown-container.active .dropdown-menu {
    display: block;
    opacity: 1;
    visibility: visible;
  }
  
  /* Force menu items to be in a column */
  .dropdown-menu li {
    display: block;
    width: 100%;
    text-align: center;
    margin: 0 !important;
  }
  
  .dropdown-menu li a {
    padding: 8px 16px;
    text-align: center;
    display: block;
    white-space: nowrap;
  }
  
  .dropdown-trigger {
    display: inline-block;
    white-space: nowrap;
  }
  
  .dropdown-trigger::after {
    display: inline-block;
    margin-left: 5px;
    position: static;
    transform: none;
    vertical-align: middle;
  }
  
  .dropdown-container:hover .dropdown-trigger::after,
  .dropdown-container.active .dropdown-trigger::after {
    transform: rotate(180deg);
  }
  
  /* Prevent layout shifting */
  .dropdown-container {
    margin-bottom: 4px;
    min-height: 32px;
  }
}

@media (max-width: 940px) {
  .dropdown-trigger {
    padding-right: 0em;
  }
  
  .dropdown-trigger::after {
    right: 0;
  }
  
  /* Ensure all links in mobile have consistent appearance */
  .navbar-links ul li a {
    text-align: center;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
}

/* Smaller screen refinements */
@media (max-width: 450px) {
  .navbar-links {
    max-width: 300px;
    line-height: 1.8em;
  }
}

@media (max-width: 370px) {
  .navbar-support-button {
    max-width: 135.5px;
    font-size: 0.8em;
    margin-left: 0px;
  }
  
  .navbar-links {
    font-weight: 700;
    text-align: center;
    max-width: 205.5px;
    margin: auto;
    margin-top: 15px;
    line-height: 1.5em;
  }
  
  /* Dropdown positioning for very small screens */
  .dropdown-menu {
    position: fixed;
    left: 50% !important;
    transform: translateX(-50%) !important;
    width: 90vw;
    max-width: 90vw;
  }
}