/* ==========================================================================
   认证模态框样式
   用于用户登录/注册的通用模态框组件
   ========================================================================== */

/* 模态框容器 */
.auth-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 10000;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.auth-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

.auth-modal.show {
    opacity: 1;
}

/* 遮罩层 */
.auth-modal-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(4px);
}

/* 模态框容器 */
.auth-modal-container {
    position: relative;
    width: 90%;
    max-width: 450px;
    max-height: 90vh;
    background: var(--bg-primary);
    border-radius: 16px;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    overflow: hidden;
    transform: scale(0.9);
    transition: transform 0.3s ease;
}

.auth-modal.show .auth-modal-container {
    transform: scale(1);
}

/* 关闭按钮 */
.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    border: none;
    background: var(--bg-secondary);
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
    transition: all 0.2s ease;
}

.auth-modal-close:hover {
    background: var(--bg-tertiary);
    color: var(--text-primary);
    transform: rotate(90deg);
}

/* 模态框内容 */
.auth-modal-content {
    padding: 48px 32px 32px;
    overflow-y: auto;
    max-height: calc(90vh - 40px);
}

/* 表单标题 */
.auth-form-header {
    text-align: center;
    margin-bottom: 32px;
}

.auth-form-title {
    font-size: 28px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 8px;
}

.auth-form-subtitle {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

/* 登录 Tab 切换 */
.auth-login-tabs {
    display: flex;
    gap: 0;
    margin-bottom: 20px;
    border-bottom: 1px solid var(--border-color);
}

.auth-login-tab {
    flex: 1;
    padding: 12px 16px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    font-size: 14px;
    font-family: var(--font-family-base);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    margin-bottom: -1px;
    transition: color 0.2s ease, border-color 0.2s ease;
}

.auth-login-tab:hover {
    color: var(--text-primary);
}

.auth-login-tab.active {
    color: var(--accent-color);
    font-weight: 500;
    border-bottom-color: var(--accent-color);
}

/* 短信验证码行：输入框 + 获取验证码按钮 */
.auth-sms-code-row {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.auth-sms-code-row .auth-form-input {
    flex: 1;
    min-width: 0;
}

.auth-btn-getcode {
    flex-shrink: 0;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color:var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family-base);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.auth-btn-getcode:hover:not(:disabled) {
    background: var(--accent-light);
    border-color: var(--accent-color);
    color: white;
}

.auth-btn-getcode:disabled {
    cursor: not-allowed;
    color: var(--text-tertiary);
    border-color: var(--border-color);
}

/* 表单容器 */
.auth-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

/* 表单字段 */
.auth-form-field {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.auth-form-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 6px;
}

.auth-form-label .info-icon {
    color: var(--text-tertiary);
    cursor: help;
    font-size: 12px;
}

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

.auth-form-input {
    width: 100%;
    padding: 12px 16px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    background: var(--bg-secondary);
    color: var(--text-primary);
    font-size: 14px;
    font-family: var(--font-family-base);
    transition: all 0.2s ease;
    box-sizing: border-box;
}

.auth-form-input:focus {
    outline: none;
    border-color: var(--accent-color);
    background: var(--bg-primary);
    box-shadow: 0 0 0 3px var(--accent-light);
}

.auth-form-input.error {
    border-color: var(--error-color);
}

.auth-form-input.success {
    border-color: var(--success-color);
}

/* 密码显示切换按钮 */
.auth-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    color: var(--text-tertiary);
    cursor: pointer;
    padding: 4px;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.2s ease;
}

.auth-password-toggle:hover {
    color: var(--text-secondary);
}

/* 图形验证码 */
.auth-captcha-wrapper {
    display: flex;
    gap: 12px;
    align-items: stretch;
}

.auth-captcha-input-wrapper {
    flex: 1;
}

.auth-captcha-image-wrapper {
    position: relative;
    width: 120px;
    height: 44px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    overflow: hidden;
    flex-shrink: 0;
    transition: border-color 0.2s ease;
}

.auth-captcha-image-wrapper:hover {
    border-color: var(--accent-color);
}

.auth-captcha-image {
    width: 100%;
    height: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: opacity 0.2s ease;
}

.auth-captcha-image:hover {
    opacity: 0.8;
}

.auth-captcha-loading {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    background: var(--bg-tertiary);
    gap: 4px;
}

.auth-captcha-loading span {
    font-size: 10px;
    color: var(--text-tertiary);
}

/* 验证提示 */
.auth-form-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0;
    display: flex;
    align-items: center;
    gap: 4px;
}

.auth-form-hint.error {
    color: var(--error-color);
}

.auth-form-hint.success {
    color: var(--success-color);
}

.auth-form-hint.checking {
    color: var(--accent-color);
}

/* 记住我选项 */
.auth-form-checkbox {
    display: flex;
    align-items: center;
    gap: 8px;
}

.auth-form-checkbox input[type="checkbox"] {
    width: 16px;
    height: 16px;
    cursor: pointer;
}

.auth-form-checkbox label {
    font-size: 14px;
    color: var(--text-secondary);
    cursor: pointer;
    user-select: none;
}

