/* Header Styles */

.header {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  box-shadow: var(--shadow-sm);
}

.nav-container {
  display: flex;
  justify-content: space-between;
  align-items: center;
  max-width: var(--container-xl);
  margin: 0 auto;
  padding: 0 var(--space-4);
  height: var(--header-height);
}

/* Logo Section */
.nav-logo {
  display: flex;
  align-items: center;
}

.nav-logo a {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  text-decoration: none;
  transition: opacity var(--transition-fast) var(--ease-in-out);
}

.nav-logo a:hover {
  opacity: 0.8;
}

.logo {
  width: 40px;
  height: 40px;
}

.logo-text {
  font-size: var(--text-xl);
  font-weight: var(--font-bold);
  color: var(--text-primary);
}

/* Navigation Menu */
.nav-menu {
  display: flex;
  align-items: center;
  gap: var(--space-6);
}

.nav-link {
  position: relative;
  font-size: var(--text-base);
  font-weight: var(--font-medium);
  color: var(--text-secondary);
  text-decoration: none;
  transition: color var(--transition-fast) var(--ease-in-out);
}

.nav-link:hover {
  color: var(--primary);
  text-decoration: none;
}

.nav-link.active {
  color: var(--primary);
}

.nav-link.active::after {
  content: '';
  position: absolute;
  bottom: -8px;
  left: 0;
  right: 0;
  height: 2px;
  background-color: var(--primary);
}

/* Theme Toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: all var(--transition-fast) var(--ease-in-out);
}

.theme-toggle:hover {
  background-color: var(--bg-secondary);
  border-color: var(--border-hover);
}

.theme-icon-light,
.theme-icon-dark {
  width: 20px;
  height: 20px;
}

[data-theme="light"] .theme-icon-dark {
  display: none;
}

[data-theme="dark"] .theme-icon-light {
  display: none;
}

/* Mobile Menu Toggle */
.mobile-menu-toggle {
  display: none;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  background-color: transparent;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  cursor: pointer;
}

.mobile-menu-toggle img {
  width: 24px;
  height: 24px;
}

/* App Header */
.app-header {
  display: flex;
  align-items: center;
  height: var(--header-height);
  background-color: var(--bg-primary);
  border-bottom: 1px solid var(--border);
  padding: 0 var(--space-4);
  gap: var(--space-4);
}

.app-header-left {
  display: flex;
  align-items: center;
  flex-shrink: 0;
}

.app-logo {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  font-size: var(--text-lg);
  font-weight: var(--font-bold);
  color: var(--text-primary);
  text-decoration: none;
}

.app-logo img {
  width: 32px;
  height: 32px;
}

.app-header-center {
  flex: 1;
  display: flex;
  justify-content: center;
  max-width: 800px;
}

.app-header-right {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  flex-shrink: 0;
}

/* Search Bar in Header */
.search-bar-container {
  display: flex;
  gap: var(--space-2);
  width: 100%;
  max-width: 600px;
}

.search-input-wrapper {
  position: relative;
  flex: 1;
  display: flex;
  align-items: center;
}

.search-icon {
  position: absolute;
  left: var(--space-3);
  width: 20px;
  height: 20px;
  opacity: 0.5;
  pointer-events: none;
}

.search-input {
  width: 100%;
  padding: var(--space-2) var(--space-10) var(--space-2) var(--space-10);
  font-size: var(--text-base);
  color: var(--text-primary);
  background-color: var(--bg-secondary);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  transition: all var(--transition-fast) var(--ease-in-out);
}

.search-input:hover {
  border-color: var(--border-hover);
}

.search-input:focus {
  outline: none;
  border-color: var(--primary);
  background-color: var(--bg-primary);
  box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.1);
}

.clear-search-btn {
  position: absolute;
  right: var(--space-2);
  display: none;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
  background-color: transparent;
  border: none;
  border-radius: var(--radius-sm);
  cursor: pointer;
  transition: background-color var(--transition-fast) var(--ease-in-out);
}

.clear-search-btn:hover {
  background-color: var(--bg-tertiary);
}

.clear-search-btn img {
  width: 16px;
  height: 16px;
  opacity: 0.5;
}

.search-input:not(:placeholder-shown) ~ .clear-search-btn {
  display: flex;
}

.search-btn {
  flex-shrink: 0;
}

/* Responsive Styles */
@media (max-width: 768px) {
  .nav-container {
    height: var(--header-height-mobile);
  }

  .nav-menu {
    display: none;
    position: absolute;
    top: var(--header-height-mobile);
    left: 0;
    right: 0;
    background-color: var(--bg-primary);
    border-bottom: 1px solid var(--border);
    box-shadow: var(--shadow-lg);
    flex-direction: column;
    padding: var(--space-4);
    gap: var(--space-2);
  }

  .nav-menu.mobile-open {
    display: flex;
  }

  .nav-link {
    width: 100%;
    padding: var(--space-2) 0;
  }

  .nav-link.active::after {
    display: none;
  }

  .mobile-menu-toggle {
    display: flex;
  }

  .app-header {
    flex-wrap: wrap;
    height: auto;
    padding: var(--space-2);
  }

  .app-header-left {
    order: 1;
  }

  .app-header-right {
    order: 2;
    margin-left: auto;
  }

  .app-header-center {
    order: 3;
    width: 100%;
    max-width: none;
    margin-top: var(--space-2);
  }

  .app-logo span {
    display: none;
  }
}

@media (max-width: 480px) {
  .logo-text {
    display: none;
  }

  .search-bar-container {
    flex-direction: column;
  }

  .search-btn {
    width: 100%;
  }
}