/* =============================================
   Sidebar Right — Assets 右侧侧边栏
   ============================================= */

/* ── 面板容器 ── */
.sr-panel {
    position: fixed;
    top: 0;
    right: 0;
    bottom: 0;
    z-index: 30;
    display: flex;
    width: var(--sidebar-right-width);
    flex-direction: column;
    padding-top: 16px;
    background-color: var(--sidebar);
    border-left: 0.5px solid var(--sidebar-border);
    transition: width 150ms ease-out, transform 300ms ease;
}

.sr-panel:not(.visible) {
    display: none;
}

/* ── 顶部关闭按钮 ── */
.sr-header {
    display: flex;
    width: 100%;
    flex-shrink: 0;
    justify-content: flex-end;
    padding: 0 8px;
}

.sr-close-btn {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 8px;
    width: 36px;
    height: 36px;
    font-size: 0.875rem;
    font-weight: 350;
    font-family: inherit;
    color: #a0a0a0;
    background: transparent;
    border: none;
    border-radius: 6px;
    outline: none;
    cursor: pointer;
    transition: all 150ms ease;
}

.sr-close-btn:hover {
    background-color: rgba(30, 30, 30, 0.5);
    color: #e0e0e0;
}

.sr-close-btn:focus-visible {
    box-shadow: 0 0 0 3px rgba(48, 48, 48, 0.5);
}

.sr-close-btn > svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
    pointer-events: none;
}

/* ── 内容区 ── */
.sr-content {
    display: flex;
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
    transition: opacity 200ms ease;
}

/* ── 搜索框 ── */
.sr-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
    margin: 16px 8px 0 8px;
}

.sr-search-icon {
    position: absolute;
    top: 50%;
    left: 14px;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    color: #a0a0a0;
    pointer-events: none;
}

.sr-search-input {
    width: 100%;
    height: 36px;
    padding: 4px 14px 4px 36px;
    font-size: 0.875rem;
    font-family: inherit;
    font-weight: 350;
    color: #ededed;
    background-color: #202020;
    border: 1px solid transparent;
    border-radius: 6px;
    outline: none;
}

.sr-search-input::placeholder {
    color: #a0a0a0;
}

.sr-search-input:focus {
    border-color: oklch(57.9% .2497 257.07);
    box-shadow: 0 0 0 2px oklch(57.9% .2497 257.07 / 0.3);
}

/* ── 上半区（固定）── */
.sr-top-section {
    display: flex;
    flex-shrink: 0;
    flex-direction: column;
    gap: 20px;
    padding: 0 8px 20px 8px;
    margin-top: 16px;
    background-color: transparent;
}

/* ── 下半区（可滚动）── */
.sr-scroll-section {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    padding: 0 8px 16px 8px;
}

/* ── 组容器 ── */
.sr-group {
    position: relative;
    display: flex;
    width: 100%;
    min-width: 0;
    flex-direction: column;
    gap: 1px;
    padding: 8px 0;
}

/* ── 菜单列表 ── */
.sr-menu-list {
    display: flex;
    width: 100%;
    min-width: 0;
    flex-direction: column;
    gap: 2px;
    list-style: none;
    margin: 0;
    padding: 0;
}

/* ── 菜单按钮（h-9）── */
.sr-menu-btn {
    display: flex;
    width: 100%;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    overflow: hidden;
    border-radius: 6px;
    padding: 8px 16px;
    text-align: start;
    font-size: 0.875rem;
    font-weight: 350;
    font-family: inherit;
    line-height: 1.5;
    height: 36px;
    color: #ededed;
    background-color: transparent;
    border: 1px solid transparent;
    outline: none;
    cursor: pointer;
    transition: width 200ms ease, height 200ms ease, padding 200ms ease, transform 200ms ease;
}

.sr-menu-btn:hover {
    background-color: #1e1e1e;
    color: #e0e0e0;
}

