/* JungleNode shared design system — Charcoal / Electric Blue theme */

:root {
  --bg: #0a0d14;
  --bg-elevated: #0f1420;
  --surface: #141a29;
  --surface-raised: #1a2133;
  --border: #232c42;
  --border-soft: #1c2333;

  --ink: #f5f7fb;
  --ink-muted: #a4adc4;
  --ink-dim: #6b7590;

  --accent: #2f7fff;
  --accent-hover: #4f92ff;
  --accent-2: #22d3ee;
  --accent-wash: rgba(47, 127, 255, 0.12);
  --accent-border: rgba(47, 127, 255, 0.4);
  --accent-glow: rgba(47, 127, 255, 0.45);
  --accent-glow-soft: rgba(47, 127, 255, 0.22);

  --danger: #e2685f;
  --danger-wash: rgba(226, 104, 95, 0.12);

  --success: #2ed573;
  --success-wash: rgba(46, 213, 115, 0.12);
  --success-border: rgba(46, 213, 115, 0.35);

  --font-sans: "Instrument Sans", system-ui, -apple-system, sans-serif;
  --font-display: "Instrument Sans", system-ui, -apple-system, sans-serif;
}

* { box-sizing: border-box; }

html { scroll-behavior: smooth; }

body {
  background-color: var(--bg);
  color: var(--ink);
  font-family: var(--font-sans);
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4, .font-display {
  font-family: var(--font-display);
  letter-spacing: -0.02em;
  font-weight: 600;
}

/* Bump heading weight past Tailwind's utility classes via specificity, no !important */
.font-display.font-semibold { font-weight: 700; }
h1.font-display.font-semibold { font-weight: 800; letter-spacing: -0.03em; }

.tabular { font-variant-numeric: tabular-nums; }

*:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: 2px;
}

/* Scrollbar */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: var(--bg); }
::-webkit-scrollbar-thumb { background: var(--border); border-radius: 6px; border: 2px solid var(--bg); }
::-webkit-scrollbar-thumb:hover { background: var(--ink-dim); }

::selection { background: var(--accent-wash); color: var(--accent-hover); }

/* Surfaces */
.jn-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 10px;
}
.jn-panel-raised {
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
}

/* Eyebrow / section labels */
.jn-eyebrow {
  font-size: 0.75rem;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-2);
}

/* Buttons — real glow, this is the energetic accent */
.jn-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.75rem 1.4rem;
  border-radius: 8px;
  transition: background-color 0.2s cubic-bezier(0.16,1,0.3,1), border-color 0.2s cubic-bezier(0.16,1,0.3,1), color 0.2s cubic-bezier(0.16,1,0.3,1), box-shadow 0.25s cubic-bezier(0.16,1,0.3,1), transform 0.2s cubic-bezier(0.16,1,0.3,1);
  white-space: nowrap;
  border: 1px solid transparent;
  cursor: pointer;
}
.jn-btn-primary {
  position: relative;
  overflow: hidden;
  background: linear-gradient(135deg, var(--accent), var(--accent-2));
  color: #ffffff;
  box-shadow: 0 4px 24px -4px var(--accent-glow-soft);
}
.jn-btn-primary::after {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(115deg, transparent 20%, rgba(255,255,255,0.35) 40%, transparent 60%);
  transform: translateX(-100%);
  transition: transform 0.6s cubic-bezier(0.16,1,0.3,1);
}
.jn-btn-primary:hover::after { transform: translateX(100%); }
.jn-btn-primary:hover {
  box-shadow: 0 8px 32px -4px var(--accent-glow);
  transform: translateY(-1px);
}
.jn-btn-primary:active { transform: translateY(0) scale(0.97); }
.jn-btn-ghost { background: transparent; border-color: var(--border); color: var(--ink); }
.jn-btn-ghost:hover { border-color: var(--accent-border); background: var(--accent-wash); color: var(--ink); }
.jn-btn-ghost:active { transform: scale(0.97); }
.jn-btn-sm { padding: 0.5rem 1rem; font-size: 0.8rem; border-radius: 6px; }

/* Card tilt (mouse-driven, real interaction — see JN.initCardTilt) */
.jn-tilt { transform-style: preserve-3d; transition: transform 0.4s cubic-bezier(0.16,1,0.3,1); }

