/**
 * Side Category List Styles
 * 侧边栏栏目列表样式
 * 支持骨架屏、深色模式、虚拟列表
 */

/* ========================================
   CSS Variables - 主题变量
   ======================================== */
:root {
    /* 浅色模式 */
    --skeleton-bg: #e0e0e0;
    --skeleton-shimmer: linear-gradient(90deg, #e0e0e0 25%, #f0f0f0 50%, #e0e0e0 75%);
    --skeleton-text-bg: #d0d0d0;
    --side-item-hover-bg: rgba(0, 0, 0, 0.05);
    --side-item-active-bg: rgba(0, 0, 0, 0.08);
    --side-item-border: rgba(0, 0, 0, 0.06);
}

/* 深色模式 */
html[dark="true"] {
    --skeleton-bg: #3a3a3a;
    --skeleton-shimmer: linear-gradient(90deg, #3a3a3a 25%, #4a4a4a 50%, #3a3a3a 75%);
    --skeleton-text-bg: #4a4a4a;
    --side-item-hover-bg: rgba(255, 255, 255, 0.08);
    --side-item-active-bg: rgba(255, 255, 255, 0.12);
    --side-item-border: rgba(255, 255, 255, 0.08);
}

/* ========================================
   Skeleton Screen - 骨架屏样式
   ======================================== */

/* 骨架屏基础动画 */
@keyframes skeleton-shimmer {
    0% {
        background-position: -200% 0;
    }
    100% {
        background-position: 200% 0;
    }
}

@keyframes skeleton-pulse {
    0%, 100% {
        opacity: 1;
    }
    50% {
        opacity: 0.5;
    }
}

/* 骨架屏容器 */
.skeleton-container {
    padding: 0;
    margin: 0;
}

/* 骨架屏项目 - PC端 */
.skeleton-item-pc {
    display: flex;
    align-items: center;
    padding: 8px;
    gap: 12px;
    border-radius: 8px;
    margin: 2px 0;
}

.skeleton-item-pc .skeleton-thumb {
    width: 28px;
    height: 28px;
    border-radius: 6px;
    background: var(--skeleton-shimmer);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite ease-in-out;
    flex-shrink: 0;
}

.skeleton-item-pc .skeleton-content {
    flex: 1;
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 10px;
}

.skeleton-item-pc .skeleton-title {
    height: 14px;
    width: 60%;
    border-radius: 4px;
    background: var(--skeleton-shimmer);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite ease-in-out;
    animation-delay: 0.1s;
}

.skeleton-item-pc .skeleton-count {
    height: 18px;
    width: 32px;
    border-radius: 10px;
    background: var(--skeleton-shimmer);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite ease-in-out;
    animation-delay: 0.2s;
    flex-shrink: 0;
}

/* 骨架屏项目 - WAP端 */
.skeleton-item-wap {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 12px;
    border-bottom: 1px solid var(--side-item-border);
}

.skeleton-item-wap:last-child {
    border-bottom: none;
}

.skeleton-item-wap .skeleton-title {
    height: 16px;
    width: 50%;
    border-radius: 4px;
    background: var(--skeleton-shimmer);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite ease-in-out;
}

.skeleton-item-wap .skeleton-count {
    height: 20px;
    width: 38px;
    border-radius: 12px;
    background: var(--skeleton-shimmer);
    background-size: 200% 100%;
    animation: skeleton-shimmer 1.5s infinite ease-in-out;
    animation-delay: 0.15s;
}

/* ========================================
   Virtual List Container - 虚拟列表容器
   ======================================== */

/* PC端虚拟列表容器 */
#side-tag-pc {
    max-height: calc(100vh - 350px);
    min-height: 200px;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* 隐藏滚动条 - Firefox */
    scrollbar-width: none;
    /* 平滑滚动 */
    scroll-behavior: smooth;
}

/* 隐藏滚动条 - Chrome/Safari/Edge */
#side-tag-pc::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* WAP端虚拟列表容器 */
#side-tag-wap {
    max-height: 60vh;
    overflow-y: auto;
    overflow-x: hidden;
    -webkit-overflow-scrolling: touch;
    overscroll-behavior: contain;
    /* 隐藏滚动条 - Firefox */
    scrollbar-width: none;
    scroll-behavior: smooth;
}

/* 隐藏滚动条 - Chrome/Safari/Edge */
#side-tag-wap::-webkit-scrollbar {
    display: none;
    width: 0;
    height: 0;
}

/* ========================================
   Virtual List Items - 虚拟列表项目样式
   ======================================== */

/* 虚拟列表占位容器 */
.virtual-list-spacer {
    width: 100%;
    pointer-events: none;
}

/* 虚拟列表可见项容器 */
.virtual-list-visible {
    width: 100%;
}

