/* ═══════════════════════════════════════════════════════════════
   ERP Auth Modals — transparent glass, two-panel (Skill India style)
   ═══════════════════════════════════════════════════════════════ */

.erp-auth-modal {
    --erp-glass: rgba(255, 255, 255, 0.58);
    --erp-glass-strong: rgba(255, 255, 255, 0.82);
    --erp-border: rgba(255, 255, 255, 0.55);
    --erp-text: #1e293b;
    --erp-muted: #64748b;
    --erp-accent: #2563eb;
    --erp-radius: 12px;
    --erp-radius-lg: 20px;
}

/* Dark transparent overlay like reference */
.modal-backdrop.show {
    opacity: 1 !important;
    background: rgba(15, 23, 42, 0.55) !important;
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

.erp-auth-modal {
    z-index: 1060 !important;
}

.erp-auth-modal .modal-backdrop {
    z-index: 1055 !important;
}

/* ─── Dialog shell ─────────────────────────────────────────────── */
.erp-auth-modal .erp-auth-dialog {
    max-width: 860px;
    width: calc(100% - 2rem);
    margin: 1rem auto;
}

.erp-auth-modal-content {
    border: 1px solid var(--erp-border);
    border-radius: var(--erp-radius-lg);
    overflow: hidden;
    background: var(--erp-glass);
    backdrop-filter: blur(18px) saturate(160%);
    -webkit-backdrop-filter: blur(18px) saturate(160%);
    box-shadow:
        0 24px 48px rgba(15, 23, 42, 0.18),
        inset 0 1px 0 rgba(255, 255, 255, 0.65);
}

.erp-auth-split {
    display: flex;
    min-height: 520px;
}

/* ─── Left brand panel ─────────────────────────────────────────── */
.erp-auth-brand-panel {
    flex: 0 0 38%;
    max-width: 38%;
    position: relative;
    overflow: hidden;
    background: linear-gradient(160deg, rgba(219, 234, 254, 0.85) 0%, rgba(255, 255, 255, 0.45) 55%, rgba(254, 226, 226, 0.35) 100%);
    border-right: 1px solid rgba(255, 255, 255, 0.5);
}

.erp-auth-brand-inner {
    position: relative;
    z-index: 1;
    height: 100%;
    padding: 2rem 1.75rem;
    display: flex;
    flex-direction: column;
}

.erp-auth-brand-logo {
    width: 52px;
    height: 52px;
    object-fit: contain;
    margin-bottom: 1.5rem;
}

.erp-auth-brand-welcome {
    font-size: 0.8125rem;
    color: var(--erp-muted);
    margin: 0 0 0.35rem;
    font-weight: 500;
}

.erp-auth-brand-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--erp-text);
    line-height: 1.25;
    margin: 0 0 0.75rem;
    letter-spacing: -0.02em;
}

.erp-auth-brand-cta {
    font-size: 0.75rem;
    font-weight: 800;
    letter-spacing: 0.08em;
    text-transform: uppercase;
    color: var(--erp-accent);
    margin: 0 0 1.25rem;
}

.erp-auth-brand-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 0.65rem;
}

.erp-auth-brand-list li {
    display: flex;
    align-items: center;
    gap: 0.6rem;
    font-size: 0.8125rem;
    color: var(--erp-muted);
    font-weight: 500;
}

.erp-auth-brand-list li span {
    width: 1.35rem;
    height: 1.35rem;
    border-radius: 50%;
    background: rgba(37, 99, 235, 0.15);
    color: var(--erp-accent);
    font-size: 0.7rem;
    font-weight: 800;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
}

.erp-auth-brand-blob {
    position: absolute;
    border-radius: 50%;
    pointer-events: none;
}

.erp-auth-brand-blob-1 {
    width: 180px;
    height: 180px;
    bottom: -40px;
    right: -30px;
    background: radial-gradient(circle, rgba(77, 171, 247, 0.28) 0%, transparent 70%);
}

