/* 标签页系统样式 */

/* ===== 标签栏 ===== */
.tab-bar {
  display: flex;
  align-items: stretch;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-light);
  overflow-x: auto;
  flex-shrink: 0;
  -webkit-overflow-scrolling: touch;
  touch-action: pan-x;
  min-height: 42px;
}
.tab-bar::-webkit-scrollbar { display: none; }
.tab-bar:empty { display: none; }

.tab-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: clamp(5px, 1.6cqi, 8px) clamp(8px, 2.4cqi, 12px) clamp(5px, 1.6cqi, 8px) clamp(8px, 2.8cqi, 14px);
  font-size: clamp(11px, calc(var(--font-size) * 0.875), 14px);
  color: var(--text-secondary);
  background: transparent;
  border-right: 1px solid var(--border-light);
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
  transition: background 0.1s, color 0.1s;
  position: relative;
  min-width: 0;
}
.tab-item[data-tab-type="component"] {
  max-width: clamp(160px, 22ch, 280px);
}
.tab-item:active { background: var(--bg-hover); }
.tab-item.active {
  color: var(--text-primary);
  background: var(--bg-primary);
}
.tab-item.active::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--accent-color);
}

.tab-icon {
  font-size: calc(var(--font-size) * 0.6875);
  flex-shrink: 0;
  opacity: 0.6;
}

.tab-label {
  white-space: nowrap;
  min-width: 0;
}
.tab-item[data-tab-type="component"] .tab-label {
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-close-btn {
  width: 18px;
  height: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: calc(var(--font-size) * 0.875);
  cursor: pointer;
  border-radius: 3px;
  flex-shrink: 0;
  padding: 0;
  line-height: 1;
  opacity: 0.5;
  transition: opacity 0.1s, background 0.1s;
}
.tab-close-btn:hover,
.tab-close-btn:active {
  opacity: 1;
  background: var(--bg-hover);
}

/* ===== 标签内容区 ===== */
.tab-content-area {
  flex: 1;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  min-height: 0;
  min-width: 0;
  position: relative;
}

/* 空状态 */
.tab-empty {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: var(--text-muted);
  font-size: calc(var(--font-size) * 0.875);
  padding: 40px 24px;
  text-align: center;
  line-height: 2;
}

/* ===== 编辑器工作区 ===== */
.editor-workspace {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-height: 0;
}
