/**
 * auth-modal.css - 认证弹窗样式
 * 
 * 按照宪法规则：CSS 独立文件，便于维护
 * 
 * @author 小猪
 * @date 2026-03-29
 * @version 1.0.0
 */

/* ===== 弹窗遮罩层 ===== */
.auth-modal-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 9999;
    display: flex;
    align-items: center;
    justify-content: center;
    
    /* 淡入淡出动画 */
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

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

/* ===== 弹窗容器 ===== */
.auth-modal {
    background-color: #fff;
    border-radius: 12px;
    width: 90%;
    max-width: 420px;
    max-height: 90vh;
    overflow-y: auto;
    position: relative;
    box-shadow: 0 20px 60px rgba(0, 0, 0, 0.3);
    
    /* 淡入淡出动画 */
    opacity: 0;
    transform: scale(0.9) translateY(-20px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.auth-modal-overlay.active .auth-modal {
    opacity: 1;
    transform: scale(1) translateY(0);
}

/* ===== 关闭按钮 ===== */
.auth-modal-close {
    position: absolute;
    top: 16px;
    right: 16px;
    width: 32px;
    height: 32px;
    background-color: #f0f0f0;
    border: none;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: #666;
    transition: all 0.3s ease;
    z-index: 10;
}

.auth-modal-close:hover {
    background-color: #e0e0e0;
    color: #333;
    transform: rotate(90deg);
}

/* ===== 弹窗头部 ===== */
.auth-modal-header {
    padding: 40px 40px 20px;
    text-align: center;
}

.auth-modal-logo {
    font-size: 48px;
    margin-bottom: 16px;
}

.auth-modal-title {
    font-size: 24px;
    font-weight: 600;
    color: #333;
    margin-bottom: 8px;
}

.auth-modal-subtitle {
    font-size: 14px;
    color: #888;
}

/* ===== 弹窗内容 ===== */
.auth-modal-body {
    padding: 20px 40px 40px;
}

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

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

.auth-form-label {
    font-size: 14px;
    font-weight: 500;
    color: #333;
}

.auth-form-label .required {
    color: #f5222d;
    margin-left: 4px;
}

.auth-form-input {
    padding: 12px 16px;
    font-size: 15px;
    border: 1px solid #d9d9d9;
    border-radius: 8px;
    outline: none;
    transition: all 0.3s ease;
    background-color: #fafafa;
}

.auth-form-input:focus {
    border-color: #6B7B8C;
    background-color: #fff;
    box-shadow: 0 0 0 3px rgba(107, 123, 140, 0.1);
}

.auth-form-input::placeholder {
    color: #bfbfbf;
}

.auth-form-input.error {
    border-color: #f5222d;
    background-color: #fff1f0;
}

.auth-form-error {
    font-size: 12px;
    color: #f5222d;
    display: none;
}

.auth-form-error.show {
    display: block;
}

/* ===== 密码输入框 ===== */
.auth-form-password {
    position: relative;
}

.auth-password-toggle {
    position: absolute;
    right: 12px;
    top: 50%;
    transform: translateY(-50%);
    background: none;
    border: none;
    cursor: pointer;
    color: #888;
    font-size: 18px;
    padding: 4px;
    transition: color 0.3s ease;
}

.auth-password-toggle:hover {
    color: #6B7B8C;
}

/* ===== 选项行 ===== */
.auth-form-options {
    display: flex;
    justify-content: flex-start;
    align-items: center;
    gap: 20px;
    font-size: 14px;
    margin-bottom: 8px;
}

.auth-remember,
.auth-auto-login {
    display: flex;
    align-items: center;
    gap: 6px;
    cursor: pointer;
    color: #666;
    font-size: 13px;
}

.auth-remember input[type="checkbox"],
.auth-auto-login input[type="checkbox"] {
    width: 14px;
    height: 14px;
    accent-color: #6B7B8C;
}

.auth-form-forgot {
    text-align: right;
    margin-bottom: 16px;
}

.auth-forgot {
    color: #6B7B8C;
    text-decoration: none;
    font-size: 13px;
    transition: color 0.3s ease;
}

.auth-forgot:hover {
    color: #5A6A7B;
    text-decoration: underline;
}

/* ===== 提交按钮 ===== */
.auth-submit-btn {
    padding: 14px 24px;
    font-size: 16px;
    font-weight: 500;
    color: #fff;
    background: linear-gradient(135deg, #6B7B8C 0%, #9B8E7E 100%);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.3s ease;
    position: relative;
    overflow: hidden;
}

.auth-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 8px 20px rgba(107, 123, 140, 0.3);
}

.auth-submit-btn:active {
    transform: translateY(0);
}

.auth-submit-btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* 加载动画 */
.auth-submit-btn.loading::after {
    content: '';
    position: absolute;
    width: 20px;
    height: 20px;
    top: 50%;
    left: 50%;
    margin-left: -10px;
    margin-top: -10px;
    border: 2px solid #fff;
    border-radius: 50%;
    border-top-color: transparent;
    animation: auth-spin 0.8s linear infinite;
}

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

/* ===== 分隔线 ===== */
.auth-divider {
    display: flex;
    align-items: center;
    margin: 24px 0;
    color: #888;
    font-size: 14px;
}

.auth-divider::before,
.auth-divider::after {
    content: '';
    flex: 1;
    height: 1px;
    background-color: #e8e8e8;
}

.auth-divider span {
    padding: 0 16px;
}

/* ===== 切换链接 ===== */
.auth-switch {
    text-align: center;
    font-size: 14px;
    color: #666;
}

.auth-switch-link {
    color: #6B7B8C;
    font-weight: 500;
    text-decoration: none;
    cursor: pointer;
    transition: color 0.3s ease;
}

.auth-switch-link:hover {
    color: #5A6A7B;
    text-decoration: underline;
}

/* ===== 跟单员入驻入口 ===== */
.auth-merchandiser-entry {
    margin-top: 16px;
    padding-top: 16px;
    border-top: 1px dashed #e0e0e0;
    text-align: center;
}

.auth-merchandiser-text {
    display: block;
    font-size: 14px;
    color: #333;
    margin-bottom: 4px;
}

.auth-merchandiser-hint {
    display: block;
    font-size: 12px;
    color: #999;
}

/* ===== 表单切换动画 ===== */
.auth-form-section {
    display: none;
    animation: auth-fadeIn 0.3s ease;
}

.auth-form-section.active {
    display: block;
}

@keyframes auth-fadeIn {
    from {
        opacity: 0;
        transform: translateX(20px);
    }
    to {
        opacity: 1;
        transform: translateX(0);
    }
}

/* ===== 顶部用户入口 ===== */
.auth-header-entry {
    display: flex;
    align-items: center;
    gap: 16px;
}

.auth-btn {
    padding: 8px 20px;
    font-size: 14px;
    font-weight: 500;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    text-decoration: none;
}

.auth-btn-login {
    color: #6B7B8C;
    background-color: transparent;
    border: 1px solid #6B7B8C;
}

.auth-btn-login:hover {
    background-color: #E8EBEE;
}

.auth-btn-register {
    color: #fff;
    background: linear-gradient(135deg, #6B7B8C 0%, #9B8E7E 100%);
    border: none;
}

.auth-btn-register:hover {
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(107, 123, 140, 0.3);
}

.auth-btn-logout {
    color: #666;
    background-color: transparent;
    border: 1px solid #d9d9d9;
    font-size: 14px;
    padding: 6px 16px;
    text-decoration: none;
}

.auth-btn-logout:hover {
    color: #f5222d;
    border-color: #f5222d;
}

/* 已登录状态 */
.auth-user-menu {
    display: flex;
    align-items: center;
    gap: 8px;
    cursor: pointer;
    padding: 6px 12px;
    border-radius: 20px;
    transition: background-color 0.3s ease;
}

.auth-user-menu:hover {
    background-color: #f0f0f0;
}

.auth-user-avatar {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    background: linear-gradient(135deg, #6B7B8C 0%, #9B8E7E 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    color: #fff;
    font-size: 14px;
    font-weight: 500;
}

.auth-user-name {
    font-size: 14px;
    color: #333;
    max-width: 100px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* ===== 响应式 ===== */
@media (max-width: 480px) {
    .auth-modal {
        width: 95%;
        max-height: 95vh;
    }

    .auth-modal-header {
        padding: 30px 24px 16px;
    }

    .auth-modal-body {
        padding: 16px 24px 30px;
    }
}
