/* SMART EMIS Dynamic Theme Token Mapping
   ==========================================================================
   This stylesheet bridges all Tailwind utility classes (brand-*, indigo-*, primary)
   to dynamic CSS variables (--brand-*, --surface, --canvas, --ink, --grad-brand)
   governed by document.documentElement's data-hue attribute:
   [data-hue="indigo|emerald|violet|sky|teal|amber|rose|cyan|slate|custom"].

   This guarantees that any screen (such as Payroll Options SCR-PA01) dynamically
   and instantaneously adapts to user-selected theme hues and dark/light modes.
   ========================================================================== */

/* 1. Brand & Primary Backgrounds (Buttons, Badges, Highlights) */
:is(.bg-brand-600, .bg-indigo-600, .btn-primary, .btn-p, .bg-primary) {
    background-color: rgb(var(--brand-600)) !important;
}

:is(.hover\:bg-brand-700:hover, .hover\:bg-indigo-700:hover) {
    background-color: rgb(var(--brand-700)) !important;
}

:is(.bg-brand-700, .bg-indigo-700) {
    background-color: rgb(var(--brand-700)) !important;
}

:is(.bg-brand-500, .bg-indigo-500) {
    background-color: rgb(var(--brand-500)) !important;
}

:is(.bg-brand-50, .bg-indigo-50) {
    background-color: rgb(var(--brand-50)) !important;
}

:is(.bg-brand-50\/30, .bg-indigo-50\/30) {
    background-color: rgb(var(--brand-50) / 0.3) !important;
}

:is(.bg-brand-50\/40, .bg-indigo-50\/40) {
    background-color: rgb(var(--brand-50) / 0.4) !important;
}

:is(.bg-brand-50\/50, .bg-indigo-50\/50) {
    background-color: rgb(var(--brand-50) / 0.5) !important;
}

:is(.bg-brand-50\/60, .bg-indigo-50\/60) {
    background-color: rgb(var(--brand-50) / 0.6) !important;
}

:is(.bg-brand-50\/70, .bg-indigo-50\/70) {
    background-color: rgb(var(--brand-50) / 0.7) !important;
}

:is(.bg-brand-50\/80, .bg-indigo-50\/80) {
    background-color: rgb(var(--brand-50) / 0.8) !important;
}

:is(.bg-brand-100, .bg-indigo-100) {
    background-color: rgb(var(--brand-100)) !important;
}

:is(.bg-indigo-500\/15) {
    background-color: rgb(var(--brand-500) / 0.15) !important;
}

/* 2. Brand & Primary Text Colors */
:is(.text-brand-600, .text-indigo-600, .text-brand-700, .text-indigo-700) {
    color: rgb(var(--brand-600)) !important;
}

:is(.hover\:text-brand-800:hover, .hover\:text-indigo-800:hover) {
    color: rgb(var(--brand-800)) !important;
}

:is(.text-brand-800, .text-indigo-800) {
    color: rgb(var(--brand-800)) !important;
}

:is(.text-brand-900, .text-indigo-900) {
    color: rgb(var(--brand-900)) !important;
}

:is(.text-brand-950, .text-indigo-950) {
    color: rgb(var(--brand-950)) !important;
}

:is(.text-brand-500, .text-indigo-500) {
    color: rgb(var(--brand-500)) !important;
}

/* Icons inside headers and widgets */
:is(i.text-brand-600, i.text-indigo-600, i.fa-sliders.text-indigo-600, i.fa-list-check.text-indigo-600, i.fa-gear.text-indigo-600, i.fa-circle-info.text-indigo-600) {
    color: rgb(var(--brand-600)) !important;
}

:is(i.text-brand-500, i.text-indigo-500, i.fa-clock-rotate-left.text-indigo-500, i.fa-link.text-indigo-500, i.fa-user-shield.text-indigo-500) {
    color: rgb(var(--brand-500)) !important;
}

/* 3. Borders & Focus Rings */
:is(.border-brand-600, .border-indigo-600) {
    border-color: rgb(var(--brand-600)) !important;
}

:is(.border-brand-500, .border-indigo-500) {
    border-color: rgb(var(--brand-500)) !important;
}

:is(.border-brand-200, .border-indigo-200, .border-brand-200\/60, .border-indigo-200\/60) {
    border-color: rgb(var(--brand-200) / 0.6) !important;
}

:is(.border-brand-300, .border-indigo-300) {
    border-color: rgb(var(--brand-300)) !important;
}

:is(.border-brand-900, .border-indigo-900) {
    border-color: rgb(var(--brand-900)) !important;
}

