/* =====================================================================
   Navi UI Kit — современные компоненты в духе 21st.dev / shadcn
   Аддитивный слой поверх navi.css. Использует те же токены (--ng-*).
   Подключается ОТДЕЛЬНО в base.html — можно снять одной строкой.
   ===================================================================== */

/* ── 1. Top loading bar (nprogress-стиль) ── */
#nv-progress {
  position: fixed; top: 0; left: 0; height: 3px; width: 0;
  z-index: 10500;
  background: linear-gradient(90deg, var(--ng-blue), var(--ng-blue-lt));
  box-shadow: 0 0 10px rgba(42,102,176,.6);
  opacity: 0;
  transition: width .2s ease, opacity .3s ease;
  border-radius: 0 2px 2px 0;
}
#nv-progress.on { opacity: 1; }

/* ── 2. Тосты (sonner-стиль) ── */
#nv-toasts {
  position: fixed; top: 18px; right: 18px; z-index: 10600;
  display: flex; flex-direction: column; gap: 10px;
  max-width: 360px; pointer-events: none;
}
.nv-toast {
  pointer-events: auto;
  display: flex; align-items: flex-start; gap: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-left: 4px solid var(--ng-blue);
  border-radius: var(--radius-sm);
  box-shadow: var(--shadow-lg);
  padding: 12px 14px;
  font-size: 13.5px; color: var(--text);
  transform: translateX(120%); opacity: 0;
  transition: transform .32s cubic-bezier(.22,1,.36,1), opacity .32s;
}
.nv-toast.in { transform: translateX(0); opacity: 1; }
.nv-toast.out { transform: translateX(120%); opacity: 0; }
.nv-toast .nv-t-ico { font-size: 17px; line-height: 1.3; flex: 0 0 auto; }
.nv-toast .nv-t-body { flex: 1 1 auto; line-height: 1.4; }
.nv-toast .nv-t-close { cursor: pointer; color: var(--text-soft); border: none; background: none; padding: 0 2px; font-size: 15px; }
.nv-toast .nv-t-close:hover { color: var(--text); }
.nv-toast.-success { border-left-color: var(--success); }
.nv-toast.-success .nv-t-ico { color: var(--success); }
.nv-toast.-danger  { border-left-color: var(--danger); }
.nv-toast.-danger  .nv-t-ico { color: var(--danger); }
.nv-toast.-warning { border-left-color: var(--warning); }
.nv-toast.-warning .nv-t-ico { color: var(--warning); }
.nv-toast.-info    { border-left-color: var(--ng-blue); }
.nv-toast.-info    .nv-t-ico { color: var(--ng-blue); }

/* ── 3. Командная палитра ⌘K ── */
#nv-cmdk-backdrop {
  position: fixed; inset: 0; z-index: 10700;
  background: rgba(14,19,32,.45);
  backdrop-filter: blur(3px);
  display: none; align-items: flex-start; justify-content: center;
  padding-top: 12vh;
}
#nv-cmdk-backdrop.open { display: flex; }
#nv-cmdk {
  width: 100%; max-width: 560px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  animation: nv-pop .16s ease;
}
@keyframes nv-pop { from { transform: scale(.96) translateY(-6px); opacity: .4; } to { transform: scale(1) translateY(0); opacity: 1; } }
#nv-cmdk .nv-cmdk-search {
  display: flex; align-items: center; gap: 10px;
  padding: 14px 16px; border-bottom: 1px solid var(--border);
}
#nv-cmdk .nv-cmdk-search i { color: var(--text-soft); font-size: 16px; }
#nv-cmdk input {
  flex: 1; border: none; outline: none; background: none;
  font-size: 15px; color: var(--text); font-family: inherit;
}
#nv-cmdk .nv-cmdk-hint { font-size: 11px; color: var(--text-soft); border: 1px solid var(--border); border-radius: 5px; padding: 2px 6px; }
#nv-cmdk-list { max-height: 56vh; overflow-y: auto; padding: 6px; }
#nv-cmdk-list .nv-cmdk-group { font-size: 10.5px; text-transform: uppercase; letter-spacing: .1em; color: var(--text-soft); padding: 10px 12px 4px; font-weight: 700; }
#nv-cmdk-list a {
  display: flex; align-items: center; gap: 11px;
  padding: 9px 12px; border-radius: var(--radius-sm);
  color: var(--text); font-size: 14px; text-decoration: none;
}
#nv-cmdk-list a i { width: 18px; text-align: center; color: var(--text-muted); font-size: 15px; }
#nv-cmdk-list a.sel, #nv-cmdk-list a:hover { background: var(--ng-blue-soft); color: var(--ng-blue-deep); }
#nv-cmdk-list a.sel i, #nv-cmdk-list a:hover i { color: var(--ng-blue); }
#nv-cmdk-list .nv-cmdk-empty { padding: 24px; text-align: center; color: var(--text-soft); font-size: 13px; }

