/* app/assets/stylesheets/theme_preferences.css
   =========================================================
   USER APPEARANCE PREFERENCES — html[data-theme] / html[data-density]
   Consumes the data-* attributes set on <html> by the layouts.

   The layouts ALSO link this file explicitly (stylesheet_link_tag
   "theme_preferences"), so it is served regardless of how the
   require_tree directives are processed.

   Specificity note: every selector is prefixed with an
   html[data-…] attribute selector, which beats the plain one-class
   selectors in the page stylesheets regardless of concat order.
   ========================================================= */

/* ============ DARK THEME ============ */

/* Shell — body + sidebar carry the dark chrome for every dashboard-   */
/* layout page; content areas are themed per design-system below.      */

html[data-theme="dark"] body.dashboard-body {
  background-color: #0b1220;
  color: #e2e8f0;
}

html[data-theme="dark"] .sidebar {
  background: #0f172a;
  border-color: #1e2a45;
}

html[data-theme="dark"] .sidebar-askwick {
  background: #1e293b;
}

html[data-theme="dark"] .ask-wick-locked:hover {
  background: #24324f;
  color: #94a3b8;
}

/* Shared dark token set (matches the --surface/--text-1 style used by
   dashboard.css, calendar.css and accounts.css). */
html[data-theme="dark"] .dash-page,
html[data-theme="dark"] .cal-page,
html[data-theme="dark"] .acc-page {
  --surface:        #111b30;
  --surface-2:      #16223b;
  --border:         #263452;
  --border-soft:    #1e2a45;
  --text-1:         #e2e8f0;
  --text-2:         #a3aec2;
  --text-3:         #6b7891;
  --accent:         #3b82f6;
  --accent-strong:  #60a5fa;
  --accent-soft:    rgba(59, 130, 246, 0.14);
  --profit-strong:  #34d399;
  --profit-soft:    rgba(16, 185, 129, 0.12);
  --profit-border:  rgba(16, 185, 129, 0.35);
  --loss-strong:    #f87171;
  --loss-soft:      rgba(220, 38, 38, 0.14);
  --loss-border:    rgba(220, 38, 38, 0.35);
  --weekly:         #818cf8;
  --weekly-soft:    rgba(99, 102, 241, 0.14);
  --weekly-border:  rgba(99, 102, 241, 0.4);
  --shadow-card:    0 1px 2px rgba(0, 0, 0, 0.4);
  --shadow-lift:    0 12px 24px -12px rgba(0, 0, 0, 0.6);
}

