
/* Admin-configurable page background (set via --site-bg on :root from PHP) */
html:not([data-theme="dark"]) body {
  background-color: var(--site-bg, #f8fafc);
}
/* FreelanceHub theme – light (default) + dark via html[data-theme="dark"] */
:root {
  --fh-bg: #f8fafc;
  --fh-bg-elevated: #ffffff;
  --fh-text: #0f172a;
  --fh-text-muted: #64748b;
  --fh-border: #e2e8f0;
  --fh-input-bg: #ffffff;
  --fh-sidebar: #ffffff;
  --fh-hover: #f1f5f9;
  --fh-accent: #14b8a6;
  color-scheme: light;
}

html[data-theme="dark"] {
  --fh-bg: #0b1220;
  --fh-bg-elevated: #111827;
  --fh-text: #e5e7eb;
  --fh-text-muted: #94a3b8;
  --fh-border: #1f2a3a;
  --fh-input-bg: #0f172a;
  --fh-sidebar: #0f172a;
  --fh-hover: #1e293b;
  color-scheme: dark;
}

html[data-theme="dark"] body {
  background-color: var(--fh-bg) !important;
  color: var(--fh-text) !important;
}

/* Surfaces */
html[data-theme="dark"] .bg-white,
html[data-theme="dark"] .bg-\[\#f8fafc\],
html[data-theme="dark"] .bg-\[\#f7f8fa\],
html[data-theme="dark"] .bg-slate-50,
html[data-theme="dark"] .bg-slate-50\/80,
html[data-theme="dark"] .bg-slate-50\/50,
html[data-theme="dark"] .bg-gray-50 {
  background-color: var(--fh-bg-elevated) !important;
}

html[data-theme="dark"] .bg-slate-100,
html[data-theme="dark"] .bg-slate-100\/80,
html[data-theme="dark"] .bg-gray-100 {
  background-color: #1e293b !important;
}

html[data-theme="dark"] .bg-slate-200,
html[data-theme="dark"] .bg-gray-200 {
  background-color: #334155 !important;
}

html[data-theme="dark"] .bg-white\/80,
html[data-theme="dark"] .bg-white\/90,
html[data-theme="dark"] .backdrop-blur-md {
  background-color: rgba(17, 24, 39, 0.92) !important;
}

html[data-theme="dark"] .hover\:bg-slate-50:hover,
html[data-theme="dark"] .hover\:bg-slate-100:hover,
html[data-theme="dark"] .hover\:bg-slate-50\/50:hover,
html[data-theme="dark"] .hover\:bg-white:hover {
  background-color: var(--fh-hover) !important;
}

/* Text */
html[data-theme="dark"] .text-slate-900,
html[data-theme="dark"] .text-slate-800,
html[data-theme="dark"] .text-gray-900,
html[data-theme="dark"] .text-gray-800 {
  color: #f1f5f9 !important;
}

html[data-theme="dark"] .text-slate-700,
html[data-theme="dark"] .text-slate-600,
html[data-theme="dark"] .text-gray-700 {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .text-slate-500,
html[data-theme="dark"] .text-slate-400,
html[data-theme="dark"] .text-gray-500,
html[data-theme="dark"] .text-gray-400 {
  color: #94a3b8 !important;
}

html[data-theme="dark"] .text-slate-300 {
  color: #cbd5e1 !important;
}

html[data-theme="dark"] .hover\:text-slate-900:hover,
html[data-theme="dark"] .hover\:text-slate-800:hover,
html[data-theme="dark"] .hover\:text-slate-700:hover {
  color: #f8fafc !important;
}

/* Borders */
html[data-theme="dark"] .border-slate-200,
html[data-theme="dark"] .border-slate-200\/80,
html[data-theme="dark"] .border-slate-200\/60,
html[data-theme="dark"] .border-slate-100,
html[data-theme="dark"] .border-slate-50,
html[data-theme="dark"] .border-gray-200,
html[data-theme="dark"] .border-gray-100 {
  border-color: var(--fh-border) !important;
}

html[data-theme="dark"] .divide-slate-100 > :not([hidden]) ~ :not([hidden]),
html[data-theme="dark"] .divide-slate-200 > :not([hidden]) ~ :not([hidden]),
html[data-theme="dark"] .divide-y > :not([hidden]) ~ :not([hidden]) {
  border-color: var(--fh-border) !important;
}

html[data-theme="dark"] .border-t,
html[data-theme="dark"] .border-b,
html[data-theme="dark"] .border-r,
html[data-theme="dark"] .border-l {
  border-color: var(--fh-border);
}

/* Inputs */
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(--fh-input-bg) !important;
  color: var(--fh-text) !important;
  border-color: var(--fh-border) !important;
}

html[data-theme="dark"] input::placeholder,
html[data-theme="dark"] textarea::placeholder {
  color: #64748b !important;
}

html[data-theme="dark"] input:focus,
html[data-theme="dark"] select:focus,
html[data-theme="dark"] textarea:focus {
  border-color: #334155 !important;
  outline-color: var(--fh-accent);
}

/* Cards / shadows */
html[data-theme="dark"] .shadow-sm,
html[data-theme="dark"] .shadow,
html[data-theme="dark"] .shadow-md,
html[data-theme="dark"] .shadow-lg,
html[data-theme="dark"] .shadow-xl,
html[data-theme="dark"] .shadow-2xl {
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.45) !important;
}

/* Tables */
html[data-theme="dark"] thead {
  background-color: #0f172a !important;
}

html[data-theme="dark"] tr:hover {
  background-color: rgba(30, 41, 59, 0.5);
}

html[data-theme="dark"] td,
html[data-theme="dark"] th {
  border-color: var(--fh-border) !important;
}

/* Primary dark buttons → light in dark mode for contrast */
html[data-theme="dark"] .bg-slate-900 {
  background-color: #e2e8f0 !important;
  color: #0f172a !important;
}
html[data-theme="dark"] .bg-slate-900:hover,
html[data-theme="dark"] .hover\:bg-slate-800:hover {
  background-color: #f8fafc !important;
  color: #0f172a !important;
}
html[data-theme="dark"] .text-white.bg-slate-900,
html[data-theme="dark"] .bg-slate-900.text-white,
html[data-theme="dark"] a.bg-slate-900,
html[data-theme="dark"] button.bg-slate-900 {
  color: #0f172a !important;
}

/* Rings */
html[data-theme="dark"] .ring-slate-200,
html[data-theme="dark"] .ring-slate-100 {
  --tw-ring-color: #334155 !important;
}

/* Headers / sidebars / sticky bars */
html[data-theme="dark"] header,
html[data-theme="dark"] nav,
html[data-theme="dark"] aside {
  border-color: var(--fh-border);
}

html[data-theme="dark"] aside.bg-white,
html[data-theme="dark"] header.bg-white,
html[data-theme="dark"] header.bg-white\/80 {
  background-color: var(--fh-sidebar) !important;
}

/* Theme toggle button */
.fh-theme-toggle {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 2.25rem;
  height: 2.25rem;
  border-radius: 9999px;
  border: 1px solid #e2e8f0;
  background: #fff;
  color: #475569;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
  flex-shrink: 0;
  padding: 0;
}
.fh-theme-toggle:hover {
  background: #f1f5f9;
}
.fh-theme-toggle:focus-visible {
  outline: 2px solid var(--fh-accent);
  outline-offset: 2px;
}
html[data-theme="dark"] .fh-theme-toggle {
  border-color: #334155;
  background: #1e293b;
  color: #fbbf24;
}
html[data-theme="dark"] .fh-theme-toggle:hover {
  background: #334155;
}
.fh-theme-toggle .icon-sun {
  display: none;
}
.fh-theme-toggle .icon-moon {
  display: inline-block;
}
html[data-theme="dark"] .fh-theme-toggle .icon-sun {
  display: inline-block;
}
html[data-theme="dark"] .fh-theme-toggle .icon-moon {
  display: none;
}

/* Soft status backgrounds */
html[data-theme="dark"] .bg-amber-50 {
  background-color: rgba(245, 158, 11, 0.12) !important;
}
html[data-theme="dark"] .bg-red-50 {
  background-color: rgba(239, 68, 68, 0.12) !important;
}
html[data-theme="dark"] .bg-emerald-50,
html[data-theme="dark"] .bg-green-50 {
  background-color: rgba(16, 185, 129, 0.12) !important;
}
html[data-theme="dark"] .bg-blue-50 {
  background-color: rgba(59, 130, 246, 0.12) !important;
}
html[data-theme="dark"] .bg-violet-50,
html[data-theme="dark"] .bg-purple-50 {
  background-color: rgba(139, 92, 246, 0.12) !important;
}
html[data-theme="dark"] .bg-teal-50,
html[data-theme="dark"] .bg-brand-50 {
  background-color: rgba(20, 184, 166, 0.12) !important;
}

/* Live chat widget */
html[data-theme="dark"] #lc-panel {
  background-color: var(--fh-bg-elevated) !important;
  border-color: var(--fh-border) !important;
}
html[data-theme="dark"] #lc-messages {
  background-color: var(--fh-bg) !important;
}
html[data-theme="dark"] #lc-form {
  background-color: var(--fh-bg-elevated) !important;
  border-color: var(--fh-border) !important;
}
html[data-theme="dark"] #lc-identity {
  background-color: #0f172a !important;
  border-color: var(--fh-border) !important;
}

/* Links that use slate hover */
html[data-theme="dark"] a.hover\:text-slate-900:hover {
  color: #f8fafc !important;
}

/* Rounded cards with explicit white */
html[data-theme="dark"] .rounded-2xl.bg-white,
html[data-theme="dark"] .rounded-xl.bg-white,
html[data-theme="dark"] .rounded-lg.bg-white {
  background-color: var(--fh-bg-elevated) !important;
}

/* Mobile nav panels */
html[data-theme="dark"] #mobile-nav {
  background-color: var(--fh-bg-elevated) !important;
  border-color: var(--fh-border) !important;
}
