/* b2b-auth.css — B2B Portal Authentication */

/* ─── Spinner Overlay (protected pages only) ──────────────────────────────── *
 * Shown briefly while auth state is being checked.
 * Removed immediately once auth is confirmed.
 * Replaced by redirect to login.html if auth fails.
 * ─────────────────────────────────────────────────────────────────────────── */

.b2b-spinner-overlay {
    position: fixed;
    inset: 0;
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f8fafc;   /* White — hides page content during auth check */
}

/* ─── Spinner ──────────────────────────────────────────────────────────────── */

.b2b-spinner {
    width: 40px;
    height: 40px;
    border: 3px solid #e2e8f0;
    border-top-color: #1A3E6F;
    border-radius: 50%;
    animation: b2b-spin 0.75s linear infinite;
}

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

/* ─── Auth Card (login page + any future modal use) ───────────────────────── *
 * Used on login.html — injected by initLoginPage() into #b2b-login-container.
 * ─────────────────────────────────────────────────────────────────────────── */

.b2b-auth-card {
    background: #ffffff;
    border-radius: 14px;
    box-shadow: 0 8px 40px rgba(0, 0, 0, 0.22);
    width: 100%;
    padding: 40px 44px;
    box-sizing: border-box;
}

@media (max-width: 520px) {
    .b2b-auth-card {
        padding: 32px 24px;
        border-radius: 10px;
    }
}

/* ─── Logo (inside card) ───────────────────────────────────────────────────── */

.b2b-auth-logo {
    display: flex;
    align-items: baseline;
    gap: 2px;
    margin-bottom: 24px;
}

.b2b-logo-ats {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #1A3E6F;
    letter-spacing: -0.5px;
}

.b2b-logo-pal {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #E2B659;
}

.b2b-logo-tag {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    font-weight: 600;
    color: #94a3b8;
    text-transform: uppercase;
    letter-spacing: 1.5px;
    margin-left: 10px;
}

/* ─── Title ────────────────────────────────────────────────────────────────── */

.b2b-auth-title {
    font-family: 'Inter', sans-serif;
    font-size: 22px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 24px;
    line-height: 1.2;
}

/* ─── Error Banner ─────────────────────────────────────────────────────────── */

.b2b-auth-error {
    background: #fef2f2;
    border: 1px solid #fca5a5;
    border-radius: 8px;
    padding: 12px 14px;
    font-size: 14px;
    color: #b91c1c;
    margin-bottom: 18px;
    font-family: 'Inter', sans-serif;
    line-height: 1.4;
}

/* ─── Form Groups ──────────────────────────────────────────────────────────── */

.b2b-form-group {
    margin-bottom: 16px;
}

