* {
    box-sizing: border-box;
    font-family: Arial, sans-serif;
    margin: 0;
    padding: 0;
}

body {
    background: #f6f6f6;
    padding-top: 70px;
}

.navbar {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 65px;
    background: #fff;
    box-shadow: 0 1px 5px rgba(0,0,0,0.1);
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 20px;
    z-index: 999;
}

.navbar h1 a {
    color: #c0392b;
    text-decoration: none;
    font-size: 22px;
}
/* ============== 移动端适配 ============== */
@media (max-width: 768px) {
    /* 导航栏适配 */
    .navbar {
        height: auto;
        flex-direction: column;
        padding: 10px;
        gap: 10px;
    }
    .search-form {
        width: 100%;
        margin: 5px 0;
    }
    .nav-right {
        width: 100%;
        justify-content: space-between;
    }
    .nav-btn {
        padding: 6px 10px;
        font-size: 13px;
    }
    .avatar {
        width: 36px;
        height: 36px;
    }

    /* 容器适配 */
    .container {
        padding: 0 10px;
        margin: 10px auto;
    }

    /* 话题栏适配 */
    .category-bar {
        gap: 6px;
        overflow-x: auto;
        padding-bottom: 8px;
        flex-wrap: nowrap;
    }
    .category-btn {
        white-space: nowrap;
        font-size: 13px;
        padding: 5px 10px;
    }

    /* 帖子列表适配 */
    .post-item {
        gap: 10px;
        padding: 10px 0;
    }
    .post-item h3 a {
        font-size: 16px;
    }
    .post-item p {
        font-size: 13px;
    }

    /* 表单适配 */
    .form-container {
        padding: 15px;
    }
    textarea {
        min-height: 150px;
    }
    .btn-group {
        flex-direction: column;
    }
    .btn {
        width: 100%;
        text-align: center;
    }

    /* 分页适配 */
    .pagination a {
        padding: 5px 10px;
        margin: 0 3px;
    }
}

/* ============== 页脚样式 ============== */
.footer {
    background: #fff;
    margin-top: 30px;
    padding: 20px 0;
    border-top: 1px solid #eee;
}
.footer-content {
    max-width: 900px;
    margin: 0 auto;
    padding: 0 15px;
    text-align: center;
    color: #666;
    font-size: 14px;
}
.footer-content p {
    margin: 5px 0;
}
.footer a {
    color: #c0392b;
    text-decoration: none;
}

.search-form {
    display: flex;
    gap: 6px;
    width: 360px;
}

.search-form input {
    flex: 1;
    padding: 8px 12px;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}

.search-form button {
    padding: 8px 14px;
    background: #c0392b;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.nav-right {
    display: flex;
    align-items: center;
    gap: 10px;
}

.nav-btn {
    padding: 8px 14px;
    background: #c0392b;
    color: #fff;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
}

.admin-btn {
    background: #2980b9;
}

.avatar-dropdown {
    position: relative;
    display: inline-block;
}

.avatar {
    width: 42px;
    height: 42px;
    border-radius: 50%;
    object-fit: cover;
    cursor: pointer;
}

.avatar.small {
    width: 36px;
    height: 36px;
}

.dropdown-menu {
    position: absolute;
    top: 50px;
    right: 0;
    background: white;
    min-width: 180px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    border-radius: 8px;
    padding: 12px;
    display: none;
}

.avatar-dropdown:hover .dropdown-menu {
    display: block;
}

.avatar-upload-form {
    margin: 8px 0;
}
.avatar-upload-form input {
    display: none;
}
.avatar-upload-form label {
    color: #2980b9;
    cursor: pointer;
    font-size: 14px;
}
.logout-link {
    display: block;
    color: #c0392b;
    margin-top: 6px;
    text-decoration: none;
    font-size: 14px;
}

.container {
    max-width: 900px;
    margin: 20px auto;
    padding: 0 15px;
}

.category-bar {
    display: flex;
    gap: 8px;
    margin-bottom: 16px;
    flex-wrap: wrap;
}

.category-btn {
    padding: 6px 12px;
    background: white;
    border: 1px solid #ddd;
    border-radius: 6px;
    text-decoration: none;
    color: #333;
    font-size: 14px;
}

.category-btn.active {
    background: #c0392b;
    color: white;
    border-color: #c0392b;
}

