/* 主样式文件 */

/* 全局重置 */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

/* 根变量 */
:root {
    --primary-color: #10B981;
    --secondary-color: #F59E0B;
    --background-color: #F9FAFB;
    --text-color: #1F2937;
    --text-secondary: #6B7280;
    --border-color: #E5E7EB;
    --white: #FFFFFF;
    --danger: #EF4444;
    --success: #10B981;
    --warning: #F59E0B;
    --info: #3B82F6;
    --light: #F3F4F6;
    --dark: #1F2937;
    --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1), 0 2px 4px -1px rgba(0, 0, 0, 0.06);
    --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -2px rgba(0, 0, 0, 0.05);
    --border-radius: 8px;
    --transition: all 0.3s ease;
}

/* 基础样式 */
body {
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
    font-size: 16px;
    line-height: 1.6;
    color: var(--text-color);
    background-color: var(--background-color);
}

/* 链接样式 */
a {
    color: var(--primary-color);
    text-decoration: none;
    transition: var(--transition);
}

a:hover {
    color: #059669;
    text-decoration: underline;
}

/* 标题样式 */
h1, h2, h3, h4, h5, h6 {
    font-weight: 600;
    line-height: 1.25;
    margin-bottom: 0.5rem;
    color: var(--text-color);
}

h1 {
    font-size: 2.5rem;
}

h2 {
    font-size: 2rem;
}

h3 {
    font-size: 1.5rem;
}

h4 {
    font-size: 1.25rem;
}

h5 {
    font-size: 1.125rem;
}

h6 {
    font-size: 1rem;
}

/* 段落样式 */
p {
    margin-bottom: 1rem;
}

/* 容器 */
.container {
    width: 100%;
    max-width: 1200px;
    margin: 0 auto;
    padding: 0 1rem;
}

/* 卡片 */
.card {
    background: var(--white);
    border-radius: var(--border-radius);
    box-shadow: var(--shadow);
    padding: 1.5rem;
    margin-bottom: 1rem;
    transition: var(--transition);
}

.card:hover {
    box-shadow: var(--shadow-lg);
    transform: translateY(-2px);
}

/* 按钮样式 */
.btn {
    display: inline-block;
    padding: 0.75rem 1.5rem;
    border-radius: var(--border-radius);
    font-weight: 500;
    text-align: center;
    cursor: pointer;
    transition: var(--transition);
    border: none;
    font-size: 1rem;
}

.btn-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.btn-primary:hover {
    background-color: #059669;
    color: var(--white);
    text-decoration: none;
}

.btn-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.btn-secondary:hover {
    background-color: #d97706;
    color: var(--white);
    text-decoration: none;
}

.btn-outline {
    background-color: transparent;
    color: var(--primary-color);
    border: 1px solid var(--primary-color);
}

.btn-outline:hover {
    background-color: var(--primary-color);
    color: var(--white);
    text-decoration: none;
}

.btn-danger {
    background-color: var(--danger);
    color: var(--white);
}

.btn-danger:hover {
    background-color: #dc2626;
    color: var(--white);
    text-decoration: none;
}

.btn-sm {
    padding: 0.5rem 1rem;
    font-size: 0.875rem;
}

.btn-lg {
    padding: 1rem 2rem;
    font-size: 1.125rem;
}

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

.form-label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--text-color);
}

.form-control {
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    font-size: 1rem;
    transition: var(--transition);
}

.form-control:focus {
    outline: none;
    border-color: var(--primary-color);
    box-shadow: 0 0 0 3px rgba(16, 185, 129, 0.1);
}

.form-control::placeholder {
    color: var(--text-secondary);
}

/* 输入组 */
.input-group {
    display: flex;
    align-items: center;
}

.input-group .form-control {
    flex: 1;
    border-radius: var(--border-radius) 0 0 var(--border-radius);
}

.input-group .btn {
    border-radius: 0 var(--border-radius) var(--border-radius) 0;
}

