/* ===========================================================
   BSS Web — teme (light, dark, navy, orange, gray, auto)
   Postavite: document.documentElement[data-bss-theme]
   =========================================================== */

/* ----- Navy plava ----- */
[data-bss-theme="navy"] {
    color-scheme: light;

    --bss-primary: #2563eb;
    --bss-primary-dark: #1d4ed8;
    --bss-primary-light: #60a5fa;
    --bss-accent: #0ea5e9;

    --bss-bg: #f0f4f8;
    --bss-surface: rgba(255, 255, 255, 0.88);
    --bss-surface-solid: #ffffff;
    --bss-border: rgba(15, 40, 70, 0.08);
    --bss-border-strong: rgba(15, 40, 70, 0.14);
    --bss-text: #0f172a;
    --bss-text-secondary: #475569;
    --bss-text-muted: #64748b;
    --bss-text-on-dark: #f1f5f9;

    --bss-header-bg: rgba(255, 255, 255, 0.78);
    --bss-header-border: rgba(15, 40, 70, 0.08);

    --bss-sidebar-bg: linear-gradient(168deg, #0b1f3a 0%, #14325a 42%, #0f2847 100%);
    --bss-sidebar-fg: rgba(241, 245, 249, 0.92);
    --bss-sidebar-fg-muted: rgba(203, 213, 225, 0.72);
    --bss-sidebar-hover: rgba(255, 255, 255, 0.08);
    --bss-sidebar-active: rgba(56, 189, 248, 0.22);
    --bss-sidebar-active-border: rgba(56, 189, 248, 0.45);
    --bss-sidebar-border: rgba(255, 255, 255, 0.08);
    --bss-sidebar-subtitle: rgba(148, 163, 184, 0.55);
    --bss-sidebar-accent: #38bdf8;
    --bss-sidebar-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.15);
}

/* ----- Light ----- */
[data-bss-theme="light"] {
    color-scheme: light;

    --bss-primary: #007aff;
    --bss-primary-dark: #0051d5;
    --bss-accent: #5e5ce6;

    --bss-bg: #f5f5f7;
    --bss-surface-solid: #ffffff;
    --bss-border: rgba(0, 0, 0, 0.08);
    --bss-border-strong: rgba(0, 0, 0, 0.12);
    --bss-text: #1d1d1f;
    --bss-text-secondary: #6e6e73;
    --bss-text-muted: #86868b;

    --bss-header-bg: rgba(255, 255, 255, 0.85);

    --bss-sidebar-bg: linear-gradient(180deg, #f8fafc 0%, #eef2f7 100%);
    --bss-sidebar-fg: #334155;
    --bss-sidebar-fg-muted: #64748b;
    --bss-sidebar-hover: rgba(15, 23, 42, 0.06);
    --bss-sidebar-active: rgba(0, 122, 255, 0.12);
    --bss-sidebar-active-border: rgba(0, 122, 255, 0.35);
    --bss-sidebar-border: rgba(15, 23, 42, 0.08);
    --bss-sidebar-subtitle: #94a3b8;
    --bss-sidebar-accent: #007aff;
    --bss-sidebar-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.06);
}

/* ----- Dark ----- */
[data-bss-theme="dark"] {
    color-scheme: dark;

    --bss-primary: #0a84ff;
    --bss-primary-dark: #409cff;
    --bss-accent: #bf5af2;

    --bss-bg: #0c0c0e;
    --bss-surface: rgba(28, 28, 30, 0.92);
    --bss-surface-solid: #1c1c1e;
    --bss-border: rgba(255, 255, 255, 0.1);
    --bss-border-strong: rgba(255, 255, 255, 0.16);
    --bss-text: #f5f5f7;
    --bss-text-secondary: #aeaeb2;
    --bss-text-muted: #8e8e93;

    --bss-header-bg: rgba(28, 28, 30, 0.88);
    --bss-header-border: rgba(255, 255, 255, 0.08);

    --bss-sidebar-bg: linear-gradient(180deg, #141416 0%, #1c1c1e 55%, #121214 100%);
    --bss-sidebar-fg: rgba(245, 245, 247, 0.9);
    --bss-sidebar-fg-muted: rgba(174, 174, 178, 0.75);
    --bss-sidebar-hover: rgba(255, 255, 255, 0.07);
    --bss-sidebar-active: rgba(10, 132, 255, 0.22);
    --bss-sidebar-active-border: rgba(10, 132, 255, 0.4);
    --bss-sidebar-border: rgba(255, 255, 255, 0.07);
    --bss-sidebar-subtitle: rgba(142, 142, 147, 0.65);
    --bss-sidebar-accent: #0a84ff;
    --bss-sidebar-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.4);
}

