﻿:root {
    --ag-primary: #e8771a;
    --ag-primary-dark: #cf6c17;
    --ag-accent: #f5c842;
    --ag-bg: #fffaf4;
    --ag-surface: #fffdf9;
    --ag-surface-soft: #fff4e6;
    --ag-border: #f0dcc0;
    --ag-text: #4b2c14;
    --ag-muted: #7f5f3f;
}

html,
body,
#container,
#content,
#content-main,
#content-related,
.dashboard #content,
.change-list #content,
.change-form #content,
#changelist,
#changelist-form,
#changelist .results,
#changelist .paginator,
body.popup,
body.popup #container,
body.popup #content {
    background: var(--ag-bg) !important;
    color: var(--ag-text) !important;
}

/* Top header: no dark background */
#header {
    background: linear-gradient(90deg, #fff4e6 0%, #ffedd8 55%, #ffe6c7 100%) !important;
    color: var(--ag-text) !important;
    border-bottom: 1px solid var(--ag-border);
    box-shadow: 0 4px 14px rgba(184, 92, 14, 0.08);
}

#header a:link,
#header a:visited,
#site-name,
#site-name a,
#user-tools,
#user-tools a {
    color: var(--ag-text) !important;
}

.ag-admin-brand {
    display: flex;
    align-items: center;
    gap: 10px;
}

.ag-admin-brand-mark {
    width: 30px;
    height: 30px;
    border-radius: 999px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-weight: 700;
    color: #7a3a00;
    background: #fff0d8;
}

.ag-admin-brand-text {
    display: flex;
    flex-direction: column;
    line-height: 1.1;
}

.ag-admin-brand-text small {
    opacity: 0.9;
    font-size: 11px;
    font-weight: 500;
    color: var(--ag-muted);
}

.module,
.dashboard .module table,
.dashboard .module,
#changelist-filter,
.paginator,
.submit-row,
.inline-group,
.selector,
.selector-available,
.selector-chosen,
fieldset,
.breadcrumbs,
#nav-sidebar {
    border: 1px solid var(--ag-border) !important;
    border-radius: 12px;
    background: var(--ag-surface) !important;
    color: var(--ag-text) !important;
    box-shadow: 0 6px 18px rgba(184, 92, 14, 0.05);
}

.module h2,
.module caption,
.inline-group h2,
#changelist table thead th,
#changelist table thead th a {
    background: var(--ag-surface-soft) !important;
    color: var(--ag-text) !important;
}

#changelist table,
#changelist table tbody tr,
#changelist table tbody th,
#changelist table tbody td,
.form-row,
.aligned label,
.help,
.quiet,
.small,
.breadcrumbs,
.breadcrumbs a,
label,
th,
th a,
td,
li,
p,
div,
span {
    color: var(--ag-text);
}

a:link,
a:visited {
    color: #9a4f10;
}

a:hover {
    color: var(--ag-primary);
}

.button,
input[type=submit],
input[type=button],
.submit-row input,
a.button,
.object-tools a:link,
.object-tools a:visited {
    border-radius: 8px;
    border: 0;
    background: var(--ag-primary) !important;
    color: #fff !important;
}

.button:hover,
input[type=submit]:hover,
input[type=button]:hover,
.submit-row input:hover,
a.button:hover,
.object-tools a:hover,
.object-tools a:focus {
    background: var(--ag-primary-dark) !important;
}

input,
textarea,
select,
.vTextField,
.vURLField,
.vLargeTextField,
.vIntegerField,
.vDateField,
.vTimeField,
.vForeignKeyRawIdAdminField {
    background: #fffcf8 !important;
    color: var(--ag-text) !important;
    border: 1px solid var(--ag-border) !important;
}

input:focus,
textarea:focus,
select:focus {
    border-color: #e7b07d !important;
    box-shadow: 0 0 0 2px rgba(232, 119, 26, 0.14);
}

/* Login page */
.login #container {
    min-height: calc(100vh - 48px);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--ag-bg) !important;
}

.ag-login-wrap {
    width: 100%;
    max-width: 520px;
    padding: 24px;
}

.ag-login-card {
    background: var(--ag-surface) !important;
    border: 1px solid var(--ag-border);
    border-radius: 16px;
    padding: 24px;
    box-shadow: 0 14px 30px rgba(184, 92, 14, 0.08);
}

.ag-login-card h1 {
    margin: 0 0 8px;
    font-size: 28px;
    color: #9a4f10;
}

