/* ============================================================
   MOOD HEADER — шапка сайта, написана с нуля на mood-base.css.
   Три зоны: бренд · навигация-таблетки · действия.
   ============================================================ */

.casino-header.mood-header-v2 {
  position: sticky;
  top: 0;
  z-index: var(--z-sticky);
  width: 100%;
  background: var(--glass);
  border-bottom: 1px solid var(--border);
  -webkit-backdrop-filter: blur(20px) saturate(1.4);
  backdrop-filter: blur(20px) saturate(1.4);
  transition: box-shadow var(--transition), background var(--transition);
}
.casino-header.mood-header-v2.casino-header--scrolled { box-shadow: var(--shadow-md); }

.mood-header__inner {
  display: flex;
  align-items: center;
  gap: var(--space-4);
  min-height: var(--mood-header-h);
  max-width: var(--content-max);
  margin-inline: auto;
  padding: 0 var(--gutter);
}

/* Логотип бренда живёт только в боковом меню, в шапке его нет —
   поэтому навигация начинает ряд слева. */

/* ——— Верхняя навигация: таблетки ——— */
.mood-top-nav {
  display: flex;
  align-items: center;
  gap: 2px;
  margin-right: auto;
  padding: 4px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
}

.mood-top-nav__link {
  position: relative;
  padding: 8px 16px;
  border-radius: var(--radius-pill);
  color: var(--text-muted);
  font-size: 14px;
  font-weight: 700;
  white-space: nowrap;
  transition: color var(--transition), background var(--transition);
}
.mood-top-nav__link:hover { color: var(--text); background: var(--surface-3); }
.mood-top-nav__link.active {
  color: var(--btn-primary-text);
  background: var(--grad-brand);
  box-shadow: var(--shadow-cta);
}

/* ——— Зона действий ——— */
.mood-header__actions {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  flex-shrink: 0;
  margin-left: auto;
}

.header-utils { display: flex; align-items: center; gap: 6px; }

.header-util-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text-muted);
  transition: color var(--transition), background var(--transition), border-color var(--transition), transform var(--dur-1) var(--ease-out);
}
.header-util-btn:hover {
  color: var(--accent);
  border-color: var(--accent);
  background: var(--accent-dim);
  transform: translateY(-1px);
}
.header-util-btn svg { width: 17px; height: 17px; }

/* Иконки темы: показываем ту, что предлагает переключение */
.theme-icon-sun { display: none; }
.theme-icon-moon { display: block; }
html[data-theme="light"] .theme-icon-sun { display: block; }
html[data-theme="light"] .theme-icon-moon { display: none; }

.sidebar-lang-flag {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  font-weight: 800;
  letter-spacing: 0.02em;
}

/* ——— Центральный док (гость / авторизован) ——— */
.header-center-dock { display: flex; align-items: center; gap: var(--space-3); }
.header-buttons { display: flex; align-items: center; gap: var(--space-2); }
.header-buttons.hidden { display: none !important; }

.header-guest-btn { padding: 9px 18px; font-size: 14px; }

/* Баланс */
.header-balance-slot { position: relative; }
.header-balance-trigger {
  display: inline-flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 12px 8px 11px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
  font-weight: 700;
  transition: border-color var(--transition), background var(--transition);
}
.header-balance-trigger:hover { border-color: var(--accent); background: var(--accent-dim); }
.header-balance-trigger-icon { display: inline-flex; color: var(--accent); }
.header-balance-trigger-text {
  display: inline-flex;
  align-items: baseline;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 14px;
  font-weight: 700;
}
.balance-bonus { font-size: 11px; color: var(--accent-2); }
.header-balance-chevron { display: inline-flex; color: var(--text-dim); transition: transform var(--transition); }
.header-balance-trigger[aria-expanded="true"] .header-balance-chevron { transform: rotate(180deg); }

/* Светлая тема: нейтральная таблетка баланса (без кораллового акцента как у Fleep) */
html[data-theme="light"] .header-balance-trigger {
  background: var(--surface);
  border-color: var(--border);
  color: var(--text);
}
html[data-theme="light"] .header-balance-trigger:hover,
html[data-theme="light"] .header-balance-trigger--open,
html[data-theme="light"] .header-balance-trigger[aria-expanded="true"] {
  background: var(--surface-2);
  border-color: var(--border-strong);
}
html[data-theme="light"] .header-balance-trigger-icon { color: var(--text-muted); }
html[data-theme="light"] .header-balance-trigger:hover .header-balance-trigger-icon,
html[data-theme="light"] .header-balance-trigger--open .header-balance-trigger-icon,
html[data-theme="light"] .header-balance-trigger[aria-expanded="true"] .header-balance-trigger-icon {
  color: var(--text);
}
html[data-theme="light"] .header-balance-trigger-text,
html[data-theme="light"] .header-balance-trigger .balance-main { color: var(--text); }