/* Nav links */
.jn-nav-link {
  color: var(--ink-muted);
  font-size: 0.9rem;
  font-weight: 500;
  transition: color 0.2s cubic-bezier(0.16,1,0.3,1);
  position: relative;
}
.jn-nav-link:hover, .jn-nav-link.active { color: var(--ink); }
.jn-nav-link.active::after {
  content: "";
  position: absolute;
  left: 0; right: 0; bottom: -6px;
  height: 2px;
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  border-radius: 2px;
  box-shadow: 0 0 8px var(--accent-glow-soft);
}

/* WHMCS-style nav dropdowns (pure CSS, hover + keyboard focus-within) */
.jn-dropdown { position: relative; }
.jn-dropdown > .jn-nav-link i { transition: transform 0.2s cubic-bezier(0.16,1,0.3,1); }
.jn-dropdown:hover > .jn-nav-link i,
.jn-dropdown:focus-within > .jn-nav-link i { transform: rotate(180deg); }
.jn-dropdown-menu {
  /* No gap between trigger and menu — a gap here breaks :hover continuity
     (the pointer crosses dead space and the menu closes mid-transit). The
     padding-top below creates the visual gap while staying inside the
     hoverable box; the visible card is the nested -inner element. */
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  padding-top: 10px;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s cubic-bezier(0.16,1,0.3,1), visibility 0.2s;
  z-index: 50;
}
.jn-dropdown:hover > .jn-dropdown-menu,
.jn-dropdown:focus-within > .jn-dropdown-menu {
  opacity: 1;
  visibility: visible;
}
.jn-dropdown-menu-inner {
  min-width: 210px;
  background: var(--surface-raised);
  border: 1px solid var(--border);
  border-radius: 10px;
  padding: 0.4rem;
  box-shadow: 0 16px 40px -12px rgba(0,0,0,0.55);
}
.jn-dropdown-item {
  display: block;
  padding: 0.6rem 0.85rem;
  border-radius: 6px;
  font-size: 0.875rem;
  color: var(--ink-muted);
  transition: background-color 0.15s ease, color 0.15s ease;
}
.jn-dropdown-item:hover, .jn-dropdown-item:focus-visible { background: var(--bg-elevated); color: var(--ink); }

/* Tags */
.jn-tag {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  letter-spacing: 0.01em;
  padding: 0.32rem 0.75rem;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: var(--bg-elevated);
  color: var(--ink-muted);
}
.jn-tag-dot { width: 6px; height: 6px; border-radius: 999px; background: currentColor; }
.jn-tag-accent { color: var(--accent-2); border-color: var(--accent-border); background: var(--accent-wash); }
.jn-tag-danger { color: var(--danger); border-color: rgba(226,104,95,0.3); background: var(--danger-wash); }
.jn-tag-success { color: var(--success); border-color: var(--success-border); background: var(--success-wash); }

/* Server overview page: rows inside the Server / Active Instance cards */
.jn-info-row { display: flex; align-items: center; justify-content: space-between; gap: 12px; padding: 9px 0; border-bottom: 1px solid var(--border-soft); }
.jn-info-row:last-child { border-bottom: none; }
.jn-info-row-label { font-size: 12px; color: var(--ink-dim); }
.jn-icon-btn { color: var(--ink-dim); display: inline-flex; align-items: center; justify-content: center; padding: 3px; border-radius: 6px; transition: color .15s ease, background .15s ease; }
.jn-icon-btn:hover { color: var(--accent-2); background: var(--accent-wash); }

/* Inputs */
.jn-input, select.jn-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 0.7rem 0.9rem;
  color: var(--ink);
  font-size: 0.9rem;
  font-family: var(--font-sans);
  outline: none;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}
.jn-input::placeholder { color: var(--ink-dim); }
.jn-input:focus { border-color: var(--accent); box-shadow: 0 0 0 3px var(--accent-wash); }

