:root {
    --primary-color: #007bff; /* 主蓝色 */
    --primary-hover-color: #0056b3; /* 悬停蓝色 */
    --secondary-color: #28a745; /* 次要颜色（绿色） */
    --secondary-hover-color: #218838; /* 次要悬停颜色 */
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    background-color: #f5f5f5;
    color: #333;
}

header {
    background-color: #fff;
    padding: 1rem;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
}

header h1 {
    margin: 0;
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--primary-color); /* 蓝色主题 */
}

nav a {
    margin-left: 1rem;
    text-decoration: none;
    color: var(--primary-color); /* 蓝色主题 */
}

nav a:hover {
    text-decoration: underline;
}

main {
    max-width: 800px;
    margin: 2rem auto;
    padding: 0 1rem;
}

.form-container {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.form-container h2 {
    margin-top: 0;
}

.form-container input,
.form-container textarea,
.form-container button {
    display: block;
    width: 100%;
    margin-bottom: 1rem;
    padding: 0.5rem;
    font-size: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
    font-family: inherit;
}

.form-container input:focus,
.form-container textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

/* 特殊处理个人资料表单中的标签 */
#profile-form label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: bold;
}

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

.form-container button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    cursor: pointer;
    transition: background-color 0.3s ease;
}

.form-container button:hover {
    background-color: var(--primary-hover-color);
}

.form-container button:hover {
    background-color: #0056b3;
}

#new-post-button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    cursor: pointer;
    margin-bottom: 1rem;
}

#new-post-button:hover {
    background-color: #218838;
}

.post {
    background: #fff;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    cursor: pointer;
    transition: box-shadow 0.3s ease;
}

.post:hover {
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.post h3 {
    margin-top: 0;
    color: #007bff;
    font-size: 1.2rem;
}

.post p {
    color: #666;
    margin-bottom: 0;
    font-size: 0.9rem;
}

/* 文章详情页面样式 */
#post-detail-section {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#post-detail h2 {
    margin-top: 0;
    color: var(--primary-color);
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

#post-detail p {
    color: #666;
    margin-bottom: 1rem;
}

.post-content {
    margin: 1.5rem 0;
    line-height: 1.6;
}

.post-content h1,
.post-content h2,
.post-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.post-content h1 {
    font-size: 2rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.post-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.post-content h3 {
    font-size: 1.25rem;
}

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

.post-content ul,
.post-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.post-content li {
    margin-bottom: 0.5rem;
}

.post-content blockquote {
    margin: 0 0 1rem;
    padding: 0.5rem 1rem;
    border-left: 4px solid var(--primary-color);
    background-color: #f8f9fa;
    color: #6c757d;
}

.post-content code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
}

.post-content pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.post-content pre code {
    background-color: transparent;
    padding: 0;
}

/* 文章元数据样式 */
#post-meta {
    background: #f8f9fa;
    padding: 1rem;
    border-radius: 8px;
    margin-bottom: 2rem;
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
}

#post-categories,
#post-tags {
    display: flex;
    flex-wrap: wrap;
    gap: 0.5rem;
    align-items: center;
}

#post-categories::before {
    content: "分类:";
    font-weight: bold;
    margin-right: 0.5rem;
    color: #333;
}

#post-tags::before {
    content: "标签:";
    font-weight: bold;
    margin-right: 0.5rem;
    color: #333;
}

/* 评论区域样式 */
#comments-section {
    margin-top: 2rem;
    border-top: 1px solid #eee;
    padding-top: 2rem;
}

#comments-section h3 {
    margin-top: 0;
    color: var(--primary-color);
}

.comment {
    background: #f8f9fa;
    margin-bottom: 1rem;
    padding: 1rem;
    border-radius: 8px;
    border-left: 3px solid var(--primary-color);
}

.comment p {
    margin: 0.5rem 0;
}

.comment p:first-child {
    margin-top: 0;
}

.comment p:last-child {
    margin-bottom: 0;
    font-size: 0.875rem;
    color: #6c757d;
}

/* 评论表单样式 */
#comment-form {
    margin-top: 1.5rem;
}

#comment-form textarea {
    width: 100%;
    min-height: 100px;
    padding: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    resize: vertical;
    font-family: inherit;
    font-size: 1rem;
    box-sizing: border-box;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#comment-form textarea:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

#comment-form button {
    background-color: var(--primary-color);
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    margin-top: 1rem;
    transition: background-color 0.3s ease;
}

#comment-form button:hover {
    background-color: var(--primary-hover-color);
}

