/* =============================================================================
   Sign-in / password screens.
   Shares the token vocabulary of the dashboard (Dash/css/app.css) so the
   authenticated and unauthenticated halves of the product look like one thing.
   ============================================================================= */

:root {
    --fs-primary: #4056f4;
    --fs-primary-dark: #2f3fc4;
    --fs-purple: #8b5cf6;

    --fs-bg: #eef1f8;
    --fs-surface: #ffffff;
    --fs-surface-2: #f8f9fc;
    --fs-border: #e3e7f2;

    --fs-text: #1e2438;
    --fs-muted: #6b7391;
    --fs-faint: #9aa1bd;

    --fs-radius: 20px;
    --fs-shadow: 0 4px 12px rgba(20, 26, 51, .05), 0 32px 64px -24px rgba(20, 26, 51, .28);
}

@media (prefers-color-scheme: dark) {
    :root {
        --fs-bg: #0b0e18;
        --fs-surface: #151a2b;
        --fs-surface-2: #1c2237;
        --fs-border: #29304a;

        --fs-text: #e8ebf5;
        --fs-muted: #a3abc7;
        --fs-faint: #6f7799;

        --fs-shadow: 0 4px 12px rgba(0, 0, 0, .4), 0 32px 64px -24px rgba(0, 0, 0, .8);
    }
}

* { box-sizing: border-box; }

body {
    margin: 0;
    min-height: 100vh;
    display: grid;
    place-items: center;
    padding: 24px;
    background-color: var(--fs-bg);
    color: var(--fs-text);
    font-family: 'Nunito', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    -webkit-font-smoothing: antialiased;

    /* Two soft colour washes rather than a flat fill. */
    background-image:
        radial-gradient(circle at 12% 18%, rgba(64, 86, 244, .16), transparent 42%),
        radial-gradient(circle at 88% 82%, rgba(139, 92, 246, .16), transparent 42%);
}

/* --------------------------------------------------------------------------
   Shell
   -------------------------------------------------------------------------- */
.auth-shell {
    width: 100%;
    max-width: 1000px;
    background: var(--fs-surface);
    border: 1px solid var(--fs-border);
    border-radius: var(--fs-radius);
    box-shadow: var(--fs-shadow);
    overflow: hidden;
    display: grid;
    grid-template-columns: 1.05fr 1fr;
}

.auth-shell.is-narrow {
    max-width: 480px;
    grid-template-columns: 1fr;
}

/* --------------------------------------------------------------------------
   Brand panel
   -------------------------------------------------------------------------- */
.auth-brand {
    position: relative;
    padding: 52px 44px;
    color: #fff;
    background: linear-gradient(150deg, #2b3ac9 0%, #4056f4 46%, #7c3aed 100%);
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    overflow: hidden;
}

/* Decorative rings; purely atmospheric, hidden from assistive tech. */
.auth-brand::before,
.auth-brand::after {
    content: "";
    position: absolute;
    border-radius: 50%;
    border: 1px solid rgba(255, 255, 255, .14);
    pointer-events: none;
}

.auth-brand::before {
    width: 340px;
    height: 340px;
    top: -130px;
    right: -120px;
}

.auth-brand::after {
    width: 220px;
    height: 220px;
    bottom: -90px;
    left: -70px;
    background: rgba(255, 255, 255, .05);
}

.brand-mark {
    display: flex;
    align-items: center;
    gap: 12px;
    font-weight: 800;
    font-size: 1rem;
    letter-spacing: .3px;
    position: relative;
    z-index: 1;
}

.brand-mark .mark-icon {
    width: 42px;
    height: 42px;
    border-radius: 12px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .16);
    backdrop-filter: blur(6px);
    font-size: 1.15rem;
}

/* An uploaded logo replaces the icon glyph and keeps the same footprint. */
.brand-mark .mark-icon .mark-img {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
    display: block;
}

.brand-copy {
    position: relative;
    z-index: 1;
    margin: 40px 0;
}

.brand-copy h1 {
    font-size: 2rem;
    line-height: 1.18;
    font-weight: 800;
    letter-spacing: -.6px;
    margin: 0 0 12px;
}

.brand-copy p {
    margin: 0;
    color: rgba(255, 255, 255, .82);
    font-size: .95rem;
    line-height: 1.6;
    max-width: 34ch;
}

.brand-points {
    list-style: none;
    padding: 0;
    margin: 0;
    position: relative;
    z-index: 1;
    display: grid;
    gap: 14px;
}

.brand-points li {
    display: flex;
    align-items: center;
    gap: 12px;
    font-size: .88rem;
    font-weight: 600;
    color: rgba(255, 255, 255, .93);
}

.brand-points i {
    width: 30px;
    height: 30px;
    border-radius: 9px;
    display: grid;
    place-items: center;
    background: rgba(255, 255, 255, .16);
    font-size: .8rem;
    flex: 0 0 auto;
}

/* --------------------------------------------------------------------------
   Form panel
   -------------------------------------------------------------------------- */
.auth-panel {
    padding: 52px 44px;
    display: flex;
    flex-direction: column;
    justify-content: center;
}

.auth-panel h2 {
    margin: 0 0 6px;
    font-size: 1.5rem;
    font-weight: 800;
    letter-spacing: -.4px;
}

.auth-panel .lede {
    margin: 0 0 28px;
    color: var(--fs-muted);
    font-size: .9rem;
}

.field {
    margin-bottom: 18px;
}

