/* Дополнения поверх дизайн-системы Nocturne: адаптив, анимации, интерактив,
   которых не было в статичном макете. tokens.css / icons.css не трогаем —
   всё новое живёт здесь. */

:root {
  --color-danger: #e5484d;
  --color-danger-bg: color-mix(in srgb, var(--color-danger) 16%, transparent);
  --color-success: #3dd68c;
  --color-success-bg: color-mix(in srgb, var(--color-success) 16%, transparent);
  --header-h: 56px;
}

html {
  scroll-behavior: smooth;
}
@media (prefers-reduced-motion: reduce) {
  html { scroll-behavior: auto; }
  *, *::before, *::after { animation-duration: 0.001ms !important; animation-iteration-count: 1 !important; transition-duration: 0.001ms !important; }
}

/* — плавающее пятно света на фоне — тонкое дыхание вместо статики — */
.aurora-blob {
  animation: aurora-drift 16s ease-in-out infinite alternate;
  will-change: transform, opacity;
}
@keyframes aurora-drift {
  0%   { transform: translate(0, 0) scale(1);       opacity: 0.9; }
  50%  { transform: translate(28px, 18px) scale(1.08); opacity: 1; }
  100% { transform: translate(-16px, 10px) scale(0.98); opacity: 0.85; }
}

/* — плавное появление блоков при загрузке/прокрутке — */
.reveal {
  opacity: 0;
  transform: translateY(14px);
  transition: opacity 0.55s ease, transform 0.55s ease;
}
.reveal.is-visible { opacity: 1; transform: none; }

/* — карточки чуть приподнимаются под курсором — */
.card { transition: transform 0.18s ease, box-shadow 0.18s ease; }
a.card:hover, .card.card-hoverable:hover { transform: translateY(-3px); }

/* — кнопки: лёгкий отклик на нажатие — */
.btn { transition: background 0.15s ease, border-color 0.15s ease, transform 0.08s ease, opacity 0.15s ease; }
.btn:active:not(:disabled) { transform: scale(0.97); }

/* — спиннер в кнопках на время запроса — */
.btn.is-loading { pointer-events: none; opacity: 0.75; }
.btn.is-loading .btn-label { visibility: hidden; }
.btn.is-loading .btn-spinner { display: inline-flex; }
.btn-spinner {
  display: none; position: absolute; align-items: center; justify-content: center;
}
.btn { position: relative; }
.spin { animation: mrp-spin 0.8s linear infinite; display: inline-flex; }
@keyframes mrp-spin { to { transform: rotate(360deg); } }

/* — плейсхолдеры вместо картинок (в макете не было готовых фото) — */
.img-slot {
  position: absolute; inset: 0; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 6px; text-align: center;
  padding: 12px;
  background:
    radial-gradient(circle at 30% 20%, color-mix(in srgb, var(--color-accent) 20%, transparent), transparent 60%),
    var(--color-neutral-900);
  color: color-mix(in srgb, var(--color-text) 45%, transparent);
}
.img-slot i { font-size: 22px; color: color-mix(in srgb, var(--color-accent) 70%, var(--color-text)); }
.img-slot span { font-size: 11px; letter-spacing: 0.02em; }

/* — баннеры сообщений (ошибка/успех/инфо) — */
.banner {
  display: flex; align-items: flex-start; gap: 8.4px; padding: 8.4px 11.2px;
  border-radius: 8px; font-size: 13px; line-height: 1.4;
}
.banner-info { background: color-mix(in srgb, var(--color-accent) 14%, transparent); color: var(--color-accent-200); }
.banner-error { background: var(--color-danger-bg); color: #ffbdbf; }
.banner-success { background: var(--color-success-bg); color: #baf4d6; }
.field-error { color: #ffbdbf; font-size: 12px; margin-top: 4px; }

/* — тосты — */
.toast-stack {
  position: fixed; right: 16px; bottom: 16px; z-index: 500;
  display: flex; flex-direction: column; gap: 8px; width: min(340px, calc(100vw - 32px));
}
.toast {
  display: flex; align-items: flex-start; gap: 8px; padding: 11px 12px;
  border-radius: 10px; background: var(--color-surface); box-shadow: var(--shadow-lg);
  font-size: 13px; line-height: 1.4; color: var(--color-text);
  animation: toast-in 0.25s ease;
}
.toast[data-leaving="1"] { animation: toast-out 0.2s ease forwards; }
.toast i { font-size: 17px; flex: none; margin-top: 1px; }
.toast[data-type="success"] i { color: var(--color-success); }
.toast[data-type="error"] i { color: var(--color-danger); }
.toast[data-type="info"] i { color: var(--color-accent); }
@keyframes toast-in { from { opacity: 0; transform: translateY(8px); } to { opacity: 1; transform: none; } }
@keyframes toast-out { to { opacity: 0; transform: translateY(8px); } }

/* — мобильная шапка и выезжающее меню (в макете сайдбар был только для десктопа) — */
.mobile-topbar { display: none; }
.aside-backdrop { display: none; }

@media (max-width: 900px) {
  .mobile-topbar {
    display: flex; align-items: center; justify-content: space-between;
    gap: 8px; padding: 10px 14px; border-bottom: 1px solid var(--color-divider);
    position: sticky; top: 0; background: var(--color-bg); z-index: 40;
  }
  .layout-with-aside > aside {
    position: fixed; top: 0; left: 0; height: 100vh; width: min(280px, 84vw);
    z-index: 60; background: var(--color-bg);
    transform: translateX(-100%); transition: transform 0.25s ease;
    box-shadow: var(--shadow-lg); overflow-y: auto;
  }
  .layout-with-aside.aside-open > aside { transform: translateX(0); }
  .aside-backdrop {
    display: block; position: fixed; inset: 0; z-index: 55;
    background: color-mix(in srgb, black 55%, transparent);
    opacity: 0; pointer-events: none; transition: opacity 0.2s ease;
  }
  .aside-backdrop.is-open { opacity: 1; pointer-events: auto; }
}

/* — состояние "авторизован" в шапке — */
#mrp-auth-slot .who { display: flex; align-items: center; gap: 8px; font-size: 13px; padding: 0 8.4px; color: var(--color-neutral-300); }
#mrp-auth-slot .who strong { color: var(--color-text); font-weight: 500; }

/* — фокус для доступности на карточках-ссылках и кастомных чекбоксах — */
a.card:focus-visible { outline: 2px solid var(--color-accent); outline-offset: 2px; }

/* — таблица кодов: новая строка мягко подсвечивается — */
@keyframes row-flash {
  from { background: color-mix(in srgb, var(--color-accent) 22%, transparent); }
  to { background: transparent; }
}
.table tbody tr.is-new { animation: row-flash 1.6s ease; }

/* — копирование кода: мгновенная обратная связь — */
.copied::after {
  content: 'Скопировано';
  margin-left: 6px; font-size: 11px; color: var(--color-success);
}

/* Компоненты вроде .dialog-backdrop/.banner/.empty-state сами задают display —
   без !important атрибут [hidden] не срабатывает (правило класса перебивает
   стандартное [hidden]{display:none}). */
[hidden] { display: none !important; }

.text-center { text-align: center; }
.empty-state {
  display: flex; flex-direction: column; align-items: center; gap: 8px;
  padding: 33.6px 16.8px; text-align: center; color: var(--color-neutral-400);
  border: 1px dashed var(--color-divider); border-radius: 8px;
}
.empty-state i { font-size: 26px; color: var(--color-accent); }