/* 用户资料模态框样式 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.4);
}

.modal-content {
    background-color: #fff;
    margin: 5% auto;
    padding: 20px;
    border: 1px solid #888;
    width: 90%;
    max-width: 500px;
    border-radius: 8px;
    position: relative;
    top: 50%;
    transform: translateY(-50%);
}

.close {
    color: #aaa;
    float: right;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    line-height: 1;
}

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

.profile-header {
    text-align: center;
    margin-bottom: 20px;
}

#profile-avatar {
    width: 100px;
    height: 100px;
    border-radius: 50%;
    object-fit: cover;
    margin-bottom: 10px;
}

#change-avatar {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

#change-avatar:hover {
    background-color: #0056b3;
}

#profile-form input,
#profile-form textarea {
    width: 100%;
    padding: 10px;
    margin-bottom: 15px;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

#profile-form button {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 10px 20px;
    border-radius: 4px;
    cursor: pointer;
    width: 100%;
}

/* 验证码样式 */
.captcha-container {
    display: flex;
    align-items: center;
    gap: 1rem;
    margin-bottom: 1rem;
}

#captcha-canvas {
    border: 1px solid #ddd;
    border-radius: 4px;
    background-color: #f8f9fa;
}

#refresh-captcha {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 0.5rem;
    border-radius: 4px;
    cursor: pointer;
    font-size: 0.875rem;
    transition: background-color 0.3s ease;
}

#refresh-captcha:hover {
    background-color: #5a6268;
}

#captcha-input {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#captcha-input:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

/* 分页控件样式 */
#pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-top: 20px;
    gap: 10px;
}

#pagination button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 8px 16px;
    border-radius: 4px;
    cursor: pointer;
}

#pagination button:hover {
    background-color: #0056b3;
}

#pagination button:disabled {
    background-color: #ccc;
    cursor: not-allowed;
}

#page-info {
    font-weight: bold;
}

/* Markdown编辑器样式 */
.editor-container {
    border: 1px solid #ddd;
    border-radius: 8px;
    margin-bottom: 1rem;
    overflow: hidden;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.editor-header {
    display: flex;
    border-bottom: 1px solid #ddd;
    background-color: #f8f9fa;
}

.editor-tab {
    background: none;
    border: none;
    padding: 0.75rem 1.5rem;
    cursor: pointer;
    border-bottom: 3px solid transparent;
    font-weight: 500;
    transition: all 0.3s ease;
}

.editor-tab.active {
    border-bottom: 3px solid #007bff;
    background-color: #fff;
    color: #007bff;
}

.editor-tab:hover:not(.active) {
    background-color: #e9ecef;
}

.editor-content {
    position: relative;
}

#post-content,
.preview-content {
    width: 100%;
    min-height: 300px;
    padding: 1.5rem;
    box-sizing: border-box;
    border: none;
    resize: vertical;
    font-size: 1rem;
    line-height: 1.6;
}

#post-content {
    font-family: 'Consolas', 'Monaco', monospace;
    background-color: #fafafa;
}

.preview-content {
    background-color: #fff;
    padding: 1.5rem;
    line-height: 1.6;
}

/* Markdown预览样式 */
.preview-content h1,
.preview-content h2,
.preview-content h3 {
    margin-top: 1.5rem;
    margin-bottom: 1rem;
    color: #333;
}

.preview-content h1 {
    font-size: 2rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.preview-content h2 {
    font-size: 1.5rem;
    border-bottom: 1px solid #eee;
    padding-bottom: 0.5rem;
}

.preview-content h3 {
    font-size: 1.25rem;
}

.preview-content p {
    margin-bottom: 1rem;
}

.preview-content ul,
.preview-content ol {
    margin-bottom: 1rem;
    padding-left: 2rem;
}

.preview-content li {
    margin-bottom: 0.5rem;
}

.preview-content blockquote {
    margin: 0 0 1rem;
    padding: 0.5rem 1rem;
    border-left: 4px solid #007bff;
    background-color: #f8f9fa;
    color: #6c757d;
}

.preview-content code {
    background-color: #f8f9fa;
    padding: 0.2rem 0.4rem;
    border-radius: 4px;
    font-family: 'Consolas', 'Monaco', monospace;
    font-size: 0.9rem;
}

.preview-content pre {
    background-color: #f8f9fa;
    padding: 1rem;
    border-radius: 4px;
    overflow-x: auto;
    margin-bottom: 1rem;
}

.preview-content pre code {
    background-color: transparent;
    padding: 0;
}

/* 发布文章表单样式 */
#post-section {
    background: #fff;
    padding: 2rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

#post-section h2 {
    margin-top: 0;
    color: #333;
    border-bottom: 1px solid #eee;
    padding-bottom: 1rem;
}

#post-title,
#post-category,
#post-tags {
    width: 100%;
    padding: 0.75rem;
    margin-bottom: 1.5rem;
    border: 1px solid #ddd;
    border-radius: 6px;
    box-sizing: border-box;
    font-size: 1rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
}

#post-title:focus,
#post-category:focus,
#post-tags:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 3px rgba(0,123,255,0.1);
}

#post-title {
    font-size: 1.5rem;
    font-weight: bold;
}

#post-category::placeholder,
#post-tags::placeholder {
    color: #999;
}

/* 表单提示文字 */
.form-hint {
    margin-bottom: 1.5rem;
    color: #6c757d;
}

