/* ============================================================
   OSHOrbit — Authentication (Aurora Dark)
   Loaded only by templates/base_auth.html, so all styling here
   is scoped to the sign-in surfaces. One shared design drives
   every login page (enterprise + client portal); only the badge
   text differs between them.
   ============================================================ */

:root {
    --auth-ink: #ffffff;
    --auth-ink-muted: #a9bbe0;
    --auth-ink-faint: #7f92bd;
    --auth-navy: #0a1738;
    --auth-navy-2: #0e1c40;
    --auth-primary: #2f6ae6;
    --auth-primary-ink: #8ab4ff;
    --auth-amber: #f5a524;
    --auth-amber-dark: #e08706;
    --auth-danger: #ffb4b4;
    --auth-glass: rgba(255, 255, 255, 0.07);
    --auth-glass-border: rgba(255, 255, 255, 0.16);
    --auth-input-bg: rgba(255, 255, 255, 0.06);
    --auth-input-border: rgba(255, 255, 255, 0.18);
    --auth-transition-fast: 160ms ease;
    --auth-font-sans: "Inter", "Segoe UI", system-ui, -apple-system, BlinkMacSystemFont, "Helvetica Neue", sans-serif;
}

*,
*::before,
*::after { box-sizing: border-box; }

html, body { margin: 0; padding: 0; }

body {
    color: var(--auth-ink);
    background: var(--auth-navy);
    font-family: var(--auth-font-sans);
    -webkit-font-smoothing: antialiased;
}

img { max-width: 100%; }
a { color: inherit; }

/* ---------- Page / shell scaffolding (from base_auth.html) ---------- */
.auth-page {
    margin: 0;
    min-height: 100dvh;
    display: flex;
    background: var(--auth-navy);
    font-family: var(--auth-font-sans);
}

.auth-shell {
    width: 100%;
    min-height: 100dvh;
    display: flex;
    margin: 0;
}

.auth-card {
    width: 100%;
    background: transparent;
    border: 0;
    border-radius: 0;
    box-shadow: none;
    padding: 0;
}

/* base_auth.html renders a small brand header we don't use in this layout */
.auth-card > .auth-brand { display: none; }

/* ---------- Aurora backdrop ---------- */
.auth-aurora {
    position: relative;
    width: 100%;
    min-height: 100dvh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px 22px;
    overflow: hidden;
    background:
        radial-gradient(720px 400px at 14% 8%, rgba(47, 106, 230, 0.55), transparent 60%),
        radial-gradient(640px 380px at 88% 92%, rgba(16, 143, 126, 0.42), transparent 60%),
        radial-gradient(560px 320px at 82% 6%, rgba(124, 92, 255, 0.40), transparent 60%),
        var(--auth-navy);
}

