/* 重置样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

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

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

/* 导航栏 - 移动设备适配 */
.navbar {
    background: #2c3e50;
    color: white;
    padding: 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

.nav-container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    height: 60px;
}

.nav-logo a {
    color: white;
    text-decoration: none;
    font-size: 1.2em;
    font-weight: bold;
}

.nav-menu {
    display: flex;
    gap: 20px;
}

.nav-link {
    color: white;
    text-decoration: none;
    padding: 8px 16px;
    border-radius: 4px;
    transition: background 0.3s;
    white-space: nowrap; /* 防止文字换行 */
}

.nav-link:hover, .nav-link.active {
    background: #e74c3c;
}

.admin-link {
    background: #e74c3c;
}

/* 主布局 - 保持PC样式按比例缩小 */
.main-layout {
    display: grid;
    grid-template-columns: 250px 1fr;
    gap: 20px;
    margin: 20px 0;
    transform-origin: top center; /* 缩放基准点 */
}

/* 侧边栏 */
.sidebar {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    height: fit-content;
}

.sidebar-section {
    margin-bottom: 30px;
}

.sidebar-section h3 {
    margin-bottom: 15px;
    color: #2c3e50;
    font-size: 1.1em;
    border-bottom: 2px solid #3498db;
    padding-bottom: 5px;
}

.category-list {
    list-style: none;
}

.category-list li {
    margin-bottom: 5px;
}

.category-link {
    display: flex;
    align-items: center;
    padding: 8px 12px;
    color: #333;
    text-decoration: none;
    border-radius: 4px;
    transition: background 0.3s;
}

.category-link:hover {
    background: #f8f9fa;
}

.category-color {
    width: 12px;
    height: 12px;
    border-radius: 50%;
    margin-right: 10px;
}

.topic-count {
    margin-left: auto;
    background: #e74c3c;
    color: white;
    padding: 2px 8px;
    border-radius: 10px;
    font-size: 0.8em;
}

/* 主内容区 */
.main-content {
    min-height: 500px;
}

/* 快速发帖卡片 - 保持原有比例 */
.quick-post-card {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    padding: 20px;
    margin-bottom: 20px;
}

.quick-post-card h3 {
    margin-bottom: 15px;
    color: #2c3e50;
}

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

.form-group textarea {
    width: 100%;
    padding: 12px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-family: inherit;
    resize: vertical;
    transition: border 0.3s;
    font-size: inherit; /* 保持字体比例 */
}

.form-group textarea:focus {
    outline: none;
    border-color: #3498db;
}

.form-actions {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.emoticon-picker {
    position: relative;
}

.emoticon-btn {
    background: none;
    border: none;
    font-size: 1.2em;
    cursor: pointer;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background 0.3s;
}

.emoticon-btn:hover {
    background: #f8f9fa;
}

.emoticon-grid {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background: white;
    border: 1px solid #ddd;
    border-radius: 4px;
    padding: 10px;
    grid-template-columns: repeat(8, 1fr);
    gap: 5px;
    max-width: 300px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
    z-index: 1000;
}

.emoticon {
    cursor: pointer;
    padding: 5px;
    border-radius: 4px;
    transition: background 0.3s;
    text-align: center;
}

.emoticon:hover {
    background: #f8f9fa;
}

/* 按钮 */
.btn {
    display: inline-block;
    padding: 10px 20px;
    background: #3498db;
    color: white;
    text-decoration: none;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 14px;
    transition: background 0.3s;
    white-space: nowrap; /* 防止按钮文字换行 */
}

.btn:hover {
    background: #2980b9;
}

.btn-primary {
    background: #3498db;
}

.btn-primary:hover {
    background: #2980b9;
}

.btn-success {
    background: #27ae60;
}

.btn-success:hover {
    background: #219a52;
}

.btn-danger {
    background: #e74c3c;
}

.btn-danger:hover {
    background: #c0392b;
}

.btn-block {
    display: block;
    width: 100%;
    text-align: center;
}

/* 话题区域 */
.topics-section {
    background: white;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    overflow: hidden;
}

.section-header {
    background: #f8f9fa;
    padding: 15px 20px;
    border-bottom: 1px solid #eee;
}

.section-header h2 {
    color: #2c3e50;
    font-size: 1.3em;
}

/* 话题列表 */
.topics-list {
    padding: 0;
}

.topic-item {
    display: flex;
    padding: 15px 20px;
    border-bottom: 1px solid #f4f4f4;
    transition: background 0.3s;
}

.topic-item:hover {
    background: #f8f9fa;
}

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

.topic-avatar {
    margin-right: 15px;
    flex-shrink: 0; /* 防止头像被压缩 */
}

.topic-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    object-fit: cover;
}

