/**
 * ============================================
 * 萍乡中学校园论坛 - 个人中心样式
 * ============================================
 * 页面专属样式，基于 forum-theme.css 变量
 * 注意：只包含页面特有样式，通用样式使用 forum-theme.css
 * ============================================
 */

/* 确保滚动条隐藏 */
html {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

html::-webkit-scrollbar {
    display: none !important;
}

body {
    scrollbar-width: none !important;
    -ms-overflow-style: none !important;
}

body::-webkit-scrollbar {
    display: none !important;
}

/* ========== 页面布局 ========== */
.profile-layout {
    display: flex;
    gap: var(--space-6);
    padding: var(--space-6) 0;
}

.profile-sidebar {
    width: 320px;
    flex-shrink: 0;
}

.profile-main {
    flex: 1;
    min-width: 0;
}

@media (max-width: 1024px) {
    .profile-layout {
        flex-direction: column;
    }

    .profile-sidebar {
        width: 100%;
    }
}

/* ========== 个人卡片 ========== */
.profile-card {
    /* 复用 .card 样式，只添加特有属性 */
    margin-bottom: var(--space-4);
}

/* ========== 用户信息卡片 ========== */
.user-info-card {
    text-align: center;
    padding: var(--space-6) var(--space-5);
}

/* 头像上传容器 */
.user-avatar-wrapper {
    position: relative;
    width: 100px;
    height: 100px;
    margin: 0 auto var(--space-4);
    border-radius: var(--radius-full);
    cursor: var(--cursor-pointer);
}

.user-avatar-large {
    width: 100px;
    height: 100px;
    border-radius: var(--radius-full);
    background: linear-gradient(135deg, var(--pz-purple-400), var(--pz-purple-600));
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 40px;
    font-weight: 600;
    box-shadow: var(--shadow-lg);
    overflow: hidden;
}

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

/* 头像上传遮罩层 */
.avatar-upload-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.5);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    color: white;
    opacity: 0;
    transition: opacity 0.3s ease;
    gap: 6px;
}

.avatar-upload-overlay svg {
    width: 28px;
    height: 28px;
    flex-shrink: 0;
}

.avatar-upload-overlay span {
    font-size: 12px;
    font-weight: 500;
    white-space: nowrap;
}

.user-avatar-wrapper:hover .avatar-upload-overlay {
    opacity: 1;
}

/* 头像上传进度 */
.avatar-upload-progress {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    border-radius: var(--radius-full);
    background: rgba(0, 0, 0, 0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    color: white;
    font-size: 14px;
    font-weight: 500;
}

.user-name {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
}

.user-id {
    font-size: 12px;
    color: var(--text-muted);
    margin-bottom: var(--space-3);
}

.user-badges {
    display: flex;
    justify-content: center;
    gap: var(--space-2);
    margin-bottom: var(--space-4);
}

/* badge 样式复用 .tag，只添加特有颜色 */
.badge-campus {
    background-color: var(--pz-purple-100);
    color: var(--pz-purple-700);
}

.badge-grade {
    background-color: var(--pz-green-100);
    color: var(--pz-green-700);
}

/* 个性化标签样式 */
.tag-study {
    background-color: var(--pz-green-100);
    color: var(--pz-green-700);
}

.tag-life {
    background-color: var(--pz-purple-100);
    color: var(--pz-purple-700);
}

.tag-gold {
    background-color: var(--pz-gold-100);
    color: var(--pz-gold-700);
}

.tag-music {
    background-color: var(--pz-red-100);
    color: var(--pz-red-700);
}

/* ========== 用户统计 ========== */
.user-stats {
    display: flex;
    justify-content: center;
    gap: var(--space-6);
    padding: var(--space-4) 0;
    border-top: 1px solid var(--border-color);
    border-bottom: 1px solid var(--border-color);
    margin-bottom: var(--space-4);
}

.stat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: var(--space-1);
}

.stat-value {
    font-size: 20px;
    font-weight: 700;
    color: var(--accent-primary);
}

.stat-label {
    font-size: 12px;
    color: var(--text-muted);
}

/* ========== 用户操作按钮 ========== */
.user-actions {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
}

.btn-block {
    width: 100%;
}

