/* =============================================================
   Login V2 -- redesigned sign-in page.
   Matches the Register V2 / LandingV2 design system. Selectors use
   the shared .rv2-* prefix (and a .rv2 wrapper) so they line up with
   register-v2.css and never collide with the legacy login.css
   (.login-*) classes, which stay loaded globally via App.razor but
   are dormant for this page.
   Tokens come from brand-tokens.css (--brand-*). Dark mode rides the
   global body.dark-mode class.
   ============================================================= */

.rv2 {
    --rv2-blue: var(--brand-primary, #00B4FF);
    --rv2-blue-deep: var(--brand-secondary, #0174B1);
    --rv2-tint: var(--brand-bg, #F6FBFF);
    --rv2-charcoal: var(--brand-charcoal, #222222);
    --rv2-orange: var(--brand-cta, #FFAA00);
    --rv2-gray: var(--brand-divider, #E0E0E0);
    --rv2-ink-60: #5A6472;
    --rv2-field-border: #D6DEE8;
    --rv2-card: #FFFFFF;

    font-family: 'Inter', system-ui, sans-serif;
    color: var(--rv2-charcoal);
    -webkit-font-smoothing: antialiased;
}

.rv2 *, .rv2 *::before, .rv2 *::after { box-sizing: border-box; }

.rv2 .sr-only {
    position: absolute !important;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden; clip: rect(0, 0, 0, 0);
    white-space: nowrap; border: 0;
}

/* SHELL ----------------------------------------------------- */
.rv2-shell {
    min-height: 100vh;
    min-height: 100dvh;
    width: 100%;
    background: var(--rv2-tint);
    display: flex;
    align-items: stretch;
    justify-content: center;
    padding: 96px 24px 48px;
}

.rv2-grid {
    width: 100%;
    max-width: 1100px;
    margin: 0 auto;
    display: grid;
    grid-template-columns: 1fr 1fr;
    /* DOM order is form-first so keyboard tab order reaches the form
       first (WCAG 2.4.3). On desktop named grid areas put the welcome
       panel on the left and the form on the right. */
    grid-template-areas: "welcome form";
    gap: 64px;
    align-items: center;
}
.rv2-welcome { grid-area: welcome; }
.rv2-form-card { grid-area: form; }

/* WELCOME PANEL (left) -------------------------------------- */
.rv2-welcome { max-width: 480px; }

.rv2-eyebrow {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 700;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--rv2-blue);
    margin: 0 0 18px;
}
/* Check-icon eyebrow shared with Register V2. Sized explicitly so the inline
   SVG does not fall back to its 300x150 default viewport. */
.rv2-check { flex: 0 0 18px; width: 18px; height: 18px; color: var(--rv2-blue); display: inline-block; }
.rv2-check svg { width: 100%; height: 100%; display: block; }

.rv2-welcome h2 {
    font-weight: 700;
    font-size: clamp(34px, 4vw, 50px);
    line-height: 1.05;
    letter-spacing: -0.035em;
    margin: 0 0 16px;
    color: var(--rv2-charcoal);
}
.rv2-welcome h2 .rv2-accent { color: var(--rv2-blue); }

.rv2-welcome .rv2-sub {
    font-size: 18px;
    line-height: 1.5;
    color: var(--rv2-ink-60);
    margin: 0 0 30px;
}
/* Italic emphasis inside .rv2-sub. Matches Register V2's .rv2-em motif so
   the two auth pages emphasize key phrases the same way. */
.rv2-welcome .rv2-sub .rv2-em { font-style: italic; font-weight: 600; color: var(--rv2-charcoal); }

.rv2-welcome-list { display: flex; flex-direction: column; gap: 18px; }
.rv2-welcome-item { display: flex; gap: 14px; align-items: flex-start; }
.rv2-welcome-item .rv2-wi-ico {
    flex: 0 0 22px;
    width: 22px; height: 22px;
    color: var(--rv2-blue);
    margin-top: 2px;
}
.rv2-welcome-item .rv2-wi-ico svg { width: 100%; height: 100%; display: block; }
.rv2-welcome-item .rv2-wi-head { font-weight: 700; font-size: 16px; margin: 0 0 2px; color: var(--rv2-charcoal); }
.rv2-welcome-item .rv2-wi-sub { font-size: 14px; line-height: 1.5; color: var(--rv2-ink-60); margin: 0; }

/* FORM CARD (right) ----------------------------------------- */
.rv2-form-card {
    background: var(--rv2-card);
    border: 1px solid var(--rv2-gray);
    border-radius: 20px;
    box-shadow: 0 24px 60px rgba(2, 32, 71, 0.10);
    padding: 32px;
    width: 100%;
    max-width: 460px;
    justify-self: end;
}

.rv2-form-head { margin-bottom: 22px; }
.rv2-title { font-weight: 700; font-size: 28px; letter-spacing: -0.02em; margin: 0 0 6px; color: var(--rv2-charcoal); }
.rv2-subtitle { font-size: 15px; line-height: 1.5; color: var(--rv2-ink-60); margin: 0; }

/* Alerts */
.rv2-alert {
    display: flex; align-items: flex-start; gap: 10px;
    border-radius: 12px; padding: 12px 14px; margin-bottom: 16px;
    font-size: 14px; line-height: 1.45;
}
.rv2-alert .rv2-alert-ico { flex: 0 0 18px; width: 18px; height: 18px; margin-top: 1px; }
.rv2-alert .rv2-alert-ico svg { width: 100%; height: 100%; display: block; }
.rv2-alert-error { background: #FDECEC; color: #B42318; }
.rv2-alert-success { background: #E7F7EE; color: #197A45; }
.rv2-alert a { color: inherit; font-weight: 700; text-decoration: underline; }

/* Form */
.rv2-form { display: flex; flex-direction: column; gap: 16px; }
.rv2-field { display: flex; flex-direction: column; gap: 6px; }
.rv2-label { font-size: 13px; font-weight: 600; color: var(--rv2-charcoal); }
.rv2-input {
    width: 100%;
    font-family: inherit;
    font-size: 15px;
    color: var(--rv2-charcoal);
    background: #FFFFFF;
    border: 1px solid var(--rv2-field-border);
    border-radius: 10px;
    padding: 12px 14px;
    transition: border-color 120ms ease, box-shadow 120ms ease;
}
.rv2-input::placeholder { color: #9AA6B2; }
.rv2-input:focus {
    outline: none;
    border-color: var(--rv2-blue);
    box-shadow: 0 0 0 3px rgba(0, 180, 255, 0.18);
}
.rv2-input:disabled { background: #F3F5F8; cursor: not-allowed; }

.rv2-password-wrap { position: relative; display: flex; }
.rv2-password-wrap .rv2-input { padding-right: 44px; }
.rv2-password-toggle {
    position: absolute; right: 6px; top: 50%; transform: translateY(-50%);
    appearance: none; border: 0; background: transparent; cursor: pointer;
    width: 34px; height: 34px; display: inline-flex; align-items: center; justify-content: center;
    color: var(--rv2-ink-60); border-radius: 8px;
}
.rv2-password-toggle:hover { color: var(--rv2-charcoal); }
.rv2-password-toggle svg { width: 20px; height: 20px; display: block; }

/* Options row: remember me + forgot password */
.rv2-options { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.rv2-checkbox-label { display: inline-flex; align-items: center; gap: 8px; cursor: pointer; font-size: 14px; color: var(--rv2-ink-60); }
.rv2-checkbox { width: 18px; height: 18px; accent-color: var(--rv2-blue); flex: 0 0 18px; }
.rv2-link { font-size: 14px; font-weight: 600; color: var(--rv2-blue-deep); text-decoration: none; }
.rv2-link:hover { text-decoration: underline; }

/* Button */
.rv2-btn {
    appearance: none; border: 0; cursor: pointer;
    font-family: inherit; font-size: 16px; font-weight: 700;
    border-radius: 12px; padding: 14px 20px;
    display: inline-flex; align-items: center; justify-content: center; gap: 10px;
    transition: transform 80ms ease, box-shadow 120ms ease, background 120ms ease;
}
.rv2-btn:disabled { opacity: 0.65; cursor: not-allowed; }
.rv2-btn-primary { background: var(--rv2-blue); color: #FFFFFF; box-shadow: 0 8px 20px rgba(0, 180, 255, 0.28); width: 100%; }
.rv2-btn-primary:not(:disabled):hover { transform: translateY(-1px); box-shadow: 0 12px 26px rgba(0, 180, 255, 0.34); }

.rv2-spinner {
    width: 16px; height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.45);
    border-top-color: #FFFFFF;
    border-radius: 50%;
    animation: rv2-spin 0.7s linear infinite;
}
@keyframes rv2-spin { to { transform: rotate(360deg); } }

/* Sign-up prompt */
.rv2-signup { text-align: center; margin-top: 22px; font-size: 14px; color: var(--rv2-ink-60); }
.rv2-signup a { color: var(--rv2-blue-deep); font-weight: 700; text-decoration: none; margin-left: 6px; }
.rv2-signup a:hover { text-decoration: underline; }

/* ============================ RESPONSIVE ============================ */
@media (max-width: 980px) {
    .rv2-grid {
        grid-template-columns: 1fr;
        grid-template-areas: "form" "welcome";  /* form first on mobile */
        gap: 36px;
        max-width: 480px;
    }
    .rv2-form-card { justify-self: stretch; }
    .rv2-welcome { max-width: none; }
    .rv2-welcome h2 { font-size: clamp(28px, 7vw, 36px); }
}
@media (max-width: 560px) {
    .rv2-shell { padding: 84px 16px 32px; }
    .rv2-form-card { padding: 24px 20px; border-radius: 16px; }
}

/* ============================ DARK MODE ============================ */
body.dark-mode .rv2 {
    --rv2-tint: #15181D;
    --rv2-charcoal: #E8EAED;
    --rv2-ink-60: #9AA6B2;
    --rv2-gray: #2C313A;
    --rv2-field-border: #3A4250;
    --rv2-card: #1C2026;
    --rv2-blue: var(--brand-primary-light, #4DB8FF);
}
body.dark-mode .rv2-shell { background: #121212; }
body.dark-mode .rv2-welcome h2,
body.dark-mode .rv2-title { color: #F5F5F5; }
body.dark-mode .rv2-input { background: #11151A; color: #E8EAED; }
body.dark-mode .rv2-input::placeholder { color: #66707C; }
body.dark-mode .rv2-alert-error { background: #3A1B1A; color: #FCA29A; }
body.dark-mode .rv2-alert-success { background: #16321F; color: #74D89B; }

/* Restore brand text colors that a global `body.dark-mode p` rule in
   app.css would otherwise clobber. Single-class rules like .rv2-eyebrow
   lose to (0,1,2) specificity, so scope-prefix to win the cascade --
   same fix Register V2 applies for the same reason. */
body.dark-mode .rv2 .rv2-eyebrow { color: var(--rv2-blue); }
body.dark-mode .rv2 .rv2-subtitle,
body.dark-mode .rv2 .rv2-sub,
body.dark-mode .rv2 .rv2-wi-sub,
body.dark-mode .rv2 .rv2-signup,
body.dark-mode .rv2 .rv2-checkbox-label { color: var(--rv2-ink-60); }
body.dark-mode .rv2 .rv2-wi-head { color: var(--rv2-charcoal); }
body.dark-mode .rv2 .rv2-sub .rv2-em { color: var(--rv2-charcoal); }