.topic-content {
    flex: 1;
    min-width: 0; /* 防止内容溢出 */
}

.topic-meta {
    display: flex;
    align-items: center;
    gap: 10px;
    margin-bottom: 8px;
    font-size: 0.9em;
    color: #9b59b6;
    flex-wrap: wrap; /* 允许在小屏幕上换行 */
}

.category-badge {
    padding: 2px 8px;
    border-radius: 12px;
    color: white;
    font-size: 0.8em;
    white-space: nowrap;
}

.author {
    font-weight: 500;
    white-space: nowrap;
}

.time {
    color: #999;
    white-space: nowrap;
}

.topic-title {
    margin-bottom: 8px;
}

.topic-title a {
    color: #2c3e50;
    text-decoration: none;
    font-size: 1.1em;
    font-weight: 600;
}

.topic-title a:hover {
    color: #3498db;
}

.topic-stats {
    display: flex;
    gap: 15px;
    font-size: 0.9em;
    color: #666;
    white-space: nowrap;
}

/* 空状态 */
.empty-state {
    text-align: center;
    padding: 40px 20px;
    color: #666;
}

.empty-state i {
    margin-bottom: 15px;
    color: #bdc3c7;
}

.empty-state p {
    margin-bottom: 20px;
}

/* 警告框 */
.alert {
    padding: 12px 15px;
    border-radius: 4px;
    margin-bottom: 20px;
}

.alert-success {
    background: #d4edda;
    color: #155724;
    border: 1px solid #c3e6cb;
}

.alert-danger {
    background: #f8d7da;
    color: #721c24;
    border: 1px solid #f5c6cb;
}

/* 删除按钮样式 */
.delete-form {
    display: inline;
}

.btn-delete-small {
    background: #e74c3c;
    color: white;
    border: none;
    padding: 4px 8px;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.8em;
    white-space: nowrap;
}

.btn-delete-small:hover {
    background: #c0392b;
}

/* 响应式设计 - 重点：整体按比例缩小 */
@media (max-width: 768px) {
    /* 设置视口缩放 */
    .container {
        width: 100%;
        padding: 0 10px;
        transform: scale(0.85); /* 整体缩小到85% */
        transform-origin: top center;
    }
    
    /* 导航栏保持水平排列 */
    .nav-container {
        padding: 0 10px;
        height: 50px;
    }
    
    .nav-logo a {
        font-size: 1.3em;
    }
    
    .nav-menu {
        gap: 8px;
    }
    
    .nav-link {
        padding: 6px 10px;
        font-size: 0.9em;
    }
    
    /* 主布局保持网格结构但缩小 */
    .main-layout {
        grid-template-columns: 200px 1fr;
        gap: 15px;
        margin: 15px 0;
        transform: scale(1); /* 重置缩放，因为容器已经缩放 */
    }
    
    /* 侧边栏调整 */
    .sidebar {
        padding: 15px;
    }
    
    /* 快速发帖卡片保持比例 */
    .quick-post-card {
        padding: 15px;
    }
    
    .form-actions {
        flex-wrap: nowrap; /* 防止换行 */
    }
    
    .emoticon-grid {
        grid-template-columns: repeat(6, 1fr);
        max-width: 250px;
    }
    
    /* 话题项调整 */
    .topic-item {
        padding: 12px 15px;
    }
    
    .topic-avatar {
        margin-right: 12px;
    }
    
    .topic-avatar img {
        width: 35px;
        height: 35px;
    }
    
    .topic-meta {
        gap: 8px;
        font-size: 0.85em;
    }
    
    .topic-title a {
        font-size: 1em;
    }
    
    .topic-stats {
        font-size: 0.85em;
        gap: 12px;
    }
    
    /* 按钮保持原有比例 */
    .btn {
        padding: 8px 16px;
        font-size: 13px;
    }
}

/* 超小屏幕设备 */
@media (max-width: 480px) {
    .container {
        transform: scale(0.75); /* 进一步缩小到75% */
        transform-origin: top center;
    }
    
    .nav-container {
        height: 45px;
    }
    
    .nav-logo a {
        font-size: 1.1em;
    }
    
    .nav-link {
        padding: 5px 8px;
        font-size: 0.8em;
    }
    
    .main-layout {
        grid-template-columns: 180px 1fr;
        gap: 10px;
        margin: 10px 0;
    }
    
    .topic-meta {
        font-size: 0.8em;
    }
}

/* 防止缩放导致的溢出 */
html {
    overflow-x: hidden;
}

body {
    overflow-x: hidden;
}