/**
 * VPM — Global light / dark theme (marketing, auth, app, admin)
 * Set on <html data-theme="light|dark">
 */

html {
  font-family: var(--vpm-font-sans);
  transition: background-color 0.25s ease, color 0.25s ease;
}

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

  --vpm-bg: #f4f7fc;
  --vpm-surface: #ffffff;
  --vpm-surface-muted: #eef2f9;
  --vpm-surface-elevated: #ffffff;
  --vpm-border: #dce3ef;
  --vpm-border-input: #c6d0e0;
  --vpm-text: #111c2d;
  --vpm-text-muted: #5a6270;
  --vpm-text-inverse: #ffffff;
  --vpm-highlight: rgba(17, 28, 45, 0.04);
  --vpm-cta-muted: rgba(41, 98, 255, 0.1);
  --vpm-shadow-sm: 0 1px 2px rgba(17, 28, 45, 0.06);
  --vpm-shadow-md: 0 12px 40px rgba(17, 28, 45, 0.08);
  --vpm-shadow-lg: 0 24px 64px rgba(17, 28, 45, 0.12);
  --vpm-shadow-card: 0 2px 12px rgba(17, 28, 45, 0.06);
  --vpm-chart-grid: #e2e8f0;

  --vpm-i-bg: var(--vpm-bg);
  --vpm-i-surface: var(--vpm-surface);
  --vpm-i-surface-low: #eef2f9;
  --vpm-i-surface-muted: #e7eeff;
  --vpm-i-surface-high: #dee8ff;
  --vpm-i-primary: #0b1524;
  --vpm-i-on-primary: #ffffff;
  --vpm-i-secondary: #006c49;
  --vpm-i-secondary-container: #6cf8bb;
  --vpm-i-on-secondary-container: #00714d;
  --vpm-i-tertiary-container: #ef4444;
  --vpm-i-text: var(--vpm-text);
  --vpm-i-text-muted: var(--vpm-text-muted);
  --vpm-i-outline: var(--vpm-border);
  --vpm-i-border: var(--vpm-border);
  --vpm-i-accent-glow: rgba(0, 108, 73, 0.18);
}

html[data-theme='dark'] {
  color-scheme: dark;

  --vpm-bg: #131722;
  --vpm-surface: #1e222d;
  --vpm-surface-muted: #181c27;
  --vpm-surface-elevated: #2a2e39;
  --vpm-border: #363a45;
  --vpm-border-input: #434651;
  --vpm-text: #e4e7ec;
  --vpm-text-muted: #8b909a;
  --vpm-text-inverse: #ffffff;
  --vpm-highlight: rgba(255, 255, 255, 0.06);
  --vpm-cta-muted: rgba(41, 98, 255, 0.16);
  --vpm-shadow-sm: 0 1px 0 rgba(0, 0, 0, 0.25);
  --vpm-shadow-md: 0 8px 32px rgba(0, 0, 0, 0.35);
  --vpm-shadow-lg: 0 16px 48px rgba(0, 0, 0, 0.45);
  --vpm-shadow-card: 0 2px 8px rgba(0, 0, 0, 0.28);
  --vpm-chart-grid: #363a45;

  --vpm-i-bg: #0d1524;
  --vpm-i-surface: #151d2e;
  --vpm-i-surface-low: #111c2d;
  --vpm-i-surface-muted: #1a2438;
  --vpm-i-surface-high: #243049;
  --vpm-i-primary: #f4f7fc;
  --vpm-i-on-primary: #0b1524;
  --vpm-i-secondary: #6cf8bb;
  --vpm-i-secondary-container: rgba(0, 108, 73, 0.35);
  --vpm-i-on-secondary-container: #6cf8bb;
  --vpm-i-tertiary-container: #f87171;
  --vpm-i-text: #e8ecf4;
  --vpm-i-text-muted: #9aa3b5;
  --vpm-i-outline: #2a3548;
  --vpm-i-border: #2a3548;
  --vpm-i-accent-glow: rgba(41, 98, 255, 0.2);
}

