/* ============================================================
   落叶云平台 - 认证页面统一样式 (登录 / 注册 / 找回密码)
   企业极简风格 · 移动PC双端适配
   ============================================================ */

/* ---------- CSS Variables ---------- */
:root {
    --auth-primary: #2563eb;
    --auth-primary-hover: #1d4ed8;
    --auth-primary-light: #eff6ff;
    --auth-success: #16a34a;
    --auth-success-light: #f0fdf4;
    --auth-warning: #ea580c;
    --auth-warning-light: #fff7ed;
    --auth-danger: #dc2626;
    --auth-danger-light: #fef2f2;
    --auth-text: #0f172a;
    --auth-text-secondary: #64748b;
    --auth-text-muted: #94a3b8;
    --auth-bg: #f1f5f9;
    --auth-card-bg: #ffffff;
    --auth-border: #e2e8f0;
    --auth-border-focus: #93c5fd;
    --auth-radius: 12px;
    --auth-radius-sm: 8px;
    --auth-radius-xs: 6px;
    --auth-shadow: 0 1px 3px 0 rgb(0 0 0 / .04), 0 1px 2px -1px rgb(0 0 0 / .04);
    --auth-shadow-lg: 0 20px 60px -12px rgb(0 0 0 / .08), 0 4px 12px -4px rgb(0 0 0 / .04);
    --auth-transition: 160ms cubic-bezier(.4, 0, .2, 1);
    --auth-font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC", "Microsoft YaHei", "Helvetica Neue", sans-serif;
}

/* ---------- Reset & Base ---------- */
*, *::before, *::after { margin: 0; padding: 0; box-sizing: border-box; }

html { -webkit-text-size-adjust: 100%; }

body {
    font-family: var(--auth-font);
    background-color: var(--auth-bg);
    color: var(--auth-text);
    line-height: 1.6;
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* ---------- Layout ---------- */
.auth-wrapper { width: 100%; max-width: 420px; }

.auth-card {
    background: var(--auth-card-bg);
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius);
    padding: 40px 36px;
    box-shadow: var(--auth-shadow-lg);
}

/* ---------- Header ---------- */
.auth-header { text-align: center; margin-bottom: 32px; }

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 12px;
    text-decoration: none;
}

.auth-logo svg { flex-shrink: 0; }

.auth-logo-text {
    font-size: 22px;
    font-weight: 700;
    color: var(--auth-text);
    letter-spacing: -.02em;
}

.auth-subtitle {
    font-size: 14px;
    color: var(--auth-text-secondary);
    font-weight: 400;
}

/* ---------- Alert / Message ---------- */
.auth-alert {
    border-radius: var(--auth-radius-xs);
    padding: 12px 16px;
    margin-bottom: 20px;
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 13px;
    line-height: 1.5;
}

.auth-alert svg { flex-shrink: 0; margin-top: 1px; }

.auth-alert-error {
    background: var(--auth-danger-light);
    color: #991b1b;
    border: 1px solid #fecaca;
}

.auth-alert-success {
    background: var(--auth-success-light);
    color: #166534;
    border: 1px solid #bbf7d0;
}

.auth-alert-info {
    background: var(--auth-primary-light);
    color: #1e40af;
    border: 1px solid #bfdbfe;
}

.auth-alert-warning {
    background: var(--auth-warning-light);
    color: #9a3412;
    border: 1px solid #fed7aa;
}

/* ---------- Invite Card ---------- */
.auth-invite-card {
    background: var(--auth-success-light);
    border: 1px solid #bbf7d0;
    border-radius: var(--auth-radius-xs);
    padding: 14px 16px;
    margin-bottom: 20px;
}