/* Уведомления */
.header-btn-notify, .header-btn-chat { position: relative; width: 38px; height: 38px; padding: 0; }
.header-notify-badge {
  position: absolute;
  top: -3px;
  right: -3px;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  border-radius: var(--radius-pill);
  background: var(--accent-2);
  color: #FFFFFF;
  font-size: 10px;
  font-weight: 800;
  line-height: 18px;
  text-align: center;
}

.header-btn-chat-label { display: none; }

/* Буст-индикатор */
.header-boost-indicator {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 11px;
  border-radius: var(--radius-pill);
  background: var(--warning-dim);
  color: var(--warning);
  font-size: 12px;
  font-weight: 700;
}
.header-boost-timer { font-family: var(--font-mono); }

/* ——— Бургер (мобильный) ——— */
.mood-header__menu-btn {
  display: none;
  align-items: center;
  justify-content: center;
  width: 38px;
  height: 38px;
  border-radius: var(--radius-sm);
  background: var(--surface-2);
  border: 1px solid var(--border);
  color: var(--text);
}
.mood-header__menu-btn:hover { border-color: var(--accent); color: var(--accent); }

/* ============================================================
   Выпадающие панели шапки (баланс, уведомления)
   ============================================================ */
.header-balance-dropdown,
.header-notify-dropdown {
  position: fixed;
  top: calc(var(--mood-header-h) + 8px);
  right: var(--gutter);
  z-index: var(--z-dropdown);
  width: min(360px, calc(100vw - 2 * var(--gutter)));
  max-height: min(560px, calc(100vh - var(--mood-header-h) - 32px));
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: mood-dropdown-in var(--dur-2) var(--ease-out);
}
.header-balance-dropdown.hidden,
.header-notify-dropdown.hidden { display: none !important; }

@keyframes mood-dropdown-in {
  from { opacity: 0; transform: translateY(-8px) scale(0.98); }
  to { opacity: 1; transform: none; }
}

.header-balance-sheet-backdrop,
.header-notify-sheet-backdrop {
  position: fixed;
  inset: 0;
  z-index: calc(var(--z-dropdown) - 1);
  background: rgba(5, 8, 13, 0.5);
}
.header-balance-sheet-backdrop.hidden,
.header-notify-sheet-backdrop.hidden { display: none !important; }

.header-balance-sheet-top,
.header-notify-sheet-top { display: none; }

.header-balance-dropdown-scroll { overflow-y: auto; padding: var(--space-4); }
.header-balance-dropdown-title,
.header-notify-head {
  margin-bottom: var(--space-3);
  font-family: var(--font-display);
  font-size: 15px;
  font-weight: 800;
  color: var(--text);
}
.header-notify-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-4) var(--space-4) var(--space-3);
  margin: 0;
  border-bottom: 1px solid var(--border);
}
.header-notify-readall {
  color: var(--accent);
  font-size: 12px;
  font-weight: 700;
}
.header-notify-readall:hover { text-decoration: underline; }

.header-balance-dropdown-list { display: flex; flex-direction: column; gap: 8px; }

/* — Счёт в валюте: строка списка «Ваши счета» — */
.header-balance-row {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: var(--space-3);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  border: 1px solid var(--border);
}
.header-balance-row--active {
  border-color: var(--accent);
  background: var(--accent-dim);
}
.header-balance-row-head {
  display: flex;
  align-items: center;
  gap: var(--space-2);
}
.header-balance-row-curr {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 800;
  letter-spacing: 0.03em;
  color: var(--text);
}
.header-balance-row-badge {
  padding: 2px 8px;
  border-radius: var(--radius-pill);
  background: var(--accent);
  color: var(--btn-primary-text);
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.04em;
  text-transform: uppercase;
}
.header-balance-row-lines { display: flex; flex-direction: column; gap: 3px; }
.header-balance-row-line {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: var(--space-3);
}
.header-balance-row-lbl { font-size: 12px; color: var(--text-dim); }
.header-balance-row-val {
  font-size: 13px;
  font-weight: 700;
  font-variant-numeric: tabular-nums;
  color: var(--text);
  white-space: nowrap;
}
.header-balance-switch-btn { width: 100%; justify-content: center; }

