/* ==========================================================================
   nightcore.fun — shared FX layer (nc-fx)
   Палитра сохранена: монохром #060606 / #141414 / #262626 / #f5f5f5 / #8c8c8c
   Статусные цвета: #22c55e / #eab308 / #ef4444.
   Подключается на всех страницах панели и sait: /static/css/nc-fx.css
   ========================================================================== */

@property --nc-ang { syntax: "<angle>"; inherits: false; initial-value: 0deg; }
@keyframes nc-spin { to { --nc-ang: 360deg; } }
@keyframes nc-rot { to { transform: rotate(360deg); } }
@keyframes nc-rise { from { opacity: 0; transform: translateY(18px); filter: blur(6px); } }
@keyframes nc-shake { 20%, 60% { transform: translateX(-8px); } 40%, 80% { transform: translateX(8px); } }

:root {
    --nc-bg: #060606;
    --nc-surface: #0e0e0e;
    --nc-card: #141414;
    --nc-line: #262626;
    --nc-line-2: #333333;
    --nc-text: #f5f5f5;
    --nc-muted: #8c8c8c;
    --nc-accent: #f0f0f0;
    --nc-ok: #22c55e;
    --nc-warn: #eab308;
    --nc-bad: #ef4444;
    --nc-ease: cubic-bezier(0.22, 1, 0.36, 1);
    --nc-spring: cubic-bezier(0.34, 1.56, 0.64, 1);
    --nc-glass: rgba(18, 18, 18, 0.62);
    --nc-glass-strong: rgba(12, 12, 12, 0.78);
    --nc-edge: rgba(255, 255, 255, 0.09);
    --nc-edge-strong: rgba(255, 255, 255, 0.2);
}