html[data-theme='dark'] .vpm-institutional {
  background: var(--vpm-i-bg);
  color: var(--vpm-i-text);
}

html[data-theme='light'] .vpm-lp-logos__row img {
  filter: grayscale(1);
  opacity: 0.72;
}

html[data-theme='light'] .vpm-lp-logos__row:hover img {
  opacity: 1;
}

html[data-theme='dark'] .vpm-lp-hero__title {
  color: var(--vpm-i-primary);
}

html[data-theme='dark'] .vpm-lp-float {
  background: rgba(30, 38, 56, 0.94);
  border-color: var(--vpm-i-border);
}

html[data-theme='dark'] .vpm-lp-logos {
  background: var(--vpm-i-surface);
}

html[data-theme='dark'] .vpm-lp-logos__row img {
  filter: grayscale(1) invert(1);
  opacity: 0.85;
}

html[data-theme='dark'] .vpm-lp-logos__row:hover img {
  opacity: 1;
}

html[data-theme='dark'] .vpm-i-section--muted {
  background: var(--vpm-i-surface-low);
}

html[data-theme='dark'] .vpm-i-footer {
  background: var(--vpm-i-surface);
}

html[data-theme='dark'] .vpm-i-mobile-nav {
  background: var(--vpm-i-surface);
}

html[data-theme='dark'] .vpm-institutional--refresh .vpm-i-nav.vpm-i-nav--open {
  background: var(--vpm-i-surface);
}

/* Theme toggle */
.vpm-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  padding: 0;
  border: 1px solid var(--vpm-border);
  border-radius: var(--vpm-radius-md);
  background: var(--vpm-surface-elevated);
  color: var(--vpm-text);
  cursor: pointer;
  transition: background var(--vpm-duration) var(--vpm-ease-out),
    border-color var(--vpm-duration) var(--vpm-ease-out);
}

.vpm-theme-toggle:hover {
  background: var(--vpm-highlight);
  border-color: var(--vpm-cta);
}

.vpm-theme-toggle .material-symbols-outlined {
  font-size: 20px;
}

.vpm-theme-toggle [data-theme-icon] {
  display: none;
}

html[data-theme='light'] .vpm-theme-toggle [data-theme-icon='moon'] {
  display: block;
}

html[data-theme='dark'] .vpm-theme-toggle [data-theme-icon='sun'] {
  display: block;
}

.vpm-institutional .vpm-theme-toggle {
  border-color: var(--vpm-i-border);
  background: var(--vpm-i-surface);
  color: var(--vpm-i-text);
}

.vpm-auth-panel .vpm-theme-toggle {
  position: absolute;
  top: var(--vpm-space-2);
  right: var(--vpm-space-2);
  z-index: 2;
}

.vpm-auth-panel {
  position: relative;
}

html[data-theme='light'] .vpm-auth-brand {
  background: linear-gradient(155deg, #0b3d91 0%, #006c49 55%, #111c2d 100%);
}

html[data-theme='dark'] .vpm-auth-brand {
  background: linear-gradient(155deg, #181a20 0%, #0b0e11 55%, #1e2329 100%);
}

/* Dashboard terminal pages (full bleed) */
.vpm-dashboard__content--terminal {
  padding: 0;
  gap: 0;
  max-width: none;
  display: flex;
  flex-direction: column;
  min-height: 0;
  flex: 1;
}

.vpm-dashboard__content--terminal .vpm-context-bar {
  flex-shrink: 0;
  border-bottom: 1px solid var(--vpm-border);
}

.vpm-dashboard__content--terminal [data-vpm-market-terminal] {
  display: flex;
  flex: 1;
  flex-direction: column;
  min-height: 0;
}

.vpm-dashboard__content--terminal .vpm-terminal {
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.vpm-dashboard__content--terminal .vpm-terminal--pro {
  overflow-y: auto;
  overflow-x: hidden;
}

@media (max-width: 1099px) {
  .vpm-dashboard__content--terminal {
    overflow-x: hidden;
  }

  .vpm-dashboard__content--terminal .vpm-dash-header__sub {
    display: none;
  }
}