/* 列表项基础样式 */
#side-tag-pc > li,
#side-tag-wap > li,
.virtual-list-visible > li {
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    will-change: transform, background-color;
    border-radius: 8px;
    margin: 2px 0;
}



/* PC端 hover 效果 */
#side-tag-pc > li:hover,
#side-tag-pc .virtual-list-visible > li:hover {
    background-color: var(--side-item-hover-bg);
    transform: translateX(4px);
}

/* PC端图片容器美化 */
#side-tag-pc .side-thumb {
    flex-shrink: 0;
    width: 28px;
    height: 28px;
    border-radius: 6px;
    overflow: hidden;
    display: flex;
    align-items: center;
    justify-content: center;
}

#side-tag-pc .side-thumb img {
    width: 100%;
    height: 100%;
}

/* PC端文字美化 */
#side-tag-pc .txt-ov {
    font-size: 14px;
    font-weight: 500;
    letter-spacing: 0.3px;
}

#side-tag-pc .f-gray {
    font-size: 12px;
    opacity: 0.6;
    font-weight: 400;
    background: var(--side-item-border);
    padding: 2px 6px;
    border-radius: 10px;
    min-width: 24px;
    text-align: center;
}

/* WAP端列表项美化 */


/* 移动端 touch 效果 */
#side-tag-wap > li:active,
#side-tag-wap .virtual-list-visible > li:active,
#side-tag-pc > li:active,
#side-tag-pc .virtual-list-visible > li:active {
    background-color: var(--side-item-active-bg);
    transform: scale(0.98);
}

/* ========================================
   Image Lazy Load - 图片懒加载样式
   ======================================== */

/* 懒加载图片占位 */
.side-thumb img {
    opacity: 0;
    transition: opacity 0.3s ease;
}

.side-thumb img.loaded {
    opacity: 1;
}

/* 图片加载中状态 */
.side-thumb img.loading {
    background: var(--skeleton-bg);
}

/* ========================================
   Loading States - 加载状态
   ======================================== */

/* 加载更多指示器 */
.load-more-indicator {
    text-align: center;
    padding: 15px 10px;
    color: #888;
    font-size: 13px;
}

.load-more-indicator.loading::after {
    content: '';
    display: inline-block;
    width: 14px;
    height: 14px;
    margin-left: 8px;
    border: 2px solid #ccc;
    border-top-color: #666;
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    vertical-align: middle;
}

html[dark="true"] .load-more-indicator.loading::after {
    border-color: #555;
    border-top-color: #aaa;
}

@keyframes spin {
    to {
        transform: rotate(360deg);
    }
}

/* 无数据提示 */
.no-data-tip {
    text-align: center;
    padding: 30px 15px;
    color: #999;
    font-size: 14px;
}

html[dark="true"] .no-data-tip {
    color: #666;
}

/* 错误提示 */
.error-tip {
    text-align: center;
    padding: 20px 15px;
    color: #e74c3c;
    font-size: 13px;
}

.error-tip .retry-btn {
    display: inline-block;
    margin-top: 10px;
    padding: 6px 16px;
    background: #3498db;
    color: #fff;
    border: none;
    border-radius: 4px;
    cursor: pointer;
    font-size: 13px;
    transition: background 0.2s ease;
}

.error-tip .retry-btn:hover {
    background: #2980b9;
}

/* ========================================
   Mobile Touch Optimization - 移动端触摸优化
   ======================================== */

/* 移动端触摸区域扩大 */
@media screen and (max-width: 768px) {
    #side-tag-wap > li {
        padding: 2px 0;
    }

    #side-tag-wap > li > a {
        padding: 10px 5px;
        display: flex;
        min-height: 44px;
        align-items: center;
    }

    /* 禁用长按选择 */
    #side-tag-wap,
    #side-tag-pc {
        -webkit-user-select: none;
        user-select: none;
        -webkit-touch-callout: none;
    }

    /* 触摸波纹效果 */
    #side-tag-wap > li {
        position: relative;
        overflow: hidden;
    }

    #side-tag-wap > li::after {
        content: '';
        position: absolute;
        top: 50%;
        left: 50%;
        width: 0;
        height: 0;
        background: rgba(0, 0, 0, 0.1);
        border-radius: 50%;
        transform: translate(-50%, -50%);
        transition: width 0.3s ease, height 0.3s ease;
        pointer-events: none;
    }

    html[dark="true"] #side-tag-wap > li::after {
        background: rgba(255, 255, 255, 0.1);
    }

    #side-tag-wap > li:active::after {
        width: 200%;
        height: 200%;
    }
}

/* ========================================
   Performance Optimization - 性能优化
   ======================================== */

/* GPU加速 */
.virtual-list-visible > li {
    transform: translateZ(0);
    backface-visibility: hidden;
}

/* 隐藏项完全不渲染 */
.virtual-item-hidden {
    display: none !important;
}

/* 减少重绘 */
#side-tag-pc,
#side-tag-wap {
    contain: layout style;
}