/* tg2emall 前端样式 - 基于Bootstrap的简化版本 */

/* 基础变量 */
:root {
    --bs-body-bg: #ffffff;
    --bs-body-color: #212529;
    --bs-primary: #0d6efd;
    --bs-secondary: #6c757d;
    --bs-success: #198754;
    --bs-info: #0dcaf0;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-light: #f8f9fa;
    --bs-dark: #212529;
    --bs-border-color: #dee2e6;
    --bs-card-bg: #ffffff;
    --bs-navbar-bg: #0d6efd;
    --bs-footer-bg: #f8f9fa;
}

/* 暗黑模式变量 */
[data-bs-theme="dark"] {
    --bs-body-bg: #1a1a1a;
    --bs-body-color: #ffffff;
    --bs-primary: #0d6efd;
    --bs-secondary: #6c757d;
    --bs-success: #198754;
    --bs-info: #0dcaf0;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-light: #343a40;
    --bs-dark: #ffffff;
    --bs-border-color: #495057;
    --bs-card-bg: #2d2d2d;
    --bs-navbar-bg: #0d6efd;
    --bs-footer-bg: #343a40;
}

/* 全局样式 */
body {
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    line-height: 1.6;
    transition: background-color 0.3s ease, color 0.3s ease;
    background: linear-gradient(135deg, #f5f5dc 0%, #e6e6d3 100%);
    background-attachment: fixed;
    min-height: 100vh;
    position: relative;
}

/* Bing壁纸背景层 */
body::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--bing-wallpaper, linear-gradient(135deg, #f5f5dc 0%, #e6e6d3 100%));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
}

/* 暗黑模式全局样式 */
.dark-theme {
    background: linear-gradient(135deg, #3a3a2e 0%, #2d2d20 100%);
    color: #e0e0e0;
}

.dark-theme::before {
    content: '';
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-image: var(--bing-wallpaper, linear-gradient(135deg, #3a3a2e 0%, #2d2d20 100%));
    background-size: cover;
    background-position: center;
    background-repeat: no-repeat;
    z-index: -1;
    filter: brightness(0.7);
}

/* 导航栏样式 - 保持毛玻璃效果 */
.navbar {
    background: rgba(255, 255, 255, 0.1) !important; /* 使用半透明白色背景 */
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.1);
    padding: 0.25rem 0 !important;
    min-height: auto !important;
}

.navbar-brand {
    font-weight: 700;
}

.navbar-brand .navbar-text {
    margin-top: 1px;
    font-size: 0.7rem !important;
}

/* 导航链接颜色 - 强制覆盖 */
.navbar-nav .nav-link {
    color: #ffffff !important;
}

.navbar-nav .nav-link:hover {
    color: #ffffff !important;
    opacity: 0.8;
}

/* 暗黑模式导航栏 */
.dark-theme .navbar {
    background: rgba(45, 45, 45, 0.2) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 2px 20px rgba(0, 0, 0, 0.3);
}

/* 搜索框样式 */
.search-container {
    max-width: 600px;
    margin: 0 auto;
}

.search-form .input-group {
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
    border-radius: 25px;
    overflow: hidden;
    border: none;
}

.search-form .input-group:focus-within {
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.15);
    border: none;
}

.search-input {
    border: none;
    padding: 15px 20px;
    font-size: 16px;
    border-radius: 25px 0 0 25px;
    background-color: #fff;
    box-shadow: none;
}

.search-input:focus {
    box-shadow: none;
    border-color: transparent;
    outline: none;
    background-color: #fff;
}

.search-form .btn {
    border-radius: 0 25px 25px 0;
    padding: 15px 20px;
    border: none;
    background-color: #f8f9fa;
}

.search-form .btn:hover {
    background-color: #e9ecef;
}

/* 快捷搜索标签 */
.quick-search {
    margin-top: 20px;
}

.quick-search .badge {
    cursor: pointer;
    transition: all 0.3s ease;
}

.quick-search .badge:hover {
    transform: translateY(-2px);
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

/* 卡片样式 - 毛玻璃效果 */
.card {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 12px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
    transition: all 0.3s ease;
}

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

/* 暗黑模式卡片 */
.dark-theme .card {
    background: rgba(45, 45, 45, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.3);
}

/* 文章内容样式 */
.article-content {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-radius: 10px;
    padding: 30px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.article-title {
    color: var(--bs-body-color);
    font-weight: 700;
    margin-bottom: 20px;
    line-height: 1.3;
}

.article-meta {
    border-bottom: 1px solid var(--bs-border-color);
    padding-bottom: 15px;
    margin-bottom: 25px;
}

.content-text {
    font-size: 16px;
    line-height: 1.8;
    color: var(--bs-body-color);
}

.content-text img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 15px 0;
}

/* 搜索结果样式 */
.result-item {
    transition: all 0.3s ease;
}

.result-item:hover {
    transform: translateX(5px);
    box-shadow: 0 5px 20px rgba(0, 0, 0, 0.15);
}

.result-item .card-title a {
    color: inherit;
    transition: color 0.3s ease;
}

.result-item .card-title a:hover {
    color: #28a745;
}

/* 统计信息样式 */
.stat-item {
    text-align: center;
    padding: 10px;
}

.stat-item h4 {
    font-weight: 700;
    margin-bottom: 5px;
}

/* 标签样式 */
.tags .badge {
    font-size: 0.75em;
    margin-right: 5px;
    margin-bottom: 5px;
}

/* 分页样式 */
.pagination .page-link {
    border: none;
    color: var(--bs-body-color);
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    margin: 0 2px;
    border-radius: 8px;
    transition: all 0.3s ease;
}

.pagination .page-link:hover {
    background: var(--bs-primary);
    color: white;
    transform: translateY(-2px);
}

.pagination .page-item.active .page-link {
    background: var(--bs-primary);
    border-color: var(--bs-primary);
}

/* 页脚样式 */
footer {
    background: rgba(248, 249, 250, 0.1) !important;
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--bs-border-color);
    margin-top: 50px;
}

/* 悬浮搜索框 */
.floating-search {
    position: fixed !important;
    top: 20px !important;
    right: 20px !important;
    z-index: 99999 !important;
    transform: translateX(100%);
    transition: transform 0.3s ease-in-out, opacity 0.3s ease-in-out;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    width: 300px;
    max-width: 90vw;
    display: block !important;
}

.floating-search .search-container {
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: none;
    border-radius: 25px;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
    padding: 8px;
}

.floating-search.show {
    transform: translateX(0) !important;
    opacity: 1 !important;
    visibility: visible !important;
    pointer-events: auto !important;
    display: block !important;
}

.floating-search .search-form {
    margin: 0;
}

.floating-search .search-form .input-group {
    width: 300px;
}

.floating-search .search-input {
    border: none;
    background: transparent;
    box-shadow: none;
    padding: 8px 15px;
}

.floating-search .search-input:focus {
    border: none;
    box-shadow: none;
    background: transparent;
}

.floating-search .btn {
    border-radius: 50%;
    width: 40px;
    height: 40px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background-color: #0d6efd;
    color: #fff;
}

.floating-search .btn:hover {
    background-color: #0b5ed7;
    border-color: #0a58ca;
    color: #fff;
}

/* 暗黑模式悬浮搜索框 */
.dark-theme .floating-search .search-container {
    background: rgba(45, 45, 45, 0.95);
    border-color: rgba(255, 255, 255, 0.1);
}

.dark-theme .floating-search .search-input {
    background-color: transparent;
    color: #e0e0e0;
}

.dark-theme .floating-search .search-input:focus {
    background-color: transparent;
    color: #e0e0e0;
}

.dark-theme .floating-search .search-input::placeholder {
    color: #adb5bd;
}

/* 响应式设计 */
@media (max-width: 768px) {
    .search-container {
        padding: 0 15px;
    }
    
    .search-input {
        font-size: 14px;
        padding: 12px 15px;
    }
    
    .article-content {
        padding: 20px;
    }
    
    .floating-search .search-container {
        padding: 10px 15px;
    }
}

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

.waterfall-item {
    break-inside: avoid;
    margin-bottom: 20px;
}

/* 瀑布流卡片样式 */
.waterfall-item .resource-card {
    height: auto;
    min-height: 280px;
    max-height: none;
    display: flex;
    flex-direction: column;
}

.waterfall-item .resource-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

.waterfall-item .resource-card .card-text {
    flex: 1;
    overflow: visible;
}

.waterfall-item .resource-card .card-footer {
    margin-top: auto;
    padding-top: 0.75rem;
    flex-shrink: 0;
}

/* 资源卡片样式优化 */
.resource-card {
    height: 300px;
    overflow: hidden;
}

.resource-card .card-body {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.resource-card .card-text {
    flex-grow: 1;
    overflow: hidden;
    position: relative;
}

.resource-card .card-title {
    font-size: 1rem;
    line-height: 1.3;
    margin-bottom: 0.75rem;
}

.resource-card .card-title a {
    color: #000000;
    text-decoration: none;
    transition: color 0.3s ease;
}

.resource-card .card-title a:hover {
    color: #28a745;
}

/* 暗黑模式下文章标题颜色 */
.dark-theme .resource-card .card-title a {
    color: #ffffff !important;
}

.dark-theme .resource-card .card-title a:hover {
    color: #4caf50 !important;
}

.resource-card .card-footer {
    margin-top: auto;
    padding-top: 0.75rem;
}

/* 内容预览文本截断 */
.content-preview {
    display: -webkit-box;
    -webkit-line-clamp: 3;
    -webkit-box-orient: vertical;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
    max-height: 4.2em;
    word-wrap: break-word;
    word-break: break-word;
}

/* 确保内容预览中的图片正常显示 */
.content-preview img {
    max-width: 100% !important;
    height: auto !important;
    max-height: 120px !important;
    object-fit: contain !important;
    display: block !important;
    margin: 5px 0 !important;
    border-radius: 4px !important;
}

/* 文章更新时间字体颜色 */
.waterfall-item .resource-card .card-footer small {
    color: #000000 !important;
    font-size: 0.75rem !important;
    display: block !important;
    visibility: visible !important;
}

/* 暗黑模式下文章更新时间字体颜色 */
.dark-theme .waterfall-item .resource-card .card-footer small {
    color: #ffffff !important;
}

/* 侧边栏统计信息字体颜色 */
.card .card-header h5 {
    color: #000000 !important;
}

.card .card-body small {
    color: #000000 !important;
}

/* 暗黑模式下侧边栏统计信息字体颜色 */
.dark-theme .card .card-header h5 {
    color: #ffffff !important;
}

.dark-theme .card .card-body small {
    color: #ffffff !important;
}

/* 固定侧边栏样式 */
.sticky-sidebar {
    position: sticky;
    top: 20px;
    max-height: none;
    overflow-y: visible;
}

/* 侧边栏毛玻璃效果 */
.sticky-sidebar .card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.3);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
}

.sticky-sidebar .card-header {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px 16px 0 0;
}

.sticky-sidebar .list-group-item {
    background: rgba(255, 255, 255, 0.05);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 8px;
    margin-bottom: 4px;
    transition: all 0.3s ease;
}

.sticky-sidebar .list-group-item:hover {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-color: rgba(255, 255, 255, 0.3);
    transform: translateY(-2px);
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.1);
}

