/**
 * WAVULT INDUSTRIAL DESIGN SYSTEM v1.0.0
 * wavult-components.css — Reusable Component Library
 *
 * Requires: wavult-tokens.css (must be imported first)
 *
 * Components:
 *   .wv-topbar       — 32px OS-window topbar
 *   .wv-header       — 56px sticky header with TÜV-CERTIFIED badge
 *   .wv-subnav       — 36px secondary nav with active underline
 *   .wv-statusbar    — 24px fixed bottom statusbar
 *   .wv-card         — Sharp 1px border card, 2px radius max
 *   .wv-kpi          — KPI card: eyebrow + value + delta + progress
 *   .wv-table        — Bloomberg-style data table
 *   .wv-pill         — Tags: active/pending/failed
 *   .wv-btn          — Primary/secondary buttons
 *   .wv-section-id   — § XX.00 section header
 *   .wv-tooltip      — [data-tip] dark popover
 *   .wv-progress-bar — 3px progress bar with grid marks
 *
 * @version 1.0.0
 * @build   2026-05-04
 */

/* ═══════════════════════════════════════════════════════════════
   A. TOPBAR — 32px OS-window chrome
   ═══════════════════════════════════════════════════════════════ */
.wv-topbar {
  height: 32px;
  background: linear-gradient(180deg, #1F242C 0%, #0A0E14 100%);
  border-bottom: 1px solid #000;
  display: flex;
  align-items: center;
  padding: 0 12px;
  position: sticky;
  top: 0;
  z-index: 200;
  user-select: none;
  gap: 0;
}

.wv-topbar__brand {
  font-family: var(--font-display);
  font-size: 12px;
  font-weight: 700;
  color: #C5CBD3;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  white-space: nowrap;
  padding-right: 16px;
  border-right: 1px solid #1C2432;
}

.wv-topbar__brand em {
  color: #5E6880;
  font-style: normal;
  margin: 0 5px;
}

.wv-topbar__menu {
  display: flex;
  gap: 0;
  flex: 1;
  list-style: none;
}

.wv-topbar__menu a {
  color: #8C94A4;
  font-family: var(--font-ui);
  font-size: 11px;
  font-weight: 400;
  letter-spacing: 0.01em;
  padding: 0 11px;
  height: 32px;
  display: flex;
  align-items: center;
  border-right: 1px solid #1C2432;
  transition: color var(--dur-fast), background var(--dur-fast);
}

.wv-topbar__menu a:first-child { border-left: 1px solid #1C2432; }
.wv-topbar__menu a:hover { background: #1C2432; color: #C5CBD3; }
.wv-topbar__menu a.active { background: #1C2432; color: #fff; }

.wv-topbar__right {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-left: auto;
}

.wv-topbar__live {
  display: flex;
  align-items: center;
  gap: 5px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: #5E6880;
}

.wv-topbar__live-dot {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--pos);
  box-shadow: 0 0 4px rgba(0,122,51,0.6);
  animation: wv-pulse-green 2s ease-in-out infinite;
}

.wv-topbar__build {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #5E6880;
  letter-spacing: 0.04em;
}

.wv-topbar__clock {
  font-family: var(--font-mono);
  font-size: 11px;
  color: #8C94A4;
  letter-spacing: 0.04em;
  min-width: 62px;
  text-align: right;
}

.wv-topbar__latency {
  font-family: var(--font-mono);
  font-size: 10px;
  color: #5E6880;
  letter-spacing: 0.04em;
}

/* ═══════════════════════════════════════════════════════════════
   B. HEADER — 56px sticky header
   ═══════════════════════════════════════════════════════════════ */
.wv-header {
  height: 56px;
  background: var(--surface-1);
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  padding: 0 20px;
  position: sticky;
  top: 32px;
  z-index: 190;
  gap: 16px;
  box-shadow: var(--shadow-2);
}

.wv-header__left { flex: 1; }

.wv-header__eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--tuv-blue);
  letter-spacing: 0.12em;
  text-transform: uppercase;
  line-height: 1;
  margin-bottom: 4px;
}

.wv-header__title {
  display: flex;
  align-items: center;
  gap: 10px;
}

.wv-header__title h1,
.wv-header__h1 {
  font-family: var(--font-ui);
  font-size: 18px;
  font-weight: 600;
  color: var(--ink-1);
  letter-spacing: -0.01em;
}

/* TÜV-CERTIFIED badge */
.wv-tuv-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  border: 1px solid var(--tuv-blue);
  color: var(--tuv-blue);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  letter-spacing: 0.10em;
  text-transform: uppercase;
  padding: 2px 7px;
  border-radius: var(--radius-2);
}