/* ----- Orange ----- */
[data-bss-theme="orange"] {
    color-scheme: light;

    --bss-primary: #ea580c;
    --bss-primary-dark: #c2410c;
    --bss-primary-light: #fb923c;
    --bss-accent: #d97706;

    --bss-bg: #fff7ed;
    --bss-surface-solid: #ffffff;
    --bss-border: rgba(124, 45, 18, 0.1);
    --bss-border-strong: rgba(124, 45, 18, 0.16);
    --bss-text: #431407;
    --bss-text-secondary: #9a3412;
    --bss-text-muted: #b45309;

    --bss-header-bg: rgba(255, 251, 245, 0.9);
    --bss-header-border: rgba(234, 88, 12, 0.12);

    --bss-sidebar-bg: linear-gradient(165deg, #431407 0%, #7c2d12 48%, #5c1d0a 100%);
    --bss-sidebar-fg: rgba(255, 237, 213, 0.95);
    --bss-sidebar-fg-muted: rgba(254, 215, 170, 0.75);
    --bss-sidebar-hover: rgba(255, 255, 255, 0.09);
    --bss-sidebar-active: rgba(251, 146, 60, 0.28);
    --bss-sidebar-active-border: rgba(251, 146, 60, 0.5);
    --bss-sidebar-border: rgba(255, 255, 255, 0.1);
    --bss-sidebar-subtitle: rgba(253, 186, 116, 0.55);
    --bss-sidebar-accent: #fb923c;
    --bss-sidebar-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.2);
}

/* ----- Gray ----- */
[data-bss-theme="gray"] {
    color-scheme: light;

    --bss-primary: #52525b;
    --bss-primary-dark: #3f3f46;
    --bss-accent: #71717a;

    --bss-bg: #f4f4f5;
    --bss-surface-solid: #ffffff;
    --bss-border: rgba(24, 24, 27, 0.08);
    --bss-border-strong: rgba(24, 24, 27, 0.14);
    --bss-text: #18181b;
    --bss-text-secondary: #52525b;
    --bss-text-muted: #71717a;

    --bss-header-bg: rgba(250, 250, 250, 0.92);
    --bss-header-border: rgba(24, 24, 27, 0.08);

    --bss-sidebar-bg: linear-gradient(180deg, #3f3f46 0%, #52525b 50%, #27272a 100%);
    --bss-sidebar-fg: rgba(250, 250, 250, 0.92);
    --bss-sidebar-fg-muted: rgba(212, 212, 216, 0.72);
    --bss-sidebar-hover: rgba(255, 255, 255, 0.08);
    --bss-sidebar-active: rgba(255, 255, 255, 0.14);
    --bss-sidebar-active-border: rgba(255, 255, 255, 0.28);
    --bss-sidebar-border: rgba(255, 255, 255, 0.1);
    --bss-sidebar-subtitle: rgba(161, 161, 170, 0.7);
    --bss-sidebar-accent: #e4e4e7;
    --bss-sidebar-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.15);
}

