/**
 * 基于 Bootstrap 5.3.6 和 Bootstrap Icons 1.13.1 的 YtBlog 样式
 * 版本: 2.0
 * 更新时间: 2025-8-7
 * 设计原则: 优先使用Bootstrap原生样式，减少自定义CSS
 */

/* ==========================================================================
   CSS变量定义 (Bootstrap 4.6.2兼容)
   ========================================================================== */
:root {
    --bs-primary: #007bff;
    --bs-secondary: #6c757d;
    --bs-success: #28a745;
    --bs-info: #17a2b8;
    --bs-warning: #ffc107;
    --bs-danger: #dc3545;
    --bs-light: #f8f9fa;
    --bs-dark: #343a40;

    --bs-primary-rgb: 0, 123, 255;
}

/* ==========================================================================
   基础样式重置与优化
   ========================================================================== */
body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, "Noto Sans", sans-serif;
    line-height: 1.6;
    color: #212529;
    background-color: #ffffff;
}

a {
    color: var(--bs-primary);
    text-decoration: none;
    transition: color 0.15s ease-in-out;
}

a:hover {
    color: #0056b3;
    text-decoration: none;
}

/* ==========================================================================
   导航栏样式 - 使用Bootstrap原生样式
   ========================================================================== */
.navbar {
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    background-color: #ffffff !important;
}

.navbar-brand {
    font-weight: 700;
    color: var(--bs-primary) !important;
}

.navbar-nav .nav-link {
    font-weight: 500;
    transition: color 0.15s ease-in-out;
    /* color: rgba(0, 0, 0, 0.55); */
}

.navbar-nav .nav-link:hover {
    color: var(--bs-primary) !important;
    background-color: rgba(var(--bs-primary-rgb), 0.1);
    border-radius: 0.375rem;
    color: var(--bs-primary);
}

/* ==========================================================================
   Hero区域样式
   ========================================================================== */
.hero-section {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    background-size: 400% 400%;
    animation: gradientShift 15s ease infinite;
    position: relative;
    overflow: hidden;
}

.stats-card {
    background: rgba(255, 255, 255, 0.15);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 1rem;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.stats-card:hover {
    transform: translateY(-5px);
    box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2);
}

@keyframes gradientShift {
    0% { background-position: 0% 50%; }
    50% { background-position: 100% 50%; }
    100% { background-position: 0% 50%; }
}

/* ==========================================================================
   页面头部样式 - 只保留通用布局，动画和渐变全部交给hero-section
   ========================================================================== */
/* .page-header {
    border-bottom: 1px solid rgba(255,255,255,0.2);
    position: relative;
    overflow: hidden;
    padding: 2rem 0;
} */
.page-header {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-bottom: 1px solid rgba(0, 0, 0, 0.1);
}

.page-header.bg-primary {
    background: var(--bs-primary) !important;
    border-bottom: 1px solid rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   卡片样式 - 使用Bootstrap原生样式，只添加必要的自定义效果
   ========================================================================== */
.card {
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.375rem;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background-color: #fff;
    overflow: hidden;
}

.card:hover {
    box-shadow: 0 0.5rem 1.5rem rgba(0, 0, 0, 0.1);
    transform: translateY(-2px);
}

/* 博客卡片样式 */
.blog-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.blog-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 文章卡片样式 */
.post-card {
    height: 100%;
    display: flex;
    flex-direction: column;
}

.post-card .card-body {
    flex: 1;
    display: flex;
    flex-direction: column;
}

/* 用户卡片样式 */
.user-card {
    height: 100%;
    text-align: center;
}

.user-card .user-avatar {
    width: 80px;
    height: 80px;
    border-radius: 50%;
    margin: 0 auto 1rem;
    object-fit: cover;
    border: 3px solid var(--bs-primary);
    transition: transform 0.3s ease;
}

.user-card:hover .user-avatar {
    transform: scale(1.05);
}

/* 分类卡片样式 */
.category-card {
    height: 100%;
    text-align: center;
}

.category-card .category-icon {
    font-size: 3rem;
    margin-bottom: 1rem;
    color: var(--bs-primary);
    transition: transform 0.3s ease;
}

.category-card:hover .category-icon {
    transform: scale(1.1);
}

/* ==========================================================================
   视图切换样式 - 使用Bootstrap原生样式
   ========================================================================== */
.view-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
}