/* 徽章 */
.badge {
    display: inline-block;
    padding: 0.25rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 500;
}

.badge-primary {
    background-color: var(--primary-color);
    color: var(--white);
}

.badge-secondary {
    background-color: var(--secondary-color);
    color: var(--white);
}

.badge-danger {
    background-color: var(--danger);
    color: var(--white);
}

.badge-info {
    background-color: var(--info);
    color: var(--white);
}

/* 警告框 */
.alert {
    padding: 1rem;
    border-radius: var(--border-radius);
    margin-bottom: 1rem;
    border-left: 4px solid;
}

.alert-success {
    background-color: rgba(16, 185, 129, 0.1);
    border-left-color: var(--success);
    color: var(--success);
}

.alert-danger {
    background-color: rgba(239, 68, 68, 0.1);
    border-left-color: var(--danger);
    color: var(--danger);
}

.alert-warning {
    background-color: rgba(245, 158, 11, 0.1);
    border-left-color: var(--warning);
    color: var(--warning);
}

.alert-info {
    background-color: rgba(59, 130, 246, 0.1);
    border-left-color: var(--info);
    color: var(--info);
}

/* 列表 */
ul, ol {
    margin-bottom: 1rem;
    padding-left: 1.5rem;
}

li {
    margin-bottom: 0.5rem;
}

/* 图片 */
.img-fluid {
    max-width: 100%;
    height: auto;
}

.img-thumbnail {
    border: 1px solid var(--border-color);
    border-radius: var(--border-radius);
    padding: 0.25rem;
    background-color: var(--white);
    max-width: 100%;
    height: auto;
}

/* 头像 */
.avatar {
    display: inline-block;
    border-radius: 50%;
    overflow: hidden;
}

.avatar-sm {
    width: 32px;
    height: 32px;
}

.avatar-md {
    width: 48px;
    height: 48px;
}

.avatar-lg {
    width: 64px;
    height: 64px;
}

/* 分隔线 */
hr {
    border: 0;
    border-top: 1px solid var(--border-color);
    margin: 1.5rem 0;
}

/* 工具类 */
.text-center {
    text-align: center;
}

.text-right {
    text-align: right;
}

.text-left {
    text-align: left;
}