/* Switch */
.jn-switch { position: relative; display: inline-block; width: 40px; height: 24px; flex-shrink: 0; }
.jn-switch input { position: absolute; opacity: 0; width: 100%; height: 100%; margin: 0; cursor: pointer; z-index: 1; }
.jn-switch-track {
  position: absolute; inset: 0; border-radius: 999px;
  background: var(--bg-elevated); border: 1px solid var(--border);
  transition: background-color 0.2s ease, border-color 0.2s ease;
}
.jn-switch-track::after {
  content: ""; position: absolute; top: 2px; left: 2px; width: 18px; height: 18px;
  border-radius: 999px; background: var(--ink-dim);
  transition: transform 0.2s cubic-bezier(0.16,1,0.3,1), background-color 0.2s ease;
}
.jn-switch input:checked ~ .jn-switch-track { background: var(--accent-wash); border-color: var(--accent-border); }
.jn-switch input:checked ~ .jn-switch-track::after { transform: translateX(16px); background: var(--accent); }
.jn-switch input:focus-visible ~ .jn-switch-track { box-shadow: 0 0 0 3px var(--accent-wash); }

/* Range slider */
input[type="range"].jn-range {
  -webkit-appearance: none;
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: var(--border);
  outline: none;
}
input[type="range"].jn-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 16px; height: 16px;
  border-radius: 999px;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 12px var(--accent-glow-soft);
  cursor: pointer;
}
input[type="range"].jn-range::-moz-range-thumb {
  width: 16px; height: 16px;
  border-radius: 999px;
  background: var(--accent);
  border: 3px solid var(--bg);
  box-shadow: 0 0 12px var(--accent-glow-soft);
  cursor: pointer;
}

/* Tables */
.jn-table { width: 100%; border-collapse: collapse; font-size: 0.875rem; }
.jn-table th {
  text-align: left;
  font-size: 0.72rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--ink-muted);
  padding: 0.8rem 1rem;
  border-bottom: 1px solid var(--border);
}
.jn-table td {
  padding: 0.9rem 1rem;
  border-bottom: 1px solid var(--border-soft);
  color: var(--ink);
}
.jn-table tr:last-child td { border-bottom: none; }

/* Panel capability strip buttons */
.jn-panel-btn {
  background: transparent;
  color: var(--ink);
  font-family: inherit;
  cursor: pointer;
  transition: background-color 0.2s cubic-bezier(0.16,1,0.3,1), border-color 0.2s cubic-bezier(0.16,1,0.3,1), transform 0.2s cubic-bezier(0.16,1,0.3,1);
}
.jn-panel-btn:hover { background: var(--bg-elevated); border-color: var(--ink-dim); transform: translateY(-2px); }
.jn-panel-btn:active { transform: translateY(0) scale(0.98); }
.jn-panel-btn-active:hover { background: var(--accent-wash); border-color: var(--accent) !important; }

/* Tabs */
.jn-tab {
  padding: 0.6rem 1.1rem;
  border-radius: 8px;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--ink-muted);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.2s ease;
}
.jn-tab:hover { color: var(--ink); }
.jn-tab.active {
  background: var(--accent-wash);
  border-color: var(--accent-border);
  color: var(--accent-2);
  box-shadow: 0 0 16px -4px var(--accent-glow-soft);
}

/* Card hover lift — with a touch of glow */
.jn-lift { transition: transform 0.25s cubic-bezier(0.16,1,0.3,1), border-color 0.25s ease, box-shadow 0.25s ease; }
.jn-lift:hover { transform: translateY(-4px); border-color: var(--accent-border); box-shadow: 0 16px 40px -12px var(--accent-glow-soft); }

/* Sidebar (account pages) */
.jn-sidebar-link {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.6rem 0.85rem;
  border-radius: 8px;
  color: var(--ink-muted);
  font-size: 0.875rem;
  font-weight: 500;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}
.jn-sidebar-link:hover { color: var(--ink); background: var(--bg-elevated); }
.jn-sidebar-link.active { color: var(--accent-2); background: var(--accent-wash); border-color: var(--accent-border); }

/* Usage bar */
.jn-usage-bar { height: 6px; border-radius: 999px; background: var(--bg-elevated); overflow: hidden; border: 1px solid var(--border); }
.jn-usage-bar > span { display: block; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent-2)); border-radius: 999px; }

/* Reveal-on-scroll: visible by default (no-JS safe), animates only once JS marks the page ready */
.jn-reveal { opacity: 1; transform: none; }
.js-ready .jn-reveal { opacity: 0; transform: translateY(10px); }
@media (prefers-reduced-motion: reduce) {
  .js-ready .jn-reveal { opacity: 1 !important; transform: none !important; }
}

