.navbar {
  position: sticky;
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 0;
  padding: 8px 20px;
  background: linear-gradient(
    135deg,
    rgba(20, 25, 40, 0.98),
    rgba(35, 40, 65, 0.95)
  );
  backdrop-filter: blur(15px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  position: relative;
}

.navbar::after {
  content: "";
  position: absolute;
  bottom: -2px;
  left: 0;
  right: 0;
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.1),
    transparent
  );
}

.navbar > .title {
  display: flex !important;
  align-items: center !important;
  text-decoration: none !important;
  color: white !important;
  transition: transform 0.2s ease;
  padding: 8px 0 !important;
  margin-right: 20px !important;
}

.navbar > .title:hover {
  transform: translateY(-1px);
}

.navbar > .title > img {
  width: 32px !important;
  height: 32px !important;
  border-radius: 6px !important;
  margin-left: 12px !important;
  object-fit: contain !important;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.2) !important;
  transition: all 0.3s ease;
  flex-shrink: 0 !important;
  vertical-align: middle !important;
}

.navbar > .title > img:hover {
  box-shadow: 0 3px 12px rgba(0, 0, 0, 0.3);
  transform: scale(1.03);
}

.navbar > .title > span {
  font-family: "Arial", sans-serif !important;
  font-size: 20px !important;
  font-weight: 600 !important;
  color: #e74c3c !important;
  margin: 0 !important;
  text-shadow: 0 1px 2px rgba(0, 0, 0, 0.3) !important;
  letter-spacing: 0.3px !important;
  line-height: 1.2 !important;
  margin-right: 10px !important;
  order: -1 !important;
  text-decoration: none !important;
  display: inline-flex !important;
  align-items: center !important;
  vertical-align: middle !important;
  position: relative !important;
  top: 0 !important;
}

.navbar > .end {
  display: flex;
  justify-content: space-between;
}

.navbar > .end > a {
  border-style: solid;
  border-width: 0.5vh;
  margin: 0.3rem;
  padding: 0.8rem;
  cursor: pointer;
  font-size: 2.7vh;
  border-radius: 2vh;
  border-color: rgba(0, 0, 0, 0);
  transition: border-color 0.4s linear;
}

.navbar > .end > a:hover {
  border-color: rgba(255, 255, 255, 1);
}

#greeting {
  font-size: 1.2rem;
  color: #ffd700;
  margin-left: 15px;
}

/* Mobile Menu Styles */
.mobile-menu-toggle {
  display: none;
  font-size: 3.5vh;
  cursor: pointer;
  margin-right: 10px;
  z-index: 1001;
}

.mobile-menu {
  display: none;
  position: fixed;
  top: 0;
  right: 0;
  width: 80%;
  height: 100%;
  background-color: var(--sidebar-bg);
  z-index: 1000;
  overflow-y: auto;
  transform: translateX(100%);
  transition: transform 0.3s ease-in-out;
  box-shadow: -5px 0 15px rgba(0, 0, 0, 0.5);
  padding-top: 60px;
  text-align: center;
}

.mobile-menu.active {
  transform: translateX(0);
}

.mobile-menu a {
  display: block;
  padding: 15px;
  font-size: 2.5vh;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu a i {
  margin-left: 10px;
}

.close-menu {
  position: absolute;
  top: 15px;
  right: 15px;
  font-size: 3vh;
  cursor: pointer;
}

.overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  z-index: 999;
}

/* Add these new classes for controlling login/logout visibility */
.desktop-only,
.mobile-only {
  display: block;
}

/* Media queries for mobile */
@media (max-width: 480px) {
  .mobile-menu-toggle {
    display: block;
    margin-left: 10px; /* Add margin to separate from login buttons */
  }

  .navbar > .end > a {
    display: none;
  }

  /* Show login/logout buttons on mobile - but respect hidden class */
  .navbar > .end > a#login-btn,
  .navbar > .end > a#logout-btn {
    display: flex !important;
    align-items: center;
    font-size: 2vh;
    padding: 0.5rem;
    margin: 0 0.3rem;
    border-width: 0.3vh;
  }

  /* Honor the hidden class even with !important declarations above */
  .navbar > .end > a#login-btn.hidden,
  .navbar > .end > a#logout-btn.hidden {
    display: none !important;
  }

  /* Show greeting on mobile */
  #greeting {
    display: block !important;
    font-size: 0.9rem;
    margin: 0 0.5rem;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }

  /* Honor the hidden class for greeting */
  #greeting.hidden {
    display: none !important;
  }

  /* Hide regular nav items but keep login/logout visible */
  .navbar > .end > a.hide-on-mobile {
    display: none;
  }

  /* Keep the logo visible */
  .navbar > .title {
    display: block;
  }

  /* Show the settings link in the mobile menu, but not in the navbar */
  .navbar > .end > a[href="#settings"] {
    display: none;
  }

  /* This selector shows all links in mobile menu */
  .mobile-menu a {
    display: block;
  }

  /* Structure the navbar for mobile */
  .navbar {
    justify-content: space-between;
    align-items: center;
    background-color: rgba(25, 25, 35, 0.95);
    padding: 1.2vh 2vh;
    margin: 0;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.3);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  }

  /* Adjust title/logo position for the new navbar */
  .navbar > .title > img {
    margin-top: 0.5vh;
  }

  /* Make the end section with login buttons and hamburger menu properly aligned */
  .navbar > .end {
    display: flex;
    align-items: center;
  }

  /* Remove the hiding of login/logout buttons */
  #login-btn,
  #logout-btn,
  #greeting {
    display: flex !important;
  }

  /* Hide the text in the login/logout buttons on smaller mobile screens */
  .navbar > .end > a#login-btn span,
  .navbar > .end > a#logout-btn span {
    display: none;
  }
}

/* For desktop, hide mobile-only elements */
@media (min-width: 481px) {
  .mobile-only {
    display: none !important;
  }
}

/* Remove desktop/mobile distinction as we're now showing the same elements */
.desktop-only,
.mobile-only {
  display: block !important;
}

/* Make login controls more responsive */
@media (max-width: 680px) {
  .navbar > .end > a span {
    display: none; /* Hide text on smaller screens */
  }

  #greeting {
    max-width: 120px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
  }
}

/* Beautiful separator line after navbar */
.navbar-separator {
  height: 2px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    rgba(255, 255, 255, 0.2) 25%,
    rgba(255, 255, 255, 0.4) 50%,
    rgba(255, 255, 255, 0.2) 75%,
    transparent 100%
  );
  margin: 0 20px;
  border-radius: 1px;
  position: relative;
  overflow: hidden;
}

.navbar-separator::before {
  content: "";
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(
    90deg,
    transparent,
    rgba(255, 255, 255, 0.6),
    transparent
  );
  animation: shimmer 3s infinite;
}

@keyframes shimmer {
  0% {
    left: -100%;
  }
  100% {
    left: 100%;
  }
}
