/* ═══════════════════════════════════════════════════════════════
    ERP Solutions — Light Theme Override
   White background · Dark text · Blue primary
   ═══════════════════════════════════════════════════════════════ */

/* Force light mode — remove any dark class from html */
html {
    color-scheme: light !important;
}

/* ── Root variables ─────────────────────────────────────────── */
:root,
html[class*="dark"],
html.dark {
    --color-bg-primary:      #ffffff !important;
    --color-bg-secondary:    #f9fafb !important;
    --color-bg-tertiary:     #f3f4f6 !important;
    --color-text-primary:    #111827 !important;
    --color-text-secondary:  #374151 !important;
    --color-text-muted:      #6b7280 !important;
    --color-border:          #e5e7eb !important;
    --color-border-light:    #f3f4f6 !important;
}

/* ── Body & main layout ─────────────────────────────────────── */
body,
#main,
.main,
[data-theme],
[class*="bg-gray-900"],
[class*="bg-slate-900"],
[class*="bg-zinc-900"] {
    background-color: #f9fafb !important;
    color: #111827 !important;
}

/* ── Top navigation bar ─────────────────────────────────────── */
#header,
nav,
header {
    background-color: #ffffff !important;
    border-bottom: 1px solid #e5e7eb !important;
    color: #111827 !important;
}

nav a,
header a {
    color: #374151 !important;
}

nav a:hover,
header a:hover {
    color: #2563eb !important;
}

/* ── Sidebar ────────────────────────────────────────────────── */
aside,
[class*="sidebar"],
#nav-sidebar {
    background-color: #ffffff !important;
    border-right: 1px solid #e5e7eb !important;
    color: #111827 !important;
}

aside a,
#nav-sidebar a {
    color: #374151 !important;
}

aside a:hover,
#nav-sidebar a:hover,
aside a.active,
#nav-sidebar a[aria-current] {
    background-color: #eff6ff !important;
    color: #2563eb !important;
}

/* ── Content area ───────────────────────────────────────────── */
.content-wrapper,
#content,
main,
.container,
[class*="content"] {
    background-color: #f9fafb !important;
    color: #111827 !important;
}

/* ── Cards & panels ─────────────────────────────────────────── */
.card,
.module,
fieldset,
[class*="card"],
[class*="panel"],
[class*="rounded"] {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
    color: #111827 !important;
}

/* ── Form inputs ────────────────────────────────────────────── */
input,
textarea,
select,
.form-control,
[class*="input"] {
    background-color: #ffffff !important;
    border: 1px solid #d1d5db !important;
    color: #111827 !important;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #3b82f6 !important;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15) !important;
    outline: none !important;
}

/* ── Tables ─────────────────────────────────────────────────── */
table,
thead,
tbody,
tr,
th,
td {
    background-color: #ffffff !important;
    color: #111827 !important;
    border-color: #e5e7eb !important;
}

thead th,
.thead-dark th {
    background-color: #f9fafb !important;
    color: #374151 !important;
    font-weight: 600 !important;
    border-bottom: 2px solid #e5e7eb !important;
}

tr:hover td {
    background-color: #eff6ff !important;
}

/* ── Buttons ────────────────────────────────────────────────── */
.btn-primary,
[class*="btn-primary"],
input[type="submit"],
button[type="submit"] {
    background-color: #2563eb !important;
    color: #ffffff !important;
    border: none !important;
    border-radius: 6px !important;
    padding: 8px 16px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
}

.btn-primary:hover,
input[type="submit"]:hover,
button[type="submit"]:hover {
    background-color: #1d4ed8 !important;
}

.btn-secondary,
[class*="btn-secondary"] {
    background-color: #ffffff !important;
    color: #374151 !important;
    border: 1px solid #d1d5db !important;
}

.btn-secondary:hover {
    background-color: #f9fafb !important;
}

/* ── Breadcrumbs ────────────────────────────────────────────── */
.breadcrumbs,
[class*="breadcrumb"] {
    background-color: #ffffff !important;
    color: #6b7280 !important;
    border-bottom: 1px solid #e5e7eb !important;
}