.auth-aurora__grid {
    position: absolute;
    inset: 0;
    pointer-events: none;
    opacity: 0.10;
    background-image:
        linear-gradient(rgba(255, 255, 255, 0.9) 1px, transparent 1px),
        linear-gradient(90deg, rgba(255, 255, 255, 0.9) 1px, transparent 1px);
    background-size: 42px 42px;
    -webkit-mask-image: radial-gradient(circle at 50% 40%, #000 0, transparent 78%);
            mask-image: radial-gradient(circle at 50% 40%, #000 0, transparent 78%);
}

/* ---------- Glass login card ---------- */
.auth-login-card {
    position: relative;
    z-index: 2;
    width: 100%;
    max-width: 428px;
    padding: 38px 36px 30px;
    border-radius: 24px;
    background: var(--auth-glass);
    border: 1px solid var(--auth-glass-border);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    box-shadow: 0 40px 90px -42px rgba(0, 0, 0, 0.72), inset 0 1px 0 rgba(255, 255, 255, 0.08);
    color: var(--auth-ink);
}

.auth-login-head {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 26px;
}

.auth-login-brand {
    display: inline-flex;
    align-items: center;
    min-width: 0;
}

.auth-login-logo {
    display: block;
    width: auto;
    max-width: 190px;
    max-height: 38px;
    height: auto;
    object-fit: contain;
    filter: drop-shadow(0 6px 16px rgba(0, 0, 0, 0.35));
}

.auth-login-badge {
    margin-left: auto;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    gap: 7px;
    padding: 7px 12px;
    border-radius: 999px;
    background: rgba(47, 106, 230, 0.22);
    border: 1px solid rgba(120, 170, 255, 0.40);
    color: #bfe3ff;
    font-size: 0.66rem;
    font-weight: 800;
    letter-spacing: 0.06em;
    text-transform: uppercase;
    white-space: nowrap;
}

.auth-login-badge::before {
    content: "";
    width: 13px;
    height: 13px;
    flex-shrink: 0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='13' height='13' viewBox='0 0 24 24' fill='none' stroke='%23bfe3ff' stroke-width='2.4' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='3' y='11' width='18' height='11' rx='2'/%3E%3Cpath d='M7 11V7a5 5 0 0 1 10 0v4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: contain;
}

.auth-login-title {
    margin: 0;
    font-size: clamp(1.5rem, 1.8vw, 1.75rem);
    font-weight: 800;
    letter-spacing: -0.02em;
    line-height: 1.2;
    color: #ffffff;
}

.auth-login-subtitle {
    margin: 7px 0 0;
    max-width: 30rem;
    font-size: 0.92rem;
    line-height: 1.6;
    color: var(--auth-ink-muted);
}

/* ---------- Form ---------- */
.auth-form {
    display: grid;
    gap: 18px;
    margin-top: 28px;
}

.crm-field,
.form-group {
    display: grid;
    gap: 8px;
    min-width: 0;
}

.auth-form .crm-field label,
.crm-field label {
    margin: 0;
    font-size: 0.8rem;
    font-weight: 700;
    letter-spacing: 0.01em;
    line-height: 1.35;
    color: #cdd8f0;
}

/* Inputs (Django renders these; target class + bare input) */
.auth-form .form-control,
.auth-form input[type="text"],
.auth-form input[type="email"],
.auth-form input[type="password"],
.auth-form input:not([type="checkbox"]):not([type="radio"]) {
    width: 100%;
    min-height: 54px;
    padding: 0 52px 0 48px;
    border-radius: 14px;
    border: 1px solid var(--auth-input-border);
    background-color: var(--auth-input-bg);
    color: #ffffff;
    font: inherit;
    font-size: 0.95rem;
    transition: border-color var(--auth-transition-fast), box-shadow var(--auth-transition-fast), background-color var(--auth-transition-fast);
}

.auth-form .form-control::placeholder,
.auth-form input::placeholder { color: var(--auth-ink-faint); }

.auth-form .form-control:hover,
.auth-form input:not([type="checkbox"]):not([type="radio"]):hover {
    border-color: rgba(255, 255, 255, 0.30);
}

.auth-form .form-control:focus,
.auth-form input:not([type="checkbox"]):not([type="radio"]):focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 4px rgba(47, 106, 230, 0.25);
    background-color: rgba(255, 255, 255, 0.09);
}

/* Field icons — username (1st) + password (2nd) */
.auth-login-card .auth-form .crm-field:nth-of-type(1) .form-control,
.auth-login-card .auth-form .crm-field:nth-of-type(1) input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='21' height='21' viewBox='0 0 24 24' fill='none' stroke='%238fa6d6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M20 21a8 8 0 0 0-16 0'/%3E%3Ccircle cx='12' cy='7' r='4'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
    background-size: 19px 19px;
}

.auth-login-card .auth-form .crm-field:nth-of-type(2) .form-control,
.auth-login-card .auth-form .crm-field:nth-of-type(2) input {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='21' height='21' viewBox='0 0 24 24' fill='none' stroke='%238fa6d6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Crect x='5' y='11' width='14' height='10' rx='2'/%3E%3Cpath d='M8 11V8a4 4 0 0 1 8 0v3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: left 15px center;
    background-size: 19px 19px;
}

/* Password show/hide toggle */
.auth-password-input-wrap { position: relative; }

.auth-password-input-wrap .form-control,
.auth-password-input-wrap input[name="password"] { padding-right: 52px; }

.password-toggle {
    position: absolute;
    top: 50%;
    right: 12px;
    transform: translateY(-50%);
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: 0;
    border-radius: 9px;
    background: transparent;
    cursor: pointer;
    z-index: 2;
    transition: background-color var(--auth-transition-fast);
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='21' height='21' viewBox='0 0 24 24' fill='none' stroke='%238fa6d6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M1 12s4-7 11-7 11 7 11 7-4 7-11 7S1 12 1 12z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: center;
    background-size: 18px 18px;
}

.password-toggle:hover { background-color: rgba(255, 255, 255, 0.10); }

