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

/* 默认浅色主题 - 防止闪烁 */
:root {
    --bg-primary: #fafafa;
    --bg-secondary: #ffffff;
    --bg-tertiary: #f5f5f5;
    --text-primary: #171717;
    --text-secondary: #525252;
    --text-muted: #a3a3a3;
    --accent: #6366f1;
    --accent-hover: #4f46e5;
    --accent-light: rgba(99, 102, 241, 0.1);
    --border: #e5e5e5;
    --shadow: 0 0 40px rgba(0, 0, 0, 0.08);
}

/* 深色主题 */
html.dark-theme {
    --bg-primary: #0d0d0d;
    --bg-secondary: #1a1a1a;
    --bg-tertiary: #262626;
    --text-primary: #ffffff;
    --text-secondary: #a3a3a3;
    --text-muted: #737373;
    --accent: #6366f1;
    --accent-hover: #818cf8;
    --accent-light: rgba(99, 102, 241, 0.15);
    --border: #404040;
    --error: #ef4444;
    --success: #22c55e;
    --shadow: 0 0 40px rgba(0, 0, 0, 0.4);
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', sans-serif;
    font-size: 14px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
}

.auth-page {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}

.auth-container {
    width: 100%;
    max-width: 380px;
    padding: 28px 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    box-shadow: var(--shadow);
    border: 1px solid var(--border);
}

.auth-header {
    text-align: center;
    margin-bottom: 20px;
}

.auth-logo {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 12px;
}

.auth-logo-icon {
    width: 32px;
    height: 32px;
    background: linear-gradient(135deg, #6366f1 0%, #8b5cf6 100%);
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-logo-icon svg {
    width: 18px;
    height: 18px;
    color: white;
}

.auth-logo-text {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
}

.auth-title {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 4px;
}

.auth-subtitle {
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-tabs {
    display: flex;
    gap: 4px;
    padding: 3px;
    background: var(--bg-tertiary);
    border-radius: 8px;
    margin-bottom: 16px;
}

.tab-btn {
    flex: 1;
    padding: 8px 12px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 13px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
}

.tab-btn.active {
    background: var(--bg-secondary);
    color: var(--text-primary);
}

.auth-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.form-group {
    position: relative;
}

.form-group label {
    display: block;
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
}

.form-input {
    width: 100%;
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    transition: all 0.2s;
    outline: none;
}

.form-input:focus {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px var(--accent-light);
}

.form-input::placeholder {
    color: var(--text-muted);
}

.code-input-group {
    display: flex;
    gap: 8px;
}

.code-input-group .form-input {
    flex: 1;
}

.captcha-img {
    width: 100px;
    height: 40px;
    border-radius: 8px;
    cursor: pointer;
    border: 1px solid var(--border);
    object-fit: cover;
}

.captcha-img:hover {
    opacity: 0.9;
}

.btn-code {
    padding: 10px 12px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    font-size: 12px;
    font-weight: 500;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
}

.btn-code:hover:not(:disabled) {
    border-color: var(--accent);
    color: var(--accent);
}

.btn-code:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}

.btn-primary {
    width: 100%;
    padding: 11px;
    border: none;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent) 0%, #8b5cf6 100%);
    color: white;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
    margin-top: 4px;
}

.btn-primary:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(99, 102, 241, 0.3);
}

.form-options {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 12px;
    margin-top: -4px;
}

.remember-me {
    display: flex;
    align-items: center;
    gap: 6px;
    color: var(--text-secondary);
    cursor: pointer;
}

.remember-me input {
    width: 14px;
    height: 14px;
    accent-color: var(--accent);
}

.forgot-link {
    color: var(--accent);
    text-decoration: none;
}

.forgot-link:hover {
    text-decoration: underline;
}

.auth-divider {
    display: flex;
    align-items: center;
    gap: 12px;
    margin: 16px 0;
    color: var(--text-muted);
    font-size: 12px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border);
}

.btn-wechat {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 100%;
    padding: 10px;
    border: 1px solid var(--border);
    border-radius: 8px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: all 0.2s;
}

.btn-wechat:hover {
    border-color: #07c160;
    color: #07c160;
}

.btn-wechat svg {
    width: 18px;
    height: 18px;
}

.auth-footer {
    text-align: center;
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px solid var(--border);
    font-size: 13px;
    color: var(--text-secondary);
}

.auth-footer a {
    color: var(--accent);
    text-decoration: none;
    font-weight: 500;
    margin-left: 4px;
}

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

/* 找回密码模态框 */
.modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s;
}

.modal-overlay.show {
    opacity: 1;
    visibility: visible;
}

.modal-content {
    width: 90%;
    max-width: 360px;
    padding: 24px;
    background: var(--bg-secondary);
    border-radius: 12px;
    border: 1px solid var(--border);
    transform: scale(0.9);
    transition: all 0.3s;
}

