/* ========================================= */
/* 分类页面样式 - 表格布局 */
/* ========================================= */

/* 分类头部 */
.category-header {
    text-align: center;
    margin: 40px 0;
    padding: 25px;
    background-color: white;
    border-radius: 8px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
}

.category-header h1 {
    font-size: 2.4rem;
    color: #2c3e50;
    margin-bottom: 12px;
}

.category-header p {
    color: #7f8c8d;
    max-width: 800px;
    margin: 0 auto;
    font-size: 1.1rem;
    line-height: 1.7;
}

/* 内容区域 */
.category-content {
    display: flex;
    gap: 30px;
    margin-bottom: 1px;
}

/* 左侧主内容区 */
.category-main {
    flex: 1;
    min-width: 0; /* 确保flex容器可以收缩 */
}

/* 左侧边栏 - 严格限制宽度 */
.category-sidebar {
    flex: 0 0 295px; /* 严格固定宽度 */
    max-width: 295px;
}

/* 表格布局 */
.guitar-table {
    background: white;
    border-radius: 8px;
    overflow: hidden;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    display: grid;
    grid-template-columns: 
        minmax(200px, 1fr)  /* 吉他谱名称 - 自适应宽度 */
        150px   /* 歌手 */
        100px   /* 格式 */
        120px   /* 作者 */
        80px;   /* 点击 */
    margin-bottom: 15px; /* 增加表格底部间距 */
}

.table-header {
    display: contents;
}

.table-header > .header-item {
    background: #2c3e50;
    color: white;
    font-weight: 600;
    padding: 16px 20px;
    font-size: 1.1rem;
    display: flex;
    align-items: center;
}

.table-row {
    display: contents;
}

.table-row > .table-cell {
    padding: 14px 20px;
    border-bottom: 1px solid #f0f0f0;
    display: flex;
    align-items: center;
    transition: background-color 0.2s;
}

.table-row:last-child > .table-cell {
    border-bottom: none;
}

/* 悬停效果 */
.table-row:hover > .table-cell {
    background-color: #f9f9f9;
}

/* 吉他谱名称样式 */
.guitar-name {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    display: block;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.guitar-name:hover {
    color: #3498db;
    text-decoration: underline;
}

/* 表格元数据样式 */
.table-cell {
    color: #555;
    font-size: 1rem;
    line-height: 1.6;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* 无结果样式 */
.no-results {
    text-align: center;
    padding: 40px;
    background: white;
    border-radius: 8px;
    color: #7f8c8d;
    font-size: 1.1rem;
}

/* 左侧热门文章区域 - 严格限制宽度 */
.popular-posts {
    background: white;
    border-radius: 8px;
    padding: 20px 15px;
    box-shadow: 0 2px 15px rgba(0,0,0,0.08);
    position: sticky;
    top: 20px;
    max-width: 295px;
}

.popular-posts h3 {
    font-size: 1.3rem;
    margin-bottom: 20px;
    padding-bottom: 10px;
    border-bottom: 1px solid #f0f0f0;
    color: #2c3e50;
    text-align: center;
    position: relative;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.popular-posts ul {
    list-style: none;
    padding: 0;
    margin: 0;
}

.popular-posts li {
    margin-bottom: 12px;
    display: flex;
    align-items: center;
    padding: 8px 0;
    border-bottom: 1px dashed #f0f0f0;
    transition: all 0.3s;
}

.popular-posts li:hover {
    background-color: #f9f9f9;
}

.popular-posts li:last-child {
    border-bottom: none;
}

.post-number {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 26px;
    height: 26px;
    background: #3498db;
    color: white;
    border-radius: 50%;
    font-weight: bold;
    margin-right: 10px;
    flex-shrink: 0;
    font-size: 0.85rem;
    box-shadow: 0 2px 5px rgba(52, 152, 219, 0.3);
}

.popular-posts li:nth-child(1) .post-number {
    background: #e74c3c;
    box-shadow: 0 2px 5px rgba(231, 76, 60, 0.3);
}

.popular-posts li:nth-child(2) .post-number {
    background: #f39c12;
    box-shadow: 0 2px 5px rgba(243, 156, 18, 0.3);
}

.popular-posts li:nth-child(3) .post-number {
    background: #2ecc71;
    box-shadow: 0 2px 5px rgba(46, 204, 113, 0.3);
}

.popular-posts a {
    color: #2c3e50;
    text-decoration: none;
    font-weight: 500;
    transition: color 0.3s;
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-size: 0.95rem;
}

.popular-posts a:hover {
    color: #3498db;
}

/* 响应式调整 */
@media (max-width: 992px) {
    .category-content {
        flex-direction: column;
    }
    
    .category-sidebar {
        flex: 0 0 auto;
        max-width: 100%;
        width: 100%;
        order: 2; /* 确保在小屏幕上边栏显示在底部 */
    }
    
    .category-main {
        order: 1; /* 主内容在上方 */
        margin-bottom: 30px;
    }
    
    .popular-posts {
        position: static;
        max-width: 100%;
    }
    
    .guitar-table {
        display: block;
        overflow-x: auto;
    }
    
    .table-header {
        display: flex;
        min-width: 700px;
    }
    
    .table-row {
        display: flex;
        min-width: 700px;
    }
    
    .table-header > .header-item,
    .table-row > .table-cell {
        flex: 1;
        min-width: 0;
    }
    
    /* 吉他谱名称自适应 */
    .table-header > .header-item:first-child,
    .table-row > .table-cell:first-child {
        flex: 2;
        min-width: 200px;
    }
    
    /* 歌手列 */
    .table-header > .header-item:nth-child(2),
    .table-row > .table-cell:nth-child(2) {
        flex: 1.5;
    }
}

@media (max-width: 768px) {
    .category-header {
        padding: 20px 15px;
        margin: 20px 0;
    }
    
    .category-header h1 {
        font-size: 2rem;
    }
    
    .popular-posts {
        padding: 15px;
    }
    
    .popular-posts h3 {
        font-size: 1.2rem;
        margin-bottom: 15px;
    }
    
    .post-number {
        width: 24px;
        height: 24px;
        font-size: 0.8rem;
    }
    
    .table-header > .header-item {
        font-size: 1rem;
        padding: 14px 15px;
    }
    
    .table-row > .table-cell {
        padding: 12px 15px;
    }
}

/* ========================================= */
/* 移动端隐藏右侧边栏 */
/* ========================================= */
@media (max-width: 768px) {
    /* 分类页面侧边栏 */
    .category-sidebar {
        display: none;
    }
    
    /* 侧边栏内的热门文章列表 */
    .popular-posts {
        display: none;
    }
}