/* ========== 个人简介 ========== */
.user-bio {
    font-size: 14px;
    line-height: 1.6;
    color: var(--text-secondary);
    word-break: break-word;
}

/* ========== 个性化设置 ========== */
.preference-section {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.preference-item {
    display: flex;
    flex-direction: column;
    gap: var(--space-2);
    padding: var(--space-3);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: all var(--transition-fast);
}

.preference-item:hover {
    border-color: var(--accent-primary);
    box-shadow: var(--shadow-sm);
}

.preference-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.preference-item-title {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: var(--space-2);
}

.preference-item-title::before {
    content: '';
    width: 4px;
    height: 16px;
    background: linear-gradient(180deg, var(--accent-primary), var(--accent-secondary));
    border-radius: var(--radius-full);
}

.preference-tags {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-2);
    min-height: 32px;
}

.preference-tags:empty::before {
    content: '点击设置添加标签';
    font-size: 12px;
    color: var(--text-muted);
    font-style: italic;
}

.tag-secondary {
    background-color: var(--bg-tertiary);
    color: var(--text-muted);
}

/* 保存提示条 */
.save-hint-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: linear-gradient(90deg, var(--pz-purple-600), var(--pz-purple-500));
    color: white;
    padding: var(--space-4) var(--space-6);
    display: flex;
    align-items: center;
    justify-content: center;
    gap: var(--space-4);
    z-index: 10001;
    transform: translateY(100%);
    transition: transform 0.3s ease;
    box-shadow: 0 -4px 20px rgba(176, 58, 114, 0.3);
}

.save-hint-bar.show {
    transform: translateY(0);
}

.save-hint-text {
    font-size: 14px;
    font-weight: 500;
}

.save-hint-bar .btn {
    padding: var(--space-2) var(--space-4);
    font-size: 13px;
    font-weight: 600;
}

.save-hint-bar .btn-primary {
    background: white;
    color: var(--accent-primary);
}

.save-hint-bar .btn-primary:hover {
    background: var(--pz-purple-50);
}

.save-hint-bar .btn-secondary {
    background: rgba(255, 255, 255, 0.2);
    color: white;
    border: 1px solid rgba(255, 255, 255, 0.3);
}

.save-hint-bar .btn-secondary:hover {
    background: rgba(255, 255, 255, 0.3);
}

/* ========== 标签页导航 ========== */
.profile-tabs {
    display: flex;
    gap: var(--space-1);
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    padding: var(--space-1);
    margin-bottom: var(--space-4);
    border: 1px solid var(--border-color);
}

.profile-tab {
    flex: 1;
    padding: var(--space-3) var(--space-4);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: var(--cursor-pointer);
    transition: all var(--transition-fast);
}

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

.profile-tab.active {
    background-color: var(--accent-primary);
    color: white;
}

/* ========== 标签页内容 ========== */
.tab-content {
    display: none;
}

.tab-content.active {
    display: block;
    animation: fadeIn 0.3s ease;
}

.content-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-4);
}

.content-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

/* ========== 筛选标签 ========== */
.filter-tabs {
    display: flex;
    gap: var(--space-2);
}

.filter-tab {
    padding: var(--space-1) var(--space-3);
    font-size: 13px;
    color: var(--text-secondary);
    background: transparent;
    border: 1px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: var(--cursor-pointer);
    transition: all var(--transition-fast);
}

.filter-tab:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
}

.filter-tab.active {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
}

/* ========== 帖子列表 ========== */
.post-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-4);
}

.post-item {
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    padding: var(--space-5);
    transition: box-shadow var(--transition-base);
}

.post-item:hover {
    box-shadow: var(--shadow-md);
}

.post-item-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: var(--space-3);
}

.post-item-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.post-item-title:hover {
    color: var(--accent-primary);
}

.post-item-excerpt {
    font-size: 14px;
    color: var(--text-secondary);
    line-height: 1.6;
    margin-bottom: var(--space-3);
    display: -webkit-box;
    -webkit-line-clamp: 2;
    line-clamp: 2;
    -webkit-box-orient: vertical;
    box-orient: vertical;
    overflow: hidden;
}

.post-item-meta {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    font-size: 13px;
    color: var(--text-muted);
}

.post-item-actions {
    display: flex;
    gap: var(--space-2);
}

