/* ─── Tab Bar ─── */

.tab-bar {
  display: flex;
  align-items: center;
  background: var(--color-surface-deep, #0f172a);
  border-bottom: 1px solid var(--color-border, rgba(100, 116, 139, 0.3));
  height: 36px;
  min-height: 36px;
  user-select: none;
}

.tab-bar-scroll {
  display: flex;
  align-items: center;
  overflow-x: auto;
  overflow-y: hidden;
  flex: 1;
  height: 100%;
  scrollbar-width: none;
}

.tab-bar-scroll::-webkit-scrollbar {
  display: none;
}

.tab-item {
  display: flex;
  align-items: center;
  gap: 2px;
  height: 100%;
  padding: 0 4px 0 12px;
  background: transparent;
  border-right: 1px solid var(--color-border, rgba(100, 116, 139, 0.2));
  cursor: pointer;
  transition: background 0.15s ease;
  flex-shrink: 0;
  max-width: 180px;
}

.tab-item:hover {
  background: var(--color-surface-hover, rgba(51, 65, 85, 0.5));
}

.tab-item-active {
  background: var(--color-surface, #1e293b);
  border-bottom: 2px solid var(--color-primary, #60a5fa);
}

.tab-item-label {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px 2px;
  min-width: 0;
  flex: 1;
  display: flex;
  align-items: center;
}

.tab-item-text {
  font-size: 12px;
  color: var(--color-text-secondary, #94a3b8);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 130px;
}

.tab-item-active .tab-item-text {
  color: var(--color-text, #e2e8f0);
  font-weight: 500;
}

.tab-item-close {
  background: none;
  border: none;
  cursor: pointer;
  padding: 2px 6px;
  font-size: 10px;
  color: var(--color-text-muted, #64748b);
  border-radius: 4px;
  transition: all 0.15s;
  flex-shrink: 0;
  line-height: 1;
}

.tab-item-close:hover {
  background: var(--color-danger-bg, rgba(239, 68, 68, 0.15));
  color: var(--color-danger, #f87171);
}

/* ─── Drag & Drop ─── */

.tab-item[draggable="true"] {
  cursor: grab;
}

.tab-item[draggable="true"]:active {
  cursor: grabbing;
}

.tab-item-dragging {
  opacity: 0.4;
}

.tab-item-drop-target {
  box-shadow: inset 3px 0 0 0 var(--color-primary, #60a5fa);
}

/* Only enable drag on devices with precise pointer (mouse/trackpad) */
@media (hover: none) and (pointer: coarse) {
  .tab-item[draggable="true"] {
    cursor: pointer;
  }
}

@media (max-width: 640px) {
  .tab-item {
    max-width: 120px;
    padding: 0 4px 0 8px;
  }
  .tab-item-text {
    max-width: 80px;
  }
}