/* ----- Auto (sistem) — light ----- */
[data-bss-theme="auto"] {
    color-scheme: light light;

    --bss-primary: #007aff;
    --bss-primary-dark: #0051d5;
    --bss-accent: #5e5ce6;

    --bss-bg: #f5f5f7;
    --bss-surface-solid: #ffffff;
    --bss-border: rgba(0, 0, 0, 0.08);
    --bss-border-strong: rgba(0, 0, 0, 0.12);
    --bss-text: #1d1d1f;
    --bss-text-secondary: #6e6e73;
    --bss-text-muted: #86868b;

    --bss-header-bg: rgba(255, 255, 255, 0.85);

    --bss-sidebar-bg: linear-gradient(180deg, #f8fafc 0%, #e8edf4 100%);
    --bss-sidebar-fg: #334155;
    --bss-sidebar-fg-muted: #64748b;
    --bss-sidebar-hover: rgba(15, 23, 42, 0.06);
    --bss-sidebar-active: rgba(0, 122, 255, 0.12);
    --bss-sidebar-active-border: rgba(0, 122, 255, 0.35);
    --bss-sidebar-border: rgba(15, 23, 42, 0.08);
    --bss-sidebar-subtitle: #94a3b8;
    --bss-sidebar-accent: #007aff;
    --bss-sidebar-shadow: inset -1px 0 0 rgba(15, 23, 42, 0.06);
}

@media (prefers-color-scheme: dark) {
    [data-bss-theme="auto"] {
        color-scheme: dark;

        --bss-primary: #0a84ff;
        --bss-primary-dark: #409cff;
        --bss-accent: #bf5af2;

        --bss-bg: #0c0c0e;
        --bss-surface-solid: #1c1c1e;
        --bss-border: rgba(255, 255, 255, 0.1);
        --bss-border-strong: rgba(255, 255, 255, 0.16);
        --bss-text: #f5f5f7;
        --bss-text-secondary: #aeaeb2;
        --bss-text-muted: #8e8e93;

        --bss-header-bg: rgba(28, 28, 30, 0.88);
        --bss-header-border: rgba(255, 255, 255, 0.08);

        --bss-sidebar-bg: linear-gradient(180deg, #141416 0%, #1c1c1e 55%, #121214 100%);
        --bss-sidebar-fg: rgba(245, 245, 247, 0.9);
        --bss-sidebar-fg-muted: rgba(174, 174, 178, 0.75);
        --bss-sidebar-hover: rgba(255, 255, 255, 0.07);
        --bss-sidebar-active: rgba(10, 132, 255, 0.22);
        --bss-sidebar-active-border: rgba(10, 132, 255, 0.4);
        --bss-sidebar-border: rgba(255, 255, 255, 0.07);
        --bss-sidebar-subtitle: rgba(142, 142, 147, 0.65);
        --bss-sidebar-accent: #0a84ff;
        --bss-sidebar-shadow: inset -1px 0 0 rgba(0, 0, 0, 0.4);
    }
}

/* Dark / auto-dark: forme, tabele, dugmad */
[data-bss-theme="dark"] .form-control,
[data-bss-theme="dark"] .form-select,
[data-bss-theme="dark"] .input-group-text {
    background-color: #2c2c2e;
    border-color: var(--bss-border-strong);
    color: var(--bss-text);
}

[data-bss-theme="dark"] .table {
    --bs-table-bg: transparent;
    --bs-table-color: var(--bss-text);
    --bs-table-border-color: var(--bss-border);
}

[data-bss-theme="dark"] .btn-outline-secondary {
    background: rgba(255, 255, 255, 0.06);
    border-color: var(--bss-border-strong);
    color: var(--bss-text);
}

[data-bss-theme="dark"] .btn-outline-secondary:hover,
[data-bss-theme="dark"] a.btn-outline-secondary:hover {
    background: rgba(255, 255, 255, 0.1);
    border-color: var(--bss-primary);
    color: var(--bss-text);
}

[data-bss-theme="dark"] .btn-pdf,
[data-bss-theme="dark"] a.btn-pdf {
    color: var(--bss-text-secondary);
    background: rgba(255, 255, 255, 0.06);
}

[data-bss-theme="dark"] .btn-pdf:hover,
[data-bss-theme="dark"] a.btn-pdf:hover {
    color: var(--bss-primary) !important;
    background: rgba(255, 255, 255, 0.1) !important;
    border-color: var(--bss-primary) !important;
}

[data-bss-theme="dark"] ::-webkit-scrollbar-thumb {
    background: rgba(255, 255, 255, 0.2);
}

@media (prefers-color-scheme: dark) {
    [data-bss-theme="auto"] .form-control,
    [data-bss-theme="auto"] .form-select,
    [data-bss-theme="auto"] .input-group-text {
        background-color: #2c2c2e;
        border-color: var(--bss-border-strong);
        color: var(--bss-text);
    }

    [data-bss-theme="auto"] .table {
        --bs-table-bg: transparent;
        --bs-table-color: var(--bss-text);
        --bs-table-border-color: var(--bss-border);
    }

    [data-bss-theme="auto"] .btn-outline-secondary {
        background: rgba(255, 255, 255, 0.06);
        border-color: var(--bss-border-strong);
        color: var(--bss-text);
    }

    [data-bss-theme="auto"] .btn-outline-secondary:hover,
    [data-bss-theme="auto"] a.btn-outline-secondary:hover {
        background: rgba(255, 255, 255, 0.1);
        border-color: var(--bss-primary);
        color: var(--bss-text);
    }

    [data-bss-theme="auto"] .btn-pdf:hover,
    [data-bss-theme="auto"] a.btn-pdf:hover {
        color: var(--bss-primary) !important;
        background: rgba(255, 255, 255, 0.1) !important;
        border-color: var(--bss-primary) !important;
    }

    [data-bss-theme="auto"] ::-webkit-scrollbar-thumb {
        background: rgba(255, 255, 255, 0.2);
    }
}
