/* 分类页面响应式样式 */

.p-category {
    background: #f5f5f5;
}

/* 隐藏旧的分类样式 */
.cate-top-wr,
.cate-container {
    display: none !important;
}

/* 分类容器 */
.category-container {
    max-width: 1200px;
    margin: 0 auto 0;
    padding: 0 20px;
    display: grid;
    grid-template-columns: 260px 1fr;
    gap: 20px;
}

/* 移动端顶部操作栏 */
.mobile-top-bar {
    display: none;
    gap: 12px;
    margin-bottom: 15px;
    position: relative;
    z-index: 10;
}

.mobile-top-bar .filter-btn,
.mobile-top-bar .sort-btn {
    flex: 1;
    height: 44px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    font-size: 14px;
    color: #333;
    cursor: pointer;
    transition: all 0.3s;
    position: relative;
    z-index: 10;
}

.mobile-top-bar .filter-btn:active,
.mobile-top-bar .sort-btn:active {
    background: #f5f5f5;
}

.mobile-top-bar .filter-btn:hover,
.mobile-top-bar .sort-btn:hover {
    border-color: #ff620e;
}

.mobile-top-bar .icon {
    font-size: 16px;
    font-style: normal;
}

.mobile-top-bar .arrow {
    font-size: 10px;
    margin-left: 2px;
}

/* 侧边栏 */
.category-sidebar {
    position: sticky;
    top: 80px;
    height: fit-content;
    max-height: calc(100vh - 100px);
    overflow-y: auto;
}

/* 桌面端隐藏侧边栏的遮罩层和调整 */
@media screen and (min-width: 769px) {
    .category-sidebar {
        position: sticky !important;
        height: fit-content !important;
    }
}

/* 移动端激活状态（在所有尺寸下生效，但主要用于移动端） */
.category-sidebar.active {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    z-index: 10000 !important;
    visibility: visible !important;
    opacity: 1 !important;
    max-height: 100vh !important;
    overflow: hidden !important;
}

.sidebar-panel {
    background: #fff;
    border-radius: 8px;
    padding: 20px;
}

.sidebar-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    margin-bottom: 20px;
    padding-bottom: 15px;
    border-bottom: 2px solid #f0f0f0;
}

.sidebar-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: #333;
}

.sidebar-close {
    display: none;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    font-size: 28px;
    color: #999;
    cursor: pointer;
}

/* 激活时显示关闭按钮 */
.category-sidebar.active .sidebar-close {
    display: block;
}

.sidebar-overlay {
    display: none;
}

/* 激活时显示遮罩层 */
.category-sidebar.active .sidebar-overlay {
    display: block !important;
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100vw !important;
    height: 100vh !important;
    background: rgba(0, 0, 0, 0.5) !important;
    z-index: 1 !important;
}

/* 激活时调整面板 */
.category-sidebar.active .sidebar-panel {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    bottom: 0 !important;
    width: 280px !important;
    max-width: 85% !important;
    height: 100vh !important;
    border-radius: 0 !important;
    z-index: 2 !important;
    -webkit-transform: translateX(0) !important;
    transform: translateX(0) !important;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch !important;
}

/* 筛选区块 */
.filter-section {
    margin-bottom: 25px;
}