.post-list {
    background: white;
    border-radius: 12px;
    padding: 20px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.post-item {
    display: flex;
    align-items: flex-start;
    gap: 12px;
    padding: 12px 0;
    border-bottom: 1px solid #eee;
}
.post-item:last-child {
    border-bottom: none;
}

.post-info {
    flex: 1;
}

.post-meta-top {
    margin-bottom: 4px;
    display: flex;
    gap: 6px;
}

.cate-tag {
    background: #eee;
    color: #666;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
}

.post-item a {
    text-decoration: none;
    color: #222;
    font-size: 18px;
}
.post-item p {
    color: #666;
    font-size: 14px;
    margin-top: 4px;
}

.post-top {
    background-color: #fff5e5;
    border-left: 4px solid #f39c12;
}
.top-tag {
    display: inline-block;
    background: #f39c12;
    color: #fff;
    font-size: 12px;
    padding: 2px 6px;
    border-radius: 4px;
}

.pagination {
    margin-top: 20px;
    text-align: center;
}
.pagination a {
    padding: 6px 12px;
    background: #c0392b;
    color: white;
    border-radius: 5px;
    text-decoration: none;
    margin: 0 5px;
}
.pagination span {
    margin: 0 10px;
    color: #666;
}

input, textarea, select {
    width: 100%;
    padding: 10px;
    margin: 8px 0;
    border: 1px solid #ddd;
    border-radius: 6px;
    font-size: 14px;
}
textarea {
    min-height: 200px;
    resize: vertical;
}
.btn {
    display: inline-block;
    padding: 8px 16px;
    border: none;
    border-radius: 6px;
    text-decoration: none;
    font-size: 14px;
    cursor: pointer;
}

.form-container {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.form-container h2 {
    color: #c0392b;
    margin-bottom: 20px;
}
.btn-group {
    margin-top: 15px;
    display: flex;
    gap: 10px;
}
.draft-btn {
    background: #e67e22;
    color: white;
}
.cancel-btn {
    background: #95a5a6;
    color: white;
}

.post-detail {
    background: white;
    border-radius: 12px;
    padding: 25px;
    box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}
.post-image img {
    max-width: 100%;
    border-radius: 8px;
    margin: 15px 0;
}
.top-btn {
    background: #f39c12;
    color: #fff;
}
/* 创建话题 */
.create-category {
    margin-bottom: 12px;
}
.create-category form {
    display: flex;
    gap: 8px;
}
.create-category input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.create-category button {
    padding: 6px 12px;
    background: #2980b9;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* 话题 + 删除按钮 */
.category-with-del {
    display: flex;
    align-items: center;
    position: relative;
}
.cat-del-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
/* 提示 */
.alert {
    background: #e3f2fd;
    color: #0d47a1;
    padding: 10px 14px;
    border-radius: 6px;
    margin-bottom: 12px;
}

/* 创建话题 */
.create-category {
    margin-bottom: 12px;
}
.create-category form {
    display: flex;
    gap: 8px;
}
.create-category input {
    flex: 1;
    padding: 6px 10px;
    border: 1px solid #ddd;
    border-radius: 6px;
}
.create-category button {
    padding: 6px 12px;
    background: #2980b9;
    color: white;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* 话题 + 删除按钮 */
.category-with-del {
    display: flex;
    align-items: center;
    position: relative;
}
.cat-del-btn {
    position: absolute;
    top: -6px;
    right: -6px;
    width: 16px;
    height: 16px;
    background: #e74c3c;
    color: white;
    border-radius: 50%;
    font-size: 12px;
    display: flex;
    align-items: center;
    justify-content: center;
    text-decoration: none;
}
/* 管理员样式 */
.admin-box {
    background: #fff;
    padding: 20px;
    border-radius: 10px;
    margin-bottom: 20px;
}
.admin-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px solid #eee;
}
.btn.red {
    background: #e74c3c;
    color: #fff;
}
.btn.orange {
    background: #f39c12;
    color: #fff;
}
.btn.blue {
    background: #3498db;
    color: #fff;
}
/* 管理员增强样式 */
.admin-form {
    display: flex;
    gap: 8px;
    margin-top:10px;
    flex-wrap:wrap;
}
.admin-form input {
    flex:1;
    min-width:120px;
}
.btn.green { background:#2ecc71; color:#fff; }
.btn.black { background:#222; color:#fff; }
.btn-group { display:flex; gap:6px; }
.alert { background:#d4edda; color:#155724; padding:10px; border-radius:6px; margin-bottom:10px; }
/* 用户头像下拉菜单 */
.user-menu {
  position: relative;
  display: inline-block;
  cursor: pointer;
}
.user-menu-content {
  display: none;
  position: absolute;
  right: 0;
  top: 40px;
  background: white;
  min-width: 160px;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  z-index: 999;
  overflow: hidden;
}
.user-menu-content a {
  color: #333;
  padding: 10px 14px;
  display: block;
  text-decoration: none;
  font-size: 14px;
}
.user-menu-content a:hover {
  background: #f5f5f5;
}
.user-menu:hover .user-menu-content {
  display: block;
}

/* 头像上传表单隐藏 */
#avatarUploadForm {
  display: none;
}