/* YBBS社区系统 - 主样式文件 */

/* 基础样式重置 */
* {
    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: #f8f9fa;
}

/* 导航栏样式 */
.navbar-brand {
    font-weight: bold;
    font-size: 1.5rem;
}

.navbar-nav .nav-link {
    font-weight: 500;
    padding: 0.5rem 1rem;
}

/* 卡片样式增强 */
.card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: box-shadow 0.15s ease-in-out;
}

.card:hover {
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.card-header {
    border-bottom: 1px solid rgba(0, 0, 0, 0.125);
}

/* 按钮样式增强 */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    transition: all 0.15s ease-in-out;
}

.btn-primary {
    background: linear-gradient(135deg, #007bff 0%, #0056b3 100%);
    border: none;
}

.btn-success {
    background: linear-gradient(135deg, #28a745 0%, #1e7e34 100%);
    border: none;
}

.btn-warning {
    background: linear-gradient(135deg, #ffc107 0%, #e0a800 100%);
    border: none;
}

.btn-danger {
    background: linear-gradient(135deg, #dc3545 0%, #c82333 100%);
    border: none;
}

/* 论坛样式 */
.thread-item:hover {
    background-color: #f8f9fa;
}

.post-item {
    border-left: 3px solid transparent;
    transition: border-left-color 0.15s ease-in-out;
}

.post-item:hover {
    border-left-color: #007bff;
}

/* 聊天样式 */
.chat-messages {
    scroll-behavior: smooth;
}

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

.message-item.own {
    background-color: #e3f2fd;
    border-radius: 1rem 1rem 0 1rem;
}

.message-item.other {
    background-color: #f5f5f5;
    border-radius: 1rem 1rem 1rem 0;
}

/* 软件库样式 */
.software-card {
    transition: transform 0.2s ease-in-out;
}

.software-card:hover {
    transform: translateY(-2px);
}

.rating-stars {
    color: #ffc107;
}

/* 内容格式化样式 */
.formatted-content {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

.formatted-content img {
    max-width: 100%;
    height: auto;
}

.formatted-content pre {
    white-space: pre-wrap;
    word-wrap: break-word;
    overflow-x: auto;
}

.formatted-content table {
    max-width: 100%;
    overflow-x: auto;
    display: block;
}

/* 软件标题样式 */
.software-title {
    word-wrap: break-word;
    overflow-wrap: break-word;
    word-break: break-word;
    min-width: 0; /* 在flex容器中允许收缩 */
}

/* 瀑布流布局 */
.masonry-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    grid-gap: 1.5rem;
    margin-bottom: 1.5rem;
}

.masonry-item {
    break-inside: avoid;
    margin-bottom: 1rem;
}

/* 侧边栏固定定位 */
.sticky-top {
    position: sticky;
    top: 1rem;
    z-index: 1020;
}

/* 分页样式 */
.pagination {
    margin-top: 1rem;
    justify-content: center !important;
}

.page-link {
    color: #007bff;
    background-color: #fff;
    border: 1px solid #dee2e6;
}

.page-link:hover {
    color: #0056b3;
    background-color: #e9ecef;
    border-color: #adb5bd;
}

.page-item.active .page-link {
    z-index: 3;
    color: #fff;
    background-color: #007bff;
    border-color: #007bff;
}

.page-item.disabled .page-link {
    color: #6c757d;
    background-color: #fff;
    border-color: #dee2e6;
}

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

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

/* 响应式设计 */
@media (max-width: 768px) {
    .navbar-nav {
        text-align: center;
    }
    
    .card-body {
        padding: 1rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .masonry-grid {
        grid-template-columns: 1fr;
        grid-gap: 1rem;
    }
    
    /* 在小屏幕上禁用侧边栏固定定位 */
    .sticky-top {
        position: static;
    }
}

/* 加载动画 */
.loading-spinner {
    display: inline-block;
    width: 2rem;
    height: 2rem;
    border: 0.25rem solid #f3f3f3;
    border-top: 0.25rem solid #007bff;
    border-radius: 50%;
    animation: spin 1s linear infinite;
}

@keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* 工具类 */
.text-truncate-2 {
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-3 {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
}

.text-truncate-multi {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

/* 自定义滚动条 */
::-webkit-scrollbar {
    width: 8px;
}

::-webkit-scrollbar-track {
    background: #f1f1f1;
}

::-webkit-scrollbar-thumb {
    background: #c1c1c1;
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: #a8a8a8;
}