/* 基础样式 */
:root {
    --primary-color: #2c3e50;
    --secondary-color: #3498db;
    --success-color: #27ae60;
    --warning-color: #f39c12;
    --danger-color: #e74c3c;
    --light-color: #ecf0f1;
    --dark-color: #2c3e50;
    --border-radius: 8px;
    --box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    --transition: all 0.3s ease;
}

* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f8f9fa;
}

.hidden {
    display: none !important;
}

/* 按钮样式 */
.btn {
    padding: 0.6rem 1.2rem;
    border: none;
    border-radius: var(--border-radius);
    cursor: pointer;
    font-weight: 600;
    transition: var(--transition);
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-primary {
    background: var(--secondary-color);
    color: white;
}

.btn-secondary {
    background: #6c757d;
    color: white;
}

.btn-outline {
    background: transparent;
    color: var(--secondary-color);
    border: 2px solid var(--secondary-color);
}

.btn-outline:hover {
    background: var(--secondary-color);
    color: white;
}

.btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

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

/* 论坛页面样式 */
#forum-page {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: linear-gradient(135deg, #f5f7fa 0%, #c3cfe2 100%);
    z-index: 2000;
    overflow-y: auto;
}

.forum-header {
    background: var(--primary-color);
    color: white;
    padding: 12px 20px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    box-shadow: var(--box-shadow);
    min-height: 56px;
    white-space: nowrap;
    overflow: hidden;
    position: relative;
}

.forum-header h2 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    padding: 0 10px;
    flex: 1;
    text-align: center;
    margin-left: 0;
    margin-right: 0;
}

.forum-header .btn-secondary {
    white-space: nowrap;
    min-width: 100px;
    z-index: 10;
    margin-right: auto;
}

.forum-header .btn-primary {
    white-space: nowrap;
    min-width: 120px;
    z-index: 10;
    margin-left: auto;
    margin-right: 0;
}

.forum-header .btn-outline {
    white-space: nowrap;
    min-width: 100px;
    z-index: 10;
}

.header-actions {
    display: flex;
    gap: 10px;
    align-items: center;
}

.forum-container {
    padding: 20px;
    max-width: 1000px;
    margin: 0 auto;
}

.forums-list {
    display: grid;
    gap: 20px;
    grid-template-columns: repeat(auto-fit, minmax(300px, 1fr));
}

.forum-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 20px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--box-shadow);
}

.forum-item:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    background: #fff;
}

.forum-item h3 {
    margin: 0 0 10px 0;
    color: var(--dark-color);
    font-size: 1.3rem;
}

.forum-item p {
    margin: 0 0 15px 0;
    color: #6c757d;
    line-height: 1.5;
}

.forum-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9rem;
    color: #6c757d;
}

.topics-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.topics-header h3 {
    margin: 0;
    color: var(--dark-color);
    font-size: 1.5rem;
}

.new-btn {
    background: var(--primary-color);
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 500;
    transition: background 0.3s;
}

.new-btn:hover {
    background: var(--secondary-color);
}

.topic-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: var(--box-shadow);
}

.topic-item:hover {
    box-shadow: 0 2px 15px rgba(0, 0, 0, 0.15);
    border-color: var(--primary-color);
}

.topic-item h3,
.topic-item h4 {
    margin: 0 0 8px 0;
    color: var(--dark-color);
    font-size: 1.1rem;
}

.topic-item .topic-link {
    color: inherit;
    text-decoration: none;
    display: inline-block;
    transition: color 0.3s ease;
}

.topic-item .topic-link:hover {
    color: var(--secondary-color);
}

.topic-meta {
    display: flex;
    gap: 15px;
    font-size: 0.85rem;
    color: #6c757d;
}

.topic-stats {
    display: flex;
    gap: 15px;
    margin-top: 10px;
    font-size: 0.8rem;
    color: #6c757d;
}

.topic-header {
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #e9ecef;
}

.topic-header h2,
.topic-header h3 {
    margin: 0 0 10px 0;
    color: var(--dark-color);
    font-size: 1.6rem;
    line-height: 1.4;
}

.topic-content {
    background: white;
    border-radius: var(--border-radius);
    padding: 20px;
    margin-bottom: 20px;
    line-height: 1.6;
    box-shadow: var(--box-shadow);
}

.replies-section h4 {
    margin: 0 0 15px 0;
    color: var(--dark-color);
    font-size: 1.2rem;
}

.reply-item {
    background: white;
    border: 1px solid #e9ecef;
    border-radius: var(--border-radius);
    padding: 15px;
    margin-bottom: 15px;
    box-shadow: var(--box-shadow);
}

.reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    font-size: 0.9rem;
    color: #6c757d;
}

.reply-content {
    line-height: 1.6;
}

.reply-form {
    margin-top: 20px;
}

.reply-form textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
    margin-bottom: 10px;
    resize: vertical;
}

.no-topics, .no-replies {
    text-align: center;
    padding: 20px;
    color: #6c757d;
    font-style: italic;
}

/* 模态框样式 */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 3000;
    overflow-y: auto;
}

