/* Alma de Barro admin theme — light, brand palette.
   Palette (from the consumer app's brand):
     cream      #FFF9F5  (background)
     deep red   #7B1E26  (primary)
     terracotta #D16F38  (secondary accent)
   Only tints/shades (rgba) of these are used — no additional brand colors.

   Light mode is forced: Django admin ships a dark palette both via
   @media (prefers-color-scheme: dark) and via the html[data-theme="dark"]
   user toggle. This sheet loads after admin base/dark_mode/custom_admin CSS,
   so declaring the brand variables on :root AND on the data-theme selectors
   overrides every path to the dark palette; color-scheme is pinned to light
   and the toggle is hidden. */

:root,
html[data-theme="light"],
html[data-theme="auto"],
html[data-theme="dark"] {
    color-scheme: light;

    --primary: #7B1E26;
    --secondary: #7B1E26;
    --accent: #D16F38;
    --primary-fg: #fff;

    --body-fg: #333;
    --body-bg: #FFF9F5;
    --body-quiet-color: #666;
    --body-medium-color: #444;
    --body-loud-color: #000;

    --header-color: #FFF9F5;
    --header-branding-color: var(--accent);
    --header-bg: #7B1E26;
    --header-link-color: #fff;

    --breadcrumbs-fg: #fff;
    --breadcrumbs-link-fg: #fff;
    --breadcrumbs-bg: #D16F38;

    --link-fg: #D16F38;
    --link-hover-color: #7B1E26;
    --link-selected-fg: #7B1E26;

    --hairline-color: rgba(123, 30, 38, 0.12);
    --border-color: rgba(123, 30, 38, 0.22);

    --darkened-bg: rgba(209, 111, 56, 0.06);
    --selected-bg: rgba(209, 111, 56, 0.16);
    --selected-row: rgba(209, 111, 56, 0.16);

    --button-fg: #fff;
    --button-bg: #7B1E26;
    --button-hover-bg: #D16F38;
    --default-button-bg: #7B1E26;
    --default-button-hover-bg: #D16F38;
    --close-button-bg: #747474;
    --close-button-hover-bg: #333;

    --object-tools-fg: #fff;
    --object-tools-bg: #D16F38;
    --object-tools-hover-bg: #7B1E26;
}

/* Re-assert inside the dark media query: dark_mode.css declares its dark
   variables in this block; redeclaring here guarantees the light palette
   wins for dark-OS users regardless of stylesheet order. */
@media (prefers-color-scheme: dark) {
    :root,
    html[data-theme="auto"],
    html[data-theme="dark"] {
        color-scheme: light;

        --primary: #7B1E26;
        --secondary: #7B1E26;
        --accent: #D16F38;
        --primary-fg: #fff;

        --body-fg: #333;
        --body-bg: #FFF9F5;
        --body-quiet-color: #666;
        --body-medium-color: #444;
        --body-loud-color: #000;

        --header-color: #FFF9F5;
        --header-branding-color: var(--accent);
        --header-bg: #7B1E26;
        --header-link-color: #fff;

        --breadcrumbs-fg: #fff;
        --breadcrumbs-link-fg: #fff;
        --breadcrumbs-bg: #D16F38;

        --link-fg: #D16F38;
        --link-hover-color: #7B1E26;
        --link-selected-fg: #7B1E26;

        --hairline-color: rgba(123, 30, 38, 0.12);
        --border-color: rgba(123, 30, 38, 0.22);

        --darkened-bg: rgba(209, 111, 56, 0.06);
        --selected-bg: rgba(209, 111, 56, 0.16);
        --selected-row: rgba(209, 111, 56, 0.16);

        --button-fg: #fff;
        --button-bg: #7B1E26;
        --button-hover-bg: #D16F38;
        --default-button-bg: #7B1E26;
        --default-button-hover-bg: #D16F38;
        --close-button-bg: #747474;
        --close-button-hover-bg: #333;

        --object-tools-fg: #fff;
        --object-tools-bg: #D16F38;
        --object-tools-hover-bg: #7B1E26;

        --message-success-bg: #dfd;
        --message-warning-bg: #ffc;
        --message-error-bg: #ffefef;
        --message-info-bg: #ccefff;
    }
}

/* Theme is fixed to light; hide the dark-mode toggle to avoid a dead control. */
.theme-toggle {
    display: none;
}

/* Header: white brand text on deep red. */
#header {
    background: var(--header-bg);
    color: #fff;
}

#header a:link,
#header a:visited,
#branding h1,
#branding h1 a:link,
#branding h1 a:visited {
    color: #fff;
}

/* Breadcrumbs: white on terracotta. */
div.breadcrumbs {
    background: var(--breadcrumbs-bg);
    color: #fff;
}

div.breadcrumbs a {
    color: #fff;
}

/* Module/table headers: deep red. */
.module h2, .module caption, .inline-group h2, .inline-related h3 {
    background: var(--primary);
    color: #fff;
}

/* Modules sit as light cards on the cream background. */
.module {
    background: #fff;
}

/* Sidebar nav on light background. */
#nav-sidebar {
    background: #fff;
}

#nav-sidebar a:link,
#nav-sidebar a:visited {
    color: var(--link-fg);
}

#nav-sidebar a:hover,
#nav-sidebar a:focus {
    color: var(--link-hover-color);
}

/* Changelist filter headers. */
#changelist-filter h2, #changelist-filter h3 {
    background: var(--primary);
    color: #fff;
}
