/* ============================================
   世纪集团 - 主样式表（完整版）
   包含：全局样式 + 像素风格 + 论坛样式
============================================ */

/* ============================================
   1. 全局重置与基础样式
============================================ */
* {
    box-sizing: border-box;
    image-rendering: pixelated;
    margin: 0;
    padding: 0;
}

body {
    background-color: #1a2b1f;
    background-image: 
        linear-gradient(rgba(70, 100, 60, 0.2) 2px, transparent 2px)
        linear-gradient(90deg, rgba(70, 100, 60, 0.2) 2px, transparent 2px);
    background-size: 32px 32px;
    font-family: 'Courier New', 'VT323', 'Press Start 2P', monospace;
    color: #e0f0d0;
    line-height: 1.6;
    min-height: 100vh;
    padding: 20px;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
}

/* ============================================
   2. 像素盒子组件
============================================ */
.pixel-box {
    background: #2d3825;
    border: 4px solid #6b8c4a;
    border-color: #8bb56a #3a5a2a #3a5a2a #8bb56a;
    padding: 20px;
    margin-bottom: 20px;
    box-shadow: 8px 8px 0 #1a2a1a;
}

/* ============================================
   3. 标题样式
============================================ */
h1, h2, h3, h4 {
    font-weight: normal;
    text-transform: uppercase;
    letter-spacing: 2px;
    text-shadow: 3px 3px 0 #1e3a1e;
    border-bottom: 4px solid #5a7a4a;
    padding-bottom: 10px;
    margin: 0 0 20px 0;
    color: #ffffb0;
}

h1 { font-size: 2rem; }
h2 { font-size: 1.6rem; }
h3 { font-size: 1.3rem; }
h4 { font-size: 1.1rem; }

