﻿/* ==== One-time page-transition suppression (Send only) ==== */
/* When html has .no-animate, disable animate.css and any CSS transitions */
html.no-animate .animate__animated {
    animation: none !important;
}

html.no-animate *,
html.no-animate *::before,
html.no-animate *::after {
    transition: none !important;
}
/* Hide any page loader on this one load */
html.no-animate .page-loader {
    display: none !important;
    animation: none !important;
}
/* Stop shimmer animation as well */
html.no-animate .loader-shimmer > span {
    animation: none !important;
}

/* Prevent layout shifts when vertical scrollbar appears/disappears between pages */
html {
    scrollbar-gutter: stable;
}

/* ===== Tooltips ===== */
.tooltip-parent {
    position: relative;
}

.tooltip {
    display: none;
    white-space: nowrap;
    border-radius: .375rem;
    background: #1e293b;
    color: #f1f5f9;
    font-size: .75rem;
    padding: .25rem .5rem;
    box-shadow: 0 10px 15px -3px rgba(0,0,0,.1),0 4px 6px -4px rgba(0,0,0,.1);
    z-index: 3500;
    pointer-events: none;
}

.tooltip-local {
    position: absolute;
    left: 50%;
    top: 100%;
    transform: translateX(-50%) translateY(8px);
}

.tooltip-fixed-side {
    position: fixed;
    transform: translateY(-50%);
}

.tooltip-parent:hover .tooltip,
.tooltip-parent:focus-within .tooltip {
    display: block;
}

body.hide-tooltips .tooltip {
    display: none !important;
}

.tooltip-parent[aria-expanded="true"] .tooltip {
    display: none !important;
}

/* ===== Sidebar flyouts (scoped!) ===== */
/* ⛔️ היה כאן: .submenu { position: fixed; ... } – זה דרס תתי-תפריטים סטטיים.
   ✅ במקום זאת, נרכז את הסטייל לפליי-אאוטים בלבד. */
aside[data-sidebar="main"] .docker-flyout {
    position: fixed;
    z-index: 4000;
    width: 11rem;
    border-radius: .75rem;
    background: #334155;
    color: #e5e7eb;
    border: 1px solid rgba(71,85,105,.6);
    box-shadow: 0 10px 25px rgba(0,0,0,.35);
    padding: .5rem;
    opacity: 0;
    visibility: hidden;
    transition: opacity .15s ease, visibility .15s ease, transform .15s ease;
}
/* הצגה ב-hover/focus (אם אין JS) */
[data-menu="docker-group"]:is(:hover, :focus-within) .docker-flyout {
    opacity: 1;
    visibility: visible;
    transform: none;
}

#chat-top-panel {
    z-index: 5000;
}

/* ===== Page Loader (scoped to content area) ===== */
/* Common loader styles */
.page-loader {
    inset: 0;
    z-index: 9999;
    display: none; /* .show => flex */
    align-items: center;
    justify-content: center;
    background: rgba(2,6,23,0.85);
    backdrop-filter: blur(6px);
}
/* Full-screen variant if ever needed */
.page-loader--fixed {
    position: fixed;
}
/* Inset variant: covers only its positioned parent (#content-shell) */
.page-loader--inset {
    position: absolute;
}
/* Visible state */
.page-loader.show {
    display: flex;
}

.loader-shimmer {
    height: 6px;
    width: 14rem;
    overflow: hidden;
    border-radius: 9999px;
    background: rgba(148,163,184,.35);
}

    .loader-shimmer > span {
        display: block;
        height: 100%;
        width: 40%;
        background: currentColor;
        animation: loader-slide 1.2s linear infinite;
    }

@keyframes loader-slide {
    0% {
        transform: translateX(-100%);
    }

    50% {
        transform: translateX(50%);
    }

    100% {
        transform: translateX(300%);
    }
}

/* ===== Restore Tailwind responsive display utilities (shim) ===== */
@media (min-width: 640px) {
    .sm\:block {
        display: block !important;
    }

    .sm\:inline-block {
        display: inline-block !important;
    }

    .sm\:flex {
        display: flex !important;
    }
}

@media (min-width: 768px) {
    .md\:block {
        display: block !important;
    }

    .md\:inline-flex {
        display: inline-flex !important;
    }

    .md\:flex {
        display: flex !important;
    }
}

/* Utilities בטוחים לשימוש מקומי (במקום .hidden) */
.u-hidden {
    display: none !important;
}

/* Hide scrollbar chrome while keeping scrolling enabled (useful on mobile). */
.u-scrollbar-hide {
    scrollbar-width: none; /* Firefox */
}

.u-scrollbar-hide::-webkit-scrollbar {
    display: none; /* Chrome/Safari */
}

.only-md-flex {
    display: none;
}

@media (min-width: 768px) {
    .only-md-flex {
        display: flex !important;
    }
}

