/*
 * OmegaMedix theme — loaded after the built Tailwind CSS (no rebuild needed).
 * 1) The brand/ink palettes become a calm navy and slate grays.
 * 2) Primary (emerald) actions become brand blue; green stays for "success" badges.
 * 3) A professional dark slate theme (html.dark), toggled from the header.
 * 4) The sidebar (sd-nav-*) styles.
 */

:root {
    --color-brand-50: #eef5fc;
    --color-brand-100: #d7e6f7;
    --color-brand-200: #b0ccec;
    --color-brand-300: #7fabdc;
    --color-brand-400: #4a85c8;
    --color-brand-500: #2064ab;
    --color-brand-600: #0b4f8f;
    --color-brand-700: #013e81;
    --color-brand-800: #082f5f;
    --color-brand-900: #0a2547;
    --color-brand-950: #061731;

    --color-ink-50: #f8fafc;
    --color-ink-100: #f1f5f9;
    --color-ink-200: #e2e8f0;
    --color-ink-300: #cbd5e1;
    --color-ink-400: #94a3b8;
    --color-ink-500: #64748b;
    --color-ink-600: #475569;
    --color-ink-700: #334155;
    --color-ink-800: #1e293b;
    --color-ink-900: #0f172a;
    --color-ink-950: #020617;

    --sd-accent: #ee830d;
}

body { background-color: #f4f6f9; -webkit-font-smoothing: antialiased; }
#sparks { display: none; } /* the old animated background is gone */

/* Cards: hairline border and a soft shadow instead of heavy outlines */
.rounded-2xl.bg-white, .rounded-xl.bg-white { box-shadow: 0 1px 2px rgb(15 23 42 / .04), 0 1px 3px rgb(15 23 42 / .06); }

/* Keyboard focus is visible but subtle (no white boxes around clicked buttons) */
button:focus, a:focus, summary:focus { outline: none; }
button:focus-visible, a:focus-visible, summary:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--color-brand-300); border-radius: 0.6rem; }

/* ------------------------------------------------------------------ */
/*  Sidebar                                                            */
/* ------------------------------------------------------------------ */
.sd-nav-top {
    display: flex; align-items: center; gap: 0.7rem; width: 100%; margin-bottom: 2px;
    padding: 0.55rem 0.75rem; border-radius: 0.6rem; text-align: start;
    font-size: 0.86rem; font-weight: 600; color: var(--color-ink-600);
    transition: background-color .15s ease, color .15s ease;
}
.sd-nav-top > .truncate { flex: 1 1 auto; min-width: 0; }
.sd-nav-top > svg:first-child { color: var(--color-ink-400); transition: color .15s ease; }
.sd-nav-top:hover { background-color: var(--color-ink-100); color: var(--color-ink-900); }
.sd-nav-top:hover > svg:first-child { color: var(--color-ink-600); }
.sd-nav-top.is-current { color: var(--color-brand-700); }
.sd-nav-top.is-current > svg:first-child, .sd-nav-top.is-active > svg:first-child { color: var(--color-brand-600); }
.sd-nav-top.is-active { background-color: var(--color-brand-50); color: var(--color-brand-700); }
.sd-nav-chevron { width: 15px; height: 15px; flex: none; color: var(--color-ink-400); transition: transform .2s ease; }

.sd-nav-panel > li:first-child { margin-top: 2px; }
.sd-nav-panel > li:last-child { margin-bottom: 8px; }
.sd-nav-panel { margin: 0; margin-inline-start: 1.35rem; padding-inline-start: 0.6rem; border-inline-start: 1px solid var(--color-ink-200); }
.sd-nav-link {
    position: relative; display: flex; align-items: center; gap: 0.5rem;
    padding: 0.42rem 0.65rem; border-radius: 0.5rem; margin: 1px 0;
    font-size: 0.82rem; font-weight: 500; color: var(--color-ink-500);
    transition: background-color .15s ease, color .15s ease;
}
.sd-nav-link > .truncate { flex: 1 1 auto; min-width: 0; }
.sd-nav-link:hover { background-color: var(--color-ink-100); color: var(--color-ink-900); }
.sd-nav-link.is-active { background-color: var(--color-brand-50); color: var(--color-brand-700); font-weight: 600; }
.sd-nav-link.is-active::before {
    content: ''; position: absolute; inset-inline-start: calc(-0.6rem - 1px); top: 22%; bottom: 22%;
    width: 2px; border-radius: 2px; background: var(--color-brand-600);
}
.sd-nav-count {
    flex: none; min-width: 20px; padding: 0 6px; border-radius: 999px; text-align: center;
    font-size: 11px; font-weight: 700; line-height: 20px; color: #fff; background: #dc2626;
}
.sd-nav-customize { margin-top: 0.75rem; padding-top: 0.75rem; border-top: 1px solid var(--color-ink-200); border-radius: 0; font-weight: 500; color: var(--color-ink-500); }
.sd-nav-customize:hover { border-radius: 0.6rem; }
.sd-nav-hidden-count { flex: none; font-size: 11px; font-weight: 600; color: var(--color-ink-400); }

