/* ==========================================================================
   FX LAYER — KPRverse-inspired visual skin + atmosphere (decorative only)
   --------------------------------------------------------------------------
   Rules of this file:
   1. NEVER set layout properties (position, margin, size, grid) on existing
      components — the original UI geometry is untouchable.
   2. The neon theme is a THIRD theme ("neon") selected like light/dark.
   3. Decorative atmosphere (particles, gradients) is a fixed background
      canvas with pointer-events: none — it can never intercept clicks.
   4. Everything respects prefers-reduced-motion and the tilt-fx=off switch.
   ========================================================================== */

/* --------------------------------------------------------------------------
   NEON THEME — charcoal glass + electric lime + cyan highlight
   -------------------------------------------------------------------------- */
:root[data-theme="neon"] {
  /* canvas + surfaces */
  --bg0: #101318;
  --bg1: #13161c;
  --bg2: #171b22;
  --bg3: #1d222b;
  --bg-hover: rgba(182, 255, 46, 0.06);
  --ink: #05070a;

  /* lines */
  --line: rgba(151, 183, 255, 0.13);
  --line2: rgba(151, 183, 255, 0.26);
  --line-strong: #26314a;
  --line-subtle: rgba(151, 183, 255, 0.07);

  /* text */
  --text: #eaf2f8;
  --text2: #b9c6d6;
  --muted: #7d8aa0;
  --faint: #566278;

  /* signal lime + cyan highlight */
  --acc: #b6ff2e;
  --acc-bright: #d8ff7a;
  --acc-dim: rgba(182, 255, 46, 0.10);
  --acc-line: rgba(182, 255, 46, 0.45);
  --accent2: #38e8ff;
  --accent2-dim: rgba(56, 232, 255, 0.10);

  /* semantic status */
  --pos: #57e389;
  --pos-dim: rgba(87, 227, 137, 0.12);
  --neg: #ff6b6b;
  --neg-dim: rgba(255, 107, 107, 0.12);
  --warn: #ffc94d;
  --warn-dim: rgba(255, 201, 77, 0.12);
  --live: #b6ff2e;

  --radius: 0px;
  --ease: cubic-bezier(.76, 0, .24, 1);
  --ease-out: cubic-bezier(.16, 1, .3, 1);
  --shadow-pop: 0 18px 50px rgba(0, 0, 0, 0.55);
}

/* neon-only base atmosphere: deep radial gradients + technical grid on the ink
   canvas. The shell layers go transparent so the canvas gradients + particles
   show through — panels/tiles keep their own glass backgrounds. */
:root[data-theme="neon"] body {
  background:
    radial-gradient(1100px 620px at 78% -12%, rgba(56, 232, 255, 0.07), transparent 62%),
    radial-gradient(950px 560px at 8% 108%, rgba(182, 255, 46, 0.06), transparent 60%),
    repeating-linear-gradient(0deg, rgba(151, 183, 255, 0.028) 0 1px, transparent 1px 44px),
    repeating-linear-gradient(90deg, rgba(151, 183, 255, 0.028) 0 1px, transparent 1px 44px),
    var(--ink);
}
:root[data-theme="neon"] #app,
:root[data-theme="neon"] .page,
:root[data-theme="neon"] .topbar { background: transparent; }

/* cinematic vignette — decorative overlay, never interactive */
:root[data-theme="neon"] body::after {
  content: "";
  position: fixed; inset: 0; z-index: 2; pointer-events: none;
  background: radial-gradient(120% 90% at 50% 40%, transparent 55%, rgba(3, 5, 9, 0.5) 100%);
}