.wv-header__tabs {
  display: flex;
  gap: 0;
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  overflow: hidden;
}

.wv-header__tab {
  padding: 6px 16px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-4);
  display: block;
  border-right: 1px solid var(--border-1);
  transition: background var(--dur-fast), color var(--dur-fast);
}

.wv-header__tab:last-child { border-right: none; }
.wv-header__tab.active { background: var(--tuv-blue); color: #fff; }
.wv-header__tab:not(.active):hover { background: var(--surface-2); color: var(--ink-2); }

.wv-header__actions { display: flex; gap: 4px; }

.wv-icon-btn {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  color: var(--ink-4);
  background: var(--surface-1);
  transition: background var(--dur-fast), color var(--dur-fast);
  cursor: pointer;
}

.wv-icon-btn:hover { background: var(--surface-2); color: var(--ink-2); }
.wv-icon-btn svg { width: 14px; height: 14px; }

/* ═══════════════════════════════════════════════════════════════
   C. SUBNAV — 36px secondary nav
   ═══════════════════════════════════════════════════════════════ */
.wv-subnav {
  height: 36px;
  background: var(--surface-2);
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: stretch;
  padding: 0 20px;
  position: sticky;
  top: 88px;
  z-index: 180;
}

.wv-subnav__links {
  display: flex;
  align-items: stretch;
  flex: 1;
  gap: 0;
  list-style: none;
}

.wv-subnav__link {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 0 13px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  color: var(--ink-4);
  border-bottom: 2px solid transparent;
  transition: color var(--dur-fast);
  white-space: nowrap;
  cursor: pointer;
}

.wv-subnav__link:hover { color: var(--ink-2); }
.wv-subnav__link.active {
  color: var(--tuv-blue);
  font-weight: 600;
  border-bottom-color: var(--tuv-blue);
  background: var(--surface-1);
}

.wv-subnav__tag {
  font-family: var(--font-mono);
  font-size: 9px;
  color: var(--ink-5);
  background: var(--surface-3);
  border: 1px solid var(--border-1);
  padding: 1px 4px;
  border-radius: var(--radius-2);
  letter-spacing: 0.04em;
}

.wv-subnav__link.active .wv-subnav__tag {
  background: var(--tuv-blue-tint);
  border-color: var(--tuv-blue);
  color: var(--tuv-blue);
}

.wv-subnav__meta {
  display: flex;
  align-items: center;
  gap: 14px;
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-5);
  margin-left: auto;
}

.wv-subnav__meta-item { display: flex; align-items: center; gap: 5px; }

.wv-subnav__dot {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pos);
  animation: wv-pulse-green 2s ease-in-out infinite;
}

/* ═══════════════════════════════════════════════════════════════
   D. STATUSBAR — 24px fixed bottom
   ═══════════════════════════════════════════════════════════════ */
.wv-statusbar {
  position: fixed;
  bottom: 0;
  left: 0;
  right: 0;
  height: 24px;
  background: var(--surface-1);
  border-top: 1px solid var(--border-2);
  display: flex;
  align-items: stretch;
  z-index: 200;
  font-family: var(--font-mono);
  font-size: 10px;
}

.wv-statusbar__cell {
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 0 10px;
  border-right: 1px solid var(--border-1);
  color: var(--ink-4);
  white-space: nowrap;
  position: relative;
}

.wv-statusbar__cell:last-child { border-right: none; }
.wv-statusbar__spacer { flex: 1; border-right: none !important; }

.wv-statusbar__live {
  width: 5px;
  height: 5px;
  border-radius: 50%;
  background: var(--pos);
  animation: wv-pulse-green 2s ease-in-out infinite;
}

.wv-statusbar__progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 2px;
  background: var(--tuv-blue);
  transition: width 1s linear;
}

/* ═══════════════════════════════════════════════════════════════
   E. CARD — Sharp 1px border, 2px radius max
   ═══════════════════════════════════════════════════════════════ */
