/* ============================================================================
   Aetherion Labs — Platform app shell
   Design System component layer. Requires design-system tokens.
   Derived from platform.css.
   ========================================================================== */

@import url('./mobile.css');

/* App page background — canonical look (Signal Screener reference) */
.page-bg {
  position: fixed;
  inset: 0;
  z-index: -1;
  pointer-events: none;
  background:
    radial-gradient(1200px 800px at 75% -10%, var(--azure-wash-06), transparent 60%),
    radial-gradient(900px 700px at 10% 100%, rgba(109, 227, 168, 0.04), transparent 55%),
    linear-gradient(180deg, #0a0a11 0%, #07070c 40%, #06060a 100%);
}

/* Faint DS grid on the fixed overlay — not on body (avoids double grid in margins). */
.page-bg::after {
  content: "";
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(var(--chart-grid) 1px, transparent 1px),
    linear-gradient(90deg, var(--chart-grid) 1px, transparent 1px);
  background-size: 48px 48px;
  mask-image: radial-gradient(1400px 900px at 50% 0%, black, transparent 80%);
  opacity: 0.55;
  pointer-events: none;
}

/* Platform pages with .page-bg — overlay is the sole background layer. */
html:has(body > .page-bg),
body.ae-grid-bg:has(> .page-bg) {
  background-color: transparent;
  background-image: none;
}

/* ── App nav overrides (sticky, gold accents) ─────────────────────────── */
.nav[data-layout-v4] {
  position: sticky;
  top: 0;
  height: 70px;
  min-height: 70px;
  display: flex;
  align-items: center;
  background: rgba(6, 6, 11, 0.82);
  backdrop-filter: blur(24px) saturate(160%);
  -webkit-backdrop-filter: blur(24px) saturate(160%);
  border-bottom: none;
  animation: navSlideDown 0.35s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.nav[data-layout-v4]::after {
  content: "";
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 1px;
  background: linear-gradient(
    90deg,
    transparent 0%,
    var(--azure-wash-12) 20%,
    var(--azure-wash-35) 50%,
    var(--azure-wash-12) 80%,
    transparent 100%
  );
  pointer-events: none;
}

@keyframes navSlideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

.nav[data-layout-v4] .nav-inner {
  max-width: 1480px;
  margin: 0 auto;
  width: 100%;
  padding: 0 28px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0;
  height: 100%;
}

.nav[data-layout-v4] .nav-left {
  display: flex;
  align-items: center;
  height: 100%;
  gap: 0;
  min-width: 0;
}

.nav[data-layout-v4] .brand {
  display: flex;
  align-items: center;
  gap: 10px;
  font-family: var(--font-display);
  font-weight: 500;
  letter-spacing: -0.015em;
  color: var(--text-100);
  font-size: 17.5px;
  white-space: nowrap;
  text-decoration: none;
  padding-right: 20px;
  margin-right: 4px;
  flex-shrink: 0;
  position: relative;
  transition: opacity 0.2s ease;
}

.nav[data-layout-v4] .brand:hover { opacity: 0.8; }

.nav[data-layout-v4] .brand::after {
  content: "";
  position: absolute;
  right: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 1px;
  height: 20px;
  background: rgba(255, 255, 255, 0.07);
}

.nav[data-layout-v4] .brand-mark {
  height: 36px;
  width: auto;
  flex-shrink: 0;
  display: block;
  object-fit: contain;
  filter: drop-shadow(0 2px 8px var(--azure-glow-soft));
}

.nav[data-layout-v4] .brand .brand-name {
  font-family: var(--font-display);
  font-size: 17px;
  font-weight: 500;
  letter-spacing: 0.01em;
  line-height: 1;
  color: var(--text-100);
  white-space: nowrap;
}

.nav[data-layout-v4] .brand .brand-main { font-weight: 500; }

.nav[data-layout-v4] .brand .brand-sub {
  font-family: var(--font-sans);
  font-weight: 300;
  letter-spacing: 0.03em;
  margin-left: 0.14em;
  color: var(--text-200);
}

.nav[data-layout-v4] .nav-menus {
  display: flex;
  align-items: center;
  padding-left: 8px;
  min-width: 0;
  flex: 1;
}

.nav[data-layout-v4] .nav-divider {
  display: inline-block;
  width: 1px;
  height: 20px;
  margin: 0 8px 0 4px;
  background: rgba(255, 255, 255, 0.16);
  flex-shrink: 0;
  align-self: center;
  border-radius: 1px;
}

.nav[data-layout-v4] .nav-tools {
  display: flex;
  align-items: center;
  margin-right: 4px;
  padding-right: 12px;
  border-right: 1px solid rgba(255, 255, 255, 0.12);
  flex-shrink: 0;
}

.nav[data-layout-v4] .nav-link--locked,
.nav[data-layout-v4] .nav-tools a.nav-link--locked {
  opacity: 0.45;
  cursor: not-allowed;
}

.nav[data-layout-v4] .navtabs,
.nav[data-layout-v4] .navtabs-primary {
  height: auto;
  flex-wrap: nowrap;
  padding-left: 8px;
}

.nav[data-layout-v4] .navtabs a {
  display: inline-flex;
  align-items: center;
  gap: 5px;
}
.nav[data-layout-v4] a.nav-help {
  margin-right: 8px;
}

.nav[data-layout-v4] .nav-right {
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
}

.nav[data-layout-v4] .avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: linear-gradient(135deg, #2a2d38, #14161c);
  border: 1.5px solid var(--azure-border-strong);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--gold-200);
  cursor: pointer;
  transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.nav[data-layout-v4] .avatar:hover {
  border-color: var(--azure-wash-45);
  box-shadow: 0 0 0 3px var(--azure-wash-10), 0 0 12px var(--azure-wash-12);
  transform: scale(1.05);
}

/* ── User dropdown ─────────────────────────────────────────────────────── */
.nav-user-wrap { position: relative; }

#nav-avatar {
  cursor: pointer;
  user-select: none;
  transition: all 0.12s ease;
}

#nav-avatar:hover {
  opacity: 0.9;
  box-shadow: 0 0 0 2px var(--azure-wash-40);
}

