/* ==================== 论坛页面样式 ==================== */
.forum-page {
    padding: 100px 4rem 4rem;
    min-height: 100vh;
}

.forum-header {
    text-align: center;
    margin-bottom: 3rem;
}

.page-title {
    font-size: 2.5rem;
    margin-bottom: 0.5rem;
}

.page-title .icon {
    color: var(--primary);
}

.page-desc {
    color: var(--text-secondary);
    margin-bottom: 1.5rem;
}

.btn-create-post {
    padding: 0.8rem 2rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 25px;
    color: white;
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
}

.btn-create-post:hover {
    transform: translateY(-3px);
    box-shadow: var(--glow);
}

/* ==================== 帖子列表 ==================== */
.posts-container {
    max-width: 900px;
    margin: 0 auto;
}

.loading {
    text-align: center;
    padding: 3rem;
    color: var(--text-secondary);
}

.loading-spinner {
    width: 50px;
    height: 50px;
    border: 3px solid var(--border-color);
    border-top-color: var(--primary);
    border-radius: 50%;
    margin: 0 auto 1rem;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    to { transform: rotate(360deg); }
}

.post-card {
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    padding: 1.5rem;
    margin-bottom: 1rem;
    cursor: pointer;
    transition: all 0.3s ease;
}

.post-card:hover {
    background: var(--bg-card-hover);
    border-color: var(--primary);
    transform: translateX(10px);
}

.post-card-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 0.8rem;
}

.post-title {
    font-size: 1.3rem;
    font-weight: 600;
    color: var(--text-primary);
    flex: 1;
}

.post-delete-btn {
    background: rgba(255, 107, 107, 0.2);
    border: 1px solid #ff6b6b;
    color: #ff6b6b;
    padding: 0.3rem 0.8rem;
    border-radius: 15px;
    font-size: 0.8rem;
    cursor: pointer;
    transition: all 0.3s;
    margin-left: 1rem;
}

.post-delete-btn:hover {
    background: #ff6b6b;
    color: white;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    color: var(--text-secondary);
    font-size: 0.9rem;
    margin-bottom: 0.8rem;
}

.post-author {
    display: flex;
    align-items: center;
    gap: 0.3rem;
}

.post-author .author-name {
    color: var(--primary);
    font-weight: 500;
}