.erp-auth-brand-blob-2 {
    width: 120px;
    height: 120px;
    top: 20%;
    left: -20px;
    background: radial-gradient(circle, rgba(139, 92, 246, 0.2) 0%, transparent 70%);
}

.erp-auth-brand-icon {
    margin-top: auto;
    font-size: 4rem;
    color: rgba(37, 99, 235, 0.15);
    align-self: center;
}

/* ─── Right form panel ─────────────────────────────────────────── */
.erp-auth-form-panel {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
    position: relative;
    background: rgba(255, 255, 255, 0.72);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.erp-auth-form-loader {
    position: absolute;
    inset: 0;
    z-index: 20;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem;
    background: rgba(255, 255, 255, 0.78);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.erp-auth-form-loader.is-visible {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.erp-auth-form-panel.is-refreshing .erp-auth-form-inner {
    filter: blur(1px);
    pointer-events: none;
    user-select: none;
}

.erp-auth-form-loader-card {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.75rem;
    padding: 1.25rem 1.5rem;
    border-radius: 14px;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(37, 99, 235, 0.12);
    box-shadow: 0 10px 28px rgba(15, 23, 42, 0.1);
    text-align: center;
}

.erp-auth-form-loader-spinner {
    width: 34px;
    height: 34px;
    border-radius: 50%;
    border: 3px solid rgba(37, 99, 235, 0.18);
    border-top-color: #2563eb;
    animation: erp-auth-spin 0.75s linear infinite;
}

.erp-auth-form-loader-text {
    margin: 0;
    font-size: 0.875rem;
    font-weight: 600;
    color: #334155;
}

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

.erp-auth-form-top {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem 0;
    min-height: 48px;
}

.erp-auth-form-top:not(:has(.erp-auth-back-btn)) {
    justify-content: flex-end;
}

.erp-auth-back-btn {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 600;
    color: var(--erp-muted);
    text-decoration: none;
    padding: 0.35rem 0.5rem;
    border-radius: 8px;
    transition: color 0.2s, background 0.2s;
}

.erp-auth-back-btn:hover {
    color: var(--erp-accent);
    background: rgba(37, 99, 235, 0.06);
}

.erp-auth-close {
    opacity: 0.6;
    margin: 0;
}

.erp-auth-close:hover {
    opacity: 1;
}

.erp-auth-form-inner {
    flex: 1;
    padding: 0.5rem 1.75rem 1.75rem;
    overflow-y: auto;
}

.erp-auth-form-heading {
    margin-bottom: 1.25rem;
}

.erp-auth-form-heading .modal-title {
    font-size: 1.35rem;
    font-weight: 800;
    color: var(--erp-text);
    margin: 0 0 0.35rem;
    letter-spacing: -0.02em;
}

.erp-auth-modal-subtitle {
    font-size: 0.875rem;
    color: var(--erp-muted);
    margin: 0;
    font-weight: 500;
}

/* ─── Form fields ──────────────────────────────────────────────── */
.erp-auth-modal .auth-field {
    margin-bottom: 1rem;
}

.erp-auth-modal .auth-label {
    display: block;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--erp-text);
    margin-bottom: 0.4rem;
}

.erp-auth-modal .auth-input,
.erp-auth-modal .math-captcha-answer-input {
    width: 100%;
    padding: 0.72rem 0.95rem;
    border: none;
    border-radius: var(--erp-radius);
    font-size: 0.9375rem;
    color: var(--erp-text);
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 8px rgba(15, 23, 42, 0.06);
    box-sizing: border-box;
    transition: box-shadow 0.2s ease, background 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
    font-weight: 500;
}

.erp-auth-modal .auth-input::placeholder,
.erp-auth-modal .math-captcha-answer-input::placeholder {
    color: #94a3b8;
}

.erp-auth-modal .auth-input:focus,
.erp-auth-modal .math-captcha-answer-input:focus {
    outline: none;
    background: #fff;
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15), 0 2px 8px rgba(15, 23, 42, 0.06);
}

.erp-auth-modal .auth-input[readonly] {
    background: rgba(248, 250, 252, 0.9);
    color: var(--erp-muted);
}

.erp-auth-modal .auth-password-wrap {
    position: relative;
}

.erp-auth-modal .auth-password-wrap .auth-input {
    padding-right: 2.75rem;
}

.erp-auth-modal .auth-password-toggle {
    position: absolute;
    right: 0.75rem;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: #94a3b8;
    cursor: pointer;
    padding: 0.25rem;
}

.erp-auth-modal .auth-form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 0.75rem;
    margin-bottom: 1rem;
    flex-wrap: wrap;
}