.auth-invite-title {
    font-size: 13px;
    font-weight: 600;
    color: #166534;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.auth-invite-body { font-size: 12px; color: var(--auth-text-secondary); line-height: 1.5; }

.auth-invite-body strong { color: var(--auth-text); }

.auth-invite-badge {
    display: inline-block;
    background: #16a34a;
    color: #fff;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 600;
}

.auth-invite-rewards {
    display: flex;
    gap: 16px;
    margin-top: 8px;
    font-size: 11px;
    color: var(--auth-text-secondary);
}

.auth-invite-rewards span { display: inline-flex; align-items: center; gap: 4px; }

/* ---------- Ban Alert ---------- */
.auth-ban-alert {
    background: var(--auth-warning-light);
    border: 1px solid #fed7aa;
    border-radius: var(--auth-radius-xs);
    padding: 16px;
    margin-bottom: 20px;
}

.auth-ban-header {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 13px;
    font-weight: 600;
    color: #9a3412;
    margin-bottom: 8px;
}

.auth-ban-body { font-size: 12px; color: var(--auth-text-secondary); line-height: 1.5; }

.auth-ban-countdown {
    font-size: 11px;
    color: var(--auth-danger);
    font-weight: 600;
    margin-top: 8px;
    display: flex;
    align-items: center;
    gap: 4px;
}

/* ---------- Form ---------- */
.auth-form { display: flex; flex-direction: column; gap: 18px; }

.auth-field { display: flex; flex-direction: column; gap: 6px; }

.auth-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-text);
    display: flex;
    align-items: center;
    gap: 4px;
}

.auth-label-optional { font-weight: 400; color: var(--auth-text-muted); font-size: 12px; }

.auth-input-wrap { position: relative; }

.auth-input-icon {
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    pointer-events: none;
    color: var(--auth-text-muted);
    display: flex;
}

.auth-input {
    width: 100%;
    padding: 11px 14px 11px 42px;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-xs);
    font-size: 14px;
    font-family: var(--auth-font);
    color: var(--auth-text);
    background: var(--auth-card-bg);
    transition: var(--auth-transition);
    appearance: none;
    -webkit-appearance: none;
}

.auth-input::placeholder { color: var(--auth-text-muted); }

.auth-input:focus {
    outline: none;
    border-color: var(--auth-primary);
    box-shadow: 0 0 0 3px rgb(37 99 235 / .08);
}

.auth-input.error { border-color: var(--auth-danger); }
.auth-input.error:focus { box-shadow: 0 0 0 3px rgb(220 38 38 / .08); }

/* Input with right-side action */
.auth-input-has-right { padding-right: 100px; }

.auth-input-right-action {
    position: absolute;
    right: 4px;
    top: 50%;
    transform: translateY(-50%);
}

/* ---------- Email verify row ---------- */
.auth-verify-row { display: flex; gap: 8px; }

.auth-verify-row .auth-input-wrap { flex: 1; }
.auth-verify-row .auth-input { padding-right: 14px; }

/* ---------- Buttons ---------- */
.auth-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    border: none;
    border-radius: var(--auth-radius-xs);
    font-size: 14px;
    font-weight: 600;
    font-family: var(--auth-font);
    cursor: pointer;
    transition: var(--auth-transition);
    text-decoration: none;
    white-space: nowrap;
    user-select: none;
    -webkit-user-select: none;
}

.auth-btn:active:not(:disabled) { transform: scale(.98); }
.auth-btn:disabled { opacity: .55; cursor: not-allowed; }

.auth-btn-primary {
    background: var(--auth-primary);
    color: #fff;
    padding: 12px 20px;
    width: 100%;
    box-shadow: 0 1px 2px rgb(37 99 235 / .2);
}

.auth-btn-primary:hover:not(:disabled) {
    background: var(--auth-primary-hover);
    box-shadow: 0 4px 12px rgb(37 99 235 / .25);
}

.auth-btn-sm {
    font-size: 12px;
    font-weight: 500;
    padding: 7px 14px;
    border-radius: var(--auth-radius-xs);
    background: var(--auth-primary);
    color: #fff;
    min-width: 80px;
}

.auth-btn-sm:hover:not(:disabled) { background: var(--auth-primary-hover); }

.auth-btn-outline {
    background: transparent;
    color: var(--auth-text-secondary);
    border: 1px solid var(--auth-border);
    padding: 7px 14px;
    font-size: 12px;
    font-weight: 500;
}

.auth-btn-outline:hover:not(:disabled) { background: #f8fafc; }

.auth-btn-ghost {
    background: transparent;
    color: var(--auth-text-muted);
    padding: 4px 8px;
    font-size: 12px;
}

.auth-btn-ghost:hover:not(:disabled) { color: var(--auth-text-secondary); }

/* ---------- Password Toggle ---------- */
.auth-pw-toggle {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    padding: 6px;
    display: flex;
    align-items: center;
    border-radius: 4px;
    transition: color .15s;
}

.auth-pw-toggle:hover { color: var(--auth-text-secondary); }

/* ---------- Form Options Row ---------- */
.auth-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: -2px;
}

