/* GlowBright — Professional Header v2 */

:root {
  --gb-header-h: 64px;
}

@media (max-width: 768px) {
  :root { --gb-header-h: 56px; }
}

.site-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  width: 100%;
  height: var(--gb-header-h);
  z-index: 1000;
  background: rgba(11, 17, 32, 0.94);
  backdrop-filter: blur(18px) saturate(1.25);
  -webkit-backdrop-filter: blur(18px) saturate(1.25);
  border-bottom: 1px solid rgba(148, 163, 184, 0.1);
  box-shadow: 0 1px 0 rgba(255,255,255,0.03) inset, 0 6px 24px rgba(0,0,0,0.22);
  overflow: visible !important;
  transition: background 0.2s ease, box-shadow 0.2s ease;
}

[data-theme="light"] .site-header {
  background: rgba(255, 255, 255, 0.92);
  border-bottom: 1px solid rgba(15, 23, 42, 0.06);
  box-shadow: 0 1px 0 #fff inset, 0 4px 20px rgba(15, 23, 42, 0.045);
}

.site-header::after {
  content: "";
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(20,184,166,0.4), rgba(99,102,241,0.35), rgba(20,184,166,0.4), transparent);
  pointer-events: none;
  opacity: 0.85;
}
[data-theme="light"] .site-header::after {
  background: linear-gradient(90deg, transparent, rgba(15,118,110,0.18), rgba(15,118,110,0.32), rgba(15,118,110,0.18), transparent);
}

