/* =========================================================
   THEME VARIABLES
========================================================= */

/* LIGHT THEME (default) */
:root {
    --bg: #f9fafb;
    --card: #ffffff;
    --card-soft: #f3f4f6;

    --text: #0f172a;
    --text-light: #6b7280;
    --text-muted: #9ca3af;

    --border: #e5e7eb;

    --primary: #4f46e5;
    --primary-hover: #4338ca;
    --primary-soft: #eef2ff;

    --success: #22c55e;
    --danger: #ef4444;

    --toggle-track-bg: #e5e7eb;
}

/* DARK THEME */
[data-theme="dark"] {
    --bg: #0d0d0d;
    --card: #161616;
    --card-soft: #1e1e1e;

    --text: #f5f5f5;
    --text-light: #a1a1aa;
    --text-muted: #71717a;

    --border: #2a2a2a;

    --primary: #3b82f6;
    --primary-hover: #2563eb;
    --primary-soft: #0f2239;

    --success: #4ade80;
    --danger: #f87171;
    --toggle-track-bg: #374151;
}

/* =========================================================
   BASE
========================================================= */

body {
    background: var(--bg);
    color: var(--text);
}

/* =========================================================
   BACKGROUNDS
========================================================= */

.bg-white {
    background-color: var(--card) !important;
}

.bg-gray-50 {
    background-color: var(--bg) !important;
}

.bg-gray-100 {
    background-color: var(--card-soft) !important;
}

.bg-indigo-50 {
    background-color: var(--primary-soft) !important;
}

.bg-indigo-100 {
    background-color: var(--primary-soft) !important;
}

/* =========================================================
   TEXT COLORS
========================================================= */

.text-gray-900 {
    color: var(--text) !important;
}

.text-gray-800,
.text-gray-700 {
    color: var(--text) !important;
}

.text-gray-600,
.text-gray-500 {
    color: var(--text-light) !important;
}

.text-gray-400 {
    color: var(--text-muted) !important;
}

/* Headings */
h1,
h2,
h3,
h4 {
    color: var(--text) !important;
}

/* =========================================================
   BORDERS
========================================================= */

.border-gray-100,
.border-gray-200 {
    border-color: var(--border) !important;
}

/* =========================================================
   BUTTONS (PRIMARY)
========================================================= */

.bg-indigo-600 {
    background-color: var(--primary) !important;
    color: #fff !important;
}

.bg-indigo-600:hover {
    background-color: var(--primary-hover) !important;
}

/* Fix rounded icon backgrounds */
:not(nav) .bg-indigo-600.rounded-xl,
:not(nav) .bg-indigo-600.rounded-full,
:not(nav) .bg-indigo-600.rounded-2xl,
:not(nav) .bg-indigo-600.rounded-lg {
    background-color: var(--primary) !important;
    border: 1px solid var(--border) !important;
}

/* =========================================================
   NAV ACTIVE (Sidebar Fix)
========================================================= */

nav .bg-indigo-600,
nav a.bg-indigo-600 {
    background-color: var(--primary) !important;
}

nav .bg-indigo-600 span,
nav .bg-indigo-600 svg {
    color: #fff !important;
    stroke: #fff !important;
}

/* =========================================================
   INPUTS / FORMS
========================================================= */

input,
textarea,
select {
    background-color: var(--card) !important;
    border-color: var(--border) !important;
    color: var(--text) !important;
}

input::placeholder,
textarea::placeholder {
    color: var(--text-muted) !important;
}

input:focus,
textarea:focus,
select:focus {
    border-color: var(--primary) !important;
    outline: none !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2) !important;
}

/* =========================================================
   TOGGLES / SWITCH
========================================================= */

input.sr-only.peer:checked~div {
    background-color: var(--primary) !important;
}

/* =========================================================
   BADGES
========================================================= */

.bg-emerald-100 {
    background-color: rgba(34, 197, 94, 0.1) !important;
    color: var(--success) !important;
}

.bg-red-50 {
    background-color: rgba(239, 68, 68, 0.1) !important;
    color: var(--danger) !important;
}

/* =========================================================
   HOVER STATES
========================================================= */

.hover\:bg-gray-50:hover {
    background-color: var(--card-soft) !important;
}

.hover\:bg-gray-100:hover {
    background-color: var(--card-soft) !important;
}

/* =========================================================
   SHADOW (optional tweak for dark)
========================================================= */

[data-theme="dark"] .shadow-sm {
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6) !important;
}

[data-theme="dark"] .shadow-2xl {
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.8) !important;
}

[data-theme="dark"] #tabIndicator {
    background: #1e1e1e;
}

/* Toggle button */
#appearanceToggle {
    background: var(--toggle-track-bg);
}

/* Knob */
#appearanceKnob {
    background: #fff;
}