/* Primary actions: SEYDALITI blue (buttons/links only; green badges keep their colour) */
a.bg-emerald-600, button.bg-emerald-600, input.bg-emerald-600 { background-color: var(--color-brand-600) !important; }
a.hover\:bg-emerald-700:hover, button.hover\:bg-emerald-700:hover { background-color: var(--color-brand-700) !important; }
a.text-emerald-700, button.text-emerald-700 { color: var(--color-brand-600); }
a.border-emerald-200.bg-emerald-50 { border-color: var(--color-brand-300) !important; background-color: var(--color-brand-50) !important; color: var(--color-brand-700) !important; }
a.bg-emerald-50, button.bg-emerald-50 { background-color: var(--color-brand-50); color: var(--color-brand-700); border-color: var(--color-brand-200); }
a.bg-emerald-50:hover, button.bg-emerald-50:hover { background-color: var(--color-brand-100); }
.focus\:ring-brand-500\/10:focus { --tw-ring-color: rgb(32 100 171 / 0.15); }

/* Older forms set a border colour without a border: give those fields a visible, rounded box */
input.border-slate-300:not(.border):not([type=checkbox]):not([type=radio]),
select.border-slate-300:not(.border), textarea.border-slate-300:not(.border) {
    border: 1px solid var(--color-ink-300); border-radius: 0.75rem; background-color: #fff;
}
input.border-slate-300:not(.border):not([type=checkbox]):not([type=radio]):not([class*="px-"]),
select.border-slate-300:not(.border):not([class*="px-"]), textarea.border-slate-300:not(.border):not([class*="px-"]) { padding: 0.5rem 0.75rem; }
input.border-slate-300:focus, select.border-slate-300:focus, textarea.border-slate-300:focus {
    outline: none; border-color: var(--color-brand-400); box-shadow: 0 0 0 4px rgb(32 100 171 / 0.12);
}