/* ============================================
   4. 头部区域
============================================ */
.grass-header {
    background: linear-gradient(0deg, #3c6a24, #6ca84c);
    border: 4px solid #2a4a1a;
    padding: 15px 25px;
    margin-bottom: 30px;
    box-shadow: 8px 8px 0 #0f2a0a;
    display: flex;
    align-items: center;
    justify-content: space-between;
    flex-wrap: wrap;
}

.logo-area {
    display: flex;
    align-items: center;
    gap: 15px;
}

.minecraft-block {
    width: 64px;
    height: 64px;
    background: #8b6b4d;
    border: 4px solid #5b3e25;
    text-align: center;
    line-height: 56px;
    font-size: 40px;
}

.site-title {
    font-size: 2rem;
    color: #ffffa0;
    text-shadow: 4px 4px 0 #3a5a1a;
    line-height: 1.2;
}

.site-slogan {
    color: #d0f0b0;
    font-size: 0.9rem;
}

/* ============================================
   5. 用户信息区域
============================================ */
.user-info {
    background: #2a3a22;
    border: 3px solid #5a7a3a;
    padding: 10px 20px;
    display: flex;
    align-items: center;
    gap: 15px;
    flex-wrap: wrap;
}

.user-avatar {
    width: 32px;
    height: 32px;
    background: #4a6a3a;
    border: 2px solid #8bb56a;
    image-rendering: pixelated;
}

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

.username {
    color: #ffffa0;
    font-weight: bold;
}

/* ============================================
   6. 导航菜单
============================================ */
.nav-menu {
    display: flex;
    gap: 5px;
    flex-wrap: wrap;
    padding: 10px;
    background: #2d3825;
    border: 4px solid #6b8c4a;
    border-color: #8bb56a #3a5a2a #3a5a2a #8bb56a;
    margin-bottom: 20px;
    box-shadow: 8px 8px 0 #1a2a1a;
}

.nav-item {
    background: #2a3a22;
    border: 3px solid #4a6a3a;
    color: #e0f0d0;
    padding: 8px 20px;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.1s;
    position: relative;
}

.nav-item:hover {
    background: #3a5a2a;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 #1a2a1a;
}

.nav-item.active {
    background: #4a6a3a;
    border-color: #8bb56a;
    color: #ffffa0;
}

.unread-badge {
    position: absolute;
    top: -5px;
    right: -5px;
    background: #ff5500;
    color: white;
    font-size: 0.7rem;
    padding: 2px 6px;
    border-radius: 10px;
    border: 2px solid #ffaa00;
}

/* ============================================
   7. 按钮样式
============================================ */
.pixel-btn {
    background: #7c5e3a;
    border: 4px solid #a57c4a;
    border-color: #c6a06a #5a3e1a #5a3e1a #c6a06a;
    color: #fff3d1;
    font-family: inherit;
    font-size: 0.9rem;
    padding: 8px 16px;
    text-shadow: 2px 2px 0 #3f2b1c;
    cursor: pointer;
    transition: 0.1s;
    text-decoration: none;
    display: inline-block;
    margin: 2px;
}

.pixel-btn:hover {
    background: #9b7a4c;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 #2a3a1a;
}

.pixel-btn:active {
    transform: translate(2px, 2px);
    box-shadow: none;
}

.pixel-btn.small {
    padding: 4px 8px;
    font-size: 0.8rem;
}

.pixel-btn.danger {
    background: #8b3a3a;
    border-color: #b55a5a #4a1a1a #4a1a1a #b55a5a;
}

.pixel-btn.success {
    background: #3a7a3a;
    border-color: #5aa55a #2a4a2a #2a4a2a #5aa55a;
}

.pixel-btn.admin-btn {
    background: #8b5a2a;
    border-color: #c68a3a #5a3e1a #5a3e1a #c68a3a;
}

/* ============================================
   8. 网格布局
============================================ */
.grid-2 {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 20px;
}

.grid-3 {
    display: grid;
    grid-template-columns: repeat(3, 1fr);
    gap: 20px;
}

.grid-4 {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 15px;
}

/* ============================================
   9. 表单样式
============================================ */
.form-group {
    margin-bottom: 20px;
}

label {
    display: block;
    margin-bottom: 8px;
    color: #b8d9a0;
    font-weight: bold;
    font-size: 0.9rem;
}

input, textarea, select {
    width: 100%;
    padding: 12px;
    background: #1e2e1e;
    border: 4px solid #4a6a3a;
    color: #e0f0d0;
    font-family: inherit;
    font-size: 1rem;
}

input:focus, textarea:focus, select:focus {
    outline: none;
    border-color: #8bb56a;
    background: #253a25;
}

/* 验证码区域 */
.captcha-area {
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.captcha-img {
    background: #2a3a22;
    border: 4px solid #5a7a4a;
    height: 50px;
    width: 150px;
    cursor: pointer;
    object-fit: cover;
}

/* ============================================
   10. 卡片组件
============================================ */
.card {
    background: #2d3825;
    border: 4px solid #4a6a3a;
    padding: 15px;
    margin-bottom: 15px;
}

.card-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
    padding-bottom: 10px;
    border-bottom: 2px solid #4a6a3a;
}

.stat-card {
    background: #1e2e1e;
    padding: 15px;
    text-align: center;
    border: 3px solid #3a5a2a;
}

.stat-number {
    font-size: 1.8rem;
    color: #ffffa0;
    font-weight: bold;
}

/* ============================================
   11. 留言板样式
============================================ */
.message-item {
    border-bottom: 3px solid #3a5a2a;
    padding: 20px 0;
}

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

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

.message-author {
    background: #3a4f2a;
    padding: 4px 12px;
    border: 2px solid #6b8c4a;
    font-weight: bold;
}

.message-content {
    background: #1e2e1e;
    padding: 20px;
    border: 3px inset #3e5e3e;
    word-wrap: break-word;
}

/* ============================================
   12. 标签徽章
============================================ */
.badge {
    background: #3a4a2a;
    border: 2px solid #7f9f6f;
    padding: 4px 10px;
    font-size: 0.8rem;
    display: inline-block;
    margin: 2px;
    color: #e0f0d0;
}

.badge.admin {
    background: #8b5a2a;
    border-color: #c68a3a;
}

.badge.online {
    background: #2a6b2a;
    border-color: #4a9f4a;
}

.badge.offline {
    background: #6b2a2a;
    border-color: #9f4a4a;
}

/* ============================================
   13. 提示消息
============================================ */
.flash-message {
    padding: 15px;
    margin-bottom: 20px;
    border: 4px solid;
}

.flash-message.success {
    background: #2a4a2a;
    border-color: #3a8b3a;
    color: #aaffaa;
}

.flash-message.error {
    background: #4a2a2a;
    border-color: #b66f5f;
    color: #ffaa8a;
}

.flash-message.info {
    background: #2a4a6a;
    border-color: #3a8bbb;
    color: #aaddff;
}

/* ============================================
   14. 分页样式
============================================ */
.pagination {
    display: flex;
    gap: 10px;
    margin: 30px 0;
    flex-wrap: wrap;
    justify-content: center;
}

.page-link {
    background: #2a3a22;
    border: 3px solid #4a6a3a;
    color: #e0f0d0;
    padding: 8px 15px;
    text-decoration: none;
    display: inline-block;
}

.page-link:hover {
    background: #3a5a2a;
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 #1a2a1a;
}

.page-link.active {
    background: #4a6a3a;
    border-color: #8bb56a;
    color: #ffffa0;
}

/* ============================================
   15. 管理后台表格
============================================ */
.admin-table {
    width: 100%;
    border-collapse: collapse;
    margin: 20px 0;
}

.admin-table th {
    background: #3a5a2a;
    padding: 12px;
    text-align: left;
    border: 2px solid #5a7a4a;
    color: #ffffb0;
}

.admin-table td {
    padding: 10px;
    border: 2px solid #3a5a2a;
}

.admin-table tr:hover {
    background: #2a3a2a;
}

/* ============================================
   16. 页脚
============================================ */
.footer {
    text-align: center;
    margin-top: 40px;
    padding: 20px;
    border-top: 4px solid #3e5e2e;
    color: #8bac7a;
}

.footer-stats {
    display: flex;
    justify-content: center;
    gap: 30px;
    margin-bottom: 20px;
    flex-wrap: wrap;
}

.footer-links {
    display: flex;
    justify-content: center;
    gap: 20px;
    margin-bottom: 15px;
    flex-wrap: wrap;
}

.footer-links a {
    color: #aacf9e;
    text-decoration: none;
}

.footer-links a:hover {
    color: #ffffa0;
}

.footer-copyright {
    font-size: 0.8rem;
}

/* ============================================
   17. 论坛专用样式
============================================ */

/* 版块网格 */
.forum-category-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    gap: 15px;
    margin-top: 20px;
}