.password-toggle:focus-visible {
    outline: none;
    box-shadow: 0 0 0 3px rgba(47, 106, 230, 0.35);
    background-color: rgba(47, 106, 230, 0.14);
}

.password-toggle.is-visible {
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='21' height='21' viewBox='0 0 24 24' fill='none' stroke='%238fa6d6' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M3 3l18 18'/%3E%3Cpath d='M10.6 5.1A10.7 10.7 0 0 1 12 5c6.2 0 10 7 10 7a18.7 18.7 0 0 1-3.2 4.2'/%3E%3Cpath d='M6.7 6.8C4 8.7 2 12 2 12s3.8 7 10 7c1.8 0 3.3-.4 4.8-1.1'/%3E%3Cpath d='M9.9 9.9A3 3 0 0 0 14.1 14.1'/%3E%3C/svg%3E");
}

.auth-password-input-wrap input[type="password"]::-ms-reveal,
.auth-password-input-wrap input[type="password"]::-ms-clear { display: none; }

/* Errors */
.field-error,
.errorlist,
.form-group ul.errorlist {
    margin: 2px 0 0;
    padding: 0;
    list-style: none;
    font-size: 0.82rem;
    line-height: 1.45;
    color: var(--auth-danger);
}

.form-error-summary {
    margin: 0 0 2px;
    padding: 13px 15px;
    border: 1px solid rgba(255, 120, 120, 0.32);
    border-radius: 14px;
    background: rgba(220, 60, 60, 0.16);
    color: #ffd9d9;
}

.form-error-summary h3 {
    margin: 0 0 4px;
    font-size: 0.86rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    color: #ffe0e0;
}

.form-error-summary p,
.form-error-summary li { margin: 0; font-size: 0.83rem; line-height: 1.5; }

.form-error-summary ul { margin: 4px 0 0; padding-left: 18px; }

/* Submit */
.form-actions { margin-top: 6px; display: flex; }

.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    cursor: pointer;
    text-decoration: none;
    font: inherit;
}

.auth-submit {
    width: 100%;
    min-height: 54px;
    padding: 0 22px;
    border: 0;
    border-radius: 14px;
    background: linear-gradient(180deg, var(--auth-amber) 0%, var(--auth-amber-dark) 100%);
    box-shadow: 0 18px 34px -14px rgba(245, 165, 36, 0.55), inset 0 1px 0 rgba(255, 255, 255, 0.22);
    color: #241300;
    font-size: 0.98rem;
    font-weight: 800;
    letter-spacing: 0.01em;
    transition: transform var(--auth-transition-fast), box-shadow var(--auth-transition-fast), filter var(--auth-transition-fast);
}

.auth-submit:hover,
.auth-submit:focus {
    transform: translateY(-1px);
    box-shadow: 0 22px 40px -14px rgba(245, 165, 36, 0.6), inset 0 1px 0 rgba(255, 255, 255, 0.24);
    filter: saturate(1.05);
    outline: none;
}

.auth-submit:active { transform: translateY(0); }

/* Footer — product attribution */
.auth-login-foot {
    margin: 22px 0 0;
    text-align: center;
    font-size: 0.76rem;
    font-weight: 600;
    letter-spacing: 0.02em;
    color: var(--auth-ink-faint);
}

.auth-login-foot-link {
    color: var(--auth-primary-ink);
    text-decoration: none;
    border-bottom: 1px solid rgba(138, 180, 255, 0.4);
    transition: color var(--auth-transition-fast), border-color var(--auth-transition-fast);
}

.auth-login-foot-link:hover,
.auth-login-foot-link:focus-visible {
    color: #ffffff;
    border-bottom-color: rgba(255, 255, 255, 0.7);
    outline: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 560px) {
    .auth-aurora { padding: 26px 16px; }

    .auth-login-card {
        padding: 30px 22px 24px;
        border-radius: 20px;
    }

    .auth-login-head { gap: 10px; margin-bottom: 22px; }
    .auth-login-logo { max-height: 32px; max-width: 150px; }
    .auth-login-badge { font-size: 0.6rem; padding: 6px 10px; }
    .auth-login-title { font-size: 1.5rem; }
    .auth-form { gap: 15px; margin-top: 22px; }

    .auth-form .form-control,
    .auth-form input:not([type="checkbox"]):not([type="radio"]),
    .auth-submit { min-height: 50px; }
}

@media (max-width: 380px) {
    .auth-login-head { flex-wrap: wrap; }
    .auth-login-badge { margin-left: 0; }
}