.field label {
    display: block;
    font-size: .78rem;
    font-weight: 800;
    letter-spacing: .04em;
    text-transform: uppercase;
    color: var(--fs-muted);
    margin-bottom: 7px;
}

.control {
    position: relative;
    display: flex;
    align-items: center;
}

.control > i {
    position: absolute;
    left: 15px;
    color: var(--fs-faint);
    font-size: .9rem;
    pointer-events: none;
}

.control input {
    width: 100%;
    padding: 13px 15px 13px 42px;
    font-size: .92rem;
    font-family: inherit;
    color: var(--fs-text);
    background: var(--fs-surface-2);
    border: 1.5px solid var(--fs-border);
    border-radius: 12px;
    transition: border-color .18s ease, box-shadow .18s ease, background-color .18s ease;
}

.control input::placeholder { color: var(--fs-faint); }

.control input:focus {
    outline: none;
    background: var(--fs-surface);
    border-color: var(--fs-primary);
    box-shadow: 0 0 0 4px rgba(64, 86, 244, .13);
}

.control input:focus ~ i { color: var(--fs-primary); }

.toggle-visibility {
    position: absolute;
    right: 6px;
    background: none;
    border: 0;
    color: var(--fs-faint);
    cursor: pointer;
    padding: 8px 10px;
    border-radius: 8px;
    font-size: .9rem;
}

.toggle-visibility:hover { color: var(--fs-primary); }

.control:has(.toggle-visibility) input { padding-right: 46px; }

.field-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 22px;
    font-size: .84rem;
}

.remember {
    display: flex;
    align-items: center;
    gap: 8px;
    color: var(--fs-muted);
    cursor: pointer;
    user-select: none;
}

.remember input { accent-color: var(--fs-primary); width: 15px; height: 15px; cursor: pointer; }

.link {
    color: var(--fs-primary);
    text-decoration: none;
    font-weight: 700;
}

.link:hover { text-decoration: underline; }

.btn-submit {
    width: 100%;
    padding: 13px 20px;
    font-size: .95rem;
    font-weight: 800;
    font-family: inherit;
    color: #fff;
    background: linear-gradient(135deg, var(--fs-primary), var(--fs-purple));
    border: 0;
    border-radius: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 9px;
    transition: transform .14s ease, box-shadow .2s ease, opacity .2s ease;
    box-shadow: 0 10px 24px -12px rgba(64, 86, 244, .9);
}

.btn-submit:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 16px 32px -14px rgba(64, 86, 244, .95);
}

.btn-submit:active:not(:disabled) { transform: translateY(0); }

.btn-submit:disabled { opacity: .62; cursor: not-allowed; }

/* --------------------------------------------------------------------------
   Alerts
   -------------------------------------------------------------------------- */
.alert-container:empty { display: none; }

.alert {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    padding: 12px 14px;
    border-radius: 11px;
    font-size: .85rem;
    font-weight: 600;
    margin-bottom: 18px;
    line-height: 1.45;
    border: 1px solid transparent;
}

.alert i { margin-top: 2px; flex: 0 0 auto; }

.alert-error {
    background: rgba(239, 68, 68, .10);
    border-color: rgba(239, 68, 68, .28);
    color: #dc2626;
}

.alert-success {
    background: rgba(16, 185, 129, .10);
    border-color: rgba(16, 185, 129, .28);
    color: #059669;
}

.alert-info {
    background: rgba(14, 165, 233, .10);
    border-color: rgba(14, 165, 233, .28);
    color: #0284c7;
}

@media (prefers-color-scheme: dark) {
    .alert-error   { color: #fca5a5; }
    .alert-success { color: #6ee7b7; }
    .alert-info    { color: #7dd3fc; }
}

.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid rgba(255, 255, 255, .35);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

.auth-foot {
    margin-top: 26px;
    padding-top: 20px;
    border-top: 1px solid var(--fs-border);
    text-align: center;
    font-size: .8rem;
    color: var(--fs-faint);
}

.auth-foot a { color: var(--fs-muted); text-decoration: none; font-weight: 700; }
.auth-foot a:hover { color: var(--fs-primary); }

/* Password strength meter (reset screen) */
.strength {
    height: 5px;
    border-radius: 999px;
    background: var(--fs-border);
    overflow: hidden;
    margin-top: 9px;
}

.strength span {
    display: block;
    height: 100%;
    width: 0;
    border-radius: 999px;
    transition: width .3s ease, background-color .3s ease;
}

.strength-hint {
    font-size: .75rem;
    color: var(--fs-muted);
    margin-top: 6px;
}

/* --------------------------------------------------------------------------
   Responsive
   -------------------------------------------------------------------------- */
@media (max-width: 880px) {
    .auth-shell { grid-template-columns: 1fr; max-width: 480px; }

    /* On a phone the brand panel is decoration; keep only a compact header. */
    .auth-brand { padding: 30px 32px; }
    .brand-copy { margin: 22px 0; }
    .brand-copy h1 { font-size: 1.5rem; }
    .brand-points { display: none; }
    .auth-brand::before, .auth-brand::after { display: none; }
}

@media (max-width: 520px) {
    body { padding: 0; }
    .auth-shell { border-radius: 0; border: 0; min-height: 100vh; align-content: center; }
    .auth-panel { padding: 34px 26px; }
    .auth-brand { padding: 26px; }
}

@media (prefers-reduced-motion: reduce) {
    * { animation-duration: .01ms !important; transition-duration: .01ms !important; }
}
