/**
 * Scoped theme for /crypto only — toggled via [data-zs-theme="dark"|"light"]
 * on [data-zs-crypto-root]. Official tokens (--zs-*) are re-mapped in light mode
 * so existing `var(--zs-…)` classes in CryptoMarketPage switch without edits.
 * Dark: neon brand locked below. Light: neutral slate via --zs-green-* (no green accent).
 */

[data-zs-crypto-root] {
  --crypto-canvas: var(--zs-right-sidebar-bg, #000000);

  /* Softer than global tokens — less “white wire” noise on dark */
  --zs-border-subtle: rgba(255, 255, 255, 0.03);
  --zs-border-soft: rgba(255, 255, 255, 0.04);
  --zs-border-mid: rgba(255, 255, 255, 0.05);
  --zs-border-strong: rgba(255, 255, 255, 0.07);

  --crypto-row-divider: rgba(255, 255, 255, 0.035);

  /* Row separation without borders (tables / lists) */
  --crypto-row-zebra: rgba(255, 255, 255, 0.015);
  --crypto-row-hover-bg: rgba(255, 255, 255, 0.02);
  --crypto-row-hover-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);

  /* Depth instead of hard card outlines */
  --crypto-card-shadow: 0 2px 10px rgba(0, 0, 0, 0.45), 0 10px 36px rgba(0, 0, 0, 0.32);
  --crypto-card-shadow-hover: 0 12px 44px rgba(0, 0, 0, 0.55), 0 0 28px var(--zs-green-soft);
  --crypto-tile-shadow: var(--crypto-card-shadow);
  --crypto-tile-shadow-hover: var(--crypto-card-shadow-hover);

  /* Overview chart card (crypto-fin-*) — dark default */
  --crypto-fin-bg: #0b1110;
  --crypto-fin-border: rgba(255, 255, 255, 0.06);
  --crypto-fin-shadow: var(--crypto-card-shadow);
  --crypto-fin-text: var(--zs-text-primary, #f5f7fa);
  --crypto-fin-text-muted: #9ca3af;
  --crypto-fin-text-secondary: #94a3b8;
  --crypto-fin-text-faint: #64748b;
  --crypto-fin-logo-bg: rgba(255, 255, 255, 0.05);
  --crypto-fin-divider: rgba(255, 255, 255, 0.06);
  --crypto-fin-surface-muted: rgba(255, 255, 255, 0.04);
  --crypto-fin-surface-hover: rgba(255, 255, 255, 0.06);
  --crypto-fin-tabs-bg: rgba(255, 255, 255, 0.04);
  --crypto-fin-tab-text: #94a3b8;
  --crypto-fin-tab-hover-text: #e2e8f0;
  --crypto-fin-tab-active-bg: rgba(59, 130, 246, 0.18);
  --crypto-fin-tab-active-text: #60a5fa;
  --crypto-fin-tab-active-shadow: 0 1px 2px rgba(59, 130, 246, 0.15);
  --crypto-fin-change-range-bg: rgba(255, 255, 255, 0.06);
  --crypto-fin-grid: rgba(255, 255, 255, 0.05);
  --crypto-fin-axis: #9ca3af;
  --crypto-fin-axis-strong: #94a3b8;
  --crypto-fin-cursor: rgba(255, 255, 255, 0.18);
  --crypto-fin-active-dot-stroke: #0b1110;
  --crypto-fin-tooltip-bg: #141916;
  --crypto-fin-tooltip-border: rgba(255, 255, 255, 0.08);
  --crypto-fin-tooltip-shadow: 0 8px 24px rgba(0, 0, 0, 0.45);
  --crypto-fin-tooltip-state-border: rgba(255, 255, 255, 0.06);
  --crypto-fin-tooltip-state-text: #cbd5e1;
  --crypto-fin-tooltip-note: #94a3b8;
  --crypto-fin-metric-icon-bg: rgba(255, 255, 255, 0.05);
  --crypto-fin-metric-icon-color: #94a3b8;
  --crypto-fin-metric-unit-bg: rgba(255, 255, 255, 0.06);
  --crypto-fin-metric-unit-text: #94a3b8;
  --crypto-fin-popover-bg: #141916;
  --crypto-fin-popover-border: rgba(255, 255, 255, 0.08);
  --crypto-fin-popover-shadow: 0 8px 28px rgba(0, 0, 0, 0.5);
  --crypto-fin-search-bg: rgba(255, 255, 255, 0.04);
  --crypto-fin-search-focus-bg: rgba(255, 255, 255, 0.06);
  --crypto-fin-up: #16a34a;
  --crypto-fin-down: #ef4444;
  --crypto-area-up-top: rgba(16, 185, 129, 0.34);
  --crypto-area-up-mid: rgba(16, 185, 129, 0.18);
  --crypto-area-up-bottom: rgba(16, 185, 129, 0);
  --crypto-area-down-top: rgba(239, 68, 68, 0.29);
  --crypto-area-down-mid: rgba(239, 68, 68, 0.145);
  --crypto-area-down-bottom: rgba(239, 68, 68, 0);
  --crypto-fin-warning: #ff9800;
  --crypto-fin-price-up: #4ade80;
  --crypto-fin-price-down: #f87171;
  --crypto-fin-flash-up: rgba(74, 222, 128, 0.12);
  --crypto-fin-flash-down: rgba(248, 113, 113, 0.1);
  --crypto-fin-skeleton-stroke: rgba(255, 255, 255, 0.08);
  --crypto-fin-skeleton-fill: rgba(255, 255, 255, 0.12);
  --crypto-fin-dot-stroke: #ffffff;
  --crypto-mc-chart-up: #18c37e;
  --crypto-mc-chart-grid: rgba(255, 255, 255, 0.02);
  --crypto-mc-chart-grid-opacity: 1;
  --crypto-idea-overlay-from: rgba(0, 0, 0, 0.4);
  --crypto-idea-watermark: rgba(255, 255, 255, 0.2);
  --crypto-idea-badge-bg: rgba(0, 0, 0, 0.6);
  --crypto-idea-badge-text: #ffffff;
  --crypto-status-dot-down: var(--crypto-fin-down);
  --crypto-status-dot-warn: var(--crypto-fin-warning);
  --crypto-status-dot-up: var(--zs-green-primary);
  /* Collections panel (dark-styled block) */
  --crypto-coll-text: #f5f7f4;
  --crypto-coll-ok: #a3ff12;
  --crypto-coll-bad: #ff4d4d;
  --crypto-coll-warn: #c9a227;
  --crypto-coll-muted: #9ca3af;
  --crypto-coll-muted-dim: #6b7280;
  --crypto-coll-muted-faint: #7a8080;
  --crypto-coll-separator: #3d4540;
  --crypto-coll-surface: rgba(255, 255, 255, 0.02);
  --crypto-coll-surface-hover: rgba(255, 255, 255, 0.06);
  --crypto-coll-surface-alt: rgba(255, 255, 255, 0.025);
  --crypto-coll-surface-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --crypto-coll-hero-bg: linear-gradient(180deg, rgba(8, 14, 12, 0.98), rgba(3, 5, 4, 1));
  --crypto-coll-panel-bg: linear-gradient(180deg, rgba(6, 9, 8, 0.98), rgba(2, 3, 2, 0.99));
  --crypto-coll-panel-shadow: 0 20px 55px rgba(0, 0, 0, 0.58), inset 0 1px 0 rgba(163, 255, 18, 0.04);
  --crypto-coll-card-bg: linear-gradient(145deg, rgba(7, 11, 10, 0.88), rgba(3, 5, 4, 0.92));
  --crypto-coll-card-shadow: 0 10px 30px rgba(0, 0, 0, 0.35);
  --crypto-coll-card-shadow-hover: 0 12px 36px rgba(0, 0, 0, 0.5), 0 0 24px rgba(163, 255, 18, 0.06);
  --crypto-coll-card-shadow-active: 0 14px 40px rgba(0, 0, 0, 0.5), 0 0 36px rgba(163, 255, 18, 0.1);
  --crypto-coll-accent: rgba(163, 255, 18, 0.4);
  --crypto-coll-inner-highlight: rgba(255, 255, 255, 0.02);
  --crypto-coll-badge-bg: rgba(12, 16, 15, 0.5);
  --crypto-coll-badge-border-ok: rgba(163, 255, 18, 0.25);
  --crypto-coll-badge-glow-ok: rgba(163, 255, 18, 0.1);
  --crypto-coll-badge-border-bad: rgba(255, 77, 77, 0.22);
  --crypto-coll-badge-glow-bad: rgba(255, 77, 77, 0.08);
  --crypto-coll-badge-border-warn: rgba(201, 162, 39, 0.22);
  --crypto-coll-badge-glow-warn: rgba(201, 162, 39, 0.08);
  --crypto-coll-inner-tint-red: rgba(255, 77, 77, 0.06);
  --crypto-coll-inner-tint-green: rgba(163, 255, 18, 0.06);
  --crypto-coll-inner-tint-green-bright: rgba(196, 255, 61, 0.07);
  --crypto-coll-inner-tint-warn: rgba(201, 162, 39, 0.05);
  --crypto-coll-inner-tint-neutral: rgba(163, 255, 18, 0.04);
  --crypto-coll-inner-inset: rgba(255, 255, 255, 0.025);
  --crypto-coll-surface-chip: rgba(255, 255, 255, 0.03);
  --crypto-coll-surface-chip-hover: rgba(255, 255, 255, 0.06);
  --crypto-coll-hero-grad-red: linear-gradient(180deg, rgba(255, 77, 77, 0.08), transparent 60%);
  --crypto-coll-hero-grad-green: linear-gradient(180deg, rgba(163, 255, 18, 0.08), transparent 60%);
  --crypto-coll-hero-grad-green-bright: linear-gradient(180deg, rgba(196, 255, 61, 0.09), transparent 60%);
  --crypto-coll-hero-grad-warn: linear-gradient(180deg, rgba(201, 162, 39, 0.07), transparent 60%);
  --crypto-coll-hero-grad-neutral: linear-gradient(180deg, rgba(163, 255, 18, 0.05), transparent 60%);
  --crypto-coll-shimmer: linear-gradient(100deg, transparent, rgba(163, 255, 18, 0.055), rgba(120, 120, 120, 0.04), transparent);
  --crypto-coll-skeleton-bar: rgba(255, 255, 255, 0.05);
  --crypto-coll-skeleton-line: rgba(255, 255, 255, 0.04);
  --crypto-coll-skeleton-title: #0a0e0d;
  --crypto-coll-insight-label: #5a625e;
  --crypto-coll-progress-track: #020403;
  --crypto-coll-icon-mask: #7c847e;
  --crypto-coll-icon-mask-hover: #8e968f;
  --crypto-coll-tile-bg: linear-gradient(145deg, rgba(24, 32, 28, 0.9), rgba(8, 10, 9, 0.95));
  --crypto-coll-tile-shadow: inset 0 1px 0 rgba(163, 255, 18, 0.05), 0 3px 12px rgba(0, 0, 0, 0.45);
  --crypto-coll-tile-shadow-hover: 0 4px 16px rgba(0, 0, 0, 0.5), inset 0 1px 0 rgba(163, 255, 18, 0.08);
}

/* Lock neon brand on crypto dark (overrides html.light inheritance if both are active) */
[data-zs-crypto-root][data-zs-theme="dark"] {
  --zs-green-primary: #a3ff12;
  --zs-green-dark: #8eea00;
  --zs-green-hover: #6fcc00;
  --zs-green-light: #c2ff4d;
  --zs-green-glow: rgba(163, 255, 18, 0.35);
  --zs-green-soft: rgba(163, 255, 18, 0.08);
  --zs-green-border: rgba(163, 255, 18, 0.2);
  --zs-green-on: #0a0e07;
  --zs-shadow-green: 0 0 28px rgba(163, 255, 18, 0.22), 0 10px 28px rgba(0, 0, 0, 0.45);
}

[data-zs-crypto-root][data-zs-theme="light"] {
  --crypto-canvas: #f2f4f3;

  /* Brand accent slots — neutral only (matches html.light) */
  --zs-green-primary: #111827;
  --zs-green-dark: #000000;
  --zs-green-hover: #1f2937;
  --zs-green-light: #374151;
  --zs-green-soft: rgba(17, 24, 39, 0.08);
  --zs-green-glow: rgba(17, 24, 39, 0.12);
  --zs-green-border: rgba(17, 24, 39, 0.16);
  --zs-green-on: #ffffff;
  --zs-shadow-green: 0 4px 14px rgba(15, 23, 42, 0.08);
  --zs-green: #111827;

  --zs-success: #111827;
  --zs-success-soft: rgba(17, 24, 39, 0.08);
  --zs-success-border: rgba(17, 24, 39, 0.18);

  --zs-text-primary: #030504;
  --zs-text-secondary: #475569;
  --zs-text-muted: #64748b;

  --zs-surface-1: #ffffff;
  --zs-surface-2: #f1f5f4;
  --zs-surface-3: #e2e8e6;

  --zs-border-subtle: rgba(15, 23, 42, 0.05);
  --zs-border-soft: rgba(15, 23, 42, 0.07);
  --zs-border-mid: rgba(15, 23, 42, 0.1);
  --zs-border-strong: rgba(15, 23, 42, 0.16);

  --crypto-row-divider: rgba(15, 23, 42, 0.07);

  --crypto-row-zebra: rgba(15, 23, 42, 0.03);
  --crypto-row-hover-bg: rgba(15, 23, 42, 0.045);
  --crypto-row-hover-shadow: 0 4px 12px rgba(15, 23, 42, 0.1);

  --crypto-card-shadow: 0 2px 12px rgba(15, 23, 42, 0.06), 0 10px 32px rgba(15, 23, 42, 0.08);
  --crypto-card-shadow-hover: 0 12px 40px rgba(15, 23, 42, 0.12), 0 0 22px var(--zs-green-soft);
  --crypto-tile-shadow: var(--crypto-card-shadow);
  --crypto-tile-shadow-hover: var(--crypto-card-shadow-hover);

  /* Hero / gradient strips that used --zs-dark + --zs-surface-3 */
  --zs-dark: #dce3e0;

  /* Overview chart card — light (preserve existing white card) */
  --crypto-fin-bg: #ffffff;
  --crypto-fin-border: #eef0f3;
  --crypto-fin-shadow: 0 4px 24px rgba(15, 23, 42, 0.06), 0 1px 3px rgba(15, 23, 42, 0.04);
  --crypto-fin-text: #0b1221;
  --crypto-fin-text-muted: #9ca3af;
  --crypto-fin-text-secondary: #6b7280;
  --crypto-fin-text-faint: #64748b;
  --crypto-fin-logo-bg: #f3f4f6;
  --crypto-fin-divider: #f0f2f5;
  --crypto-fin-surface-muted: #f4f6f8;
  --crypto-fin-surface-hover: #f9fafb;
  --crypto-fin-tabs-bg: #f4f6f8;
  --crypto-fin-tab-text: #6b7280;
  --crypto-fin-tab-hover-text: #111827;
  --crypto-fin-tab-active-bg: #e8f0ff;
  --crypto-fin-tab-active-text: #2563eb;
  --crypto-fin-tab-active-shadow: 0 1px 2px rgba(37, 99, 235, 0.12);
  --crypto-fin-change-range-bg: #f3f4f6;
  --crypto-fin-grid: #eef1f4;
  --crypto-fin-axis: #9ca3af;
  --crypto-fin-axis-strong: #475569;
  --crypto-fin-cursor: #b2b5be;
  --crypto-fin-active-dot-stroke: #ffffff;
  --crypto-fin-tooltip-bg: #ffffff;
  --crypto-fin-tooltip-border: #eef0f3;
  --crypto-fin-tooltip-shadow: 0 6px 20px rgba(15, 23, 42, 0.12);
  --crypto-fin-tooltip-state-border: #f0f2f5;
  --crypto-fin-tooltip-state-text: #334155;
  --crypto-fin-tooltip-note: #6b7280;
  --crypto-fin-metric-icon-bg: #f4f6f8;
  --crypto-fin-metric-icon-color: #64748b;
  --crypto-fin-metric-unit-bg: #f1f5f9;
  --crypto-fin-metric-unit-text: #64748b;
  --crypto-fin-popover-bg: #ffffff;
  --crypto-fin-popover-border: #e5e7eb;
  --crypto-fin-popover-shadow: 0 8px 28px rgba(15, 23, 42, 0.12);
  --crypto-fin-search-bg: #fafafa;
  --crypto-fin-search-focus-bg: #ffffff;
  --crypto-fin-up: #16a34a;
  --crypto-fin-down: #ef4444;
  --crypto-area-up-top: rgba(16, 185, 129, 0.38);
  --crypto-area-up-mid: rgba(16, 185, 129, 0.19);
  --crypto-area-up-bottom: rgba(16, 185, 129, 0);
  --crypto-area-down-top: rgba(239, 68, 68, 0.31);
  --crypto-area-down-mid: rgba(239, 68, 68, 0.135);
  --crypto-area-down-bottom: rgba(239, 68, 68, 0);
  --crypto-fin-warning: #ff9800;
  --crypto-fin-price-up: #15803d;
  --crypto-fin-price-down: #b91c1c;
  --crypto-fin-flash-up: rgba(22, 163, 74, 0.1);
  --crypto-fin-flash-down: rgba(239, 68, 68, 0.09);
  --crypto-fin-skeleton-stroke: rgba(15, 23, 42, 0.08);
  --crypto-fin-skeleton-fill: rgba(15, 23, 42, 0.12);
  --crypto-fin-dot-stroke: #ffffff;
  --crypto-mc-chart-up: #111827;
  --crypto-mc-chart-grid: rgba(15, 23, 42, 0.066);
  --crypto-mc-chart-grid-opacity: 1;
  --crypto-idea-overlay-from: rgba(0, 0, 0, 0.4);
  --crypto-idea-watermark: rgba(255, 255, 255, 0.2);
  --crypto-idea-badge-bg: rgba(0, 0, 0, 0.6);
  --crypto-idea-badge-text: #ffffff;
  --crypto-status-dot-down: var(--crypto-fin-down);
  --crypto-status-dot-warn: var(--crypto-fin-warning);
  --crypto-status-dot-up: var(--zs-green-primary);
}

