/**
 * 认证相关样式 - 用户头像、登录/注册弹窗、数据同步进度
 */

/* ========== 桌面端顶部栏 ========== */
.desktop-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px 20px;
    background: transparent;
    flex-shrink: 0;
}

.desktop-header-spacer {
    flex: 1;
}

/* ========== 用户头像区域 ========== */
.user-avatar-area {
    display: flex;
    align-items: center;
    gap: 10px;
}

/* 用户名标签 */
.user-label {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 2px 12px;
    border-radius: var(--radius-md);
    font-size: 14px;
    height: 28px;
    white-space: nowrap;
}

.user-label.guest {
    background: var(--accent-color);
    color: #000;
}

.user-label.logged-in {
    background: #333;
    color: var(--text-primary);
}

/* 头像按钮容器（带彩色渐变圆环） */
.avatar-btn {
    width: 52px;
    height: 52px;
    border-radius: 50%;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    /* 彩色渐变圆环背景 */
    background: conic-gradient(
        from 0deg,
        #22c55e 0deg,      /* 绿色 */
        #3b82f6 90deg,     /* 蓝色 */
        #8b5cf6 180deg,    /* 紫色 */
        #ef4444 270deg,    /* 红色 */
        #f97316 315deg,    /* 橙色 */
        #22c55e 360deg     /* 回到绿色 */
    );
    padding: 3px;
}

.avatar-btn::before {
    content: '';
    position: absolute;
    inset: 3px;
    border-radius: 50%;
    background: var(--bg-primary);
}

.avatar-btn:hover {
    transform: scale(1.05);
}

/* 头像图片（在圆环内部） */
.avatar-btn img {
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    object-fit: cover;
    border-radius: 50%;
    position: relative;
    z-index: 1;
}

/* 默认头像 */
.avatar-btn .default-avatar {
    width: calc(100% - 6px);
    height: calc(100% - 6px);
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    position: relative;
    z-index: 1;
    overflow: hidden;
}

.avatar-btn .default-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* ========== 用户下拉菜单 ========== */
.user-dropdown {
    position: fixed;
    top: 87px;
    right: 20px;
    width: 386px;
    background: var(--bg-secondary);
    border-radius: 50px;
    padding: 25px 32px 32px;
    z-index: 101;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: all var(--transition-normal);
    box-shadow: var(--shadow-lg);
}

.user-dropdown.active {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

/* 用户邮箱 */
.user-email {
    font-size: 14px;
    color: #fff;
    text-align: center;
    margin-bottom: 20px;
}

/* 大头像区域 */
.user-avatar-large {
    position: relative;
    width: 85px;
    height: 85px;
    margin: 0 auto 20px;
}

.user-avatar-large img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    object-fit: cover;
    border: 3px solid var(--text-muted);
}

.user-avatar-large .default-avatar-large {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: var(--bg-tertiary);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid var(--text-muted);
    overflow: hidden;
}

.user-avatar-large .default-avatar-large img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 50%;
}

/* 头像上传按钮 */
.avatar-upload-btn {
    position: absolute;
    bottom: -5px;
    right: -5px;
    width: 28px;
    height: 28px;
    background: #333;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all var(--transition-fast);
    border: 2px solid var(--bg-secondary);
}

.avatar-upload-btn:hover {
    background: var(--accent-color);
}

.avatar-upload-btn svg {
    width: 14px;
    height: 14px;
    color: #fff;
}

.avatar-upload-input {
    display: none;
}

/* 欢迎文字 */
.user-welcome {
    font-size: 24px;
    font-weight: 600;
    color: #fff;
    text-align: center;
    margin-bottom: 24px;
}

/* 退出按钮 */
.logout-btn {
    width: 185px;
    height: 48px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 8px;
    background: var(--bg-tertiary);
    border-radius: 80px;
    color: #fff;
    font-size: 20px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.logout-btn:hover {
    background: var(--bg-hover);
}

.logout-btn svg {
    width: 20px;
    height: 20px;
}

/* 游客状态按钮组 */
.guest-actions {
    display: flex;
    gap: 16px;
    justify-content: center;
    margin-top: 20px;
}

.guest-login-btn,
.guest-register-btn {
    width: 100px;
    height: 40px;
    border-radius: var(--radius-md);
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all var(--transition-fast);
}

.guest-login-btn {
    background: var(--accent-color);
    color: #fff;
}

.guest-login-btn:hover {
    background: var(--accent-hover);
}

.guest-register-btn {
    background: var(--error-color);
    color: #fff;
}

.guest-register-btn:hover {
    background: #dc2626;
}

/* ========== 认证弹窗遮罩 ========== */
.auth-overlay {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(2, 2, 2, 0.7);
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
}

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

/* ========== 登录弹窗 ========== */
.auth-modal {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0.9);
    background: var(--bg-secondary);
    border-radius: 50px;
    padding: 32px 52px 40px;
    z-index: 2001;
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-normal);
    min-width: 456px;
}

