﻿/* M3GIM Components - Tabs, Detail Panel, Badges, Spinner */

/* Tab Bar */
.tab-bar {
  display: flex;
  background: var(--color-cream);
  border-bottom: 1px solid var(--border-color);
  height: var(--tab-bar-height);
  flex-shrink: 0;
  overflow-x: auto;
  overflow-y: hidden;
}

.tab-bar__tab {
  display: flex;
  align-items: center;
  gap: var(--space-2);
  padding: 0 var(--space-6);
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: var(--color-text-secondary);
  border: none;
  background: none;
  cursor: pointer;
  border-bottom: 3px solid transparent;
  transition: color var(--transition-fast), border-color var(--transition-fast);
  white-space: nowrap;
  flex-shrink: 0;
}

.tab-bar__tab:hover {
  color: var(--color-text-primary);
}

.tab-bar__tab.active {
  color: var(--color-kug-blau);
  border-bottom-color: var(--color-kug-blau);
}

.tab-bar__tab svg {
  width: 18px;
  height: 18px;
}

.tab-bar__badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 16px;
  height: 16px;
  padding: 0 4px;
  margin-left: 4px;
  font-size: 10px;
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  background: var(--color-kug-blau);
  color: var(--color-text-inverse);
  border-radius: 8px;
}

/* Badges */
.badge {
  display: inline-flex;
  align-items: center;
  padding: 2px var(--space-2);
  border-radius: var(--border-radius);
  font-size: var(--text-xs);
  font-weight: var(--weight-medium);
  white-space: nowrap;
  background: var(--color-parchment);
  color: var(--color-text-secondary);
}

/* F-1: Unified neutral badges - type indicated by text, not color */
.badge--konvolut { background: var(--color-parchment); color: var(--color-text-secondary); }
.badge--konvolut-struct { background: var(--color-cream); color: var(--color-text-secondary); border: 1px solid var(--border-color); font-style: italic; }

/* Wikidata badge — original logo colors, neutral background */
.badge--wikidata {
  background: var(--color-parchment);
  padding: 2px 3px;
  cursor: pointer;
  line-height: 1;
  text-decoration: none;
}

.badge--wikidata svg {
  display: block;
  width: 10px;
  height: 10px;
}

/* Chips */
.chip {
  display: inline-flex;
  align-items: center;
  gap: var(--space-1);
  padding: 2px 8px;
  border-radius: 12px;
  font-size: var(--text-xs);
  line-height: 1.5;
}

.chip--entity {
  background: rgba(0, 74, 143, 0.08);
  color: var(--color-text-primary);
}

.chip--werk {
  background: rgba(139, 58, 58, 0.08);
  color: var(--color-text-primary);
}

.chip--clickable {
  cursor: pointer;
  transition: background var(--transition-fast);
}

.chip--clickable:hover {
  background: rgba(0, 74, 143, 0.18);
}

.chip--werk.chip--clickable:hover {
  background: rgba(139, 58, 58, 0.18);
}

.chip__role {
  color: var(--color-text-tertiary);
  font-size: 0.7rem;
}

/* FF-Badges (research question annotation) */
.ff-badges {
  display: flex;
  gap: var(--space-1);
  margin-left: auto;
  align-items: center;
}

.ff-badges__tag {
  font-size: 0.6rem;
  font-family: var(--font-mono);
  font-weight: var(--weight-semibold);
  padding: 1px 6px;
  border-radius: 10px;
  background: var(--color-cream);
  color: var(--color-kug-blau);
  border: 1px solid var(--border-color);
  letter-spacing: 0.02em;
  line-height: 1.6;
}

/* Data coverage annotation */
.data-coverage {
  font-size: var(--text-xs);
  font-style: italic;
  color: var(--color-text-tertiary);
  text-align: right;
  padding: var(--space-1) 0;
}

/* Spinner */
.spinner {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: var(--space-4);
  height: 100%;
  min-height: 300px;
  color: var(--color-text-tertiary);
}

.spinner__ring {
  width: 40px;
  height: 40px;
  border: 3px solid var(--color-parchment);
  border-top-color: var(--color-kug-blau);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

.spinner__text {
  font-size: var(--text-sm);
}

/* =========================================================================
   Tooltip — CSS-only via data-tip attribute
   Usage: <span data-tip="Tooltip text">Element</span>
   ========================================================================= */

[data-tip] {
  position: relative;
}

[data-tip]::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  padding: var(--space-1) var(--space-2);
  background: var(--color-text-primary);
  color: var(--color-text-inverse);
  font-family: var(--font-ui);
  font-size: var(--text-xs);
  font-weight: var(--weight-normal);
  font-style: normal;
  line-height: var(--leading-normal);
  white-space: nowrap;
  border-radius: var(--border-radius);
  box-shadow: var(--shadow-sm);
  pointer-events: none;
  opacity: 0;
  transition: opacity 150ms ease;
  z-index: 200;
}

/* Multiline tooltips (line breaks via \a in content) */
[data-tip-wrap]::after {
  white-space: pre-line;
  max-width: 280px;
  text-align: left;
}

[data-tip]:hover::after {
  opacity: 1;
}

/* Empty data-tip: no tooltip */
[data-tip=""]::after {
  display: none;
}

/* Position variant: below the element */
[data-tip-pos="bottom"]::after {
  bottom: auto;
  top: calc(100% + 6px);
}

/* Position variant: align left edge (for elements near right screen edge) */
[data-tip-pos="bottom-left"]::after {
  bottom: auto;
  top: calc(100% + 6px);
  left: 0;
  transform: none;
}

/* Table cells: position below to avoid clipping by sticky thead */
.archiv-table td [data-tip]::after,
.archiv-table th [data-tip]::after {
  bottom: auto;
  top: calc(100% + 4px);
}