.ag-login-card p {
    margin: 0 0 20px;
    color: var(--ag-muted);
}

.ag-field {
    margin-bottom: 14px;
}

.ag-field label {
    display: block;
    margin-bottom: 6px;
    color: var(--ag-text);
    font-weight: 600;
}

.ag-field input[type=text],
.ag-field input[type=password],
#login-form input[type=text],
#login-form input[type=password] {
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--ag-border);
    padding: 10px 12px;
    background: #fffcf8 !important;
    color: var(--ag-text) !important;
}

.ag-alert,
.errornote,
ul.messagelist li {
    border: 1px solid #f2c4a4;
    border-left: 4px solid #d9691f;
    background: #fff3ea !important;
    color: #7a3a00 !important;
    border-radius: 10px;
    padding: 10px 12px;
    margin-bottom: 14px;
}

.login .submit-row {
    background: transparent !important;
    border: 0;
    box-shadow: none;
    padding: 0;
    margin-top: 16px;
}

.login .submit-row input {
    width: 100%;
    padding: 10px 14px;
    font-weight: 600;
}

.password-reset-link {
    margin-top: 6px;
    margin-bottom: 4px;
}

/* Dialogs and popups */
dialog,
.ui-dialog,
[role="dialog"] {
    background: #fffaf4 !important;
    color: var(--ag-text) !important;
    border: 1px solid var(--ag-border) !important;
    border-radius: 12px;
}

dialog::backdrop {
    background: rgba(255, 245, 232, 0.72) !important;
}

#footer {
    color: var(--ag-muted) !important;
    background: transparent !important;
}

/* Force light admin theme (override Django dark mode variables) */
:root,
html,
html[data-theme="light"],
html[data-theme="dark"],
body {
    color-scheme: light !important;
    --primary: #e8771a !important;
    --secondary: #cf6c17 !important;
    --accent: #f5c842 !important;

    --body-bg: #fffaf4 !important;
    --body-fg: #4b2c14 !important;
    --body-quiet-color: #7f5f3f !important;
    --body-loud-color: #4b2c14 !important;

    --header-color: #4b2c14 !important;
    --header-branding-color: #4b2c14 !important;
    --header-bg: #ffedd8 !important;
    --header-link-color: #4b2c14 !important;

    --breadcrumbs-fg: #7f5f3f !important;
    --breadcrumbs-link-fg: #9a4f10 !important;
    --breadcrumbs-bg: #fff4e6 !important;

    --link-fg: #9a4f10 !important;
    --link-hover-color: #e8771a !important;
    --link-selected-fg: #cf6c17 !important;

    --hairline-color: #f0dcc0 !important;
    --border-color: #f0dcc0 !important;

    --error-fg: #8f3c11 !important;

    --message-success-bg: #fff4e6 !important;
    --message-warning-bg: #fff2de !important;
    --message-error-bg: #fff0ea !important;

    --darkened-bg: #fff2e2 !important;
    --selected-bg: #ffe8cc !important;
    --selected-row: #fff3e3 !important;

    --button-fg: #ffffff !important;
    --button-bg: #e8771a !important;
    --button-hover-bg: #cf6c17 !important;
    --default-button-bg: #e8771a !important;
    --default-button-hover-bg: #cf6c17 !important;
    --close-button-bg: #7f5f3f !important;
    --close-button-hover-bg: #6f5236 !important;

    --delete-button-bg: #c35b24 !important;
    --delete-button-hover-bg: #ab4f1f !important;

    --object-tools-bg: #e8771a !important;
    --object-tools-hover-bg: #cf6c17 !important;

    --nav-hairline-color: #f0dcc0 !important;
    --nav-body-bg: #fffdf9 !important;
    --nav-link-fg: #4b2c14 !important;
    --nav-current-link-bg: #fff2e2 !important;
    --nav-selected-row: #fff3e3 !important;
}

/* Final black background guards */
#header,
#nav-sidebar,
#content,
#content-main,
#content-related,
.module,
.inline-group,
.selector,
.selector-available,
.selector-chosen,
#changelist,
#changelist-form,
#changelist .results,
#changelist-filter,
.paginator,
.breadcrumbs,
.login #container,
.ag-login-card,
body.popup,
body.popup #container,
body.popup #content,
dialog,
.ui-dialog,
[role="dialog"] {
    background-color: #fffaf4 !important;
    color: #4b2c14 !important;
}