/* ---------- base ---------- */
html { scroll-behavior: smooth; -webkit-tap-highlight-color: transparent; }
::selection { background: rgba(255, 255, 255, 0.88); color: #0a0a0a; }
* { scrollbar-width: thin; scrollbar-color: #343434 transparent; }
*::-webkit-scrollbar { width: 9px; height: 9px; }
*::-webkit-scrollbar-track { background: transparent; }
*::-webkit-scrollbar-thumb {
    background: #2e2e2e; border-radius: 99px;
    border: 2px solid transparent; background-clip: padding-box;
    transition: background 0.2s;
}
*::-webkit-scrollbar-thumb:hover { background: #4a4a4a; background-clip: padding-box; border: 2px solid transparent; }
:focus-visible { outline: 2px solid rgba(255, 255, 255, 0.75); outline-offset: 2px; border-radius: 6px; }
input:focus-visible, textarea:focus-visible, select:focus-visible { outline: none; }

/* плавные переходы между страницами (Chrome/Edge: cross-document view transitions) */
@view-transition { navigation: auto; }
::view-transition-old(root) { animation: nc-vt-out 0.22s var(--nc-ease) both; }
::view-transition-new(root) { animation: nc-vt-in 0.38s var(--nc-ease) both; }
@keyframes nc-vt-out { to { opacity: 0; transform: translateY(-6px); filter: blur(4px); } }
@keyframes nc-vt-in { from { opacity: 0; transform: translateY(10px); filter: blur(4px); } }

/* ---------- animated background layer (JS: NC.bg()) ---------- */
.nc-bg {
    position: fixed; inset: 0; z-index: -1; overflow: hidden;
    pointer-events: none;
}
.nc-bg > * { position: absolute; }
.nc-bg .nc-aurora {
    width: 70vmax; height: 70vmax; border-radius: 50%;
    filter: blur(90px); opacity: 0.7; will-change: transform;
    background: radial-gradient(circle at 50% 50%, rgba(255, 255, 255, 0.2), rgba(255, 255, 255, 0) 62%);
}
.nc-bg .a1 { left: -22vmax; top: -30vmax; animation: nc-drift-a 18s ease-in-out infinite alternate; }
.nc-bg .a2 { right: -26vmax; top: -10vmax; opacity: 0.55; animation: nc-drift-b 22s ease-in-out infinite alternate; }
.nc-bg .a3 { left: 20vw; bottom: -42vmax; opacity: 0.45; animation: nc-drift-c 26s ease-in-out infinite alternate; }
@keyframes nc-drift-a { to { transform: translate3d(14vmax, 10vmax, 0) scale(1.18); } }
@keyframes nc-drift-b { to { transform: translate3d(-12vmax, 14vmax, 0) scale(0.9); } }
@keyframes nc-drift-c { to { transform: translate3d(10vmax, -8vmax, 0) scale(1.25); } }
.nc-bg .nc-grid {
    inset: 0;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.045) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.045) 1px, transparent 1px);
    background-size: 56px 56px;
    -webkit-mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 10%, transparent 75%);
    mask-image: radial-gradient(ellipse 80% 60% at 50% 0%, #000 10%, transparent 75%);
    animation: nc-grid-pan 40s linear infinite;
}
@keyframes nc-grid-pan { to { background-position: 56px 56px, 56px 56px; } }
.nc-bg canvas { inset: 0; width: 100%; height: 100%; opacity: 0.85; }
.nc-bg .nc-grain {
    inset: -50%; width: 200%; height: 200%; opacity: 0.045; mix-blend-mode: overlay;
    background-image: url("data:image/svg+xml;utf8,<svg xmlns='http://www.w3.org/2000/svg' width='160' height='160'><filter id='n'><feTurbulence type='fractalNoise' baseFrequency='0.9' numOctaves='2' stitchTiles='stitch'/><feColorMatrix values='0 0 0 0 1  0 0 0 0 1  0 0 0 0 1  0 0 0 1 0'/></filter><rect width='100%' height='100%' filter='url(%23n)'/></svg>");
    animation: nc-grain 1.2s steps(6) infinite;
}
@keyframes nc-grain {
    0% { transform: translate(0, 0); } 20% { transform: translate(-3%, 2%); } 40% { transform: translate(2%, -3%); }
    60% { transform: translate(-2%, -1%); } 80% { transform: translate(3%, 3%); } 100% { transform: translate(0, 0); }
}
.nc-bg .nc-vignette {
    inset: 0;
    background: radial-gradient(ellipse at 50% 40%, transparent 45%, rgba(0, 0, 0, 0.55) 100%);
}
/* фон body переносится на <html> скриптом (NC.bg), чтобы слой z-index:-1 был виден */
body.nc-has-bg { background: transparent !important; }

/* ---------- glass ---------- */
.nc-glass {
    background: var(--nc-glass);
    -webkit-backdrop-filter: blur(18px) saturate(1.35);
    backdrop-filter: blur(18px) saturate(1.35);
    border: 1px solid var(--nc-edge);
    box-shadow: 0 1px 0 rgba(255, 255, 255, 0.05) inset, 0 24px 60px -24px rgba(0, 0, 0, 0.8);
}

/* cursor spotlight layer: JS вставляет <i class="nc-glow"> в элементы [data-nc-glow] */
.nc-glow {
    position: absolute; inset: 0; border-radius: inherit; pointer-events: none; z-index: 0;
    opacity: 0; transition: opacity 0.35s var(--nc-ease);
    background: radial-gradient(360px circle at var(--mx, 50%) var(--my, 50%), rgba(255, 255, 255, 0.075), transparent 62%);
}
:hover > .nc-glow { opacity: 1; }

/* ripple (JS: NC.ripple) */
.nc-ripple {
    position: absolute; border-radius: 50%; pointer-events: none; z-index: 5;
    width: 12px; height: 12px; margin: -6px 0 0 -6px;
    background: rgba(255, 255, 255, 0.5); mix-blend-mode: soft-light;
    transform: scale(0); opacity: 0.9;
    animation: nc-ripple 0.65s var(--nc-ease) forwards;
}
@keyframes nc-ripple { to { transform: scale(var(--rs, 24)); opacity: 0; } }

/* scroll reveal */
[data-nc-reveal] {
    opacity: 0; transform: translateY(18px) scale(0.985); filter: blur(5px);
    transition: opacity 0.7s var(--nc-ease), transform 0.8s var(--nc-ease), filter 0.7s var(--nc-ease);
    transition-delay: calc(var(--nc-i, 0) * 60ms);
}
[data-nc-reveal].nc-in { opacity: 1; transform: none; filter: none; }

