/* Общая шапка сайта — теперь одинаковая на всех страницах после логина
   (автор, 22.09.2026: "Давай 4 кнопки Магазин/Клан/Карта/В бой перенесём в
   хедер на всех страницах... хедер на всех страницах сайта один и тот же").
   Раньше у каждой темы была своя, слегка разная шапка (светлая hero.css у
   hero.html/clan.html, тёмная plain-шапка из style.css у map/shop/battle) —
   теперь она вынесена в отдельный файл, подключаемый на каждой странице ДО
   темы страницы, и не зависит ни от hero.css, ни от style.css: все цвета
   ниже — собственные константы, а не переменные из другого файла, чтобы
   шапка одинаково работала что на светлых, что на тёмных страницах.

   Порядок ссылок в <head>: header.css первым, затем стили самой страницы
   (hero.css/style.css/shop.css) — так их дополнительные точечные правки
   (например высота отступа снизу под мобильную панель) всегда побеждают. */

.hh-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 10px 24px;
  background: #ffffff;
  border-bottom: 1px solid #e3e7ef;
  position: sticky;
  top: 0;
  z-index: 90;
}

.hh-logo { display: flex; align-items: center; gap: 8px; text-decoration: none; color: #1a1f2b; flex-shrink: 0; }
.hh-logo-mark {
  width: 34px; height: 34px; border-radius: 9px; background: #12172a; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1.1rem;
}
.hh-logo-text { font-weight: 700; font-size: 1.05rem; white-space: nowrap; }

/* ---------- Навигация: Магазин / Клан / Карта / В бой ----------
   Именно эти 4 пункта, в этом порядке — "Герой" среди них нет, на страницу
   героя ведёт клик по лого выше. На десктопе это горизонтальный ряд прямо в
   шапке; ниже 860px тот же самый <nav> перестаёт быть частью шапки и
   становится закреплённой по низу экрана панелью вкладок (иконка сверху,
   подпись снизу), как в мобильном приложении — см. медиа-запрос ниже. */
.hh-nav { display: flex; align-items: center; gap: 4px; }
.hh-nav-link {
  display: flex; align-items: center; gap: 6px;
  padding: 8px 14px; border-radius: 10px; text-decoration: none;
  color: #1a1f2b; font-weight: 600; font-size: 0.88rem; white-space: nowrap;
}
.hh-nav-link:hover { background: #f4f5f8; }
.hh-nav-link-icon { font-size: 1rem; }
.hh-nav-link-active { background: #f4f5f8; }
.hh-nav-link-battle { background: #dc2626; color: #fff; }
.hh-nav-link-battle:hover { background: #b91c1c; }
.hh-nav-link-battle.hh-nav-link-active { background: #b91c1c; }

.hh-header-right { display: flex; align-items: center; gap: 12px; flex-shrink: 0; }

/* ---------- Валюта игрока: золото / наличные ----------
   Автор, 22.09.2026: "добавим в игру такое понятие как золото и наличные
   (вместо алмазов)... разместим их в хедер рядом с уведомлением и
   профилем". User.gold/User.cash — личный баланс игрока. С 23.09.2026 это
   ЕДИНСТВЕННОЕ место, куда попадает золото за бой — Clan.goldBalance убран
   из схемы целиком (клан больше не копит золото, см. комментарий у User.gold
   в prisma/schema.prisma и src/battle/resolve.ts). Ссылка ведёт в магазин —
   единственное место, куда эти деньги в итоге приведут. */
.hh-currency-group {
  display: flex; align-items: center; gap: 6px; text-decoration: none;
  padding: 4px; border-radius: 12px;
}
.hh-currency-group:hover { background: #f4f5f8; }
.hh-currency-chip {
  display: flex; align-items: center; gap: 4px;
  background: #f4f5f8; border: 1px solid #e3e7ef; border-radius: 999px;
  padding: 5px 10px; font-size: 0.82rem; font-weight: 700; color: #1a1f2b;
  white-space: nowrap;
}
.hh-currency-icon { font-size: 0.9rem; }

.hh-icon-btn {
  position: relative;
  width: 38px; height: 38px; border-radius: 10px;
  background: #f4f5f8; border: 1px solid #e3e7ef;
  font-size: 1.05rem; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
}
.hh-icon-btn-small { width: 30px; height: 30px; font-size: 0.9rem; }
.hh-dot { position: absolute; top: 5px; right: 6px; width: 7px; height: 7px; border-radius: 50%; background: #dc2626; }

.hh-user { position: relative; display: flex; align-items: center; gap: 8px; cursor: pointer; }
.hh-avatar {
  width: 36px; height: 36px; border-radius: 50%; background: #12172a; color: #fff;
  display: flex; align-items: center; justify-content: center; font-size: 1rem; overflow: hidden; flex-shrink: 0;
}
.hh-user-text { line-height: 1.2; }
.hh-user-name { font-weight: 600; font-size: 0.9rem; color: #1a1f2b; }
.hh-user-id { font-size: 0.72rem; color: #7c8494; }
.hh-chevron { color: #7c8494; font-size: 0.8rem; }
.hh-user-menu {
  position: absolute; right: 0; top: calc(100% + 8px); background: #ffffff;
  border: 1px solid #e3e7ef; border-radius: 10px;
  box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04), 0 1px 3px rgba(16, 24, 40, 0.06);
  min-width: 140px; padding: 6px; z-index: 95;
}
.hh-menu-item {
  display: block; width: 100%; text-align: left; padding: 8px 10px; border-radius: 6px;
  border: none; background: none; color: #1a1f2b; font: inherit; cursor: pointer;
}
.hh-menu-item:hover { background: #f4f5f8; }

/* ---------- Уведомления (выпадающая панель колокольчика) ----------
   Собирается через JS (wireNotifications в public/shared.js), не разметкой —
   см. комментарий там. Переиспользует .hh-user-menu как базу (тот же вид
   выпадашки), просто шире и со своим списком строк. */
.hh-notif-panel { min-width: 300px; max-width: 360px; max-height: 380px; overflow-y: auto; padding: 4px; }
.hh-notif-item {
  padding: 9px 10px; border-radius: 8px; cursor: pointer; border-bottom: 1px solid #f0f1f4;
}
.hh-notif-item:last-child { border-bottom: none; }
.hh-notif-item:hover { background: #f4f5f8; }
.hh-notif-item.unread { background: #fff7f0; }
.hh-notif-item.unread:hover { background: #fdeee0; }
.hh-notif-msg { font-size: 0.82rem; color: #1a1f2b; line-height: 1.35; }
.hh-notif-time { font-size: 0.7rem; color: #9aa2b1; margin-top: 3px; }

/* ---------- Модалка "Обращение в поддержку" (п.14) ----------
   Собирается через JS (wireSupportTickets в public/shared.js), не
   разметкой каждой страницы — см. комментарий там. */
.hh-modal-overlay {
  position: fixed; inset: 0; background: rgba(16, 20, 34, 0.55);
  display: flex; align-items: center; justify-content: center; z-index: 200; padding: 16px;
}
.hh-modal {
  background: #fff; border-radius: 14px; padding: 20px; width: 100%; max-width: 420px;
  box-shadow: 0 12px 40px rgba(16, 24, 40, 0.25);
}
.hh-modal-title { margin: 0 0 14px; font-size: 1.05rem; }
.hh-modal-label { display: block; font-size: 0.78rem; color: #7c8494; margin: 10px 0 4px; font-weight: 600; }
.hh-modal select, .hh-modal textarea {
  width: 100%; font: inherit; padding: 9px 10px; border-radius: 8px; border: 1px solid #e3e7ef;
  box-sizing: border-box; resize: vertical;
}
.hh-modal-btns { display: flex; justify-content: flex-end; gap: 8px; margin-top: 14px; }

/* ---------- Тост — общий для всех страниц ---------- */
.hh-toast {
  position: fixed; bottom: 20px; left: 50%; transform: translateX(-50%);
  background: #12172a; color: #fff; padding: 10px 18px; border-radius: 10px;
  font-weight: 600; box-shadow: 0 4px 14px rgba(0, 0, 0, 0.25); z-index: 300; font-size: 0.88rem;
  max-width: calc(100vw - 32px); text-align: center;
}

/* ---------- Мобильная версия: нав уходит вниз экрана, иконки+подписи ---------- */
@media (max-width: 860px) {
  .hh-header { padding: 10px 14px; }

  .hh-nav {
    position: fixed; left: 0; right: 0; bottom: 0; z-index: 95;
    background: #ffffff; border-top: 1px solid #e3e7ef;
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom, 0px));
    justify-content: space-between; gap: 2px;
    box-shadow: 0 -2px 10px rgba(16, 24, 40, 0.08);
  }
  .hh-nav-link {
    flex: 1 1 0; flex-direction: column; gap: 2px; padding: 6px 2px;
    border-radius: 10px; font-size: 0.62rem; text-align: center;
  }
  .hh-nav-link-icon { font-size: 1.3rem; }
  .hh-nav-link-battle { background: transparent; color: #dc2626; }
  .hh-nav-link-battle:hover, .hh-nav-link-battle.hh-nav-link-active { background: #fde8e8; color: #b91c1c; }

  /* Место под закреплённую снизу панель, чтобы контент под ней не
     перекрывался. На страницах со своей более специфичной обёрткой
     (.hh-main на hero.css-страницах уже даёт 90px снизу) это правило просто
     проигрывает по специфичности и ничего не меняет. */
  body main { padding-bottom: 92px; }
}

@media (max-width: 480px) {
  /* На совсем узких экранах прячем имя/ID в чипе профиля (аватар с
     шевроном по-прежнему открывает меню) — иначе шапка не помещается
     рядом с новыми чипами валюты. */
  .hh-user-text { display: none; }
  .hh-currency-chip { padding: 5px 7px; font-size: 0.76rem; }
}

/* ==========================================================================
   Фирменная тёмная шапка КЛАНСКИ (05.10.2026)
   Бренд — dark cinematic: тёмная древесно-угольная база, красно-оранжевые
   акценты (см. public/assets/brand/ и мастер-ТЗ). Блок стоит ПОСЛЕДНИМ в
   файле намеренно — он переопределяет светлые значения выше, не меняя
   разметку и логику шапки. Выпадающие панели (меню профиля, уведомления,
   модалка поддержки) остаются светлыми — это отдельные "карточки".
   ========================================================================== */
.hh-header {
  background: linear-gradient(180deg, #1b110b 0%, #0f0a07 100%);
  border-bottom: 1px solid #3a2415;
  box-shadow: 0 1px 0 rgba(255, 106, 31, 0.28), 0 6px 18px rgba(0, 0, 0, 0.35);
}
.hh-logo { gap: 10px; color: #efe3d3; }
.hh-logo-mark { width: auto; height: 36px; border-radius: 0; background: none; display: block; }
.hh-logo-word { display: block; height: 17px; width: auto; }
.hh-nav-link { color: #e9d7bd; }
.hh-nav-link:hover { background: rgba(255, 255, 255, 0.08); }
.hh-nav-link-active { background: rgba(255, 106, 31, 0.16); color: #ffd9a0; }
.hh-nav-link-battle { background: linear-gradient(180deg, #ff6a1f, #c0261a); color: #fff; }
.hh-nav-link-battle:hover { background: linear-gradient(180deg, #ff7d3a, #d02d1e); }
.hh-nav-link-battle.hh-nav-link-active { background: linear-gradient(180deg, #ff7d3a, #d02d1e); }
.hh-currency-group:hover { background: rgba(255, 255, 255, 0.06); }
.hh-currency-chip { background: rgba(255, 255, 255, 0.07); border-color: #3a2a1d; color: #f3e6d2; }
.hh-icon-btn { background: rgba(255, 255, 255, 0.07); border-color: #3a2a1d; color: #f3e6d2; }
.hh-avatar { background: #2a1a10; border: 1px solid #5a3a22; }
.hh-user-name { color: #f3e6d2; }
.hh-user-id, .hh-chevron { color: #a8927c; }

@media (max-width: 860px) {
  .hh-nav {
    background: #0f0a07; border-top: 1px solid #3a2415;
    box-shadow: 0 -2px 14px rgba(0, 0, 0, 0.5);
  }
  .hh-nav-link-battle { background: transparent; color: #ff6a1f; }
  .hh-nav-link-battle:hover, .hh-nav-link-battle.hh-nav-link-active { background: rgba(255, 106, 31, 0.16); color: #ff8a4a; }
  .hh-logo-mark { height: 32px; }
  .hh-logo-word { height: 15px; }
}
@media (max-width: 480px) {
  /* На узких экранах оставляем только знак-щит — слово не помещается рядом с валютой. */
  .hh-logo-word { display: none; }
}

/* Всплывающее окно у колокольчика (ТЗ 09.10.2026, п.5): «Всеобщий созыв! …» */
.hh-notif-toast {
  position: absolute; top: calc(100% + 12px); right: -8px; width: 280px; z-index: 60;
  display: flex; gap: 10px; align-items: center; padding: 12px 14px; cursor: pointer;
  background: rgba(24, 14, 9, 0.96); color: #f3e6d2; border: 1px solid rgba(255, 150, 60, 0.5); border-radius: 12px;
  box-shadow: 0 12px 36px rgba(0, 0, 0, 0.55), 0 0 18px rgba(255, 120, 30, 0.25);
  font-size: 14px; line-height: 1.3; text-align: left; white-space: normal;
  opacity: 0; transform: translateY(-8px); pointer-events: none; transition: opacity 0.25s ease, transform 0.25s ease;
}
.hh-notif-toast.on { opacity: 1; transform: none; pointer-events: auto; }
.hh-notif-toast::before { content: ""; position: absolute; top: -7px; right: 22px; width: 12px; height: 12px; background: inherit; border-left: 1px solid rgba(255, 150, 60, 0.5); border-top: 1px solid rgba(255, 150, 60, 0.5); transform: rotate(45deg); }
.hh-notif-toast.muster { border-color: #ffb347; box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 26px rgba(255, 160, 40, 0.5); animation: hhToastPulse 1.6s ease-in-out infinite; }
.hh-notif-toast-ico { font-size: 26px; flex: none; }
.hh-notif-toast-msg { font-weight: 600; }
@keyframes hhToastPulse { 50% { box-shadow: 0 12px 36px rgba(0, 0, 0, 0.6), 0 0 38px rgba(255, 170, 50, 0.8); } }