.post-author .admin-tag {
    background: linear-gradient(135deg, #ff6b6b, #ee5a24);
    padding: 0.1rem 0.5rem;
    border-radius: 10px;
    font-size: 0.75rem;
    color: white;
}

.post-preview {
    color: var(--text-secondary);
    line-height: 1.6;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.post-footer {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-top: 1rem;
    padding-top: 1rem;
    border-top: 1px solid var(--border-color);
    color: var(--text-secondary);
    font-size: 0.85rem;
}

.empty-state {
    text-align: center;
    padding: 4rem 2rem;
    color: var(--text-secondary);
}

.empty-state .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

/* ==================== 模态框扩展 ==================== */
.modal-large {
    max-width: 700px;
}

.post-detail {
    max-height: 70vh;
    overflow-y: auto;
}

.post-detail .post-meta {
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    margin-bottom: 1.5rem;
}

.post-detail .post-content {
    line-height: 1.8;
    white-space: pre-wrap;
    margin-bottom: 2rem;
    padding: 1rem;
    background: rgba(0, 0, 0, 0.1);
    border-radius: 10px;
}

.replies-section {
    border-top: 1px solid var(--border-color);
    padding-top: 1.5rem;
}

.replies-section h3 {
    margin-bottom: 1rem;
    color: var(--primary);
}

.replies-list {
    margin-bottom: 1.5rem;
}

.reply-item {
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
    padding: 1rem;
    margin-bottom: 0.8rem;
}

.reply-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
    font-size: 0.9rem;
}

.reply-author {
    color: var(--primary);
    font-weight: 500;
}

.reply-date {
    color: var(--text-secondary);
}

.reply-content {
    color: var(--text-secondary);
    line-height: 1.6;
}

.login-hint {
    text-align: center;
    color: var(--text-secondary);
    padding: 1rem;
    background: rgba(0, 0, 0, 0.2);
    border-radius: 10px;
}

.login-hint a {
    color: var(--primary);
    text-decoration: none;
}

.login-hint a:hover {
    text-decoration: underline;
}

/* ==================== 私信页面样式 ==================== */
.messages-page {
    padding: 100px 2rem 2rem;
    min-height: 100vh;
    display: flex;
    flex-direction: column;
}

.messages-container {
    flex: 1;
    display: flex;
    gap: 1rem;
    max-width: 1200px;
    margin: 0 auto;
    width: 100%;
}

/* 好友列表侧边栏 */
.friends-sidebar {
    width: 300px;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.friends-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.friends-header h3 {
    margin-bottom: 1rem;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.add-friend-form {
    display: flex;
    gap: 0.5rem;
}

.add-friend-form input {
    flex: 1;
    padding: 0.5rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 8px;
    color: var(--text-primary);
    font-size: 0.9rem;
}

.add-friend-form input:focus {
    outline: none;
    border-color: var(--primary);
}

.add-friend-form button {
    padding: 0.5rem 1rem;
    background: var(--primary);
    border: none;
    border-radius: 8px;
    color: var(--bg-dark);
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.add-friend-form button:hover {
    background: var(--primary-dark);
}

.friends-list {
    flex: 1;
    overflow-y: auto;
}

.friend-item {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    cursor: pointer;
    transition: all 0.3s;
    display: flex;
    align-items: center;
    gap: 0.8rem;
}

.friend-item:hover, .friend-item.active {
    background: rgba(0, 212, 255, 0.1);
}

.friend-item.active {
    border-left: 3px solid var(--primary);
}

.friend-avatar {
    width: 40px;
    height: 40px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    font-weight: bold;
    overflow: hidden;
}

.friend-avatar img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.friend-info {
    flex: 1;
}

.friend-name {
    font-weight: 500;
}

.friend-id {
    font-size: 0.8rem;
    color: var(--text-secondary);
}

/* 聊天区域 */
.chat-area {
    flex: 1;
    background: var(--bg-card);
    border: 1px solid var(--border-color);
    border-radius: 15px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.chat-header {
    padding: 1rem;
    border-bottom: 1px solid var(--border-color);
    display: flex;
    align-items: center;
    gap: 1rem;
}

.chat-header h3 {
    flex: 1;
}

.chat-messages {
    flex: 1;
    overflow-y: auto;
    padding: 1rem;
    display: flex;
    flex-direction: column;
    gap: 0.8rem;
}

.message-item {
    max-width: 70%;
    padding: 0.8rem 1rem;
    border-radius: 15px;
    line-height: 1.5;
}

.message-item.sent {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    align-self: flex-end;
    border-bottom-right-radius: 5px;
}

.message-item.received {
    background: rgba(0, 0, 0, 0.3);
    align-self: flex-start;
    border-bottom-left-radius: 5px;
}

.message-time {
    font-size: 0.75rem;
    opacity: 0.7;
    margin-top: 0.3rem;
}

.chat-input {
    padding: 1rem;
    border-top: 1px solid var(--border-color);
    display: flex;
    gap: 0.8rem;
}

.chat-input input {
    flex: 1;
    padding: 0.8rem 1rem;
    background: rgba(0, 0, 0, 0.3);
    border: 1px solid var(--border-color);
    border-radius: 25px;
    color: var(--text-primary);
    font-size: 1rem;
}

.chat-input input:focus {
    outline: none;
    border-color: var(--primary);
}

.chat-input button {
    padding: 0.8rem 1.5rem;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border: none;
    border-radius: 25px;
    color: white;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s;
}

.chat-input button:hover {
    transform: scale(1.05);
}

.chat-placeholder {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-secondary);
    text-align: center;
}

.chat-placeholder .icon {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.user-id-display {
    background: rgba(0, 0, 0, 0.3);
    padding: 1rem;
    border-radius: 10px;
    margin-bottom: 1rem;
    text-align: center;
}

.user-id-display .label {
    color: var(--text-secondary);
    font-size: 0.9rem;
}

.user-id-display .id {
    color: var(--primary);
    font-size: 1.2rem;
    font-weight: bold;
    font-family: monospace;
}

/* ==================== 响应式 ==================== */
@media (max-width: 768px) {
    .forum-page {
        padding: 100px 0.8rem 2rem;
    }
    
    .forum-header {
        flex-direction: column;
        gap: 1rem;
        text-align: center;
    }
    
    .forum-header h1 {
        font-size: 1.5rem;
    }
    
    .btn-create {
        width: 100%;
        padding: 0.8rem;
    }
    
    .post-card {
        padding: 1rem;
    }
    
    .post-title {
        font-size: 1rem;
    }
    
    .post-meta {
        flex-wrap: wrap;
        font-size: 0.8rem;
    }
    
    .messages-container {
        flex-direction: column;
        height: auto;
    }
    
    .friends-sidebar {
        width: 100%;
        max-height: 250px;
        border-right: none;
        border-bottom: 1px solid var(--border-color);
    }
    
    .chat-area {
        min-height: 400px;
    }
    
    .chat-header {
        padding: 0.8rem;
    }
    
    .chat-input {
        flex-direction: column;
        gap: 0.5rem;
        padding: 0.8rem;
    }
    
    .chat-input input {
        width: 100%;
    }
    
    .chat-input button {
        width: 100%;
    }
    
    .add-friend-input {
        flex-direction: column;
        gap: 0.5rem;
    }
    
    .add-friend-input input {
        width: 100%;
    }
    
    .add-friend-input button {
        width: 100%;
    }
    
    /* 帖子详情模态框 */
    .post-detail-modal .modal-content {
        width: 95%;
        padding: 1rem;
        max-height: 85vh;
    }
    
    .post-detail h2 {
        font-size: 1.2rem;
    }
    
    .reply-item {
        padding: 0.8rem;
    }
    
    .reply-form textarea {
        min-height: 80px;
    }
}

@media (max-width: 480px) {
    .forum-page {
        padding: 90px 0.5rem 1.5rem;
    }
    
    .forum-header h1 {
        font-size: 1.3rem;
    }
    
    .post-card {
        padding: 0.8rem;
    }
    
    .post-title {
        font-size: 0.95rem;
    }
    
    .post-preview {
        font-size: 0.85rem;
    }
    
    .friend-item {
        padding: 0.6rem;
    }
    
    .friend-avatar {
        width: 35px;
        height: 35px;
        font-size: 0.9rem;
    }
    
    .chat-messages {
        padding: 0.8rem;
    }
    
    .message-item {
        max-width: 90%;
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
}
