/* 全局样式 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    line-height: 1.6;
    color: #333;
    background-color: #f5f5f5;
}

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

/* 头部样式 */
.header {
    background-color: #fff;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 15px 0;
    position: sticky;
    top: 0;
    z-index: 100;
}

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

.logo {
    font-size: 24px;
    font-weight: bold;
    color: #333;
    text-decoration: none;
}

.search-form {
    display: flex;
    gap: 10px;
    width: 400px;
}

.search-form input {
    flex: 1;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.search-form button {
    padding: 10px 20px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

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

.header-right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.user-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
}

.btn {
    padding: 10px 20px;
    background-color: #6c757d;
    color: #fff;
    border: none;
    border-radius: 4px;
    text-decoration: none;
    cursor: pointer;
    font-size: 14px;
    transition: background-color 0.3s;
}

.btn:hover {
    background-color: #5a6268;
}

.btn-primary {
    background-color: #007bff;
}

.btn-primary:hover {
    background-color: #0056b3;
}

/* 主要内容样式 */
.main {
    padding: 20px 0;
}

/* 帖子样式 */
.posts-container {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 20px;
}

.post-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.post-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.post-header {
    padding: 15px;
    border-bottom: 1px solid #eee;
}

.post-user {
    display: flex;
    align-items: center;
    gap: 10px;
}

.post-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.post-username {
    font-weight: bold;
    text-decoration: none;
    color: #333;
}

.post-meta {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-top: 5px;
    font-size: 12px;
    color: #666;
}

.post-content {
    padding: 15px;
    min-height: 100px;
}

.post-content.expanded {
    max-height: none;
}

.post-content.collapsed {
    max-height: 100px;
    overflow: hidden;
    position: relative;
}

.post-content.collapsed::after {
    content: '';
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    height: 30px;
    background: linear-gradient(to bottom, rgba(255, 255, 255, 0), rgba(255, 255, 255, 1));
}

.toggle-content {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    padding: 5px 0;
    font-size: 14px;
}

.post-images {
    display: grid;
    grid-template-columns: 1fr;
    gap: 5px;
    padding: 0 15px 15px;
}

.post-image {
    width: 100%;
    object-fit: cover;
    cursor: pointer;
    transition: transform 0.3s;
}

.post-image:hover {
    transform: scale(1.02);
}

.thumbnail {
    width: 700px;
    max-width: 100%;
    height: auto;
    object-fit: cover;
}

.hidden {
    display: none;
}

.original-image {
    width: 100%;
    height: auto;
}

/* 移动端适配 */
@media (max-width: 768px) {
    .thumbnail {
        width: 100%;
    }
}

/* 评论系统样式 */
.post-comments {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.comments-list {
    margin-bottom: 20px;
}

.comment {
    margin-bottom: 15px;
    padding: 15px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 10px;
}

.comment-content {
    margin-bottom: 10px;
    line-height: 1.6;
}

.comment-actions {
    display: flex;
    align-items: center;
}

.comment-replies {
    margin-top: 15px;
    margin-left: 40px;
    padding-left: 15px;
    border-left: 2px solid #eee;
}

.comment-reply {
    margin-bottom: 10px;
    padding: 10px;
    background-color: #f5f5f5;
    border-radius: 6px;
}

.comment-input-area {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.comment-input {
    width: 100%;
    min-height: 80px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

.reply-input-container {
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reply-input {
    width: 100%;
    min-height: 60px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

.load-more-comments,
.load-more-replies {
    margin-top: 10px;
    padding: 5px 10px;
    background-color: transparent;
    border: none;
    color: #007bff;
    cursor: pointer;
    font-size: 14px;
}

.load-more-comments:hover,
.load-more-replies:hover {
    text-decoration: underline;
}

.post-tags {
    padding: 0 15px 15px;
    display: flex;
    flex-wrap: wrap;
    gap: 8px;
}

.post-tag {
    background-color: #f0f0f0;
    color: #333;
    padding: 5px 10px;
    border-radius: 20px;
    font-size: 12px;
    text-decoration: none;
    transition: background-color 0.3s;
}

.post-tag:hover {
    background-color: #e0e0e0;
}

.post-actions {
    padding: 15px;
    border-top: 1px solid #eee;
    display: flex;
    justify-content: space-around;
}

.action-btn {
    display: flex;
    align-items: center;
    gap: 5px;
    background: none;
    border: none;
    color: #666;
    cursor: pointer;
    font-size: 14px;
    padding: 5px 10px;
    border-radius: 4px;
    transition: background-color 0.3s;
}

.action-btn:hover {
    background-color: #f0f0f0;
}

.action-btn.liked {
    color: #dc3545;
}

/* 发布帖子页面 */
.create-post-container {
    max-width: 800px;
    margin: 0 auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    padding: 20px;
}

.create-post-form {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.form-group {
    display: flex;
    flex-direction: column;
    gap: 5px;
}

.form-group label {
    font-weight: bold;
    font-size: 14px;
}

.form-group textarea {
    resize: vertical;
    min-height: 150px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    font-size: 14px;
}

.mood-selector {
    display: flex;
    gap: 10px;
}

.mood-btn {
    width: 40px;
    height: 40px;
    border: 2px solid #ddd;
    background-color: #fff;
    border-radius: 50%;
    cursor: pointer;
    font-weight: bold;
    transition: all 0.3s;
}

.mood-btn.selected {
    border-color: #007bff;
    background-color: #007bff;
    color: #fff;
}

.image-upload {
    border: 2px dashed #ddd;
    border-radius: 8px;
    padding: 20px;
    text-align: center;
    cursor: pointer;
    transition: border-color 0.3s;
}

.image-upload:hover {
    border-color: #007bff;
}

.image-upload input {
    display: none;
}

.preview-images {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    margin-top: 10px;
}

.preview-image {
    position: relative;
    width: 100px;
    height: 100px;
}

.preview-image img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    border-radius: 4px;
}

.remove-image {
    position: absolute;
    top: -5px;
    right: -5px;
    background-color: #dc3545;
    color: #fff;
    border: none;
    border-radius: 50%;
    width: 20px;
    height: 20px;
    font-size: 12px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
}

.privacy-setting {
    display: flex;
    align-items: center;
    gap: 10px;
}

.privacy-setting input[type="checkbox"] {
    width: 18px;
    height: 18px;
}

/* 图片弹窗 */
.modal {
    display: none;
    position: fixed;
    z-index: 1000;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.9);
}

.modal.show {
    display: flex;
    align-items: center;
    justify-content: center;
}

.modal-content {
    display: flex;
    width: 90%;
    max-width: 1200px;
    height: 80%;
    background-color: #fff;
    border-radius: 8px;
    overflow: hidden;
}

.modal-left {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    background-color: #000;
}

.image-carousel {
    position: relative;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.carousel-prev, .carousel-next {
    position: absolute;
    top: 50%;
    transform: translateY(-50%);
    background-color: rgba(0, 0, 0, 0.5);
    color: #fff;
    border: none;
    width: 40px;
    height: 40px;
    border-radius: 50%;
    cursor: pointer;
    font-size: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 10;
}

.carousel-prev {
    left: 20px;
}

.carousel-next {
    right: 20px;
}

#modalImage {
    max-width: 100%;
    max-height: 100%;
    object-fit: contain;
}

.carousel-indicators {
    position: absolute;
    bottom: 20px;
    left: 50%;
    transform: translateX(-50%);
    display: flex;
    gap: 10px;
}

.indicator {
    width: 10px;
    height: 10px;
    border-radius: 50%;
    background-color: rgba(255, 255, 255, 0.5);
    cursor: pointer;
}

.indicator.active {
    background-color: #fff;
}

.modal-right {
    width: 350px;
    padding: 20px;
    overflow-y: auto;
}

.close {
    position: absolute;
    top: 10px;
    right: 20px;
    color: #fff;
    font-size: 30px;
    cursor: pointer;
}

/* 评论样式 */
.comments-container {
    margin-top: 20px;
    padding-top: 20px;
    border-top: 1px solid #eee;
}

.comment-form {
    display: flex;
    gap: 10px;
    margin-bottom: 20px;
}

.comment-form textarea {
    flex: 1;
    min-height: 60px;
    padding: 10px;
    border: 1px solid #ddd;
    border-radius: 4px;
    resize: vertical;
}

.comment-list {
    display: flex;
    flex-direction: column;
    gap: 20px;
}

.comment {
    display: flex;
    gap: 10px;
    padding: 10px;
    background-color: #f9f9f9;
    border-radius: 8px;
}

.comment-avatar img {
    width: 40px;
    height: 40px;
    border-radius: 50%;
}

.comment-content {
    flex: 1;
}

.comment-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 5px;
}

.comment-username {
    font-weight: bold;
    font-size: 14px;
}

.comment-time {
    font-size: 12px;
    color: #666;
}

.comment-text {
    font-size: 14px;
    margin-bottom: 10px;
}

.comment-actions {
    display: flex;
    gap: 10px;
    font-size: 12px;
}

.comment-actions button {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
}

.replies {
    margin-left: 50px;
    margin-top: 10px;
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.reply {
    padding: 10px;
    background-color: #f0f0f0;
    border-radius: 8px;
    font-size: 14px;
}

.toggle-replies {
    background: none;
    border: none;
    color: #007bff;
    cursor: pointer;
    padding: 5px 0;
    font-size: 12px;
    margin-left: 50px;
}

/* 页脚样式 */
.footer {
    background-color: #fff;
    border-top: 1px solid #eee;
    padding: 20px 0;
    margin-top: 50px;
    text-align: center;
    font-size: 14px;
    color: #666;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .header .container {
        flex-direction: column;
        gap: 15px;
    }
    
    .search-form {
        width: 100%;
    }
    
    .posts-container {
        grid-template-columns: 1fr;
    }
    
    .modal-content {
        flex-direction: column;
        height: 90%;
    }
    
    .modal-right {
        width: 100%;
        height: 50%;
    }
}