.wv-card {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  overflow: hidden;
  transition: box-shadow var(--dur-base) var(--ease-tuv),
              border-color var(--dur-base) var(--ease-tuv);
}

.wv-card:hover {
  box-shadow: var(--shadow-2);
  border-color: var(--border-2);
}

.wv-card--lift:hover {
  box-shadow: var(--shadow-3);
  transform: translateY(-1px);
  transition: box-shadow var(--dur-base) var(--ease-tuv),
              border-color var(--dur-base) var(--ease-tuv),
              transform var(--dur-base) var(--ease-tuv);
}

.wv-card__header {
  padding: 10px 16px;
  border-bottom: 1px solid var(--border-1);
  display: flex;
  align-items: center;
  gap: 8px;
  background: var(--surface-2);
}

.wv-card__title {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-3);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  flex: 1;
}

.wv-card__body { padding: 16px; }

.wv-card__footer {
  padding: 10px 16px;
  border-top: 1px solid var(--border-1);
  background: var(--surface-2);
}

/* ═══════════════════════════════════════════════════════════════
   F. KPI — Eyebrow + value + delta + progress
   ═══════════════════════════════════════════════════════════════ */
.wv-kpi {
  background: var(--surface-1);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  padding: 12px 16px 10px;
  position: relative;
  cursor: default;
  transition: background var(--dur-base) var(--ease-tuv);
  overflow: hidden;
}

.wv-kpi::after {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 2px;
  background: var(--tuv-blue);
  transform: scaleX(0);
  transform-origin: left;
  transition: transform var(--dur-base) var(--ease-tuv);
}

.wv-kpi:hover { background: var(--surface-2); }
.wv-kpi:hover::after { transform: scaleX(1); }

.wv-kpi__eyebrow {
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 500;
  color: var(--ink-5);
  letter-spacing: 0.10em;
  text-transform: uppercase;
  margin-bottom: 6px;
  display: flex;
  align-items: center;
  gap: 5px;
}

.wv-kpi__value {
  font-family: var(--font-display);
  font-size: 22px;
  font-weight: 700;
  color: var(--ink-1);
  letter-spacing: -0.01em;
  line-height: 1;
  margin-bottom: 4px;
}

.wv-kpi__unit {
  font-family: var(--font-mono);
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-4);
  margin-left: 2px;
}

.wv-kpi__sub {
  display: flex;
  align-items: center;
  gap: 6px;
  margin: 4px 0 8px;
}

.wv-kpi__progress {
  height: 3px;
  background: var(--surface-3);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.wv-kpi__progress-fill {
  height: 100%;
  border-radius: 1px;
  background: var(--tuv-blue);
  transition: width 600ms var(--ease-tuv);
}

/* Grid tick marks */
.wv-kpi__progress::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent calc(25% - 1px),
    rgba(10,14,20,0.08) calc(25% - 1px),
    rgba(10,14,20,0.08) 25%
  );
}

/* ═══════════════════════════════════════════════════════════════
   G. TABLE — Bloomberg-style data table
   ═══════════════════════════════════════════════════════════════ */
.wv-table-wrap {
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  overflow: hidden;
}

.wv-table {
  width: 100%;
  border-collapse: collapse;
  font-family: var(--font-ui);
  font-size: 12px;
}

.wv-table th {
  background: var(--surface-2);
  font-family: var(--font-mono);
  font-size: 9px;
  font-weight: 600;
  color: var(--ink-4);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  padding: 8px 10px;
  text-align: left;
  border-bottom: 1px solid var(--border-2);
  white-space: nowrap;
  user-select: none;
}

.wv-table th.sortable { cursor: pointer; }
.wv-table th.sortable:hover { color: var(--ink-2); background: var(--surface-3); }

.wv-table td {
  padding: 9px 10px;
  border-bottom: 1px solid var(--border-1);
  vertical-align: middle;
  white-space: nowrap;
}

.wv-table tr:last-child td { border-bottom: none; }

.wv-table tbody tr {
  background: var(--surface-1);
  transition: background var(--dur-fast);
  position: relative;
}

.wv-table tbody tr:hover { background: var(--surface-2); }

.wv-table tfoot tr td {
  background: var(--surface-2);
  border-top: 2px solid var(--ink-2);
  font-weight: 700;
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-2);
}

.wv-table .cell-mono {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-3);
}

