/* ==========================================
   Token Platform - Auth Pages v2.0
   主色调: 支付宝蓝 #1677FF + 纯白
   风格: 大气科技感，无渐变
   ========================================== */

:root {
    --primary: #1677FF;
    --primary-hover: #0958D9;
    --primary-light: #E6F4FF;
    --white: #FFFFFF;
    --gray-50: #F7F8FA;
    --gray-100: #F2F3F5;
    --gray-200: #E8ECF0;
    --gray-300: #D9DDE4;
    --gray-400: #C4C9D4;
    --gray-500: #9CA3AF;
    --gray-600: #6B7280;
    --gray-700: #4B5563;
    --gray-800: #1F2937;
    --success: #00B578;
    --danger: #FF3B30;
    --transition: all 0.2s ease;
    --font: -apple-system, BlinkMacSystemFont, 'PingFang SC', 'Helvetica Neue', 'Microsoft YaHei', sans-serif;
    --radius: 6px;
    --radius-md: 8px;
    --radius-lg: 12px;
    --shadow-sm: 0 1px 2px rgba(0,0,0,0.04);
    --shadow: 0 1px 4px rgba(0,0,0,0.08);
    --shadow-md: 0 4px 12px rgba(0,0,0,0.08);
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
    font-family: var(--font);
    min-height: 100vh;
    display: flex;
    background: var(--gray-50);
    -webkit-font-smoothing: antialiased;
}

