/* ============================================
   标签栏样式 (Tabs Bar)
   ============================================ */

.tabs-bar {
    position: fixed;
    top: 64px;  /* --header-height = 64px */
    left: 260px;  /* --sidebar-width = 260px，硬编码避免变量未定义 */
    right: 0;
    width: calc(100% - 260px);
    height: 40px;
    background: #ffffff;
    border-bottom: 1px solid #e5e7eb;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 0.5rem;
    z-index: 998;
    transition: left 0.3s ease, width 0.3s ease;
}

/* 侧边栏折叠时 */
body.sidebar-collapsed .tabs-bar {
    left: 0;
    width: 100%;
}

.tabs-list {
    display: flex;
    align-items: center;
    gap: 0.25rem;
    flex: 1;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: #d1d5db #f3f4f6;
}

.tabs-list::-webkit-scrollbar {
    height: 4px;
}

.tabs-list::-webkit-scrollbar-track {
    background: #f3f4f6;
}

.tabs-list::-webkit-scrollbar-thumb {
    background: #d1d5db;
    border-radius: 2px;
}

/* 标签项容器 */
.tab-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.375rem 0.75rem;
    background: #f9fafb;
    border: 1px solid #f3f4f6;
    border-radius: 0.5rem;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.2s;
    /* user-select: none; */
    position: relative;
}

.tab-item:hover {
    background: #f3f4f6;
}

/* 激活标签 - 使用蓝色系代替绿色 */
.tab-item.active {
    background: #eff6ff;
    border-color: #0ec780;
    color: #0ec780;
}

/* 图标容器 - 淡色圆角背景 */
.tab-item-icon {
    font-size: 1rem;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0.25rem;
    background: rgba(0, 0, 0, 0.04);
    border-radius: 0.375rem;
    width: 1.5rem;
    height: 1.5rem;
}

/* 激活标签的图标背景 */
.tab-item.active .tab-item-icon {
    background: rgba(59, 130, 246, 0.1);
}

.tab-item-title {
    font-size: 0.875rem;
    font-weight: 500;
    margin-right: 0.5rem;
}

/* 关闭按钮 - 右上角定位 */
.tab-item-close {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 1rem;
    height: 1rem;
    border-radius: 50%;
    background: transparent;
    border: solid 1px #9ca3af;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.2s;
    position: absolute;
    top: 0.25rem;
    right: 0.25rem;
    opacity: 0;
    padding: 0;
}

/* 悬停时显示关闭按钮（非当前标签） */
.tab-item:not(.active):hover .tab-item-close {
    opacity: 1;
}

/* 激活标签始终显示关闭按钮 */
.tab-item.active .tab-item-close {
    opacity: 1 !important;
}

.tabs-actions {
    position: relative;
    margin-left: 0.5rem;
}

.tabs-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    background: transparent;
    border: none;
    border-radius: 0.375rem;
    cursor: pointer;
    color: #6b7280;
    transition: all 0.2s;
}

.tabs-btn:hover {
    background: #f3f4f6;
    color: #1f2937;
}

.tabs-menu {
    position: absolute;
    top: 100%;
    right: 0;
    margin-top: 0.25rem;
    background: white;
    border: 1px solid #e5e7eb;
    border-radius: 0.5rem;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    min-width: 140px;
    z-index: 1000;
}

.tabs-menu-item {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    color: #1f2937;
    text-decoration: none;
    transition: background 0.2s;
}

.tabs-menu-item:hover {
    background: #f3f4f6;
}

.tabs-menu-item span.bi {
    font-size: 1rem;
}

/* 拖拽样式 */
.tab-item.dragging {
    opacity: 0.5;
    cursor: grabbing;
}

.tab-item.drag-over {
    border-left: 3px solid #07C160;
}