.wv-table .cell-rank {
  font-family: var(--font-mono);
  font-size: 11px;
  color: var(--ink-5);
  width: 32px;
}

/* ═══════════════════════════════════════════════════════════════
   H. PILL — Status tags
   ═══════════════════════════════════════════════════════════════ */
.wv-pill {
  display: inline-flex;
  align-items: center;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 2px 6px;
  border-radius: var(--radius-2);
  font-weight: 500;
  white-space: nowrap;
}

.wv-pill--active {
  color: var(--tuv-blue);
  background: var(--tuv-blue-tint);
  border: 1px solid rgba(0,61,122,0.15);
}

.wv-pill--pending {
  color: var(--ink-4);
  background: var(--surface-3);
  border: 1px solid var(--border-1);
}

.wv-pill--failed {
  color: var(--neg);
  background: var(--neg-tint);
  border: 1px solid rgba(188,27,27,0.15);
}

.wv-pill--warn {
  color: var(--warn);
  background: var(--warn-tint);
  border: 1px solid rgba(184,134,11,0.15);
}

.wv-pill--pos {
  color: var(--pos);
  background: var(--pos-tint);
  border: 1px solid rgba(0,122,51,0.15);
}

/* ═══════════════════════════════════════════════════════════════
   I. BUTTON
   ═══════════════════════════════════════════════════════════════ */
.wv-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  font-family: var(--font-ui);
  font-size: 12px;
  font-weight: 500;
  padding: 6px 14px;
  border-radius: var(--radius-2);
  border: 1px solid transparent;
  cursor: pointer;
  transition: background var(--dur-fast), color var(--dur-fast),
              border-color var(--dur-fast), box-shadow var(--dur-fast);
  white-space: nowrap;
  user-select: none;
}

.wv-btn:disabled { opacity: 0.45; cursor: not-allowed; }

.wv-btn--primary {
  background: var(--tuv-blue);
  color: #fff;
  border-color: var(--tuv-blue-deep);
}

.wv-btn--primary:not(:disabled):hover {
  background: var(--tuv-blue-deep);
  box-shadow: var(--shadow-1);
}

.wv-btn--secondary {
  background: var(--surface-1);
  color: var(--ink-2);
  border-color: var(--border-2);
}

.wv-btn--secondary:not(:disabled):hover {
  background: var(--surface-2);
  color: var(--ink-1);
  border-color: var(--border-2);
}

.wv-btn--ghost {
  background: transparent;
  color: var(--ink-4);
  border-color: var(--border-1);
}

.wv-btn--ghost:not(:disabled):hover {
  background: var(--surface-2);
  color: var(--ink-2);
}

.wv-btn--sm { font-size: 11px; padding: 4px 10px; }
.wv-btn--lg { font-size: 13px; padding: 8px 20px; }

/* ═══════════════════════════════════════════════════════════════
   J. SECTION HEADER — § XX.00
   ═══════════════════════════════════════════════════════════════ */
.wv-section-id {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 0 10px;
  border-bottom: 1px solid var(--border-2);
  margin-bottom: 12px;
}

.wv-section-id__id {
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 600;
  color: var(--tuv-blue);
  letter-spacing: 0.06em;
  white-space: nowrap;
}

.wv-section-id__title {
  font-family: var(--font-ui);
  font-size: 14px;
  font-weight: 600;
  color: var(--ink-1);
}

.wv-section-id__sub {
  font-size: 11px;
  font-weight: 400;
  color: var(--ink-4);
  margin-left: 2px;
}

.wv-section-id__tools {
  margin-left: auto;
  display: flex;
  align-items: center;
  gap: 6px;
}

.wv-section-id__tool-btn {
  font-family: var(--font-mono);
  font-size: 10px;
  color: var(--ink-4);
  border: 1px solid var(--border-1);
  border-radius: var(--radius-2);
  padding: 2px 8px;
  background: var(--surface-1);
  transition: background var(--dur-fast), color var(--dur-fast);
  cursor: pointer;
}

.wv-section-id__tool-btn:hover { background: var(--surface-2); color: var(--ink-2); }

/* ═══════════════════════════════════════════════════════════════
   K. TOOLTIP — [data-tip] dark popover
   ═══════════════════════════════════════════════════════════════ */
[data-tip] { position: relative; }

