/*
 * HidayahChat admin theme: Django admin's colour variables set to the brand (lapis, turquoise, gold).
 * Light values sit on :root; dark mode needs every variable we touch set again, in both places Django
 * switches theme (the OS preference, and the theme toggle's html[data-theme]), or light values leak in.
 */
:root,
html[data-theme="light"] {
    --primary: #8FA6E0;
    --secondary: #1D3B8F;
    --accent: #D9A23A;
    --primary-fg: #fff;
    --body-fg: #13224A;
    --body-bg: #fff;
    --body-quiet-color: #4C5B80;
    --body-medium-color: #33406A;
    --body-loud-color: #0F1A3D;
    --header-bg: #1D3B8F;
    --header-branding-color: #fff;
    --header-link-color: #fff;
    --breadcrumbs-bg: #14306F;
    --link-fg: #1D3B8F;
    --link-hover-color: #0F8F8A;
    --link-selected-fg: #13224A;
    --hairline-color: #E3E8F2;
    --border-color: #CCD5E6;
    --darkened-bg: #F3F6FC;
    --selected-bg: #E6ECFA;
    --selected-row: #FFF6DF;
    --button-bg: #1D3B8F;
    --button-hover-bg: #14306F;
    --default-button-bg: #0F8F8A;
    --default-button-hover-bg: #0B7570;
    --close-button-bg: #5A6688;
    --close-button-hover-bg: #1D3B8F;
    --object-tools-bg: #1D3B8F;
    --object-tools-hover-bg: #0F8F8A;
    --hc-field-bg: #fff;
    --hc-demo-bg: #F5F8FF;
    --hc-demo-border: #C9D6F2;
    --hc-page-bg: #EEF4F1;
    --font-family-primary: "Readex Pro", system-ui, -apple-system, "Segoe UI", sans-serif;
}

@media (prefers-color-scheme: dark) {
    :root:not([data-theme="light"]) {
        --primary: #2A4FB8;
        --secondary: #2A4FB8;
        --primary-fg: #F7F8FC;
        --body-fg: #E8ECF8;
        --body-bg: #0E1530;
        --body-quiet-color: #AAB4D4;
        --body-medium-color: #CBD3EA;
        --body-loud-color: #FFFFFF;
        --header-bg: #13224A;
        --breadcrumbs-bg: #0E1A3A;
        --link-fg: #9DB4F0;
        --link-hover-color: #5FD0C9;
        --link-selected-fg: #C7D3FF;
        --hairline-color: #26305A;
        --border-color: #33406A;
        --darkened-bg: #16204A;
        --selected-bg: #1A2550;
        --selected-row: #1E2A55;
        --button-bg: #2A4FB8;
        --button-hover-bg: #3F63D8;
        --default-button-bg: #0F8F8A;
        --default-button-hover-bg: #14B8A6;
        --close-button-bg: #33406A;
        --close-button-hover-bg: #46557A;
        --object-tools-bg: #2A4FB8;
        --object-tools-hover-bg: #0F8F8A;
        --hc-field-bg: #121B3B;
        --hc-demo-bg: #1B2440;
        --hc-demo-border: #33406A;
        --hc-page-bg: #0B1230;
    }
}

html[data-theme="dark"] {
    --primary: #2A4FB8;
    --secondary: #2A4FB8;
    --primary-fg: #F7F8FC;
    --body-fg: #E8ECF8;
    --body-bg: #0E1530;
    --body-quiet-color: #AAB4D4;
    --body-medium-color: #CBD3EA;
    --body-loud-color: #FFFFFF;
    --header-bg: #13224A;
    --breadcrumbs-bg: #0E1A3A;
    --link-fg: #9DB4F0;
    --link-hover-color: #5FD0C9;
    --link-selected-fg: #C7D3FF;
    --hairline-color: #26305A;
    --border-color: #33406A;
    --darkened-bg: #16204A;
    --selected-bg: #1A2550;
    --selected-row: #1E2A55;
    --button-bg: #2A4FB8;
    --button-hover-bg: #3F63D8;
    --default-button-bg: #0F8F8A;
    --default-button-hover-bg: #14B8A6;
    --close-button-bg: #33406A;
    --close-button-hover-bg: #46557A;
    --object-tools-bg: #2A4FB8;
    --object-tools-hover-bg: #0F8F8A;
    --hc-field-bg: #121B3B;
    --hc-demo-bg: #1B2440;
    --hc-demo-border: #33406A;
    --hc-page-bg: #0B1230;
}

/* Header */
#header {
    background: linear-gradient(100deg, #13224A 0%, var(--header-bg) 55%, #0F6F7A 100%);
}

#site-name {
    display: flex;
    align-items: center;
    gap: 14px;
    flex-wrap: wrap;
}