.view-toggle-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--bs-primary);
    background-color: transparent;
    color: var(--bs-primary);
    border-radius: 0.375rem;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
}

.view-toggle-btn:hover {
    background-color: var(--bs-primary);
    color: #fff;
    text-decoration: none;
}

.view-toggle-btn.active {
    background-color: var(--bs-primary);
    color: #fff;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.view-toggle-btn i {
    font-size: 1.1rem;
}

/* 兼容旧的按钮样式 */
#gridView, #listView, #listViewIndex {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    padding: 0;
    border: 1px solid var(--bs-primary);
    background-color: transparent;
    color: var(--bs-primary);
    border-radius: 0.375rem;
    transition: all 0.15s ease-in-out;
    text-decoration: none;
}

#gridView:hover, #listView:hover, #listViewIndex:hover {
    background-color: var(--bs-primary);
    color: #fff;
    text-decoration: none;
}

#gridView.active, #listView.active, #listViewIndex.active {
    background-color: var(--bs-primary);
    color: #fff;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

/* ==========================================================================
   统计组样式 - 使用Bootstrap原生样式
   ========================================================================== */
.stats-group {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
    align-items: center;
}

.stats-group .badge {
    font-size: 0.75rem;
    padding: 0.25rem 0.5rem;
}

/* ==========================================================================
   表格样式 - 使用Bootstrap原生样式
   ========================================================================== */
.table {
    background-color: #fff;
    border-radius: 0.375rem;
    overflow: hidden;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
}

.table th {
    background-color: var(--bs-light);
    border-bottom: 2px solid var(--bs-primary);
    font-weight: 600;
    color: var(--bs-dark);
    padding: 1rem;
}