.breadcrumbs a {
    color: #2563eb !important;
}

/* ── Tabs ───────────────────────────────────────────────────── */
[role="tab"],
[class*="tab"] {
    color: #6b7280 !important;
    border-bottom: 2px solid transparent !important;
}

[role="tab"][aria-selected="true"],
[class*="tab-active"] {
    color: #2563eb !important;
    border-bottom-color: #2563eb !important;
    background-color: transparent !important;
}

/* ── Inline tables ──────────────────────────────────────────── */
.inline-group,
.tabular,
.stacked {
    background-color: #ffffff !important;
    border: 1px solid #e5e7eb !important;
}

.inline-group h2,
.inline-group .module h3 {
    background-color: #eff6ff !important;
    color: #1d4ed8 !important;
    padding: 8px 12px !important;
}

/* ── Badges / status labels ─────────────────────────────────── */
[class*="badge"],
[class*="label"] {
    font-size: 0.75rem !important;
    font-weight: 500 !important;
    border-radius: 9999px !important;
    padding: 2px 10px !important;
}

/* ── Scrollbar ──────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #f3f4f6; }
::-webkit-scrollbar-thumb { background: #d1d5db; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #9ca3af; }

/* ── Typography ─────────────────────────────────────────────── */
h1, h2, h3, h4, h5, h6 {
    color: #111827 !important;
    font-weight: 600 !important;
}

p, span, label, li {
    color: #374151;
}

a {
    color: #2563eb !important;
}

a:hover {
    color: #1d4ed8 !important;
}

/* ── Messages / alerts ──────────────────────────────────────── */
.messagelist .success,
.alert-success {
    background-color: #f0fdf4 !important;
    border-left: 4px solid #22c55e !important;
    color: #15803d !important;
}

.messagelist .error,
.alert-error {
    background-color: #fef2f2 !important;
    border-left: 4px solid #ef4444 !important;
    color: #dc2626 !important;
}

.messagelist .warning,
.alert-warning {
    background-color: #fffbeb !important;
    border-left: 4px solid #f59e0b !important;
    color: #d97706 !important;
}

/* ── Login page (Unfold) ───────────────────────────────────── */
body.login {
    background-color: #eef3f9 !important;
}

body.login #page {
    position: relative;
    overflow: hidden;
    background:
        radial-gradient(circle at 12% 18%, rgba(37, 99, 235, 0.18), rgba(37, 99, 235, 0) 28%),
        radial-gradient(circle at 86% 22%, rgba(14, 165, 233, 0.16), rgba(14, 165, 233, 0) 34%),
        linear-gradient(160deg, #f5f9ff 0%, #edf3fc 50%, #f7faff 100%) !important;
}

body.login #page::before {
    content: "";
    position: absolute;
    inset: 0;
    background-image: url('/static/img/erp-login-tech-overlay.svg');
    background-repeat: no-repeat;
    background-size: cover;
    background-position: center;
    opacity: 0.75;
    pointer-events: none;
}

body.login #page > .flex {
    position: relative;
    z-index: 1;
}

body.login #page .w-full.sm\:w-96 {
    background: rgba(255, 255, 255, 0.72);
    border: 1px solid rgba(255, 255, 255, 0.9);
    border-radius: 18px;
    box-shadow: 0 22px 60px rgba(15, 23, 42, 0.14);
    backdrop-filter: blur(8px);
    -webkit-backdrop-filter: blur(8px);
    padding: 28px 24px 22px;
}

body.login #login-form input {
    background-color: rgba(255, 255, 255, 0.84) !important;
}

body.login #login-form button[type="submit"] {
    background-image: linear-gradient(90deg, #1d4ed8 0%, #2563eb 55%, #1d4ed8 100%);
    box-shadow: 0 10px 24px rgba(29, 78, 216, 0.28);
}

@media (max-width: 640px) {
    body.login #page .w-full.sm\:w-96 {
        border-radius: 14px;
        padding: 22px 16px 16px;
    }

    body.login #page::before {
        opacity: 0.58;
    }
}
