/* =================================================================
   WF Portal — Login Page
   -----------------------------------------------------------------
   Standalone styles for the login/auth flow. Renders outside
   MainLayout (no TopNav, no wf-main). Uses --theme-* tokens
   from root.css.
   ================================================================= */

/* ── Body override when login page is rendered ──────────────────── */

body:has(.login-wrapper) {
    background-color: #1a1a2e !important;
    background-image:
        radial-gradient(ellipse at 20% 20%, rgba(91, 33, 182, .18) 0%, transparent 50%),
        radial-gradient(ellipse at 80% 80%, rgba(37, 99, 235, .12) 0%, transparent 50%),
        radial-gradient(ellipse at 50% 50%, rgba(26, 107, 60, .08) 0%, transparent 60%),
        linear-gradient(160deg, #1a1a2e 0%, #16213e 30%, #1a1a2e 60%, #0f3460 100%) !important;
}

/* ── Full-viewport wrapper ──────────────────────────────────────── */

.login-wrapper {
    flex: 1;
    min-height: 100vh;
    overflow-y: auto;
    padding: 6vh 1rem 2rem;
    text-align: center;
}

/* ── Logo block above card ──────────────────────────────────────── */

.login-brand {
    position: relative;
    z-index: 1;
    display: inline-flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 2rem;
}

.login-brand-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    border-radius: 1rem;
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-offset));
    color: #fff;
    font-size: 2rem;
    box-shadow: 0 8px 32px rgba(91, 33, 182, .3);
    margin-bottom: 0.75rem;
}

.login-brand-name {
    font-size: var(--theme-font-size-xl);
    font-weight: 700;
    color: rgba(255, 255, 255, .9);
    letter-spacing: 0.04em;
    text-transform: uppercase;
}

/* ── Card ───────────────────────────────────────────────────────── */

.login-card {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 420px;
    margin: 0 auto;
    text-align: left;
    background: rgba(255, 255, 255, .08);
    backdrop-filter: blur(24px);
    -webkit-backdrop-filter: blur(24px);
    border: 1px solid rgba(255, 255, 255, .12);
    border-radius: calc(var(--theme-radius) + 0.25rem);
    box-shadow:
        0 8px 32px rgba(0, 0, 0, .4),
        inset 0 0 0 1px rgba(255, 255, 255, .06);
    overflow: hidden;
}

/* ── Card header ────────────────────────────────────────────────── */

.login-header {
    text-align: center;
    padding: 2rem 2rem 1.25rem;
    border-bottom: 1px solid rgba(255, 255, 255, .08);
}

.login-title {
    color: rgba(255, 255, 255, .95);
    font-weight: 700;
    font-size: var(--theme-font-size-2xl);
    margin-bottom: 0.25rem;
}

.login-subtitle {
    color: rgba(255, 255, 255, .5);
    font-size: var(--theme-font-size-sm);
    margin: 0;
}

/* ── Card body ──────────────────────────────────────────────────── */

.login-body {
    padding: 1.75rem 2rem 2rem;
}

.login-step-heading {
    color: rgba(255, 255, 255, .6);
    font-weight: 500;
    font-size: var(--theme-font-size-sm);
    margin-bottom: 1.25rem;
}

/* ── Form fields — must win over wf.css .form-control ───────────── */

.login-body .form-label {
    color: rgba(255, 255, 255, .7);
    font-size: var(--theme-font-size-sm);
    font-weight: 500;
}

.login-body .form-control,
.login-body .form-select {
    background-color: rgba(255, 255, 255, .08) !important;
    border: 1px solid rgba(255, 255, 255, .15) !important;
    color: rgba(255, 255, 255, .95) !important;
    padding: 0.65rem 0.875rem;
    font-size: var(--theme-font-size-base);
    border-radius: var(--theme-radius-button);
}

.login-body .form-control::placeholder {
    color: rgba(255, 255, 255, .3) !important;
}

.login-body .form-control:focus,
.login-body .form-select:focus {
    background-color: rgba(255, 255, 255, .12) !important;
    border-color: var(--theme-primary) !important;
    box-shadow: 0 0 0 3px rgba(var(--theme-primary-rgb), .3) !important;
    color: rgba(255, 255, 255, .95) !important;
    outline: none;
}