/* ── 4. Skeleton shimmer ── */
.skeleton {
  position: relative; overflow: hidden;
  background: var(--surface-alt);
  border-radius: 6px; min-height: 14px;
}
.skeleton::after {
  content: ''; position: absolute; inset: 0;
  transform: translateX(-100%);
  background: linear-gradient(90deg, transparent, rgba(255,255,255,.6), transparent);
  animation: nv-shimmer 1.3s infinite;
}
@keyframes nv-shimmer { 100% { transform: translateX(100%); } }
.skeleton-line { height: 12px; margin: 6px 0; }
.skeleton-line.w-60 { width: 60%; } .skeleton-line.w-40 { width: 40%; } .skeleton-line.w-80 { width: 80%; }

/* ── 5. Copy-to-clipboard ── */
.nv-copy {
  cursor: pointer; border: none; background: none; padding: 0 4px;
  color: var(--text-soft); font-size: 13px; transition: color .15s;
  vertical-align: middle;
}
.nv-copy:hover { color: var(--ng-blue); }
.nv-copy.copied { color: var(--success); }

/* ── 6. Back-to-top ── */
#nv-top {
  position: fixed; bottom: 92px; left: 24px; z-index: 9000;
  width: 40px; height: 40px; border-radius: 10px;
  background: var(--surface); border: 1px solid var(--border);
  color: var(--text-muted); box-shadow: var(--shadow);
  display: none; align-items: center; justify-content: center;
  cursor: pointer; transition: all .15s;
}
#nv-top:hover { color: var(--ng-blue); border-color: var(--border-strong); transform: translateY(-2px); }
#nv-top.show { display: flex; }
@media (max-width: 992px){ #nv-top { left: 16px; bottom: 80px; } }

/* ── 7. Анимация чисел ── */
.nv-count { font-variant-numeric: tabular-nums; }

/* ── 8. Плавная модалка (scale-in) ── */
.modal.fade .modal-dialog { transform: scale(.97) translateY(-8px); transition: transform .2s cubic-bezier(.22,1,.36,1); }
.modal.show .modal-dialog { transform: scale(1) translateY(0); }
.modal-content { border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-lg); }
.modal-backdrop.show { backdrop-filter: blur(2px); }

/* ── 9. Empty-state ── */
.nv-empty {
  text-align: center; padding: 40px 20px; color: var(--text-soft);
}
.nv-empty .nv-empty-ico { font-size: 38px; color: var(--border-strong); display: block; margin-bottom: 10px; }
.nv-empty .nv-empty-t { font-size: 14px; font-weight: 600; color: var(--text-muted); }
.nv-empty .nv-empty-s { font-size: 12.5px; margin-top: 3px; }

/* ── 10. Контент fade-in при загрузке ── */
.content > * { animation: nv-fade .35s ease both; }
@keyframes nv-fade { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: translateY(0); } }

/* ── 11. Микро-полировка ── */
.btn:active { transform: translateY(1px); }
.tooltip-inner { background: var(--ng-ink); border-radius: 7px; font-size: 12px; padding: 6px 10px; }
.tooltip.bs-tooltip-top .tooltip-arrow::before { border-top-color: var(--ng-ink); }
.tooltip.bs-tooltip-bottom .tooltip-arrow::before { border-bottom-color: var(--ng-ink); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: var(--border-strong); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--text-soft); }

@media (prefers-reduced-motion: reduce) {
  .content > *, .nv-toast, #nv-cmdk, .skeleton::after { animation: none !important; transition: none !important; }
}

/* ── 12. Крест-подсветка строки/столбца при наведении (все таблицы) ──
   Как в суточных/табеле; inset-тень поверх любого фона ячейки.
   Отключить для таблицы: атрибут data-nv-nocross. */
tr.nv-row-hl > td, tr.nv-row-hl > th { box-shadow: inset 0 0 0 9999px rgba(42, 102, 176, .08); }
td.nv-col-hl, th.nv-col-hl { box-shadow: inset 0 0 0 9999px rgba(42, 102, 176, .08); }
tr.nv-row-hl > td.nv-col-hl, tr.nv-row-hl > th.nv-col-hl {
  box-shadow: inset 0 0 0 9999px rgba(42, 102, 176, .18);
}