html { scroll-padding-top: var(--gb-header-h); }
body:has(#site-header) { padding-top: var(--gb-header-h) !important; }
body:has(#site-header) #main-content,
body:has(#site-header) main#main-content,
body:has(#site-header) > main {
  padding-top: 0;
  scroll-margin-top: var(--gb-header-h);
}
body:has(#site-header) #main-content > .section:first-child,
body:has(#site-header) main > .section:first-child {
  padding-top: max(1.25rem, env(safe-area-inset-top, 0px));
}
@supports not selector(body:has(#site-header)) {
  body { padding-top: 0 !important; }
}
body:has(.admin-layout) { padding-top: 0 !important; }

.header-inner {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: var(--gb-header-h);
  gap: 0.75rem;
  min-width: 0;
  overflow: visible !important;
}
.site-header .header-inner {
  min-height: var(--gb-header-h);
  height: var(--gb-header-h);
  overflow: visible !important;
  width: 96%;
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 0.35rem;
}

/* Logo */
.logo {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #f1f5f9;
  font-family: 'Outfit', Inter, system-ui, sans-serif;
  font-weight: 700;
  font-size: 1.18rem;
  flex-shrink: 0;
  letter-spacing: -0.03em;
  text-decoration: none;
  transition: opacity 0.15s ease;
}
.logo:hover { opacity: 0.9; color: #f1f5f9; }
.logo-text { display: inline-flex; align-items: baseline; line-height: 1; }
.logo-glow {
  background: linear-gradient(135deg, #14b8a6, #2dd4bf 45%, #818cf8);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 800;
}
.logo-bright {
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc;
  font-weight: 700;
}
[data-theme="light"] .logo-glow {
  background: linear-gradient(135deg, #0f766e, #14b8a6 45%, #4f46e5) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}
[data-theme="light"] .logo-bright {
  color: #0f172a !important;
  -webkit-text-fill-color: #0f172a !important;
}
[data-theme="dark"] .logo-glow {
  background: linear-gradient(135deg, #14b8a6, #2dd4bf 45%, #818cf8) !important;
  -webkit-background-clip: text !important;
  background-clip: text !important;
  -webkit-text-fill-color: transparent !important;
}
[data-theme="dark"] .logo-bright {
  color: #f8fafc !important;
  -webkit-text-fill-color: #f8fafc !important;
}
.logo-mark { display: flex; flex-shrink: 0; }
.logo-mark svg { display: block; }
.logo-stack {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 0.05rem;
  min-width: 0;
  line-height: 1.15;
}
.logo-tagline {
  display: block;
  font-family: Inter, system-ui, sans-serif;
  font-size: 0.58rem;
  font-weight: 500;
  color: #64748b;
  max-width: 200px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
[data-theme="dark"] .logo-tagline { color: #94a3b8; }
@media (max-width: 700px) {
  .logo-tagline { max-width: 120px; font-size: 0.52rem; }
}

.site-logo-img {
  display: block;
  width: auto;
  height: 40px;
  max-width: min(200px, 48vw);
  object-fit: contain;
  object-position: left center;
}
.site-logo-img--header { height: 40px; max-width: min(200px, 46vw); }
.site-logo-img--footer { height: 52px; max-width: min(240px, 60vw); }
.site-logo-img--admin { height: 36px; max-width: 170px; display: inline-block; vertical-align: middle; }
.site-logo-img--auth { height: 56px; max-width: min(240px, 80%); margin: 0 0 0.75rem; }
.logo:has(.site-logo-img) { gap: 0.45rem; align-items: center; min-height: 40px; }
@media (max-width: 560px) {
  .site-logo-img--header { height: 34px; max-width: min(160px, 42vw); }
}

/* Theme toggle */
.theme-toggle {
  display: flex;
  align-items: center;
  gap: 0.3rem;
  padding: 2px;
  border-radius: 9999px;
  cursor: pointer;
  border: none;
  background: transparent;
}
.theme-toggle-track {
  width: 40px;
  height: 22px;
  background: rgba(30, 41, 59, 0.85);
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 9999px;
  position: relative;
  transition: border-color 0.15s ease;
}
.theme-toggle:hover .theme-toggle-track { border-color: rgba(20, 184, 166, 0.4); }
[data-theme="light"] .theme-toggle-track {
  background: #e2e8f0;
  border-color: rgba(15, 23, 42, 0.08);
}
.theme-toggle-thumb {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 16px;
  height: 16px;
  background: linear-gradient(135deg, #14b8a6, #6366f1);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s cubic-bezier(0.16, 1, 0.3, 1);
  color: #fff;
  box-shadow: 0 1px 3px rgba(15, 118, 110, 0.3);
}
[data-theme="light"] .theme-toggle-thumb { transform: translateX(18px); }
.theme-toggle-thumb .icon-sun { display: none; }
.theme-toggle-thumb .icon-moon { display: block; }
[data-theme="light"] .theme-toggle-thumb .icon-sun { display: block; }
[data-theme="light"] .theme-toggle-thumb .icon-moon { display: none; }
.theme-label {
  font-size: 0.68rem;
  font-weight: 600;
  color: #94a3b8;
  min-width: 26px;
}
[data-theme="light"] .theme-label { color: #64748b; }

.header-actions {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  flex-shrink: 0;
}

/* Search */
.header-search {
  position: relative;
  flex: 1 1 auto;
  max-width: 210px;
  min-width: 110px;
  margin-inline: 0.3rem;
}
.header-search-input {
  width: 100%;
  height: 34px;
  padding: 0 0.85rem 0 2.05rem;
  border-radius: 9999px;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(15, 23, 42, 0.45);
  color: #f1f5f9;
  font-size: 0.84rem;
  font-weight: 500;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease, background 0.15s ease;
}
.header-search-input:hover {
  border-color: rgba(20, 184, 166, 0.28);
  background: rgba(15, 23, 42, 0.6);
}
.header-search-input:focus {
  border-color: rgba(20, 184, 166, 0.48);
  box-shadow: 0 0 0 3px rgba(20, 184, 166, 0.1);
  background: rgba(15, 23, 42, 0.75);
}
.header-search-input::placeholder { color: #64748b; }
[data-theme="light"] .header-search-input {
  background: #f8fafc;
  border-color: rgba(15, 23, 42, 0.07);
  color: #0f172a;
}
[data-theme="light"] .header-search-input:hover {
  border-color: rgba(15, 118, 110, 0.28);
  background: #fff;
}
[data-theme="light"] .header-search-input:focus {
  border-color: rgba(15, 118, 110, 0.42);
  box-shadow: 0 0 0 3px rgba(15, 118, 110, 0.08);
  background: #fff;
}
[data-theme="light"] .header-search-input::placeholder { color: #94a3b8; }
.header-search::before {
  content: '';
  position: absolute;
  left: 0.72rem;
  top: 50%;
  transform: translateY(-50%);
  width: 12px;
  height: 12px;
  background: currentColor;
  opacity: 0.36;
  mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2' d='M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z'/%3E%3C/svg%3E") center / contain no-repeat;
  -webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' fill='none' viewBox='0 0 24 24' stroke='white'%3E%3Cpath stroke-linecap='round' stroke-linejoin='round' stroke-width='2.2' d='M21 21l-4.35-4.35M17 11A6 6 0 1 1 5 11a6 6 0 0 1 12 0z'/%3E%3C/svg%3E") center / contain no-repeat;
  pointer-events: none;
  color: #94a3b8;
  z-index: 1;
}
@media (max-width: 900px) { .header-search { max-width: 130px; } }
@media (max-width: 700px) { .header-search { display: none; } }

.gb-profile-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  height: 34px;
  border-radius: 50%;
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(30, 41, 59, 0.4);
  overflow: hidden;
  flex-shrink: 0;
  text-decoration: none;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.gb-profile-btn:hover {
  color: #14b8a6;
  border-color: rgba(20, 184, 166, 0.38);
  background: rgba(20, 184, 166, 0.08);
}
[data-theme="light"] .gb-profile-btn {
  color: #64748b;
  border-color: rgba(15, 23, 42, 0.07);
  background: #f1f5f9;
}
[data-theme="light"] .gb-profile-btn:hover {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.3);
  background: #fff;
}
.gb-profile-avatar {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 50%;
}

.gb-more-btn {
  display: inline-flex;
  align-items: center;
  gap: 0.3rem;
  height: 34px;
  padding: 0 0.7rem;
  border-radius: 8px;
  color: #94a3b8;
  border: 1px solid rgba(148, 163, 184, 0.14);
  background: rgba(30, 41, 59, 0.3);
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}
.gb-more-btn:hover,
.gb-more-btn[aria-expanded="true"] {
  color: #14b8a6;
  border-color: rgba(20, 184, 166, 0.32);
  background: rgba(20, 184, 166, 0.07);
}
[data-theme="light"] .gb-more-btn {
  color: #475569;
  border-color: rgba(15, 23, 42, 0.07);
  background: #f8fafc;
}
[data-theme="light"] .gb-more-btn:hover,
[data-theme="light"] .gb-more-btn[aria-expanded="true"] {
  color: #0f766e;
  border-color: rgba(15, 118, 110, 0.28);
  background: #fff;
}
.gb-more-icon {
  display: flex;
  flex-direction: column;
  gap: 2.5px;
  width: 13px;
}
.gb-more-icon span {
  display: block;
  height: 1.5px;
  background: currentColor;
  border-radius: 1px;
}