#nav-avatar:focus-visible {
  outline: none;
  box-shadow: 0 0 0 2px var(--azure-wash-55);
}

.nav-user-menu {
  position: absolute;
  top: calc(100% + 10px);
  right: 0;
  width: 240px;
  background: var(--surface-card);
  border: 1px solid var(--border-strong);
  border-radius: 12px;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.7), inset 0 1px 0 rgba(255, 255, 255, 0.08);
  padding: 8px;
  z-index: 9999;
  opacity: 0;
  transform: translateY(-8px) scale(0.97);
  pointer-events: none;
  transition: opacity 0.16s ease, transform 0.16s ease;
}

.nav-user-menu.is-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

.num-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 12px 12px 14px;
  cursor: default;
  border-radius: 10px;
  background: rgba(255, 255, 255, 0.03);
}

.num-avatar-lg {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: linear-gradient(135deg, #3a3f4d, #1c1e28);
  border: 1px solid var(--azure-border-strong);
  display: grid;
  place-items: center;
  font-family: var(--font-display);
  font-size: 13px;
  font-weight: 500;
  color: var(--text-100);
  flex-shrink: 0;
}

.num-identity { min-width: 0; }

.num-display-name {
  font-family: var(--font-sans);
  font-size: 14px;
  font-weight: 500;
  color: var(--text-100);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.num-email {
  font-size: 12px;
  color: var(--text-300);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-top: 2px;
}

.num-tier {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 500;
  letter-spacing: 0.04em;
  text-transform: uppercase;
  color: var(--pos-400);
  margin-top: 4px;
}

.num-tier--none {
  color: var(--text-300);
  text-transform: none;
  letter-spacing: 0.01em;
  font-weight: 400;
}

.num-divider {
  height: 1px;
  background: var(--line);
  margin: 6px 0;
}

.num-divider--spaced {
  margin: 10px 0;
  background: var(--border-strong);
}

.num-item {
  display: flex;
  align-items: center;
  gap: 11px;
  padding: 9px 12px 9px 14px;
  border-radius: 9px;
  font-family: var(--font-sans);
  font-size: 14px;
  color: var(--text-200);
  text-decoration: none;
  cursor: pointer;
  transition: all 0.12s ease;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}

.num-item:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-100);
}

.num-item--danger:hover {
  background: color-mix(in srgb, var(--neg-400) 12%, transparent);
  color: var(--neg-400);
}

.num-item--admin { color: var(--text-300); }

.num-item--admin:hover {
  background: var(--azure-wash-10);
  color: var(--text-100);
}

.num-item-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  opacity: 0.75;
}

.num-item--locked {
  opacity: 0.45;
  cursor: not-allowed;
}

#nav-user-info {
  display: flex;
  flex-direction: column;
  align-items: flex-end;
  gap: 2px;
  line-height: 1;
}

.nui-name {
  font-family: var(--font-display);
  font-size: 14px;
  font-weight: 600;
  color: var(--gold-200);
  white-space: nowrap;
}

.nui-clock {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--text-300);
  white-space: nowrap;
}

/* ── Help pages ────────────────────────────────────────────────────────── */
.help-layout {
  display: grid;
  grid-template-columns: 260px 1fr;
  gap: 40px;
  max-width: 1200px;
  margin: 0 auto;
  padding: 40px 28px 80px;
}

.help-sidebar-title {
  font-family: var(--font-mono);
  font-size: 11px;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  color: var(--text-300);
  margin-bottom: 16px;
}

.help-nav {
  list-style: none;
  padding: 0;
  margin: 0;
}

.help-nav a {
  display: block;
  padding: 8px 12px;
  border-radius: 8px;
  color: var(--text-200);
  font-size: 14px;
  transition: background 0.15s, color 0.15s;
}

.help-nav a:hover,
.help-nav a.active {
  background: var(--azure-wash-08);
  color: var(--text-100);
}

.help-article {
  color: var(--text-200);
  line-height: 1.7;
  font-size: 16px;
}

.help-article h1,
.help-article h2,
.help-article h3 {
  font-family: var(--font-display);
  color: var(--text-100);
  margin: 1.5em 0 0.5em;
}

.help-article h1 { font-size: 2rem; }
.help-article h2 { font-size: 1.5rem; }
.help-article a { color: var(--gold-200); }
.help-article code {
  font-family: var(--font-mono);
  font-size: 0.9em;
  background: var(--surface-panel);
  padding: 2px 6px;
  border-radius: 4px;
}

@media (max-width: 768px) {
  .help-layout { grid-template-columns: 1fr; }
}

@media (prefers-reduced-motion: reduce) {
  .nav[data-layout-v4],
  .nav[data-layout-v4] .navtabs a,
  .nav[data-layout-v4] .avatar {
    animation: none !important;
    transition-duration: 0.01ms !important;
  }
}
