/* Tenant theme packs (Partner dashboard)
   Wrapper: <div id="theme-root" data-theme="...">
   Goals: soft palettes, business look, and guaranteed text contrast.
*/

/* ---------- Global defaults & contrast helpers ---------- */
[data-theme] {
  --text-primary: #0f172a;   /* slate-900 */
  --text-muted:   #475569;   /* slate-600 */
  --bg-page:      #ffffff;   /* per-theme can override */
  --bg-sidebar:   #ffffff;
  --border:       #e5e7eb;   /* gray-200 */
  --ring-focus:   #a5b4fc;   /* indigo-300 */
  --font-display: Inter, ui-sans-serif, system-ui;
  --font-body:    Inter, ui-sans-serif, system-ui;

  color: var(--text-primary);
  font-family: var(--font-body);
}

/* Apply base colors to core surfaces */
[data-theme] .fi-body {
  background-color: var(--bg-page) !important;
  color: var(--text-primary) !important;
}

[data-theme] .fi-sidebar {
  background-color: var(--bg-sidebar) !important;
  color: var(--text-primary) !important;
}

[data-theme] .fi-card {
  background-color: #ffffff !important;
  border: 1px solid var(--border) !important;
}

[data-theme] a { color: var(--color-primary, #6366f1) !important; }
[data-theme] :focus {
  outline-color: var(--ring-focus) !important;
  box-shadow: 0 0 0 3px var(--ring-focus) !important;
}

[data-theme] h1, 
[data-theme] .fi-header, 
[data-theme] .fi-section-header-heading {
  color: var(--text-primary) !important;
}

/* Buttons (keep accessible contrast on primary) */
[data-theme] .fi-btn-primary,
[data-theme] button[class*="fi-btn-primary"] {
  background-color: var(--color-primary) !important;
  border-color: var(--color-primary) !important;
  color: #ffffff !important; /* AA contrast on all primaries below */
}

/* ---------- DEFAULT + aliases (soft violet/sky on clean white) ---------- */
/* Aliases: ecommerce, education, saas, local_services, hospitality_events */
:root,
[data-theme="default"],
[data-theme="ecommerce"],
[data-theme="education"],
[data-theme="saas"],
[data-theme="local_services"],
[data-theme="hospitality_events"] {
  --color-primary:  #6d28d9;  /* violet-700 (good contrast on white) */
  --color-secondary:#0ea5e9;  /* sky-500 */
  --color-accent:   #16a34a;  /* green-600 */
  --bg-page:        #ffffff;
  --bg-sidebar:     #ffffff;
  --border:         #e5e7eb;
  --ring-focus:     #c4b5fd;  /* violet-300 */
}

[data-theme="default"] .fi-sidebar-header,
[data-theme="ecommerce"] .fi-sidebar-header,
[data-theme="education"] .fi-sidebar-header,
[data-theme="saas"] .fi-sidebar-header,
[data-theme="local_services"] .fi-sidebar-header,
[data-theme="hospitality_events"] .fi-sidebar-header,
[data-theme="default"] .fi-topbar,
[data-theme="ecommerce"] .fi-topbar,
[data-theme="education"] .fi-topbar,
[data-theme="saas"] .fi-topbar,
[data-theme="local_services"] .fi-topbar,
[data-theme="hospitality_events"] .fi-topbar {
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary)) !important;
  color: #ffffff !important; /* high contrast on the gradient */
}

/* ---------- MEDICAL + alias (health_wellness) ---------- */
/* Soft clinical: sky/teal on white */
[data-theme="medical"],
[data-theme="health_wellness"] {
  --color-primary:  #0284c7;  /* sky-600 */
  --color-secondary:#14b8a6;  /* teal-500 */
  --color-accent:   #059669;  /* emerald-600 */
  --bg-page:        #ffffff;
  --bg-sidebar:     #f8fafc;  /* slate-50 */
  --border:         #e2e8f0;  /* slate-200 */
  --ring-focus:     #7dd3fc;  /* sky-300 */
}

[data-theme="medical"] .fi-sidebar-header,
[data-theme="health_wellness"] .fi-sidebar-header,
[data-theme="medical"] .fi-topbar,
[data-theme="health_wellness"] .fi-topbar {
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary)) !important;
  color: #ffffff !important;
}

/* ---------- AGENCY (indigo/cyan, cleaner & softer) ---------- */
[data-theme="agency"] {
  --color-primary:  #6366f1;  /* indigo-500 */
  --color-secondary:#06b6d4;  /* cyan-500 */
  --color-accent:   #f59e0b;  /* amber-500 */
  --bg-page:        #ffffff;
  --bg-sidebar:     #ffffff;
  --border:         #e5e7eb;
  --ring-focus:     #93c5fd;  /* blue-300 */
}

[data-theme="agency"] .fi-sidebar-header,
[data-theme="agency"] .fi-topbar {
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary)) !important;
  color: #ffffff !important;
}

/* ---------- FINANCE + alias (real_estate) ---------- */
/* Trustworthy blue with emerald accent */
[data-theme="finance"],
[data-theme="real_estate"] {
  --color-primary:  #2563eb;  /* blue-600 */
  --color-secondary:#0ea5e9;  /* sky-500 */
  --color-accent:   #059669;  /* emerald-600 */
  --bg-page:        #ffffff;
  --bg-sidebar:     #ffffff;
  --border:         #e5e7eb;
  --ring-focus:     #93c5fd;  /* blue-300 */
}

[data-theme="finance"] .fi-sidebar-header,
[data-theme="real_estate"] .fi-sidebar-header,
[data-theme="finance"] .fi-topbar,
[data-theme="real_estate"] .fi-topbar {
  background: linear-gradient(90deg, var(--color-primary), var(--color-secondary)) !important;
  color: #ffffff !important;
}

/* ---------- FITNESS (softened; no dark UI; business-friendly) ---------- */
/* Was orange/grey & dark—now lighter, with good contrast on white */
[data-theme="fitness"] {
  --color-primary:  #ea580c;  /* orange-600 (AA on white) */
  --color-secondary:#16a34a;  /* green-600 */
  --color-accent:   #0ea5e9;  /* sky-500 */
  --bg-page:        #ffffff;
  --bg-sidebar:     #ffffff;
  --border:         #e5e7eb;
  --ring-focus:     #fdba74;  /* orange-300 */
}

[data-theme="fitness"] .fi-sidebar-header,
[data-theme="fitness"] .fi-topbar {
  /* softer gradient; still readable with white text */
  background: linear-gradient(90deg, #fb923c, var(--color-primary)) !important; /* orange-300 -> orange-600 */
  color: #ffffff !important;
}

/* ---------- Minor utility tweaks for readability ---------- */
[data-theme] .fi-badge,
[data-theme] .fi-badge > span {
  color: #0f172a !important;
}

[data-theme] .fi-input, 
[data-theme] .fi-select, 
[data-theme] .fi-textarea {
  background-color: #ffffff !important;
  color: var(--text-primary) !important;
  border-color: var(--border) !important;
}

[data-theme] .fi-table thead th {
  color: var(--text-muted) !important;
}

[data-theme] .fi-table tbody td {
  color: var(--text-primary) !important;
}

/* Keep charts neutral; Filament/Chart.js will pick up text color */
