.navbar {
  background-color: var(--surface-color);
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 0;
  z-index: 100;
  padding: 4px 0;
  border-bottom: 2px solid var(--primary-color);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  height: 60px; /* Fixed height to control navbar size */
}

.nav-left {
  display: flex;
  align-items: center;
  height: 100%;
}

.logo-link {
  display: flex;
  align-items: center;
  height: 100%;
}

.logo-img {
  height: 60px; /* Maximize height to fit navbar exactly */
  width: auto;
  transition: transform 0.2s ease;
  transform-origin: left center;
}

.logo-img:hover {
  transform: scale(1.05);
}

.nav-links {
  display: flex;
  gap: 20px;
  align-items: center;
  transition: transform 0.3s ease;
}

.nav-links a {
  font-weight: 500;
  color: var(--text-primary);
  padding: 8px 12px;
  border-radius: 6px;
  transition: all 0.2s;
  position: relative;
  white-space: nowrap;
  flex-shrink: 0;
}

.nav-links a:hover, .nav-links a.active {
  color: var(--primary-color);
  background-color: rgba(230, 36, 41, 0.05);
}

.nav-links a::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 2px;
  background-color: var(--primary-color);
  transition: width 0.3s ease;
}

.nav-links a:hover::after, .nav-links a.active::after {
  width: 80%;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 15px;
  height: 100%;
}

.search-box {
  display: flex;
  align-items: center;
  background-color: transparent;
  border: 1px solid transparent;
  border-radius: 20px;
  padding: 4px;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.search-box.active {
  background-color: var(--bg-color);
  border-color: var(--border-color);
  padding: 4px 16px 4px 4px;
}

.search-box:focus-within {
  border-color: var(--primary-color);
}

.search-box input {
  border: none;
  background: none;
  outline: none;
  color: var(--text-primary);
  padding: 0;
  width: 0;
  opacity: 0;
  font-family: inherit;
  transition: width 0.3s ease, padding 0.3s ease, opacity 0.3s ease;
}

.search-box.active input {
  width: 150px;
  padding: 4px 8px;
  opacity: 1;
}

.search-box button {
  color: var(--text-primary);
  background-color: transparent;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.2s, color 0.2s;
  z-index: 2;
}

.search-box button:hover {
  background-color: rgba(230, 36, 41, 0.1);
  color: var(--primary-color);
}

.icon-btn {
  font-size: 1.2rem;
  color: var(--text-primary);
  padding: 8px;
  border-radius: 50%;
  transition: background-color 0.2s, color 0.2s;
}

.icon-btn:hover {
  background-color: rgba(230, 36, 41, 0.1);
  color: var(--primary-color);
}

.profile-menu {
  position: relative;
  height: 100%;
  display: flex;
  align-items: center;
}

.profile-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  overflow: hidden;
  border: 2px solid var(--border-color);
  padding: 0;
  transition: border-color 0.3s ease;
}

.profile-menu:hover .profile-btn {
  border-color: var(--primary-color);
}

.profile-btn img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.dropdown-content {
  visibility: hidden;
  position: absolute;
  top: 100%;
  right: 0;
  background-color: var(--surface-color);
  min-width: 200px;
  box-shadow: var(--shadow-md);
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--border-color);
  opacity: 0;
  transform: translateY(-10px);
  transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
  z-index: 1000;
}

.profile-menu:hover .dropdown-content {
  visibility: visible;
  opacity: 1;
  transform: translateY(10px);
}

.dropdown-content a {
  display: block;
  padding: 12px 20px;
  color: var(--text-primary);
  font-weight: 400;
  transition: background-color 0.2s, color 0.2s;
  display: flex;
  align-items: center;
  gap: 12px;
}

.dropdown-content a i {
  color: var(--text-secondary);
  font-size: 1.1rem;
}

.dropdown-content a:hover {
  background-color: rgba(230, 36, 41, 0.05);
  color: var(--primary-color);
}

.dropdown-content a:hover i {
  color: var(--primary-color);
}

.dropdown-content .logout {
  border-top: 1px solid var(--border-color);
  color: #d32f2f;
}

.dropdown-content .logout i {
  color: #d32f2f;
}

.dropdown-content .logout:hover {
  background-color: #ffebee;
}

[data-theme="dark"] .dropdown-content .logout:hover {
  background-color: rgba(211, 47, 47, 0.15);
}

/* Navbar Login/Register Button */
.btn-solid {
  background-color: var(--primary-color);
  color: #ffffff !important;
  border-radius: 8px;
  text-decoration: none;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 10px rgba(230, 36, 41, 0.2);
}

.btn-solid:hover {
  background-color: #c01e23;
  transform: translateY(-2px);
  box-shadow: 0 6px 15px rgba(230, 36, 41, 0.3);
}

.btn-solid::after {
  display: none !important; /* Prevent the underline effect from .nav-links a */
}

/* Mobile Responsiveness for Navbar */
@media (max-width: 768px) {
  .nav-container {
    flex-wrap: wrap;
    height: auto;
    padding: 10px 0;
  }
  .nav-links {
    order: 3;
    width: 100%;
    overflow-x: auto;
    padding-bottom: 5px;
    margin-top: 10px;
    justify-content: flex-start;
    -webkit-overflow-scrolling: touch;
  }
  .nav-links::-webkit-scrollbar {
    height: 4px;
  }
  .nav-links::-webkit-scrollbar-thumb {
    background-color: var(--primary-color);
    border-radius: 4px;
  }
  .nav-right {
    margin-left: auto;
  }
  .search-box.active input {
    width: 120px; /* slightly smaller on mobile */
  }
}
