/**
 * AI语音评测系统 - 注册页面样式
 * 
 * 设计风格: 简洁明快、轻量、注重留白与层次
 */

/* =============================================
   变量
   ============================================= */
:root {
    --c-brand: #3b82f6;
    --c-brand-hover: #2563eb;
    --c-brand-light: #eff6ff;
    --c-success: #10b981;
    --c-error: #ef4444;
    --c-text: #1e293b;
    --c-text-sub: #64748b;
    --c-text-hint: #94a3b8;
    --c-bg: #f1f5f9;
    --c-white: #ffffff;
    --c-border: #e2e8f0;
    --c-border-focus: #3b82f6;
    --shadow-card: 0 1px 3px rgba(0,0,0,.06), 0 4px 16px rgba(0,0,0,.06);
    --radius: 8px;
    --radius-lg: 16px;
    --transition: .2s ease;
}

/* =============================================
   重置
   ============================================= */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; -webkit-text-size-adjust: 100%; }

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC',
                 'Hiragino Sans GB', 'Microsoft YaHei', 'Helvetica Neue',
                 Helvetica, Arial, sans-serif;
    line-height: 1.5;
    color: var(--c-text);
    background: var(--c-bg);
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 24px 16px;
}

/* =============================================
   卡片容器
   ============================================= */
.register-container {
    width: 100%;
    max-width: 420px;
    background: var(--c-white);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-card);
    overflow: hidden;
    animation: fadeUp .4s ease;
}

@keyframes fadeUp {
    from { opacity: 0; transform: translateY(16px); }
    to   { opacity: 1; transform: translateY(0); }
}

/* =============================================
   头部
   ============================================= */
.register-header {
    padding: 32px 32px 24px;
    text-align: center;
}

.register-header-inner {
    display: inline-flex;
    align-items: center;
    gap: 10px;
}

.register-header-logo {
    width: 36px;
    height: 36px;
    border-radius: 8px;
    object-fit: contain;
    vertical-align: middle;
}

.register-title {
    font-size: 22px;
    font-weight: 700;
    color: var(--c-text);
}

.register-subtitle {
    font-size: 14px;
    color: var(--c-text-sub);
}

/* =============================================
   步骤指示器
   ============================================= */
.progress-steps {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 0 32px 24px;
}

.step-item {
    display: flex;
    align-items: center;
    position: relative;
}

.step-circle {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: var(--c-bg);
    border: 2px solid var(--c-border);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 13px;
    font-weight: 600;
    color: var(--c-text-hint);
    transition: var(--transition);
    position: relative;
    z-index: 2;
}

.step-item.active .step-circle {
    background: var(--c-brand);
    border-color: var(--c-brand);
    color: #fff;
}

.step-item.completed .step-circle {
    background: var(--c-success);
    border-color: var(--c-success);
    color: #fff;
}

.step-item.completed .step-circle::after {
    content: '\2713';
    font-size: 14px;
}

.step-item.completed .step-number { display: none; }

.step-line {
    width: 48px;
    height: 2px;
    background: var(--c-border);
    margin: 0 6px;
    transition: var(--transition);
}

.step-line.active { background: var(--c-brand); }

.step-label {
    position: absolute;
    bottom: -22px;
    left: 50%;
    transform: translateX(-50%);
    font-size: 11px;
    color: var(--c-text-hint);
    white-space: nowrap;
}

.step-item.active .step-label {
    color: var(--c-brand);
    font-weight: 500;
}

/* =============================================
   表单
   ============================================= */
.register-form {
    padding: 20px 32px 32px;
}

.form-group {
    margin-bottom: 20px;
    position: relative;
}

.form-label {
    display: block;
    font-size: 13px;
    font-weight: 500;
    color: var(--c-text);
    margin-bottom: 6px;
}

.form-label .required {
    color: var(--c-error);
    margin-left: 2px;
}

/* 输入框 */
.input-wrapper { position: relative; }

.form-input {
    width: 100%;
    height: 44px;
    padding: 0 14px;
    padding-left: 40px;
    font-size: 14px;
    color: var(--c-text);
    background: var(--c-white);
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    outline: none;
    transition: var(--transition);
}

.form-input::placeholder { color: var(--c-text-hint); }

.form-input:focus {
    border-color: var(--c-border-focus);
    box-shadow: 0 0 0 3px rgba(59, 130, 246, .1);
}

.form-input.error {
    border-color: var(--c-error);
    box-shadow: 0 0 0 3px rgba(239, 68, 68, .08);
}

.form-input.success {
    border-color: var(--c-success);
}

/* 图标 */
.input-icon {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--c-text-hint);
    pointer-events: none;
    transition: var(--transition);
    display: flex;
    align-items: center;
}

.form-input:focus ~ .input-icon,
.input-wrapper .form-input:focus + .input-icon { color: var(--c-brand); }

/* 密码切换 */
.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--c-text-hint);
    cursor: pointer;
    padding: 2px;
    font-size: 16px;
    line-height: 1;
    transition: var(--transition);
}