/* ===== Table action pill buttons (Edit/Delete) ===== */
.ldata-action-pill {
    text-decoration: none;
}

html[data-theme="light"] .ldata-action-pill {
    background: rgba(248,250,252,.95) !important;
    color: #0f172a !important;
    border-color: rgba(148,163,184,.85) !important;
}

html[data-theme="light"] .ldata-action-pill:hover {
    background: rgba(226,232,240,.95) !important;
}

html[data-theme="light"] .ldata-action-pill--danger {
    color: #991b1b !important; /* red-800 */
    border-color: rgba(220,38,38,.45) !important; /* red-600-ish */
}

html[data-theme="light"] .ldata-action-pill--danger:hover {
    background: rgba(254,226,226,.85) !important; /* red-100-ish */
}

/* ===== Users forms (Create/Edit/Delete) ===== */
html[data-theme="light"] .ldata-users-form .shadow-soft {
    background: rgba(255,255,255,.92) !important;
    border-color: rgba(148,163,184,.7) !important;
    color: #0f172a !important;
}

html[data-theme="light"] .ldata-users-form .shadow-soft .border-b {
    border-color: rgba(148,163,184,.55) !important;
}

html[data-theme="light"] .ldata-users-form .shadow-soft h3 {
    color: #0f172a !important;
}

html[data-theme="light"] .ldata-users-form label {
    color: #334155 !important;
}

html[data-theme="light"] .ldata-users-form input:not([type="checkbox"]):not([type="radio"]):not([type="range"]),
html[data-theme="light"] .ldata-users-form textarea,
html[data-theme="light"] .ldata-users-form select {
    background: rgba(248,250,252,.98) !important;
    border-color: rgba(148,163,184,.75) !important;
    color: #0f172a !important;
}

html[data-theme="light"] .ldata-users-form input::placeholder,
html[data-theme="light"] .ldata-users-form textarea::placeholder {
    color: rgba(71,85,105,.9) !important;
    opacity: 1 !important;
}

html[data-theme="light"] .ldata-users-form input[readonly],
html[data-theme="light"] .ldata-users-form input[disabled] {
    background: rgba(241,245,249,.98) !important;
    color: rgba(71,85,105,.95) !important;
}

