/* ======================================================================
   TRADER LIGHT/DARK THEME CONTRACT — FINAL

   Purpose:
   - Replace runtime color dependence on settings/skins/skins.json.
   - Preserve the currently effective Classic Business light appearance.
   - Define a complete dark token set, including bridge-only variables.
   - Keep the existing --skin-* names as a compatibility contract while the
     legacy frontend is migrated gradually.

   Runtime note:
   - Dark is the default when no persisted preference exists.
   - Persisted Light/Dark selection is restored before first paint.
====================================================================== */

:root,
html[data-theme="dark"] {
  color-scheme: dark;

  /* App / surfaces */
  --skin-app-bg: #07111f;
  --skin-canvas-bg: rgba(9, 19, 36, 0.97);
  --skin-panel-bg: rgba(12, 24, 44, 0.92);
  --skin-panel-bg-strong: rgba(15, 27, 48, 0.98);
  --skin-panel-border: rgba(96, 165, 250, 0.16);

  /* Typography */
  --skin-title-color: #f8fafc;
  --skin-text-color: #dbe7f5;
  --skin-muted-color: #8ea3bd;
  --skin-list-text-color: #dbe7f5;
  --skin-link-color: #93c5fd;
  --skin-link-hover-color: #bfdbfe;

  /* Actions */
  --skin-primary-btn-bg: #d4af37;
  --skin-primary-btn-text: #111827;
  --skin-soft-btn-bg: #111827;
  --skin-soft-btn-text: #e5e7eb;

  /* Fields */
  --skin-input-bg: #0f1b30;
  --skin-input-border: #223552;
  --skin-focus-color: #eab308;

  /* Tables */
  --skin-table-head-bg: #0f172a;
  --skin-table-head-text: #f8fafc;
  --skin-table-row-hover: #132742;
  --skin-table-row-even: rgba(255, 255, 255, 0.025);
  --skin-table-cell-border: rgba(148, 163, 184, 0.14);

  /* Soft accents / states */
  --skin-accent-soft-bg: rgba(59, 130, 246, 0.14);
  --skin-accent-soft-text: #bfdbfe;
  --skin-positive-color: #22c55e;
  --skin-negative-color: #f97373;
  --skin-neutral-color: #9ca3af;
  --skin-alert-bg: #1f2937;
  --skin-alert-text: #fee2e2;
  --skin-alert-border: #f97316;
  --skin-badge-bg: #111827;
  --skin-badge-text: #e5e7eb;

  /* Elevation / geometry */
  --skin-shadow-color: rgba(0, 0, 0, 0.7);
  --skin-shell-shadow: 0 14px 30px var(--skin-shadow-color);
  --skin-card-shadow: 0 10px 24px var(--skin-shadow-color);
  --skin-shell-radius: 18px;
  --skin-card-radius: 16px;
  --skin-field-radius: 12px;
  --skin-pill-radius: 999px;

  /* Navigation */
  --skin-nav-bg: #020617;
  --skin-nav-text: #e5e7eb;
  --skin-nav-hover: #1d4ed8;
}

html[data-theme="light"] {
  color-scheme: light;

  /* App / surfaces */
  --skin-app-bg: #eef2f6;
  --skin-canvas-bg: rgba(255, 255, 255, 0.92);
  --skin-panel-bg: rgba(255, 255, 255, 0.84);
  --skin-panel-bg-strong: rgba(255, 255, 255, 0.94);
  --skin-panel-border: rgba(15, 23, 42, 0.10);

  /* Typography */
  --skin-title-color: #1f2937;
  --skin-text-color: #111827;
  --skin-muted-color: #6b7280;
  --skin-list-text-color: #111827;
  --skin-link-color: #2563eb;
  --skin-link-hover-color: #1d4ed8;

  /* Actions */
  --skin-primary-btn-bg: #2563eb;
  --skin-primary-btn-text: #ffffff;
  --skin-soft-btn-bg: #e5e7eb;
  --skin-soft-btn-text: #111827;

  /* Fields */
  --skin-input-bg: #ffffff;
  --skin-input-border: #cfd7e3;
  --skin-focus-color: #3b82f6;

  /* Tables */
  --skin-table-head-bg: #1f2937;
  --skin-table-head-text: #ffffff;
  --skin-table-row-hover: #eef4ff;
  --skin-table-row-even: rgba(255, 255, 255, 0.54);
  --skin-table-cell-border: rgba(15, 23, 42, 0.08);

  /* Soft accents / states */
  --skin-accent-soft-bg: #eef4ff;
  --skin-accent-soft-text: #2643a2;
  --skin-positive-color: #16a34a;
  --skin-negative-color: #dc2626;
  --skin-neutral-color: #6b7280;
  --skin-alert-bg: #fef9c3;
  --skin-alert-text: #78350f;
  --skin-alert-border: #facc15;
  --skin-badge-bg: #e5e7eb;
  --skin-badge-text: #111827;

  /* Elevation / geometry */
  --skin-shadow-color: rgba(15, 23, 42, 0.15);
  --skin-shell-shadow: 0 14px 30px var(--skin-shadow-color);
  --skin-card-shadow: 0 10px 24px var(--skin-shadow-color);
  --skin-shell-radius: 18px;
  --skin-card-radius: 16px;
  --skin-field-radius: 12px;
  --skin-pill-radius: 999px;

  /* Navigation */
  --skin-nav-bg: #262626;
  --skin-nav-text: #ffffff;
  --skin-nav-hover: #2ab1ce;
}

/* Compatibility note: the legacy bridge treats --skin-nav-hover as text colour.
   MainNav uses it as the hover surface, so pin its hover text to nav text. */
body[data-trader-skin] .nav-bar a:hover,
body[data-trader-skin] .nav-bar a:focus {
  color: var(--skin-nav-text) !important;
}
