/* Global style reset */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f7fa;
}

/* Unified font style for all input boxes */
input, textarea, select {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
}

/* Unified placeholder text style */
input::placeholder, textarea::placeholder {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif !important;
    color: #a0aec0;
    opacity: 1;
}

.container {
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 20px;
}

/* Header styles */
.header {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 1rem 0;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
    position: sticky;
    top: 0;
    z-index: 100;
}

.header-content {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 2rem;
}

.header-buttons {
    display: flex;
    gap: 0.75rem;
    align-items: center;
}

.logo h1 {
    font-size: 1.8rem;
    font-weight: 700;
}

.logo i {
    margin-right: 0.5rem;
    color: #ffd700;
}

.search-bar {
    display: flex;
    flex: 1;
    max-width: 400px;
    position: relative;
}

.search-bar input {
    flex: 1;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 25px 0 0 25px;
    font-size: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    outline: none;
}

.search-bar button {
    padding: 0.75rem 1.5rem;
    background: #4a5568;
    color: white;
    border: none;
    border-radius: 0 25px 25px 0;
    cursor: pointer;
    transition: background 0.3s;
}

.search-bar button:hover {
    background: #2d3748;
}

/* Button styles */
.btn-primary {
    background: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
    color: white;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
    box-shadow: 0 4px 15px rgba(79, 172, 254, 0.3);
}

.btn-primary:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(79, 172, 254, 0.4);
}

.btn-secondary {
    background: #e2e8f0;
    color: #4a5568;
    border: none;
    padding: 0.75rem 1.5rem;
    border-radius: 25px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s;
}

.btn-secondary:hover {
    background: #cbd5e0;
}

/* Main content area */
.main-content {
    padding: 2rem 0;
}

.content-wrapper {
    display: grid;
    grid-template-columns: 280px 1fr;
    gap: 2rem;
}

/* Sidebar styles */
.sidebar {
    background: white;
    border-radius: 12px;
    padding: 1.5rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
    height: fit-content;
    position: sticky;
    top: 120px;
}

.sidebar h3 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.1rem;
    font-weight: 600;
}

.categories ul {
    list-style: none;
}

.categories li {
    margin-bottom: 0.5rem;
}

.categories a {
    display: block;
    padding: 0.75rem 1rem;
    color: #4a5568;
    text-decoration: none;
    border-radius: 8px;
    transition: all 0.3s;
    font-weight: 500;
}

.categories a:hover,
.categories a.active {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    transform: translateX(5px);
}

.stats {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 1px solid #e2e8f0;
}

.stat-item {
    display: flex;
    justify-content: space-between;
    margin-bottom: 0.75rem;
}

.stat-label {
    color: #718096;
}

.stat-value {
    font-weight: 600;
    color: #2d3748;
}

/* Posts area styles */
.posts-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 20px rgba(0,0,0,0.08);
}

.posts-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 2rem;
    padding-bottom: 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.posts-header h2 {
    color: #2d3748;
    font-size: 1.5rem;
    font-weight: 600;
}

.sort-options select {
    padding: 0.5rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    background: white;
    color: #4a5568;
    font-weight: 500;
    cursor: pointer;
    outline: none;
    transition: border-color 0.3s;
}

.sort-options select:focus {
    border-color: #667eea;
}

/* Post card styles */
.post-card {
    background: #f8fafc;
    border: 2px solid #e2e8f0;
    border-radius: 12px;
    padding: 1.5rem;
    margin-bottom: 1.5rem;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
}

.post-card:hover {
    transform: translateY(-3px);
    box-shadow: 0 8px 25px rgba(0,0,0,0.1);
    border-color: #667eea;
}

.post-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 1rem;
}

.post-meta {
    display: flex;
    align-items: center;
    gap: 1rem;
    flex-wrap: wrap;
}

.post-category {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 15px;
    font-size: 0.85rem;
    font-weight: 600;
}

.post-author {
    color: #718096;
    font-size: 0.9rem;
}

.post-time {
    color: #a0aec0;
    font-size: 0.85rem;
}


.post-title {
    font-size: 1.25rem;
    font-weight: 600;
    color: #2d3748;
    margin-bottom: 0.75rem;
    line-height: 1.4;
}

.post-content {
    color: #4a5568;
    line-height: 1.6;
    margin-bottom: 1rem;
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

/* Post detail page content should not be truncated */
.post-detail-page .post-content {
    display: block;
    -webkit-line-clamp: unset;
    -webkit-box-orient: unset;
    overflow: visible;
    white-space: pre-wrap;
}

.post-stats {
    display: flex;
    align-items: center;
    gap: 1.5rem;
    color: #718096;
    font-size: 0.9rem;
}

.post-stats i {
    margin-right: 0.5rem;
}

.like-btn {
    background: none;
    border: none;
    color: #718096;
    cursor: pointer;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem;
    border-radius: 8px;
    transition: all 0.3s;
}

.like-btn:hover {
    color: #e53e3e;
    background: #fed7d7;
}

.like-btn.liked {
    color: #e53e3e;
}

/* Modal styles */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.5);
    backdrop-filter: blur(5px);
}