.erp-auth-modal .auth-checkbox-label {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.8125rem;
    color: var(--erp-muted);
    cursor: pointer;
    margin: 0;
}

.erp-auth-modal .auth-checkbox-label input,
.erp-auth-modal .auth-terms-row input {
    accent-color: var(--erp-accent);
    width: 1rem;
    height: 1rem;
}

.erp-auth-modal .auth-link {
    color: var(--erp-accent);
    text-decoration: none;
    font-size: 0.8125rem;
    font-weight: 700;
}

.erp-auth-modal .auth-link:hover {
    text-decoration: underline;
}

.erp-auth-modal .auth-terms-row {
    display: flex;
    align-items: flex-start;
    gap: 0.6rem;
    margin-bottom: 1rem;
    padding: 0.75rem;
    background: rgba(255, 255, 255, 0.45);
    border-radius: var(--erp-radius);
}

.erp-auth-modal .auth-terms-row label {
    font-size: 0.8125rem;
    color: var(--erp-muted);
    margin: 0;
    line-height: 1.45;
    cursor: pointer;
}

/* ─── Captcha ──────────────────────────────────────────────────── */
.erp-auth-modal .auth-captcha-block {
    margin-bottom: 1rem;
}

.erp-auth-modal .auth-captcha-label {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.8125rem;
    font-weight: 700;
    color: var(--erp-text);
    margin-bottom: 0.5rem;
}

.erp-auth-modal .auth-captcha-label i {
    color: var(--erp-accent);
}

.erp-auth-modal .math-captcha-box {
    display: flex;
    flex-direction: column;
    gap: 0.6rem;
}

.erp-auth-modal .math-captcha-challenge {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 0.75rem;
    padding: 0.7rem 0.95rem;
    border-radius: var(--erp-radius);
    background: linear-gradient(135deg, rgba(147, 197, 253, 0.35), rgba(196, 181, 253, 0.25));
    border: 1px solid rgba(255, 255, 255, 0.6);
}

.erp-auth-modal .math-text {
    font-size: 1.0625rem;
    font-weight: 800;
    color: var(--erp-text);
    font-family: ui-monospace, monospace;
}

.erp-auth-modal .math-captcha-refresh {
    width: 2rem;
    height: 2rem;
    border: none;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.75);
    color: var(--erp-muted);
    cursor: pointer;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.erp-auth-modal .math-captcha-refresh:hover {
    color: var(--erp-accent);
    background: #fff;
}

.erp-auth-modal .math-captcha-answer-input {
    text-align: center;
    font-weight: 700;
}

.erp-auth-modal .math-captcha-status {
    min-height: 1.15rem;
    font-size: 0.78rem;
    font-weight: 700;
    line-height: 1.35;
    padding-top: 0.15rem;
}