.auth-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    font-size: 13px;
    color: var(--auth-text-secondary);
    user-select: none;
}

.auth-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-primary);
    cursor: pointer;
    margin: 0;
}

.auth-link {
    font-size: 13px;
    color: var(--auth-primary);
    text-decoration: none;
    font-weight: 500;
    transition: color .15s;
}

.auth-link:hover { color: var(--auth-primary-hover); }

/* ---------- Remember Login Box ---------- */
.auth-remember-box {
    background: #f8fafc;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-xs);
    padding: 14px 16px;
}

.auth-remember-box .auth-checkbox { align-items: flex-start; }

.auth-remember-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--auth-text);
    margin-bottom: 2px;
}

.auth-remember-hint {
    font-size: 11px;
    color: var(--auth-text-muted);
}

/* ---------- Terms Agreement ---------- */
.auth-terms-box {
    background: #f8fafc;
    border: 1px solid var(--auth-border);
    border-radius: var(--auth-radius-xs);
    padding: 14px 16px;
}

.auth-terms-checkbox {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    cursor: pointer;
}

.auth-terms-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    accent-color: var(--auth-primary);
    cursor: pointer;
    margin-top: 1px;
}

.auth-terms-text { font-size: 12px; color: var(--auth-text-secondary); line-height: 1.5; }

/* ---------- Security Tips ---------- */
.auth-tips {
    background: #fffbeb;
    border: 1px solid #fde68a;
    border-radius: var(--auth-radius-xs);
    padding: 14px 16px;
    margin-top: 4px;
}

.auth-tips-title {
    font-size: 12px;
    font-weight: 600;
    color: #92400e;
    display: flex;
    align-items: center;
    gap: 6px;
    margin-bottom: 6px;
}

.auth-tips-list { font-size: 11px; color: var(--auth-text-secondary); line-height: 1.7; padding-left: 16px; }

.auth-tips-list li { margin-bottom: 2px; }

/* ---------- Footer ---------- */
.auth-footer { text-align: center; margin-top: 24px; }

.auth-footer p { font-size: 13px; color: var(--auth-text-secondary); }

/* ---------- Step Indicator (找回密码) ---------- */
.auth-steps {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 32px;
    position: relative;
}

.auth-step {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    z-index: 2;
}

.auth-step-circle {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: #f1f5f9;
    color: var(--auth-text-muted);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 14px;
    font-weight: 700;
    transition: all .25s;
    border: 2px solid transparent;
}

.auth-step.active .auth-step-circle {
    background: var(--auth-primary);
    color: #fff;
    border-color: var(--auth-primary);
    box-shadow: 0 4px 12px rgb(37 99 235 / .25);
}

.auth-step.completed .auth-step-circle {
    background: var(--auth-success);
    color: #fff;
    border-color: var(--auth-success);
}

.auth-step-label {
    font-size: 12px;
    font-weight: 500;
    color: var(--auth-text-muted);
    transition: color .25s;
}

.auth-step.active .auth-step-label { color: var(--auth-primary); font-weight: 600; }
.auth-step.completed .auth-step-label { color: var(--auth-success); }

.auth-steps-line {
    position: absolute;
    top: 18px;
    left: calc(16.67% + 18px);
    right: calc(16.67% + 18px);
    height: 2px;
    background: #e2e8f0;
    z-index: 1;
    transition: background .3s;
}

.auth-steps-line.completed { background: var(--auth-success); }

/* Step Content */
.auth-step-content { display: none; }

.auth-step-content.active {
    display: block;
    animation: authFadeSlide .35s ease;
}

@keyframes authFadeSlide {
    from { opacity: 0; transform: translateY(8px); }
    to   { opacity: 1; transform: translateY(0); }
}

.auth-step-desc { text-align: center; color: var(--auth-text-secondary); font-size: 14px; margin-bottom: 24px; line-height: 1.5; }

/* ---------- Password Strength ---------- */
.auth-pw-strength {
    height: 4px;
    background: #f1f5f9;
    border-radius: 2px;
    overflow: hidden;
    margin-top: 2px;
}

.auth-pw-strength-bar {
    height: 100%;
    width: 0;
    transition: width .3s ease, background .3s ease;
    border-radius: 2px;
}

.auth-pw-strength-weak { background: var(--auth-danger); }
.auth-pw-strength-medium { background: var(--auth-warning); }
.auth-pw-strength-strong { background: var(--auth-success); }

