/* 认证页容器 */

body.is-auth-page,
body.is-auth-page #appContent {
    overflow-x: clip;
}

body.is-auth-page #appContent {
    min-height: calc(100vh - var(--topnav-height, 48px));
}

.auth-container {
    display: flex;
    align-items: center;
    justify-content: center;
    flex: 1 1 auto;
    width: 100%;
    min-height: calc(100vh - var(--topnav-height, 48px));
    padding: 2.5rem 1rem;
    box-sizing: border-box;
    animation: auth-fade-in 0.3s ease-out;
}

@keyframes auth-fade-in {
    from { opacity: 0; }
    to { opacity: 1; }
}
.dark .auth-container {
    background-color: #000000;
}
.auth-panel {
    width: 100%;
    max-width: 28rem;
    margin: 0 auto;
    box-sizing: border-box;
}

#login-form,
#register-form,
#forgot-password-form {
    width: 100%;
}

#register-form.hidden,
#forgot-password-form.hidden,
#login-form.hidden,
#register-form[hidden],
#forgot-password-form[hidden],
.auth-panel .hidden {
    display: none !important;
}

.auth-panel > div {
    width: 100%;
}

.auth-input {
    width: 100%;
    padding: 0.4rem 1.25rem;
    border: 1px solid #d1d5db;
    border-radius: 0.5rem;
    font-size: 1rem;
    transition: all 0.2s;
    background: transparent;
    outline: none;
    color: inherit;
}
.auth-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.dark .auth-input {
    border-color: #4b5563;
    background-color: #222224;
    color: #fff;
}
.dark .auth-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}

