/* ============================================================
   eco-max-vh.css — VH (night-max, 2026-09-08): уведомления,
   тосты, бейджи и диплинки уровня MAX для messenger.vyshka.cloud.
   Слой-компаньон eco-max-vh.js (презентационный, идемпотентный).
   Канон: #f6f8fc/#ffffff/#0f172a/#516180/#1a56db/#3b82f6,
   тёмная #0b1220/#111c2e/#edf3ff/#6b96ff, радиусы 16/12/20, Onest.
   API/БД/ws.js/?v= — не тронуты. Вставки помечены data-vh-*.
   --- Волна B (W012, 2026-09-09): 100% hardcoded переведён на
   глобальные токены (surface/text/border/accent + --accent-grad-2
   из eco-week-b.css с fallback); отдельный dark-блок §5 схлопнут —
   тёмная тема теперь получается автоматически из skin-v2 §1b.
   Визуальные дельты задокументированы в evidence/w012-019. ---
   ============================================================ */

/* ---------- 1. Контейнер тостов ---------- */
.vh-toasts {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 260;
  display: flex;
  flex-direction: column;
  gap: 10px;
  width: 372px;
  max-width: calc(100vw - 40px);
  pointer-events: none;
}

.vh-toast {
  pointer-events: auto;
  display: grid;
  grid-template-columns: auto minmax(0, 1fr) auto;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  background: var(--surface);
  color: var(--text);
  border: 1px solid var(--border);
  border-radius: 16px;
  box-shadow: var(--shadow-pop);
  cursor: pointer;
  font-family: "Onest", -apple-system, "Segoe UI", sans-serif;
  animation: vh-toast-in 0.32s cubic-bezier(0.2, 0.9, 0.3, 1.2) both;
  transition: transform 0.16s ease, opacity 0.22s ease;
}

/* hover-отклик — transform-first (бриф §8: предпочитать transform/opacity);
   отдельная тень-hover упразднена при переводе на var(--shadow-pop) */
.vh-toast:hover {
  transform: translateY(-1px);
}

.vh-toast.is-leaving {
  opacity: 0;
  transform: translateY(6px) scale(0.98);
  pointer-events: none;
}

.vh-toast:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* световая полоса канона слева */
.vh-toast::before {
  content: "";
  position: absolute;
  left: 0;
  top: 12px;
  bottom: 12px;
  width: 3px;
  border-radius: 0 3px 3px 0;
  background: linear-gradient(180deg, var(--accent-grad-2, #3b82f6), var(--accent));
}

.vh-toast {
  position: relative;
  overflow: hidden;
}

/* ---------- 2. Аватар отправителя ---------- */
/* color:#ffffff сохранён литералом осознанно: фон — насыщенная
   инлайн-палитра eco-max-vh.js (AV_COLORS), одинакова в обеих темах;
   --accent-ink здесь был бы НЕПРАВИЛЕН (в dark он тёмный) */
.vh-toast__ava {
  width: 40px;
  height: 40px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  color: #ffffff;
  font-size: 14px;
  font-weight: 700;
  letter-spacing: 0.02em;
  flex-shrink: 0;
  user-select: none;
}

/* ---------- 3. Тело тоста ---------- */
.vh-toast__body {
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.vh-toast__label {
  font-size: 10.5px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.vh-toast__name {
  font-size: 14px;
  font-weight: 600;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.vh-toast__text {
  font-size: 13px;
  line-height: 1.35;
  color: var(--text-muted);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* ---------- 4. Кнопки звука и закрытия ---------- */
.vh-toast__actions {
  display: flex;
  flex-direction: column;
  gap: 4px;
  align-self: flex-start;
}

.vh-toast__btn {
  width: 28px;
  height: 28px;
  display: grid;
  place-items: center;
  border: none;
  border-radius: 8px;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: background 0.14s ease, color 0.14s ease;
  -webkit-tap-highlight-color: transparent;
}

.vh-toast__btn:hover {
  background: var(--surface-2);
  color: var(--text);
}

.vh-toast__btn svg {
  display: block;
}

.vh-toast__btn.is-muted {
  color: #94a3b8; /* состояние «выключено» — нейтраль вне канона тем */
}

/* ---------- 5. Тёмная тема ----------
   Волна B: блок схлопнут в токены — все значения ниже получаются
   автоматически из html[data-theme=dark] (skin-v2 §1b):
   surface #111c2e / text #edf3ff / border #223049 / muted #9fb0cd /
   shadow-pop / градиент акцента. */

/* ---------- 6. Мобильная раскладка (390) ---------- */
@media (max-width: 860px) {
  .vh-toasts {
    left: 12px;
    right: 12px;
    bottom: auto;
    top: calc(10px + var(--safe-top, 0px));
    width: auto;
    max-width: none;
  }

  .vh-toast {
    animation-name: vh-toast-in-mobile;
  }

  .vh-toast.is-leaving {
    transform: translateY(-6px) scale(0.98);
  }
}

@keyframes vh-toast-in {
  from {
    opacity: 0;
    transform: translateX(28px) scale(0.96);
  }
  to {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes vh-toast-in-mobile {
  from {
    opacity: 0;
    transform: translateY(-16px) scale(0.97);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

/* ---------- 7. Бейдж на вкладках (sidenav/bottomnav) ---------- */
/* color:#ffffff сохранён литералом: 17px градиентный бейдж вне топ-10
   --accent-ink волны B (белый на #2563eb-конце = 5.3:1); кандидат
   на сплошной акцент + чернила в W018 */
.vh-navbadge {
  position: absolute;
  left: calc(50% + 5px);
  top: 5px;
  min-width: 17px;
  height: 17px;
  padding: 0 5px;
  border-radius: 9px;
  display: none;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, var(--accent-grad-2, #3b82f6), var(--accent));
  color: #ffffff;
  font-family: "Onest", -apple-system, "Segoe UI", sans-serif;
  font-size: 10.5px;
  font-weight: 700;
  line-height: 1;
  letter-spacing: 0.01em;
  box-shadow: 0 2px 6px rgba(26, 86, 219, 0.4);
  pointer-events: none;
  animation: vh-badge-in 0.28s cubic-bezier(0.2, 0.9, 0.3, 1.3) both;
}

.vh-navbadge.is-on {
  display: flex;
}

.bottomnav__btn .vh-navbadge {
  top: 2px;
  left: calc(50% + 6px);
}

@keyframes vh-badge-in {
  from {
    opacity: 0;
    transform: scale(0.4);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* подскок при росте счётчика (класс вешается на один кадр анимации) */
.vh-pop {
  animation: vh-badge-pop 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

@keyframes vh-badge-pop {
  0% {
    transform: scale(1);
  }
  45% {
    transform: scale(1.28);
  }
  100% {
    transform: scale(1);
  }
}

/* ---------- 8. Анимация появления бейджа в списке чатов ---------- */
.chat-row__badge.vh-pop {
  animation: vh-badge-pop 0.42s cubic-bezier(0.2, 0.9, 0.3, 1.4);
}

/* лёгкая подсветка ряда с новым непрочитанным */
.chat-row.vh-row-flash .chat-row__name {
  color: var(--accent);
  transition: color 0.5s ease;
}

/* ---------- 9. Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .vh-toast,
  .vh-navbadge,
  .vh-pop,
  .chat-row__badge.vh-pop {
    animation: none !important;
  }

  .vh-toast {
    transition: none;
  }
}