/* Depth-parallax stage (CSS 3D, no WebGL) */
.jn-depth-stage {
  position: relative;
  perspective: 1400px;
  transform-style: preserve-3d;
}
.jn-depth-layer {
  position: absolute;
  inset: 0;
  transform-style: preserve-3d;
  will-change: transform;
  transition: transform 0.6s cubic-bezier(0.16,1,0.3,1);
}
@media (prefers-reduced-motion: reduce) {
  .jn-depth-layer { transition: none !important; transform: none !important; }
}

/* Fine grid backdrop */
.jn-grid-backdrop {
  background-image:
    linear-gradient(var(--border-soft) 1px, transparent 1px),
    linear-gradient(90deg, var(--border-soft) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(ellipse 60% 60% at 50% 30%, black, transparent);
}

/* Gradient mesh wash + glow blobs — the "energy" layer behind hero/feature sections */
.jn-mesh-bg {
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 60% 50% at 15% 10%, var(--accent-glow-soft), transparent 60%),
    radial-gradient(ellipse 55% 45% at 90% 20%, rgba(34, 211, 238, 0.16), transparent 60%),
    linear-gradient(180deg, transparent, var(--bg) 90%);
  pointer-events: none;
}
.jn-glow-blob {
  position: absolute;
  border-radius: 999px;
  filter: blur(60px);
  pointer-events: none;
  opacity: 0.5;
}

/* Modal backdrop */
.jn-modal-backdrop { background: rgba(4, 6, 10, 0.8); backdrop-filter: blur(6px); }

/* Ambient page background — fixed, blurred, darkened photo behind all content */
.jn-page-bg-wrap {
  position: absolute;
  inset: 0;
  z-index: 0;
  overflow: hidden;
  pointer-events: none;
}
.jn-page-bg-image {
  position: absolute;
  inset: -20px;
  background-size: cover;
  background-position: center;
  filter: blur(8px) brightness(0.4) saturate(0.8);
  transform: scale(1.03);
}
.jn-page-bg-overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(180deg, rgba(10,13,20,0.3) 0%, rgba(10,13,20,0.55) 22%, var(--bg) 55%, var(--bg) 100%);
}

/* Fill variant — for standalone hero sections at the very top of a page.
   Even wash through most of the section so the image reads across the
   whole hero, with a soft colour-mix smoke blend at the bottom edge only
   (where the hero meets the next section) instead of a hard cut. */
.jn-page-bg-overlay-fill {
  position: absolute;
  inset: -10px;
  background: linear-gradient(180deg,
    rgba(10,13,20,0.35) 0%,
    rgba(10,13,20,0.45) 68%,
    rgba(47,127,255,0.12) 82%,
    rgba(34,211,238,0.10) 91%,
    var(--bg) 100%);
  filter: blur(4px);
}

/* Smoky variant — for sections sandwiched between solid content above/below.
   Fully solid at both edges, a soft colour-mix haze feathers the seam before
   the image reveals in the middle, instead of a hard cut. */
.jn-page-bg-overlay-smoky {
  position: absolute;
  inset: -10px;
  background: linear-gradient(180deg,
    var(--bg) 0%,
    rgba(47,127,255,0.10) 10%,
    rgba(34,211,238,0.08) 22%,
    transparent 40%,
    transparent 60%,
    rgba(34,211,238,0.08) 78%,
    rgba(47,127,255,0.10) 90%,
    var(--bg) 100%);
  filter: blur(6px);
}

/* Gradient-border glow card — wraps a solid inner panel in a 1px gradient "border" */
.jn-glow-card {
  border-radius: 14px;
  padding: 1px;
  background: linear-gradient(135deg, var(--accent), var(--accent-2) 45%, transparent 75%);
  box-shadow: 0 12px 40px -16px var(--accent-glow-soft);
}
.jn-glow-card > .jn-glow-card-inner {
  border-radius: 13px;
  background: var(--surface);
  height: 100%;
}

/* Promo / announcement banner */
.jn-promo-bar {
  background: linear-gradient(90deg, var(--accent), var(--accent-2));
  color: #ffffff;
}

/* Floating stat chip — overlaps hero/panel corners */
.jn-float-chip {
  position: absolute;
  background: var(--surface-raised);
  border: 1px solid var(--accent-border);
  border-radius: 10px;
  box-shadow: 0 12px 32px -8px rgba(0,0,0,0.5), 0 0 20px -6px var(--accent-glow-soft);
}
