/* Osprey Rankings — the native view.
 *
 * Additive only. No rule in dashboard.css is edited or overridden; everything here either uses a
 * class that does not exist there, or scopes itself under #rankings-view. Every colour, radius,
 * font size and spacing step comes from the existing theme tokens, so the view follows the light
 * and dark themes and the 768px breakpoint without restating either.
 */

/* `display: flex` below would otherwise beat the user-agent rule for the `hidden` attribute, so
   the hidden state is restated explicitly. Without this the view would stay on screen when the
   dashboard grid is shown. */
#rankings-view[hidden] { display: none; }

#rankings-view {
  flex: 1;
  overflow-y: auto;
  overflow-x: hidden;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  min-width: 0;
}

.nr-panel {
  background: var(--bg-surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow-sm);
}

.nr-controls {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
}

.nr-controls .search-input { width: 200px; }

.nr-control-label {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nr-spacer { flex: 1; }

/* --- Provenance block: the sentence a client is entitled to read before any number. --- */
.nr-provenance { padding: 12px 14px; border-bottom: 1px solid var(--border-light); }

.nr-provenance-headline {
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 4px;
}

.nr-provenance-statement {
  font-size: 12px;
  color: var(--text-secondary);
  line-height: 1.5;
  max-width: 78ch;
}

.nr-meta-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(190px, 1fr));
  gap: 8px 16px;
  margin-top: 10px;
}

.nr-meta-item { min-width: 0; }

.nr-meta-label {
  font-size: 10px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.nr-meta-value {
  font-size: 12px;
  color: var(--text-primary);
  font-variant-numeric: tabular-nums;
  overflow-wrap: anywhere;
}

.nr-meta-value.nr-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

/* --- State badges --- */
.nr-badge {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 11px;
  font-weight: 600;
  border: 1px solid transparent;
  white-space: nowrap;
}

.nr-badge-native { background: var(--accent-subtle); color: var(--accent-text); }
.nr-badge-unknown { background: var(--warning-bg); color: var(--warning); }
.nr-badge-superseded { background: var(--bg-inset); color: var(--text-secondary); border-color: var(--border); }
.nr-badge-current { background: var(--success-bg); color: var(--success); }
.nr-badge-danger { background: var(--danger-bg); color: var(--danger); }
.nr-badge-fixture { background: var(--danger-bg); color: var(--danger); border-color: var(--danger); }

.nr-note {
  font-size: 11px;
  color: var(--text-muted);
  line-height: 1.5;
  margin-top: 6px;
  max-width: 90ch;
}

/* --- Table --- */
.nr-table-wrap { overflow-x: auto; overflow-y: auto; max-height: calc(100vh - 340px); }

#rankings-view .data-table th.nr-sortable { cursor: pointer; user-select: none; }
#rankings-view .data-table th.nr-sortable:hover { color: var(--text-primary); }
#rankings-view .data-table th.nr-sortable:focus-visible {
  outline: 2px solid var(--accent);
  outline-offset: -2px;
}
#rankings-view .data-table th .nr-sort-caret { margin-left: 4px; opacity: 0.9; }
#rankings-view .data-table td.nr-symbol { font-weight: 600; color: var(--text-primary); }
#rankings-view .data-table td.nr-unavailable { color: var(--text-muted); font-style: italic; }

.nr-footer {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
  align-items: center;
  padding: 10px 14px;
  border-top: 1px solid var(--border-light);
  font-size: 11px;
  color: var(--text-muted);
}

@media (max-width: 768px) {
  #rankings-view { padding: 8px; }
  .nr-controls .search-input { width: 100%; }
  .nr-table-wrap { max-height: none; }
}