/* A few hard-coded light hover tints inside dashboard.css. */
html[data-theme="dark"] .dash-page .dash-link-btn:hover,
html[data-theme="dark"] .dash-page .dash-btn--ghost:hover {
  background: #1e2a45;
  border-color: #2c3b5e;
}
html[data-theme="dark"] .dash-page .dash-card-icon--violet { background: rgba(124, 58, 237, .16); color: #a78bfa; }
html[data-theme="dark"] .dash-page .dash-card-icon--amber  { background: rgba(217, 119, 6, .16);  color: #fbbf24; }
html[data-theme="dark"] .dash-page .is-muted               { color: #4d5b76; }
html[data-theme="dark"] .dash-page .is-neutral             { color: #fbbf24; }

/* Trades pages — --t-* tokens (index / show / entry). */
html[data-theme="dark"] .trades-page,
html[data-theme="dark"] .trade-show-page,
html[data-theme="dark"] .trade-entry-page {
  --t-surface:       #111b30;
  --t-surface-2:     #16223b;
  --t-surface-3:     #1e2a45;
  --t-border:        #263452;
  --t-border-soft:   #1e2a45;
  --t-text-1:        #e2e8f0;
  --t-text-2:        #a3aec2;
  --t-text-3:        #6b7891;
  --t-accent:        #3b82f6;
  --t-accent-strong: #60a5fa;
  --t-accent-soft:   rgba(59, 130, 246, 0.14);
  --t-accent-border: rgba(59, 130, 246, 0.4);
  --t-profit:        #34d399;
  --t-profit-strong: #34d399;
  --t-profit-soft:   rgba(16, 185, 129, 0.12);
  --t-profit-border: rgba(16, 185, 129, 0.35);
  --t-loss:          #f87171;
  --t-loss-strong:   #f87171;
  --t-loss-soft:     rgba(220, 38, 38, 0.14);
  --t-loss-border:   rgba(220, 38, 38, 0.35);
}

/* Import center — --i-* tokens. */
html[data-theme="dark"] .import-page {
  --i-surface:      #111b30;
  --i-surface-2:    #16223b;
  --i-surface-3:    #1e2a45;
  --i-border:       #263452;
  --i-border-soft:  #1e2a45;
  --i-text-1:       #e2e8f0;
  --i-text-2:       #a3aec2;
  --i-text-3:       #6b7891;
  --i-accent:       #3b82f6;
  --i-accent-strong:#60a5fa;
  --i-accent-soft:  rgba(59, 130, 246, 0.14);
  --i-accent-border:rgba(59, 130, 246, 0.4);
}

/* Chatroom (Wick AI) — --bg/--surface/--line/--ink family, plus the
   full state-tint set the chat stylesheet adds (green/amber/red softs,
   user-bubble, shadows). Every chat component should ride these tokens
   so dark mode needs no extra selectors. */
html[data-theme="dark"] .chat-shell {
  --bg:       #0b1220;
  --surface:  #10192b;
  --surface-2:#16223b;
  --surface-3:#1e2a45;
  --line:     #263452;
  --line-2:   #1e2a45;
  --ink:      #e2e8f0;
  --ink-2:    #a3aec2;
  --muted:    #6b7891;
  --soft:     #4d5b76;
  --faint:    #243050;

  --green:      #1f9d68;
  --green-2:    #34d399;
  --green-soft: rgba(52, 211, 153, .12);
  --green-line: rgba(52, 211, 153, .35);

  --amber:      #fbbf24;
  --amber-soft: rgba(217, 119, 6, .13);
  --amber-line: rgba(217, 119, 6, .42);

  --red:        #f87171;
  --red-soft:   rgba(220, 38, 38, .16);
  --red-line:   rgba(220, 38, 38, .42);

  --user-bg:    #1d2a45;
  --user-fg:    #edf2fa;

  --shadow-1:  0 0 0 0.5px var(--line);
  --shadow-2:  0 8px 24px -16px rgba(0, 0, 0, .55);
  --shadow-pop: 0 12px 32px -16px rgba(0, 0, 0, .6);
}

/* Ask Wick docked panel + sidebar trigger — same treatment as .chat-shell.
   All ask_wick.css rules are token-driven, so one block flips everything. */
html[data-theme="dark"] .askwick {
  --wick-green:      #1f9d68;
  --wick-green-2:    #34d399;
  --wick-green-soft: rgba(52, 211, 153, .12);
  --wick-green-line: rgba(52, 211, 153, .35);

  --wick-text-1:      #e2e8f0;
  --wick-text-2:      #a3aec2;
  --wick-text-3:      #6b7891;
  --wick-soft:        #4d5b76;

  --wick-border:      #263452;
  --wick-border-soft: #1e2a45;
  --wick-surface:     #10192b;
  --wick-surface-2:   #16223b;
  --wick-surface-3:   #1e2a45;

  --wick-user-bg: #1d2a45;
  --wick-user-fg: #edf2fa;
}

/* Settings design-system tokens (scopes every .s-* / form component). */
html[data-theme="dark"] .settings-page {
  --s-bg:            #0b1220;
  --s-surface:       #10192b;
  --s-surface-2:     #16223b;
  --s-border:         #263452;
  --s-border-soft:   #1e2a45;
  --s-text-1:        #e2e8f0;
  --s-text-2:        #a3aec2;
  --s-text-3:        #6b7891;
  --s-accent:        #3b82f6;
  --s-accent-strong: #60a5fa;
  --s-accent-soft:   rgba(59, 130, 246, 0.14);
  --s-accent-border: rgba(59, 130, 246, 0.4);
  --s-profit:        #34d399;
  --s-profit-soft:   rgba(16, 185, 129, 0.12);
  --s-profit-border: rgba(16, 185, 129, 0.35);
  --s-loss:          #f87171;
  --s-loss-soft:     rgba(220, 38, 38, 0.14);
  --s-loss-border:   rgba(220, 38, 38, 0.35);
  --s-warn:          #fbbf24;
  --s-warn-soft:     rgba(217, 119, 6, 0.14);
  --s-violet:        #a78bfa;
  --s-violet-soft:   rgba(124, 58, 237, 0.14);
  --s-violet-border: rgba(124, 58, 237, 0.4);
  --s-shadow-card:   0 1px 2px rgba(0, 0, 0, 0.4);
  --s-shadow-lift:   0 12px 24px -12px rgba(0, 0, 0, 0.6);
}

html[data-theme="dark"] .main-content {
  background-color: transparent;
}

/* Inputs: browsers render white on dark widgets unless told otherwise. */
html[data-theme="dark"] .settings-page input,
html[data-theme="dark"] .settings-page select,
html[data-theme="dark"] .settings-page textarea {
  background-color: #16223b;
  border-color: #263452;
  color: #e2e8f0;
}

/* ============ DENSITY ============ */
/* Applies wherever the dashboard design system renders tables/cards.  */

html[data-density="compact"] .dash-page .dash-table td,
html[data-density="compact"] .dash-page .dash-table th {
  padding-top: 6px;
  padding-bottom: 6px;
  font-size: 12.5px;
}

html[data-density="spacious"] .dash-page .dash-table td,
html[data-density="spacious"] .dash-page .dash-table th {
  padding-top: 15px;
  padding-bottom: 15px;
  font-size: 13.5px;
}

html[data-density="compact"] .dash-page .dash-metric-value {
  font-size: 21px;
}

html[data-density="spacious"] .dash-page .dash-metric-value {
  font-size: 26px;
}