/* ===== 左侧品牌区 ===== */
.auth-brand {
    width: 40%;
    background: linear-gradient(160deg, #1677FF 0%, #0958D9 50%, #003EB3 100%);
    display: flex;
    flex-direction: column;
    justify-content: center;
    align-items: center;
    padding: 60px;
    position: relative;
    overflow: hidden;
}

/* 装饰性几何图案 */
.auth-brand::before {
    content: '';
    position: absolute;
    top: -30%;
    right: -20%;
    width: 500px;
    height: 500px;
    background: rgba(255,255,255,0.04);
    border-radius: 50%;
}

.auth-brand::after {
    content: '';
    position: absolute;
    bottom: -15%;
    left: -15%;
    width: 400px;
    height: 400px;
    background: rgba(255,255,255,0.03);
    border-radius: 50%;
}

.auth-brand-content {
    position: relative;
    z-index: 1;
    text-align: center;
    color: #fff;
    max-width: 420px;
}

.auth-brand-logo {
    width: 80px;
    height: 80px;
    background: rgba(255,255,255,0.15);
    border-radius: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto 32px;
    font-size: 36px;
    backdrop-filter: blur(8px);
    border: 1px solid rgba(255,255,255,0.1);
}

.auth-brand-logo img { width: 48px; height: 48px; }

.auth-brand-title {
    font-size: 36px;
    font-weight: 800;
    margin-bottom: 14px;
    letter-spacing: -0.5px;
}

.auth-brand-desc {
    font-size: 16px;
    opacity: 0.8;
    margin-bottom: 48px;
    line-height: 1.8;
    letter-spacing: 0.3px;
}

.auth-brand-features {
    display: flex;
    flex-direction: column;
    gap: 16px;
    text-align: left;
}

.auth-brand-feature {
    display: flex;
    align-items: center;
    gap: 14px;
    font-size: 14px;
    opacity: 0.9;
    letter-spacing: 0.2px;
}

.auth-brand-feature i {
    width: 30px;
    height: 30px;
    background: rgba(255,255,255,0.15);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 12px;
    flex-shrink: 0;
}

/* ===== 右侧表单区 ===== */
.auth-form-wrapper {
    width: 60%;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 40px;
    background: var(--white);
    position: relative;
}

/* 右侧装饰点阵 */
.auth-form-wrapper::before {
    content: '';
    position: absolute;
    top: 0; right: 0;
    width: 200px; height: 200px;
    background-image: radial-gradient(circle, #E5E7EB 1px, transparent 1px);
    background-size: 20px 20px;
    opacity: 0.5;
}
:root[data-theme="dark"] .auth-form-wrapper::before {
    background-image: radial-gradient(circle, #374151 1px, transparent 1px);
}

.auth-form-container {
    width: 100%;
    max-width: 440px;
    position: relative;
    z-index: 1;
}

.auth-form-header {
    margin-bottom: 32px;
}

.auth-form-title {
    font-size: 28px;
    font-weight: 700;
    color: var(--gray-800);
    margin-bottom: 8px;
}

.auth-form-subtitle {
    font-size: 15px;
    color: var(--gray-500);
}

.auth-form-subtitle a {
    color: var(--primary);
    font-weight: 500;
}

.auth-form-subtitle a:hover { text-decoration: underline; }

/* ===== 表单 ===== */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 18px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.form-label {
    font-size: 13px;
    font-weight: 500;
    color: var(--gray-700);
}

.form-label.required::after {
    content: '*';
    color: var(--danger);
    margin-left: 2px;
}

.form-input-wrapper {
    position: relative;
}

.form-input-wrapper > i:first-child {
    position: absolute;
    left: 12px;
    top: 50%;
    transform: translateY(-50%);
    color: var(--gray-400);
    font-size: 15px;
}

.form-control {
    width: 100%;
    height: 44px;
    padding: 0 12px 0 40px;
    border: 1px solid var(--gray-300);
    border-radius: var(--radius);
    font-size: 14px;
    color: var(--gray-800);
    transition: var(--transition);
    outline: none;
    font-family: var(--font);
    background: var(--white);
}

.form-control:focus {
    border-color: var(--primary);
    box-shadow: 0 0 0 3px var(--primary-light);
}

.form-control.error { border-color: var(--danger); }
.form-control::placeholder { color: var(--gray-400); }

.password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--gray-400);
    cursor: pointer;
    padding: 4px;
}
.password-toggle:hover { color: var(--gray-600); }

.form-error {
    font-size: 12px;
    color: var(--danger);
    display: flex;
    align-items: center;
    gap: 4px;
}

.form-hint { font-size: 12px; color: var(--gray-500); }

/* ===== 角色选择 ===== */
.role-selector {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.role-option {
    padding: 16px;
    border: 2px solid var(--gray-200);
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: var(--transition);
    text-align: center;
}
.role-option:hover { border-color: var(--gray-300); background: var(--gray-50); }
.role-option.selected { border-color: var(--primary); background: var(--primary-light); }
.role-option input { display: none; }

.role-option-icon {
    width: 44px; height: 44px;
    margin: 0 auto 8px;
    background: var(--gray-100);
    border-radius: var(--radius-md);
    display: flex; align-items: center; justify-content: center;
    font-size: 20px; color: var(--gray-500);
    transition: var(--transition);
}
.role-option.selected .role-option-icon { background: var(--primary); color: var(--white); }

.role-option-name { font-size: 14px; font-weight: 600; color: var(--gray-700); margin-bottom: 2px; }
.role-option-desc { font-size: 12px; color: var(--gray-500); }

/* ===== 复选框 ===== */
.form-check { display: flex; align-items: center; gap: 8px; }
.form-check-input { width: 16px; height: 16px; accent-color: var(--primary); cursor: pointer; }
.form-check-label { font-size: 14px; color: var(--gray-600); cursor: pointer; }
.form-check-label a { color: var(--primary); }

/* ===== 提交按钮 ===== */
.btn-submit {
    width: 100%;
    padding: 14px;
    font-size: 15px;
    font-weight: 600;
    color: var(--white);
    background: var(--primary);
    border: none;
    border-radius: var(--radius);
    cursor: pointer;
    transition: var(--transition);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    font-family: var(--font);
}
.btn-submit:hover { background: var(--primary-hover); }
.btn-submit:active { transform: scale(0.99); }
.btn-submit:disabled { opacity: 0.6; cursor: not-allowed; transform: none; }

.btn-submit .loading {
    width: 18px; height: 18px;
    border: 2px solid rgba(255,255,255,0.3);
    border-top-color: #fff;
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
}

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

/* ===== 社交登录 ===== */
.auth-divider {
    display: flex; align-items: center; gap: 16px; margin: 24px 0;
}
.auth-divider::before, .auth-divider::after {
    content: ''; flex: 1; height: 1px; background: var(--gray-200);
}
.auth-divider span { font-size: 13px; color: var(--gray-400); }

.auth-social { display: flex; gap: 12px; }

.btn-social {
    flex: 1; padding: 12px;
    border: 1px solid var(--gray-200);
    border-radius: var(--radius);
    background: var(--white);
    cursor: pointer;
    display: flex; align-items: center; justify-content: center;
    gap: 8px; font-size: 14px;
    color: var(--gray-700); transition: var(--transition);
    font-family: var(--font);
}
.btn-social:hover { background: var(--gray-50); border-color: var(--gray-300); }
.btn-social i { font-size: 16px; }

/* ===== 页脚 ===== */
.auth-forgot { text-align: right; }
.auth-forgot a { font-size: 13px; color: var(--primary); font-weight: 500; }
.auth-forgot a:hover { text-decoration: underline; }

.auth-footer {
    text-align: center; margin-top: 32px;
    font-size: 13px; color: var(--gray-500);
}
.auth-footer a { color: var(--primary); }

/* ===== Toast ===== */
.toast-container {
    position: fixed; top: 16px; right: 16px;
    z-index: 10001;
    display: flex; flex-direction: column; gap: 8px;
}

.toast {
    min-width: 280px; max-width: 400px;
    padding: 12px 16px;
    border-radius: var(--radius-md);
    display: flex; align-items: center; gap: 10px;
    box-shadow: var(--shadow-md);
    font-size: 14px;
    animation: slideIn 0.2s ease;
}
.toast-success { background: #E8F8F0; color: #005C3B; }
.toast-error { background: #FFEDED; color: #A00000; }
.toast-warning { background: #FFF3E8; color: #8B5000; }
.toast-info { background: var(--primary-light); color: #003A8C; }
.toast-icon { font-size: 18px; flex-shrink: 0; }
.toast-message { flex: 1; }
.toast-close { background: none; border: none; cursor: pointer; opacity: 0.5; color: inherit; font-size: 14px; }
.toast-close:hover { opacity: 1; }

/* ===== 响应式 ===== */
@media (max-width: 1024px) {
    .auth-brand { width: 35%; padding: 32px; }
    .auth-form-wrapper { width: 65%; }
    .auth-brand-title { font-size: 26px; }
    .auth-brand-desc { font-size: 15px; }
}

@media (max-width: 768px) {
    body { flex-direction: column; }
    .auth-brand {
        width: 100%; padding: 40px 24px;
        min-height: auto;
    }
    .auth-brand-title { font-size: 22px; }
    .auth-brand-features { display: none; }
    .auth-form-wrapper { width: 100%; padding: 32px 20px; }
    .auth-form-container { max-width: none; }
    .role-selector { grid-template-columns: 1fr; }
}

/* ===== 动画 ===== */
.auth-form-container { animation: fadeIn 0.4s ease; }
.auth-brand-content { animation: slideUp 0.5s ease; }

@keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes slideUp { from { opacity: 0; transform: translateY(24px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(100%); } to { opacity: 1; transform: translateX(0); } }

/* ===== 微信扫码登录 ===== */
.wechat-login-container {
    display: flex;
    flex-direction: column;
    align-items: center;
    margin-bottom: 8px;
}

.wechat-qr-wrapper {
    width: 200px;
    height: 240px;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
}

.wechat-qr-loading {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
    color: #9CA3AF;
    font-size: 14px;
}
.wechat-qr-loading i { font-size: 28px; }

.wechat-qr-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 12px;
}

.wechat-qr-box img {
    width: 180px;
    height: 180px;
    border: 1px solid #E5E7EB;
    border-radius: 8px;
    background: #fff;
}

.wechat-scan-tip {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 14px;
    color: #07C160;
    font-weight: 500;
}
.wechat-scan-tip i { font-size: 18px; }

.wechat-error-box {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    color: #EF4444;
    font-size: 14px;
}
.wechat-error-box i { font-size: 28px; }

.btn-retry {
    padding: 6px 16px;
    background: #4F46E5;
    color: #fff;
    border: none;
    border-radius: 6px;
    font-size: 13px;
    cursor: pointer;
}
.btn-retry:hover { background: #4338CA; }

/* 备用登录 */
.auth-divider { margin-top: 8px; }
.backup-login-link {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px;
    font-size: 13px;
    color: #6B7280;
    text-decoration: none;
    transition: color 0.2s;
}
.backup-login-link:hover { color: #4F46E5; }

/* 暗色模式兼容 */
[data-theme="dark"] .wechat-qr-box img {
    border-color: #374151;
    background: #fff;
}
[data-theme="dark"] .wechat-scan-tip { color: #34D399; }
