.collection-list-container {
    position: fixed;
    top: 102px;
    right: 0;
    width: 100%;
    height: 52vh; /* 全屏高度 */
    z-index: 999;
    display: flex;
    justify-content: flex-end; /* 使内容靠右对齐 - 默认为右侧 */
    align-items: center; /* 垂直居中 */
}

/* 左侧模式 */
.collection-list-container.left-side {
    justify-content: flex-start; /* 使内容靠左对齐 */
    left: 0;
    right: auto;
}

.collection-list-overlay {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 170%;
    z-index: -1;
}

.collection-search-header {
    width: 100%;
    box-sizing: border-box;
    position: sticky; /* 固定在顶部 */
    top: 0;
    z-index: 1000; /* 确保在滚动内容之上 */
}

.collection-search-input {
    width: 74%;
    padding: 2px;
    margin-bottom: 10px;
    border: 1px solid #ccc;
    border-radius: 6px;
    font-size: 14px;
    margin-left: 28px;
}

.collection-global-title {
    font-size: 18px;
    font-weight: bold;
    text-align: center;
    margin-bottom: 10px;
    color: #f7f7f7;
}

.collection-header {
    display: flex;
    align-items: center;
    cursor: pointer;
    user-select: none;
    transition: background-color 0.2s;
    background-color: rgba(120, 120, 120, 0.8); /* 白色背景 */
    color: #333; /* 黑色字体 */
    border-radius: 8px; /* 圆角 */
    margin-bottom: 5px;
    width: 100%; /* 统一宽度 */
    box-sizing: border-box;
    position: relative;
}

.collection-header:hover {
    background-color: #ffffff;
}

.collection-toggle {
    width: 20px;
    height: 20px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 4px; /* 调整右边距 */
    transition: transform 0.2s;
    flex-shrink: 0;
}

/* 右侧模式下的箭头样式 - 箭头在最右边 */
.collection-list-container:not(.left-side) .collection-header {
}

/* 右侧模式下，箭头在最右边 */
.collection-list-container:not(.left-side) .collection-toggle {
    margin-left: 0; /* 调整左边距 */
    position: relative;
    left: 8px;
}

/* 右侧模式下，标题在最左边 */
.collection-list-container:not(.left-side) .collection-name {
    text-align: right; /* 标题左对齐 */
    margin-left: 0;
}

/* 左侧模式下的箭头样式 - 箭头在最左边 */
.collection-list-container.left-side .collection-toggle {
    /*margin-left: 60px; !* 调整左边距 *!*/
    position: absolute;
    left: 120px;
}

.collection-toggle.collapsed {
    transform: rotate(-180deg);
}

.collection-name {
    flex: 1;
    color: #f7f7f7; /* 黑色字体 */
    font-size: 16px;
    text-align: right; /* 标题右对齐 */
    white-space: nowrap;
    overflow: hidden;
    padding: 4px;
    line-height: 20px;
    margin-left: auto; /* 将名称推到最右边 */
}

/* 左侧模式下的名称样式 - 标题在最右边 */
.collection-list-container.left-side .collection-name {
    text-align: left; /* 标题右对齐 */
    margin-right: 0;
}

.collection-link-icon {
    width: 12px;
    height: 12px;
    margin-left: 5px;
    transform: rotate(90deg);
    vertical-align: middle;
}

.collection-name.linkable {
    color: #00ffc6;
}

.collection-name.linkable-hot {
    color: #00ffc6; /* 热门目录标题颜色为红色 */
}

.collection-children {
    margin-top: 5px;
    width: 100%; /* 强制继承父目录宽度 */
    position: relative;
    right: 15px;
}


/* 左侧模式下的子目录缩进 */
.collection-list-container.left-side .collection-children {
    margin-top: 5px;
    width: 100%;
    position: relative;
    left: 15px;
}

/* 子目录项：确保宽度与父目录完全一致 */
.collection-children .collection-item {
    margin-bottom: 8px;
    width: 100%;
}

.collection-name-text{
    position: relative;
    overflow: hidden; /* 裁剪超出的滚动文字 */
}