.form-hint small {
    font-size: 0.875rem;
}

/* 表单按钮容器 */
.form-buttons {
    display: flex;
    gap: 1rem;
    margin-top: 1rem;
}

/* 发布和取消按钮样式 */
#post-section button[type="submit"] {
    background-color: #28a745;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
    flex: 1;
    max-width: 200px;
}

#post-section button[type="submit"]:hover {
    background-color: #218838;
}

#cancel-post {
    background-color: #6c757d;
    color: white;
    border: none;
    padding: 0.75rem 2rem;
    border-radius: 6px;
    cursor: pointer;
    font-size: 1rem;
    font-weight: 500;
    transition: background-color 0.3s ease;
    flex: 1;
    max-width: 200px;
}

#cancel-post:hover {
    background-color: #5a6268;
}

/* 分类和标签样式 */
#post-category,
#post-tags {
    width: 100%;
    padding: 0.5rem;
    margin-bottom: 1rem;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-sizing: border-box;
}

#post-meta {
    background: #fff;
    padding: 1rem;
    border-radius: 8px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    margin-bottom: 1rem;
}

.category {
    display: inline-block;
    background-color: #007bff;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

.tag {
    display: inline-block;
    background-color: #28a745;
    color: white;
    padding: 0.2rem 0.5rem;
    border-radius: 4px;
    font-size: 0.8rem;
    margin-right: 0.5rem;
    margin-bottom: 0.5rem;
}

/* 搜索功能样式 */
.forum-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 1rem;
}

.search-container {
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

#search-input {
    padding: 0.5rem 1rem;
    border: 1px solid #ddd;
    border-radius: 20px;
    width: 250px;
    font-size: 0.9rem;
    transition: border-color 0.3s ease, box-shadow 0.3s ease;
    background-image: url('data:image/svg+xml;utf8,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="%23666" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><circle cx="11" cy="11" r="8"></circle><line x1="21" y1="21" x2="16.65" y2="16.65"></line></svg>');
    background-repeat: no-repeat;
    background-position: 10px center;
    background-size: 16px;
    padding-left: 35px;
}

#search-input:focus {
    outline: none;
    border-color: #007bff;
    box-shadow: 0 0 0 2px rgba(0,123,255,0.25);
}

#search-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 0.5rem 1rem;
    border-radius: 20px;
    cursor: pointer;
    transition: background-color 0.3s ease;
    font-size: 0.9rem;
}

#search-button:hover {
    background-color: #0056b3;
}

/* 搜索结果提示 */
.search-result-info {
    background-color: #e9ecef;
    padding: 0.5rem 1rem;
    border-radius: 4px;
    margin-bottom: 1rem;
    font-size: 0.9rem;
}

@media (max-width: 600px) {
    .forum-header {
        flex-direction: column;
        align-items: stretch;
    }
    
    .search-container {
        width: 100%;
    }
    
    #search-input {
        flex-grow: 1;
        width: auto;
    }
    
    .modal-content {
        width: 95%;
        margin: 10% auto;
    }
    
    header {
        flex-direction: column;
        text-align: center;
    }
    
    nav {
        margin-top: 1rem;
    }
    
    nav a {
        margin: 0 0.5rem;
    }
    
    .editor-header {
        font-size: 0.9rem;
    }
    
    .editor-tab {
        padding: 0.4rem 0.8rem;
    }
    
    #search-result-info {
        font-size: 0.8rem;
        padding: 0.4rem 0.8rem;
    }
    
    /* 发布文章页面响应式优化 */
    #post-section {
        padding: 1rem;
    }
    
    #post-title {
        font-size: 1.2rem;
    }
    
    .editor-tab {
        padding: 0.5rem 1rem;
    }
    
    #post-content,
    .preview-content {
        padding: 1rem;
        min-height: 200px;
    }
    
    .form-buttons {
        flex-direction: column;
    }
    
    #post-section button[type="submit"],
    #cancel-post {
        max-width: none;
        width: 100%;
    }
}

/* 文章操作按钮样式 */
.post-actions {
    display: flex;
    gap: 1rem;
    margin: 1.5rem 0;
    padding: 1rem 0;
    border-top: 1px solid #eee;
    border-bottom: 1px solid #eee;
}

.action-button {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    background-color: #f8f9fa;
    border: 1px solid #ddd;
    padding: 0.5rem 1rem;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.3s ease;
    font-size: 0.9rem;
}

.action-button:hover {
    background-color: #e9ecef;
    border-color: #ccc;
}

.action-button.liked {
    background-color: #cce5ff;
    border-color: var(--primary-color);
    color: var(--primary-color);
}

.action-button.favorited {
    background-color: #fff3cd;
    border-color: #ffc107;
    color: #856404;
}

.action-icon {
    font-size: 1.2rem;
}

.action-count {
    background-color: #dee2e6;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 0.75rem;
    font-weight: bold;
}

.action-button.liked .action-count {
    background-color: var(--primary-color);
    color: white;
}