/* WFM Labs Tools — Light-First Theme Override
   For tools built with standard Tailwind (bg-white, bg-gray-50, etc.)
   Light mode = native styles, Dark mode = CSS overrides */

/* Font: match MIV system font stack */
*, body, html {
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* ═══════════════════════════════════════════════════
   LIGHT MODE — native Tailwind styles, minimal touch
   Just ensure page bg is gray-100 not pure white
   ═══════════════════════════════════════════════════ */

body { transition: background-color 0.2s, color 0.2s; }

/* ═══════════════════════════════════════════════════
   COLORED HEADER BARS — force them to blend with page
   These are inline-color hero/header bars baked into
   compiled React bundles that don't respond to theming
   ═══════════════════════════════════════════════════ */

/* ── Colored header bars: use compiled Tailwind class names ── */

/* Turquoise bar (Time: .bg-\[\#188193\]) */
.bg-\[\#188193\] {
  background-color: #f3f4f6 !important;
  color: #1f2937 !important;
  box-shadow: none !important;
}
.bg-\[\#188193\] * { color: inherit !important; }
.bg-\[\#188193\] .text-white { color: #1f2937 !important; }
/* Turquoise buttons → blue */
.bg-\[\#35948e\] { background-color: #2563eb !important; color: #fff !important; }
.bg-\[\#35948e\]:hover { background-color: #1d4ed8 !important; }
.hover\:bg-\[\#075773\]:hover { background-color: #1d4ed8 !important; }
/* Turquoise text accent */
.text-\[\#188193\] { color: #2563eb !important; }
.text-\[\#35948e\] { color: #2563eb !important; }
.border-\[\#35948e\] { border-color: #3b82f6 !important; }

/* Blue bar (Multi-Objective: .bg-\[\#1A57BF\]) */
.bg-\[\#1A57BF\] {
  background-color: #f3f4f6 !important;
  color: #1f2937 !important;
  box-shadow: none !important;
}
.bg-\[\#1A57BF\] * { color: inherit !important; }
.bg-\[\#1A57BF\] .text-white { color: #1f2937 !important; }
[class*="text-blue-100"] { color: #6B7280 !important; }

/* Blue-800 bar (Occupancy) */
.bg-blue-800 {
  background-color: #f3f4f6 !important;
  color: #1f2937 !important;
  box-shadow: none !important;
}
.bg-blue-800 .text-white { color: #1f2937 !important; }

/* Brand-dark bar (Power One: .bg-brand-dark = #075773) */
.bg-brand-dark {
  background-color: #f3f4f6 !important;
  color: #1f2937 !important;
  box-shadow: none !important;
}
.bg-brand-dark * { color: inherit !important; }
.bg-brand-dark .text-white { color: #1f2937 !important; }
.text-brand-primary { color: #2563eb !important; }
.text-brand-gray-light { color: #6B7280 !important; }
.text-brand-gray-medium { color: #4B5563 !important; }
.border-brand-primary\/20 { border-color: rgba(37,99,235,0.2) !important; }

/* Gray-900 section (MAPE dark hero) */
.bg-gray-900.text-white {
  background-color: #f3f4f6 !important;
  color: #1f2937 !important;
}

/* Sticky nav bars — keep white */
[class*="sticky"][class*="bg-white"] {
  background-color: #ffffff !important;
}

/* Slate-50 page bg (MAPE) */
.bg-slate-50, [class*="bg-slate-50"] {
  background-color: #f3f4f6 !important;
}

/* ── DARK overrides for all header bars ── */
.dark .bg-\[\#188193\] {
  background-color: #030712 !important; color: #f3f4f6 !important;
}
.dark .bg-\[\#188193\] *, .dark .bg-\[\#188193\] .text-white { color: #f3f4f6 !important; }
.dark .bg-\[\#35948e\] { background-color: #3b82f6 !important; color: #fff !important; }
.dark .text-\[\#188193\], .dark .text-\[\#35948e\] { color: #60a5fa !important; }
.dark .border-\[\#35948e\] { border-color: #3b82f6 !important; }

.dark .bg-\[\#1A57BF\] {
  background-color: #030712 !important; color: #f3f4f6 !important;
}
.dark .bg-\[\#1A57BF\] *, .dark .bg-\[\#1A57BF\] .text-white { color: #f3f4f6 !important; }
.dark [class*="text-blue-100"] { color: #9CA3AF !important; }

.dark .bg-blue-800 {
  background-color: #030712 !important; color: #f3f4f6 !important;
}
.dark .bg-blue-800 .text-white { color: #f3f4f6 !important; }

.dark .bg-brand-dark {
  background-color: #030712 !important; color: #f3f4f6 !important;
}
.dark .bg-brand-dark *, .dark .bg-brand-dark .text-white { color: #f3f4f6 !important; }
.dark .text-brand-primary { color: #60a5fa !important; }
.dark .text-brand-gray-light { color: #9CA3AF !important; }
.dark .text-brand-gray-medium { color: #d1d5db !important; }
.dark .border-brand-primary\/20 { border-color: rgba(96,165,250,0.2) !important; }

.dark .bg-gray-900.text-white {
  background-color: #111827 !important; color: #f3f4f6 !important;
}

.dark [class*="sticky"][class*="bg-white"] {
  background-color: #111827 !important; border-color: #374151 !important;
}

.dark .bg-slate-50, .dark [class*="bg-slate-50"] {
  background-color: #030712 !important;
}


/* ═══════════════════════════════════════════════════
   DARK MODE — add dark overrides via .dark class
   Page: #030712 | Cards: #111827 | Insets: #1f2937
   ═══════════════════════════════════════════════════ */

html.dark body {
  background-color: #030712 !important;
  color: #f3f4f6 !important;
}

/* Page backgrounds */
.dark .bg-gray-100, .dark .bg-gray-50,
.dark [class*="bg-gray-100"], .dark [class*="bg-gray-50"] {
  background-color: #030712 !important;
}
.dark .min-h-screen { background-color: #030712 !important; }

/* Cards */
.dark .bg-white, .dark [class*="bg-white"] {
  background-color: #111827 !important;
}

/* Inset/subtle backgrounds */
.dark .bg-blue-50, .dark .bg-green-50, .dark .bg-orange-50,
.dark .bg-red-50, .dark .bg-amber-50, .dark .bg-purple-50,
.dark [class*="bg-blue-50"], .dark [class*="bg-green-50"],
.dark [class*="bg-orange-50"], .dark [class*="bg-red-50"],
.dark [class*="bg-amber-50"], .dark [class*="bg-purple-50"] {
  background-color: #1f2937 !important;
}
.dark .bg-blue-100, .dark .bg-green-100, .dark .bg-orange-100,
.dark [class*="bg-blue-100"], .dark [class*="bg-green-100"],
.dark [class*="bg-orange-100"] {
  background-color: #1e3a5f !important;
}

/* Gray scale backgrounds */
.dark .bg-gray-200, .dark [class*="bg-gray-200"] { background-color: #374151 !important; }
.dark .bg-gray-300, .dark [class*="bg-gray-300"] { background-color: #4b5563 !important; }
.dark .bg-gray-800, .dark [class*="bg-gray-800"] { background-color: #1f2937 !important; }
.dark .bg-gray-900, .dark [class*="bg-gray-900"] { background-color: #111827 !important; }

/* Gradient backgrounds */
.dark [class*="bg-gradient"] {
  opacity: 0.85;
}

/* Text */
.dark .text-gray-900, .dark [class*="text-gray-900"] { color: #f3f4f6 !important; }
.dark .text-gray-800, .dark [class*="text-gray-800"] { color: #e5e7eb !important; }
.dark .text-gray-700, .dark [class*="text-gray-700"] { color: #d1d5db !important; }
.dark .text-gray-600, .dark [class*="text-gray-600"] { color: #9CA3AF !important; }
.dark .text-gray-500, .dark [class*="text-gray-500"] { color: #6B7280 !important; }
.dark .text-gray-400, .dark [class*="text-gray-400"] { color: #9CA3AF !important; }
.dark .text-black { color: #f3f4f6 !important; }
.dark p, .dark span, .dark li, .dark label,
.dark h1, .dark h2, .dark h3, .dark h4, .dark h5, .dark h6,
.dark th, .dark td, .dark dt, .dark dd { color: inherit; }

/* Borders */
.dark .border-gray-200, .dark [class*="border-gray-200"] { border-color: #374151 !important; }
.dark .border-gray-300, .dark [class*="border-gray-300"] { border-color: #4b5563 !important; }
.dark .border-gray-100, .dark [class*="border-gray-100"] { border-color: #1f2937 !important; }
.dark [class*="divide-gray-200"] > * + * { border-color: #374151 !important; }
.dark [class*="divide-gray-100"] > * + * { border-color: #1f2937 !important; }

/* Inputs */
.dark input, .dark select, .dark textarea {
  background-color: #1f2937 !important;
  border-color: #4b5563 !important;
  color: #f3f4f6 !important;
}
.dark input::placeholder, .dark textarea::placeholder {
  color: #6B7280 !important;
}
.dark input:focus, .dark select:focus, .dark textarea:focus {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 0 2px rgba(59,130,246,0.25) !important;
}

/* Range sliders */
.dark input[type="range"] {
  background: #4b5563 !important;
}
.dark input[type="range"]::-webkit-slider-thumb {
  background: #3b82f6 !important;
}
.dark input[type="range"]::-moz-range-thumb {
  background: #3b82f6 !important;
}

/* Tables */
.dark table { border-color: #374151 !important; }
.dark thead { background-color: #0f172a !important; }
.dark th { color: #d1d5db !important; border-color: #374151 !important; }
.dark td { color: #e5e7eb !important; border-color: #1f2937 !important; }
.dark tbody tr { border-color: #1f2937 !important; }
.dark tr:hover { background-color: rgba(59,130,246,0.06) !important; }

/* Shadows */
.dark [class*="shadow"] {
  --tw-shadow-color: rgba(0,0,0,0.3) !important;
}

/* Ring/focus */
.dark [class*="ring-"] {
  --tw-ring-color: rgba(59,130,246,0.4) !important;
}

/* Scrollbar */
.dark ::-webkit-scrollbar { width: 6px; }
.dark ::-webkit-scrollbar-track { background: #030712; }
.dark ::-webkit-scrollbar-thumb { background: #374151; border-radius: 3px; }
.dark ::-webkit-scrollbar-thumb:hover { background: #4b5563; }

/* Misc */
.dark hr { border-color: #374151 !important; }


/* ═══════════════════════════════════════════════════
   TOOLBAR, FOOTER, ABOUT — both modes
   ═══════════════════════════════════════════════════ */

/* Floating toolbar */
#wfm-toolbar {
  position: fixed; top: 12px; right: 16px; z-index: 1000;
  display: flex; align-items: center; gap: 8px;
}
#wfm-about-btn {
  background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
  border: 1px solid #d1d5db; color: #6B7280;
  width: 36px; height: 36px; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 600; transition: all 0.2s; flex-shrink: 0;
}
#wfm-about-btn:hover { border-color: #2563eb; color: #2563eb; }
#wfm-theme-toggle {
  background: rgba(255,255,255,0.9); backdrop-filter: blur(8px);
  border: 1px solid #d1d5db; color: #6B7280;
  width: 36px; height: 36px; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 18px; transition: all 0.2s; flex-shrink: 0;
}
#wfm-theme-toggle:hover { border-color: #2563eb; color: #2563eb; }

/* Dark toolbar */
.dark #wfm-about-btn, .dark #wfm-theme-toggle {
  background: rgba(17,24,39,0.9); border-color: #374151; color: #9CA3AF;
}
.dark #wfm-about-btn:hover, .dark #wfm-theme-toggle:hover {
  border-color: #3b82f6; color: #60a5fa;
}

/* About overlay */
#wfm-about-overlay {
  display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.4);
  z-index: 10000; align-items: center; justify-content: center; padding: 24px;
}
#wfm-about-overlay.active { display: flex; }
#wfm-about-box {
  background: #ffffff; border: 1px solid #e5e7eb; border-radius: 12px;
  padding: 24px; max-width: 560px; width: 100%; max-height: 80vh; overflow-y: auto;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.1);
}
#wfm-about-box h3 { color: #111827; font-size: 18px; font-weight: 700; margin: 0 0 4px 0; }
#wfm-about-box .about-sub { color: #2563eb; font-size: 12px; margin: 0 0 16px 0; }
#wfm-about-box .about-text { color: #374151; font-size: 14px; line-height: 1.7; margin: 0; }
#wfm-about-box .about-close {
  margin-top: 16px; background: #2563eb; color: #fff; border: none;
  padding: 8px 20px; border-radius: 6px; cursor: pointer; font-size: 13px; font-weight: 600;
}
#wfm-about-box .about-close:hover { background: #1d4ed8; }

.dark #wfm-about-box {
  background: #111827; border-color: #374151;
  box-shadow: 0 20px 25px -5px rgba(0,0,0,0.4);
}
.dark #wfm-about-box h3 { color: #f3f4f6; }
.dark #wfm-about-box .about-sub { color: #60a5fa; }
.dark #wfm-about-box .about-text { color: #d1d5db; }

/* Footer */
#wfm-footer {
  background-color: #ffffff; border-top: 1px solid #e5e7eb;
  padding: 16px 24px;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
}
#wfm-footer .footer-top { display: flex; justify-content: space-between; align-items: center; flex-wrap: wrap; gap: 12px; margin-bottom: 12px; }
#wfm-footer .footer-copyright { font-size: 13px; color: #6B7280; }
#wfm-footer .footer-copyright a { color: #2563eb; text-decoration: none; }
#wfm-footer .footer-links { display: flex; gap: 20px; }
#wfm-footer .footer-links a { font-size: 13px; color: #6B7280; text-decoration: none; transition: color 0.2s; }
#wfm-footer .footer-links a:hover { color: #2563eb; }
#wfm-footer .footer-disclaimer { font-size: 11px; color: #9CA3AF; text-align: center; max-width: 800px; margin: 0 auto; line-height: 1.5; }

.dark #wfm-footer { background-color: #111827; border-top-color: #374151; }
.dark #wfm-footer .footer-copyright { color: #9CA3AF; }
.dark #wfm-footer .footer-copyright a { color: #60a5fa; }
.dark #wfm-footer .footer-links a { color: #9CA3AF; }
.dark #wfm-footer .footer-links a:hover { color: #60a5fa; }
.dark #wfm-footer .footer-disclaimer { color: #6B7280; }

/* ═══════════════════════════════════════════════════
   VARIANCE ANALYSIS — tool-specific overrides
   ═══════════════════════════════════════════════════ */

/* Hero title section */
#wfm-hero {
  text-align: center;
  padding: 2rem 1.5rem 0.5rem;
  max-width: 56rem;
  margin: 0 auto;
}
#wfm-hero h1 {
  font-size: 1.875rem;
  font-weight: 700;
  color: #1f2937;
  margin: 0 0 0.5rem 0;
  line-height: 1.2;
}
#wfm-hero p {
  font-size: 0.875rem;
  color: #6B7280;
  margin: 0;
  line-height: 1.6;
}
.dark #wfm-hero h1 { color: #f3f4f6; }
.dark #wfm-hero p { color: #9CA3AF; }

/* Input fields — orange left accent */
input, select {
  border-left: 3px solid #f97316 !important;
}

/* Focus rings → orange */
.focus\:ring-blue-500:focus { --tw-ring-color: rgba(249,115,22,0.5) !important; }
.focus\:border-blue-500:focus { border-color: #f97316 !important; }

/* Card accents */
.bg-white.rounded-lg.shadow,
.bg-white.rounded-lg.shadow-sm,
.bg-white.rounded-lg.shadow-md,
.bg-white.rounded-lg.shadow-lg {
  border-left: 4px solid #f97316 !important;
}

/* Blue header bar → blend with page */
.bg-blue-800 {
  background-color: transparent !important;
  box-shadow: none !important;
}
.dark .bg-blue-800 {
  background-color: transparent !important;
}

/* Colored info panels in dark */
.dark .bg-blue-50 { background-color: rgba(59,130,246,0.08) !important; }
.dark .bg-green-50 { background-color: rgba(16,185,129,0.08) !important; }
.dark .bg-red-50 { background-color: rgba(239,68,68,0.08) !important; }
.dark .bg-amber-50 { background-color: rgba(245,158,11,0.08) !important; }

/* Section header borders → orange accent */
[class*="border-b"][class*="border-blue-200"][class*="text-blue-700"] {
  border-color: #f97316 !important;
  color: #f97316 !important;
}
.dark [class*="border-b"][class*="border-blue-200"][class*="text-blue-700"] {
  border-color: #fb923c !important;
  color: #fb923c !important;
}

/* Table header in dark */
.dark table thead { background-color: #0f172a !important; }
.dark table th { color: #d1d5db !important; border-color: #374151 !important; }
.dark table td { color: #e5e7eb !important; border-color: #1f2937 !important; }
.dark table tbody tr:hover { background-color: rgba(249,115,22,0.06) !important; }
