/* =========================================================================
   ChatMMM V2 — Auth screens (login, register, forgot password, reset)
   Standalone full-page experience. NO sidebar, NO topbar.
   Uses the V2 design tokens; everything else is local BEM (.cmm-auth__*).
   ========================================================================= */

/* Defensive: if someone drops the shell partials in by accident, hide them. */
body[data-cmm-page="auth"] .cmm-sidebar,
body[data-cmm-page="auth"] .cmm-topbar,
body[data-cmm-page="auth"] .cmm-shell__header { display: none !important; }

body[data-cmm-page="auth"] {
    min-height: 100vh;
    margin: 0;
    background:
        radial-gradient(ellipse at top left, rgba(124, 58, 237, 0.18), transparent 55%),
        radial-gradient(ellipse at bottom right, rgba(59, 130, 246, 0.14), transparent 60%),
        var(--cmm-bg, #0b0d12);
    color: var(--cmm-text, #e7e9ee);
    font-family: 'Inter', system-ui, -apple-system, sans-serif;
    display: flex;
    flex-direction: column;
}

/* Light theme override */
:root[data-theme="light"] body[data-cmm-page="auth"],
.theme-light body[data-cmm-page="auth"] {
    background:
        radial-gradient(ellipse at top left, rgba(124, 58, 237, 0.10), transparent 55%),
        radial-gradient(ellipse at bottom right, rgba(59, 130, 246, 0.08), transparent 60%),
        var(--cmm-bg, #f7f8fb);
}

.cmm-auth {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 24px 16px 48px;
    box-sizing: border-box;
}

.cmm-auth__brand {
    display: inline-flex;
    align-items: center;
    gap: 12px;
    margin: 8px 0 28px;
    text-decoration: none;
    color: inherit;
}
.cmm-auth__brand-mark {
    width: 40px; height: 40px;
    display: grid; place-items: center;
    background: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
    color: #fff;
    border-radius: 12px;
    font-weight: 800;
    font-size: 18px;
    box-shadow: 0 6px 20px rgba(124, 58, 237, 0.35);
}
.cmm-auth__brand-name {
    font-size: 22px;
    font-weight: 700;
    letter-spacing: -0.01em;
}

.cmm-auth__card {
    width: 100%;
    max-width: 460px;
    background: var(--cmm-surface, rgba(20, 22, 30, 0.7));
    backdrop-filter: blur(20px) saturate(140%);
    -webkit-backdrop-filter: blur(20px) saturate(140%);
    border: 1px solid var(--cmm-border, rgba(255, 255, 255, 0.08));
    border-radius: 18px;
    padding: 28px 28px 24px;
    box-shadow: 0 24px 60px rgba(0, 0, 0, 0.35);
}
:root[data-theme="light"] .cmm-auth__card,
.theme-light .cmm-auth__card {
    background: rgba(255, 255, 255, 0.85);
    border-color: rgba(0, 0, 0, 0.06);
    box-shadow: 0 24px 60px rgba(15, 23, 42, 0.08);
}

.cmm-auth__title {
    margin: 0 0 6px;
    font-size: 26px;
    font-weight: 700;
    letter-spacing: -0.02em;
}
.cmm-auth__subtitle {
    margin: 0 0 22px;
    font-size: 14px;
    color: var(--cmm-text-muted, #8b909c);
    line-height: 1.5;
}

/* OAuth buttons */
.cmm-auth__oauth { display: grid; gap: 10px; margin-bottom: 18px; }
.cmm-auth__oauth-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    padding: 11px 14px;
    background: var(--cmm-surface-2, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--cmm-border, rgba(255, 255, 255, 0.1));
    border-radius: 12px;
    color: inherit;
    font: 500 14px/1 'Inter', sans-serif;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease, transform 0.05s ease;
}
.cmm-auth__oauth-btn:hover { background: var(--cmm-surface-3, rgba(255, 255, 255, 0.07)); }
.cmm-auth__oauth-btn:active { transform: scale(0.99); }
.cmm-auth__oauth-btn[disabled] { opacity: 0.55; cursor: not-allowed; }
.cmm-auth__oauth-btn svg { width: 18px; height: 18px; }
.cmm-auth__oauth-btn[data-provider="apple"] svg { fill: currentColor; }

/* Divider */
.cmm-auth__divider {
    display: flex; align-items: center; gap: 12px;
    margin: 18px 0;
    color: var(--cmm-text-muted, #8b909c);
    font-size: 12px;
    text-transform: uppercase;
    letter-spacing: 0.08em;
}
.cmm-auth__divider::before,
.cmm-auth__divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--cmm-border, rgba(255, 255, 255, 0.08));
}

/* Form */
.cmm-auth__form { display: grid; gap: 14px; }
.cmm-auth__field { display: grid; gap: 6px; }
.cmm-auth__label {
    font-size: 12px;
    font-weight: 600;
    color: var(--cmm-text-muted, #8b909c);
    letter-spacing: 0.01em;
}
.cmm-auth__input {
    width: 100%;
    box-sizing: border-box;
    padding: 11px 14px;
    background: var(--cmm-surface-2, rgba(255, 255, 255, 0.04));
    border: 1px solid var(--cmm-border, rgba(255, 255, 255, 0.10));
    border-radius: 10px;
    color: inherit;
    font: 500 14px/1.4 'Inter', sans-serif;
    transition: border-color 0.15s ease, background 0.15s ease;
}
.cmm-auth__input:focus {
    outline: none;
    border-color: var(--cmm-accent, #7c3aed);
    background: var(--cmm-surface-3, rgba(255, 255, 255, 0.07));
}
.cmm-auth__input--error { border-color: #ef4444; }
.cmm-auth__field-note {
    min-height: 14px;
    font-size: 11px;
    color: var(--cmm-text-muted, #8b909c);
}
.cmm-auth__field-note.is-success { color: #10b981; }
.cmm-auth__field-note.is-error { color: #ef4444; }
.cmm-auth__field-note.is-warn { color: #f59e0b; }

.cmm-auth__password-wrap { position: relative; }
.cmm-auth__password-toggle {
    position: absolute; right: 10px; top: 50%;
    transform: translateY(-50%);
    background: transparent;
    border: 0;
    color: var(--cmm-text-muted, #8b909c);
    cursor: pointer;
    padding: 6px;
    font-size: 14px;
}
.cmm-auth__password-toggle:hover { color: var(--cmm-text, #e7e9ee); }

/* Password strength meter */
.cmm-auth__strength {
    display: grid;
    grid-template-columns: 1fr 1fr 1fr 1fr;
    gap: 4px;
    margin-top: 6px;
}
.cmm-auth__strength-bar {
    height: 4px;
    background: var(--cmm-border, rgba(255, 255, 255, 0.1));
    border-radius: 2px;
    transition: background 0.2s ease;
}
.cmm-auth__strength--1 .cmm-auth__strength-bar:nth-child(-n+1) { background: #ef4444; }
.cmm-auth__strength--2 .cmm-auth__strength-bar:nth-child(-n+2) { background: #f59e0b; }
.cmm-auth__strength--3 .cmm-auth__strength-bar:nth-child(-n+3) { background: #84cc16; }
.cmm-auth__strength--4 .cmm-auth__strength-bar:nth-child(-n+4) { background: #10b981; }

.cmm-auth__strength-label {
    margin-top: 6px;
    font-size: 11px;
    color: var(--cmm-text-muted, #8b909c);
    min-height: 14px;
}

.cmm-auth__hints {
    display: grid;
    gap: 4px;
    margin: 8px 0 0;
    padding: 0;
    list-style: none;
    font-size: 11px;
    color: var(--cmm-text-muted, #8b909c);
}
.cmm-auth__hints li::before {
    content: '○ ';
    color: var(--cmm-text-muted, #8b909c);
}
.cmm-auth__hints li.is-met { color: #10b981; }
.cmm-auth__hints li.is-met::before { content: '✓ '; color: #10b981; }

/* Checkbox row */
.cmm-auth__check {
    display: flex; align-items: flex-start; gap: 10px;
    font-size: 13px;
    color: var(--cmm-text-muted, #8b909c);
    line-height: 1.4;
    cursor: pointer;
    user-select: none;
}
.cmm-auth__check input[type="checkbox"] {
    margin-top: 2px;
    accent-color: var(--cmm-accent, #7c3aed);
}
.cmm-auth__check a { color: var(--cmm-accent, #a78bfa); text-decoration: none; }
.cmm-auth__check a:hover { text-decoration: underline; }

.cmm-auth__row {
    display: flex; align-items: center; justify-content: space-between;
    font-size: 13px;
}
.cmm-auth__row a { color: var(--cmm-accent, #a78bfa); text-decoration: none; }
.cmm-auth__row a:hover { text-decoration: underline; }

/* Captcha container */
.cmm-auth__captcha { display: flex; justify-content: center; min-height: 65px; }
.cmm-auth__captcha:empty { display: none; }

/* Submit button */
.cmm-auth__submit {
    width: 100%;
    padding: 12px 14px;
    background: linear-gradient(135deg, #7c3aed 0%, #3b82f6 100%);
    color: #fff;
    border: 0;
    border-radius: 12px;
    font: 600 14px/1 'Inter', sans-serif;
    cursor: pointer;
    transition: transform 0.05s ease, opacity 0.15s ease, box-shadow 0.15s ease;
    box-shadow: 0 8px 24px rgba(124, 58, 237, 0.28);
    margin-top: 4px;
}
.cmm-auth__submit:hover:not([disabled]) {
    box-shadow: 0 10px 28px rgba(124, 58, 237, 0.42);
}
.cmm-auth__submit:active:not([disabled]) { transform: scale(0.995); }
.cmm-auth__submit[disabled] { opacity: 0.6; cursor: not-allowed; }
.cmm-auth__submit[data-loading="true"]::after {
    content: '';
    width: 14px; height: 14px;
    border: 2px solid rgba(255, 255, 255, 0.5);
    border-top-color: #fff;
    border-radius: 50%;
    margin-left: 10px;
    vertical-align: -2px;
    display: inline-block;
    animation: cmm-auth-spin 0.7s linear infinite;
}
@keyframes cmm-auth-spin { to { transform: rotate(360deg); } }

/* Status / error / success banners */
.cmm-auth__status {
    margin: 12px 0 0;
    padding: 10px 12px;
    border-radius: 10px;
    font-size: 13px;
    display: none;
}
.cmm-auth__status.is-visible { display: block; }
.cmm-auth__status--error {
    background: rgba(239, 68, 68, 0.12);
    color: #fca5a5;
    border: 1px solid rgba(239, 68, 68, 0.25);
}
.cmm-auth__status--success {
    background: rgba(16, 185, 129, 0.12);
    color: #86efac;
    border: 1px solid rgba(16, 185, 129, 0.25);
}
.cmm-auth__status--info {
    background: rgba(59, 130, 246, 0.10);
    color: #93c5fd;
    border: 1px solid rgba(59, 130, 246, 0.25);
}

/* Footer */
.cmm-auth__footer {
    margin-top: 18px;
    text-align: center;
    font-size: 13px;
    color: var(--cmm-text-muted, #8b909c);
}
.cmm-auth__footer a {
    color: var(--cmm-accent, #a78bfa);
    text-decoration: none;
    font-weight: 600;
}
.cmm-auth__footer a:hover { text-decoration: underline; }

/* 2FA step */
.cmm-auth__step { display: none; }
.cmm-auth__step.is-active { display: block; }
.cmm-auth__code-input {
    letter-spacing: 0.4em;
    text-align: center;
    font-size: 18px;
    font-family: 'JetBrains Mono', monospace;
}

/* Backup-code link */
.cmm-auth__alt-link {
    background: transparent;
    border: 0;
    padding: 0;
    color: var(--cmm-accent, #a78bfa);
    font: 500 13px 'Inter', sans-serif;
    cursor: pointer;
    text-decoration: none;
}
.cmm-auth__alt-link:hover { text-decoration: underline; }

/* Hide-utility — progressive reveal */
.cmm-auth__hidden { display: none !important; }

@media (max-width: 520px) {
    .cmm-auth__card { padding: 22px 20px 20px; border-radius: 14px; }
    .cmm-auth__title { font-size: 22px; }
}