.fl-wrap {
    position: relative;
}
.fl-wrap .auth-input {
    padding-top: 1.2rem;
    padding-bottom: 0.1rem;
}
.fl-label {
    position: absolute;
    left: 1.25rem;
    top: 0;
    bottom: 0;
    display: flex;
    align-items: center;
    font-size: 1rem;
    color: #6b7280;
    pointer-events: none;
    transform-origin: left center;
    transform: translateY(0) scale(1);
    transition: transform 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                font-size 0.22s cubic-bezier(0.4, 0, 0.2, 1),
                color 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    white-space: nowrap;
}
.dark .fl-label { color: #9ca3af; }

.fl-wrap .auth-input:focus ~ .fl-label,
.fl-wrap .auth-input:not(:placeholder-shown) ~ .fl-label {
    transform: translateY(-0.7rem) scale(0.72);
    color: #6b7280;
}
.dark .fl-wrap .auth-input:focus ~ .fl-label,
.dark .fl-wrap .auth-input:not(:placeholder-shown) ~ .fl-label {
    color: #9ca3af;
}

.auth-pwd-toggle {
    position: absolute;
    right: 0.75rem;
    top: 0;
    bottom: 0;
    margin-top: auto;
    margin-bottom: auto;
    width: 2.5rem;
    height: 2.5rem;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    border: none;
    background: transparent;
    cursor: pointer;
    color: #9ca3af;
    flex-shrink: 0;
    line-height: 0;
}
.auth-pwd-toggle i {
    display: block;
    width: 1.25rem;
    height: 1.25rem;
    font-size: 1.25rem;
    line-height: 1;
}
.auth-pwd-toggle:hover {
    color: #4b5563;
    background: transparent;
}
.dark .auth-pwd-toggle {
    color: #6b7280;
}
.dark .auth-pwd-toggle:hover {
    color: #d1d5db;
    background: transparent;
}

.vcode-input {
    flex: 1;
    min-width: 0;
    height: 4.5rem;
    text-align: center;
    font-size: 1.5rem;
    border: 1.5px solid #d1d5db;
    border-radius: 0.5rem;
    outline: none;
    transition: border-color 0.15s, box-shadow 0.15s;
    background: transparent;
    color: inherit;
}
.vcode-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.15);
}
.vcode-input:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    background-color: #f3f4f6;
}
.dark .vcode-input:disabled { background-color: #1a1a1c; }
.vcode-input.filled {
    border-color: #d1d5db;
}

.vcode-error .vcode-input {
    border-color: #ef4444 !important;
    background-color: #fef2f2 !important;
    box-shadow: none !important;
}
.dark .vcode-error .vcode-input {
    border-color: #f87171 !important;
    background-color: rgba(239,68,68,0.15) !important;
}

.vcode-success .vcode-input {
    border-color: #22c55e !important;
    background-color: #f0fdf4 !important;
    box-shadow: none !important;
}
.dark .vcode-success .vcode-input {
    border-color: #4ade80 !important;
    background-color: rgba(34,197,94,0.15) !important;
}
.dark .vcode-input { border-color: #4b5563; background-color: #222224; color: #d1d5db; }
.dark .vcode-input:focus {
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59,130,246,0.2);
}
.dark .vcode-input.filled { border-color: #4b5563; }
.auth-btn-primary {
    flex: 1 1 0;
    min-width: 0;
    width: auto;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.35rem;
    padding: 0.4rem 1.25rem;
    border: 1px solid transparent;
    border-radius: 0.5rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: #fff;
    background-color: #000;
    transition: background 0.2s;
    cursor: pointer;
    white-space: normal;
    line-height: 1.3;
}
.auth-btn-primary:hover { background-color: #1f2937; }
.auth-btn-primary:disabled { background-color: #9ca3af; cursor: not-allowed; }
.dark .auth-btn-primary { background-color: #fff; color: #000; }
.dark .auth-btn-primary:hover { background-color: #e5e7eb; }

.btn-blue { background-color: #0071e3 !important; color: #fff !important; }
.btn-blue:hover { background-color: #0077ed !important; }
.dark .btn-blue { background-color: #0071e3 !important; color: #fff !important; }
.dark .btn-blue:hover { background-color: #0077ed !important; }

.btn-dark { background-color: #1d1d1f !important; color: #fff !important; }
.btn-dark:hover { background-color: #3a3a3c !important; }
.dark .btn-dark { background-color: #f5f5f7 !important; color: #1d1d1f !important; }
.dark .btn-dark:hover { background-color: #e5e5ea !important; }

.auth-btn-secondary {
    width: 100%;
    padding: 0.75rem 1.5rem;
    background-color: #f3f4f6;
    color: #374151;
    font-weight: 600;
    font-size: 0.95rem;
    border-radius: 0.5rem;
    transition: background 0.2s;
    cursor: pointer;
    border: none;
    margin-bottom: 1.5rem;
}
.auth-btn-secondary:hover { background-color: #e5e7eb; }
.dark .auth-btn-secondary { background-color: #222224; color: #d1d5db; }
.dark .auth-btn-secondary:hover { background-color: #333335; }

.strength-bar-wrap {
    flex: 1;
    height: 0.5rem;
    background-color: #e5e7eb;
    border-radius: 9999px;
    overflow: hidden;
}
.dark .strength-bar-wrap { background-color: #000; }
.strength-bar { height: 100%; border-radius: 9999px; transition: all 0.3s; }
.strength-bar.strength-weak { background: #ef4444; }
.strength-bar.strength-mid { background: #eab308; }
.strength-bar.strength-strong { background: #16a34a; }
html.dark .strength-bar.strength-strong { background: #fff; }
.is-clickable { cursor: pointer; }

.auth-logo-svg path { fill: #000; transition: fill 0.2s; }
.dark .auth-logo-svg path { fill: #fff; }

.vcode-dot {
    display: inline-block;
    width: 5px;
    height: 5px;
    border-radius: 50%;
    background: #9ca3af;
    animation: vcode-bounce 0.6s ease-in-out infinite alternate;
}
.dark .vcode-dot { background: #6b7280; }
@keyframes vcode-bounce {
    from { transform: translateY(0); opacity: 0.5; }
    to   { transform: translateY(-5px); opacity: 1; }
}

#auth-toast {
    position: fixed;
    bottom: 2rem;
    left: 50%;
    transform: translateX(-50%) translateY(0.5rem);
    background: #1f2937;
    color: #fff;
    padding: 0.75rem 1.5rem;
    border-radius: 0.5rem;
    font-size: 0.9rem;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.25s ease, transform 0.25s ease;
    z-index: 8;
    white-space: nowrap;
}
#auth-toast.show {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}
.dark #auth-toast { background: #fff; color: #000; }

.auth-logo-row{display:flex;justify-content:center;margin-bottom:1.5rem;}
.auth-title{margin:0 0 2rem;font-size:1.5rem;font-weight:700;text-align:center;color:var(--fg);}
.auth-title--sm{margin-bottom:.5rem;}
.auth-title--reset{margin-bottom:2.5rem;}
.auth-alert{margin-bottom:1rem;padding:1rem;border-radius:.5rem;text-align:center;font-size:.875rem;background:var(--danger-bg);color:var(--danger);border:1px solid var(--danger);}
.auth-alert--ok{background:var(--success-bg);color:var(--success);border-color:var(--success);}
.auth-forgot{display:flex;justify-content:flex-end;}
.auth-forgot a{display:inline-flex;align-items:center;gap:.25rem;font-size:.875rem;color:var(--site-theme-color);text-decoration:none;}
.auth-privacy{display:flex;flex-direction:column;align-items:center;gap:.5rem;padding:.25rem 0;}
.auth-privacy p{margin:0;font-size:.75rem;line-height:1.6;text-align:center;color:var(--muted);}
.auth-actions{display:flex;gap:.75rem;}
.auth-actions .auth-btn-primary{flex:1;display:flex;align-items:center;justify-content:center;gap:.5rem;}
.auth-row{display:flex;gap:.5rem;}
.auth-code-row{display:flex;flex-direction:column;gap:.5rem;}
.auth-code-inputs{display:flex;gap:.5rem;width:100%;}
.auth-status{display:flex;align-items:center;justify-content:center;gap:.5rem;min-height:1.25rem;}
.auth-side-btn{flex-shrink:0;padding:0 1rem;font-size:.875rem;border:1px solid var(--border);background:transparent;color:var(--fg);border-radius:.5rem;white-space:nowrap;}
.auth-match{font-size:.875rem;color:var(--danger);}
.auth-ok-icon{font-size:3rem;margin:0 auto 1rem;color:var(--success);display:block;}
.auth-stack { display: flex; flex-direction: column; gap: 1.5rem; }
.auth-cluster { display: flex; align-items: stretch; gap: 0.75rem; }
.auth-cluster > .fl-wrap,
.auth-cluster > .auth-grow { flex: 1 1 auto; min-width: 0; }
.auth-row { display: flex; align-items: center; justify-content: space-between; gap: 0.5rem; }
.auth-end { display: flex; justify-content: flex-end; }
.auth-end a,
.auth-forgot a {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    font-size: 0.875rem;
    color: var(--site-theme-color);
    text-decoration: none;
}
.auth-hint { font-size: 0.875rem; color: var(--muted); }
.auth-hint--ok { color: var(--success); }
.auth-hint--err { color: var(--danger); }
.auth-grow { flex: 1; min-width: 0; }
.fl-wrap.auth-grow { flex: 1; }
.auth-cell-center { text-align: center; }
.auth-center { display: inline-flex; align-items: center; justify-content: center; gap: 0.35rem; }
.auth-card {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    padding: 0 1rem;
    font-size: 0.875rem;
    font-weight: 400;
    color: inherit;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
}
.auth-card:hover { background: var(--surface); }
.auth-privacy {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 0.5rem;
    padding: 0.25rem 0;
}
.auth-privacy .privacy-icon { display: block; margin: 0 auto; }
.auth-privacy p {
    margin: 0;
    font-size: 0.75rem;
    line-height: 1.6;
    text-align: center;
    color: var(--muted);
}
.auth-actions { display: flex; align-items: stretch; gap: 0.75rem; }
.auth-actions .auth-btn-primary { flex: 1 1 0; min-width: 0; }
#password-match { font-size: 0.875rem; color: var(--danger); }
#username-validation,
#password-strength-text,
#reg-vcode-msg,
#reset-vcode-msg { font-size: 0.8125rem; color: var(--muted); }
.auth-code-inputs,
#reg-vcode-row,
#reset-vcode-row { display: flex; gap: 0.5rem; width: 100%; }
.auth-status {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    min-height: 1.25rem;
}
#reg-vcode-spinner,
#reset-vcode-spinner {
    display: inline-flex;
    align-items: center;
    gap: 4px;
}
@media (max-width: 420px) {
    .auth-actions { flex-direction: column; }
    .auth-actions .auth-btn-primary { width: 100%; }
}