/* 暗黑模式侧边栏 */
.dark-theme .sticky-sidebar .card {
    background: rgba(45, 45, 45, 0.25);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.15);
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
}

.dark-theme .sticky-sidebar .card-header {
    background: rgba(45, 45, 45, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.dark-theme .sticky-sidebar .list-group-item {
    background: rgba(45, 45, 45, 0.1);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.05);
    color: #e0e0e0;
}

.dark-theme .sticky-sidebar .list-group-item:hover {
    background: rgba(45, 45, 45, 0.2);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-color: rgba(255, 255, 255, 0.2);
    color: #e0e0e0;
}

/* 响应式设计 - 移动端取消固定定位 */
@media (max-width: 768px) {
    .sticky-sidebar {
        position: static;
        max-height: none;
        overflow-y: visible;
    }
}

/* 通用标签颜色样式 */
.tag-badge, .badge.tag-color {
    font-size: 0.8rem;
    padding: 0.4em 0.8em;
    border-radius: 1rem;
    font-weight: 500;
    transition: all 0.3s ease;
    display: inline-block;
}

/* 标签颜色循环样式 */
.tag-badge:nth-child(1), .badge.tag-color:nth-child(1) { background-color: #e3f2fd; color: #1976d2; }
.tag-badge:nth-child(2), .badge.tag-color:nth-child(2) { background-color: #f3e5f5; color: #7b1fa2; }
.tag-badge:nth-child(3), .badge.tag-color:nth-child(3) { background-color: #e8f5e8; color: #388e3c; }
.tag-badge:nth-child(4), .badge.tag-color:nth-child(4) { background-color: #fff3e0; color: #f57c00; }
.tag-badge:nth-child(5), .badge.tag-color:nth-child(5) { background-color: #fce4ec; color: #c2185b; }
.tag-badge:nth-child(6), .badge.tag-color:nth-child(6) { background-color: #e0f2f1; color: #00695c; }
.tag-badge:nth-child(7), .badge.tag-color:nth-child(7) { background-color: #f1f8e9; color: #689f38; }
.tag-badge:nth-child(8), .badge.tag-color:nth-child(8) { background-color: #e8eaf6; color: #3f51b5; }
.tag-badge:nth-child(9), .badge.tag-color:nth-child(9) { background-color: #fff8e1; color: #ff8f00; }
.tag-badge:nth-child(10), .badge.tag-color:nth-child(10) { background-color: #f9fbe7; color: #827717; }

/* 暗黑模式下的标签颜色 */
.dark-theme .tag-badge:nth-child(1), .dark-theme .badge.tag-color:nth-child(1) { background-color: #1e3a8a !important; color: #93c5fd !important; }
.dark-theme .tag-badge:nth-child(2), .dark-theme .badge.tag-color:nth-child(2) { background-color: #581c87 !important; color: #c084fc !important; }
.dark-theme .tag-badge:nth-child(3), .dark-theme .badge.tag-color:nth-child(3) { background-color: #14532d !important; color: #86efac !important; }
.dark-theme .tag-badge:nth-child(4), .dark-theme .badge.tag-color:nth-child(4) { background-color: #9a3412 !important; color: #fed7aa !important; }
.dark-theme .tag-badge:nth-child(5), .dark-theme .badge.tag-color:nth-child(5) { background-color: #831843 !important; color: #f9a8d4 !important; }
.dark-theme .tag-badge:nth-child(6), .dark-theme .badge.tag-color:nth-child(6) { background-color: #134e4a !important; color: #5eead4 !important; }
.dark-theme .tag-badge:nth-child(7), .dark-theme .badge.tag-color:nth-child(7) { background-color: #365314 !important; color: #bef264 !important; }
.dark-theme .tag-badge:nth-child(8), .dark-theme .badge.tag-color:nth-child(8) { background-color: #312e81 !important; color: #a5b4fc !important; }
.dark-theme .tag-badge:nth-child(9), .dark-theme .badge.tag-color:nth-child(9) { background-color: #92400e !important; color: #fde68a !important; }
.dark-theme .tag-badge:nth-child(10), .dark-theme .badge.tag-color:nth-child(10) { background-color: #3f3f16 !important; color: #e6ff4a !important; }

/* 文章元信息样式 */
.article-meta .meta-info {
    margin-top: 1rem;
}

.article-meta .publish-time {
    font-size: 0.9rem;
}

.article-meta .tags {
    margin-top: 0.5rem;
}

/* 毛玻璃效果容器 */
.container, .container-fluid {
    background: rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.1);
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 30px;
}

/* 毛玻璃背景下的文字颜色优化 */
.container, .container-fluid {
    color: #000000;
}

.container h1, .container h2, .container h3, 
.container h4, .container h5, .container h6 {
    color: #000000;
    font-weight: 600;
}

.container .lead {
    color: #000000;
}

.container .text-muted {
    color: #666666 !important;
}

/* 暗黑模式毛玻璃效果容器 */
.dark-theme .container, .dark-theme .container-fluid {
    background: rgba(45, 45, 45, 0.2);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.1);
    border-radius: 16px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
    margin-top: 20px;
    margin-bottom: 20px;
    padding: 30px;
}

/* 暗黑模式毛玻璃背景下的文字颜色优化 */
.dark-theme .container, .dark-theme .container-fluid {
    color: #ffffff;
}

.dark-theme .container h1, .dark-theme .container h2, .dark-theme .container h3, 
.dark-theme .container h4, .dark-theme .container h5, .dark-theme .container h6 {
    color: #ffffff;
    font-weight: 600;
}

.dark-theme .container .lead {
    color: #ffffff;
}

.dark-theme .container .text-muted {
    color: #cccccc !important;
}