/* 按钮 */
.auth-form-button {
    width: 100%;
    padding: 12px 24px;
    border: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 600;
    font-family: var(--font-family-base);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.auth-form-button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

.auth-form-button-primary {
    background: var(--accent-color);
    color: white;
}

.auth-form-button-primary:hover:not(:disabled) {
    background: var(--accent-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px var(--accent-light);
}

.auth-form-button-primary:active:not(:disabled) {
    transform: translateY(0);
}

/* 加载动画 */
.auth-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid rgba(255, 255, 255, 0.3);
    border-top-color: white;
    border-radius: 50%;
    animation: auth-spin 0.6s linear infinite;
}

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

/* 链接区域 */
.auth-form-links {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
}

.auth-form-link {
    color: var(--accent-color);
    text-decoration: none;
    cursor: pointer;
    transition: color 0.2s ease;
}

.auth-form-link:hover {
    color: var(--accent-hover);
    text-decoration: underline;
}

/* 分隔线 */
.auth-form-divider {
    display: flex;
    align-items: center;
    gap: 16px;
    margin: 24px 0;
}

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

.auth-form-divider-text {
    font-size: 14px;
    color: var(--text-tertiary);
}

/* 第三方登录 */
.auth-oauth-buttons {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-oauth-button {
    width: 100%;
    padding: 12px 24px;
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 14px;
    font-weight: 500;
    font-family: var(--font-family-base);
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
}

.auth-oauth-button:hover {
    border-color: var(--accent-color);
    background: var(--bg-primary);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

.auth-oauth-button svg {
    width: 20px;
    height: 20px;
}

.auth-oauth-button.github svg {
    fill: currentColor;
}

.auth-oauth-button.wechat {
    background: var(--accent-light);
    color: white;
}

.auth-oauth-button.wechat:hover {
    background-color: var(--bg-primary);
    border-color: var(--border-supper-light);
    color: var(--text-primary);
}

/* 底部提示 */
.auth-form-footer {
    text-align: center;
    margin-top: 24px;
    padding-top: 24px;
    border-top: 1px solid var(--border-color);
    font-size: 14px;
    color: var(--text-secondary);
}

/* 响应式设计 */
@media (max-width: 640px) {
    .auth-modal-container {
        width: 95%;
        max-width: none;
        border-radius: 12px;
    }
    
    .auth-modal-content {
        padding: 40px 24px 24px;
    }
    
    .auth-form-title {
        font-size: 24px;
    }
    
    .auth-captcha-wrapper {
        flex-direction: column;
        gap: 8px;
    }
    
    .auth-captcha-image-wrapper {
        width: 100%;
        height: 50px;
    }
}

/* 暗色主题适配 */
[data-theme="dark"] .auth-modal-overlay {
    background: rgba(0, 0, 0, 0.8);
}

/* 护眼主题适配 */
[data-theme="eye-care"] .auth-modal-overlay {
    background: rgba(50, 40, 30, 0.7);
}

/* 用户名可用性检查状态 */
.auth-username-status {
    display: flex;
    align-items: center;
    gap: 6px;
    font-size: 13px;
    margin-top: 4px;
}

.auth-username-status.checking {
    color: var(--text-tertiary);
}

.auth-username-status.available {
    color: var(--success-color);
}

.auth-username-status.unavailable {
    color: var(--error-color);
}

/* 密码强度指示器 */
.auth-password-strength {
    margin-top: 8px;
}

.auth-password-strength-bar {
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    overflow: hidden;
    margin-bottom: 6px;
}

.auth-password-strength-fill {
    height: 100%;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.auth-password-strength-fill.weak {
    width: 33%;
    background: var(--error-color);
}

.auth-password-strength-fill.medium {
    width: 66%;
    background: var(--warning-color, #f59e0b);
}

.auth-password-strength-fill.strong {
    width: 100%;
    background: var(--success-color);
}

.auth-password-strength-text {
    font-size: 12px;
    color: var(--text-tertiary);
}

/* 注册成功提示 */
.auth-success-message {
    text-align: center;
    padding: 24px;
}

.auth-success-icon {
    font-size: 64px;
    margin-bottom: 16px;
}

.auth-success-title {
    font-size: 24px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 12px;
}

.auth-success-desc {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0 0 24px;
    line-height: 1.6;
}

.auth-success-benefits {
    background: var(--bg-secondary);
    border-radius: 12px;
    padding: 20px;
    margin: 24px 0;
    text-align: left;
}

.auth-success-benefits-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 16px;
}

.auth-success-benefits-list {
    list-style: none;
    padding: 0;
    margin: 0;
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.auth-success-benefits-item {
    font-size: 14px;
    color: var(--text-secondary);
    display: flex;
    align-items: center;
    gap: 10px;
}

.auth-success-benefits-item::before {
    content: '✅';
    font-size: 16px;
}

.auth-success-actions {
    display: flex;
    gap: 12px;
    margin-top: 24px;
}

.auth-success-actions .auth-form-button {
    flex: 1;
}

/* ==================== 错误提示区域 ==================== */

.auth-error-message {
    background: rgba(239, 68, 68, 0.1);
    border: 1px solid rgba(239, 68, 68, 0.3);
    border-left: 4px solid #ef4444;
    border-radius: 8px;
    padding: 12px 16px;
    margin-bottom: 20px;
    color: #ef4444;
    font-size: 14px;
    line-height: 1.5;
    display: none;
    animation: slideDown 0.3s ease;
}

.auth-error-message::before {
    content: '❌ ';
    margin-right: 6px;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