.password-toggle:hover { color: var(--c-text-sub); }

/* 错误提示 */
.form-error {
    display: none;
    font-size: 12px;
    color: var(--c-error);
    margin-top: 4px;
    padding-left: 2px;
}

.form-error.show {
    display: block;
    animation: shake .3s ease;
}

@keyframes shake {
    0%,100% { transform: translateX(0); }
    25%     { transform: translateX(-4px); }
    75%     { transform: translateX(4px); }
}

.form-success {
    display: none;
    font-size: 12px;
    color: var(--c-success);
    margin-top: 4px;
    padding-left: 2px;
}

.form-success.show { display: block; }

/* =============================================
   验证码按钮
   ============================================= */
.btn-send-code {
    width: 100%;
    height: 44px;
    padding: 0 20px;
    font-size: 14px;
    font-weight: 500;
    color: var(--c-brand);
    background: var(--c-brand-light);
    border: 1px solid transparent;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
}

.btn-send-code:hover:not(:disabled) {
    background: var(--c-brand);
    color: #fff;
}

.btn-send-code:disabled {
    opacity: .5;
    cursor: not-allowed;
}

.captcha-hint {
    font-size: 12px;
    color: var(--c-text-hint);
    margin-top: 6px;
}

/* =============================================
   复选框
   ============================================= */
.checkbox-group {
    display: flex;
    align-items: flex-start;
    gap: 8px;
    margin-bottom: 20px;
}

.checkbox-input {
    width: 16px;
    height: 16px;
    margin-top: 3px;
    cursor: pointer;
    accent-color: var(--c-brand);
    flex-shrink: 0;
}

.checkbox-label {
    font-size: 13px;
    color: var(--c-text-sub);
    line-height: 1.5;
}

.checkbox-label a {
    color: var(--c-brand);
    text-decoration: none;
}

.checkbox-label a:hover { text-decoration: underline; }

/* =============================================
   按钮
   ============================================= */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    height: 44px;
    padding: 0 24px;
    font-size: 15px;
    font-weight: 600;
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.btn-primary {
    width: 100%;
    color: #fff;
    background: var(--c-brand);
}

.btn-primary:hover:not(:disabled) {
    background: var(--c-brand-hover);
}

.btn-primary:active:not(:disabled) {
    transform: scale(.98);
}

.btn-primary:disabled {
    opacity: .6;
    cursor: not-allowed;
}

.btn-secondary {
    color: var(--c-text-sub);
    background: var(--c-bg);
}

.btn-secondary:hover { background: var(--c-border); }

/* 加载 */
.btn.loading {
    position: relative;
    color: transparent;
    pointer-events: none;
}

.btn.loading::after {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    border: 2px solid #fff;
    border-top-color: transparent;
    border-radius: 50%;
    animation: spin .6s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* =============================================
   分隔线 + 社交登录
   ============================================= */
.divider {
    display: flex;
    align-items: center;
    margin: 24px 0 20px;
    gap: 12px;
}

.divider::before,
.divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--c-border);
}

.divider span {
    font-size: 12px;
    color: var(--c-text-hint);
    white-space: nowrap;
}

.social-login {
    display: flex;
    justify-content: center;
    gap: 16px;
}

.social-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    height: 42px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    background: var(--c-white);
    color: var(--c-text);
    font-size: 14px;
    cursor: pointer;
    transition: var(--transition);
    text-decoration: none;
}

.social-btn:hover {
    border-color: #07c160;
    background: #f0fdf4;
}

.social-btn .wechat-icon {
    display: flex;
    align-items: center;
}

/* =============================================
   返回链接
   ============================================= */
.back-link {
    text-align: center;
    margin-top: 16px;
}

.back-link a {
    color: var(--c-text-hint);
    font-size: 13px;
    text-decoration: none;
    transition: var(--transition);
}

.back-link a:hover { color: var(--c-brand); }

/* =============================================
   弹窗
   ============================================= */
.modal-overlay {
    position: fixed;
    top: 0; left: 0; right: 0; bottom: 0;
    background: rgba(0,0,0,.4);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 20px;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: var(--transition);
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 100%;
    max-width: 560px;
    max-height: 80vh;
    background: var(--c-white);
    border-radius: var(--radius-lg);
    overflow: hidden;
    transform: scale(.95);
    transition: .25s ease;
}

.modal-overlay.show .modal-content { transform: scale(1); }

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--c-border);
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text);
}

.modal-close {
    width: 32px; height: 32px;
    display: flex; align-items: center; justify-content: center;
    background: none; border: none;
    font-size: 20px; color: var(--c-text-hint);
    cursor: pointer; border-radius: 6px;
    transition: var(--transition);
}

.modal-close:hover { background: var(--c-bg); color: var(--c-text); }

.modal-body {
    padding: 20px;
    overflow-y: auto;
    max-height: calc(80vh - 120px);
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 12px 20px;
    border-top: 1px solid var(--c-border);
}

.modal-footer .btn { height: 38px; font-size: 14px; }