:is(.border-indigo-500\/30) {
    border-color: rgb(var(--brand-500) / 0.3) !important;
}

/* Spinners and loaders */
.border-indigo-600 {
    border-color: rgb(var(--brand-600)) !important;
}
.border-t-transparent {
    border-top-color: transparent !important;
}

/* Focus and ring utilities */
:is(.ring-brand-500, .ring-indigo-500, .ring-brand-500\/20, .ring-indigo-500\/20) {
    --tw-ring-color: rgb(var(--brand-500) / 0.25) !important;
}

:is(.focus\:ring-indigo-500:focus, .focus\:ring-brand-500:focus) {
    --tw-ring-color: rgb(var(--brand-500) / 0.4) !important;
}

/* 4. Dark Mode Adaptations */
.dark body,
.dark .layout-wrapper,
.dark .layout-page,
.dark .content-wrapper {
    background-color: rgb(var(--canvas)) !important;
    color: rgb(var(--ink)) !important;
}

.dark :is(.bg-white, .focus\:bg-white:focus, .hover\:bg-white:hover):not(.page-hero *) {
    background-color: rgb(var(--surface)) !important;
}

.dark :is(.bg-slate-50, .bg-gray-50, .hover\:bg-slate-50:hover):not(.page-hero *) {
    background-color: rgb(var(--surface-2)) !important;
}

.dark :is(.bg-slate-100, .bg-gray-100, .hover\:bg-slate-100:hover):not(.page-hero *) {
    background-color: rgb(var(--surface-2)) !important;
}

.dark :is(.border-slate-200, .border-slate-200\/80, .border-slate-100):not(.page-hero *) {
    border-color: rgb(var(--border)) !important;
}

.dark :is(.border-slate-300, .hover\:border-slate-300:hover):not(.page-hero *) {
    border-color: rgb(var(--border-strong)) !important;
}

.dark :is(.text-slate-900, .text-slate-800, .hover\:text-slate-900:hover, .hover\:text-slate-800:hover):not(.page-hero *) {
    color: rgb(var(--ink)) !important;
}

.dark :is(.text-slate-700, .text-slate-600, .hover\:text-slate-700:hover, .hover\:text-slate-600:hover):not(.page-hero *) {
    color: rgb(var(--ink-2)) !important;
}

.dark :is(.text-slate-500, .text-slate-400):not(.page-hero *) {
    color: rgb(var(--ink-muted)) !important;
}

.dark :is(.bg-brand-50, .bg-indigo-50, .bg-brand-950\/50, .bg-indigo-950\/50, .bg-indigo-950\/40, .bg-indigo-950\/30, .bg-indigo-950\/20) {
    background-color: rgb(var(--brand-500) / 0.16) !important;
}

.dark :is(.text-brand-600, .text-indigo-600, .text-brand-400, .text-indigo-400, .text-brand-700, .text-indigo-700, .text-brand-800, .text-indigo-800) {
    color: rgb(var(--brand-300)) !important;
}

.dark :is(.hover\:text-indigo-300:hover, .hover\:text-brand-300:hover) {
    color: rgb(var(--brand-200)) !important;
}

.dark :is(i.text-brand-600, i.text-indigo-600, i.text-brand-500, i.text-indigo-500, i.text-brand-400, i.text-indigo-400) {
    color: rgb(var(--brand-400)) !important;
}

.dark :is(.text-brand-950, .text-indigo-950, .text-indigo-200, .text-brand-200) {
    color: rgb(var(--brand-100)) !important;
}

.dark :is(.text-indigo-300, .text-brand-300) {
    color: rgb(var(--brand-200)) !important;
}

.dark :is(.border-brand-600, .border-indigo-600, .border-brand-500, .border-indigo-500) {
    border-color: rgb(var(--brand-500) / 0.45) !important;
}

.dark :is(.border-brand-200, .border-indigo-200, .border-brand-200\/60, .border-indigo-200\/60, .border-brand-900, .border-indigo-900) {
    border-color: rgb(var(--brand-500) / 0.25) !important;
}

/* 5. Header and Brand Gradients */
#es-bar {
    background: var(--header-bg, var(--grad-brand, linear-gradient(135deg, rgb(var(--brand-600)) 0%, rgb(var(--brand-700)) 55%, rgb(var(--brand-900)) 100%))) !important;
}

.bg-grad-brand {
    background-image: var(--grad-brand) !important;
}

.text-grad-brand {
    background-image: var(--grad-brand) !important;
    -webkit-background-clip: text !important;
    background-clip: text !important;
    color: transparent !important;
}