.post-status {
    display: inline-flex;
    align-items: center;
    padding: 2px var(--space-2);
    font-size: 11px;
    font-weight: 500;
    border-radius: var(--radius-sm);
}

.post-status-published {
    background-color: var(--pz-green-100);
    color: var(--pz-green-700);
}

.post-status-draft {
    background-color: var(--bg-secondary);
    color: var(--text-muted);
}

/* ========== 历史记录列表 ========== */
.history-list {
    display: flex;
    flex-direction: column;
    gap: var(--space-3);
}

.history-item {
    display: flex;
    align-items: center;
    gap: var(--space-4);
    padding: var(--space-4);
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    transition: box-shadow var(--transition-base);
}

.history-item:hover {
    box-shadow: var(--shadow-md);
}

.history-item-content {
    flex: 1;
    min-width: 0;
}

.history-item-title {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.history-item-meta {
    font-size: 12px;
    color: var(--text-muted);
}

.history-item-time {
    font-size: 12px;
    color: var(--text-muted);
    white-space: nowrap;
}

/* ========== 设置区域 ========== */
.settings-section {
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
    margin-bottom: var(--space-4);
    overflow: hidden;
}

.settings-title {
    font-size: 16px;
    font-weight: 600;
    color: var(--text-primary);
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

.settings-list {
    padding: var(--space-2) 0;
}

.settings-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-4) var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.settings-item:last-child {
    border-bottom: none;
}

.settings-info {
    display: flex;
    flex-direction: column;
    gap: var(--space-1);
}

.settings-label {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
}

.settings-desc {
    font-size: 12px;
    color: var(--text-muted);
}

.settings-select {
    width: auto;
    min-width: 120px;
}

/* ========== 开关组件 ========== */
.switch {
    position: relative;
    display: inline-block;
    width: 48px;
    height: 24px;
}

.switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.switch-slider {
    position: absolute;
    cursor: var(--cursor-pointer);
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: var(--border-color);
    transition: var(--transition-fast);
    border-radius: var(--radius-full);
}

.switch-slider:before {
    position: absolute;
    content: "";
    height: 18px;
    width: 18px;
    left: 3px;
    bottom: 3px;
    background-color: white;
    transition: var(--transition-fast);
    border-radius: 50%;
}

.switch input:checked + .switch-slider {
    background-color: var(--accent-primary);
}

.switch input:checked + .switch-slider:before {
    transform: translateX(24px);
}

/* ========== 模态框 ========== */
.modal {
    display: flex;
    position: fixed;
    inset: 0;
    z-index: 10000;
    align-items: center;
    justify-content: center;
    pointer-events: none;
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active {
    pointer-events: auto;
    opacity: 1;
}

.modal-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.5);
    backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity 0.3s ease;
}

.modal.active .modal-overlay {
    opacity: 1;
}

.modal-content {
    position: relative;
    width: 100%;
    max-width: 600px;
    max-height: 85vh;
    background-color: var(--bg-tertiary);
    border-radius: var(--radius-xl);
    box-shadow: var(--shadow-xl);
    overflow: hidden;
    margin: var(--space-4);
    transform: scale(0.9) translateY(20px);
    opacity: 0;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

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

.modal.closing .modal-content {
    transform: scale(0.95) translateY(10px);
    opacity: 0;
}

.modal.closing .modal-overlay {
    opacity: 0;
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: var(--space-5);
    border-bottom: 1px solid var(--border-color);
}

.modal-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 24px;
    color: var(--text-muted);
    background: transparent;
    border: none;
    border-radius: var(--radius-md);
    cursor: var(--cursor-pointer);
    transition: all var(--transition-fast);
}

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

.modal-body {
    padding: var(--space-5);
    overflow-y: auto;
    max-height: 60vh;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: var(--space-3);
    padding: var(--space-4) var(--space-5);
    border-top: 1px solid var(--border-color);
    background-color: var(--bg-secondary);
}

/* ========== 表单样式 ========== */
.form-group {
    margin-bottom: var(--space-4);
}

.form-group:last-child {
    margin-bottom: 0;
}

.form-label {
    display: block;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: var(--space-2);
}

.form-hint {
    display: block;
    font-size: 12px;
    color: var(--text-muted);
    margin-top: var(--space-1);
}