:root[data-theme="neon"] ::selection { background: rgba(182, 255, 46, 0.28); }
:root[data-theme="neon"] ::-webkit-scrollbar-thumb { background: #26314a; }
:root[data-theme="neon"] ::-webkit-scrollbar-thumb:hover { background: #38e8ff; }

/* glass panels: subtle translucency + hairline lime top edge */
:root[data-theme="neon"] .panel,
:root[data-theme="neon"] .stat-row,
:root[data-theme="neon"] .cmdbar,
:root[data-theme="neon"] .seg button {
  background: linear-gradient(180deg, rgba(23, 27, 34, 0.92), rgba(16, 19, 24, 0.94));
  border: 1px solid rgba(151, 183, 255, 0.10);
  box-shadow:
    inset 0 1px 0 rgba(216, 255, 122, 0.05),
    0 10px 30px rgba(0, 0, 0, 0.35);
}

:root[data-theme="neon"] .panel.accent {
  border-color: rgba(182, 255, 46, 0.22);
  box-shadow:
    inset 0 1px 0 rgba(216, 255, 122, 0.08),
    0 0 0 1px rgba(182, 255, 46, 0.06),
    0 14px 40px rgba(0, 0, 0, 0.4);
}

:root[data-theme="neon"] .panel-head { border-bottom: 1px solid rgba(151, 183, 255, 0.10); }
:root[data-theme="neon"] .panel-head h2 { color: var(--text); }

/* stat cells: glass tiles with hover lift-glow */
:root[data-theme="neon"] .stat-cell {
  background: linear-gradient(180deg, rgba(23, 27, 34, 0.9), rgba(16, 19, 24, 0.94));
  border: 1px solid rgba(151, 183, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(216, 255, 122, 0.05);
  transition: border-color .25s var(--ease-out), box-shadow .25s var(--ease-out);
}
:root[data-theme="neon"] .stat-cell:hover {
  border-color: rgba(182, 255, 46, 0.35);
  box-shadow:
    inset 0 1px 0 rgba(216, 255, 122, 0.08),
    0 0 18px rgba(182, 255, 46, 0.10);
}

/* hero values get a soft lime glow */
:root[data-theme="neon"] .stat-cell .v,
:root[data-theme="neon"] .mi-cell .v.hero { text-shadow: 0 0 14px rgba(182, 255, 46, 0.25); }
:root[data-theme="neon"] .mi-cell .v.hero.acc { text-shadow: 0 0 16px rgba(182, 255, 46, 0.45); }

/* topbar: glass strip + lime active pill */
:root[data-theme="neon"] .topbar > * {
  background: linear-gradient(180deg, rgba(23, 27, 34, 0.94), rgba(16, 19, 24, 0.96));
  border: 1px solid rgba(151, 183, 255, 0.10);
  box-shadow: inset 0 1px 0 rgba(216, 255, 122, 0.05);
}
:root[data-theme="neon"] .primary-nav a {
  color: var(--text2);
  transition: color .2s var(--ease-out), text-shadow .2s var(--ease-out);
}
:root[data-theme="neon"] .primary-nav a:hover { color: var(--text); text-shadow: 0 0 12px rgba(56, 232, 255, 0.4); }
:root[data-theme="neon"] .primary-nav a.active {
  color: var(--acc);
  text-shadow: 0 0 14px rgba(182, 255, 46, 0.5);
}
:root[data-theme="neon"] .primary-nav a.active::after {
  background: var(--acc);
  box-shadow: 0 0 12px rgba(182, 255, 46, 0.65);
}

/* buttons: illumination on hover, pressed press */
:root[data-theme="neon"] .btn,
:root[data-theme="neon"] .icon-btn {
  transition: box-shadow .2s var(--ease-out), color .2s var(--ease-out),
    background .2s var(--ease-out), transform .12s var(--ease-out);
}
:root[data-theme="neon"] .btn:hover {
  background: rgba(182, 255, 46, 0.08);
  border-color: rgba(182, 255, 46, 0.5);
  color: var(--acc-bright);
  box-shadow: 0 0 16px rgba(182, 255, 46, 0.18);
}
:root[data-theme="neon"] .btn.primary {
  background: var(--acc);
  border-color: var(--acc);
  color: #10131a;
  box-shadow: 0 0 18px rgba(182, 255, 46, 0.25);
}
:root[data-theme="neon"] .btn.primary:hover { box-shadow: 0 0 26px rgba(182, 255, 46, 0.4); }
:root[data-theme="neon"] .btn:active { transform: translateY(1px); }

/* pills: neon outlines */
:root[data-theme="neon"] .pill { border: 1px solid rgba(151, 183, 255, 0.2); }
:root[data-theme="neon"] .pill.acc { border-color: rgba(182, 255, 46, 0.5); color: var(--acc-bright); box-shadow: 0 0 10px rgba(182, 255, 46, 0.15); }

/* tables: refined separators + row hover sweep */
:root[data-theme="neon"] table.data th { color: var(--accent2); border-bottom: 1px solid rgba(56, 232, 255, 0.25); }
:root[data-theme="neon"] table.data td { border-bottom: 1px solid rgba(151, 183, 255, 0.06); }
:root[data-theme="neon"] table.data tr.rowlink:hover td,
:root[data-theme="neon"] table.data tr:hover td { background: rgba(56, 232, 255, 0.04); }

/* match rows: lime hover wash + open-state glass */
:root[data-theme="neon"] .mi-main:hover { background: rgba(182, 255, 46, 0.04); box-shadow: inset 3px 0 0 var(--acc); }
:root[data-theme="neon"] .mi-row.open .mi-main { background: var(--bg2); }
:root[data-theme="neon"] .mi-row.open .mi-main * { color: var(--text) !important; }

/* charts get a faint cyan grid */
:root[data-theme="neon"] .chart-wrap { filter: drop-shadow(0 0 6px rgba(56, 232, 255, 0.08)); }

/* dark theme also gets the subtle upgrade (no palette change, just depth) */
:root[data-theme="dark"] .stat-cell,
:root[data-theme="dark"] .panel { transition: border-color .25s var(--ease-out), box-shadow .25s var(--ease-out); }
:root[data-theme="dark"] .stat-cell:hover { border-color: rgba(255, 95, 20, 0.4); }

/* --------------------------------------------------------------------------
   BUTTON PRESS (all themes, tiny)
   -------------------------------------------------------------------------- */
.btn:active { transform: translateY(1px); }

/* --------------------------------------------------------------------------
   FX ATMOSPHERE — fixed decorative canvas behind everything
   -------------------------------------------------------------------------- */
#fx-atmosphere {
  position: fixed;
  inset: 0;
  z-index: 0;
  pointer-events: none;
  opacity: 0.85;
}
:root[data-theme="light"] #fx-atmosphere { display: none; }
:root[data-theme="neon"] #fx-atmosphere { opacity: 1; }

/* keep every real UI layer above the atmosphere */
#app, body > .login, .boot-overlay, .crox-curtain { position: relative; z-index: 1; }

/* --------------------------------------------------------------------------
   ENTRANCE + MICRO-ANIMATIONS (GSAP drives JS-side; CSS handles the rest)
   -------------------------------------------------------------------------- */
#page .panel, #page .stat-row { will-change: transform, opacity; }
body.fx-animating #page { min-height: 1px; }

@media (prefers-reduced-motion: reduce) {
  #fx-atmosphere { display: none; }
  #page .panel, #page .stat-row { will-change: auto; }
}

/* login neon accents */
:root[data-theme="neon"] body { color: var(--text); }
:root[data-theme="neon"] .login {
  background: linear-gradient(180deg, rgba(19, 22, 28, 0.96), rgba(16, 19, 24, 0.98));
  border: 1px solid rgba(151, 183, 255, 0.12);
  box-shadow:
    inset 0 1px 0 rgba(216, 255, 122, 0.06),
    0 0 0 1px rgba(182, 255, 46, 0.05),
    0 30px 80px rgba(0, 0, 0, 0.6),
    0 0 60px rgba(56, 232, 255, 0.05);
}
:root[data-theme="neon"] .login-head { border-bottom: 1px solid rgba(151, 183, 255, 0.12); }
:root[data-theme="neon"] .login-head .dot {
  box-shadow: 0 0 12px rgba(182, 255, 46, 0.8);
}
:root[data-theme="neon"] .login-form button[type="submit"] {
  box-shadow: 0 0 22px rgba(182, 255, 46, 0.28);
}
:root[data-theme="neon"] .login-form button[type="submit"]:hover {
  box-shadow: 0 0 34px rgba(182, 255, 46, 0.45);
}
:root[data-theme="neon"] .login-error { color: var(--neg); }