/* 内层滚动文字容器：实现跑马灯 */
.scroll-text {
    display: inline-block;
    white-space: nowrap;
    animation: marquee 3s linear infinite; /* 跑马灯动画 */
}

/* 跑马灯动画：从右向左无限滚动 */
@keyframes marquee {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(-16%); /* 滚动到文字长度的100%，实现循环 */
    }
}

.collection-list-container.left-side .collection-name-text{
    margin-right: 40px;
    margin-left: 0;
    overflow: hidden; /* 防止滚动内容溢出 */
}

.collection-list-container.left-side .scroll-text{
    display: inline-block;
    white-space: nowrap;
    animation: marqueeLeft 3s linear infinite; /* 跑马灯动画 */
}

@keyframes marqueeLeft {
    0% {
        transform: translateX(0);
    }
    100% {
        transform: translateX(16%); /* 滚动到文字长度的100%，实现循环 */
    }
}

.collection-hot-icon {
    position: absolute;
    top: 50%; /* 垂直居中对齐文字 */
    right: 0; /* 紧贴标题文字右侧 */
    width: 1em; /* 与文字字号等比例 */
    height: 1em;
    transform: translateY(-50%); /* 精准垂直居中 */
    display: inline-block;
    z-index: 1; /* 确保在文字上方 */
}

.collection-list-container.left-side .collection-hot-icon {
    right: -22px;
}

/* 兼容右侧列表模式：同样保持right:0，因为父级是.collection-name-text，不受整体布局影响 */
.collection-list-container:not(.left-side) .collection-hot-icon {
    right: 94px;
}

.toggle-icon::before {
    content: "▲";
    font-size: 20px;
}

.toggle-icon.collapsed::before {
    content: "▼";
    font-size: 20px;
}

/* 为容器添加滚动支持 */
.collection-list-content-wrapper {
    background-color: rgba(123, 121, 121, 0.50); /* 灰色背景 */
    border: 1px; /* 0.5透明度边框 */
    border-radius: 10px; /* 右侧圆角，左侧贴近屏幕边缘 */
    width: 228px; /* 固定宽度 */
    height: 100%; /* 高度为屏幕的一半 */
    max-height: 100%;
    overflow: hidden; /* 隐藏溢出内容，由内部容器处理滚动 */
    padding: 10px;
    box-sizing: border-box;
    position: relative;
    transform: translateX(100%);
    transition: transform 0.3s ease;
    z-index: 999;
    display: flex;
    flex-direction: column;
}

/* 内容滚动容器 */
.collection-list-content-scroll {
    flex: 1;
    overflow-y: auto; /* 只允许垂直滚动 */
    overflow-x: auto; /* 隐藏水平滚动 */
    padding-top: 10px; /* 与搜索框保持一定距离 */
    direction: rtl
}

.collection-list-container.left-side .collection-list-content-scroll{
    direction: ltr
}

/* 左侧模式下的内容包装器样式 */
.collection-list-container.left-side .collection-list-content-wrapper {
    border-radius: 10px; /* 左侧圆角，右侧贴近屏幕边缘 */
    transform: translateX(-100%);
}

.collection-list-container.show .collection-list-content-wrapper {
    transform: translateX(0); /* 滑入显示 */
}

/* 左侧模式下的显示动画 */
.collection-list-container.left-side.show .collection-list-content-wrapper {
    transform: translateX(0); /* 从左侧滑入显示 */
}

.collection-list-container.mobile .collection-list-content-wrapper {
    width: 250px;
    height: 50%;
    padding: 15px;
}

.collection-item{
    width: 70%;
}

@media screen and (max-width: 600px) {

    .collection-item{
        width: 66%;
    }
    .collection-name {
        font-size: 14px;
    }

    .collection-list-container.mobile .collection-name {
        font-size: 14px;
    }

    .collection-list-container:not(.left-side) .collection-toggle{
        left: 8px;
    }
    .collection-list-container.left-side .collection-toggle{
        left: 120px;
    }
    .collection-list-container:not(.left-side) .collection-hot-icon{
        right: 88px;
    }
}

