
/* ============================================================
   PRETTY PATCH v5.0
   ============================================================ */

/* ==== Тосты (top-right) ==== */
.nw-toasts {
  position: fixed;
  top: 16px;
  right: 16px;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 8px;
  max-width: 340px;
  pointer-events: none;
}
.nw-toast {
  display: flex;
  align-items: flex-start;
  gap: 10px;
  padding: 12px 14px 14px;
  background: var(--bg-elev);
  border: 1px solid var(--border-hi);
  border-radius: 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.45), 0 0 0 1px rgba(255,255,255,0.03);
  pointer-events: auto;
  cursor: pointer;
  opacity: 0;
  transform: translateX(40px) scale(0.96);
  transition: opacity .25s cubic-bezier(.4,0,.2,1), transform .25s cubic-bezier(.4,0,.2,1);
  position: relative;
  overflow: hidden;
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  min-width: 260px;
}
.nw-toast.show {
  opacity: 1;
  transform: translateX(0) scale(1);
}
.nw-toast-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 7px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 1px;
}
.nw-toast-success .nw-toast-icon { background: rgba(74,222,128,.14); color: #4ade80; }
.nw-toast-error   .nw-toast-icon { background: rgba(255,107,107,.14); color: #ff8585; }
.nw-toast-info    .nw-toast-icon { background: rgba(75,142,255,.14); color: #7baeff; }
.nw-toast-warn    .nw-toast-icon { background: rgba(251,191,36,.14); color: #fbbf24; }
.nw-toast-body { flex: 1; min-width: 0; }
.nw-toast-msg {
  font-size: 13px;
  color: var(--text);
  line-height: 1.45;
  font-weight: 500;
  word-break: break-word;
}
.nw-toast-bar {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  width: 100%;
  background: rgba(255,255,255,0.05);
  transform-origin: left;
  border-radius: 0 0 12px 12px;
}
.nw-toast-bar.run::after {
  content: '';
  position: absolute;
  inset: 0;
  background: currentColor;
  animation: nwToastBar linear forwards;
  transform-origin: left;
  transform: scaleX(1);
}
.nw-toast-success .nw-toast-bar::after { color: #4ade80; }
.nw-toast-error   .nw-toast-bar::after { color: #ff6b6b; }
.nw-toast-info    .nw-toast-bar::after { color: #4b8eff; }
.nw-toast-warn    .nw-toast-bar::after { color: #fbbf24; }
@keyframes nwToastBar {
  from { transform: scaleX(1); }
  to   { transform: scaleX(0); }
}

/* Скрываем старый тост */
.toast { display: none !important; }

/* ==== Модалки — плавнее ==== */
.modal-overlay {
  opacity: 0;
  transition: opacity .18s ease;
}
.modal-overlay.open { opacity: 1; }
.modal-overlay.visible .modal-box,
.modal-overlay.visible .legal-modal {
  transform: scale(1);
  opacity: 1;
}
.modal-box, .legal-modal {
  transform: scale(0.96);
  opacity: 0;
  transition: transform .2s cubic-bezier(.34, 1.3, .64, 1), opacity .18s ease;
}

/* ==== Кнопки — тактильность ==== */
.icon-btn:active,
.comp-btn:active,
.send-btn:active:not(:disabled),
.plan-btn:active:not(:disabled),
.at-tab:active,
.side-nav-item:active,
.new-chat:active {
  transform: scale(0.96);
}

/* ==== Hover у навигации в сайдбаре — сдвиг ==== */
.side-nav-item {
  transition: background .15s, color .15s, padding-left .15s;
}
.side-nav-item:hover {
  padding-left: 14px;
}
.side-nav-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 16px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.side-nav-item { position: relative; padding-left: 10px; }

/* ==== Плавный скролл сообщений ==== */
.messages {
  scroll-behavior: smooth;
}
.messages * {
  scroll-margin-top: 80px;
}

/* ==== Фокус у полей ==== */
.composer:focus-within,
.admin-input:focus,
.field input:focus {
  box-shadow: 0 0 0 3px rgba(var(--accent-rgb), 0.12);
  transition: box-shadow .18s, border-color .18s;
}

/* ==== Кнопка темы ==== */
#nwThemeBtn {
  transition: transform .2s cubic-bezier(.34, 1.3, .64, 1), background .12s, color .12s;
}
#nwThemeBtn:hover {
  transform: rotate(15deg) scale(1.06);
}
#nwThemeBtn:active {
  transform: rotate(0deg) scale(0.94);
}

/* ==== Скелетон загрузки ==== */
@keyframes nwShimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}
.stat-card.loading,
.admin-table.loading td {
  background: linear-gradient(90deg,
    rgba(255,255,255,0.02) 0%,
    rgba(255,255,255,0.06) 50%,
    rgba(255,255,255,0.02) 100%);
  background-size: 200% 100%;
  animation: nwShimmer 1.6s linear infinite;
}

/* ==== Меню пользователя — плавный выезд ==== */
.user-menu {
  animation: nwMenuIn .22s cubic-bezier(.34, 1.3, .64, 1);
}
@keyframes nwMenuIn {
  from { opacity: 0; transform: translateY(8px) scale(0.97); }
  to   { opacity: 1; transform: translateY(0) scale(1); }
}

/* ==== Плавное появление карточек тарифов в чате ==== */
.plan {
  animation: nwCardIn .35s cubic-bezier(.4, 0, .2, 1) backwards;
}
@keyframes nwCardIn {
  from { opacity: 0; transform: translateY(10px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ==== Кнопки с плавным hover ==== */
.new-chat, .plan-btn, .btn-primary-sm, .btn-danger-sm, .send-btn {
  transition: transform .15s cubic-bezier(.34, 1.3, .64, 1), background .15s, box-shadow .15s, opacity .15s;
}

/* ==== Активная вкладка админки ==== */
.at-tab {
  position: relative;
  transition: background .15s, color .15s;
}
.at-tab.active {
  background: var(--bg-active);
}
.at-tab.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 20%;
  bottom: 20%;
  width: 3px;
  background: var(--accent);
  border-radius: 0 3px 3px 0;
}
.at-tab { padding-left: 14px; }

/* ==== Фокус-ринг только для клавиатуры ==== */
button:focus { outline: none; }
button:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}
