/* 全局样式 */
:root {
    --text-color: #333;
    --bg-color: #fff; /* 改为纯白背景 */
    --link-color: #0066cc;
    --link-hover: #004080;
    --border-color: #e0e0e0;
    --accent-color: #0066cc;
    --light-accent: #e6f0fa;
    --font-size: 16px;
    --line-height: 1.6;
}

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

body {
    font-family: "LXGW WenKai", sans-serif;
    font-weight: normal;
    font-size: var(--font-size);
    line-height: var(--line-height);
    color: var(--text-color);
    background-color: #fff; /* 强制使用纯白背景 */
    margin: 0;
    padding: 0;
}

a {
    color: var(--link-color);
    text-decoration: none;
}

a:hover {
    color: var(--link-hover);
    text-decoration: underline;
}

h1, h2, h3, h4 {
    margin: 1.5rem 0 1rem;
    line-height: 1.2;
    font-weight: 600;
}

p {
    margin-bottom: 1rem;
}

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

.content-wrapper {
    display: flex;
    margin-top: 60px; /* 为固定导航栏留出空间，减小以适应更小的顶部栏 */
}

.main-content {
    flex: 1;
    padding-right: 30px;
    border-right: 1px solid var(--border-color);
}

.sidebar {
    width: 280px;
    padding-left: 30px;
}

/* 头部和导航 */
.header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0; /* 缩小顶部栏高度 */
    border-bottom: 1px solid var(--border-color);
    background-color: #fff; /* 确保是纯白色 */
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    z-index: 1000;
    box-shadow: 0 1px 3px rgba(0,0,0,0.05); /* 添加轻微阴影，增强视觉分离 */
}

.header .container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
}

.site-title {
    font-size: 1.5rem;
    font-weight: 600;
    display: flex;
    align-items: center;
}

.site-title a {
    color: var(--text-color);
    text-decoration: none;
    display: flex;
    align-items: center;
}

.site-logo {
    height: 24px;
    margin-right: 8px;
}

.nav {
    display: flex;
    gap: 1.5rem;
}

.nav a {
    color: var(--text-color);
    text-decoration: none;
}

.nav a:hover {
    color: var(--link-color);
}

/* 主要内容区 */
.main {
    min-height: calc(100vh - 200px);
}

/* 帖子列表 */
.post-list {
    margin-bottom: 2rem;
}

.category-description {
    margin-top: -0.5rem;
    margin-bottom: 1rem;
    font-size: 0.9rem;
    color: #666;
}

.post-item {
    padding: 0.8rem 0;
    border-bottom: 1px solid var(--border-color);
}

.post-title {
    font-size: 1.1rem;
    margin-bottom: 0.2rem;
    font-weight: normal;
    display: flex;
    align-items: center;
    flex-wrap: wrap;
}

.post-title a {
    margin-right: 0.5rem;
}

.post-meta {
    color: #666;
    font-size: 0.75rem;
    margin-bottom: 0.3rem;
    font-weight: normal;
}

.post-excerpt {
    margin-bottom: 0.2rem;
    line-height: 1.3;
    font-size: 0.9rem;
    color: #444;
    max-height: 2.6em; /* 限制为两行 */
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 2; /* 限制为两行 */
    -webkit-box-orient: vertical;
}

/* 侧边栏 */
.sidebar-section {
    margin-bottom: 2rem;
}

.sidebar-title {
    font-size: 1.1rem;
    margin-bottom: 1rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border-color);
}

.sidebar-content {
    font-size: 0.9rem;
}

.announcement {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px dashed var(--border-color);
}

.announcement:last-child {
    border-bottom: none;
}

.announcement-title {
    font-weight: 600;
    margin-bottom: 0.3rem;
}