[data-tip]:hover::after {
  content: attr(data-tip);
  position: absolute;
  bottom: calc(100% + 6px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--ink-1);
  color: #C5CBD3;
  font-family: var(--font-mono);
  font-size: 10px;
  padding: 5px 8px;
  border-radius: var(--radius-2);
  white-space: nowrap;
  z-index: 300;
  pointer-events: none;
  animation: wv-fade-up var(--dur-base) var(--ease-tuv);
}

[data-tip]:hover::before {
  content: '';
  position: absolute;
  bottom: calc(100% + 2px);
  left: 50%;
  transform: translateX(-50%);
  border: 4px solid transparent;
  border-top-color: var(--ink-1);
  z-index: 300;
  pointer-events: none;
  animation: wv-fade-up var(--dur-base) var(--ease-tuv);
}

/* Tooltip: bottom-anchor variant */
[data-tip-bottom]:hover::after {
  bottom: auto;
  top: calc(100% + 6px);
  animation: wv-fade-down var(--dur-base) var(--ease-tuv);
}
[data-tip-bottom]:hover::before {
  bottom: auto;
  top: calc(100% + 2px);
  border-top-color: transparent;
  border-bottom-color: var(--ink-1);
  animation: wv-fade-down var(--dur-base) var(--ease-tuv);
}

/* ═══════════════════════════════════════════════════════════════
   L. PROGRESS BAR — 3px with grid marks
   ═══════════════════════════════════════════════════════════════ */
.wv-progress-bar {
  height: 3px;
  background: var(--surface-3);
  border-radius: 1px;
  overflow: hidden;
  position: relative;
}

.wv-progress-bar__fill {
  height: 100%;
  border-radius: 1px;
  background: var(--tuv-blue);
  transition: width 600ms var(--ease-tuv);
}

.wv-progress-bar--pos .wv-progress-bar__fill { background: var(--pos); }
.wv-progress-bar--neg .wv-progress-bar__fill { background: var(--neg); }
.wv-progress-bar--warn .wv-progress-bar__fill { background: var(--warn); }

/* Grid tick marks at 25% intervals */
.wv-progress-bar--ticks::after {
  content: '';
  position: absolute;
  inset: 0;
  background: repeating-linear-gradient(
    90deg,
    transparent,
    transparent calc(25% - 1px),
    rgba(10,14,20,0.10) calc(25% - 1px),
    rgba(10,14,20,0.10) 25%
  );
  pointer-events: none;
}

/* Thicker variant */
.wv-progress-bar--thick { height: 6px; }

/* ═══════════════════════════════════════════════════════════════
   M. DELTA PILL — Directional value change indicator
   ═══════════════════════════════════════════════════════════════ */
.wv-delta {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  font-family: var(--font-mono);
  font-size: 10px;
  font-weight: 500;
  padding: 1px 5px;
  border-radius: var(--radius-2);
}

.wv-delta--up { color: var(--pos); background: var(--pos-tint); }
.wv-delta--dn { color: var(--neg); background: var(--neg-tint); }
.wv-delta--flat { color: var(--ink-4); background: var(--surface-3); }

/* ═══════════════════════════════════════════════════════════════
   N. DIVIDER
   ═══════════════════════════════════════════════════════════════ */
.wv-divider {
  height: 1px;
  background: var(--border-1);
  margin: 16px 0;
}

.wv-divider--strong {
  background: var(--border-2);
  height: 2px;
}

/* ═══════════════════════════════════════════════════════════════
   KEYFRAMES
   ═══════════════════════════════════════════════════════════════ */
@keyframes wv-pulse-green {
  0%, 100% { opacity: 1; box-shadow: 0 0 4px rgba(0,122,51,0.6); }
  50%       { opacity: 0.7; box-shadow: 0 0 8px rgba(0,122,51,0.9); }
}

@keyframes wv-fade-up {
  from { opacity: 0; transform: translateX(-50%) translateY(4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

@keyframes wv-fade-down {
  from { opacity: 0; transform: translateX(-50%) translateY(-4px); }
  to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}

/* ═══════════════════════════════════════════════════════════════
   RESPONSIVE
   ═══════════════════════════════════════════════════════════════ */
@media (max-width: 768px) {
  .wv-subnav__meta { display: none; }
  .wv-header { padding: 0 12px; }
  .wv-topbar { padding: 0 8px; }
}
