/*
 * Light / dark theme for the sign-in layout (admin::layouts.default):
 * /login, /auth/forgetpwd, /auth/resetpwd/{token} and the expired-link pages.
 *
 * partials.theme-boot puts data-theme="light|dark" on <html> before first
 * paint; partials.theme-toggle flips it. The layout and its views read the
 * --auth-* tokens below from their inline style="" attributes, each with the
 * light value as the var() fallback, so light mode renders exactly as before
 * even if this sheet does not load.
 *
 * Loaded after Bootstrap 4 and mainStyle.css. The dark rules that recolour
 * Bootstrap's own !important utilities (.text-primary, .text-light) carry
 * !important too and win on specificity.
 *
 * Dark contrast (WCAG AA), card #161b22 / page #0d1117:
 *   text #e6edf3 on card 14.6:1   muted #9da7b3 on card 7.1:1
 *   link #79b8ff on card 8.3:1    footer #9da7b3 on page 7.8:1
 *   field border #6e7681 vs card 3.8:1, vs field #0d1117 4.1:1
 *   login button #0d1117 on #e6edf3 16.0:1
 *   send / confirm white on #2f6fe4 4.7:1, button vs card 3.7:1
 *   active language white on #1f6feb 4.6:1
 */

:root {
    --auth-page-bg: #f4f6fb;
    --auth-card-bg: #fff;
    --auth-card-shadow: 0 4px 8px 0 rgba(0, 0, 0, 0.2), 0 6px 20px 0 rgba(0, 0, 0, 0.19);
    --auth-muted: gray;
    --auth-footer-link: #52617a;
    --auth-submit-bg: black;
    --auth-submit-blue: #1148C7;
}

/* One logo at a time: the light-surface logo by default, the dark-surface
   (white-ink) logo on the dark card. */
.login-logo .auth-logo--dark {
    display: none;
}

[data-theme="dark"] {
    --auth-page-bg: #0d1117;
    --auth-card-bg: #161b22;
    --auth-card-shadow: 0 0 0 1px rgba(240, 246, 252, 0.1), 0 8px 24px rgba(0, 0, 0, 0.6);
    --auth-text: #e6edf3;
    --auth-muted: #9da7b3;
    --auth-link: #79b8ff;
    --auth-footer-link: #9da7b3;
    --auth-field-bg: #0d1117;
    --auth-addon-bg: #21262d;
    --auth-border: #6e7681;
    --auth-focus: #58a6ff;
    --auth-menu-bg: #1c2128;
    --auth-menu-hover: #2d333b;
    --auth-menu-active: #1f6feb;
    --auth-submit-bg: #e6edf3;
    --auth-submit-text: #0d1117;
    --auth-submit-blue: #2f6fe4;
}

[data-theme="dark"] .login-logo .auth-logo--light {
    display: none;
}

[data-theme="dark"] .login-logo .auth-logo--dark {
    display: inline;
}

[data-theme="dark"] body.login-page {
    color: var(--auth-text);
}

/* Links: "Forgot Password?", "Register a new organization", "Back to login". */
[data-theme="dark"] .login-box .text-primary {
    color: var(--auth-link) !important;
}

/* Login button: black on the white card becomes light on the dark card. */
[data-theme="dark"] #loginForm .btn-block.text-light {
    color: var(--auth-submit-text) !important;
}

/* Form fields and their icon add-ons. */
[data-theme="dark"] .login-box .form-control {
    color: var(--auth-text);
    background-color: var(--auth-field-bg);
    border-color: var(--auth-border);
}

[data-theme="dark"] .login-box .form-control::placeholder {
    color: var(--auth-muted);
    opacity: 1;
}

[data-theme="dark"] .login-box .form-control:focus {
    color: var(--auth-text);
    background-color: var(--auth-field-bg);
    border-color: var(--auth-focus);
    box-shadow: 0 0 0 0.2rem rgba(88, 166, 255, 0.3);
}

/* The read-only address on the reset form. */
[data-theme="dark"] .login-box .form-control[readonly] {
    background-color: var(--auth-addon-bg);
}

[data-theme="dark"] .login-box .form-control:-webkit-autofill {
    -webkit-text-fill-color: var(--auth-text);
    box-shadow: 0 0 0 1000px var(--auth-field-bg) inset;
    caret-color: var(--auth-text);
}

[data-theme="dark"] .login-box .input-group-text {
    color: var(--auth-text);
    background-color: var(--auth-addon-bg);
    border-color: var(--auth-border);
}

/* Language switcher (admin::layouts.partials.language_switcher). */
[data-theme="dark"] .login-box .nav-link,
[data-theme="dark"] .login-box .nav-link:hover,
[data-theme="dark"] .login-box .nav-link:focus {
    color: var(--auth-link);
}

[data-theme="dark"] .login-box .dropdown-menu {
    background-color: var(--auth-menu-bg);
    border-color: rgba(240, 246, 252, 0.15);
    box-shadow: 0 8px 24px rgba(0, 0, 0, 0.6);
}

[data-theme="dark"] .login-box .dropdown-item {
    color: var(--auth-text);
}

[data-theme="dark"] .login-box .dropdown-item:hover,
[data-theme="dark"] .login-box .dropdown-item:focus {
    color: var(--auth-text);
    background-color: var(--auth-menu-hover);
}

[data-theme="dark"] .login-box .dropdown-item.active,
[data-theme="dark"] .login-box .dropdown-item:active {
    color: #fff;
    background-color: var(--auth-menu-active);
}

/* The loader modal's spinner sits on the card colour. */
[data-theme="dark"] #loader .fa-spinner {
    color: var(--auth-text);
}