/* ── Primary button ─────────────────────────────────────────────── */

.login-btn {
    padding: 0.7rem 1rem;
    font-weight: 600;
    font-size: var(--theme-font-size-base);
    background: linear-gradient(135deg, var(--theme-primary), var(--theme-primary-hover)) !important;
    border: none !important;
    border-radius: var(--theme-radius-button);
    color: var(--theme-text-on-primary) !important;
    box-shadow: 0 4px 14px rgba(var(--theme-primary-rgb), .4);
    transition: transform 100ms ease, box-shadow 150ms ease;
}

.login-btn:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 6px 20px rgba(var(--theme-primary-rgb), .5);
}

.login-btn:active:not(:disabled) {
    transform: translateY(0);
}

/* ── Back link ──────────────────────────────────────────────────── */

.login-back-link {
    color: rgba(255, 255, 255, .5) !important;
    text-decoration: none !important;
    font-size: var(--theme-font-size-sm);
}

.login-back-link:hover {
    color: rgba(255, 255, 255, .8) !important;
}

/* ── List group (2FA contacts, tenant selection) ────────────────── */

.login-body .list-group-item {
    background: rgba(255, 255, 255, .06) !important;
    border: 1px solid rgba(255, 255, 255, .10) !important;
    color: rgba(255, 255, 255, .8) !important;
}

.login-body .list-group-item:hover:not(:disabled) {
    background: rgba(255, 255, 255, .10) !important;
    border-color: rgba(255, 255, 255, .18) !important;
    color: rgba(255, 255, 255, .95) !important;
}

.login-body .list-group-item.active {
    background: rgba(var(--theme-primary-rgb), .2) !important;
    border-color: var(--theme-primary) !important;
    color: rgba(255, 255, 255, .95) !important;
}

/* ── Alert ──────────────────────────────────────────────────────── */

.login-body .alert-danger {
    background: rgba(220, 38, 38, .15) !important;
    border-color: rgba(220, 38, 38, .25) !important;
    color: #fca5a5 !important;
}

/* ── Helper text ────────────────────────────────────────────────── */

.login-body .text-secondary-wf {
    color: rgba(255, 255, 255, .5) !important;
}

/* ── Code entry monospace ───────────────────────────────────────── */

.login-body .font-monospace {
    font-family: var(--theme-font-mono);
}

/* ── Card footer ────────────────────────────────────────────────── */

.login-footer {
    text-align: center;
    padding: 0.75rem;
    border-top: 1px solid rgba(255, 255, 255, .08);
    color: rgba(255, 255, 255, .35);
    font-size: var(--theme-font-size-xs);
}

/* ── Spinner override for dark bg ───────────────────────────────── */

.login-body .spinner-border {
    border-color: rgba(255, 255, 255, .3);
    border-right-color: transparent;
}

/* ── Validation messages ────────────────────────────────────────── */

.login-body .validation-message {
    color: #fca5a5;
    font-size: var(--theme-font-size-xs);
    margin-top: 0.25rem;
}

/* ── Check badge (selected contact/tenant) ──────────────────────── */

.login-check-badge {
    background-color: var(--theme-primary) !important;
    color: var(--theme-text-on-primary);
}

/* ── Badge (locked tenant) ──────────────────────────────────────── */

.login-body .badge.bg-danger {
    background: rgba(220, 38, 38, .25) !important;
    color: #fca5a5;
}

/* ── Mobile ─────────────────────────────────────────────────────── */

@media (max-width: 480px) {
    .login-wrapper {
        padding: 3vh 0.75rem 1.5rem;
    }
    .login-card {
        max-width: 100%;
    }
    .login-body {
        padding: 1.25rem 1.25rem 1.5rem;
    }
    .login-header {
        padding: 1.5rem 1.25rem 1rem;
    }
    .login-brand-icon {
        width: 3rem;
        height: 3rem;
        font-size: 1.5rem;
    }
    .login-brand-name {
        font-size: var(--theme-font-size-lg);
    }
}
