/* =====================================================================
   VeriTax dark theme — global reskin layer.
   Loaded AFTER style.css on every page (via header.php). Re-maps the
   existing design tokens to the VeriTax dark palette so all legacy pages
   (verify, settings, members, admin, login, wizard…) adopt the new look
   WITHOUT touching their markup or logic. A few hardcoded light surfaces
   are patched explicitly below.
   ===================================================================== */

:root {
  /* Base palette → VeriTax */
  --color-navy-deep: #070A16;
  --color-navy: #141C34;
  --color-navy-2: #1D2747;
  --color-gold: #F5C451;
  --color-gold-strong: #E0A93B;
  --color-gold-soft: rgba(245,196,81,.14);

  --color-page-bg: #070C1B;
  --color-surface: rgba(255,255,255,.04);
  --color-surface-soft: rgba(255,255,255,.025);
  --color-border: rgba(255,255,255,.08);
  --color-ink: #EAF0FF;
  --color-ink-muted: #9AABD2;

  --color-success: #34E0A1;
  --color-warning: #F5C451;
  --color-danger: #FF7B7B;
  --color-info: #38E1FF;
  --color-waiting: #B79CFF;
  --color-teal: #0F766E;

  --bg-primary: var(--color-page-bg);
  --bg-secondary: rgba(255,255,255,.025);
  --bg-glass: rgba(255,255,255,.04);
  --bg-glass-active: rgba(255,255,255,.09);

  --accent-cyan: #38E1FF;
  --accent-violet: #7C5CFF;
  --accent-glow: rgba(124,92,255,.18);
  --accent-gradient: linear-gradient(135deg, #7C5CFF, #38E1FF);

  --text-primary: #EAF0FF;
  --text-secondary: #9AABD2;
  --text-muted: #7787AE;

  --border-color: rgba(255,255,255,.08);
  --border-glow: rgba(245,196,81,.3);

  --status-pass: #34E0A1;
  --status-pass-glow: rgba(52,224,161,.12);
  --status-warning: #F5C451;
  --status-warning-glow: rgba(245,196,81,.12);
  --status-fail: #FF7B7B;
  --status-fail-glow: rgba(255,123,123,.12);
  --status-review: #38E1FF;
  --status-review-glow: rgba(56,225,255,.12);

  --shadow-sm: 0 1px 3px rgba(0,0,0,0.4);
  --shadow-md: 0 6px 16px -6px rgba(0,0,0,0.5);
  --shadow-lg: 0 18px 40px -12px rgba(0,0,0,0.6);
  --shadow-premium: 0 18px 50px -18px rgba(0,0,0,0.65);
}

/* Page background — aurora glow via fixed pseudo-elements, no seams possible */
html {
  background: #070C1B;
  min-height: 100%;
}
body {
  background: transparent !important;  /* must be transparent so pseudo-elements show through */
  min-height: 100vh;
  position: relative;
  color: var(--text-primary);
  font-family: 'Noto Sans Thai', 'Inter', sans-serif;
}
body::before, body::after {
  content: '';
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: -1;
}
/* Purple aurora — top-right corner */
body::before {
  background: radial-gradient(ellipse 70% 60% at 100% 0%, rgba(124,92,255,.22) 0%, transparent 70%);
  filter: blur(40px);
}
/* Cyan aurora — bottom-left corner */
body::after {
  background: radial-gradient(ellipse 70% 60% at 0% 100%, rgba(56,225,255,.16) 0%, transparent 70%);
  filter: blur(40px);
}

/* Glass panels — more opaque dark base so the aurora doesn't muddy them,
   and nested panels read as distinct cards (settings stacks panel-in-panel). */
.glass-panel {
  background: rgba(14,20,40,.72) !important;
  border: 1px solid rgba(255,255,255,.09) !important;
  backdrop-filter: blur(16px) saturate(130%);
  -webkit-backdrop-filter: blur(16px) saturate(130%);
  box-shadow: 0 18px 50px -22px rgba(0,0,0,.6);
}
.glass-panel .glass-panel {
  background: rgba(255,255,255,.04) !important;
  border-color: rgba(255,255,255,.07) !important;
  box-shadow: none;
}
.info-card { background: rgba(255,255,255,.04) !important; border-color: rgba(255,255,255,.08) !important; }

/* App header → translucent dark bar */
.app-header {
  background: rgba(9,14,30,.62) !important;
  backdrop-filter: blur(18px) saturate(140%);
  border-bottom: 1px solid rgba(255,255,255,.08);
}
.app-footer { background: transparent; color: var(--text-muted); }

/* Brand mark → VeriTax gold tile */
.brand-icon {
  background: linear-gradient(135deg,#F5C451,#A8871D) !important;
  color: #0A1024 !important;
}

/* Form controls — patch hardcoded #fff backgrounds to dark glass */
.form-input,
input[type="text"], input[type="number"], input[type="date"],
input[type="email"], input[type="password"], input[type="search"],
select, textarea {
  background: rgba(255,255,255,.04) !important;
  color: var(--text-primary) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
}
.form-input::placeholder, input::placeholder, textarea::placeholder { color: #6B799E !important; }
.form-input:focus, input:focus, select:focus, textarea:focus {
  border-color: rgba(56,225,255,.5) !important;
  background: rgba(56,225,255,.06) !important;
  outline: none;
}
select option { background: #0E1430; color: var(--text-primary); }

/* Primary action → VeriTax gold gradient (was solid navy, low-contrast on dark) */
.btn-primary {
  background: linear-gradient(135deg,#F5C451,#E0A93B) !important;
  color: #0A1024 !important;
  border: none !important;
}
.btn-gold { background: linear-gradient(135deg,#F5C451,#E0A93B) !important; color: #0A1024 !important; }
.btn-secondary {
  background: rgba(255,255,255,.05) !important;
  color: var(--text-primary) !important;
  border: 1px solid rgba(255,255,255,.14) !important;
}
.btn-secondary:hover { background: rgba(255,255,255,.1) !important; }

/* Tables */
.data-table th { color: var(--text-muted); border-bottom-color: rgba(255,255,255,.08); }
.data-table td { border-bottom-color: rgba(255,255,255,.05); }
.data-table tr:hover td { background: rgba(124,92,255,.06); }

/* Modals */
.modal-content {
  background: linear-gradient(180deg,rgba(20,28,52,.97),rgba(13,18,38,.98)) !important;
  border: 1px solid rgba(255,255,255,.12) !important;
  color: var(--text-primary);
}

/* Nav links */
.nav-link { color: var(--text-secondary); }
.nav-link:hover { color: #fff !important; }
.nav-link.active { color: var(--color-gold) !important; border-bottom-color: var(--color-gold); }

/* Scrollbars */
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: rgba(255,255,255,.12); border-radius: 8px; border: 2px solid transparent; background-clip: content-box; }
::-webkit-scrollbar-thumb:hover { background: rgba(255,255,255,.22); background-clip: content-box; }

/* Admin banner */
.admin-banner { background: rgba(124,92,255,.12); border-bottom: 1px solid rgba(124,92,255,.25); color: #C9D3F2; }
.admin-banner a { color: var(--color-gold); }

/* =====================================================================
   Legacy utility-class overrides — these hardcode light greys in
   style.css and need explicit dark-theme contrast fixes.
   ===================================================================== */

/* Text utility colors */
.text-dimmed, .text-light-gray { color: #8FA0C8 !important; }
.text-gray { color: #9AABD2 !important; }
.text-dark-gray { color: #AFBEDF !important; }

/* Tabs */
.tab-nav { background: rgba(255,255,255,.04) !important; border: 1px solid rgba(255,255,255,.08); }
.tab-link { color: #AFBEDF !important; }
.tab-link:hover:not(.active) { background: rgba(255,255,255,.08) !important; color: #EAF0FF !important; }
.tab-link.active { background: linear-gradient(135deg,#F5C451,#E0A93B) !important; color: #0A1024 !important; }

/* List tables */
.list-table thead tr { background: rgba(255,255,255,.04) !important; }
.list-table th { color: #AFBEDF !important; border-bottom-color: rgba(255,255,255,.1) !important; }
.list-table td { border-bottom-color: rgba(255,255,255,.06) !important; }
.list-table tbody tr:hover td { background: rgba(124,92,255,.06); }

/* Data table head */
.data-table th { color: #AFBEDF !important; background: rgba(255,255,255,.03) !important; border-bottom-color: rgba(255,255,255,.12) !important; }

/* Few-shot box */
.fewshot-box { background: rgba(124,92,255,.08) !important; border: 1px solid rgba(124,92,255,.25) !important; }
.fewshot-title { color: #EAF0FF !important; }

/* Hints / small labels */
.form-hint, .form-label-sm, .company-pick-tax, .company-pick-footer a,
.page-header-back, .admin-header-text p, .member-tag .role-member { color: #9AABD2 !important; }
.form-label-sm { color: #AFBEDF !important; }

/* Panels / cards with hardcoded white or light backgrounds */
.details-panel, .onboarding-wait, .admin-create-box, .company-pick-card {
  background: rgba(255,255,255,.04) !important;
  border: 1px solid rgba(255,255,255,.1) !important;
  color: var(--text-primary) !important;
}
.company-pick-card:hover { background: rgba(124,92,255,.08) !important; border-color: rgba(245,196,81,.4) !important; }

/* Badges / tags */
.badge-neutral { background: rgba(255,255,255,.08) !important; color: #C5D0EC !important; }
.member-tag { background: rgba(255,255,255,.07) !important; color: #C5D0EC !important; }

/* Wizard inactive states */
.wizard-step-num.inactive { background: rgba(255,255,255,.1) !important; color: #9AABD2 !important; }
.wizard-step-label.inactive { color: #9AABD2 !important; }
.wizard-connector.inactive { background: rgba(255,255,255,.12) !important; }

/* Small action buttons */
.btn-save-sm { background: rgba(255,255,255,.06) !important; color: #EAF0FF !important; border: 1px solid rgba(255,255,255,.14) !important; }
.btn-delete-sm { background: rgba(255,123,123,.12) !important; color: #FF9B9B !important; border: 1px solid rgba(255,123,123,.4) !important; }
.btn-ghost { color: #AFBEDF !important; border-color: rgba(255,255,255,.14) !important; }
.btn-link-muted { color: #9AABD2 !important; }

/* Light borders → subtle dark borders */
.details-panel, .border-top-light { border-color: rgba(255,255,255,.08) !important; }

/* Alerts → dark-tinted, light text */
.alert-success { background: rgba(52,224,161,.1) !important; border: 1px solid rgba(52,224,161,.3) !important; color: #6FE9BD !important; }
.alert-error   { background: rgba(255,123,123,.1) !important; border: 1px solid rgba(255,123,123,.32) !important; color: #FF9B9B !important; }
.alert-warning { background: rgba(245,196,81,.1) !important; border: 1px solid rgba(245,196,81,.32) !important; color: #F5C451 !important; }
.badge-warning { background: rgba(245,196,81,.14) !important; color: #F5C451 !important; }
.badge-danger  { background: rgba(255,123,123,.14) !important; color: #FF9B9B !important; }
.alert-info    { background: rgba(56,225,255,.1) !important; border: 1px solid rgba(56,225,255,.3) !important; color: #7FE8FF !important; }
.badge-info    { background: rgba(56,225,255,.14) !important; color: #7FE8FF !important; }

/* Admin panel section headings (hardcoded near-black #1e293b) */
.admin-section-h3, .admin-subsection-h3 { color: #EAF0FF !important; }
.member-tag .role-owner { color: #7FB4FF !important; }

/* Select dropdown options (hardcoded dark text) → light on dark */
select option, .nav-company-select option { color: #EAF0FF !important; background: #0E1430 !important; }
select optgroup { color: #7EC8E3 !important; background: #0B1028 !important; font-weight: 700; }
select optgroup option { color: #EAF0FF !important; background: #111832 !important; }

/* Accordion sections — hardcoded --color-navy titles are invisible on dark bg */
.accordion-section {
  background: rgba(255,255,255,.04) !important;
  border-color: rgba(255,255,255,.09) !important;
}
.accordion-header {
  background: rgba(255,255,255,.03) !important;
}
.accordion-header:hover {
  background: rgba(124,92,255,.07) !important;
}
.accordion-title {
  color: #EAF0FF !important;
}
.accordion-title .step-num,
.accordion-title .section-num {
  color: var(--color-gold) !important;
  border-color: rgba(245,196,81,.35) !important;
}
.accordion-content {
  border-top-color: rgba(255,255,255,.08) !important;
}
.accordion-toggle-icon { color: #9AABD2 !important; }
