/* =====================================================================
   HEADER - Cyber Glow Edition v1.1 (FIXED)
   Виправлено: темні кнопки меню і мови
   ===================================================================== */

:root {
  --header-height: 56px;
  --header-bg: rgba(11, 11, 15, 0.85);
  --header-border: rgba(255, 255, 255, 0.08);
  --header-shadow: 0 4px 24px rgba(0, 0, 0, 0.15),
                   0 0 40px var(--neon-primary-glow-08);
  
  /* Neon glow */
  --neon-primary: var(--k-primary, #ff6b35);
  --neon-secondary: var(--k-success, #60c20f);
  --neon-cyan: #00d9ff;

  /* Accent alpha helpers (override in light theme) */
  --neon-primary-soft: rgba(255, 107, 53, 0.15);
  --neon-primary-border: rgba(255, 107, 53, 0.2);
  --neon-primary-glow-05: rgba(255, 107, 53, 0.05);
  --neon-primary-glow-08: rgba(255, 107, 53, 0.08);
  --neon-primary-glow-10: rgba(255, 107, 53, 0.10);
  --neon-primary-glow-20: rgba(255, 107, 53, 0.20);
  --neon-primary-glow-50: rgba(255, 107, 53, 0.50);
  --neon-primary-glow-70: rgba(255, 107, 53, 0.70);
  
  /* Градієнти */
  --gradient-primary: linear-gradient(135deg, #ff6b35, #ff8f6b);
  --gradient-glow: linear-gradient(135deg, var(--neon-primary-glow-20), rgba(96, 194, 15, 0.2));
  
  /* ВИПРАВЛЕННЯ: Темні кольори для кнопок */
  --header-btn-bg: rgba(26, 26, 36, 0.7);
  --header-btn-border: rgba(255, 255, 255, 0.12);
  --header-btn-hover-bg: rgba(26, 26, 36, 0.9);
  --header-btn-hover-border: rgba(255, 255, 255, 0.2);
}

/* ===== ОСНОВНИЙ КОНТЕЙНЕР ===== */
.header-glass {
  position: sticky;
  top: 0;
  left: 0;
  right: 0;
  z-index: 1000;
  height: var(--header-height);
  
  /* Glassmorphism */
  background: var(--header-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  
  /* Borders & shadows */
  border-bottom: 1px solid var(--header-border);
  box-shadow: var(--header-shadow);
  
  /* Layout */
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--k-space-4, 16px);
  padding: 0 var(--k-space-4, 16px);
  
  /* Анімація */
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Hover effect */
.header-glass::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-glow);
  opacity: 0;
  transition: opacity 0.3s ease;
  pointer-events: none;
}

.header-glass:hover::before {
  opacity: 0.15;
}

/* ===== LAYOUT SECTIONS ===== */
.header-left,
.header-center,
.header-right {
  display: flex;
  align-items: center;
  gap: var(--k-space-3, 12px);
  height: 100%;
}



/* ===== HEADER ACTION ICONS (COMPACT) ===== */
.header-glass .header-right .btn{
  position: relative;
  width: 34px;
  height: 34px;
  padding: 0 !important;
  gap: 0 !important;
  border-width: 1px;
  border-radius: 12px;
}

.header-glass .header-right .btn i{
  font-size: 15px;
}

/* Green dot indicators (notifications / friend requests) */
.header-glass .header-right .btn .kp-indicator-dot{
  position: absolute;
  top: 6px;
  right: 6px;
  width: 9px;
  height: 9px;
  border-radius: 999px;
  background: var(--neon-secondary);
  box-shadow:
    0 0 0 2px rgba(11, 11, 15, 0.9),
    0 0 14px rgba(96, 194, 15, 0.65);
  pointer-events: none;
}

.header-glass .header-right .btn .badge{
  position: absolute;
  top: 4px;
  right: 4px;
  margin-left: 0 !important;
  transform: none !important;
  padding: 2px 6px;
  font-size: 11px;
  border-radius: 999px;
  min-width: 18px;
  justify-content: center;
  pointer-events: none;
}



/* ===== HEADER POPOVERS (notifications / friends) ===== */
.header-popover{ position: relative; }

.header-popover-panel{
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: min(360px, calc(100vw - 18px));
  border-radius: 16px;
  border: 1px solid rgba(255,255,255,0.10);
  background: rgba(18,18,24,0.78);
  backdrop-filter: blur(12px);
  box-shadow: 0 18px 60px rgba(0,0,0,0.55);
  overflow: hidden;
  z-index: 1200;
}

.header-popover-panel .hp-head{
  padding: 10px 12px;
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.header-popover-panel .hp-title{
  font-weight: 700;
  font-size: 14px;
  letter-spacing: .2px;
}

.header-popover-panel .hp-body{
  max-height: 340px;
  overflow: auto;
  padding: 6px;
}

.header-popover-panel .hp-item{
  display: flex;
  gap: 10px;
  align-items: flex-start;
  padding: 10px;
  border-radius: 14px;
}
.header-popover-panel .hp-item:hover{
  background: rgba(255,255,255,0.06);
}

.header-popover-panel .hp-dot{
  width: 8px;
  height: 8px;
  border-radius: 999px;
  margin-top: 5px;
  background: var(--neon-secondary);
  flex: 0 0 auto;
  box-shadow: 0 0 14px rgba(96, 194, 15, 0.55);
}

.header-popover-panel .hp-msg{
  flex: 1 1 auto;
  font-size: 13px;
  line-height: 1.35;
}

.header-popover-panel .hp-time{
  margin-top: 4px;
  font-size: 11px;
  opacity: 0.75;
  white-space: nowrap;
}

.header-popover-panel .hp-empty{
  padding: 12px;
  font-size: 13px;
  opacity: 0.75;
}

.header-popover-panel .hp-foot{
  padding: 10px 12px;
  border-top: 1px solid rgba(255,255,255,0.08);
  display: flex;
  justify-content: flex-end;
}

.header-popover-panel .hp-link{
  font-size: 13px;
  text-decoration: none;
  opacity: 0.9;
}
.header-popover-panel .hp-link:hover{ opacity: 1; text-decoration: underline; }

/* tighter hit-area on very small screens */
@media (max-width: 480px){
  .header-glass .header-right .btn{
    width: 34px;
    height: 34px;
    border-radius: 10px;
  }
  .header-glass .header-right .btn i{
    font-size: 15px;
  }
  .header-glass .header-right .btn .kp-indicator-dot{
    top: 5px;
    right: 5px;
    width: 8px;
    height: 8px;
  }
  .header-glass .header-right .btn .badge{
    top: 3px;
    right: 3px;
    min-width: 16px;
    padding: 2px 5px;
    font-size: 10px;
  }
}

.header-left {
  flex-shrink: 0;
}

.header-center {
  flex: 1;
  justify-content: center;
  max-width: 600px;
}

.header-right {
  flex-shrink: 0;
  gap: 6px;
}

/* ===== LOGO ===== */
.header-logo {
  display: flex;
  align-items: center;
  gap: 4px;
  text-decoration: none;
  padding: var(--k-space-2, 8px) var(--k-space-3, 12px);
  border-radius: var(--k-radius-lg, 12px);
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.header-logo::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.header-logo:hover::before {
  opacity: 0.1;
}

.logo-text {
  font-size: 18px;
  font-weight: 700;
  letter-spacing: -0.02em;
  background: var(--gradient-primary);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  position: relative;
  z-index: 1;
}

.logo-dot {
  font-size: 20px;
  color: var(--neon-secondary);
  animation: pulse-dot 2s ease-in-out infinite;
  position: relative;
  z-index: 1;
}

@keyframes pulse-dot {
  0%, 100% { 
    opacity: 1; 
    transform: scale(1);
  }
  50% { 
    opacity: 0.7; 
    transform: scale(1.2);
  }
}

/* ===== MENU BUTTON (ВИПРАВЛЕНО) ===== */
.header-menu-btn {
  position: relative;
  width: 34px;
  height: 34px;
  display: flex;
  align-items: center;
  justify-content: center;
  
  /* ТЕМНИЙ ФОН */
  background: var(--header-btn-bg) !important;
  border: 1px solid var(--header-btn-border) !important;
  border-radius: var(--k-radius-lg, 10px);
  
  transition: all 0.2s ease;
  cursor: pointer;
  color: rgba(255, 255, 255, 0.9) !important;
}

.header-menu-btn::before {
  content: '';
  position: absolute;
  inset: -1px;
  background: var(--gradient-primary);
  border-radius: var(--k-radius-lg, 10px);
  opacity: 0;
  transition: opacity 0.2s ease;
  z-index: -1;
}

.header-menu-btn:hover {
  background: var(--header-btn-hover-bg) !important;
  border-color: var(--header-btn-hover-border) !important;
  transform: translateY(-1px);
}

.header-menu-btn:hover::before {
  opacity: 0.3;
}

.header-menu-btn[aria-expanded="true"] {
  background: var(--neon-primary-soft) !important;
  border-color: var(--neon-primary-border) !important;
  box-shadow: 0 0 20px var(--neon-primary-glow-20);
}

.header-menu-btn i.chev {
  color: rgba(255, 255, 255, 0.95);
  font-size: 12.5px;
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.header-menu-btn[aria-expanded="true"] i.chev {
  transform: rotate(180deg);
}

/* ===== LANGUAGE BUTTON (ВИПРАВЛЕНО) ===== */
.header-lang-dropdown {
  position: relative;
}

.header-lang-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  
  /* ТЕМНИЙ ФОН */
  background: var(--header-btn-bg) !important;
  border: 1px solid var(--header-btn-border) !important;
  border-radius: var(--k-radius-lg, 12px);
  
  font-size: 12.5px;
  font-weight: 500;
  color: rgba(255, 255, 255, 0.9) !important;
  transition: all 0.2s ease;
  cursor: pointer;
  height: 34px;
}

.header-lang-btn:hover {
  background: var(--header-btn-hover-bg) !important;
  border-color: var(--header-btn-hover-border) !important;
  transform: translateY(-1px);
}

.header-lang-btn .fa-globe {
  color: var(--neon-cyan);
  font-size: 13px;
}

.lang-code {
  font-weight: 600;
  letter-spacing: 0.02em;
  color: rgba(255, 255, 255, 0.95);
}

.header-lang-btn .ml-half {
  margin-left: 4px;
}

.header-lang-btn i {
  color: rgba(255, 255, 255, 0.8);
}

/* Dropdown list */
.lang-dropdown-list {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  min-width: 180px;
  background: rgba(26, 26, 36, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--k-radius-lg, 12px);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
              0 0 20px var(--neon-primary-glow-10);
  padding: var(--k-space-2, 8px);
  list-style: none;
  margin: 0;
  z-index: 1001;
  animation: slideDown 0.2s ease-out;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.lang-dropdown-list li {
  margin: 0;
}

.lang-item {
  display: flex;
  align-items: center;
  gap: var(--k-space-2, 8px);
  padding: var(--k-space-2, 8px) var(--k-space-3, 12px);
  border-radius: var(--k-radius-md, 8px);
  text-decoration: none;
  color: rgba(255, 255, 255, 0.8);
  font-size: 13px;
  font-weight: 500;
  transition: all 0.2s ease;
}

.lang-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: #fff;
  transform: translateX(4px);
}

.lang-item.active {
  background: var(--neon-primary-soft);
  color: var(--neon-primary);
  border: 1px solid var(--neon-primary-border);
}

.flag-icon {
  font-size: 18px;
  width: 24px;
  text-align: center;
}

/* ===== INLINE MENU ===== */
.header-menu-inline {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  background: rgba(11, 11, 15, 0.95);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3),
              0 0 40px var(--neon-primary-glow-05);
  z-index: 999;
  max-height: 0;
  overflow: hidden;
  opacity: 0;
  transition: max-height 0.3s cubic-bezier(0.4, 0, 0.2, 1), 
              opacity 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: max-height, opacity;
}

.header-menu-inline.show {
  max-height: 400px;
  opacity: 1;
}

.header-menu-inline nav.tabs {
  border: none;
  background: transparent;
  padding: var(--k-space-3, 12px) var(--k-space-4, 16px);
  margin-bottom: 0;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: thin;
  scrollbar-color: var(--neon-primary-glow-50) transparent;
}

.header-menu-inline nav.tabs::-webkit-scrollbar {
  height: 4px;
}

.header-menu-inline nav.tabs::-webkit-scrollbar-track {
  background: transparent;
}

.header-menu-inline nav.tabs::-webkit-scrollbar-thumb {
  background: var(--neon-primary-glow-50);
  border-radius: 2px;
}

.header-menu-inline nav.tabs::-webkit-scrollbar-thumb:hover {
  background: var(--neon-primary-glow-70);
}

.header-menu-inline .tab {
  min-height: 44px;
  padding: var(--k-space-2, 8px) var(--k-space-3, 12px);
  border-radius: var(--k-radius-lg, 12px);
  transition: all 0.2s ease;
  background: transparent;
  position: relative;
}

.header-menu-inline .tab::before {
  content: '';
  position: absolute;
  inset: 0;
  background: var(--gradient-primary);
  border-radius: var(--k-radius-lg, 12px);
  opacity: 0;
  transition: opacity 0.2s ease;
}

.header-menu-inline .tab:hover,
.header-menu-inline .tab:focus {
  background: rgba(255, 255, 255, 0.05);
  transform: translateY(-1px);
}

.header-menu-inline .tab:hover::before {
  opacity: 0.1;
}

.header-menu-inline .tab.active {
  background: rgba(var(--accent-rgb, 255, 107, 53), 0.15);
  border: 1px solid rgba(var(--accent-rgb, 255, 107, 53), 0.3);
  color: var(--page-accent, #ff6b35);
  box-shadow: 0 0 20px rgba(var(--accent-rgb, 255, 107, 53), 0.2);
}

/* ===== АДАПТИВНІСТЬ ===== */

/* Tablet */
@media (max-width: 992px) {
  .header-glass {
    padding: 0 var(--k-space-3, 12px);
    gap: var(--k-space-3, 12px);
  }
  
  .header-logo .logo-text {
    font-size: 15px;
  }
  
  .header-center {
    display: none;
  }
}

/* Mobile */
@media (max-width: 768px) {
  :root {
    --header-height: 52px;
  }
  
  .header-glass {
    padding: 0 var(--k-space-2, 8px);
    gap: var(--k-space-2, 8px);
  }
  
  .header-left,
  .header-right {
    gap: var(--k-space-2, 8px);
  }
  
  .header-logo {
    padding: var(--k-space-1, 4px) var(--k-space-2, 8px);
  }
  
  .header-logo .logo-text {
    font-size: 13px;
  }
  
  .header-menu-btn {
    width: 34px;
    height: 34px;
  }
  
  .header-lang-btn {
    padding: var(--k-space-2, 8px);
    font-size: 12px;
  }
  
  .header-lang-btn .lang-code {
    display: none;
  }
  
  .header-menu-inline.show {
    max-height: 300px;
  }
  
  .header-menu-inline .tab {
    font-size: 13px;
    min-height: 34px;
  }
}

/* Small mobile */
@media (max-width: 480px) {
  .header-logo .logo-dot {
    display: none;
  }
}

/* ===== ACCESSIBILITY ===== */
.visually-hidden {
  position: absolute;
  width: 1px;
  height: 1px;
  padding: 0;
  margin: -1px;
  overflow: hidden;
  clip: rect(0, 0, 0, 0);
  white-space: nowrap;
  border-width: 0;
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
  .header-glass,
  .header-menu-btn,
  .header-lang-btn,
  .header-menu-inline,
  .header-menu-inline .tab,
  .logo-dot {
    transition: none !important;
    animation: none !important;
  }
}

/* ===== LIGHT THEME ===== */
[data-theme="light"] {
  --header-bg: rgba(255, 255, 255, 0.85);
  --header-border: rgba(0, 0, 0, 0.08);
  --header-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  --header-btn-bg: rgba(0, 0, 0, 0.05);
  --header-btn-border: rgba(0, 0, 0, 0.12);
  --header-btn-hover-bg: rgba(0, 0, 0, 0.08);
  --header-btn-hover-border: rgba(0, 0, 0, 0.2);

  --gradient-primary: linear-gradient(135deg, #2563eb, #60a5fa);

  /* Accent alpha helpers (blue) */
  --neon-primary-soft: rgba(37, 99, 235, 0.15);
  --neon-primary-border: rgba(37, 99, 235, 0.2);
  --neon-primary-glow-05: rgba(37, 99, 235, 0.05);
  --neon-primary-glow-08: rgba(37, 99, 235, 0.08);
  --neon-primary-glow-10: rgba(37, 99, 235, 0.10);
  --neon-primary-glow-20: rgba(37, 99, 235, 0.20);
  --neon-primary-glow-50: rgba(37, 99, 235, 0.50);
  --neon-primary-glow-70: rgba(37, 99, 235, 0.70);
}

[data-theme="light"] .header-menu-btn,
[data-theme="light"] .header-lang-btn {
  color: rgba(0, 0, 0, 0.9) !important;
}

[data-theme="light"] .header-menu-btn i,
[data-theme="light"] .header-lang-btn i {
  color: rgba(0, 0, 0, 0.7);
}

[data-theme="light"] .lang-dropdown-list {
  background: rgba(255, 255, 255, 0.95);
  border-color: rgba(0, 0, 0, 0.1);
}

[data-theme="light"] .lang-item {
  color: rgba(0, 0, 0, 0.8);
}

[data-theme="light"] .lang-item:hover {
  background: rgba(0, 0, 0, 0.05);
  color: #000;
}

[data-theme="light"] .header-menu-inline {
  background: rgba(255, 255, 255, 0.95);
  border-bottom: 1px solid rgba(0, 0, 0, 0.10);
}

[data-theme="light"] .header-menu-inline .tab:hover,
[data-theme="light"] .header-menu-inline .tab:focus {
  background: rgba(0, 0, 0, 0.04);
}

[data-theme="light"] .header-popover-panel {
  background: rgba(255, 255, 255, 0.92);
  border-color: rgba(0, 0, 0, 0.10);
  box-shadow: 0 18px 60px rgba(0, 0, 0, 0.18);
}

[data-theme="light"] .header-popover-panel .hp-item:hover {
  background: rgba(0, 0, 0, 0.04);
}

/* ===== Header activity (work / attack) ===== */
.header-activity {
  display: inline-flex;
  align-items: center;
  padding: 6px 12px;
  margin-right: 8px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.10);
  color: rgba(255, 255, 255, 0.88);
  font-size: 13px;
  line-height: 1;
  text-decoration: none;
  white-space: nowrap;
}

.header-activity:hover {
  background: rgba(255, 255, 255, 0.10);
  border-color: rgba(255, 255, 255, 0.18);
}

[data-theme="light"] .header-activity {
  background: rgba(0, 0, 0, 0.04);
  border-color: rgba(0, 0, 0, 0.10);
  color: rgba(0, 0, 0, 0.85);
}

[data-theme="light"] .header-activity:hover {
  background: rgba(0, 0, 0, 0.06);
  border-color: rgba(0, 0, 0, 0.15);
}