.auth-pw-hint { font-size: 11px; color: var(--auth-text-muted); margin-top: 2px; min-height: 17px; }

/* ---------- Toast ---------- */
.auth-toast {
    position: fixed;
    bottom: 32px;
    left: 50%;
    transform: translateX(-50%) translateY(24px);
    padding: 10px 24px;
    border-radius: 8px;
    font-size: 13px;
    font-weight: 500;
    color: #fff;
    opacity: 0;
    pointer-events: none;
    transition: all .3s;
    z-index: 9999;
    white-space: nowrap;
    max-width: calc(100vw - 32px);
    text-align: center;
    box-shadow: 0 8px 24px rgb(0 0 0 / .15);
}

.auth-toast.show { opacity: 1; transform: translateX(-50%) translateY(0); pointer-events: auto; }
.auth-toast-success { background: var(--auth-success); }
.auth-toast-error { background: var(--auth-danger); }
.auth-toast-info { background: var(--auth-primary); }

/* ---------- Modal (服务条款) ---------- */
.auth-modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgb(15 23 42 / .5);
    backdrop-filter: blur(2px);
    z-index: 1000;
    align-items: center;
    justify-content: center;
    padding: 20px;
}

.auth-modal-overlay.show { display: flex; }

.auth-modal {
    background: var(--auth-card-bg);
    border-radius: var(--auth-radius);
    max-width: 480px;
    width: 100%;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
    box-shadow: 0 25px 80px rgb(0 0 0 / .15);
}

.auth-modal-header {
    padding: 20px 24px;
    border-bottom: 1px solid var(--auth-border);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.auth-modal-title { font-size: 16px; font-weight: 600; }

.auth-modal-close {
    background: none;
    border: none;
    color: var(--auth-text-muted);
    cursor: pointer;
    padding: 4px;
    border-radius: 4px;
    display: flex;
    transition: color .15s;
}

.auth-modal-close:hover { color: var(--auth-text); }

.auth-modal-body {
    padding: 24px;
    overflow-y: auto;
    flex: 1;
}

.auth-modal-section { margin-bottom: 20px; }
.auth-modal-section:last-child { margin-bottom: 0; }

.auth-modal-section-title {
    font-size: 13px;
    font-weight: 600;
    margin-bottom: 8px;
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-modal-section-body p {
    font-size: 12px;
    color: var(--auth-text-secondary);
    line-height: 1.7;
}

.auth-modal-footer {
    padding: 16px 24px;
    border-top: 1px solid var(--auth-border);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

/* ---------- Loading Spinner ---------- */
.auth-spinner {
    display: inline-block;
    width: 18px;
    height: 18px;
    border: 2.5px solid rgb(255 255 255 / .25);
    border-radius: 50%;
    border-top-color: #fff;
    animation: authSpin .6s linear infinite;
}

@keyframes authSpin { to { transform: rotate(360deg); } }

/* Shake animation for error */
.auth-shake { animation: authShake .4s ease; }

@keyframes authShake {
    0%, 100% { transform: translateX(0); }
    20% { transform: translateX(-6px); }
    40% { transform: translateX(6px); }
    60% { transform: translateX(-4px); }
    80% { transform: translateX(4px); }
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
    body { padding: 16px 12px; }

    .auth-card { padding: 28px 20px; border-radius: var(--auth-radius-sm); }

    .auth-logo-text { font-size: 20px; }

    .auth-subtitle { font-size: 13px; }

    .auth-input { padding: 10px 12px 10px 38px; font-size: 16px; }
    .auth-input-icon { left: 12px; }

    .auth-btn { font-size: 13px; }
    .auth-btn-primary { padding: 13px 20px; }

    .auth-verify-row { flex-direction: column; }

    .auth-options { flex-direction: column; align-items: flex-start; gap: 10px; }

    .auth-invite-rewards { flex-direction: column; gap: 4px; }

    .auth-modal-overlay { padding: 12px; }
    .auth-modal-header { padding: 16px 20px; }
    .auth-modal-body { padding: 20px; }
    .auth-modal-footer { padding: 14px 20px; }

    .auth-steps-line { left: calc(16.67% + 16px); right: calc(16.67% + 16px); }
    .auth-step-circle { width: 32px; height: 32px; font-size: 13px; }
    .auth-step-label { font-size: 11px; }
}

/* ---------- Reduced Motion ---------- */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