/* 协议样式 */
.agreement-content h3 {
    font-size: 18px;
    margin-bottom: 12px;
    color: var(--c-text);
}

.agreement-content h4 {
    font-size: 15px;
    margin: 16px 0 8px;
    color: var(--c-text);
}

.agreement-content p {
    font-size: 13px;
    line-height: 1.8;
    color: var(--c-text-sub);
    margin-bottom: 6px;
}

/* =============================================
   成功页
   ============================================= */
.success-container {
    text-align: center;
    padding: 48px 32px;
}

.success-icon {
    width: 64px; height: 64px;
    margin: 0 auto 20px;
    background: var(--c-success);
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
    color: #fff;
    animation: pop .4s ease;
}

@keyframes pop {
    0%   { transform: scale(0); }
    70%  { transform: scale(1.08); }
    100% { transform: scale(1); }
}

.success-title {
    font-size: 20px;
    font-weight: 700;
    color: var(--c-text);
    margin-bottom: 8px;
}

.success-message {
    font-size: 14px;
    color: var(--c-text-sub);
    margin-bottom: 24px;
}

.success-username {
    display: inline-block;
    padding: 6px 14px;
    background: var(--c-brand-light);
    border-radius: 6px;
    font-size: 14px;
    font-weight: 500;
    color: var(--c-brand);
    margin-bottom: 24px;
}

/* =============================================
   验证码数字输入框（单数字+下划线样式）
   ============================================= */
.code-input-group {
    display: flex;
    justify-content: center;
    gap: 10px;
}

.code-digit {
    width: 44px;
    height: 52px;
    border: none;
    border-bottom: 2px solid var(--c-border);
    background: transparent;
    text-align: center;
    font-size: 24px;
    font-weight: 600;
    color: var(--c-text);
    outline: none;
    transition: var(--transition);
    caret-color: var(--c-brand);
    -webkit-appearance: none;
    -moz-appearance: textfield;
}

.code-digit::-webkit-outer-spin-button,
.code-digit::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.code-digit:focus {
    border-bottom-color: var(--c-brand);
    box-shadow: 0 2px 0 0 var(--c-brand);
}

.code-digit.filled {
    border-bottom-color: var(--c-success);
}

.code-digit.error {
    border-bottom-color: var(--c-error);
    animation: shake .3s ease;
}

/* =============================================
   拼图验证
   ============================================= */
#captcha-element { margin: 12px 0; }

/* =============================================
   消息提示
   ============================================= */
.message-toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-80px);
    padding: 10px 20px;
    background: var(--c-text);
    color: #fff;
    border-radius: 20px;
    font-size: 14px;
    box-shadow: 0 4px 12px rgba(0,0,0,.15);
    z-index: 2000;
    opacity: 0;
    transition: .25s ease;
    white-space: nowrap;
}

.message-toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

.message-toast.success { background: var(--c-success); }
.message-toast.error   { background: var(--c-error); }

/* =============================================
   微信扫码页
   ============================================= */
.wechat-qr-container {
    text-align: center;
    padding: 32px;
}

.wechat-qr-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--c-text);
    margin-bottom: 20px;
}

.wechat-qr-box {
    width: 240px;
    height: 240px;
    margin: 0 auto 20px;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    display: flex;
    align-items: center;
    justify-content: center;
    background: var(--c-bg);
}

.wechat-qr-tip {
    font-size: 13px;
    color: var(--c-text-hint);
}

/* =============================================
   响应式
   ============================================= */
@media (max-width: 768px) {
    body {
        padding: 16px 12px;
        align-items: flex-start;
        padding-top: 32px;
    }
    .register-container { max-width: 100%; }
    .register-header { padding: 24px 20px 20px; }
    .register-title { font-size: 20px; }
    .progress-steps { padding: 0 20px 20px; }
    .step-line { width: 36px; }
    .register-form { padding: 16px 20px 24px; }
    .form-input {
        height: 46px;
        font-size: 16px; /* 防止iOS缩放 */
    }
    .btn { height: 46px; }
}

@media (max-width: 380px) {
    body { padding: 8px; padding-top: 16px; }
    .register-header { padding: 20px 16px 16px; }
    .register-title { font-size: 18px; }
    .progress-steps { padding: 0 16px 16px; }
    .step-circle { width: 28px; height: 28px; font-size: 12px; }
    .step-line { width: 24px; margin: 0 3px; }
    .step-label { font-size: 10px; }
    .register-form { padding: 14px 16px 20px; }
    .form-group { margin-bottom: 16px; }
    .form-label { font-size: 12px; }
    .form-input { height: 42px; padding: 0 12px; padding-left: 36px; }
    .btn { height: 42px; font-size: 14px; }
    .success-container { padding: 36px 20px; }
    .code-input-group { gap: 6px; }
    .code-digit { width: 36px; height: 44px; font-size: 20px; }
}

/* 减少动画 */
@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: .01ms !important;
        transition-duration: .01ms !important;
    }
}