.table td {
    padding: 1rem;
    vertical-align: middle;
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

.table-hover tbody tr:hover {
    background-color: rgba(var(--bs-primary-rgb), 0.05);
}

/* ==========================================================================
   分页样式 - 使用Bootstrap原生样式
   ========================================================================== */
.pagination {
    justify-content: center;
    margin-top: 2rem;
}

.pagination .page-link {
    border: 1px solid rgba(0, 0, 0, 0.125);
    color: var(--bs-primary);
    padding: 0.5rem 0.75rem;
    transition: all 0.15s ease-in-out;
}

.pagination .page-link:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

.pagination .page-item.active .page-link {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
}

/* ==========================================================================
   表单样式 - 使用Bootstrap原生样式
   ========================================================================== */
.form-control {
    border: 1px solid rgba(0, 0, 0, 0.125);
    border-radius: 0.375rem;
    padding: 0.5rem 0.75rem;
    transition: border-color 0.15s ease-in-out, box-shadow 0.15s ease-in-out;
}

.form-control:focus {
    border-color: var(--bs-primary);
    box-shadow: 0 0 0 0.2rem rgba(var(--bs-primary-rgb), 0.25);
}

/* ==========================================================================
   按钮样式 - 使用Bootstrap原生样式
   ========================================================================== */
.btn {
    border-radius: 0.375rem;
    font-weight: 500;
    padding: 0.5rem 1rem;
    transition: all 0.15s ease-in-out;
    border: 1px solid transparent;
}

.btn-primary {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-primary:hover {
    background-color: #0056b3;
    border-color: #0056b3;
    transform: translateY(-1px);
}

.btn-outline-primary {
    color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.btn-outline-primary:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    transform: translateY(-1px);
}

/* ==========================================================================
   徽章样式 - 使用Bootstrap原生样式
   ========================================================================== */
.badge {
    font-size: 0.75rem;
    font-weight: 500;
    padding: 0.25rem 0.5rem;
    border-radius: 0.375rem;
}

.badge-primary {
    background-color: var(--bs-primary);
    color: #fff;
}

.badge-success {
    background-color: var(--bs-success);
    color: #fff;
}

.badge-info {
    background-color: var(--bs-info);
    color: #fff;
}

.badge-warning {
    background-color: var(--bs-warning);
    color: #212529;
}

.badge-danger {
    background-color: var(--bs-danger);
    color: #fff;
}

/* ==========================================================================
   空状态样式 - 使用Bootstrap原生样式
   ========================================================================== */
.empty-state {
    text-align: center;
    padding: 3rem 1rem;
    color: var(--bs-secondary);
}

.empty-state i {
    font-size: 4rem;
    margin-bottom: 1rem;
    opacity: 0.5;
}

.empty-state h3 {
    font-size: 1.5rem;
    margin-bottom: 0.5rem;
}

.empty-state p {
    font-size: 1rem;
    margin-bottom: 1.5rem;
}

/* ==========================================================================
   返回顶部按钮样式 - 使用Bootstrap原生样式
   ========================================================================== */
.back-to-top {
    position: fixed;
    bottom: 20px;
    right: 20px;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background-color: var(--bs-primary);
    color: #fff;
    border: none;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
    transition: all 0.3s ease;
    z-index: 1000;
    display: none;
}

/* ==========================================================================
   响应式样式 - 使用Bootstrap原生样式
   ========================================================================== */
@media (max-width: 991.98px) {
    .navbar-collapse {
        background: var(--bs-light) !important;
        padding-bottom: 0.5rem !important;
        z-index: 1000;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
    }
    .navbar-collapse .nav-item a,.navbar-search {
        padding-left: 0.5rem !important;
    }
    .hero-section {
        padding: 3rem 0;
    }
    
    .stats-card h3 {
        font-size: 2rem;
    }
    
    .view-controls {
        margin-bottom: 1rem;
    }
    
    .card-body {
        padding: 1rem;
    }
}

@media (max-width: 767.98px) {
    .hero-section {
        padding: 2rem 0;
    }
    
    .hero-section h1 {
        font-size: 2rem;
    }
    
    .hero-section .lead {
        font-size: 1rem;
    }
    
    .stats-card {
        margin-bottom: 1rem;
    }
    
    .stats-card h3 {
        font-size: 1.5rem;
    }
    
    .view-controls {
        flex-direction: column;
        align-items: stretch;
    }
    
    .view-toggle-btn {
        width: 100%;
        height: 36px;
    }
    
    #gridView, #listView, #listViewIndex {
        width: 100%;
        height: 36px;
    }
    
    .card-body {
        padding: 0.75rem;
    }
    
    .user-card .user-avatar {
        width: 60px;
        height: 60px;
    }
    
    .category-card .category-icon {
        font-size: 2rem;
    }
    
    .table-responsive {
        font-size: 0.875rem;
    }
    
    .back-to-top {
        width: 40px;
        height: 40px;
        bottom: 15px;
        right: 15px;
    }
}

@media (max-width: 575.98px) {
    .container {
        padding-left: 0.75rem;
        padding-right: 0.75rem;
    }
    
    .hero-section h1 {
        font-size: 1.75rem;
    }
    
    .stats-card {
        padding: 1rem;
    }
    
    .card-body {
        padding: 0.5rem;
    }
    
    .pagination .page-link {
        padding: 0.375rem 0.5rem;
        font-size: 0.875rem;
    }
}

/* ==========================================================================
   打印样式 - 使用Bootstrap原生样式
   ========================================================================== */
@media print {
    .navbar,
    .sidebar,
    .view-controls,
    .back-to-top,
    .pagination {
        display: none !important;
    }
    
    .container {
        max-width: none;
        width: 100%;
    }
    
    .card {
        border: 1px solid #000;
        box-shadow: none;
    }
    
    .hero-section {
        background: none !important;
        color: #000;
    }
    
    a {
        color: #000;
        text-decoration: underline;
    }
    
    a[href]:after {
        content: " (" attr(href) ")";
        font-size: 0.875rem;
        color: #666;
    }
}

/* ==========================================================================
   深色模式支持 - 使用Bootstrap原生样式
   ========================================================================== */
@media (prefers-color-scheme: dark) {
    .card {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
    }
    
    .table {
        background-color: #2d3748;
        color: #e2e8f0;
    }
    
    .table th {
        background-color: #4a5568;
        color: #e2e8f0;
    }
    
    .table td {
        border-color: #4a5568;
    }
    
.form-control {
        background-color: #2d3748;
        border-color: #4a5568;
        color: #e2e8f0;
}

.form-control:focus {
        background-color: #2d3748;
    border-color: var(--bs-primary);
    }
}

/* ==========================================================================
   侧边栏卡片样式 - 使用Bootstrap原生样式，添加美化效果
   ========================================================================== */
.sidebar-sticky .card {
    border: none;
    box-shadow: 0 0.125rem 0.25rem rgba(0, 0, 0, 0.075);
    border-radius: 0.5rem;
    overflow: hidden;
    transition: transform 0.3s ease, box-shadow 0.3s ease;
    background: #fff;
}

.sidebar-sticky .card:hover {
    transform: translateY(-2px);
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.sidebar-sticky .card-header {
    background: linear-gradient(135deg, var(--bs-primary) 0%, #0056b3 100%);
    color: white;
    border: none;
    padding: 1rem 1.25rem;
    position: relative;
}

.sidebar-sticky .card-header::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: linear-gradient(135deg, rgba(255,255,255,0.1) 0%, rgba(255,255,255,0.05) 100%);
    pointer-events: none;
}

.sidebar-sticky .card-header h5,
.sidebar-sticky .card-header h6 {
    color: white;
    margin: 0;
    font-weight: 600;
    position: relative;
    z-index: 1;
}

.sidebar-sticky .card-body {
    padding: 1.25rem;
    background: #fff;
}

/* 分类标签按钮样式 */
.sidebar-sticky .btn-outline-primary {
    border-color: var(--bs-primary);
    color: var(--bs-primary);
    background-color: transparent;
    transition: all 0.3s ease;
    text-align: left;
    padding: 0.75rem 1rem;
    border-radius: 0.375rem;
    font-weight: 500;
}

.sidebar-sticky .btn-outline-primary:hover {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
    color: #fff;
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(var(--bs-primary-rgb), 0.3);
}

.sidebar-sticky .btn-outline-primary .badge {
    background-color: #f8f9fa;
    color: var(--bs-primary);
    border: 1px solid var(--bs-primary);
    font-weight: 600;
    padding: 0.25rem 0.5rem;
    border-radius: 0.25rem;
    transition: all 0.3s ease;
}

.sidebar-sticky .btn-outline-primary:hover .badge {
    background-color: rgba(255, 255, 255, 0.9);
    color: var(--bs-primary);
    border-color: rgba(255, 255, 255, 0.9);
}

/* 分类按钮容器样式 */
.category-buttons {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0.5rem;
}

.category-buttons .btn {
    margin-bottom: 0;
    border-width: 1px;
    position: relative;
    overflow: hidden;
    min-height: 40px;
}

.category-buttons .btn::before {
    content: '';
    position: absolute;
    top: 0;
    left: -100%;
    width: 100%;
    height: 100%;
    background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.1), transparent);
    transition: left 0.5s ease;
}

.category-buttons .btn:hover::before {
    left: 100%;
}

/* 分类名称样式 */
.category-buttons .category-name {
    font-size: 0.875rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 60%;
}

/* 标签云样式 */
.sidebar-sticky .tag-cloud .badge {
    background-color: #f8f9fa;
    color: var(--bs-dark);
    border: 1px solid #e9ecef;
    transition: all 0.3s ease;
    text-decoration: none;
}

.sidebar-sticky .tag-cloud .badge:hover {
    background-color: var(--bs-primary);
    color: #fff;
    border-color: var(--bs-primary);
    transform: translateY(-1px);
    box-shadow: 0 0.25rem 0.5rem rgba(var(--bs-primary-rgb), 0.3);
    text-decoration: none;
}

/* 响应式优化 */
@media (max-width: 767.98px) {
    .category-buttons {
        grid-template-columns: 1fr;
    }
    
    .sidebar-sticky .btn-outline-primary {
        padding: 0.5rem 0.75rem;
        font-size: 0.875rem;
    }
    
    .sidebar-sticky .btn-outline-primary .badge {
        padding: 0.2rem 0.4rem;
        font-size: 0.75rem;
    }
    
    .category-buttons .category-name {
        max-width: 70%;
    }
}
