/* Mobile-First Header with Dynamic Height and Blur Background */
.header {
  background: var(--surface-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border-glass);
  box-shadow: 0 2px 10px var(--shadow-light);
  position: sticky;
  top: 0;
  z-index: 100;
  height: clamp(56px, 8vh, 72px);
  transition: all 0.3s ease;
}

/* Scrolled state - solid background */
.header.scrolled {
  background: var(--bg-primary);
  backdrop-filter: none;
  -webkit-backdrop-filter: none;
  border-bottom: 3px solid var(--border-primary);
  box-shadow: 0 2px 10px var(--shadow-heavy);
}

/* Header Container - Mobile First */
.header-container {
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 100%;
  gap: 1rem;
}

/* Logo Section - Mobile Optimized */
.logo-section {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.logo-text {
  font-size: clamp(16px, 4vw, 20px);
  font-weight: 700;
  color: var(--text-primary);
  text-shadow: 2px 2px 4px var(--shadow-medium);
  background: linear-gradient(45deg, var(--primary-light), var(--primary));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

/* Main Navigation - Mobile First */
.main-nav {
  display: none;
  list-style: none;
  padding: 0;
  margin: 0;
  align-items: center;
  gap: 0.5rem;
  font-size: clamp(14px, 2vw, 16px);
}

.nav-item {
  padding: 0.5rem 0.75rem;
  color: var(--text-primary);
  text-decoration: none;
  cursor: pointer;
  transition: background-color 0.3s ease;
  border-radius: 4px;
  white-space: nowrap;
}

.nav-item:hover {
  background-color: var(--border-light);
}

.nav-item.active {
  background-color: var(--primary);
  color: white;
}

/* Dropdown Navigation */
.nav-dropdown {
  position: relative;
}

.dropdown-toggle {
  cursor: pointer;
  user-select: none;
  transition: background-color 0.3s ease;
}

.dropdown-toggle:hover {
  background-color: var(--border-light);
}

.dropdown-menu {
  position: absolute;
  top: 100%;
  right: -20px;
  background: var(--surface-glass);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  border: 1px solid var(--border-glass);
  border-radius: 8px;
  box-shadow: 0 4px 12px var(--shadow-medium);
  min-width: 200px;
  max-width: 200px;
  z-index: 1000;
  opacity: 0;
  visibility: hidden;
  transform: translateY(-10px) translateX(20px);
  transition: all 0.3s ease;
  display: flex;
  flex-direction: column;
  gap: 0;
}

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

.dropdown-item {
  padding: 0.75rem 1rem;
  color: var(--text-primary);
  cursor: pointer;
  transition: background-color 0.3s ease;
  border-bottom: 1px solid var(--border-light);
  text-align: left;
  font-size: 14px;
  white-space: nowrap;
}

.dropdown-item:last-child {
  border-bottom: none;
}

.dropdown-item:hover {
  background-color: var(--border-light);
}

.dropdown-item:first-child {
  border-radius: 8px 8px 0 0;
}

.dropdown-item:last-child {
  border-radius: 0 0 8px 8px;
}

/* Header Actions - Mobile First */
.header-actions {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  flex-shrink: 0;
}

.search-box {
  display: flex;
  background: var(--border-light);
  border-radius: 20px;
  overflow: hidden;
  border: 1px solid var(--border-secondary);
  height: clamp(36px, 6vh, 42px);
  padding: 0 0.75rem;
  min-width: 0;
}

.search-input {
  background: transparent;
  border: none;
  padding: 0 0.5rem;
  color: var(--text-primary);
  width: clamp(120px, 20vw, 200px);
  font-size: clamp(14px, 2vw, 16px);
  outline: none;
}

.search-input::placeholder {
  color: var(--text-secondary);
}

.search-btn, .favorites-btn, .profile-btn {
  background: none;
  border: none;
  color: var(--text-accent);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.3s ease;
  flex-shrink: 0;
}

.search-btn:hover, .favorites-btn:hover, .profile-btn:hover {
  background-color: var(--border-secondary);
  transform: scale(1.1);
}

/* Theme Toggle Button */
.theme-toggle {
  background: none;
  border: 1px solid var(--border-secondary);
  color: var(--text-primary);
  cursor: pointer;
  padding: 0.5rem;
  border-radius: 50%;
  transition: all 0.3s ease;
  flex-shrink: 0;
  font-size: 18px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-toggle:hover {
  background-color: var(--border-secondary);
  transform: scale(1.1);
  border-color: var(--primary);
}

/* Tablet and Desktop Breakpoints */
@media (min-width: 768px) {
  .header-container {
    padding: 0 2rem;
    gap: 2rem;
  }
  
  .main-nav {
    display: flex;
    gap: 1rem;
  }
  
  .header-actions {
    gap: 1rem;
  }
  
  .search-input {
    width: 180px;
  }
  
  /* Ensure dropdown doesn't go off screen */
  .dropdown-menu {
    right: 0;
    left: auto;
  }
}

@media (min-width: 1024px) {
  .header-container {
    padding: 0 2rem;
  }
  
  .main-nav {
    gap: 1.5rem;
  }
  
  .search-input {
    width: 220px;
  }
}

/* Mobile Navigation Toggle (for future enhancement) */
@media (max-width: 767px) {
  .main-nav {
    position: absolute;
    top: 100%;
    left: 0;
    right: 0;
    background: var(--surface-glass-hover);
    backdrop-filter: blur(8px);
    flex-direction: column;
    padding: 1rem;
    border-top: 1px solid var(--border-glass);
    transform: translateY(-100%);
    opacity: 0;
    pointer-events: none;
    transition: all 0.3s ease;
  }
  
  .main-nav.mobile-open {
    display: flex;
    transform: translateY(0);
    opacity: 1;
    pointer-events: auto;
  }
  
  .nav-item {
    padding: 0.75rem 1rem;
    text-align: center;
    border-bottom: 1px solid var(--border-light);
  }
  
  .nav-item:last-child {
    border-bottom: none;
  }
  
  .nav-dropdown {
    width: 100%;
  }
  
  .dropdown-menu {
    position: absolute;
    top: 100%;
    right: -10px;
    background: var(--surface-glass);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    border: 1px solid var(--border-glass);
    border-radius: 8px;
    box-shadow: 0 4px 12px var(--shadow-medium);
    min-width: 160px;
    max-width: 160px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px) translateX(15px);
    transition: all 0.3s ease;
    display: flex;
    flex-direction: column;
    gap: 0;
  }
  
  .dropdown-menu.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0) translateX(0);
  }
  
  .dropdown-item {
    padding: 0.5rem 0.75rem;
    color: var(--text-primary);
    cursor: pointer;
    transition: background-color 0.3s ease;
    border-bottom: 1px solid var(--border-light);
    text-align: left;
    font-size: 13px;
    white-space: nowrap;
  }
  
  .dropdown-item:last-child {
    border-bottom: none;
  }
  
  .dropdown-item:first-child {
    border-radius: 8px 8px 0 0;
  }
  
  .dropdown-item:last-child {
    border-radius: 0 0 8px 8px;
  }
}
