/* ============================================
   左侧边栏 - 基础样式
   ============================================ */
.left-sidebar {
    width: 220px;
    flex-shrink: 0;
    position: sticky;
    top: 20px;
    max-height: calc(100vh - 40px);
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
    align-self: flex-start;
    margin-left: 20px;
}

/* WebKit浏览器隐藏滚动条 */
.left-sidebar::-webkit-scrollbar {
    display: none;
}

/* ============================================
   分类卡片
   ============================================ */
.category-card {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

/* ============================================
   分类标题栏
   ============================================ */

/* 蓝色渐变（软件库） */
.category-header {
    background: linear-gradient(to right, var(--primary), #6e8ffa);
    color: white;
    padding: 15px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 绿色渐变（游戏中心） */
.game-category-header {
    background: linear-gradient(to right, #22c55e, #16a34a) !important;
    color: white;
    padding: 15px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

/* 紫色渐变（论坛板块） */
.forum-category-header {
    background: linear-gradient(to right, #8a2be2, #ba55d3) !important;
    color: white;
    padding: 15px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.header-title {
    display: flex;
    align-items: center;
}

.header-title i {
    margin-right: 5px;
}

/* ============================================
   分类列表
   ============================================ */
.category-list {
    list-style: none;
    margin: 0;
    padding: 0;
    max-height: 400px;
    overflow-y: auto;
    scrollbar-width: none;
    -ms-overflow-style: none;
}

/* WebKit浏览器隐藏分类列表滚动条 */
.category-list::-webkit-scrollbar {
    display: none;
}

.category-item {
    border-bottom: 1px solid var(--border);
    margin: 0;
    padding: 0;
}

.category-item:last-child {
    border-bottom: none;
}

/* 分类图标 */
.category-icon {
    width: 30px;
    height: 30px;
    flex-shrink: 0;
    object-fit: contain;
    vertical-align: middle;
}

/* ============================================
   分类链接
   ============================================ */

/* 默认（软件库蓝色） */
.category-link {
    display: flex;
    align-items: center;
    padding: 12px 15px;
    color: var(--dark);
    transition: var(--transition);
    gap: 10px;
    text-decoration: none;
}

.category-link:hover {
    background-color: rgba(25, 152, 255, 0.05);
    color: var(--primary);
    padding-left: 20px;
}

.category-link.active {
    background-color: rgba(25, 152, 255, 0.1);
    color: var(--primary);
    border-left: 3px solid var(--primary);
}

/* 游戏分类链接 - 绿色主题 */
.game-category-link:hover {
    background-color: rgba(34, 197, 94, 0.05) !important;
    color: #22c55e !important;
    padding-left: 20px;
}

.game-category-link.active {
    background-color: rgba(34, 197, 94, 0.1) !important;
    color: #22c55e !important;
    border-left: 3px solid #22c55e !important;
}

/* 论坛板块链接 - 紫色主题 */
.forum-plate-link:hover {
    background-color: rgba(138, 43, 226, 0.05) !important;
    color: #8a2be2 !important;
    padding-left: 20px;
}

.forum-plate-link.active {
    background-color: rgba(138, 43, 226, 0.1) !important;
    color: #8a2be2 !important;
    border-left: 3px solid #8a2be2 !important;
}

/* ============================================
   父子分类 - 分组标题（大分类）
   ============================================ */
.category-group {
    list-style: none;
    margin: 0;
    padding: 0;
    border-bottom: 1px solid var(--border);
}

.category-group:last-child {
    border-bottom: none;
}

.category-group-title {
    display: flex;
    align-items: center;
    padding: 10px 12px;
    font-size: 13px;
    font-weight: 600;
    color: #444;
    background: #f8f9fb;
    cursor: pointer;
    user-select: none;
    transition: background 0.2s ease;
    gap: 8px;
}

.category-group-title:hover {
    background: #eef1f6;
}

.category-group-title .category-icon {
    width: 22px;
    height: 22px;
    border-radius: 4px;
    flex-shrink: 0;
}

.category-group-title span {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    line-height: 1.4;
}

/* 折叠箭头图标 */
.category-toggle-icon {
    font-size: 12px;
    color: #999;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

.category-group.collapsed .category-toggle-icon {
    transform: rotate(-90deg);
}

/* 大分类标题栏 - 不同主题色的悬停效果 */
.category-group-title[data-theme="apk"]:hover {
    color: var(--primary);
}

.category-group-title[data-theme="game"]:hover {
    color: #22c55e;
}

.category-group-title[data-theme="forum"]:hover {
    color: #8a2be2;
}

/* ============================================
   父子分类 - 子分类列表
   ============================================ */
.category-children {
    list-style: none;
    padding: 0;
    margin: 0;
    max-height: 500px;
    overflow: hidden;
    transition: max-height 0.35s ease, opacity 0.25s ease;
    opacity: 1;
}

.category-group.collapsed .category-children {
    max-height: 0 !important;
    opacity: 0;
    overflow: hidden;
}

/* 子分类项 */
.category-child-item {
    padding-left: 10px;
    border-bottom: 1px solid rgba(0, 0, 0, 0.04);
}

.category-child-item:last-child {
    border-bottom: none;
}

.category-child-item .category-link {
    padding: 9px 10px 9px 12px;
    font-size: 13px;
    gap: 8px;
}

.category-child-item .category-link:hover {
    padding-left: 16px;
}

.category-child-item .category-link.active {
    padding-left: 12px;
}

.category-child-item .category-icon {
    width: 22px;
    height: 22px;
    border-radius: 4px;
}

/* ============================================
   投稿/发帖按钮文字
   ============================================ */
.wz {
    font-size: 12px;
    color: white;
    font-weight: normal;
    text-decoration: none;
}

.wz:hover {
    color: white;
}

.wz i {
    margin-right: 5px;
}

/* ============================================
   工具分类容器
   ============================================ */
.tool-cat-container {
    background: white;
    border-radius: var(--border-radius);
    box-shadow: var(--box-shadow);
    margin-bottom: 20px;
    overflow: hidden;
}

/* 工具分类标题栏 - 橙色渐变 */
.tool-cat-header {
    background: linear-gradient(to right, #ff9966, #ff5e62);
    color: white;
    padding: 15px;
    font-weight: 600;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.tool-cat-title {
    display: flex;
    align-items: center;
}

.tool-cat-title i {
    margin-right: 5px;
}

.tool-cat-more {
    font-size: 12px;
    color: white;
    font-weight: normal;
    text-decoration: none;
}

.tool-cat-more:hover {
    color: white;
}

.tool-cat-more i {
    margin-right: 5px;
}

/* 工具分类网格 */
.tool-cat-grid {
    display: grid;
    grid-template-columns: repeat(2, 1fr);
    padding: 8px;
    gap: 8px;
}

.tool-cat-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-decoration: none;
    color: var(--dark);
    padding: 10px 5px;
    border-radius: 8px;
    transition: all 0.2s ease;
}

.tool-cat-item:hover {
    background-color: rgba(255, 153, 102, 0.05);
    color: #ff9966;
}

.tool-cat-active {
    background-color: rgba(255, 153, 102, 0.1);
    color: #ff9966;
}

.tool-cat-icon-wrap {
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 5px;
}

.tool-cat-icon {
    width: 28px;
    height: 28px;
    object-fit: contain;
}

.tool-cat-name {
    font-size: 12px;
    text-align: center;
    overflow: hidden;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-line-clamp: 1;
    -webkit-box-orient: vertical;
}

/* ============================================
   响应式设计
   ============================================ */
@media (max-width: 992px) {
    .left-sidebar {
        width: 100%;
        position: static;
        order: 3;
        margin-top: 20px;
        border-top: 1px solid var(--border);
        padding-top: 20px;
    }
    
    /* 移动端分类列表高度放大 */
    .category-list {
        max-height: 500px;
    }
    
    /* 移动端大分类标题加大点击区域 */
    .category-group-title {
        padding: 12px 15px;
    }
}

@media (max-width: 576px) {
    .left-sidebar {
        display: none;
    }
    
    .tool-cat-grid {
        grid-template-columns: repeat(4, 1fr);
    }
}