/* ========== 个性化选项 ========== */
.preference-options {
    display: flex;
    flex-wrap: wrap;
    gap: var(--space-3);
    max-height: 400px;
    overflow-y: auto;
    padding: var(--space-4);
    background-color: var(--bg-secondary);
    border-radius: var(--radius-lg);
    border: 1px solid var(--border-color);
}

.preference-options::-webkit-scrollbar {
    width: 6px;
}

.preference-options::-webkit-scrollbar-track {
    background: var(--bg-tertiary);
    border-radius: var(--radius-full);
}

.preference-options::-webkit-scrollbar-thumb {
    background: var(--accent-primary);
    border-radius: var(--radius-full);
}

.preference-option {
    display: inline-flex;
    align-items: center;
    padding: var(--space-2) var(--space-4);
    font-size: 14px;
    color: var(--text-secondary);
    background-color: var(--bg-tertiary);
    border: 2px solid var(--border-color);
    border-radius: var(--radius-full);
    cursor: var(--cursor-pointer);
    transition: all var(--transition-fast);
    user-select: none;
}

.preference-option:hover {
    border-color: var(--accent-primary);
    color: var(--accent-primary);
    transform: translateY(-2px);
    box-shadow: var(--shadow-sm);
}

.preference-option.selected {
    background-color: var(--accent-primary);
    border-color: var(--accent-primary);
    color: white;
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.preference-option.selected:hover {
    background-color: var(--pz-purple-600);
    border-color: var(--pz-purple-600);
}

/* ========== 加载更多 ========== */
.load-more {
    text-align: center;
    padding: var(--space-6) 0;
}

/* ========== 空状态 ========== */
.empty-state {
    text-align: center;
    padding: var(--space-10) var(--space-5);
}

.empty-state-icon {
    width: 80px;
    height: 80px;
    margin: 0 auto var(--space-4);
    color: var(--text-muted);
}

.empty-state-text {
    font-size: 14px;
    color: var(--text-muted);
}

/* ========== 音乐播放器占位提示 ========== */
.music-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 40px 20px;
    text-align: center;
}

.music-placeholder-icon {
    color: var(--text-tertiary);
    margin-bottom: 16px;
}

.music-placeholder-text {
    font-size: 16px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.music-placeholder-hint {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

/* ========== 动画 ========== */
@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-20px) scale(0.95);
    }
    to {
        opacity: 1;
        transform: translateY(0) scale(1);
    }
}

/* ========== 页脚 ========== */
.footer {
    background-color: var(--bg-tertiary);
    border-top: 1px solid var(--border-color);
    padding: var(--space-4) 0;
    margin-top: var(--space-8);
}

.footer-content {
    display: flex;
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
    gap: var(--space-4);
}

.footer-logo {
    display: flex;
    align-items: center;
    gap: var(--space-2);
    font-size: 16px;
    font-weight: 700;
    color: var(--accent-primary);
    flex-shrink: 0;
}

.footer-logo .navbar-logo {
    width: 28px;
    height: 28px;
}

.footer-links {
    display: flex;
    gap: var(--space-4);
    flex-wrap: wrap;
    justify-content: center;
}

.footer-link {
    font-size: 13px;
    color: var(--text-secondary);
    white-space: nowrap;
}

.footer-link:hover {
    color: var(--accent-primary);
}

.footer-copyright {
    font-size: 12px;
    color: var(--text-muted);
    flex-shrink: 0;
    white-space: nowrap;
}

/* ========== 深色模式适配 ========== */
[data-theme="dark"] .profile-card,
[data-theme="dark"] .post-item,
[data-theme="dark"] .history-item,
[data-theme="dark"] .settings-section {
    background-color: var(--neutral-800);
}

[data-theme="dark"] .settings-title {
    background-color: var(--neutral-900);
}

[data-theme="dark"] .modal-footer {
    background-color: var(--neutral-900);
}

/* ========== 响应式适配 ========== */
@media (max-width: 768px) {
    .footer-content {
        flex-direction: column;
        text-align: center;
        gap: var(--space-3);
    }

    .footer-links {
        flex-wrap: wrap;
        justify-content: center;
        gap: var(--space-3) var(--space-4);
    }
}
