.tab-bar {
    position: sticky;
    top: 0;
    z-index: 1000;
    background: var(--tab-bar-bg, #f8f9fa);
    border-bottom: 1px solid var(--tab-bar-border, #dee2e6);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.tab-list {
    display: flex;
    align-items: flex-end;
    overflow-x: auto;
    overflow-y: hidden;
    scrollbar-width: thin;
    scrollbar-color: var(--tab-scrollbar-thumb, #cbd5e1) var(--tab-scrollbar-track, transparent);
    padding: 0 8px;
    gap: 2px;
    min-height: 42px;
}

.tab-list::-webkit-scrollbar {
    height: 6px;
}

.tab-list::-webkit-scrollbar-track {
    background: transparent;
}

.tab-list::-webkit-scrollbar-thumb {
    background: var(--tab-scrollbar-thumb, #cbd5e1);
    border-radius: 3px;
}

.tab-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 8px 16px 8px 12px;
    background: var(--tab-bg, #e9ecef);
    border: 1px solid var(--tab-border, #dee2e6);
    border-bottom: none;
    border-radius: 8px 8px 0 0;
    cursor: pointer;
    user-select: none;
    white-space: nowrap;
    min-width: 120px;
    max-width: 240px;
    position: relative;
    transition: all 0.2s ease;
    margin-top: 4px;
}

.tab-item.dragging {
    opacity: 0.6;
    transform: scale(0.98);
}

.tab-item.drag-over {
    border-color: var(--tab-border-active, #94a3b8);
    box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.35);
}

.tab-item:hover {
    background: var(--tab-bg-hover, #dee2e6);
}

.tab-item.active {
    background: var(--tab-bg-active, #ffffff);
    border-color: var(--tab-border-active, #dee2e6);
    z-index: 10;
    margin-top: 0;
    padding-top: 10px;
    box-shadow: 0 -2px 4px rgba(0,0,0,0.05);
}

.tab-title {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 13px;
    color: var(--tab-text, #495057);
    font-weight: 500;
}

.tab-item.active .tab-title {
    color: var(--tab-text-active, #212529);
    font-weight: 600;
}

.tab-close {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 50%;
    color: var(--tab-close-color, #6c757d);
    font-size: 16px;
    line-height: 1;
    transition: all 0.2s ease;
    flex-shrink: 0;
}

.tab-close:hover {
    background: var(--tab-close-bg-hover, #dc3545);
    color: var(--tab-close-color-hover, #ffffff);
}

.s-main {
    display: flex;
    flex-direction: column;
    min-height: 100vh;
}

.s-main .content {
    flex: 1 1 auto;
    min-height: 0;
}

.tab-containers {
    width: 100%;
    height: auto;
    flex: 1 1 auto;
    min-height: 0;
    position: relative;
    overflow: hidden;
}

.tab-container {
    width: 100%;
    height: 100%;
    display: none;
    overflow: auto;
    position: absolute;
    top: 0;
    left: 0;
}

.tab-container[style*="display: block"],
.tab-container.active {
    display: block !important;
}

.tab-iframe {
    width: 100%;
    height: 100%;
    border: 0;
    display: block;
}

.tab-context-menu {
    position: fixed;
    min-width: 160px;
    background: #ffffff;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    box-shadow: 0 12px 24px rgba(0,0,0,0.12);
    z-index: 10001;
    padding: 6px;
    font-size: 13px;
}

.tab-context-item {
    padding: 8px 10px;
    border-radius: 6px;
    cursor: pointer;
    color: #1f2937;
}

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

[data-bs-theme="dark"] .tab-bar,
html.theme-cosmos-dark .tab-bar {
    background: var(--tab-bar-bg, #1e293b);
    border-bottom-color: var(--tab-bar-border, #334155);
}

[data-bs-theme="dark"] .tab-item,
html.theme-cosmos-dark .tab-item {
    background: var(--tab-bg, #0f172a);
    border-color: var(--tab-border, #334155);
    color: var(--tab-text, #cbd5e1);
}

[data-bs-theme="dark"] .tab-item:hover,
html.theme-cosmos-dark .tab-item:hover {
    background: var(--tab-bg-hover, #1e293b);
}

[data-bs-theme="dark"] .tab-item.active,
html.theme-cosmos-dark .tab-item.active {
    background: var(--tab-bg-active, #0f172a);
    border-color: var(--tab-border-active, #475569);
    color: var(--tab-text-active, #f8fafc);
}

[data-bs-theme="dark"] .tab-title,
html.theme-cosmos-dark .tab-title {
    color: var(--tab-text, #cbd5e1);
}

[data-bs-theme="dark"] .tab-item.active .tab-title,
html.theme-cosmos-dark .tab-item.active .tab-title {
    color: var(--tab-text-active, #f8fafc);
}

[data-bs-theme="dark"] .tab-close,
html.theme-cosmos-dark .tab-close {
    color: var(--tab-close-color, #94a3b8);
}

[data-bs-theme="dark"] .tab-close:hover,
html.theme-cosmos-dark .tab-close:hover {
    background: var(--tab-close-bg-hover, #dc2626);
    color: var(--tab-close-color-hover, #ffffff);
}

[data-bs-theme="dark"] .tab-item.drag-over,
html.theme-cosmos-dark .tab-item.drag-over {
    border-color: #64748b;
    box-shadow: inset 0 0 0 2px rgba(59, 130, 246, 0.35);
}

[data-bs-theme="dark"] .tab-context-menu,
html.theme-cosmos-dark .tab-context-menu {
    background: #0f172a;
    border-color: #334155;
    box-shadow: 0 12px 24px rgba(0,0,0,0.5);
    color: #e2e8f0;
}

[data-bs-theme="dark"] .tab-context-item,
html.theme-cosmos-dark .tab-context-item {
    color: #e2e8f0;
}

[data-bs-theme="dark"] .tab-context-item:hover,
html.theme-cosmos-dark .tab-context-item:hover {
    background: #1e293b;
}

html.theme-glassy-light .tab-bar {
    background: var(--tab-bar-bg, #f8f9fa);
    border-bottom-color: var(--tab-bar-border, #dee2e6);
}

html.theme-glassy-light .tab-item {
    background: var(--tab-bg, #e9ecef);
    border-color: var(--tab-border, #dee2e6);
    color: var(--tab-text, #495057);
}

html.theme-glassy-light .tab-item:hover {
    background: var(--tab-bg-hover, #dee2e6);
}

html.theme-glassy-light .tab-item.active {
    background: var(--tab-bg-active, #ffffff);
    border-color: var(--tab-border-active, #dee2e6);
    color: var(--tab-text-active, #212529);
}

html.theme-glassy-light .tab-title {
    color: var(--tab-text, #495057);
}

html.theme-glassy-light .tab-item.active .tab-title {
    color: var(--tab-text-active, #212529);
}

html.theme-glassy-light .tab-close {
    color: var(--tab-close-color, #6c757d);
}

html.theme-glassy-light .tab-close:hover {
    background: var(--tab-close-bg-hover, #dc3545);
    color: var(--tab-close-color-hover, #ffffff);
}