.header-balance-dropdown-error,
.header-balance-dropdown-empty {
  padding: var(--space-6) var(--space-4);
  text-align: center;
  font-size: 13px;
  line-height: 1.5;
  color: var(--text-muted);
}
.header-balance-dropdown-error { color: var(--danger); }
.header-notify-list { flex: 1; overflow-y: auto; padding: var(--space-2) var(--space-4); }
.header-notify-footer { padding: var(--space-3) var(--space-4); border-top: 1px solid var(--border); }
.header-notify-viewall {
  width: 100%;
  padding: 9px;
  border-radius: var(--radius-pill);
  background: var(--surface-2);
  color: var(--text);
  font-size: 13px;
  font-weight: 700;
  transition: background var(--transition);
}
.header-notify-viewall:hover { background: var(--accent-dim); color: var(--accent); }

/* Попап языков */
.sidebar-lang-popup {
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  z-index: var(--z-dropdown);
  width: 280px;
  max-height: 420px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  border-radius: var(--radius-lg);
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  box-shadow: var(--shadow-lg);
  animation: mood-dropdown-in var(--dur-2) var(--ease-out);
}
.sidebar-lang-popup.hidden { display: none !important; }
.header-lang-wrapper { position: relative; }

.sidebar-lang-popup-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: var(--space-3) var(--space-4);
  border-bottom: 1px solid var(--border);
}
.sidebar-lang-popup-title { font-weight: 800; font-size: 14px; }
.sidebar-lang-popup-close {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 26px; height: 26px;
  border-radius: 50%;
  color: var(--text-muted);
  font-size: 18px;
  line-height: 1;
}
.sidebar-lang-popup-close:hover { background: var(--surface-2); color: var(--text); }
.sidebar-lang-popup-body { overflow-y: auto; padding: var(--space-3); }
.sidebar-lang-popup-section + .sidebar-lang-popup-section { margin-top: var(--space-4); }
.sidebar-lang-popup-section-title {
  margin-bottom: 6px;
  font-size: 10px;
  font-weight: 800;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-dim);
}
.sidebar-lang-list { display: flex; flex-direction: column; gap: 2px; }
.sidebar-lang-list > * {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 8px 10px;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: background var(--transition), color var(--transition);
}
.sidebar-lang-list > *:hover { background: var(--surface-2); color: var(--text); }

/* Слот историй под шапкой */
.home-stories-top-slot { padding: var(--space-3) var(--gutter) 0; }
.home-stories-top-slot.hidden { display: none !important; }

/* ============================================================
   Смещение под левую панель. Шапка — сосед .casino-layout,
   поэтому отступ ей нужен свой, иначе панель накрывает логотип.
   ============================================================ */
@media (min-width: 1024px) {
  .casino-header.mood-header-v2,
  .home-stories-top-slot {
    margin-left: var(--mood-rail-w);
    width: calc(100% - var(--mood-rail-w));
    transition: margin-left var(--dur-3) var(--ease-out), width var(--dur-3) var(--ease-out);
  }
}

/* ============================================================
   Планшет и мобильный
   ============================================================ */
@media (max-width: 1279px) {
  .mood-top-nav__link { padding: 8px 12px; font-size: 13px; }
  .header-btn-profile--desktop { display: none; }
}

@media (max-width: 1023px) {
  .mood-top-nav { display: none; }
  .mood-header__menu-btn { display: inline-flex; }
  .mood-header__inner { gap: var(--space-3); }
  .header-utils { display: none; }
  .header-guest-btn { padding: 8px 14px; font-size: 13px; }
}

@media (max-width: 640px) {
  .header-brand-logo .logo-img { height: 28px; }
  .header-btn-notify { display: none; }
  .header-balance-trigger { padding: 7px 10px; }
  .header-balance-trigger-text { font-size: 13px; }

  /* Панели превращаются в нижние шиты */
  .header-balance-dropdown,
  .header-notify-dropdown {
    top: auto;
    right: 0;
    left: 0;
    bottom: 0;
    width: 100%;
    max-height: 82vh;
    border-radius: var(--radius-xl) var(--radius-xl) 0 0;
    animation: mood-sheet-in var(--dur-3) var(--ease-out);
  }
  .header-balance-sheet-top,
  .header-notify-sheet-top {
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    padding: var(--space-3) var(--space-4) 0;
  }
  .header-balance-sheet-handle,
  .header-notify-sheet-handle {
    width: 40px;
    height: 4px;
    border-radius: var(--radius-pill);
    background: var(--border-strong);
  }
  .header-balance-sheet-close,
  .header-notify-sheet-close {
    position: absolute;
    top: var(--space-2);
    right: var(--space-3);
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 32px; height: 32px;
    border-radius: 50%;
    background: var(--surface-2);
    color: var(--text-muted);
  }
}

@keyframes mood-sheet-in {
  from { transform: translateY(100%); }
  to { transform: none; }
}