.announcement-date {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.stats-list {
    list-style: none;
    padding: 0;
}

.stats-list li {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
}

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

.category-list li {
    margin-bottom: 0.5rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px dashed var(--border-color);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-list li:last-child {
    border-bottom: none;
}

.category-list a {
    color: var(--text-color);
    text-decoration: none;
}

.category-list a:hover {
    color: var(--accent-color);
}

.category-count {
    background-color: #eee;
    color: #666;
    font-size: 0.75rem;
    padding: 0.1rem 0.4rem;
    border-radius: 10px;
}

/* 帖子详情 */
.post-container {
    margin-top: 20px; /* 增加与顶部栏的间距 */
    padding-top: 10px;
}

.post-navigation {
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

.post-navigation a {
    color: #666;
}

.post-header {
    margin-bottom: 1.2rem;
}

.post-category {
    margin-bottom: 0.5rem;
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.category-tag {
    display: inline-block;
    padding: 0.2rem 0.6rem;
    background-color: var(--accent-color);
    color: white;
    font-size: 0.8rem;
    border-radius: 3px;
}

.category-tag.small {
    padding: 0.1rem 0.4rem;
    font-size: 0.7rem;
    margin-left: 0.3rem;
    vertical-align: middle;
}

/* 置顶标签样式 */
.tags-container {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 置顶样式修饰符 */
.category-tag.sticky {
    background-color: #e74c3c;
}

.category-tag.sticky-super {
    background-color: #f39c12;
}

.post-header h1 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.post-content {
    line-height: 1.6;
    margin-bottom: 2rem;
}

.post-content p {
    margin-bottom: 0.8rem;
}

/* 帖子操作按钮 */
.post-actions {
    display: flex;
    gap: 10px;
}

.edit-btn, .delete-btn {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 3px;
    text-decoration: none;
}

.edit-btn {
    background-color: #3498db;
    color: white;
}

.edit-btn:hover {
    background-color: #2980b9;
    color: white;
    text-decoration: none;
}

.delete-btn {
    background-color: #e74c3c;
    color: white;
}

.delete-btn:hover {
    background-color: #c0392b;
    color: white;
    text-decoration: none;
}

.sticky-btn {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 3px;
    text-decoration: none;
    background-color: #27ae60;
    color: white;
}

.sticky-btn:hover {
    background-color: #219653;
    color: white;
    text-decoration: none;
}

.sticky-btn.super {
    background-color: #f39c12;
}

.sticky-btn.super:hover {
    background-color: #d35400;
    color: white;
    text-decoration: none;
}

.unsticky-btn {
    display: inline-block;
    padding: 0.2rem 0.5rem;
    font-size: 0.8rem;
    border-radius: 3px;
    text-decoration: none;
    background-color: #7f8c8d;
    color: white;
}

.unsticky-btn:hover {
    background-color: #636e72;
    color: white;
    text-decoration: none;
}

/* 评论区 */
.comments {
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    padding-top: 1.2rem;
}

.comments h3 {
    margin-bottom: 1.2rem;
    font-size: 1.1rem;
}

.comment {
    margin-bottom: 1rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid var(--border-color);
}

.comment:last-child {
    border-bottom: none;
}

.comment-meta {
    color: #666;
    font-size: 0.8rem;
    margin-bottom: 0.3rem;
}

.comment-content {
    line-height: 1.4;
    font-size: 0.95rem;
}

/* 表单样式 */
.form-group {
    margin-bottom: 1rem;
}

.remember-group {
    display: flex;
    align-items: center;
    font-size: 0.9rem;
    color: #666;
}

.remember-group label {
    display: flex;
    align-items: center;
    cursor: pointer;
}

.remember-group input[type="checkbox"] {
    margin-right: 0.5rem;
    cursor: pointer;
}

.form-group label {
    display: block;
    margin-bottom: 0.3rem;
    font-weight: 600;
    font-size: 0.9rem;
}

.form-control {
    width: 100%;
    padding: 0.6rem;
    border: 1px solid var(--border-color);
    font-size: 0.95rem;
    font-family: inherit;
}

/* 横线输入框样式 */
.line-input input,
.line-input textarea,
.line-input select {
    width: 100%;
    padding: 0.6rem 0.2rem;
    border: none;
    border-bottom: 1px solid var(--border-color);
    font-size: 0.95rem;
    font-family: inherit;
    background-color: transparent;
    outline: none;
    transition: border-color 0.3s;
}

.line-input input:focus,
.line-input textarea:focus,
.line-input select:focus {
    border-bottom: 2px solid var(--accent-color);
}

.line-input select {
    cursor: pointer;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    background-image: url("data:image/svg+xml;charset=UTF-8,%3csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='currentColor' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3e%3cpolyline points='6 9 12 15 18 9'%3e%3c/polyline%3e%3c/svg%3e");
    background-repeat: no-repeat;
    background-position: right 0.2rem center;
    background-size: 1em;
    padding-right: 1.5rem;
}

textarea.form-control,
.line-input textarea {
    min-height: 120px;
    resize: vertical;
    line-height: 1.5;
}

.btn {
    display: inline-block;
    padding: 0.5rem 1rem;
    background-color: var(--accent-color);
    color: white;
    border: none;
    font-size: 0.95rem;
    cursor: pointer;
    font-family: inherit;
    width: 100%;
    margin-top: 10px;
    text-decoration: none; /* 防止显示下划线 */
    text-align: center; /* 确保文本居中 */
}

.btn:hover {
    background-color: var(--link-hover);
    color: white; /* 确保悬浮时文本颜色不变 */
    text-decoration: none; /* 确保悬浮时不显示下划线 */
}

.btn-secondary {
    background-color: #666;
}

.btn-secondary:hover {
    background-color: #555;
    color: white; /* 确保悬浮时文本颜色不变 */
    text-decoration: none; /* 确保悬浮时不显示下划线 */
}

.post-btn {
    width: auto;
}

.form-buttons {
    display: flex;
    gap: 10px;
}

.form-buttons .btn {
    width: auto;
}

.comment-form h3 {
    font-size: 1.1rem;
    margin-top: 1.5rem;
    margin-bottom: 1rem;
}

.comment-btn {
    width: auto;
    margin-top: 15px;
}

/* 用户识别码样式 */
.user-code {
    font-size: 0.75em;
    color: #888;
    font-weight: normal;
}

.user-code.admin {
    color: #e74c3c;
    font-weight: bold;
}

/* 登录提示样式 */
.login-prompt {
    text-align: center;
    padding: 20px;
    background-color: #f9f9f9;
    border: 1px solid #eee;
    margin: 20px 0;
}

/* 错误提示样式 */
.alert {
    padding: 15px;
    margin-bottom: 20px;
    border-radius: 4px;
}

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

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

/* 成功消息弹窗 */
.success-message {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 8px;
    padding: 20px 30px;
    text-align: center;
    z-index: 1000;
    max-width: 90%;
    width: 400px;
}

.success-message h3 {
    margin-top: 0;
    color: #155724;
    font-size: 1.2rem;
}

.success-message p {
    margin-bottom: 20px;
    color: #333;
}

.success-message .icon {
    display: block;
    margin: 0 auto 15px;
    width: 50px;
    height: 50px;
    background-color: #28a745;
    border-radius: 50%;
    position: relative;
}

.success-message .icon:before,
.success-message .icon:after {
    content: '';
    position: absolute;
    background-color: white;
}

.success-message .icon:before {
    width: 3px;
    height: 15px;
    transform: rotate(45deg);
    top: 24px;
    left: 17px;
}

.success-message .icon:after {
    width: 25px;
    height: 3px;
    transform: rotate(45deg);
    top: 30px;
    left: 13px;
}

.alert ul {
    margin: 0;
    padding-left: 20px;
}

/* 代码样式 */
code {
    background-color: #f5f5f5;
    padding: 2px 4px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 0.9em;
}

pre {
    background-color: #f5f5f5;
    padding: 8px;
    border-radius: 5px;
    overflow-x: auto;
    margin: 0.5rem 0; /* 减少上下间距 */
}

pre code {
    background-color: transparent;
    padding: 0;
    display: block; /* 确保代码块正确显示 */
    line-height: 1.4; /* 减少行间距 */
}

/* 长文本自动换行 */
.post-content,
.comment-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
}

/* 邮箱样式 */
.email {
    font-family: monospace;
    color: #0066cc;
    white-space: nowrap;
}

/* 页脚 */
.footer {
    text-align: center;
    padding: 1.5rem 0;
    margin-top: 2rem;
    border-top: 1px solid var(--border-color);
    color: #666;
    font-size: 0.8rem;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    margin: 1.5rem 0;
    gap: 0.3rem;
}

.pagination a {
    padding: 0.4rem 0.6rem;
    border: 1px solid var(--border-color);
    font-size: 0.9rem;
}

.pagination a.active {
    background-color: var(--accent-color);
    color: white;
    border-color: var(--accent-color);
}

.pagination a.disabled {
    color: #ccc;
    cursor: not-allowed;
    pointer-events: none;
}

/* 表单链接 */
.form-link {
    text-align: center;
    margin-top: 1.5rem;
    color: #666;
}

/* 弹窗样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1001;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0, 0, 0, 0.4);
}

.modal-content {
    background-color: #fff;
    margin: 15% auto;
    padding: 30px;
    border: 1px solid var(--border-color);
    width: 350px;
    max-width: 90%;
    position: relative;
}

.modal-title {
    text-align: center;
    margin-top: 0;
    margin-bottom: 25px;
    font-size: 1.3rem;
    font-weight: normal;
    color: var(--text-color);
}

.close {
    position: absolute;
    right: 15px;
    top: 10px;
    color: #aaa;
    font-size: 24px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

.close:hover,
.close:focus {
    color: black;
    text-decoration: none;
}

/* 标签切换样式 */
.tab {
    overflow: hidden;
    border-bottom: 1px solid var(--border-color);
    margin-bottom: 20px;
    display: flex;
}

.tab button {
    background-color: inherit;
    float: left;
    border: none;
    outline: none;
    cursor: pointer;
    padding: 10px 16px;
    font-size: 16px;
    flex: 1;
    font-family: inherit;
}

.tab button:hover {
    background-color: #f1f1f1;
}

.tab button.active {
    border-bottom: 2px solid var(--accent-color);
    color: var(--accent-color);
}

.tabcontent {
    display: none;
    padding: 6px 0;
    border-top: none;
}

/* 响应式设计 */
@media (max-width: 900px) {
    .content-wrapper {
        flex-direction: column;
    }

    .main-content {
        padding-right: 0;
        border-right: none;
        margin-bottom: 2rem;
    }

    .sidebar {
        width: 100%;
        padding-left: 0;
        border-top: 1px solid var(--border-color);
        padding-top: 2rem;
    }
}

@media (max-width: 600px) {
    body {
        font-size: 15px;
    }

    .header .container {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
        padding: 0.5rem 20px;
    }

    .nav {
        width: 100%;
        justify-content: space-between;
    }

    .content-wrapper {
        margin-top: 100px;
    }
}