.modal-content {
    background-color: white;
    margin: 5% auto;
    padding: 0;
    border-radius: 16px;
    width: 90%;
    max-width: 850px;
    box-shadow: 0 20px 60px rgba(0,0,0,0.3);
    animation: modalSlideIn 0.3s ease-out;
}

.modal-large {
    max-width: 900px;
    max-height: 90vh;
    overflow-y: auto;
}

@keyframes modalSlideIn {
    from {
        opacity: 0;
        transform: translateY(-50px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 2rem 2rem 1rem;
    border-bottom: 2px solid #e2e8f0;
}

.modal-header h3 {
    color: #2d3748;
    font-size: 1.5rem;
    font-weight: 600;
}

.close-btn {
    background: none;
    border: none;
    font-size: 1.5rem;
    color: #718096;
    cursor: pointer;
    padding: 0.5rem;
    border-radius: 50%;
    transition: all 0.3s;
}

.close-btn:hover {
    background: #e2e8f0;
    color: #2d3748;
}

/* Form styles */
#createPostForm {
    padding: 0 2rem 2rem;
}

.form-group {
    margin-bottom: 1.5rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    color: #2d3748;
    font-weight: 600;
}

.form-group input,
.form-group select,
.form-group textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    transition: border-color 0.3s;
    outline: none;
}

.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
    border-color: #667eea;
}

.form-group textarea {
    resize: vertical;
    min-height: 120px;
}

.form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 1rem;
    padding-top: 1rem;
}

/* Post detail styles */
.post-detail-content {
    padding: 2rem;
}

.post-detail-content .post-meta {
    margin-bottom: 1.5rem;
    padding-bottom: 1rem;
    border-bottom: 1px solid #e2e8f0;
}

.post-detail-content .post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    margin-bottom: 2rem;
    white-space: pre-wrap;
}

.post-actions {
    display: flex;
    align-items: center;
    gap: 2rem;
    padding: 1rem 0;
    border-bottom: 1px solid #e2e8f0;
}

/* Comments area styles */
.comments-section {
    padding: 2rem;
    background: #f8fafc;
}

.comment-form {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
}

.comment-form h4 {
    color: #2d3748;
    margin-bottom: 1rem;
    font-size: 1.1rem;
}

.comments-list h4 {
    color: #2d3748;
    margin-bottom: 1.5rem;
    font-size: 1.1rem;
}

.comment-item {
    background: white;
    padding: 1.5rem;
    border-radius: 12px;
    margin-bottom: 1rem;
    box-shadow: 0 2px 10px rgba(0,0,0,0.05);
    position: relative;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.75rem;
}

.comment-author {
    font-weight: 600;
    color: #2d3748;
}

.comment-time {
    color: #a0aec0;
    font-size: 0.85rem;
}

.comment-content {
    color: #4a5568;
    line-height: 1.6;
    white-space: pre-wrap;
}


/* No content message */
.no-posts,
.no-comments {
    text-align: center;
    padding: 3rem 2rem;
    color: #718096;
}

.no-posts i {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: #cbd5e0;
}

.no-posts p,
.no-comments p {
    font-size: 1.1rem;
}

/* Loading indicator */
.loading {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background: white;
    padding: 2rem;
    border-radius: 12px;
    box-shadow: 0 10px 30px rgba(0,0,0,0.2);
    display: flex;
    align-items: center;
    gap: 1rem;
    z-index: 2000;
}

.loading i {
    font-size: 1.5rem;
    color: #667eea;
}

/* Responsive design */
@media (max-width: 768px) {
    .content-wrapper {
        grid-template-columns: 1fr;
        gap: 1rem;
    }
    
    .sidebar {
        position: static;
        order: 2;
    }
    
    .header-content {
        flex-direction: column;
        gap: 1rem;
    }
    
    .search-bar {
        max-width: none;
        width: 100%;
    }
    
    .posts-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 1rem;
    }
    
    .modal-content {
        margin: 2% auto;
        width: 95%;
    }
    
    .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
}

@media (max-width: 480px) {
    .container {
        padding: 0 10px;
    }
    
    .posts-section,
    .sidebar {
        padding: 1rem;
    }
    
    .post-card {
        padding: 1rem;
    }
    
    .modal-content {
        margin: 1% auto;
    }
    
    .post-detail-content,
    .comments-section {
        padding: 1rem;
    }
}

/* Scrollbar styles */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e0;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a0aec0;
}

/* Comment form area styles - added top comment form */
.comment-form-section {
    margin-bottom: 2rem;
}