.auth-modal.active {
    opacity: 1;
    visibility: visible;
    transform: translate(-50%, -50%) scale(1);
}

/* 弹窗标题区域 */
.auth-header {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 21px;
    margin-bottom: 25px;
}

.auth-title-row {
    display: flex;
    align-items: center;
    gap: 9px;
    padding-top: 10px;
}

.auth-logo {
    width: 37px;
    height: 37px;
}

.auth-title {
    font-size: 36px;
    font-weight: 700;
    color: #fff;
}

.auth-divider {
    width: 100%;
    height: 1px;
    background: var(--text-secondary);
}

/* 输入框组 */
.auth-input-group {
    margin-bottom: 21px;
}

.auth-input-label {
    font-size: 16px;
    font-weight: 600;
    color: #828282;
    display: block;
    line-height: 42px;
}

.auth-input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.auth-input {
    width: 100%;
    background: transparent;
    border: none;
    border-bottom: 1px solid var(--text-secondary);
    border-radius: 0;
    padding: 8px 40px 8px 0;
    font-size: 16px;
    color: #fff;
    outline: none;
    transition: border-color var(--transition-fast);
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
}

.auth-input:focus {
    border-bottom-color: var(--accent-color);
}

.auth-input::placeholder {
    color: #828282;
}

/* 密码可见切换按钮 */
.password-toggle {
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    width: 24px;
    height: 24px;
    cursor: pointer;
    color: #828282;
    transition: color var(--transition-fast);
}

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

/* 密码提示 */
.auth-hint {
    font-size: 12px;
    color: #828282;
    margin-top: 4px;
}

/* 错误提示 */
.auth-error {
    display: none;
    color: var(--error-color);
    font-size: 14px;
    margin: 16px 0;
    text-align: center;
}

.auth-error.active {
    display: block;
}

/* 按钮组 */
.auth-buttons {
    display: flex;
    gap: 30px;
    justify-content: center;
    margin-top: 30px;
    padding-bottom: 10px;
}

.auth-btn {
    width: 167px;
    height: 48px;
    border-radius: 15px;
    font-size: 24px;
    font-weight: 600;
    cursor: pointer;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    justify-content: center;
}

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

.auth-btn-primary {
    background: var(--accent-color);
    color: #fff;
}

.auth-btn-primary:hover:not(:disabled) {
    background: var(--accent-hover);
}

.auth-btn-secondary {
    background: var(--error-color);
    color: #fff;
}

.auth-btn-secondary:hover:not(:disabled) {
    background: #dc2626;
}

/* 切换链接 */
.auth-switch {
    text-align: center;
    margin-top: 20px;
}

.auth-switch-link {
    font-size: 11px;
    color: #7379d0;
    cursor: pointer;
    transition: color var(--transition-fast);
}

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

/* ========== 注册弹窗（额外样式） ========== */
.register-modal {
    min-width: 456px;
    max-height: 90vh;
    overflow-y: auto;
}

.register-modal .auth-input-group {
    margin-bottom: 51px;
}

.register-modal .auth-input-group:last-of-type {
    margin-bottom: 30px;
}

.register-modal .auth-buttons {
    justify-content: center;
}

.register-modal .auth-btn {
    width: 100%;
    max-width: 167px;
}

/* ========== 迁移确认弹窗 ========== */
.migrate-modal {
    min-width: 420px;
    max-width: 480px;
}

.migrate-content {
    padding: 10px 0 20px;
}

.migrate-desc {
    font-size: 15px;
    color: var(--text-secondary);
    text-align: center;
    margin-bottom: 24px;
    line-height: 1.5;
}

.migrate-stats {
    display: flex;
    justify-content: center;
    gap: 32px;
    margin-bottom: 28px;
}

.migrate-stat-item {
    font-size: 14px;
    color: var(--text-secondary);
}

.migrate-stat-value {
    font-size: 24px;
    font-weight: 700;
    color: #fff;
    margin-right: 4px;
}

.migrate-range-section {
    margin-bottom: 20px;
}