.hc-brand,
#site-name a.hc-brand:link,
#site-name a.hc-brand:visited {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    color: #fff;
    font-weight: 400;
    letter-spacing: 0;
}

.hc-brand b { font-weight: 700; }

.hc-brand small {
    font-size: .62em;
    font-weight: 400;
    opacity: .7;
    margin-left: 4px;
}

.hc-demo-badge {
    display: inline-block;
    padding: 4px 12px;
    border-radius: 999px;
    background: #D9A23A;
    color: #13224A;
    font-size: 12px;
    font-weight: 600;
}

/* Footer */
.hc-footer {
    padding: 20px 40px 28px;
    color: var(--body-quiet-color);
    font-size: 13px;
}

.hc-footer__links {
    display: flex;
    flex-wrap: wrap;
    gap: 8px 24px;
    margin-bottom: 14px;
}

.hc-footer .vis-credit {
    padding-top: 14px;
    border-top: 1px solid var(--hairline-color);
}

@media (max-width: 767px) {
    .hc-footer { padding: 18px 16px 24px; }
}

/* Sign-in page */
body.login {
    background: var(--hc-page-bg) url("lattice.svg") repeat;
}

.login #container {
    width: min(28em, calc(100vw - 32px));
    border: 0;
    border-radius: 20px;
    overflow: hidden;
    box-shadow: 0 0 0 1px var(--hairline-color), 0 30px 70px -28px rgba(29, 59, 143, .45);
}

.login #header {
    padding: 18px 24px;
}

.login #content {
    padding: 24px 28px 6px;
}

.login .form-row {
    padding: 6px 0;
}

.login .form-row label {
    color: var(--body-fg);
    font-weight: 500;
    line-height: 1.9;
}

.login .form-row #id_username,
.login .form-row #id_password {
    height: 46px;
    padding: 10px 14px;
    border: 1px solid var(--border-color);
    border-radius: 12px;
    background: var(--hc-field-bg);
    color: var(--body-fg);
    font-size: 15px;
    transition: border-color .2s, box-shadow .2s;
}

.login .form-row #id_username:focus,
.login .form-row #id_password:focus {
    border-color: #3F63D8;
    outline: none;
    box-shadow: 0 0 0 4px rgba(63, 99, 216, .2);
}

.login .submit-row {
    clear: both;
    margin: 0;
    padding: 18px 0 0;
}

.login .submit-row input {
    width: 100%;
    height: 48px;
    margin: 0;
    border: 0;
    border-radius: 12px;
    background: linear-gradient(120deg, #1D3B8F, #3F63D8 60%, #8B7CF6);
    color: #fff;
    font-size: 15px;
    font-weight: 600;
    letter-spacing: .01em;
    text-transform: none;
    cursor: pointer;
    box-shadow: 0 12px 24px -12px rgba(63, 99, 216, .75);
    transition: filter .2s, transform .2s;
}

.login .submit-row input:hover {
    filter: brightness(1.08);
    transform: translateY(-1px);
}

.login .submit-row input:focus-visible {
    outline: 3px solid #F2B544;
    outline-offset: 2px;
}

/* Demo accounts, under the form (Django floats the form, so clear it) */
.hc-demo-accounts {
    clear: both;
    margin-top: 22px;
    padding-top: 18px;
    border-top: 1px solid var(--hairline-color);
}

.hc-demo-accounts__title {
    margin: 0 0 10px;
    color: var(--body-fg);
    font-weight: 600;
}

.hc-demo-account {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    border: 1px solid var(--hc-demo-border);
    border-radius: 12px;
    background: var(--hc-demo-bg);
    color: var(--body-fg);
    font: inherit;
    text-align: left;
    cursor: pointer;
    transition: border-color .2s, box-shadow .2s;
}

.hc-demo-account:hover,
.hc-demo-account:focus-visible {
    border-color: #3F63D8;
    outline: none;
    box-shadow: 0 0 0 4px rgba(63, 99, 216, .18);
}

.hc-demo-account__role { font-weight: 600; }
.hc-demo-account__email { flex: 1; color: var(--body-quiet-color); overflow-wrap: anywhere; }
.hc-demo-account__use { color: #14B8A6; font-weight: 600; }

.hc-demo-accounts__note {
    margin: 10px 0 0;
    color: var(--body-quiet-color);
    font-size: 12px;
    line-height: 1.5;
}

/* Sign-in footer: centred and stacked to fit the card */
.login .hc-footer {
    padding: 18px 28px 26px;
    text-align: center;
}

.login .hc-footer__links {
    justify-content: center;
    margin-bottom: 12px;
}

.login .hc-footer__links span { display: none; }

.login .hc-footer .vis-credit__line {
    flex-direction: column;
    justify-content: center;
    gap: 12px;
    text-align: center;
}

.login .hc-footer .vis-social {
    order: -1;
    justify-content: center;
}