/* OmegaMedix logo: keep its blue/orange readable on the dark theme */
html.dark img.sd-logo { background: #fff; border-radius: 0.75rem; padding: 4px 8px; box-sizing: content-box; }

/* Online orders waiting for approval */
tr.sd-awaiting { background-color: #fff7ed; }
html.dark tr.sd-awaiting { background-color: rgb(238 131 13 / 0.12); }


/* Rounder, softer buttons like seydaliti */
a.rounded-md.bg-emerald-600, button.rounded-md.bg-emerald-600 { border-radius: 0.75rem; box-shadow: 0 1px 2px rgb(1 62 129 / .25); }

/* ------------------------------------------------------------------ */
/*  Dark slate theme                                                   */
/* ------------------------------------------------------------------ */
html.dark { color-scheme: dark; }
html.dark body { background-color: #0b1120; color: #e2e8f0; }

html.dark .bg-white, html.dark [class*="bg-white/"] { background-color: #111a2e !important; }
html.dark aside#sidebar, html.dark header { background-color: #0e1628 !important; }
html.dark .bg-ink-50, html.dark .bg-slate-50, html.dark .bg-gray-50, html.dark [class*="bg-ink-50/"] { background-color: #0b1120 !important; }
html.dark .bg-ink-100, html.dark .bg-slate-100, html.dark .bg-slate-200, html.dark .bg-gray-100 { background-color: #1a2438 !important; }
html.dark .hover\:bg-ink-50:hover, html.dark .hover\:bg-slate-50:hover, html.dark .hover\:bg-slate-100:hover,
html.dark .hover\:bg-slate-300:hover, html.dark .hover\:bg-ink-100:hover, html.dark .hover\:bg-gray-50:hover { background-color: #1a2438 !important; }
html.dark tr.hover\:bg-slate-50:hover { background-color: #152036 !important; }
html.dark .rounded-2xl.bg-white, html.dark .rounded-xl.bg-white { box-shadow: 0 1px 2px rgb(0 0 0 / .35); }

html.dark [class*="border-ink-"], html.dark [class*="border-slate-"], html.dark [class*="border-gray-"],
html.dark .border, html.dark .border-b, html.dark .border-t, html.dark .border-e, html.dark .border-s { border-color: #1e293b; }
html.dark .divide-y > * + * { border-color: #1e293b; }

html.dark .text-ink-950, html.dark .text-ink-900, html.dark .text-ink-800, html.dark .text-ink-700,
html.dark .text-slate-900, html.dark .text-slate-800, html.dark .text-slate-700, html.dark .text-gray-900, html.dark .text-gray-800 { color: #e2e8f0 !important; }
html.dark .text-ink-600, html.dark .text-ink-500, html.dark .text-slate-600, html.dark .text-slate-500, html.dark .text-gray-600 { color: #94a3b8 !important; }
html.dark .text-ink-400, html.dark .text-ink-300, html.dark .text-slate-400, html.dark .text-gray-400 { color: #64748b !important; }

html.dark input:not([type=checkbox]):not([type=radio]):not([type=submit]), html.dark select, html.dark textarea {
    background-color: #0e1628 !important; color: #e2e8f0 !important; border-color: #2a3650 !important;
}
html.dark input::placeholder, html.dark textarea::placeholder { color: #64748b; }

/* Sidebar on dark */
html.dark .sd-nav-top { color: #cbd5e1; }
html.dark .sd-nav-top > svg:first-child, html.dark .sd-nav-chevron { color: #64748b; }
html.dark .sd-nav-top:hover, html.dark .sd-nav-link:hover { background-color: #1a2438; color: #f1f5f9; }
html.dark .sd-nav-top.is-current { color: #93c5fd; }
html.dark .sd-nav-top.is-active, html.dark .sd-nav-link.is-active { background-color: rgb(59 130 246 / .14); color: #bfdbfe; }
html.dark .sd-nav-top.is-current > svg:first-child, html.dark .sd-nav-top.is-active > svg:first-child { color: #60a5fa; }
html.dark .sd-nav-link { color: #94a3b8; }
html.dark .sd-nav-link.is-active::before { background: #60a5fa; }
html.dark .sd-nav-panel, html.dark .sd-nav-customize { border-color: #1e293b; }
html.dark button:focus-visible, html.dark a:focus-visible { box-shadow: 0 0 0 2px #3b82f6; }
html.dark input[type=date] { color-scheme: dark; }

/* Light tinted panels/badges become translucent on dark */
html.dark .bg-brand-50, html.dark .bg-emerald-50, html.dark .bg-sky-50, html.dark .bg-amber-50, html.dark .bg-rose-50,
html.dark .bg-violet-50, html.dark .bg-red-50, html.dark .bg-blue-50 { background-color: rgb(255 255 255 / 0.06) !important; }
html.dark .text-brand-700, html.dark .text-brand-800, html.dark a.text-emerald-700 { color: #7fabdc !important; }
html.dark .text-emerald-700 { color: #6ee7b7; }
html.dark .text-sky-700 { color: #7dd3fc; } html.dark .text-amber-700, html.dark .text-amber-800 { color: #fcd34d; }
html.dark .text-rose-700, html.dark .text-rose-600, html.dark .text-red-600, html.dark .text-red-700 { color: #fca5a5; }
html.dark .text-violet-700 { color: #c4b5fd; }
html.dark .shadow-sm, html.dark .shadow, html.dark .shadow-xl { box-shadow: 0 1px 3px rgb(0 0 0 / .45); }

/* Theme toggle icons */
.sd-theme-on { display: none; }
html.dark .sd-theme-on { display: inline; }
html.dark .sd-theme-off { display: none; }
.sd-nav-chevron.rotate-180 { transform: rotate(180deg); }
.sd-nav-icon { width: 18px; height: 18px; flex: none; }

/* Mobile menu opened (any language): the rtl:translate-x-full rule would otherwise keep it off-screen in Arabic. */
@media (max-width: 1023.98px) {
    aside#sidebar.sd-sidebar-open { translate: 0 0 !important; transform: none !important; }
}