html[data-theme="light"] .ldata-users-form input[type="checkbox"],
html[data-theme="light"] .ldata-users-form input[type="radio"] {
    accent-color: var(--ui-brand, #2563EB);
}

/* LIGHT: Assigned Customers pills (Main/טלפייר etc.) need stronger contrast */
html[data-theme="light"] .ldata-users-form .ldata-assigned-customer-pill {
    background: rgba(248,250,252,.98) !important;
    border-color: rgba(100,116,139,.65) !important;
    color: #0f172a !important;
}

html[data-theme="light"] .ldata-users-form .ldata-assigned-customer-pill:hover {
    background: rgba(241,245,249,.98) !important;
    border-color: rgba(100,116,139,.80) !important;
}

html[data-theme="light"] .ldata-users-form .ldata-assigned-customer-pill.border-emerald-500 {
    border-color: rgb(16 185 129) !important;
    background: rgba(16,185,129,.14) !important;
    color: rgb(4 120 87) !important;
}

/* Secondary action buttons in forms */
html[data-theme="light"] .ldata-users-form .ldata-btn-secondary {
    background: rgba(255,255,255,.92) !important;
    color: #0f172a !important;
    border-color: rgba(148,163,184,.8) !important;
}

html[data-theme="light"] .ldata-users-form .ldata-btn-secondary:hover {
    background: rgba(226,232,240,.9) !important;
}

/* ===== Global Theme Layer (gray / light / black) =====
   Goal:
    - Default is LIGHT (modern bright UI)
   - LIGHT uses a soft white across the site
   - BLACK adds a deeper dark option
   - Icons follow text color (currentColor)
*/

:root {
    /* If UI customization provides --ui-bg, we use it for the gray theme. */
    --app-bg-gray: var(--ui-bg, #0F172A);
    --app-bg-layer-gray:
        radial-gradient(circle at 20% 20%, rgba(30,41,59,.6) 0%, rgba(15,23,42,0) 60%),
        radial-gradient(circle at 80% 10%, rgba(2,6,23,.6) 0%, rgba(15,23,42,0) 70%),
        linear-gradient(to bottom right,
            rgba(15,23,42,1) 0%,
            rgba(30,41,59,1) 50%,
            rgba(15,23,42,1) 100%);
    --app-bg-layer-black:
        radial-gradient(circle at 20% 20%, rgba(0,0,0,.65) 0%, rgba(0,0,0,0) 60%),
        radial-gradient(circle at 80% 10%, rgba(0,0,0,.75) 0%, rgba(0,0,0,0) 70%),
        linear-gradient(to bottom right,
            rgba(0,0,0,1) 0%,
            rgba(10,10,10,1) 50%,
            rgba(0,0,0,1) 100%);
    --app-bg-layer-light:
        radial-gradient(circle at 20% 20%, rgba(226,232,240,.9) 0%, rgba(248,250,252,0) 60%),
        radial-gradient(circle at 80% 10%, rgba(203,213,225,.9) 0%, rgba(248,250,252,0) 70%),
        linear-gradient(to bottom right,
            rgba(248,250,252,1) 0%,
            rgba(226,232,240,1) 50%,
            rgba(248,250,252,1) 100%);
}

html[data-theme="gray"] {
    color-scheme: dark;
    --app-bg-layer: var(--app-bg-layer-gray);

    /* Default UI tokens when Directus theme is not provided */
    --ui-bg: #0F172A;
    --ui-card: rgba(51,65,85,0.80);
}

html[data-theme="black"] {
    color-scheme: dark;
    --app-bg-layer: var(--app-bg-layer-black);

    --ui-bg: #000;
    --ui-card: rgba(17,17,17,0.92);
}

html[data-theme="light"] {
    color-scheme: light;
    --app-bg-layer: var(--app-bg-layer-light);

    --ui-bg: #f8fafc;
    --ui-card: rgba(255,255,255,0.92);
}

/* Background layer */
html[data-theme="gray"] body {
    background-color: var(--app-bg-gray) !important;
    color: #f1f5f9;
}

html[data-theme="black"] body {
    background-color: #000 !important;
    color: #f8fafc;
}

html[data-theme="light"] body {
    /* Soft white (not pure #fff) */
    background-color: #f8fafc !important;
    color: #0f172a;
}

/* Roles table header: black in dark themes */
html[data-theme="gray"] table.roles-table thead,
html[data-theme="black"] table.roles-table thead {
    background-color: rgba(0,0,0,.65) !important;
}

html[data-theme="light"] table.roles-table thead {
    /* Keep consistent with other tables: dark header + light text */
    background-color: rgba(30,41,59,.88) !important; /* slate-800/90-ish */
    color: #f1f5f9;
}

html[data-theme="gray"] .roles-table-shell,
html[data-theme="black"] .roles-table-shell {
    background-color: rgba(0,0,0,.35) !important;
}

html[data-theme="light"] .roles-table-shell {
    /* LIGHT theme normally remaps bg-slate-* to light surfaces; keep this table dark */
    background-color: rgba(51,65,85,.80) !important; /* slate-700/80 */
    color: #f1f5f9;
}

html[data-theme="gray"] table.roles-table,
html[data-theme="black"] table.roles-table {
    background-color: rgba(0,0,0,.45) !important;
}

html[data-theme="light"] table.roles-table {
    background-color: rgba(30,41,59,.35) !important;
}

/* Ensure Tailwind text utilities stay readable inside Roles table (scoped). */
html[data-theme="light"] .roles-table-shell .text-slate-100,
html[data-theme="light"] .roles-table-shell .text-slate-200,
html[data-theme="light"] .roles-table-shell .text-slate-300,
html[data-theme="light"] .roles-table-shell .text-slate-400,
html[data-theme="light"] .roles-table-shell .text-slate-500 {
    color: #f1f5f9 !important;
}

html[data-theme="gray"] table.roles-table tbody tr,
html[data-theme="black"] table.roles-table tbody tr {
    background-color: rgba(0,0,0,.18) !important;
}

html[data-theme="gray"] table.roles-table tbody tr:hover,
html[data-theme="black"] table.roles-table tbody tr:hover {
    background-color: rgba(255,255,255,.05) !important;
}

/* General Settings (Key/Value/Notes tables): follow UI customization tokens */
section[data-page="general-settings"] {
    /* Fallbacks match the previous look if UI variables are missing. */
    --gs-table-bg: var(--ui-card, rgba(0,0,0,.42));
    --gs-table-head-bg: rgba(0,0,0,.78);
    --gs-table-row-bg: transparent;
    --gs-table-row-alt-bg: rgba(0,0,0,.18);
    --gs-table-row-hover-bg: rgba(255,255,255,.05);
    --gs-table-divider: rgba(148,163,184,.28);

    /* Extra surfaces used by Tailwind utility classes within this page (inputs/tabs). */
    --gs-surface-1: var(--ui-card, rgba(0,0,0,.42));
    --gs-surface-2: rgba(0,0,0,.35);
    --gs-input-bg: rgba(0,0,0,.35);
}

/* Dark themes: derive from ui-card / ui-bg when possible. */
/* Gray theme: avoid pure black; match the site's slate/card palette */
html[data-theme="gray"] section[data-page="general-settings"] {
    --gs-table-bg: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 95%, transparent);
    /* Similar to Tailwind bg-slate-800/80 feel, but derived from ui tokens */
    --gs-table-head-bg: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 78%, var(--ui-bg, #0F172A) 22%);
    --gs-table-row-bg: transparent;
    --gs-table-row-alt-bg: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 70%, var(--ui-bg, #0F172A) 30%);
    --gs-table-row-hover-bg: color-mix(in srgb, var(--ui-brand, #3B82F6) 12%, var(--ui-card, rgba(51,65,85,0.8)) 88%);
    --gs-table-divider: color-mix(in srgb, currentColor 16%, transparent);

    --gs-surface-1: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 92%, transparent);
    --gs-surface-2: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 72%, var(--ui-bg, #0F172A) 28%);
    --gs-input-bg: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 84%, var(--ui-bg, #0F172A) 16%);
}

/* Black theme: keep the header darker and more contrasty */
html[data-theme="black"] section[data-page="general-settings"] {
    --gs-table-bg: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 88%, #000 12%);
    --gs-table-head-bg: color-mix(in srgb, #000 70%, var(--ui-card, rgba(51,65,85,0.8)) 30%);
    --gs-table-row-bg: transparent;
    --gs-table-row-alt-bg: color-mix(in srgb, #000 35%, var(--ui-card, rgba(51,65,85,0.8)) 65%);
    --gs-table-row-hover-bg: color-mix(in srgb, var(--ui-brand, #3B82F6) 12%, #000 88%);
    --gs-table-divider: color-mix(in srgb, currentColor 16%, transparent);

    --gs-surface-1: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 86%, #000 14%);
    --gs-surface-2: color-mix(in srgb, #000 55%, var(--ui-card, rgba(51,65,85,0.8)) 45%);
    --gs-input-bg: color-mix(in srgb, #000 35%, var(--ui-card, rgba(51,65,85,0.8)) 65%);
}

/* Light theme: keep a soft, readable look using ui-card + a tiny brand tint on hover. */
html[data-theme="light"] section[data-page="general-settings"] {
    /* Keep Settings table + tabs consistent with Projects (dark table chrome) even in LIGHT. */
    --gs-table-bg: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 92%, transparent);
    --gs-table-head-bg: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 78%, var(--ui-bg, #0F172A) 22%);
    --gs-table-row-bg: transparent;
    --gs-table-row-alt-bg: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 70%, var(--ui-bg, #0F172A) 30%);
    --gs-table-row-hover-bg: color-mix(in srgb, var(--ui-brand, #3B82F6) 12%, var(--ui-card, rgba(51,65,85,0.8)) 88%);
    --gs-table-divider: color-mix(in srgb, currentColor 16%, transparent);

    --gs-surface-1: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 92%, transparent);
    --gs-surface-2: color-mix(in srgb, var(--ui-card, rgba(51,65,85,0.8)) 72%, var(--ui-bg, #0F172A) 28%);

    /* Keep form controls readable (light surface + dark text) in LIGHT. */
    --gs-input-bg: color-mix(in srgb, #0f172a 3%, var(--ui-card, rgba(255,255,255,.92)) 97%);
}

/* LIGHT: General Settings tabs captions should be black.
   Use a light strip background so black text is readable. */
html[data-theme="light"] section[data-page="general-settings"] > .max-w-3xl .inline-flex {
    background-color: rgba(241,245,249,.92) !important; /* slate-100-ish */
    border-color: rgba(100,116,139,.45) !important;
}

html[data-theme="light"] section[data-page="general-settings"] > .max-w-3xl .inline-flex a {
    color: #0f172a !important;
}

html[data-theme="light"] section[data-page="general-settings"] > .max-w-3xl .inline-flex a i {
    color: currentColor !important;
}

html[data-theme="light"] section[data-page="general-settings"] > .max-w-3xl .inline-flex a:hover {
    background-color: rgba(226,232,240,.95) !important; /* slate-200-ish */
}

/* Active tab: keep it highlighted but with black label as requested */
html[data-theme="light"] section[data-page="general-settings"] > .max-w-3xl .inline-flex a.bg-brand {
    background-color: rgba(191,219,254,1) !important; /* blue-200 */
    color: #0f172a !important;
}

section[data-page="general-settings"] table {
    background-color: var(--gs-table-bg) !important;
}

section[data-page="general-settings"] table thead tr {
    background-color: var(--gs-table-head-bg) !important;
    color: inherit;
}

section[data-page="general-settings"] table tbody tr {
    background-color: var(--gs-table-row-bg) !important;
}

section[data-page="general-settings"] table tbody tr:nth-child(even) {
    background-color: var(--gs-table-row-alt-bg) !important;
}

section[data-page="general-settings"] table tbody tr:hover {
    background-color: var(--gs-table-row-hover-bg) !important;
}

/* (Removed) LIGHT-specific overrides that forced Settings table/tabs to a light palette.
   Settings now follows the Projects-style dark table chrome in all themes. */

/* Override Tailwind divide color used on tbody. */
section[data-page="general-settings"] tbody.divide-y > :not([hidden]) ~ :not([hidden]) {
    border-top-color: var(--gs-table-divider) !important;
}

/* Make the surrounding cards match the UI theme as well (prevents bright borders). */
section[data-page="general-settings"] .bg-slate-700\/80 {
    background-color: var(--ui-card, rgba(51,65,85,0.8)) !important;
}

/* These utility classes are heavily used in the Settings tables (header rows, tabs, inputs). */
section[data-page="general-settings"] .bg-slate-800\/80 {
    background-color: var(--gs-table-head-bg) !important;
}

section[data-page="general-settings"] .bg-slate-800\/40 {
    background-color: var(--gs-input-bg) !important;
}

section[data-page="general-settings"] .bg-slate-800\/50 {
    background-color: var(--gs-surface-2) !important;
}

section[data-page="general-settings"] .bg-slate-800\/60 {
    background-color: var(--gs-surface-2) !important;
}

section[data-page="general-settings"] .bg-slate-800\/40:focus,
section[data-page="general-settings"] .bg-slate-800\/40:focus-visible {
    background-color: var(--gs-input-bg) !important;
}

section[data-page="general-settings"] .border-slate-600\/50 {
    border-color: var(--gs-table-divider) !important;
}

section[data-page="general-settings"] .border-slate-500\/60 {
    border-color: var(--gs-table-divider) !important;
}

/* Theme icons inside #theme-toggle */
#theme-toggle [data-theme-icon] {
    display: none;
}
html[data-theme="light"] #theme-toggle [data-theme-icon="light"] { display: block; }
html[data-theme="gray"]  #theme-toggle [data-theme-icon="gray"] { display: block; }
html[data-theme="black"] #theme-toggle [data-theme-icon="black"] { display: block; }

/* Some Tailwind /opacity utility variants are not present in the shipped output.css.
    These are used in Razor for toast banners; define them here to avoid white-on-white. */
.bg-sky-600\/90 { background-color: rgba(2,132,199,.9) !important; }
.bg-amber-600\/90 { background-color: rgba(217,119,6,.9) !important; }
.bg-amber-700\/40 { background-color: rgba(180,83,9,.4) !important; }

/* Topbar + Sidebar use the same Tailwind classes (bg-slate-700, borders, etc).
   Theme-specific palette mapping is handled below via the utility overrides. */

/* Common Tailwind utility overrides for LIGHT so the site doesn't keep dark text/bg classes */
html[data-theme="light"] .bg-slate-900 { background-color: #f8fafc !important; }
html[data-theme="light"] .bg-slate-900\/60 { background-color: rgba(248,250,252,.75) !important; }
html[data-theme="light"] .bg-slate-800 { background-color: #ffffff !important; }
html[data-theme="light"] .bg-slate-800\/80 { background-color: rgba(255,255,255,.88) !important; }
html[data-theme="light"] .bg-slate-800\/60 { background-color: rgba(255,255,255,.82) !important; }
html[data-theme="light"] .bg-slate-800\/40 { background-color: rgba(255,255,255,.72) !important; }
html[data-theme="light"] .bg-slate-700 { background-color: #f1f5f9 !important; }
html[data-theme="light"] .bg-slate-700\/80 { background-color: rgba(241,245,249,.86) !important; }
html[data-theme="light"] .bg-slate-700\/70 { background-color: rgba(241,245,249,.82) !important; }
html[data-theme="light"] .bg-slate-700\/60 { background-color: rgba(241,245,249,.78) !important; }
html[data-theme="light"] .bg-slate-700\/50 { background-color: rgba(241,245,249,.70) !important; }
html[data-theme="light"] .bg-slate-600 { background-color: rgba(226,232,240,.92) !important; }
html[data-theme="light"] .hover\:bg-slate-600:hover { background-color: rgba(226,232,240,.92) !important; }

/* ===== Chrome emphasis (LIGHT) =====
   Add subtle brand-tinted depth to top/left nav without introducing new colors. */
html[data-theme="light"] header[data-topbar] {
    background-color: rgba(255,255,255,.88) !important;
    background-image:
        linear-gradient(to right,
            color-mix(in srgb, var(--ui-brand, #3B82F6) 10%, rgba(255,255,255,.92) 90%) 0%,
            rgba(255,255,255,.92) 55%,
            rgba(255,255,255,.86) 100%);
    border-bottom-color: color-mix(in srgb, var(--ui-brand, #3B82F6) 22%, rgba(148,163,184,.55) 78%) !important;
    box-shadow: 0 10px 24px -18px rgba(15,23,42,.28);
}

html[data-theme="light"] aside[data-sidebar="main"] {
    background-color: rgba(255,255,255,.86) !important;
    background-image:
        linear-gradient(to bottom,
            color-mix(in srgb, var(--ui-brand, #3B82F6) 7%, rgba(255,255,255,.92) 93%) 0%,
            rgba(255,255,255,.86) 45%,
            rgba(248,250,252,.92) 100%);
    border-right-color: color-mix(in srgb, var(--ui-brand, #3B82F6) 18%, rgba(148,163,184,.55) 82%) !important;
    box-shadow: 10px 0 24px -22px rgba(15,23,42,.35);
}

/* Make sidebar link hover/active feel crisp in LIGHT */
aside[data-sidebar="main"] .submenu a,
aside[data-sidebar="main"] .submenu button {
    position: relative;
}

html[data-theme="light"] aside[data-sidebar="main"] .submenu a:hover,
html[data-theme="light"] aside[data-sidebar="main"] .submenu button:hover {
    background-color: color-mix(in srgb, var(--ui-brand, #3B82F6) 10%, rgba(226,232,240,.85) 90%) !important;
}

html[data-theme="light"] aside[data-sidebar="main"] .submenu a.bg-slate-600 {
    background-color: color-mix(in srgb, var(--ui-brand, #3B82F6) 14%, rgba(226,232,240,.92) 86%) !important;
    border: 1px solid color-mix(in srgb, var(--ui-brand, #3B82F6) 22%, rgba(148,163,184,.55) 78%) !important;
}

html[data-theme="light"] aside[data-sidebar="main"] .submenu a.bg-slate-600::before {
    content: "";
    position: absolute;
    left: 0;
    top: 6px;
    bottom: 6px;
    width: 3px;
    border-radius: 9999px;
    background: var(--ui-brand, #3B82F6);
}

/* Slightly emphasize open groups */
html[data-theme="light"] aside[data-sidebar="main"] details[open] > summary {
    background-color: color-mix(in srgb, var(--ui-brand, #3B82F6) 8%, rgba(226,232,240,.65) 92%) !important;
}

html[data-theme="light"] aside[data-sidebar="main"] details[open] > summary i {
    color: color-mix(in srgb, var(--ui-brand, #3B82F6) 70%, #0f172a 30%) !important;
}

/* In LIGHT theme, nav/header and active items should keep dark text.
   Some active states use text-white; scope-fix only inside chrome. */
html[data-theme="light"] header[data-topbar] .text-white,
html[data-theme="light"] aside[data-sidebar="main"] .text-white {
    color: #0f172a !important;
}

/* Topbar clock uses text-slate-200/90; ensure contrast on LIGHT chrome. */
html[data-theme="light"] header[data-topbar] #ldata-topbar-clock {
    color: #0f172a !important;
}

html[data-theme="light"] .text-slate-100 { color: #0f172a !important; }
html[data-theme="light"] .text-slate-200 { color: #0f172a !important; }
html[data-theme="light"] .text-slate-300 { color: #334155 !important; }
html[data-theme="light"] .text-slate-400 { color: #475569 !important; }
html[data-theme="light"] .text-slate-500 { color: #64748b !important; }

/* Syslog level badges are colored via [data-level] (not via text-slate-*).
   In LIGHT theme the page surfaces become light, so the dark-theme badge palette becomes unreadable.
   Scope to #logsTable so this affects Syslog only. */
html[data-theme="light"] #logsTable [data-level] {
    background: rgba(148,163,184,.22) !important;
    border-color: rgba(100,116,139,.55) !important;
    color: #0f172a !important;
}

html[data-theme="light"] #logsTable [data-level="INFO"],
html[data-theme="light"] #logsTable [data-level="NOTICE"] {
    background: rgba(2,132,199,.12) !important;
    border-color: rgba(2,132,199,.35) !important;
    color: #075985 !important; /* sky-800 */
}

html[data-theme="light"] #logsTable [data-level="DEBUG"] {
    background: rgba(16,185,129,.12) !important;
    border-color: rgba(16,185,129,.35) !important;
    color: #047857 !important; /* emerald-700 */
}

html[data-theme="light"] #logsTable [data-level="WARN"] {
    background: rgba(245,158,11,.12) !important;
    border-color: rgba(245,158,11,.35) !important;
    color: #92400e !important; /* amber-800 */
}

html[data-theme="light"] #logsTable [data-level="ERR"],
html[data-theme="light"] #logsTable [data-level="CRIT"],
html[data-theme="light"] #logsTable [data-level="ALERT"],
html[data-theme="light"] #logsTable [data-level="EMERG"] {
    background: rgba(220,38,38,.10) !important;
    border-color: rgba(220,38,38,.35) !important;
    color: #991b1b !important; /* red-800 */
}

/* Syslog “Quick” range buttons: override page-local dark styles in LIGHT mode. */
html[data-theme="light"] section[data-page="general-syslog"] .qr-btn {
    background: rgba(241,245,249,.92) !important; /* slate-100-ish */
    border-color: rgba(148,163,184,.75) !important;
    color: #0f172a !important;
}

html[data-theme="light"] section[data-page="general-syslog"] .qr-btn:hover {
    background: rgba(226,232,240,.92) !important; /* slate-200-ish */
}

html[data-theme="light"] section[data-page="general-syslog"] .qr-btn:focus-visible {
    outline: 2px solid color-mix(in srgb, var(--ui-brand, #3B82F6) 55%, transparent) !important;
    outline-offset: 2px;
}

/* In LIGHT theme, most form controls should use a light surface + dark text.
   Many pages use dark-slate utility backgrounds even in LIGHT, which makes
   black placeholders/text hard to read unless we normalize these classes. */
html[data-theme="light"] input.bg-slate-800\/40:not([type="checkbox"]):not([type="radio"]),
html[data-theme="light"] textarea.bg-slate-800\/40,
html[data-theme="light"] select.bg-slate-800\/40,
html[data-theme="light"] input.bg-slate-700\/60:not([type="checkbox"]):not([type="radio"]),
html[data-theme="light"] textarea.bg-slate-700\/60,
html[data-theme="light"] select.bg-slate-700\/60,
html[data-theme="light"] input.bg-slate-800\/60:not([type="checkbox"]):not([type="radio"]),
html[data-theme="light"] textarea.bg-slate-800\/60,
html[data-theme="light"] select.bg-slate-800\/60 {
    background-color: rgba(241,245,249,.92) !important; /* slate-100-ish */
    color: #0f172a !important;
    border-color: rgba(100,116,139,.65) !important;
}

/* Checkboxes/radios sometimes use dark-slate bg utilities for DARK theme.
   In LIGHT, keep them readable, while still allowing the checked fill to show. */
html[data-theme="light"] input[type="checkbox"].bg-slate-800\/40,
html[data-theme="light"] input[type="radio"].bg-slate-800\/40,
html[data-theme="light"] input[type="checkbox"].bg-slate-700\/60,
html[data-theme="light"] input[type="radio"].bg-slate-700\/60,
html[data-theme="light"] input[type="checkbox"].bg-slate-800\/60,
html[data-theme="light"] input[type="radio"].bg-slate-800\/60 {
    background-color: rgba(255,255,255,.98) !important;
    border-color: rgba(100,116,139,.65) !important;
}

html[data-theme="light"] input[type="checkbox"].bg-slate-800\/40:checked,
html[data-theme="light"] input[type="radio"].bg-slate-800\/40:checked,
html[data-theme="light"] input[type="checkbox"].bg-slate-700\/60:checked,
html[data-theme="light"] input[type="radio"].bg-slate-700\/60:checked,
html[data-theme="light"] input[type="checkbox"].bg-slate-800\/60:checked,
html[data-theme="light"] input[type="radio"].bg-slate-800\/60:checked {
    background-color: currentColor !important;
    border-color: transparent !important;
}

html[data-theme="light"] input.bg-slate-800\/40::placeholder,
html[data-theme="light"] textarea.bg-slate-800\/40::placeholder,
html[data-theme="light"] input.bg-slate-700\/60::placeholder,
html[data-theme="light"] textarea.bg-slate-700\/60::placeholder,
html[data-theme="light"] input.bg-slate-800\/60::placeholder,
html[data-theme="light"] textarea.bg-slate-800\/60::placeholder {
    color: #0f172a !important;
    opacity: 1 !important;
}

/* Placeholders should be black in LIGHT theme */
html[data-theme="light"] input::placeholder,
html[data-theme="light"] textarea::placeholder,
html[data-theme="light"] .form-input::placeholder,
html[data-theme="light"] .form-textarea::placeholder,
html[data-theme="light"] input::-webkit-input-placeholder,
html[data-theme="light"] textarea::-webkit-input-placeholder,
html[data-theme="light"] .form-input::-webkit-input-placeholder,
html[data-theme="light"] .form-textarea::-webkit-input-placeholder,
html[data-theme="light"] input::-moz-placeholder,
html[data-theme="light"] textarea::-moz-placeholder,
html[data-theme="light"] .form-input::-moz-placeholder,
html[data-theme="light"] .form-textarea::-moz-placeholder,
html[data-theme="light"] input:-ms-input-placeholder,
html[data-theme="light"] textarea:-ms-input-placeholder,
html[data-theme="light"] .form-input:-ms-input-placeholder,
html[data-theme="light"] .form-textarea:-ms-input-placeholder {
    color: #0f172a !important;
    opacity: 1 !important;
}

html[data-theme="light"] .placeholder-slate-300\/70::placeholder,
html[data-theme="light"] .placeholder-slate-400::placeholder,
html[data-theme="light"] .placeholder-slate-500::placeholder,
html[data-theme="light"] .placeholder-slate-300\/70::-webkit-input-placeholder,
html[data-theme="light"] .placeholder-slate-400::-webkit-input-placeholder,
html[data-theme="light"] .placeholder-slate-500::-webkit-input-placeholder,
html[data-theme="light"] .placeholder-slate-300\/70::-moz-placeholder,
html[data-theme="light"] .placeholder-slate-400::-moz-placeholder,
html[data-theme="light"] .placeholder-slate-500::-moz-placeholder,
html[data-theme="light"] .placeholder-slate-300\/70:-ms-input-placeholder,
html[data-theme="light"] .placeholder-slate-400:-ms-input-placeholder,
html[data-theme="light"] .placeholder-slate-500:-ms-input-placeholder {
    color: #0f172a !important;
    opacity: 1 !important;
}

/* Select text should be black in LIGHT theme (native <select>) */
html[data-theme="light"] select,
html[data-theme="light"] .form-select {
    color: #0f172a !important;
}

html[data-theme="light"] select option,
html[data-theme="light"] .form-select option {
    color: #0f172a !important;
}

/* Syslog filters: the Level/Source "select-like" buttons must remain readable in LIGHT. */
html[data-theme="light"] #levelsButton,
html[data-theme="light"] #sourcesButton {
    background-color: rgba(241,245,249,.92) !important; /* slate-100-ish */
    color: #0f172a !important;
    border-color: rgba(100,116,139,.65) !important;
}

html[data-theme="light"] #levelsButton *,
html[data-theme="light"] #sourcesButton * {
    color: #0f172a !important;
}

/* Syslog Level/Source dropdown menus are intentionally dark even in LIGHT.
   Our global `text-slate-*` remaps would otherwise turn their text dark. */
html[data-theme="light"] #levelsMenu,
html[data-theme="light"] #sourcesMenu {
    color: #f1f5f9 !important;
}

html[data-theme="light"] #levelsMenu .text-slate-100,
html[data-theme="light"] #levelsMenu .text-slate-200,
html[data-theme="light"] #levelsMenu .text-slate-300,
html[data-theme="light"] #levelsMenu .text-slate-400,
html[data-theme="light"] #levelsMenu .text-slate-500,
html[data-theme="light"] #sourcesMenu .text-slate-100,
html[data-theme="light"] #sourcesMenu .text-slate-200,
html[data-theme="light"] #sourcesMenu .text-slate-300,
html[data-theme="light"] #sourcesMenu .text-slate-400,
html[data-theme="light"] #sourcesMenu .text-slate-500 {
    color: #f1f5f9 !important;
}

html[data-theme="light"] #levelsMenu label,
html[data-theme="light"] #levelsMenu button,
html[data-theme="light"] #sourcesMenu label,
html[data-theme="light"] #sourcesMenu button {
    color: #f1f5f9 !important;
}

/* Page header title (text + icon): contrast per theme.
   Needs to come AFTER the LIGHT text-slate-* remaps to win specificity/order. */
html[data-theme="gray"] [data-page-header] [data-page-header-title],
html[data-theme="gray"] [data-page-header] [data-page-header-title] *,
html[data-theme="black"] [data-page-header] [data-page-header-title],
html[data-theme="black"] [data-page-header] [data-page-header-title] * {
    color: #f1f5f9 !important;
}

html[data-theme="light"] [data-page-header] [data-page-header-title],
html[data-theme="light"] [data-page-header] [data-page-header-title] * {
    color: #0f172a !important;
}

html[data-theme] [data-page-header] [data-page-header-title] svg {
    fill: currentColor !important;
    stroke: currentColor !important;
}

html[data-theme="light"] .border-slate-600 { border-color: rgba(148,163,184,.75) !important; }
html[data-theme="light"] .border-slate-600\/50 { border-color: rgba(148,163,184,.55) !important; }
html[data-theme="light"] .border-slate-500\/60 { border-color: rgba(148,163,184,.65) !important; }
html[data-theme="light"] .border-slate-600\/40 { border-color: rgba(148,163,184,.45) !important; }

/* Deeper blacks for BLACK theme (keeps the gray look but darker) */
html[data-theme="black"] .bg-slate-900 { background-color: #000 !important; }
html[data-theme="black"] .bg-slate-800 { background-color: rgba(17,17,17,1) !important; }
html[data-theme="black"] .bg-slate-700 { background-color: rgba(28,28,28,1) !important; }
html[data-theme="black"] .bg-slate-700\/80 { background-color: rgba(28,28,28,.86) !important; }
html[data-theme="black"] .bg-slate-800\/40 { background-color: rgba(17,17,17,.70) !important; }
