/* Tab Switcher web component styles */

tab-switcher {
  display: flex;
  position: relative;
  gap: 4px;
  padding: 4px;
  box-sizing: border-box;
  background: #ebebeb;
  border-radius: 10px;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}

tab-switcher::-webkit-scrollbar {
  display: none;
}

tab-switcher .thumb {
  position: absolute;
  top: 4px;
  left: 4px;
  height: calc(100% - 8px);
  background: #fff;
  border-radius: 6px;
  z-index: 0;
  will-change: transform, width;
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.04);
}

tab-item {
  position: relative;
  z-index: 1;
  flex: 1 0 auto;
  min-width: 4.5rem;
  display: block;
  cursor: pointer;
  padding: 10px 12px;
  text-align: center;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
  user-select: none;
  opacity: 0.45;
  font-weight: 400;
  transition: opacity 0.2s ease, font-weight 0.2s ease;
  outline: none;
}

tab-item:focus-visible {
  outline: 2px solid #888;
  outline-offset: 2px;
  border-radius: 4px;
}

tab-item[selected] {
  opacity: 1;
  font-weight: 600;
}

tab-item[disabled] {
  opacity: 0.2;
  cursor: not-allowed;
}

tab-item .hold-glow {
  position: absolute;
  inset: 0;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.12);
  pointer-events: none;
  opacity: 0;
  z-index: 0;
}

tab-item .label {
  position: relative;
  z-index: 1;
  display: inline-block;
}

tab-item.shaking .label {
  animation: tab-switcher-shake 0.35s ease;
}

@keyframes tab-switcher-shake {
  0%   { transform: translateX(0); }
  20%  { transform: translateX(-5px); }
  40%  { transform: translateX(5px); }
  60%  { transform: translateX(-4px); }
  80%  { transform: translateX(4px); }
  100% { transform: translateX(0); }
}

@media (prefers-reduced-motion: reduce) {
  tab-switcher .thumb {
    transition: none !important;
  }
  tab-item.shaking .label {
    animation: none;
  }
}

/* Dark mode support (matches project theme) */
[data-bs-theme="dark"] tab-switcher,
body.dark-mode tab-switcher {
  background: #2a2a2a;
}

[data-bs-theme="dark"] tab-switcher .thumb,
body.dark-mode tab-switcher .thumb {
  background: #3d3d3d;
  box-shadow: 0 2px 24px rgba(0, 0, 0, 0.25);
}

[data-bs-theme="dark"] tab-item .hold-glow,
body.dark-mode tab-item .hold-glow {
  background: rgba(255, 255, 255, 0.12);
}

/* Panel host used by the widget */
.tab-switcher-panels > [role="tabpanel"][hidden] {
  display: none !important;
}

.tab-switcher-loading {
  opacity: 0.55;
  pointer-events: none;
  transition: opacity 0.15s ease;
}