.comment-form-card {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    color: white;
}

.comment-form-card h4 {
    color: white;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-form-card .form-group {
    margin-bottom: 1rem;
}

.comment-form-card input,
.comment-form-card textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    border: none;
    border-radius: 8px;
    font-size: 1rem;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    background: rgba(255, 255, 255, 0.95);
    color: #2d3748;
    transition: all 0.3s ease;
}

.comment-form-card input:focus,
.comment-form-card textarea:focus {
    outline: none;
    background: white;
    box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.3);
    transform: translateY(-1px);
}

.comment-form-card .btn-primary {
    background: rgba(255, 255, 255, 0.2);
    border: 2px solid rgba(255, 255, 255, 0.3);
    color: white;
    padding: 0.75rem 1.5rem;
    border-radius: 8px;
    font-weight: 600;
    transition: all 0.3s ease;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.comment-form-card .btn-primary:hover {
    background: rgba(255, 255, 255, 0.3);
    border-color: rgba(255, 255, 255, 0.5);
    transform: translateY(-2px);
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Post detail page styles */
.post-detail-page {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    margin-bottom: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.post-detail-page .post-header {
    margin-bottom: 1.5rem;
    border-bottom: 1px solid #e2e8f0;
    padding-bottom: 1rem;
}

.post-detail-page .post-title {
    font-size: 2rem;
    font-weight: 700;
    color: #1a202c;
    margin-bottom: 1.5rem;
    line-height: 1.3;
    display: block;
    width: 100%;
}

.post-detail-page .post-meta {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
    color: #64748b;
    margin-bottom: 0.75rem;
}

.post-detail-page .post-meta-line {
    display: flex;
    flex-wrap: wrap;
    gap: 1rem;
    align-items: center;
    font-size: 0.9rem;
    color: #64748b;
    padding: 1rem 0;
    margin-top: 1.5rem;
    margin-bottom: 1.5rem;
    border-top: 1px solid #e2e8f0;
    border-bottom: 1px solid #e2e8f0;
}

/* Mobile responsive layout */
@media (max-width: 768px) {
    .post-detail-page .post-meta-line {
        gap: 0.5rem;
        font-size: 0.8rem;
    }
}

.post-detail-page .post-author-info {
    display: block;
    font-size: 0.9rem;
    color: #64748b;
}

.post-detail-page .post-author-info .post-author {
    display: block;
    margin-bottom: 0.25rem;
}

.post-detail-page .post-author-info .post-time {
    display: block;
}

.post-detail-page .post-category {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.8rem;
    font-weight: 500;
}

.post-detail-page .post-content {
    font-size: 1.1rem;
    line-height: 1.8;
    color: #2d3748;
    margin-bottom: 2rem;
    white-space: pre-wrap;
}

/* 移除原来的post-actions样式，因为已合并到post-meta-line中 */

/* 评论列表区域样式增强 - 内部评论区域 */
.comments-section-inner {
    margin-top: 2rem;
    padding-top: 2rem;
    border-top: 2px solid #e2e8f0;
}

.comments-section-inner h4 {
    color: #1a202c;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

/* 保留原有的独立评论区域样式（如果需要） */
.comments-section {
    background: white;
    border-radius: 12px;
    padding: 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.comments-section h4 {
    color: #1a202c;
    margin-bottom: 1.5rem;
    font-size: 1.3rem;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 0.5rem;
    border-bottom: 2px solid #e2e8f0;
    padding-bottom: 1rem;
}

.comment-item {
    background: #f8fafc;
    border-radius: 8px;
    padding: 1rem;
    margin-bottom: 1rem;
    border-left: 3px solid #667eea;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 0.5rem;
}

.comment-author {
    font-weight: 600;
    color: #2d3748;
}

.comment-time {
    font-size: 0.8rem;
    color: #64748b;
}

.comment-content {
    color: #4a5568;
    line-height: 1.6;
}

.no-comments {
    text-align: center;
    color: #64748b;
    font-style: italic;
    padding: 2rem;
}

/* 帖子页面响应式设计 */
@media (max-width: 768px) {
    .comment-form-card {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .comment-form-card h4 {
        font-size: 1.1rem;
    }
    
    .comment-form-card input,
    .comment-form-card textarea {
        padding: 0.6rem 0.8rem;
        font-size: 0.9rem;
    }
    
    .post-detail-page {
        padding: 1.5rem;
        margin: 1rem;
    }
    
    .post-detail-page .post-title {
        font-size: 1.5rem;
    }
    
    .post-detail-page .post-meta {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .post-detail-page .post-meta-line {
        flex-direction: column;
        align-items: flex-start;
        gap: 0.5rem;
    }
    
    .comments-section-inner {
        margin-top: 1.5rem;
        padding-top: 1.5rem;
    }
}