/* появление новых узлов после NC.patch */
.nc-enter { animation: nc-enter 0.7s var(--nc-ease) backwards; animation-delay: calc(var(--nc-i, 0) * 55ms); }
@keyframes nc-enter {
    from { opacity: 0; transform: translateY(16px) scale(0.97); filter: blur(6px); }
}

/* text shimmer: белый → серый градиент, бегущий блик */
.nc-shimmer {
    background: linear-gradient(100deg, #8c8c8c 0%, #f5f5f5 28%, #ffffff 40%, #8c8c8c 62%, #f5f5f5 100%);
    background-size: 220% 100%;
    -webkit-background-clip: text; background-clip: text;
    -webkit-text-fill-color: transparent; color: transparent;
    animation: nc-shimmer 7s linear infinite;
}
@keyframes nc-shimmer { to { background-position: -220% 0; } }

/* skeleton */
.nc-skeleton {
    position: relative; overflow: hidden; background: rgba(255, 255, 255, 0.04);
    border-radius: 10px; min-height: 14px;
}
.nc-skeleton::after {
    content: ""; position: absolute; inset: 0;
    background: linear-gradient(100deg, transparent 20%, rgba(255, 255, 255, 0.08) 50%, transparent 80%);
    transform: translateX(-100%); animation: nc-skel 1.4s ease-in-out infinite;
}
@keyframes nc-skel { to { transform: translateX(100%); } }

/* pulsing live dot */
.nc-pulse { position: relative; }
.nc-pulse::after {
    content: ""; position: absolute; inset: -4px; border-radius: 50%;
    border: 1.5px solid currentColor; opacity: 0;
    animation: nc-pulse 2.2s var(--nc-ease) infinite;
}
@keyframes nc-pulse { 0% { transform: scale(0.6); opacity: 0.7; } 80%, 100% { transform: scale(2.1); opacity: 0; } }

/* kbd */
.nc-kbd {
    display: inline-flex; align-items: center; justify-content: center; min-width: 20px; height: 20px;
    padding: 0 6px; border-radius: 6px; border: 1px solid var(--nc-line-2);
    background: rgba(255, 255, 255, 0.05); color: var(--nc-muted);
    font: 500 10.5px/1 "IBM Plex Mono", monospace;
    box-shadow: 0 1px 0 rgba(0, 0, 0, 0.5);
}

/* ---------- toast stack (JS: NC.toast) ---------- */
.nc-toasts {
    position: fixed; right: 18px; bottom: 18px; z-index: 9999;
    display: flex; flex-direction: column-reverse; gap: 10px; pointer-events: none;
    max-width: min(380px, calc(100vw - 36px));
}
.nc-toast {
    position: relative; overflow: hidden; pointer-events: auto;
    display: flex; align-items: flex-start; gap: 10px;
    padding: 12px 14px 14px; border-radius: 14px;
    background: var(--nc-glass-strong);
    -webkit-backdrop-filter: blur(18px) saturate(1.4); backdrop-filter: blur(18px) saturate(1.4);
    border: 1px solid var(--nc-edge-strong); color: var(--nc-text);
    font: 500 13px/1.4 "IBM Plex Sans", system-ui, sans-serif;
    box-shadow: 0 18px 50px -12px rgba(0, 0, 0, 0.85), 0 1px 0 rgba(255, 255, 255, 0.06) inset;
    animation: nc-toast-in 0.5s var(--nc-spring) both;
}
.nc-toast.out { animation: nc-toast-out 0.32s var(--nc-ease) forwards; }
.nc-toast .ic {
    flex: 0 0 auto; width: 20px; height: 20px; border-radius: 50%; display: grid; place-items: center;
    font-size: 12px; font-weight: 700; color: #0a0a0a; background: #cfcfcf; margin-top: 1px;
}
.nc-toast.ok .ic { background: var(--nc-ok); }
.nc-toast.err .ic { background: var(--nc-bad); color: #fff; }
.nc-toast.warn .ic { background: var(--nc-warn); }
.nc-toast.ok { border-color: rgba(34, 197, 94, 0.4); }
.nc-toast.err { border-color: rgba(239, 68, 68, 0.45); }
.nc-toast .tm { flex: 1; word-break: break-word; }
.nc-toast .bar {
    position: absolute; left: 0; bottom: 0; height: 2px; width: 100%;
    background: rgba(255, 255, 255, 0.55); transform-origin: left; animation: nc-toast-bar var(--nc-dur, 3.4s) linear forwards;
}
.nc-toast.ok .bar { background: var(--nc-ok); }
.nc-toast.err .bar { background: var(--nc-bad); }
@keyframes nc-toast-in { from { opacity: 0; transform: translateX(40px) scale(0.92); } }
@keyframes nc-toast-out { to { opacity: 0; transform: translateX(30px) scale(0.94); } }
@keyframes nc-toast-bar { to { transform: scaleX(0); } }

/* ---------- custom confirm (JS: NC.confirm) ---------- */
.nc-dialog {
    position: fixed; inset: 0; z-index: 9990; display: flex; align-items: center; justify-content: center; padding: 20px;
    background: rgba(0, 0, 0, 0.55);
    -webkit-backdrop-filter: blur(10px) saturate(1.2); backdrop-filter: blur(10px) saturate(1.2);
    opacity: 0; visibility: hidden; transition: opacity 0.3s var(--nc-ease), visibility 0s linear 0.3s;
}
.nc-dialog.show { opacity: 1; visibility: visible; transition: opacity 0.3s var(--nc-ease); }
.nc-dialog .box {
    width: 100%; max-width: 400px; padding: 24px; border-radius: 20px;
    background: var(--nc-glass-strong);
    -webkit-backdrop-filter: blur(24px) saturate(1.4); backdrop-filter: blur(24px) saturate(1.4);
    border: 1px solid var(--nc-edge-strong);
    box-shadow: 0 40px 100px -20px rgba(0, 0, 0, 0.95), 0 1px 0 rgba(255, 255, 255, 0.08) inset;
    color: var(--nc-text); font-family: "IBM Plex Sans", system-ui, sans-serif;
    transform: translateY(24px) scale(0.94); opacity: 0;
    transition: transform 0.5s var(--nc-spring), opacity 0.3s var(--nc-ease);
}
.nc-dialog.show .box { transform: none; opacity: 1; }
.nc-dialog h3 { margin: 0 0 8px; font-size: 1.12rem; letter-spacing: -0.01em; }
.nc-dialog p { margin: 0 0 20px; color: var(--nc-muted); font-size: 13.5px; line-height: 1.55; }
.nc-dialog .row { display: flex; gap: 8px; }
.nc-dialog .row button {
    flex: 1; padding: 12px; border-radius: 12px; border: 1px solid var(--nc-line-2);
    background: transparent; color: var(--nc-text); font: 600 14px "IBM Plex Sans", system-ui, sans-serif;
    cursor: pointer; transition: transform 0.2s var(--nc-ease), background 0.2s, border-color 0.2s, box-shadow 0.2s;
}
.nc-dialog .row button:hover { background: rgba(255, 255, 255, 0.07); transform: translateY(-1px); }
.nc-dialog .row button:active { transform: scale(0.97); }
.nc-dialog .row .go { background: var(--nc-accent); color: #0a0a0a; border-color: transparent; }
.nc-dialog .row .go:hover { background: #fff; box-shadow: 0 10px 30px -8px rgba(255, 255, 255, 0.35); }
.nc-dialog.danger .row .go { background: rgba(239, 68, 68, 0.18); color: #fecaca; border-color: rgba(239, 68, 68, 0.5); }
.nc-dialog.danger .row .go:hover { background: rgba(239, 68, 68, 0.3); box-shadow: 0 10px 30px -8px rgba(239, 68, 68, 0.5); }

/* Анимации не отключаем по prefers-reduced-motion: дизайн сайта построен на движении. */