.modal-overlay.show .modal-content {
    transform: scale(1);
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
}

.modal-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 20px;
    cursor: pointer;
    border-radius: 6px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s;
}

.modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
}

/* Toast提示框 - 现代化设计 */
.toast {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%) translateY(-100px);
    padding: 12px 24px;
    border-radius: 12px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    opacity: 0;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 1001;
    border: 1px solid var(--border);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.12), 0 2px 8px rgba(0, 0, 0, 0.08);
    display: flex;
    align-items: center;
    gap: 10px;
    min-width: 200px;
    justify-content: center;
}

.toast.show {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
}

/* 成功提示 - 绿色主题 */
.toast.success {
    background: linear-gradient(135deg, #10b981 0%, #059669 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 32px rgba(16, 185, 129, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toast.success::before {
    content: '✓';
    font-size: 16px;
    font-weight: bold;
}

/* 图形验证码弹窗 - 标准设计 */
.captcha-box {
    width: 300px;
    background: var(--bg-secondary);
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    overflow: hidden;
}

.captcha-box-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 14px 16px;
    border-bottom: 1px solid var(--border);
}

.captcha-box-title {
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.captcha-box-close {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-tertiary);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    transition: color 0.2s;
}

.captcha-box-close:hover {
    color: var(--text-primary);
}

.captcha-box-body {
    padding: 20px 16px;
    display: flex;
    flex-direction: column;
    gap: 14px;
}

.captcha-img-row {
    display: flex;
    align-items: center;
    gap: 10px;
}

.captcha-box-img {
    flex: 1;
    height: 44px;
    border-radius: 4px;
    object-fit: cover;
    cursor: pointer;
    border: 1px solid var(--border);
}

.captcha-refresh-btn {
    width: 44px;
    height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-secondary);
    cursor: pointer;
    transition: all 0.2s;
}

.captcha-refresh-btn:hover {
    border-color: var(--accent);
    color: var(--accent);
}

.captcha-refresh-btn svg {
    transition: transform 0.3s;
}

.captcha-refresh-btn:hover svg {
    transform: rotate(180deg);
}

.captcha-box-input {
    width: 100%;
    height: 40px;
    padding: 0 12px;
    border: 1px solid var(--border);
    border-radius: 4px;
    background: var(--bg-tertiary);
    color: var(--text-primary);
    font-size: 16px;
    letter-spacing: 4px;
    text-align: center;
    text-transform: uppercase;
    outline: none;
    transition: border-color 0.2s;
    box-sizing: border-box;
}

.captcha-box-input:focus {
    border-color: var(--accent);
}

.captcha-box-input::placeholder {
    color: var(--text-tertiary);
    font-size: 13px;
    letter-spacing: 1px;
    text-transform: none;
}

.captcha-box-actions {
    display: flex;
    gap: 10px;
    margin-top: 6px;
}

.captcha-btn-cancel,
.captcha-btn-confirm {
    flex: 1;
    height: 36px;
    border-radius: 4px;
    font-size: 14px;
    cursor: pointer;
    transition: all 0.2s;
}

.captcha-btn-cancel {
    border: 1px solid var(--border);
    background: var(--bg-tertiary);
    color: var(--text-secondary);
}

.captcha-btn-cancel:hover {
    border-color: var(--text-secondary);
    color: var(--text-primary);
}

.captcha-btn-confirm {
    border: none;
    background: var(--accent);
    color: #fff;
}

.captcha-btn-confirm:hover {
    opacity: 0.9;
}

/* 错误提示 - 红色主题 */
.toast.error {
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 32px rgba(239, 68, 68, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toast.error::before {
    content: '✕';
    font-size: 16px;
    font-weight: bold;
}

/* 信息提示 - 蓝色主题 */
.toast.info {
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    box-shadow: 0 8px 32px rgba(59, 130, 246, 0.3), 0 2px 8px rgba(0, 0, 0, 0.1);
}

.toast.info::before {
    content: 'ℹ';
    font-size: 16px;
    font-weight: bold;
}

/* 密码输入框容器 */
.password-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.password-input-wrapper .form-input {
    padding-right: 40px;
}

/* 密码显示/隐藏按钮 */
.password-toggle-btn {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    width: 28px;
    height: 28px;
    border: none;
    background: transparent;
    color: var(--text-muted);
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 4px;
    transition: all 0.2s;
    padding: 0;
}

.password-toggle-btn:hover {
    color: var(--text-secondary);
    background: var(--bg-tertiary);
}

.password-toggle-btn svg {
    width: 18px;
    height: 18px;
}

/* 默认显示eye-off-icon(闭着的眼睛)，隐藏eye-icon(睁开的眼睛) */
.password-toggle-btn .eye-icon {
    display: none;
}

@media (max-width: 480px) {
    .auth-container {
        padding: 24px 20px;
    }
}
