/* Navbar Styles */
:root {
  --navbar-height: 60px;
  --navbar-bg: rgba(11, 18, 32, 0.95);
  --navbar-text: #e5e7eb;
  --navbar-hover: #7c3aed;
  --gradient-primary: linear-gradient(135deg, #7c3aed, #06b6d4);
}

.navbar {
  background: var(--navbar-bg);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  height: var(--navbar-height);
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.navbar-container {
  max-width: 1200px;
  height: 100%;
  margin: 0 auto;
  padding: 0 1.5rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: relative; /* allow centering brand */
}

/* Logo Container - centered brand */
.navbar-logo-container {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  height: 100%;
}

/* Right-aligned items */
.navbar-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 100%;
}

.navbar-right {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  margin-left: auto;
  height: 100%;
}

.navbar.user-menu {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  height: 100%;
  padding: 0 0.5rem;
}

.user-menu .btn {
  white-space: nowrap;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  height: 36px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1; /* ensure vertical centering */
}

.user-menu .btn.btn-primary {
  background: transparent; /* outlined style, match Log Out */
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: 500;
}

.user-menu .btn.btn-secondary {
  background: transparent; /* align with generic .btn-secondary */
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: white;
  font-weight: 500;
}

.user-menu .btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  background: rgba(255, 255, 255, 0.05);
}

/* Navigation Menu */
.navbar-menu {
  display: flex;
  list-style: none;
  margin: 0;
  padding: 0;
  height: 100%;
}

.navbar-menu li {
  display: flex;
  align-items: center;
}

.navbar-logo {
  font-size: 1.5rem;
  font-weight: 700;
  text-decoration: none;
  color: var(--navbar-text);
  transition: opacity 0.2s ease;
}

.navbar-logo:hover {
  opacity: 0.9;
}

/* Menu */
.navbar-menu {
  display: flex;
  align-items: center;
  justify-content: space-between;
  width: 100%;
  margin: 0;
  padding: 0;
  list-style: none;
  height: 100%;
}

/* Navigation Links */
.nav-link {
  color: var(--navbar-text);
  text-decoration: none;
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.5rem 0;
  position: relative;
  transition: color 0.2s ease;
  display: flex;
  align-items: center;
  height: 100%;
}

.nav-link:hover {
  color: var(--navbar-hover);
}

/* Buttons */
.btn {
  padding: 0.5rem 1rem;
  border-radius: 6px;
  font-weight: 500;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  border: none;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.btn-primary {
  background: var(--gradient-primary);
  color: white;
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.3);
}

.btn-secondary {
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--navbar-text);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.05);
}

/* Language Selector */
.language-selector-container {
  display: flex;
  align-items: center;
  height: 100%;
  padding: 0 0.5rem;
}

.language-selector {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: var(--navbar-text);
  padding: 0.4rem 0.8rem;
  border-radius: 4px;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s ease;
  height: 36px;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  background-image: url("data:image/svg+xml;utf8,<svg fill='white' height='24' viewBox='0 0 24 24' width='24' xmlns='http://www.w3.org/2000/svg'><path d='M7 10l5 5 5-5z'/><path d='M0 0h24v24H0z' fill='none'/></svg>");
  background-repeat: no-repeat;
  background-position: right 8px center;
  padding-right: 2rem;
}

.language-selector:hover {
  background-color: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.3);
}

.language-selector:focus {
  outline: none;
  border-color: var(--navbar-hover);
  box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.2);
}

/* Mobile Menu Toggle */
.navbar-toggle {
  display: none;
  flex-direction: column;
  justify-content: space-between;
  width: 28px;
  height: 20px;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0;
  z-index: 1001;
}

.hamburger {
  display: block;
  width: 100%;
  height: 2px;
  background: var(--navbar-text);
  transition: all 0.3s ease;
}

/* Mobile Menu */
@media (max-width: 768px) {
  .navbar {
    padding: 0 1rem;
  }
  
  .navbar-container {
    padding: 0 1rem;
  }
  /* On mobile, align brand to the left */
  .navbar-logo-container {
    position: static;
    transform: none;
    margin-right: auto;
  }
  
  .navbar-menu {
    position: fixed;
    top: 0;
    right: -100%;
    width: 80%;
    max-width: 300px;
    height: 100vh;
    background: var(--navbar-bg);
    flex-direction: column;
    justify-content: flex-start;
    padding: 5rem 2rem 2rem;
    box-shadow: -2px 0 10px rgba(0, 0, 0, 0.1);
    transition: right 0.3s ease-in-out;
    gap: 1.5rem;
  }
  
  .navbar-right {
    flex-direction: column;
    width: 100%;
    margin-left: 0;
    gap: 1rem;
  }

  .navbar-menu.active {
    right: 0;
  }
  
  .navbar-logo-container {
    position: static;
    transform: none;
    margin-right: auto;
  }
  
  .navbar-logo {
    font-size: 1.3rem;
  }

  .navbar-toggle {
    display: flex;
  }
  
  .nav-link {
    width: 100%;
    padding: 0.75rem 0;
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
  }
  
  .user-menu {
    width: 100%;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid rgba(255, 255, 255, 0.1);
  }
  
  .btn {
    width: 100%;
    margin: 0.25rem 0;
  }
  
  .language-selector {
    width: 100%;
    margin: 1rem 0;
  }
}

/* Hide/show elements based on auth state */
#dashboard-link,
#logout-btn {
  display: none;
}

.authenticated #dashboard-link,
.authenticated #logout-btn {
  display: inline-block;
}

.authenticated #login-link {
  display: none;
}

/* Hide dashboard link on dashboard page */
body[data-page="dashboard"] #dashboard-link {
  display: none;
}
