/* 40aWeek - components/header */

.glass-panel {
  background: rgba(255, 255, 255, 0.92);
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-bottom: 1px solid var(--border-color, #E8E4DF);
}

header {
  box-shadow: 0 4px 30px rgba(0, 0, 0, 0.1);
  border-bottom: 1px solid rgba(255, 255, 255, 0.3);
  padding: 0 24px;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  z-index: 299;
}

.header-content {
  display: flex;
  align-items: center;
  height: 56px;
  margin: 0 auto;
  gap: 0;
}

.header-logo {
  font-family: var(--font-serif);
  font-weight: 400;
  color: var(--color-primary);
  font-size: 20px;
  text-decoration: none;
  letter-spacing: 0;
  flex-shrink: 0;
  margin-right: 24px;
}

.logo-mobile {
  display: none;
}

.header-nav {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 0 auto;
}

.header-nav a {
  font-family: var(--font-sans);
  color: #4b5563;
  font-weight: 500;
  font-size: 0.95rem;
  transition: color 0.2s, background 0.2s;
  text-decoration: none;
  padding: 6px 12px;
  border-radius: 8px;
  white-space: nowrap;
}

.header-nav a:hover {
  color: var(--text-color);
  background: var(--bg-subtle);
}

.header-nav a.active {
  color: var(--color-primary);
  font-weight: 600;
}

.header-right {
  display: flex;
  align-items: center;
  gap: 8px;
  flex-shrink: 0;
}

.desktop-search-wrapper {
  position: relative;
  min-width: 115px;
  max-width: 200px;
  height: 32px;
}

.desktop-search-wrapper .header-search {
  position: absolute;
  right: 0;
  top: 0;
  z-index: 100;
}

.header-search {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  box-sizing: border-box;
  background: var(--bg-subtle);
  border: 1px solid #e5e7eb;
  border-radius: 20px;
  padding: 0 12px;
  color: #9ca3af;
  font-size: 0.82rem;
  cursor: pointer;
  white-space: nowrap;
  transition: background 0.2s, border-color 0.2s;
  border-color: var(--border-color);
}

.header-search:hover {
  background: var(--border-color-light, #F0EBE5);
  border-color: var(--border-color, #E8E4DF);
}

.header-search i {
  font-size: 0.75rem;
  flex-shrink: 0;
}

.header-search:focus-within {
  background: #ffffff;
  border-color: var(--color-primary, #6366f1);
  box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.08);
}

.header-search input {
  background: transparent !important;
  border: none !important;
  outline: none !important;
  box-shadow: none !important;
  color: inherit;
  padding: 0;
  margin: 0;
  width: 100%;
}

.header-search input::placeholder {
  color: #9ca3af;
}

.header-timer {
  display: flex;
  align-items: center;
  gap: 7px;
  height: 32px;
  box-sizing: border-box;
  background: var(--bg-subtle);
  color: var(--text-secondary);
  border: 1px solid var(--border-color, #E8E4DF);
  border-radius: 20px;
  padding: 5px 12px;
  font-size: 0.82rem;
  font-weight: 500;
  white-space: nowrap;
  cursor: default;
  flex-shrink: 0;
  letter-spacing: 0.01em;
  transition: background 0.2s, color 0.2s, border-color 0.2s;
  border-color: var(--border-color);
}

.header-timer i {
  font-size: 0.75rem;
  opacity: 0.85;
  color: #9ca3af;
}

.header-timer .js-countdown-timer {
  font-variant-numeric: tabular-nums;
}

.header-profile {
  display: flex;
  align-items: center;
  gap: 8px;
}

.profile-menu-container {
  position: relative;
  display: inline-flex;
  align-items: center;
}

.logged-out-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  box-sizing: border-box;
  border-radius: 50%;
  background: var(--bg-subtle, rgba(0, 0, 0, 0.04));
  border: 1px solid var(--border-color, #E8E4DF);
  color: var(--text-color, #111827);
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
  outline: none;
}

.logged-out-trigger:hover,
.logged-out-trigger.active {
  background: var(--border-color, #E8E4DF);
  color: var(--color-primary, #C8490D);
}

body.dark-mode .logged-out-trigger {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.15);
  color: #f9fafb;
}

body.dark-mode .logged-out-trigger:hover,
body.dark-mode .logged-out-trigger.active {
  background: rgba(255, 255, 255, 0.15);
  color: var(--color-primary, #C8490D);
}

.header-profile .btn {
  height: 32px;
  box-sizing: border-box;
  border-radius: 20px;
  padding: 0 16px;
  font-size: 0.82rem;
  font-weight: 600;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  white-space: nowrap;
}

.header-profile .btn-subtle-auth {
  background: transparent;
  color: var(--text-color, #2A211D);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}

.header-profile .btn-subtle-auth:hover {
  color: var(--color-primary, #C8490D);
  background: rgba(200, 73, 13, 0.06);
  border-color: rgba(200, 73, 13, 0.18);
}

body.dark-mode .header-profile .btn-subtle-auth {
  color: var(--text-color, #E8E4DF);
}

body.dark-mode .header-profile .btn-subtle-auth:hover {
  color: var(--color-primary, #C8490D);
  background: rgba(255, 255, 255, 0.08);
}

@media (max-width: 600px) {
  .header-profile .btn-subtle-auth {
    display: none !important;
  }
}

.profile-dropdown-trigger {
  display: flex;
  align-items: center;
  gap: 8px;
  height: 32px;
  box-sizing: border-box;
  background: transparent;
  border: none;
  padding: 0 4px 0 0;
  cursor: pointer;
  color: var(--text-color, #111827);
  transition: opacity 0.2s ease;
  outline: none;
}

.profile-dropdown-trigger:hover,
.profile-menu-container.active .profile-dropdown-trigger {
  background: transparent;
  border: none;
  opacity: 0.85;
}

.user-avatar-circle {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  flex-shrink: 0;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #ffffff;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.15);
}

.user-avatar-circle img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.user-avatar-circle .header-initials {
  font-family: 'DM Serif Display', serif !important;
  font-size: 0.85rem !important;
  color: #ffffff !important;
  line-height: 1 !important;
  text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.2) !important;
  user-select: none;
}

.user-avatar-circle.large {
  width: 44px;
  height: 44px;
}

.user-avatar-circle.large .header-initials {
  font-size: 1.15rem !important;
}

.profile-username-text {
  font-weight: 600;
  font-size: 0.88rem;
  color: inherit;
  max-width: 120px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.profile-chevron {
  font-size: 0.7rem;
  opacity: 0.7;
  transition: transform 0.2s ease;
}

.profile-menu-container.active .profile-chevron {
  transform: rotate(180deg);
}

.profile-dropdown-menu {
  position: fixed;
  width: 240px;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid var(--border-color, #E8E4DF);
  border-radius: 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.12);
  padding: 12px;
  display: none;
  flex-direction: column;
  gap: 4px;
  z-index: 10000;
}

.profile-dropdown-menu.active {
  display: flex;
  animation: fadeInSlide 0.2s ease-out;
}

.dropdown-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 6px 12px 6px;
}

.dropdown-user-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.dropdown-username {
  font-weight: 700;
  font-size: 0.95rem;
  color: var(--text-color, #111827);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-email {
  font-size: 0.78rem;
  color: #6b7280;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dropdown-divider {
  height: 1px;
  background: var(--border-color, #E8E4DF);
  margin: 4px 0;
  opacity: 0.6;
}

.dropdown-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 12px;
  border-radius: 10px;
  color: var(--text-color, #111827);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  background: transparent;
  border: none;
  width: 100%;
  cursor: pointer;
  text-align: left;
  transition: background 0.15s ease, color 0.15s ease;
}

.dropdown-item i {
  font-size: 0.95rem;
  width: 16px;
  text-align: center;
  opacity: 0.8;
}

.dropdown-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: var(--color-primary);
}

.dropdown-item.logout-item {
  color: #ef4444;
}

.dropdown-item.logout-item:hover {
  background: rgba(239, 68, 68, 0.1);
  color: #dc2626;
}

.dropdown-item-split {
  justify-content: space-between;
  cursor: default;
}

.dropdown-item-split:hover {
  background: transparent !important;
  color: var(--text-color, #111827) !important;
}

.dropdown-item-left {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-color, #111827);
}

.dropdown-item-left i {
  font-size: 0.95rem;
  width: 16px;
  text-align: center;
  opacity: 0.8;
}

.lang-selector-pills {
  display: inline-flex;
  align-items: center;
  background: rgba(0, 0, 0, 0.05);
  padding: 3px;
  border-radius: 8px;
  gap: 2px;
  border: 1px solid var(--border-color, #E8E4DF);
}

body.dark-mode .lang-selector-pills {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.12);
}

.lang-pill {
  border: none;
  background: transparent;
  color: #6b7280;
  padding: 4px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.15s ease;
  line-height: 1;
}

.lang-pill:hover {
  color: var(--text-color, #111827);
}

.lang-pill.active {
  background: var(--color-primary, #C8490D) !important;
  color: #ffffff !important;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.15);
}

body.dark-mode .lang-pill:hover {
  color: #ffffff;
}

body.dark-mode .lang-pill.active {
  background: var(--color-primary, #C8490D) !important;
  color: #ffffff !important;
}

.header-actions {
  display: flex;
  align-items: center;
  gap: 12px;
}

#mobile-nav-toggle {
  display: none;
  background: none;
  border: none;
  color: var(--color-primary);
  font-size: 28px;
  cursor: pointer;
  padding: 0;
  margin-right: 10px;
}

.mobile-only-sidebar {
  display: none;
}

.section-header h2,
.votes-title {
  text-align: center;
  font-size: 2rem;
  color: var(--color-secondary);
  margin-bottom: 10px;
  font-weight: 800;
}

.section-header p {
  color: var(--text-light);
  font-size: 1.1rem;
}

.header-top-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 20px;
}

.header-top-row .form-title {
  margin: 0;
  font-size: 1.8rem;
  line-height: normal;
  background: -webkit-linear-gradient(45deg, #111, #555);
  -webkit-background-clip: text;
  background-clip: text;
  padding-bottom: 2px;
}

.status-header i {
  font-size: 3rem;
  margin-bottom: 20px;
  display: inline-block;
  color: var(--color-primary);
}

.mobile-only-sidebar .sidebar {
  position: static;
  align-self: auto;
}

.mission-header span:first-child {
  font-size: 1.1rem;
  font-weight: 800;
  color: #1e1b4b;
  display: flex;
  align-items: center;
  gap: 10px;
}

.mission-header i {
  color: #ef4444;
  font-size: 1.2rem;
  filter: drop-shadow(0 2px 4px rgba(239, 68, 68, 0.3));
  animation: pulseIcon 2s infinite;
}

#header-karma-display #karma-val {
  position: relative;
  line-height: 1;
  display: inline-block;
}

#profile-bio {
  max-width: 100%;
  margin-top: 5px;
  text-align: left;
}

.header-timer:hover {
  background: var(--border-color-light, #F0EBE5);
  border-color: var(--border-color, #E8E4DF);
  color: var(--color-primary);
}

.mobile-nav-menu {
  position: absolute;
  top: 100%;
  left: 0;
  width: 100vw;
  height: calc(100vh - 56px);
  background-color: #fff;
  z-index: 9999;
  display: none;
  flex-direction: column;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  border-top: 1px solid #eee;
  overflow-y: auto;
}

body.nav-open .mobile-nav-menu {
  display: flex;
}

.mobile-nav-content {
  padding: 20px;
}

.burger-icon {
  width: 24px;
  height: 24px;
  position: relative;
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 0 !important;
  margin-right: 8px !important;
}

.burger-icon .bar {
  display: block;
  width: 100%;
  height: 2px;
  background-color: var(--color-primary);
  border-radius: 2px;
  position: absolute;
  left: 0;
  transition: all 0.3s ease-in-out;
}

.burger-icon .bar:nth-child(1) {
  top: 5px;
}

.burger-icon .bar:nth-child(2) {
  top: 11px;
}

.burger-icon .bar:nth-child(3) {
  top: 17px;
}

body.nav-open .burger-icon .bar:nth-child(1) {
  transform: translateY(6px) rotate(45deg);
}

body.nav-open .burger-icon .bar:nth-child(2) {
  opacity: 0;
}

body.nav-open .burger-icon .bar:nth-child(3) {
  transform: translateY(-6px) rotate(-45deg);
}

.mobile-nav-links {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.mobile-nav-links a {
  font-size: 18px;
  font-weight: 600;
  color: #111827;
  text-decoration: none;
  display: block;
}

.mobile-nav-links a:hover {
  color: var(--color-primary);
}

.search-container {
  position: relative;
}

.search-results-dropdown {
  display: none;
  position: absolute;
  top: 100%;
  left: 0;
  width: 100%;
  min-width: 250px;
  max-height: 400px;
  overflow-y: auto;
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.4);
  border-radius: 12px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
  z-index: 1000;
  margin-top: 10px;
  flex-direction: column;
  padding: 10px 0;
  animation: fadeIn 0.2s ease-out;
}

.search-results-dropdown.mobile-version {
  position: static;
  width: 100%;
  box-shadow: none;
  border: none;
  background: transparent;
  padding: 0;
}

#theme-toggle-btn .light-icon,
.mobile-nav-links .light-icon,
.theme-toggle-item .light-icon {
  display: none !important;
}

#theme-toggle-btn .dark-icon,
.mobile-nav-links .dark-icon,
.theme-toggle-item .dark-icon {
  display: inline-block !important;
}

.mobile-nav-links .dark-text {
  display: none;
}

.mobile-nav-links .light-text {
  display: inline-block;
}

#profile-socials {
  display: flex;
  gap: 15px;
  justify-content: center;
}

.nav-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.5);
  z-index: 298;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.3s ease-in-out, visibility 0.3s;
}

.nav-open .nav-overlay {
  opacity: 1;
  visibility: visible;
}

#btn-theme-toggle {
  font-size: 1.2rem;
  padding: 8px;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  background: transparent;
  color: #64748b;
  border: 1px solid transparent;
  cursor: pointer;
}

#btn-theme-toggle:hover {
  background: transparent !important;
  color: var(--color-primary);
  transform: none !important;
}

#btn-theme-toggle.is-active-dark {
  color: #fbbf24;
  text-shadow: 0 0 10px rgba(251, 191, 36, 0.5);
}

.theme-toggle-sidebar {
  margin: 0 !important;
  display: flex;
  align-items: center;
  gap: 15px;
  cursor: pointer;
  padding: 0 !important;
  border-radius: 12px;
  transition: background 0.2s;
  width: 100% !important;
  background: rgba(0, 0, 0, 0.02);
  justify-content: center !important;
  box-sizing: border-box;
  overflow: visible !important;
}

.theme-toggle-sidebar:hover {
  background: rgba(0, 0, 0, 0.03);
}

.theme-toggle-track {
  width: 52px;
  height: 28px;
  background: #cbd5e1;
  border-radius: 30px;
  position: relative;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 6px;
  transition: all 0.3s ease;
  flex-shrink: 0 !important;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
  margin-right: 12px;
  overflow: visible !important;
  margin: 0 auto !important;
}

.toggle-ball {
  width: 18px;
  height: 18px;
  background: white;
  border-radius: 50%;
  position: absolute;
  top: 3px;
  left: 3px;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

.toggle-icon-sun,
.toggle-icon-moon {
  font-size: 10px;
  z-index: 1;
}

.toggle-icon-sun {
  color: #d97706;
  margin-left: 2px;
}

.toggle-icon-moon {
  color: #94a3b8;
}

.theme-label {
  font-size: 0.95rem;
  font-weight: 600;
  color: var(--text-light);
  user-select: none;
  white-space: nowrap;
  text-align: left;
}

.floating-panel .theme-toggle-sidebar {
  margin: 0 !important;
  background: transparent !important;
}

.mobile-search-clone {
  margin-bottom: 20px;
  width: 100%;
}

.mobile-theme-toggle-pill {
  border: 1px solid var(--border-color);
  background: var(--bg-subtle);
  cursor: pointer;
  width: 40px;
  height: 32px;
  padding: 4px 12px;
  margin-top: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 20px;
}

.search-result-item {
  display: flex;
  align-items: center;
  padding: 10px 20px;
  text-decoration: none;
  color: #1f2937;
  transition: background-color 0.2s;
  gap: 12px;
}

.search-result-item:hover {
  background-color: rgba(79, 70, 229, 0.05);
}

.search-result-icon {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background-color: var(--color-primary-light, #FDF0E8);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #6b7280;
  flex-shrink: 0;
}

.search-result-title {
  font-weight: 600;
  font-size: 0.9rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-result-subtitle {
  font-size: 0.75rem;
  color: #6b7280;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-no-results {
  padding: 15px 20px;
  text-align: center;
  color: #6b7280;
  font-size: 0.9rem;
  font-style: italic;
}

.search-loading {
  padding: 15px;
  display: flex;
  justify-content: center;
  color: var(--color-primary);
}

.mobile-theme-toggle-pill .dark-icon {
  color: #9ca3af;
}

.mobile-theme-toggle-pill .light-icon {
  color: #f59e0b;
}

#user-email-display {
  cursor: pointer;
  font-weight: 700;
  display: flex;
  align-items: center !important;
  transition: all 0.2s ease;
  padding: 5px 10px;
  border-radius: 20px;
  gap: 10px;
  height: 100%;
  text-decoration: none;
}

#user-email-display:hover {
  color: var(--color-primary);
  background-color: rgba(0, 0, 0, 0.05);
}

.nav-open header {
  backdrop-filter: none;
  background: #ffffff;
  z-index: 9999;
}

.theme-selector-wrapper {
  display: flex;
  justify-content: center;
  width: 100%;
}

.theme-selector {
  display: flex;
  background: #e2e8f0;
  border-radius: 20px;
  padding: 2px;
  gap: 2px;
}

.theme-option {
  padding: 8px 16px;
  border-radius: 18px;
  cursor: pointer;
  font-size: 1rem;
  color: #64748b;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
}

.theme-option:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-color);
}

.theme-option.active {
  background: white;
  color: var(--color-primary);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
  font-weight: bold;
}

.search-result-content {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-category-title {
  font-size: 0.7rem;
  text-transform: uppercase;
  color: #9ca3af;
  font-weight: bold;
  padding: 5px 20px;
  margin-top: 5px;
  letter-spacing: 0.05em;
}

#theme-toggle-btn {
  background: var(--bg-subtle);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  width: 32px;
  height: 32px;
  color: var(--text-secondary, #9ca3af);
  font-size: 1rem;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

#theme-toggle-btn:hover {
  background: var(--border-color-light, #F0EBE5);
  border-color: var(--border-color);
  color: var(--color-primary);
}

.mobile-theme-toggle-link {
  display: flex !important;
  align-items: center;
  justify-content: space-between;
}
