/* Day 39 — customer portal dark mode. Loaded by resources/views/portal.blade.php; active when <html data-theme="dark">
   (set before first paint by portal-theme.js from the saved choice or the device setting). */
html[data-theme="dark"] {
  color-scheme: dark;
  --pc-bg: #0f141c;
  --pc-surface: #182030;
  --pc-surface-alt: #1f293a;
  --pc-border: #2a3547;
  --pc-border-strong: #3a475c;
  --pc-text: #e6e9ef;
  --pc-text-muted: #a3adbd;
  --pc-text-soft: #7b8698;
  --pc-primary: #737cf8;
  --pc-primary-600: #9aa1ff;
  --pc-primary-50: rgba(139, 147, 255, 0.16);
  --pc-accent: #22d3ee;
  --pc-success: #34d399;
  --pc-success-bg: rgba(52, 211, 153, 0.14);
  --pc-warning: #fbbf24;
  --pc-warning-bg: rgba(251, 191, 36, 0.14);
  --pc-danger: #f87171;
  --pc-danger-bg: rgba(248, 113, 113, 0.14);
  --pc-header-bg: rgba(15, 20, 28, 0.88);
  --pc-shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.4);
  --pc-shadow: 0 1px 3px rgba(0, 0, 0, 0.45), 0 1px 2px rgba(0, 0, 0, 0.3);
  --pc-shadow-lg: 0 12px 32px -12px rgba(0, 0, 0, 0.7), 0 4px 10px -4px rgba(0, 0, 0, 0.5);
}
html[data-theme="dark"] body { background: var(--pc-bg); color: var(--pc-text); }

/* hard-coded light surfaces in Stocky's portal components */
html[data-theme="dark"] .pc-chip { background: var(--pc-surface-alt); color: var(--pc-text-muted); border-color: var(--pc-border-strong); }
html[data-theme="dark"] .pc-chip:hover { color: var(--pc-primary); border-color: var(--pc-primary); }
html[data-theme="dark"] .pc-bottom-nav { background: rgba(15, 20, 28, 0.96); }
html[data-theme="dark"] .pc-stat-highlight { background: var(--pc-surface); border-color: rgba(248, 113, 113, 0.35); }
html[data-theme="dark"] .pc-stat-blue .pc-stat-icon, html[data-theme="dark"] .pc-quick-blue, html[data-theme="dark"] .pc-badge-partial { background: rgba(96, 165, 250, 0.16); color: #93c5fd; }
html[data-theme="dark"] .pc-stat-amber .pc-stat-icon { background: rgba(251, 191, 36, 0.16); color: #fcd34d; }
html[data-theme="dark"] .pc-stat-green .pc-stat-icon, html[data-theme="dark"] .pc-quick-green { background: rgba(52, 211, 153, 0.16); color: #6ee7b7; }
html[data-theme="dark"] .pc-stat-red .pc-stat-icon { background: rgba(248, 113, 113, 0.16); color: #fca5a5; }
html[data-theme="dark"] .pc-quick-violet { background: rgba(167, 139, 250, 0.16); color: #c4b5fd; }
html[data-theme="dark"] .wh-badge-grey { background: #334155; color: #cbd5e1; }
html[data-theme="dark"] code { color: #f0abfc; background: transparent; }

/* "Checking access..." screen (AuthGate) */
html[data-theme="dark"] .auth-gate .auth-gate-loading { background: var(--pc-bg); }
html[data-theme="dark"] .auth-gate .auth-gate-loading p { color: var(--pc-text-muted); }
html[data-theme="dark"] .auth-gate .auth-gate-spinner { border-color: var(--pc-border); border-top-color: var(--pc-primary); }

/* form controls */
html[data-theme="dark"] input:not([type=checkbox]):not([type=radio]):not([type=range]),
html[data-theme="dark"] select, html[data-theme="dark"] textarea {
  background-color: var(--pc-surface-alt); color: var(--pc-text); border-color: var(--pc-border-strong);
}
html[data-theme="dark"] input::placeholder, html[data-theme="dark"] textarea::placeholder { color: var(--pc-text-soft); }
html[data-theme="dark"] option { background: var(--pc-surface); color: var(--pc-text); }

/* language switcher (portal i18n.js) */
html[data-theme="dark"] .pi18n-switch { background: var(--pc-surface); border-color: var(--pc-border-strong); box-shadow: 0 2px 10px rgba(0, 0, 0, 0.5); }
html[data-theme="dark"] .pi18n-switch select { background: transparent; color: var(--pc-text); }

/* theme toggle button (injected into the header by portal-theme.js) */
.wh-theme-btn { display: inline-flex; align-items: center; justify-content: center; width: 38px; height: 38px; border-radius: 10px;
  border: 0; background: transparent; color: var(--pc-text-muted); cursor: pointer; margin-right: 2px; padding: 0; }
.wh-theme-btn:hover { background: var(--pc-surface); color: var(--pc-text); }
.wh-theme-btn svg { width: 20px; height: 20px; }
.pc-header-actions { display: flex; align-items: center; }

/* header room for the theme button: slightly tighter menu; if it still does not fit (long names / languages),
   portal-theme.js adds .wh-nav-compact and the menu shows icons only (labels stay as tooltips) */
.pc-header .pc-nav { justify-content: safe center; }
.pc-header .pc-nav-desktop .pc-nav-link { padding: 0.5rem 0.55rem; gap: 0.35rem; }
.pc-header .pc-user-name { max-width: 120px; }
.pc-header .pc-nav-desktop.wh-nav-compact .pc-nav-link span:not(.pc-nav-icon) { display: none; }
.pc-header .pc-nav-desktop.wh-nav-compact .pc-nav-link { padding: 0.5rem; }