.migrate-range-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: #828282;
    margin-bottom: 12px;
}

.migrate-range-wrapper {
    position: relative;
}

.migrate-range {
    width: 100%;
    height: 6px;
    -webkit-appearance: none;
    appearance: none;
    background: var(--bg-tertiary);
    border-radius: 3px;
    outline: none;
    cursor: pointer;
}

.migrate-range::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
    transition: transform 0.15s ease;
}

.migrate-range::-webkit-slider-thumb:hover {
    transform: scale(1.1);
}

.migrate-range::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--accent-color);
    border: none;
    border-radius: 50%;
    cursor: pointer;
    box-shadow: 0 2px 6px rgba(99, 102, 241, 0.4);
}

.migrate-range-labels {
    display: flex;
    justify-content: space-between;
    margin-top: 8px;
    font-size: 11px;
    color: #666;
}

.migrate-range-value {
    text-align: center;
    font-size: 14px;
    color: var(--accent-color);
    font-weight: 600;
    margin-top: 12px;
}

.migrate-warning {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 12px 16px;
    background: rgba(245, 158, 11, 0.1);
    border: 1px solid rgba(245, 158, 11, 0.3);
    border-radius: 8px;
    margin-top: 16px;
}

.migrate-warning svg {
    width: 18px;
    height: 18px;
    color: #f59e0b;
    flex-shrink: 0;
}

.migrate-warning span {
    font-size: 13px;
    color: #f59e0b;
    line-height: 1.4;
}

.migrate-modal .auth-buttons {
    gap: 20px;
}

.migrate-modal .auth-btn {
    min-width: 120px;
}

/* ========== 数据同步进度条 ========== */
.sync-progress-bar {
    position: fixed;
    top: 0;
    left: 280px;
    right: 0;
    height: 5px;
    background: rgba(255, 255, 255, 0.08);
    z-index: 3000; /* 高于 auth-overlay(2000) 和 modal(2001) */
    overflow: hidden;
    opacity: 0;
    visibility: hidden;
    transition: opacity var(--transition-fast);
    pointer-events: none;
}

.sync-progress-bar.active {
    opacity: 1;
    visibility: visible;
}

.sync-progress-fill {
    height: 100%;
    background: linear-gradient(90deg, #a3e635 0%, #4ade80 50%, #22c55e 100%);
    border-radius: 0 3px 3px 0;
    transition: width 0.3s ease;
    box-shadow: 0 0 10px rgba(74, 222, 128, 0.5);
}

/* 同步状态文字 */
.sync-status {
    position: fixed;
    top: 10px;
    left: 50%;
    transform: translateX(-50%);
    background: var(--bg-tertiary);
    padding: 8px 16px;
    border-radius: var(--radius-md);
    font-size: 13px;
    color: var(--text-primary);
    z-index: 3000; /* 高于 auth-overlay(2000) 和 modal(2001) */
    opacity: 0;
    visibility: hidden;
    transition: all var(--transition-fast);
    display: flex;
    align-items: center;
    gap: 8px;
    pointer-events: none;
}

.sync-status.active {
    opacity: 1;
    visibility: visible;
}

.sync-status .sync-icon {
    width: 16px;
    height: 16px;
    animation: spin 1s linear infinite;
}

.sync-status.done .sync-icon {
    animation: none;
    color: var(--success-color);
}

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

/* ========== 响应式 ========== */
@media (max-width: 768px) {
    .desktop-header {
        display: none;
    }

    .user-label {
        display: none;
    }

    .avatar-btn {
        width: 40px;
        height: 40px;
    }

    .user-dropdown {
        top: 60px;
        right: 10px;
        left: 10px;
        width: auto;
        max-width: 360px;
        padding: 20px;
        border-radius: 30px;
    }

    .user-welcome {
        font-size: 20px;
    }

    .logout-btn {
        width: 160px;
        height: 42px;
        font-size: 16px;
    }

    .auth-modal {
        min-width: auto;
        width: calc(100% - 32px);
        max-width: 400px;
        padding: 24px 24px 32px;
        border-radius: 30px;
    }

    .auth-title {
        font-size: 28px;
    }

    .auth-btn {
        width: 140px;
        height: 44px;
        font-size: 18px;
    }

    .auth-buttons {
        gap: 16px;
    }

    .sync-progress-bar {
        left: 0;
    }
}

/* 侧边栏隐藏时进度条全宽 */
@media (max-width: 768px) {
    .sync-progress-bar {
        left: 0;
    }
}