.erp-auth-modal .math-captcha-status.error {
    color: #c92a2a;
    background: #fff5f5;
    border: 1px solid rgba(245, 101, 101, 0.35);
    border-radius: 0.45rem;
    padding: 0.45rem 0.55rem;
}
.erp-auth-modal .math-captcha-status.success { color: #2f9e44; }

/* ─── Submit button ────────────────────────────────────────────── */
.erp-auth-modal .auth-btn-primary {
    width: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.82rem 1rem;
    border: none;
    border-radius: var(--erp-radius);
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
    color: #fff;
    font-size: 0.9375rem;
    font-weight: 700;
    cursor: pointer;
    box-shadow: 0 6px 18px rgba(37, 99, 235, 0.3);
    transition: transform 0.2s, box-shadow 0.2s;
}

.erp-auth-modal .auth-btn-primary:hover:not(:disabled) {
    transform: translateY(-1px);
    box-shadow: 0 8px 22px rgba(37, 99, 235, 0.38);
}

.erp-auth-modal .auth-btn-primary:disabled {
    background: linear-gradient(135deg, #94a3b8, #cbd5e1);
    box-shadow: none;
    cursor: not-allowed;
}

.erp-auth-modal .auth-btn-primary .submit-text,
.erp-auth-modal .auth-btn-primary .submit-loader {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.erp-auth-modal .auth-form-footer-note {
    text-align: center;
    margin-top: 0.875rem;
}

.erp-auth-modal .auth-form-footer-note p {
    font-size: 0.75rem;
    color: #94a3b8;
    margin: 0;
}

/* ─── Notifications ────────────────────────────────────────────── */
.erp-auth-modal .goi-notification-container {
    position: static;
    top: auto;
    right: auto;
    width: auto;
    max-width: none;
    z-index: auto;
    margin-bottom: 0.85rem;
}

.erp-auth-modal .goi-notification-container:empty {
    margin-bottom: 0;
}

.erp-auth-modal .goi-alert {
    padding: 0.8rem 0.95rem;
    border-radius: var(--erp-radius);
    font-size: 0.8125rem;
    display: flex;
    align-items: flex-start;
    gap: 0.65rem;
    margin-bottom: 0;
    background: rgba(255, 255, 255, 0.92);
    border: 1px solid rgba(255, 255, 255, 0.7);
    box-shadow: 0 4px 14px rgba(15, 23, 42, 0.08);
    position: relative;
    overflow: visible;
}

.erp-auth-modal .goi-alert::after {
    display: none;
}

.erp-auth-modal .erp-auth-toast-body {
    flex: 1;
    min-width: 0;
}

.erp-auth-modal .erp-auth-toast-title {
    display: block;
    font-size: 0.78rem;
    font-weight: 800;
    letter-spacing: 0.02em;
    margin-bottom: 0.15rem;
}

.erp-auth-modal .erp-auth-toast-message {
    display: block;
    line-height: 1.45;
    font-weight: 600;
}

.erp-auth-modal .erp-auth-toast-close {
    flex-shrink: 0;
    border: none;
    background: transparent;
    color: inherit;
    opacity: 0.65;
    padding: 0.1rem;
    line-height: 1;
    cursor: pointer;
}

.erp-auth-modal .erp-auth-toast-close:hover {
    opacity: 1;
}

.erp-auth-modal .erp-auth-toast.erp-auth-toast-hide {
    opacity: 0;
    transform: translateY(-4px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.erp-auth-modal .goi-alert-success {
    color: #2b8a3e;
    border-color: rgba(72, 187, 120, 0.35);
    background: #f0fff4;
}

.erp-auth-modal .goi-alert-error {
    color: #c92a2a;
    border-color: rgba(245, 101, 101, 0.45);
    background: #fff5f5;
}

.erp-auth-modal .goi-alert-warning {
    color: #e67700;
    border-color: rgba(255, 193, 7, 0.45);
    background: #fff9db;
}

.erp-auth-modal .goi-alert-info {
    color: #1864ab;
    border-color: rgba(77, 171, 247, 0.35);
    background: #e7f5ff;
}

/* ─── Password strength ────────────────────────────────────────── */
.erp-auth-modal .auth-password-strength {
    margin: -0.25rem 0 1rem;
}

.erp-auth-modal .goi-strength-bar {
    height: 4px;
    background: rgba(255, 255, 255, 0.6);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 0.25rem;
}

.erp-auth-modal .goi-strength-fill {
    height: 100%;
    transition: width 0.3s;
}

.erp-auth-modal .goi-strength-weak .goi-strength-fill { width: 25%; background: #e03131; }
.erp-auth-modal .goi-strength-fair .goi-strength-fill { width: 50%; background: #f59f00; }
.erp-auth-modal .goi-strength-good .goi-strength-fill { width: 75%; background: #4dabf7; }
.erp-auth-modal .goi-strength-strong .goi-strength-fill { width: 100%; background: #2f9e44; }

.erp-auth-modal .goi-strength-text {
    font-size: 0.75rem;
    color: var(--erp-muted);
}

/* ─── OTP digit boxes (Skill India style) ─────────────────────── */
.erp-auth-modal .auth-label-center {
    text-align: center;
}

.erp-otp-boxes {
    display: flex;
    justify-content: center;
    gap: 0.5rem;
    margin-bottom: 0.25rem;
}

.erp-otp-digit {
    width: 2.75rem;
    height: 3rem;
    text-align: center;
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--erp-text);
    border: 1.5px solid rgba(148, 163, 184, 0.45);
    border-radius: 10px;
    background: rgba(255, 255, 255, 0.92);
    box-shadow: 0 2px 6px rgba(15, 23, 42, 0.05);
    transition: border-color 0.2s, box-shadow 0.2s;
    -webkit-appearance: none;
    appearance: none;
    padding: 0;
}

.erp-otp-digit:focus {
    outline: none;
    border-color: var(--erp-accent);
    box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.15);
    background: #fff;
}

.erp-otp-digit.error {
    border-color: #e03131;
}

.erp-auth-alt-action {
    text-align: center;
    margin-top: 1rem;
}

.erp-auth-modal .auth-link-button {
    background: none;
    border: none;
    cursor: pointer;
    padding: 0.35rem 0.5rem;
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
}

.erp-auth-modal .auth-link-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

@media (max-width: 575.98px) {
    .erp-otp-digit {
        width: 2.35rem;
        height: 2.65rem;
        font-size: 1.1rem;
    }

    .erp-otp-boxes {
        gap: 0.35rem;
    }
}

/* Terms modal stacks above login */
.erp-auth-terms-modal {
    z-index: 1070 !important;
}

.erp-auth-terms-modal.show ~ .modal-backdrop,
body.modal-open .modal-backdrop.show ~ .modal-backdrop {
    z-index: 1065 !important;
}

.erp-auth-terms-modal .erp-auth-terms-content {
    background: rgba(255, 255, 255, 0.92);
    backdrop-filter: blur(16px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    border-radius: var(--erp-radius-lg);
    box-shadow: 0 20px 40px rgba(15, 23, 42, 0.15);
}

/* ─── Mobile: stack panels ─────────────────────────────────────── */
@media (max-width: 767.98px) {
    .erp-auth-modal .erp-auth-dialog {
        max-width: calc(100% - 1rem);
    }

    .erp-auth-split {
        flex-direction: column;
        min-height: auto;
    }

    .erp-auth-brand-panel {
        flex: none;
        max-width: 100%;
        min-height: 140px;
        border-right: none;
        border-bottom: 1px solid rgba(255, 255, 255, 0.5);
    }

    .erp-auth-brand-inner {
        padding: 1.25rem;
    }

    .erp-auth-brand-title {
        font-size: 1.1rem;
    }

    .erp-auth-brand-list,
    .erp-auth-brand-icon {
        display: none;
    }

    .erp-auth-form-inner {
        padding: 0.5rem 1.25rem 1.25rem;
    }

    .erp-auth-modal .auth-form-options {
        flex-direction: column;
        align-items: flex-start;
    }
}

@media (min-width: 768px) {
    .erp-auth-form-top .erp-auth-back-btn:only-child {
        margin-right: auto;
    }
}

/* Hide legacy panels */
.erp-auth-steps,
.erp-auth-tips,
.erp-auth-modal .auth-back-link {
    display: none;
}