.mt-1 { margin-top: 0.25rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mt-5 { margin-top: 3rem; }

.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.mb-5 { margin-bottom: 3rem; }

.ml-1 { margin-left: 0.25rem; }
.ml-2 { margin-left: 0.5rem; }
.ml-3 { margin-left: 1rem; }
.ml-4 { margin-left: 1.5rem; }
.ml-5 { margin-left: 3rem; }

.mr-1 { margin-right: 0.25rem; }
.mr-2 { margin-right: 0.5rem; }
.mr-3 { margin-right: 1rem; }
.mr-4 { margin-right: 1.5rem; }
.mr-5 { margin-right: 3rem; }

.p-1 { padding: 0.25rem; }
.p-2 { padding: 0.5rem; }
.p-3 { padding: 1rem; }
.p-4 { padding: 1.5rem; }
.p-5 { padding: 3rem; }

.pt-1 { padding-top: 0.25rem; }
.pt-2 { padding-top: 0.5rem; }
.pt-3 { padding-top: 1rem; }
.pt-4 { padding-top: 1.5rem; }
.pt-5 { padding-top: 3rem; }

.pb-1 { padding-bottom: 0.25rem; }
.pb-2 { padding-bottom: 0.5rem; }
.pb-3 { padding-bottom: 1rem; }
.pb-4 { padding-bottom: 1.5rem; }
.pb-5 { padding-bottom: 3rem; }

.pl-1 { padding-left: 0.25rem; }
.pl-2 { padding-left: 0.5rem; }
.pl-3 { padding-left: 1rem; }
.pl-4 { padding-left: 1.5rem; }
.pl-5 { padding-left: 3rem; }

.pr-1 { padding-right: 0.25rem; }
.pr-2 { padding-right: 0.5rem; }
.pr-3 { padding-right: 1rem; }
.pr-4 { padding-right: 1.5rem; }
.pr-5 { padding-right: 3rem; }

.d-flex {
    display: flex;
}

.flex-column {
    flex-direction: column;
}

.justify-content-center {
    justify-content: center;
}

.justify-content-between {
    justify-content: space-between;
}

.align-items-center {
    align-items: center;
}

.flex-wrap {
    flex-wrap: wrap;
}

.flex-grow-1 {
    flex-grow: 1;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

/* 动画 */
@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.fade-in {
    animation: fadeIn 0.3s ease-in-out;
}

/* 加载动画 */
.loading {
    display: inline-block;
    width: 20px;
    height: 20px;
    border: 2px solid var(--border-color);
    border-radius: 50%;
    border-top-color: var(--primary-color);
    animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 滚动条样式 */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: var(--light);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb {
    background: var(--border-color);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-secondary);
}

/* 选择文本样式 */
::selection {
    background-color: rgba(16, 185, 129, 0.2);
    color: var(--text-color);
}

/* 禁用状态 */
.disabled {
    opacity: 0.6;
    cursor: not-allowed;
    pointer-events: none;
}

/* 网格系统 */
.row {
    display: flex;
    flex-wrap: wrap;
    margin: 0 -1rem;
}

.col-lg-3, .col-lg-9 {
    padding: 0 1rem;
    position: relative;
    width: 100%;
}

@media (min-width: 992px) {
    .col-lg-3 {
        flex: 0 0 25%;
        max-width: 25%;
    }
    
    .col-lg-9 {
        flex: 0 0 75%;
        max-width: 75%;
    }
}

/* 响应式工具类 */
.d-none {
    display: none !important;
}

@media (min-width: 992px) {
    .d-lg-block {
        display: block !important;
    }
}

@media (max-width: 767px) {
    .d-none-mobile {
        display: none !important;
    }
}

@media (min-width: 768px) {
    .d-none-desktop {
        display: none !important;
    }
}

/* 评论样式 */
.comment {
    background-color: #fff;
    transition: all 0.2s ease;
}

.comment:hover {
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.comment-header {
    border-bottom: 1px solid #f0f0f0;
    padding-bottom: 8px;
}

/* 回复容器样式 */
.replies-container {
    background-color: #fafafa;
    border-radius: 8px;
    padding: 12px;
    margin-top: 12px;
}

/* 回复项样式 */
.reply-item {
    background-color: #f8f9fa;
    border-left: 3px solid #007bff;
    transition: all 0.2s ease;
}

.reply-item:hover {
    background-color: #e9ecef;
    border-left-color: #0056b3;
}

.reply-item .reply-header {
    font-size: 0.9rem;
}

/* 回复表单样式 */
.reply-form {
    background-color: #fff;
    border: 1px solid #dee2e6;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

/* 展开/折叠回复按钮 */
.toggle-replies-btn {
    color: #007bff;
    font-size: 0.85rem;
    padding: 4px 8px;
    margin-top: 8px;
    text-decoration: none;
    display: inline-flex;
    align-items: center;
    transition: all 0.2s ease;
}

.toggle-replies-btn:hover {
    color: #0056b3;
    text-decoration: underline;
}

.toggle-replies-btn i {
    transition: transform 0.2s ease;
}

.toggle-replies-btn:hover i {
    transform: translateY(2px);
}

/* 隐藏的回复区域 */
.hidden-replies {
    animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* 评论操作按钮 */
.comment-actions .btn,
.reply-actions .btn {
    padding: 2px 8px;
    font-size: 0.85rem;
}

.comment-actions .btn:hover,
.reply-actions .btn:hover {
    background-color: #f0f0f0;
}

/* 评论菜单 */
.dropdown-menu {
    min-width: 120px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.dropdown-item {
    padding: 8px 16px;
    font-size: 0.9rem;
}

.dropdown-item:hover {
    background-color: #f8f9fa;
}

/* 旧版兼容样式 */
.reply[data-indent-level="1"] {
    margin-left: 0;
}

.reply[data-indent-level="2"] {
    margin-left: 2rem;
}

/* Markdown 内容样式 */
.markdown-body {
    font-size: 16px;
    line-height: 1.6;
    color: #24292e;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-all;
    white-space: normal;
}

.markdown-body * {
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
}

.markdown-body h1,
.markdown-body h2,
.markdown-body h3,
.markdown-body h4,
.markdown-body h5,
.markdown-body h6 {
    margin-top: 24px;
    margin-bottom: 16px;
    font-weight: 600;
    line-height: 1.25;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.markdown-body h1 { font-size: 2em; border-bottom: 1px solid #eaecef; padding-bottom: 0.3em; }
.markdown-body h2 { font-size: 1.5em; border-bottom: 1px solid #eaecef; padding-bottom: 0.3em; }
.markdown-body h3 { font-size: 1.25em; }
.markdown-body h4 { font-size: 1em; }
.markdown-body h5 { font-size: 0.875em; }
.markdown-body h6 { font-size: 0.85em; color: #6a737d; }

.markdown-body p {
    margin-bottom: 1em;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.markdown-body code {
    background-color: rgba(27,31,35,0.05);
    padding: 0.2em 0.4em;
    border-radius: 3px;
    font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
    font-size: 85%;
    word-break: break-all;
    white-space: pre-wrap;
    max-width: 100%;
}

.markdown-body pre {
    background-color: #f6f8fa;
    padding: 16px;
    border-radius: 3px;
    overflow: auto;
    margin-bottom: 1em;
    max-width: 100%;
    white-space: pre-wrap;
    word-wrap: break-word;
}

.markdown-body pre code {
    background-color: transparent;
    padding: 0;
    word-break: break-all;
    white-space: pre-wrap;
}

.markdown-body blockquote {
    border-left: 4px solid #dfe2e5;
    padding: 0 16px;
    color: #6a737d;
    margin: 1em 0;
    max-width: 100%;
    overflow-wrap: break-word;
    word-wrap: break-word;
    word-break: break-word;
}

.markdown-body a {
    color: #0366d6;
    text-decoration: none;
    word-break: break-all;
    max-width: 100%;
}

.markdown-body a:hover {
    text-decoration: underline;
}

.markdown-body img {
    max-width: 100%;
    height: auto;
    border-radius: 4px;
    margin: 0.5em 0;
    display: block;
}

.markdown-body ul,
.markdown-body ol {
    padding-left: 2em;
    margin-bottom: 1em;
    max-width: 100%;
}

.markdown-body li {
    margin-bottom: 0.5em;
    word-break: break-all;
    max-width: 100%;
}

.markdown-body table {
    border-collapse: collapse;
    width: 100%;
    margin-bottom: 1em;
    max-width: 100%;
    overflow: auto;
    display: block;
}

.markdown-body th,
.markdown-body td {
    border: 1px solid #dfe2e5;
    padding: 8px 12px;
    text-align: left;
    word-break: break-all;
    max-width: 100%;
}

.markdown-body th {
    background-color: #f6f8fa;
    font-weight: 600;
}

.markdown-body hr {
        border: 0;
        border-top: 2px solid #eaecef;
        margin: 2em 0;
        max-width: 100%;
    }
    
    /* 文件预览模态框 */
    .file-preview-modal {
        display: none;
        position: fixed;
        z-index: 9999;
        left: 0;
        top: 0;
        width: 100%;
        height: 100%;
        background-color: rgba(0,0,0,0.95);
        overflow: hidden;
    }
    
    .file-preview-modal.active {
        display: flex;
        align-items: center;
        justify-content: center;
        flex-direction: column;
    }
    
    .file-preview-modal .close-modal {
        position: absolute;
        top: 20px;
        right: 35px;
        color: #f1f1f1;
        font-size: 40px;
        font-weight: bold;
        cursor: pointer;
        z-index: 10000;
        transition: color 0.3s ease;
    }
    
    .file-preview-modal .close-modal:hover {
        color: var(--primary-color);
    }
    
    .file-preview-modal .preview-content {
        max-width: 90%;
        max-height: 85vh;
        position: relative;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .file-preview-modal .preview-content img,
    .file-preview-modal .preview-content video {
        max-width: 100%;
        max-height: 85vh;
        border-radius: 8px;
        object-fit: contain;
    }
    
    .file-preview-modal .file-info-bar {
        position: absolute;
        bottom: 20px;
        left: 50%;
        transform: translateX(-50%);
        background: rgba(0,0,0,0.8);
        color: white;
        padding: 12px 30px;
        border-radius: 30px;
        display: flex;
        gap: 20px;
        align-items: center;
        z-index: 10000;
    }
    
    .file-preview-modal .file-info-bar .file-name {
        font-size: 14px;
        font-weight: 500;
        max-width: 300px;
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }
    
    .file-preview-modal .file-info-bar .file-meta {
        font-size: 13px;
        color: #aaa;
    }
    
    .file-preview-modal .preview-nav {
        position: absolute;
        top: 50%;
        transform: translateY(-50%);
        font-size: 32px;
        color: white;
        cursor: pointer;
        padding: 15px;
        z-index: 10000;
        transition: all 0.3s ease;
        background: rgba(255,255,255,0.1);
        border-radius: 50%;
        width: 50px;
        height: 50px;
        display: flex;
        align-items: center;
        justify-content: center;
    }
    
    .file-preview-modal .preview-nav:hover {
        color: var(--primary-color);
        background: rgba(255,255,255,0.2);
    }
    
    .file-preview-modal .prev-btn {
        left: 30px;
    }
    
    .file-preview-modal .next-btn {
        right: 30px;
    }

/* 帖子卡片样式 */
.post-card {
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin-bottom: 16px;
    transition: all 0.2s ease;
    cursor: pointer;
}

.post-card:hover {
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.12);
    transform: translateY(-2px);
}

.post-header {
    display: flex;
    align-items: center;
    padding: 16px;
    padding-bottom: 12px;
}

.post-avatar {
    flex-shrink: 0;
}

.post-meta {
    flex: 1;
    margin-left: 12px;
}

.post-author {
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 2px;
}

.post-time {
    font-size: 0.875rem;
    color: #6B7280;
    display: flex;
    align-items: center;
}

.post-content {
    padding: 0 16px;
    padding-bottom: 12px;
}

.post-title {
    font-size: 1.125rem;
    font-weight: 600;
    color: #1F2937;
    margin-bottom: 8px;
}

.post-content p {
    color: #4B5563;
    line-height: 1.6;
    margin-bottom: 0;
}

.post-media {
    padding: 0 16px;
    padding-bottom: 12px;
}

.post-media img {
    width: 100%;
    height: auto;
    max-height: 400px;
    object-fit: contain;
    border-radius: 8px;
    cursor: pointer;
    transition: transform 0.2s ease;
    display: block;
}

.post-media img:hover {
    transform: scale(1.01);
}

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

.post-action {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 6px 16px;
    border-radius: 6px;
    cursor: pointer;
    color: #6B7280;
    transition: all 0.2s ease;
}

.post-action:hover {
    background-color: #F3F4F6;
    color: #374151;
}

.post-action i {
    font-size: 1.125rem;
}

.post-action span {
    font-size: 0.875rem;
}

.post-action.active {
    color: #10B981;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .post-media img {
        max-height: 300px;
    }
    
    .post-actions {
        padding: 10px 8px;
    }
    
    .post-action {
        padding: 6px 10px;
    }
}
