/* ---------- Tab Bar ---------- */

.tab-bar {
  display: flex;
  align-items: stretch;
  height: 36px;
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border);
  flex-shrink: 0;
}

.tab-bar-scroll {
  display: flex;
  flex: 1;
  overflow-x: auto;
  overflow-y: hidden;
  scrollbar-width: none;  /* Firefox */
}

.tab-bar-scroll::-webkit-scrollbar {
  display: none;  /* Chrome, Safari */
}

/* Fade indicators for scroll overflow */
.tab-bar {
  position: relative;
}

.tab-bar::before,
.tab-bar::after {
  content: '';
  position: absolute;
  top: 0;
  bottom: 0;
  width: 16px;
  pointer-events: none;
  z-index: 1;
  opacity: 0;
  transition: opacity 0.15s;
}

.tab-bar::before {
  left: 0;
  background: linear-gradient(to right, var(--bg-secondary), transparent);
}

.tab-bar::after {
  right: 36px; /* before new tab button */
  background: linear-gradient(to left, var(--bg-secondary), transparent);
}

/* ---------- Tab Item ---------- */

.tab-item {
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 0 8px;
  min-width: 100px;
  max-width: 200px;
  height: 36px;
  border-right: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  cursor: pointer;
  user-select: none;
  transition: background 0.1s;
  flex-shrink: 0;
}

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

.tab-item.active {
  background: var(--bg);
  border-bottom-color: transparent;
  border-top: 2px solid var(--accent);
}

.tab-item:not(.active) {
  border-top: 2px solid transparent;
}

/* ---------- Tab Label ---------- */

.tab-label {
  flex: 1;
  font-size: 12px;
  color: var(--text);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tab-item.active .tab-label {
  font-weight: 500;
  color: var(--text-h);
}

/* ---------- Modified Dot ---------- */

.tab-modified-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text);
  opacity: 0.6;
  flex-shrink: 0;
  animation: tab-dot-in 0.2s ease-out;
}

@keyframes tab-dot-in {
  from { opacity: 0; transform: scale(0); }
  to { opacity: 0.6; transform: scale(1); }
}

/* ---------- Mobile ---------- */

@media (max-width: 767px) {
  .tab-bar {
    height: 40px;
  }

  .tab-item {
    height: 40px;
    min-width: 80px;
  }

  .tab-close {
    display: none;
  }

  .tab-new {
    height: 40px;
    width: 40px;
  }
}

/* ---------- Close Button ---------- */

.tab-close {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 3px;
  background: transparent;
  color: var(--text);
  opacity: 0;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
  flex-shrink: 0;
  transition: opacity 0.1s, background 0.1s;
}

.tab-item:hover .tab-close,
.tab-item.active .tab-close {
  opacity: 0.5;
}

.tab-close:hover {
  opacity: 1 !important;
  background: var(--accent-bg);
}

/* ---------- Rename Input ---------- */

.tab-rename-input {
  flex: 1;
  min-width: 0;
  border: 1px solid var(--accent-border);
  border-radius: 2px;
  background: var(--bg);
  color: var(--text-h);
  font-size: 12px;
  padding: 1px 4px;
  outline: none;
  font-family: inherit;
}

/* ---------- New Tab Button ---------- */

.tab-new {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-bottom: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  font-size: 18px;
  font-weight: 300;
  cursor: pointer;
  flex-shrink: 0;
  transition: color 0.1s;
}

.tab-new:hover {
  color: var(--accent);
}