.filter-section:first-child .filter-options {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

.filter-section:first-child .filter-option {
    padding: 12px 15px;
    background: #f8f8f8;
    border-radius: 6px;
    font-weight: 500;
}

.filter-section:first-child .filter-option.active {
    background: #ff620e;
    color: #fff;
}

.filter-title {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 15px;
    font-weight: 600;
    color: #333;
    margin-bottom: 12px;
    cursor: pointer;
    -webkit-user-select: none;
    user-select: none;
}

.filter-title .nav-icon {
    font-size: 12px;
    font-style: normal;
    -webkit-transition: -webkit-transform 0.3s;
    transition: transform 0.3s;
    -webkit-transform: rotate(90deg);
    transform: rotate(90deg);
}

.filter-section.collapsed .filter-title .nav-icon {
    -webkit-transform: rotate(0deg);
    transform: rotate(0deg);
}

.filter-section.collapsed .filter-options {
    display: none;
}

.filter-options {
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.filter-option {
    padding: 8px 12px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    border-radius: 4px;
    transition: all 0.3s;
}

.filter-option:hover {
    background: #f8f8f8;
    color: #ff620e;
}

.filter-option.active {
    background: #fff3f0;
    color: #ff620e;
    font-weight: 500;
}

/* 主内容区 */
.category-main {
    min-width: 0;
}

/* 结果信息 */
.result-info {
    margin-bottom: 20px;
    padding: 15px 20px;
    background: #fff;
    border-radius: 8px;
    font-size: 14px;
    color: #666;
}

/* 排序标题 */
.sort-header {
    margin-bottom: 15px;
}

.sort-header h2 {
    font-size: 24px;
    font-weight: 600;
    color: #333;
}

/* 排序选项 */
.sort-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
    margin-bottom: 20px;
}

.sort-option {
    padding: 15px 20px;
    background: #f8f8f8;
    color: #666;
    text-decoration: none;
    border-radius: 8px;
    font-size: 16px;
    font-weight: 500;
    transition: all 0.3s;
    text-align: center;
}

.sort-option:hover {
    background: #fff3f0;
    color: #ff620e;
}

.sort-option.active {
    background: #ff620e;
    color: #fff;
}

.result-count {
    font-size: 14px;
    color: #999;
}

.count-number {
    color: #ff620e;
    font-weight: 600;
}

/* 漫画网格 */
.comic-grid {
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 20px;
    margin-bottom: 30px;
}

.comic-card {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    transition: transform 0.3s, box-shadow 0.3s;
}

.comic-card:hover {
    -webkit-transform: translateY(-5px);
    transform: translateY(-5px);
    box-shadow: 0 8px 16px rgba(0, 0, 0, 0.15);
}

.comic-link {
    display: block;
    text-decoration: none;
    color: inherit;
}

.comic-cover {
    position: relative;
    width: 100%;
    padding-bottom: 133.33%;
    overflow: hidden;
    background: #eee;
}

.comic-cover img {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    object-fit: cover;
    transition: transform 0.3s;
}

.comic-card:hover .comic-cover img {
    -webkit-transform: scale(1.05);
    transform: scale(1.05);
}

.comic-status {
    position: absolute;
    bottom: 8px;
    left: 8px;
    padding: 4px 8px;
    background: rgba(0, 0, 0, 0.7);
    color: #fff;
    font-size: 12px;
    border-radius: 4px;
    max-width: calc(100% - 16px);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.comic-title {
    padding: 12px;
    font-size: 14px;
    font-weight: 500;
    line-height: 1.4;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

/* 分页 */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 20px;
    background: #fff;
    border-radius: 8px;
}

.page-btn,
.pagination a {
    padding: 8px 16px;
    background: #f8f8f8;
    color: #666;
    text-decoration: none;
    border-radius: 4px;
    font-size: 14px;
    transition: all 0.3s;
}

.page-btn:hover,
.pagination a:hover {
    background: #ff620e;
    color: #fff;
}

.pagination a.active {
    background: #ff620e;
    color: #fff;
}

/* 夜间模式 */
body.p-category.dark-mode {
    background: #1a1a1a !important;
    color: #e0e0e0 !important;
}

body.dark-mode .category-container {
    background: #1a1a1a !important;
}

body.dark-mode .sidebar-panel,
body.dark-mode .category-header,
body.dark-mode .category-main,
body.dark-mode .comic-card,
body.dark-mode .pagination {
    background: #2a2a2a !important;
}

body.dark-mode .filter-title,
body.dark-mode .sidebar-header h3 {
    color: #e0e0e0;
}

body.dark-mode .filter-option {
    color: #999;
}

body.dark-mode .filter-option:hover {
    background: #333;
}

body.dark-mode .comic-title {
    color: #e0e0e0;
}

body.dark-mode .rank-table-wrapper {
    background: #2a2a2a;
}

body.dark-mode .rank-table thead {
    background: #333;
}

body.dark-mode .rank-table th {
    color: #e0e0e0;
}

body.dark-mode .rank-table tbody tr {
    border-bottom-color: #444;
}

body.dark-mode .rank-table tbody tr:hover {
    background: #333;
}

body.dark-mode .rank-table td {
    color: #e0e0e0;
}

body.dark-mode .comic-cell a {
    color: #e0e0e0;
}

body.dark-mode .comic-cell a:hover {
    color: #ff620e;
}

body.dark-mode .result-info {
    color: #e0e0e0;
}

body.dark-mode .mobile-top-bar {
    background: #2a2a2a;
    border-bottom-color: #444;
}

body.dark-mode .filter-btn,
body.dark-mode .sort-btn {
    background: #333;
    color: #e0e0e0;
    border-color: #444;
}

body.dark-mode .mobile-sort-dropdown {
    background: #2a2a2a;
    border-color: #444;
}

body.dark-mode .mobile-sort-dropdown a {
    color: #e0e0e0;
    border-bottom-color: #444;
}

body.dark-mode .mobile-sort-dropdown a:hover {
    background: #333;
}

/* 排行榜表格样式 */
.rank-table-wrapper {
    background: #fff;
    border-radius: 8px;
    overflow: hidden;
    margin-bottom: 20px;
    position: relative;
    z-index: 1;
}

.rank-table {
    width: 100%;
    border-collapse: collapse;
}

.rank-table thead {
    background: #f8f8f8;
}

.rank-table th {
    padding: 15px;
    text-align: left;
    font-size: 14px;
    font-weight: 600;
    color: #666;
    border-bottom: 2px solid #e0e0e0;
}

.rank-table tbody tr {
    border-bottom: 1px solid #f0f0f0;
    transition: background 0.3s;
}

.rank-table tbody tr:hover {
    background: #f8f8f8;
}

.rank-table td {
    padding: 15px;
    font-size: 14px;
    color: #666;
    vertical-align: middle;
}

/* 排名单元格 */
.rank-cell {
    text-align: center;
}

.rank-badge {
    display: inline-block;
    width: 32px;
    height: 32px;
    line-height: 32px;
    text-align: center;
    font-weight: 600;
    color: #999;
    background: #f0f0f0;
    border-radius: 6px;
}

.rank-badge.rank-1,
.rank-badge.rank-2,
.rank-badge.rank-3 {
    background: linear-gradient(135deg, #ff620e 0%, #ff8c42 100%);
    color: #fff;
    box-shadow: 0 2px 8px rgba(255, 98, 14, 0.3);
}

/* 漫画单元格 */
.comic-cell a {
    color: #333;
    text-decoration: none;
    font-weight: 500;
}

.comic-cell a:hover {
    color: #ff620e;
}

/* 作者单元格 */
.author-cell {
    color: #999;
}

/* 章节单元格 */
.chapter-cell a {
    color: #ff620e;
    text-decoration: none;
}

.chapter-cell a:hover {
    text-decoration: underline;
}

/* 日期单元格 */
.date-cell {
    color: #999;
    font-size: 13px;
}

/* 评分单元格 */
.score-cell {
    text-align: center;
    font-weight: 600;
    color: #ff620e;
}

/* 响应式断点 */

/* 平板设备 */
@media screen and (max-width: 1024px) {
    .category-container {
        grid-template-columns: 220px 1fr;
        gap: 15px;
    }
    
    .comic-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 15px;
    }
}

/* 手机设备 */
@media screen and (max-width: 768px) {
    .category-container {
        grid-template-columns: 1fr;
        margin-top: 60px;
        padding: 10px;
    }
    
    .mobile-top-bar {
        display: flex;
    }
    
    .category-sidebar {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        z-index: 999;
        visibility: hidden;
        opacity: 0;
        transition: all 0.3s;
        max-height: none;
    }
    
    .category-sidebar.active {
        visibility: visible;
        opacity: 1;
    }
    
    .sidebar-overlay {
        display: block;
        position: absolute;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
    }
    
    .sidebar-panel {
        position: absolute;
        top: 0;
        left: 0;
        bottom: 0;
        width: 280px;
        max-width: 85%;
        border-radius: 0;
        -webkit-transform: translateX(-100%);
        transform: translateX(-100%);
        -webkit-transition: -webkit-transform 0.3s;
        transition: transform 0.3s;
        overflow-y: auto;
    }
    
    .category-sidebar.active .sidebar-panel {
        -webkit-transform: translateX(0);
        transform: translateX(0);
    }
    
    .sidebar-close {
        display: block;
    }
    
    .comic-grid {
        grid-template-columns: repeat(3, 1fr);
        gap: 10px;
    }
    
    .category-header {
        flex-direction: column;
        gap: 10px;
        padding: 12px 15px;
    }
    
    .sort-buttons {
        width: 100%;
        justify-content: center;
    }
    
    /* 排行榜表格移动端 */
    .rank-table-wrapper {
        overflow-x: visible;
    }
    
    .rank-table {
        min-width: 0;
    }
    
    /* 隐藏作者、日期、评分列 */
    .rank-table th:nth-child(3),
    .rank-table th:nth-child(5),
    .rank-table th:nth-child(6),
    .rank-table td:nth-child(3),
    .rank-table td:nth-child(5),
    .rank-table td:nth-child(6) {
        display: none;
    }
    
    .rank-table th,
    .rank-table td {
        padding: 12px 10px;
        font-size: 13px;
    }
    
    .rank-badge {
        width: 28px;
        height: 28px;
        line-height: 28px;
        font-size: 13px;
    }
}

/* 移动端排序下拉菜单 */
.mobile-sort-dropdown {
    display: none;
    position: absolute;
    top: 100%;
    left: 50%;
    right: 10px;
    margin-top: 4px;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 6px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
    z-index: 100;
    overflow: hidden;
}

.mobile-sort-dropdown.active {
    display: block;
}

.mobile-sort-dropdown a {
    display: block;
    padding: 10px 16px;
    color: #666;
    text-decoration: none;
    font-size: 14px;
    border-bottom: 1px solid #f0f0f0;
    transition: all 0.2s;
}

.mobile-sort-dropdown a:last-child {
    border-bottom: none;
}

.mobile-sort-dropdown a:hover {
    background: #f8f8f8;
}

.mobile-sort-dropdown a.active {
    background: #fff3f0;
    color: #ff620e;
    font-weight: 500;
}

/* 小屏手机 */
@media screen and (max-width: 480px) {
    .comic-grid {
        grid-template-columns: repeat(2, 1fr);
        gap: 8px;
    }
    
    .comic-title {
        font-size: 12px;
        padding: 8px;
    }
    
    /* 排行榜表格小屏 */
    .rank-table {
        min-width: 0;
    }
    
    .rank-table th,
    .rank-table td {
        padding: 10px 8px;
        font-size: 12px;
    }
    
    .rank-badge {
        width: 26px;
        height: 26px;
        line-height: 26px;
        font-size: 12px;
    }
    
    /* 调整列宽 */
    .rank-table th:nth-child(1),
    .rank-table td:nth-child(1) {
        width: 50px;
    }
    
    .rank-table th:nth-child(4),
    .rank-table td:nth-child(4) {
        width: 100px;
    }
}


/* 强制覆盖body背景 - 必须放在最后 */
body.dark-mode {
    background-color: #1a1a1a !important;
}

body.p-category.dark-mode {
    background-color: #1a1a1a !important;
}
