/**
 * Tabs Component - 玻璃态设计风格
 * 浏览器标签页列表
 * 更新: 2026-01-16 - 应用玻璃态设计规范
 */

/* ===== 通用标签按钮 - 玻璃态 ===== */
.tab-btn {
  padding: 0.5rem 1.25rem;
  border-radius: 0.5rem;
  font-size: 0.875rem;
  font-weight: 600;
  transition: all 0.2s ease;
  background: rgba(23, 23, 23, 0.5);
  color: var(--muted-foreground);
  border: none;
  cursor: pointer;
}

.tab-btn:hover {
  background: rgba(38, 38, 38, 1);
  color: white;
}

.tab-btn.active {
  background: white;
  color: black;
  box-shadow: 0 4px 12px rgba(255, 255, 255, 0.1);
}

/* 标签组容器 */
.tab-group {
  display: flex;
  gap: 0.25rem;
  background: rgba(0, 0, 0, 0.3);
  padding: 0.25rem;
  border-radius: 0.625rem;
}

/* 玻璃态标签组 */
.tab-group-glass {
  display: flex;
  gap: 0.25rem;
  background: rgba(255, 255, 255, 0.05);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 0.25rem;
  border-radius: 0.625rem;
  border: 1px solid rgba(255, 255, 255, 0.1);
}

/* ===== 标签页容器 ===== */
#browser-tabs-container {
  height: 100%;
  overflow-y: auto;
  padding: 0.5rem;
  position: relative;
}

/* 浏览器面板内的 loading-overlay */
#browser-tabs-container #loading-overlay {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  background: var(--background);
  z-index: 10;
}

#tabs-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* ===== 标签页项 - 玻璃态 ===== */
.tab-item {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 0.875rem;
  background: rgba(255, 255, 255, 0.03);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  border-radius: var(--radius);
  cursor: pointer;
  transition: all 0.3s ease;
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  animation: listItemIn var(--transition-normal, 200ms) ease-out;
  animation-fill-mode: both;
}

.tab-item:hover {
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
  transform: translateY(-1px);
}

.tab-item.active {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.15);
}

.tab-item.active::before {
  content: '';
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  width: 3px;
  height: 60%;
  background: var(--primary);
  border-radius: 0 2px 2px 0;
}

/* 标签页图标 - 玻璃态 */
.tab-icon {
  width: 1.75rem;
  height: 1.75rem;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  background: rgba(255, 255, 255, 0.05);
  border-radius: var(--radius-sm);
}

.tab-icon img {
  width: 1.125rem;
  height: 1.125rem;
  object-fit: contain;
  border-radius: 0.125rem;
}

/* 标签页信息 */
.tab-info {
  flex: 1;
  min-width: 0;
  overflow: hidden;
}

.tab-title {
  font-size: 0.8125rem;
  font-weight: 500;
  color: var(--foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  margin-bottom: 0.125rem;
}

.tab-url {
  font-size: 0.6875rem;
  color: var(--muted-foreground);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 标签页操作 */
.tab-actions {
  display: flex;
  gap: 0.25rem;
  opacity: 0;
  transition: opacity var(--transition-fast, 150ms);
}

.tab-item:hover .tab-actions {
  opacity: 1;
}

.tab-action-btn {
  width: 1.5rem;
  height: 1.5rem;
  border: none;
  background: rgba(255, 255, 255, 0.05);
  color: var(--muted-foreground);
  border-radius: var(--radius-sm);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  transition: all var(--transition-fast, 150ms);
}

.tab-action-btn:hover {
  background: rgba(239, 68, 68, 0.8);
  color: white;
}

/* ===== 列表项入场动画 ===== */
@keyframes listItemIn {
  from {
    opacity: 0;
    transform: translateX(-8px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 列表项依次入场 */
.tab-item:nth-child(1) { animation-delay: 0ms; }
.tab-item:nth-child(2) { animation-delay: 30ms; }
.tab-item:nth-child(3) { animation-delay: 60ms; }
.tab-item:nth-child(4) { animation-delay: 90ms; }
.tab-item:nth-child(5) { animation-delay: 120ms; }
.tab-item:nth-child(n+6) { animation-delay: 150ms; }

#no-tabs-message {
  flex-direction: column;
}

/* ===== 浅色主题样式 - 颜色反转 ===== */

/* 通用标签按钮 - 浅色主题 */
body:not(.dark) .tab-btn {
  background: rgba(0, 0, 0, 0.05);
  color: var(--muted-foreground);
}

body:not(.dark) .tab-btn:hover {
  background: rgba(0, 0, 0, 0.12);
  color: var(--foreground);
}

body:not(.dark) .tab-btn.active {
  background: var(--foreground);
  color: var(--background);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* 标签组容器 - 浅色主题 */
body:not(.dark) .tab-group {
  background: rgba(0, 0, 0, 0.05);
}

/* 玻璃态标签组 - 浅色主题 */
body:not(.dark) .tab-group-glass {
  background: rgba(0, 0, 0, 0.05);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

/* 标签页项 - 浅色主题 */
body:not(.dark) .tab-item {
  background: rgba(0, 0, 0, 0.03);
  border: 1px solid rgba(0, 0, 0, 0.1);
}

body:not(.dark) .tab-item:hover {
  background: rgba(0, 0, 0, 0.08);
  border-color: rgba(0, 0, 0, 0.2);
}

/* 标签页图标 - 浅色主题 */
body:not(.dark) .tab-icon {
  background: rgba(0, 0, 0, 0.05);
}

/* 标签页操作按钮 - 浅色主题 */
body:not(.dark) .tab-action-btn {
  background: rgba(0, 0, 0, 0.05);
}
