/*
 * BamBoek brand theme for the Django admin.
 *
 * Brand palette (from bamboek.nl):
 *   green  #3ace6f  — primary accent (links, buttons, breadcrumbs)
 *   navy   #21254c  — structure (header bar, default buttons)
 *   white  #ffffff  — background
 *
 * Both themes are branded. The light block sets brand vars on :root and the
 * explicit "light" theme; the dark blocks below re-skin the admin's dark
 * chrome (kept dark) with the same navy/green accents, covering the explicit
 * "dark" toggle and OS-auto dark (prefers-color-scheme).
 */
:root,
html[data-theme="light"] {
    --primary: #3ace6f;        /* green — module headers, accents */
    --primary-fg: #21254c;     /* navy text on green surfaces (readable) */

    --secondary: #21254c;      /* navy — structural */
    --accent: #3ace6f;

    /* Header bar: navy with white text, green branding wordmark. */
    --header-color: #ffffff;
    --header-branding-color: #3ace6f;
    --header-bg: #21254c;
    --header-link-color: #ffffff;

    /* Breadcrumbs: green bar with navy text. */
    --breadcrumbs-fg: #21254c;
    --breadcrumbs-link-fg: #21254c;
    --breadcrumbs-bg: #3ace6f;

    /* Links: a darker green for legible text on white. */
    --link-fg: #1f9050;
    --link-hover-color: #21254c;
    --link-selected-fg: #166b3a;

    /* Primary buttons: green with navy text. */
    --button-bg: #3ace6f;
    --button-fg: #21254c;
    --button-hover-bg: #2bb35d;

    /* Secondary/default buttons: navy with white text. */
    --default-button-bg: #21254c;
    --default-button-fg: #ffffff;
    --default-button-hover-bg: #161a38;

    /* Object tools (the "ADD" buttons top-right): green. */
    --object-tools-bg: #3ace6f;
    --object-tools-fg: #21254c;
    --object-tools-hover-bg: #2bb35d;

    /* Selected / highlighted rows in light green. */
    --selected-row: #eafaf0;
    --selected-bg: #d8f5e3;
}

/*
 * Dark theme — keep Django's dark backgrounds (--body-bg etc. untouched),
 * recolour the brand accents. Shared declarations:
 */
html[data-theme="dark"] {
    --primary: #3ace6f;        /* green accents / module headers */
    --primary-fg: #11231a;     /* dark text on green */
    --secondary: #181a35;
    --accent: #3ace6f;

    /* Header: deep navy bar, white text, green wordmark. */
    --header-color: #ffffff;
    --header-branding-color: #3ace6f;
    --header-bg: #181a35;
    --header-link-color: #ffffff;

    /* Breadcrumbs: deep navy with green text (a bright green bar is too loud
       on a dark page). */
    --breadcrumbs-fg: #5fe08c;
    --breadcrumbs-link-fg: #8fe9af;
    --breadcrumbs-bg: #1b1e3d;

    /* Links: brighter green for legibility on dark. */
    --link-fg: #5fe08c;
    --link-hover-color: #8fe9af;
    --link-selected-fg: #3ace6f;

    --button-bg: #3ace6f;
    --button-fg: #11231a;
    --button-hover-bg: #56db86;

    --default-button-bg: #2a2d52;
    --default-button-fg: #ffffff;
    --default-button-hover-bg: #363a66;

    --object-tools-bg: #3ace6f;
    --object-tools-fg: #11231a;
    --object-tools-hover-bg: #56db86;

    --selected-row: #1e3a2a;
    --selected-bg: #173024;
}

/* OS-auto dark (no explicit toggle): override Django's media-query defaults. */
@media (prefers-color-scheme: dark) {
    :root {
        --primary: #3ace6f;
        --primary-fg: #11231a;
        --secondary: #181a35;
        --accent: #3ace6f;
        --header-color: #ffffff;
        --header-branding-color: #3ace6f;
        --header-bg: #181a35;
        --header-link-color: #ffffff;
        --breadcrumbs-fg: #5fe08c;
        --breadcrumbs-link-fg: #8fe9af;
        --breadcrumbs-bg: #1b1e3d;
        --link-fg: #5fe08c;
        --link-hover-color: #8fe9af;
        --link-selected-fg: #3ace6f;
        --button-bg: #3ace6f;
        --button-fg: #11231a;
        --button-hover-bg: #56db86;
        --default-button-bg: #2a2d52;
        --default-button-fg: #ffffff;
        --default-button-hover-bg: #363a66;
        --object-tools-bg: #3ace6f;
        --object-tools-fg: #11231a;
        --object-tools-hover-bg: #56db86;
        --selected-row: #1e3a2a;
        --selected-bg: #173024;
    }
    /* But if the user explicitly chose light, keep light brand vars. */
    html[data-theme="light"] {
        --header-bg: #21254c;
        --breadcrumbs-bg: #3ace6f;
        --breadcrumbs-fg: #21254c;
        --breadcrumbs-link-fg: #21254c;
        --link-fg: #1f9050;
        --primary-fg: #21254c;
        --button-fg: #21254c;
        --object-tools-fg: #21254c;
        --selected-row: #eafaf0;
        --selected-bg: #d8f5e3;
    }
}

/*
 * Submit-row button text contrast. Django colours all submit buttons with
 * --button-fg regardless of background, which left text unreadable on the
 * brand colours. Note Django's mapping: the PRIMARY `.default` button uses the
 * navy --default-button-bg, while the secondary saves use the green
 * --button-bg. So: white text on the navy primary, dark text on the green
 * secondaries. Theme-agnostic — the backgrounds are brand in both themes.
 */
.submit-row input,
.submit-row button,
.submit-row a.button {
    color: #11231a;
}
.submit-row input.default,
.submit-row button.default,
.submit-row a.button.default {
    color: #ffffff;
}