.sr-menu-btn:focus-visible {
    box-shadow: 0 0 0 2px #303030;
}

.sr-menu-btn:active {
    transform: scale(0.98);
}

.sr-menu-btn:disabled,
.sr-menu-btn[aria-disabled="true"] {
    pointer-events: none;
    opacity: 0.5;
}

/* 按钮内左侧（图标 + 文字） */
.sr-menu-btn-inner {
    display: flex;
    align-items: center;
    gap: 8px;
    overflow: hidden;
}

.sr-menu-btn-inner > span {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.sr-menu-btn-inner > svg {
    width: 16px;
    height: 16px;
    flex-shrink: 0;
}

/* ── 激活态按钮（蓝色高亮）── */
.sr-menu-btn--active {
    background-color: oklch(57.9% .2497 257.07) !important;
    color: #ffffff !important;
}

.sr-menu-btn--active:hover {
    background-color: oklch(57.9% .2497 257.07 / 0.9) !important;
}

.sr-menu-btn--active[data-active="true"] {
    background-color: #0c0c0c;
    border: 1px solid rgba(80, 80, 80, 0.5);
    box-shadow: 0 1px 2px rgba(0,0,0,0.3);
    color: #e0e0e0;
}

/* ── 计数 Badge ── */
.sr-badge {
    display: inline-flex;
    flex-shrink: 0;
    align-items: center;
    justify-content: center;
    gap: 4px;
    min-width: 24px;
    height: auto;
    padding: 2px 8px;
    font-size: 0.75rem;
    font-weight: 350;
    font-family: inherit;
    font-variant-numeric: tabular-nums;
    color: #a0a0a0;
    background-color: #1f1f1f;
    border: 1px solid transparent;
    border-radius: 6px;
    overflow: hidden;
    white-space: nowrap;
}

.sr-badge--active {
    background-color: rgba(255, 255, 255, 0.2);
    color: #ffffff;
}

/* ── 图标颜色 ── */
.sr-icon-white {
    color: #ffffff;
}

.sr-icon-muted {
    color: #a0a0a0;
}

/* ── 分区标签 ── */
.sr-section-label {
    display: flex;
    flex-shrink: 0;
    align-items: center;
    height: 36px;
    padding: 0 16px;
    font-size: 0.875rem;
    font-weight: 350;
    font-family: inherit;
    color: rgba(176, 176, 176, 0.3);
    border-radius: 6px;
    outline: none;
    user-select: none;
}

.sr-section-label--row {
    justify-content: space-between;
}

/* ── 新建文件夹按钮 ── */
.sr-folder-add-btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 28px;
    height: 28px;
    margin-right: -4px;
    padding: 4px;
    color: #a0a0a0;
    background: transparent;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: background-color 150ms ease;
}

.sr-folder-add-btn:hover {
    background-color: #1e1e1e;
}

.sr-folder-add-btn > svg {
    width: 14px;
    height: 14px;
    flex-shrink: 0;
}

/* ── 折叠态 ── */
.sr-panel[data-state="collapsed"] {
    width: 40px;
    padding-top: 16px;
}

.sr-panel[data-state="collapsed"] .sr-content {
    opacity: 0;
    pointer-events: none;
    overflow: hidden;
}
.sr-panel[data-state="collapsed"] .sr-header {
    pointer-events: auto;
}
.sr-panel[data-state="collapsed"] .sr-header > *:not(.sr-close-btn) {
    display: none;
}
.sr-panel[data-state="collapsed"] .sr-close-btn svg {
    transform: rotate(180deg);
}

/* 展开/折叠时内容区的过渡 */
.sr-content {
    transition: opacity 200ms ease;
}

/* ── 手机端隐藏 ── */
@media (max-width: 1023px) {
    .sr-panel.visible {
        display: none;
    }
}

[data-placeholder] {
    opacity: 0.35;
    pointer-events: none;
}