/* 版块卡片 */
.forum-category-card {
    background: #1e2e1e;
    border: 3px solid #3a5a2a;
    padding: 15px;
    display: flex;
    align-items: center;
    gap: 15px;
    text-decoration: none;
    transition: all 0.1s;
}

.forum-category-card:hover {
    transform: translate(-2px, -2px);
    box-shadow: 4px 4px 0 #2a3a1a;
    border-color: #5a7a4a;
}

.forum-category-icon {
    font-size: 2.5rem;
    min-width: 60px;
    text-align: center;
}

.forum-category-info {
    flex: 1;
}

.forum-category-name {
    margin: 0 0 5px 0;
    color: #ffffa0;
    font-size: 1.2rem;
}

.forum-category-desc {
    margin: 0;
    color: #8baa7a;
    font-size: 0.9rem;
}

.forum-category-stats {
    margin-top: 5px;
    color: #aacf9e;
    font-size: 0.8rem;
}

.forum-category-arrow {
    font-size: 1.5rem;
    color: #8baa7a;
}

/* 帖子列表 */
.forum-topic-list {
    background: #1e2e1e;
    border: 3px inset #3e5e3e;
}

.forum-topic-item {
    border-bottom: 2px solid #3a5a2a;
    padding: 15px;
}

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

.forum-topic-main {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.forum-topic-title {
    flex: 1;
}

.forum-topic-title a {
    color: #ffffa0;
    text-decoration: none;
    font-size: 1.1rem;
    font-weight: bold;
}

.forum-topic-title a:hover {
    color: #ffff60;
    text-decoration: underline;
}

.forum-topic-badges {
    display: inline-block;
    margin-left: 10px;
}

.forum-topic-stats {
    display: flex;
    gap: 20px;
    text-align: center;
    min-width: 150px;
}

.forum-topic-stat {
    text-align: center;
}

.forum-topic-stat-number {
    font-size: 1.2rem;
    color: #ffffa0;
}

.forum-topic-stat-label {
    font-size: 0.8rem;
    color: #8baa7a;
}

.forum-topic-meta {
    color: #8baa7a;
    font-size: 0.8rem;
    margin-top: 8px;
}

/* 帖子详情 */
.forum-topic-header {
    background: #1e2e1e;
    border: 3px inset #3e5e3e;
    padding: 20px;
    margin-bottom: 20px;
}

.forum-topic-author {
    display: flex;
    justify-content: space-between;
    color: #8baa7a;
    margin-bottom: 20px;
    flex-wrap: wrap;
    gap: 10px;
}

.forum-topic-content {
    background: #2a3a2a;
    padding: 20px;
    border: 2px inset #3e5e3e;
    min-height: 200px;
    line-height: 1.8;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 回复列表 */
.forum-reply-list {
    background: #1e2e1e;
    border: 3px inset #3e5e3e;
}

.forum-reply-item {
    border-bottom: 2px solid #3a5a2a;
    padding: 20px;
}

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

.forum-reply-header {
    display: flex;
    justify-content: space-between;
    margin-bottom: 10px;
    flex-wrap: wrap;
    gap: 10px;
}

.forum-reply-author {
    font-weight: bold;
    color: #ffffa0;
}

.forum-reply-floor {
    color: #8baa7a;
    margin-left: 10px;
}

.forum-reply-time {
    color: #8baa7a;
    font-size: 0.8rem;
}

.forum-reply-content {
    background: #2a3a2a;
    padding: 15px;
    border: 2px inset #3e5e3e;
    white-space: pre-wrap;
    word-wrap: break-word;
}

/* 发帖表单 */
.forum-post-form {
    max-width: 800px;
    margin: 0 auto;
}

.forum-post-form textarea {
    width: 100%;
    background: #2a3a2a;
    color: #e0f0d0;
    border: 4px solid #4a6a3a;
    padding: 10px;
    font-family: 'Courier New', monospace;
    min-height: 300px;
}

.forum-post-form input[type="text"] {
    width: 100%;
    background: #2a3a2a;
    color: #e0f0d0;
    border: 4px solid #4a6a3a;
    padding: 10px;
}

.forum-post-form select {
    width: 100%;
    background: #2a3a2a;
    color: #e0f0d0;
    border: 4px solid #4a6a3a;
    padding: 10px;
}

/* 搜索框 */
.forum-search-box {
    display: flex;
    gap: 10px;
    margin-bottom: 30px;
}

.forum-search-box input {
    flex: 1;
    padding: 10px;
    background: #1e2e1e;
    border: 4px solid #4a6a3a;
    color: #e0f0d0;
}

/* 空状态提示 */
.forum-empty-state {
    background: #1e2e1e;
    padding: 40px;
    text-align: center;
    border: 3px inset #3e5e3e;
}

.forum-empty-state p {
    color: #8baa7a;
    margin-bottom: 20px;
    font-size: 1.1rem;
}

/* 论坛徽章 */
.forum-badge-pinned {
    background: #ffaa00;
    border: 2px solid #ffcc00;
    color: #1a2a1a;
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-right: 5px;
    display: inline-block;
}

.forum-badge-essence {
    background: #8b5a2a;
    border: 2px solid #c68a3a;
    color: #ffffa0;
    padding: 2px 8px;
    font-size: 0.8rem;
    margin-right: 5px;
    display: inline-block;
}

/* ============================================
   18. 响应式设计
============================================ */
@media (max-width: 1024px) {
    .grid-3, .grid-4 {
        grid-template-columns: repeat(2, 1fr);
    }
}

@media (max-width: 768px) {
    .grass-header {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .user-info {
        width: 100%;
        justify-content: space-between;
    }
    
    .grid-2, .grid-3, .grid-4 {
        grid-template-columns: 1fr;
    }
    
    .nav-menu {
        flex-direction: column;
    }
    
    .nav-item {
        width: 100%;
        text-align: center;
    }
    
    .footer-stats {
        flex-direction: column;
        gap: 10px;
    }
    
    .footer-links {
        flex-direction: column;
        gap: 10px;
    }
    
    /* 论坛手机适配 */
    .forum-category-grid {
        grid-template-columns: 1fr;
    }
    
    .forum-topic-main {
        flex-direction: column;
        align-items: flex-start;
    }
    
    .forum-topic-stats {
        margin-top: 10px;
        width: 100%;
        justify-content: space-around;
    }
    
    .forum-reply-header {
        flex-direction: column;
        gap: 5px;
    }
    
    .forum-search-box {
        flex-direction: column;
    }
    
    .admin-table {
        font-size: 0.8rem;
    }
    
    .admin-table th, .admin-table td {
        padding: 5px;
    }
}

/* ============================================
   19. 自定义滚动条
============================================ */
::-webkit-scrollbar {
    width: 12px;
    background: #1a2a1a;
}

::-webkit-scrollbar-thumb {
    background: #5a7a4a;
    border: 2px solid #8bb56a;
}

::-webkit-scrollbar-thumb:hover {
    background: #6b8c5a;
}

::-webkit-scrollbar-track {
    background: #1e2e1e;
}

/* ============================================
   20. 工具类
============================================ */
.text-center { text-align: center; }
.text-left { text-align: left; }
.text-right { text-align: right; }

.mt-10 { margin-top: 10px; }
.mt-20 { margin-top: 20px; }
.mt-30 { margin-top: 30px; }
.mb-10 { margin-bottom: 10px; }
.mb-20 { margin-bottom: 20px; }
.mb-30 { margin-bottom: 30px; }

.hidden { display: none; }
.inline-block { display: inline-block; }
.block { display: block; }

/* 像素化图像 */
.pixelated {
    image-rendering: pixelated;
    image-rendering: crisp-edges;
}

/* ============================================
   图片上传和显示样式
============================================ */

.image-upload-area {
    background: #2a3a2a;
    border: 3px solid #4a6a3a;
    padding: 15px;
    margin-bottom: 10px;
    display: flex;
    gap: 10px;
    align-items: center;
    flex-wrap: wrap;
}

.image-upload-area input[type="file"] {
    flex: 1;
    padding: 8px;
    background: #1e2e1e;
    border: 3px solid #4a6a3a;
    color: #e0f0d0;
}

.image-preview-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 10px;
    margin-top: 15px;
}

.image-preview-item {
    position: relative;
    border: 3px solid #4a6a3a;
    background: #1e2e1e;
    padding: 5px;
}

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

.image-preview-item .remove-image {
    position: absolute;
    top: -8px;
    right: -8px;
    background: #8b3a3a;
    border: 2px solid #b55a5a;
    color: white;
    width: 24px;
    height: 24px;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 16px;
    font-weight: bold;
}

.image-preview-item .remove-image:hover {
    background: #b55a5a;
}

.upload-progress {
    margin-top: 10px;
    height: 20px;
    background: #1e2e1e;
    border: 2px solid #4a6a3a;
    display: none;
}

.progress-bar {
    height: 100%;
    background: #5a8a4a;
    width: 0%;
    transition: width 0.3s;
}

/* 帖子内图片样式 */
.topic-images {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 10px;
    margin-top: 15px;
    padding-top: 15px;
    border-top: 2px dashed #3a5a2a;
}

.topic-image-item {
    border: 3px solid #4a6a3a;
    background: #2a3a2a;
    padding: 5px;
    cursor: pointer;
    transition: transform 0.2s;
}

.topic-image-item:hover {
    transform: scale(1.05);
}

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

/* 图片预览模态框 */
.image-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0,0,0,0.9);
    z-index: 10000;
    align-items: center;
    justify-content: center;
}

.image-modal img {
    max-width: 90%;
    max-height: 90%;
    border: 4px solid #6b8c4a;
    object-fit: contain;
}

.image-modal .close {
    position: absolute;
    top: 20px;
    right: 30px;
    color: white;
    font-size: 40px;
    font-weight: bold;
    cursor: pointer;
    z-index: 10001;
}

.image-modal .close:hover {
    color: #ffaa8a;
}

/* 手机适配 */
@media (max-width: 768px) {
    .image-preview-grid {
        grid-template-columns: repeat(2, 1fr);
    }
    
    .topic-images {
        grid-template-columns: repeat(2, 1fr);
    }
}