.modal-content {
    background-color: white;
    margin: 10% auto;
    padding: 0;
    border-radius: var(--border-radius);
    width: 90%;
    max-width: 600px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
}

.modal-header {
    padding: 15px 20px;
    background-color: var(--primary-color);
    color: white;
    border-radius: var(--border-radius) var(--border-radius) 0 0;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.modal-header h3 {
    margin: 0;
}

.close {
    color: white;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    background: none;
    border: none;
}

.close:hover {
    opacity: 0.7;
}

.modal-body {
    padding: 20px;
}

.modal-footer {
    padding: 15px 20px;
    background-color: #f8f9fa;
    border-radius: 0 0 var(--border-radius) var(--border-radius);
    display: flex;
    justify-content: flex-end;
    gap: 10px;
}

.form-group {
    margin-bottom: 15px;
}

.form-group label {
    display: block;
    margin-bottom: 5px;
    font-weight: 600;
}

.form-group input,
.form-group textarea {
    width: 100%;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: var(--border-radius);
}

.form-group textarea {
    resize: vertical;
    min-height: 100px;
}

/* 加载动画 */
.loading {
    display: flex;
    justify-content: center;
    align-items: center;
    padding: 40px;
}

.spinner {
    width: 40px;
    height: 40px;
    border: 4px solid rgba(0, 0, 0, 0.1);
    border-radius: 50%;
    border-top-color: var(--secondary-color);
    animation: spin 1s ease-in-out infinite;
}

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

/* 响应式设计 */
@media (max-width: 768px) {
    .forum-header {
        flex-direction: column;
        gap: 10px;
        text-align: center;
    }
    
    .forum-header h2 {
        font-size: 1.5rem;
    }
    
    .forum-container {
        padding: 10px;
    }
    
    .forums-list {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        width: 95%;
        margin: 5% auto;
    }
    
    .topic-meta {
        flex-direction: column;
        gap: 5px;
    }
    
    .topic-stats {
        flex-wrap: wrap;
    }
}

@media (max-width: 576px) {
    .forum-header h2 {
        font-size: 1.2rem;
    }
    
    .btn {
        padding: 0.5rem 0.8rem;
        font-size: 0.8rem;
    }
    
    .forum-item {
        padding: 15px;
    }
    
    .forum-item h3 {
        font-size: 1.1rem;
    }
    
    .topic-item {
        padding: 10px;
    }
    
    .topic-item h3,
    .topic-item h4 {
        font-size: 1rem;
    }
    
    .modal-body {
        padding: 15px;
    }
}


/* 图片预览样式 */
.images-preview {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.image-preview-item {
    position: relative;
    width: 100px;
    height: 100px;
    border: 2px solid #ddd;
    border-radius: var(--border-radius);
    overflow: hidden;
    flex-shrink: 0;
}

.image-preview-item img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.remove-image {
    position: absolute;
    top: 2px;
    right: 2px;
    background: rgba(255, 0, 0, 0.8);
    color: white;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    line-height: 1;
}

.remove-image:hover {
    background: rgba(255, 0, 0, 1);
}

/* 内容中的图片样式 */
.topic-content img,
.reply-content img {
    max-width: 100%;
    height: auto;
    border-radius: var(--border-radius);
    margin: 10px 0;
    box-shadow: var(--box-shadow);
}

/* 确保图片不会溢出容器 */
.topic-content,
.reply-content {
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.topic-content *,
.reply-content * {
    max-width: 100%;
}


/* 管理员操作按钮样式 */
.admin-actions {
    display: flex;
    gap: 5px;
    margin-left: auto;
    align-items: center;
}

.admin-actions .btn {
    padding: 4px 8px;
    font-size: 0.8rem;
    border-radius: 4px;
    min-width: auto;
}

.admin-actions .btn-sm {
    padding: 3px 6px;
    font-size: 0.75rem;
}

.admin-actions .btn-danger {
    background: var(--danger-color);
    color: white;
}

.admin-actions .btn-warning {
    background: var(--warning-color);
    color: white;
}

.admin-actions .btn:hover {
    transform: translateY(-1px);
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.2);
}

/* 主题列表中的管理员按钮 */
.topic-item .admin-actions {
    margin-left: 10px;
}

.topic-header .admin-actions {
    margin-top: 10px;
}

/* 回复中的管理员按钮 */
.reply-header .admin-actions {
    margin-left: 10px;
}

/* 管理员模式样式 */
.admin-mode .topic-item,
.admin-mode .reply-item {
    border-left: 3px solid var(--warning-color);
}

/* 响应式设计中的管理员按钮 */
@media (max-width: 768px) {
    .admin-actions {
        flex-direction: column;
        gap: 3px;
    }
    
    .admin-actions .btn {
        padding: 2px 4px;
        font-size: 0.7rem;
    }
    
    .topic-header .admin-actions {
        margin-top: 5px;
    }
}

@media (max-width: 576px) {
    .admin-actions {
        flex-direction: row;
        flex-wrap: wrap;
    }
    
    .admin-actions .btn {
        padding: 1px 3px;
        font-size: 0.65rem;
    }
    
    .admin-actions .btn i {
        margin-right: 2px;
    }
}