.b2b-form-row {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

@media (max-width: 480px) {
    .b2b-form-row {
        grid-template-columns: 1fr;
    }
}

.b2b-label {
    display: block;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    margin-bottom: 6px;
}

.b2b-required {
    color: #ef4444;
    margin-left: 2px;
}

.b2b-optional {
    color: #9ca3af;
    font-weight: 400;
}

.b2b-input {
    width: 100%;
    padding: 11px 14px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 14px;
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    background: #ffffff;
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    outline: none;
}

.b2b-input::placeholder {
    color: #9ca3af;
}

.b2b-input:focus {
    border-color: #1A3E6F;
    box-shadow: 0 0 0 3px rgba(26, 62, 111, 0.12);
}

/* ─── Phone Input ──────────────────────────────────────────────────────────── */

.b2b-phone-wrap {
    display: flex;
    gap: 8px;
    align-items: stretch;
}

.b2b-phone-code {
    flex-shrink: 0;
    width: 220px;
    padding: 11px 8px;
    border: 1.5px solid #d1d5db;
    border-radius: 8px;
    font-size: 13px;
    font-family: 'Inter', sans-serif;
    color: #1e293b;
    background: #ffffff;
    cursor: pointer;
    outline: none;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
    box-sizing: border-box;
}

.b2b-phone-code:focus {
    border-color: #1A3E6F;
    box-shadow: 0 0 0 3px rgba(26, 62, 111, 0.12);
}

.b2b-phone-number {
    flex: 1;
    min-width: 0;
}

@media (max-width: 480px) {
    .b2b-phone-wrap {
        flex-direction: column;
    }
    .b2b-phone-code {
        width: 100%;
    }
}

/* ─── Password Rules ────────────────────────────────────────────────────────── */

.b2b-password-rules {
    list-style: none;
    margin: 8px 0 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.b2b-rule {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #94a3b8;
    padding-left: 18px;
    position: relative;
    transition: color 0.15s ease;
}

.b2b-rule::before {
    content: '○';
    position: absolute;
    left: 0;
    font-size: 11px;
}

.b2b-rule--ok {
    color: #16a34a;
}

.b2b-rule--ok::before {
    content: '✓';
    color: #16a34a;
}

.b2b-rule--fail {
    color: #dc2626;
}

.b2b-rule--fail::before {
    content: '✗';
    color: #dc2626;
}

/* OTP input — large centered digits */
.b2b-otp-input {
    text-align: center;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: 10px;
    padding: 14px;
    color: #1A3E6F;
}

/* ─── Primary Button ───────────────────────────────────────────────────────── */

.b2b-btn-primary {
    width: 100%;
    padding: 13px 20px;
    background: #1A3E6F;
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    font-family: 'Inter', sans-serif;
    cursor: pointer;
    margin-top: 6px;
    transition: background 0.15s ease, transform 0.1s ease;
}

.b2b-btn-primary:hover:not(:disabled) {
    background: #163459;
}

.b2b-btn-primary:active:not(:disabled) {
    transform: scale(0.99);
}

.b2b-btn-primary:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* ─── Switch State Link ────────────────────────────────────────────────────── */

.b2b-auth-switch {
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    color: #64748b;
    text-align: center;
    margin: 16px 0 0;
}

.b2b-auth-switch a {
    color: #1A3E6F;
    font-weight: 600;
    text-decoration: none;
}

.b2b-auth-switch a:hover {
    text-decoration: underline;
}

/* ─── OTP Verify State ─────────────────────────────────────────────────────── */

.b2b-verify-desc {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #64748b;
    line-height: 1.6;
    margin: 0 0 20px;
}

.b2b-verify-note {
    font-family: 'Inter', sans-serif;
    font-size: 12px;
    color: #9ca3af;
    text-align: center;
    margin: 10px 0 0;
}

/* ─── Public Computer Notice ───────────────────────────────────────────────── */

.b2b-public-wrap {
    margin-top: 18px;
    padding: 12px 14px;
    background: #f8fafc;
    border: 1px solid #e2e8f0;
    border-radius: 8px;
}

.b2b-public-label {
    display: flex;
    align-items: center;
    gap: 10px;
    font-family: 'Inter', sans-serif;
    font-size: 13px;
    font-weight: 600;
    color: #374151;
    cursor: pointer;
    user-select: none;
}

.b2b-public-checkbox {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    accent-color: #1A3E6F;
    cursor: pointer;
}

.b2b-public-hint {
    font-family: 'Inter', sans-serif;
    font-size: 11px;
    color: #94a3b8;
    margin: 6px 0 0 26px;
    line-height: 1.5;
}

/* ─── Success State ────────────────────────────────────────────────────────── */

.b2b-success-box {
    text-align: center;
    padding: 16px 0 8px;
}

.b2b-success-icon {
    font-size: 44px;
    margin-bottom: 14px;
}

.b2b-success-title {
    font-family: 'Inter', sans-serif;
    font-size: 20px;
    font-weight: 700;
    color: #0f172a;
    margin: 0 0 10px;
}

.b2b-success-desc {
    font-family: 'Inter', sans-serif;
    font-size: 14px;
    color: #64748b;
    line-height: 1.7;
    margin: 0;
}
