/* @moonlight/ui v0.3.1 — tokens/tokens.css */
:root {
  --bg: #0f1117;
  --surface: #1a1d27;
  --border: #2a2d3a;
  --text: #e1e4ed;
  --text-muted: #8b8fa3;
  --primary: #6366f1;
  --primary-hover: #818cf8;
  --active: #22c55e;
  --pending: #f59e0b;
  --inactive: #ef4444;
  --font-mono: "SF Mono", "Fira Code", monospace;
  --font-sans: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
}

/* @moonlight/ui v0.3.1 — base-styles/base-styles.css */
/* Base reset + body */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-sans);
  background: var(--bg);
  color: var(--text);
  line-height: 1.6;
}

h2 {
  margin: 1rem 0 0.5rem;
}

h3 {
  margin: 1.5rem 0 0.5rem;
  color: var(--text-muted);
  font-size: 0.875rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Layout */
.container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 0 1.5rem;
}

/* Stat cards */
.stats-row {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin: 1rem 0 2rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem 1.5rem;
  min-width: 120px;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-card.active {
  border-color: var(--active);
}

.stat-card.pending {
  border-color: var(--pending);
}

.stat-card.inactive {
  border-color: var(--inactive);
}

.stat-value {
  font-size: 1.5rem;
  font-weight: 700;
}

.stat-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Utilities */
.mono {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  word-break: break-all;
}

.error-text {
  color: var(--inactive);
  font-size: 0.875rem;
}

.hint-text {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 1rem;
}

.empty-state {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 2rem;
  margin-top: 1rem;
}

.empty-state p {
  margin-bottom: 0.75rem;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 4px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
}

.badge-active {
  background: rgba(34, 197, 94, 0.15);
  color: var(--active);
}

.badge-pending {
  background: rgba(245, 158, 11, 0.15);
  color: var(--pending);
}

.badge-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: var(--inactive);
}

/* Forms */
.form-group {
  margin-bottom: 1rem;
  position: relative;
}

.form-group label {
  display: block;
  font-size: 0.875rem;
  color: var(--text-muted);
  margin-bottom: 0.25rem;
}

.form-group input,
.form-group select {
  width: 100%;
  padding: 0.6rem 0.75rem;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  color: var(--text);
  font-size: 0.875rem;
  font-family: var(--font-mono);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary);
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
  flex-wrap: wrap;
}

.form-row .form-group {
  flex: 1;
  min-width: 150px;
}

/* Buttons */
.btn-primary {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem 1.5rem;
  border-radius: 6px;
  font-size: 0.875rem;
  cursor: pointer;
  transition: background 0.15s;
}

.btn-primary:hover {
  background: var(--primary-hover);
}

.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-wide {
  width: 100%;
  padding: 0.75rem;
  font-size: 1rem;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.875rem;
  cursor: pointer;
  padding: 0;
}

.btn-link:hover {
  color: var(--text);
}

/* Cards (login / generic card layout) */
.login-container {
  display: flex;
  justify-content: center;
  align-items: center;
  min-height: 100vh;
}

.login-card {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 2.5rem;
  width: 100%;
  max-width: 420px;
}

.login-card h1 {
  margin-bottom: 0.5rem;
  color: var(--primary);
}

.login-card p {
  color: var(--text-muted);
  font-size: 0.875rem;
  margin-bottom: 1.5rem;
}

/* Misc banner */
.version-mismatch-banner {
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid var(--border);
  padding: 0.4rem 1.5rem;
  font-size: 0.75rem;
  text-align: center;
}

/* @moonlight/ui v0.3.1 — nav/nav.css */
nav {
  background: var(--surface);
  border-bottom: 1px solid var(--border);
  padding: 0.75rem 1.5rem;
}

.nav-inner {
  max-width: 1200px;
  margin: 0 auto;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.nav-brand {
  font-weight: 700;
  font-size: 1rem;
  color: var(--primary);
  text-decoration: none;
}

.nav-links {
  display: flex;
  gap: 1.25rem;
  align-items: center;
}

.nav-links a {
  color: var(--text-muted);
  text-decoration: none;
  font-size: 0.875rem;
  transition: color 0.15s;
}

.nav-links a:hover {
  color: var(--text);
}

.nav-address {
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--text-muted);
  background: var(--bg);
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  border: 1px solid var(--border);
}

.version-badge {
  font-size: 0.7rem;
  font-weight: 500;
  color: var(--text-muted);
  background: var(--border);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 0.5rem;
}

.icon-btn {
  background: none;
  border: none;
  cursor: pointer;
  color: var(--text-muted);
  padding: 0.35rem;
  border-radius: 4px;
  display: inline-flex;
  align-items: center;
  vertical-align: middle;
}

.icon-btn:hover {
  color: var(--text);
  background: var(--surface);
}

/* @moonlight/ui v0.3.1 — stepper/stepper.css */
.onboarding-stepper {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  margin-bottom: 2.5rem;
  padding: 1.5rem 0 0;
}

.onboarding-step {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.4rem;
  min-width: 80px;
}

.step-dot {
  width: 2rem;
  height: 2rem;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.8rem;
  font-weight: 700;
  background: var(--surface);
  border: 2px solid var(--border);
  color: var(--text-muted);
}

.onboarding-step.active .step-dot {
  border-color: var(--primary);
  background: var(--primary);
  color: white;
}

.onboarding-step.done .step-dot {
  border-color: var(--active);
  background: var(--active);
  color: white;
}

.step-label {
  font-size: 0.7rem;
  color: var(--text-muted);
  text-align: center;
  white-space: nowrap;
}

.onboarding-step.active .step-label {
  color: var(--text);
  font-weight: 600;
}

.onboarding-step.done .step-label {
  color: var(--active);
}

.step-line {
  flex: 1;
  height: 2px;
  background: var(--border);
  min-width: 40px;
  margin: 0 0.25rem;
  margin-bottom: 1.4rem;
}

.step-line.done {
  background: var(--active);
}

.onboarding-content {
  max-width: 600px;
  margin: 0 auto;
}

/* provider-console app-styles */
/*
 * App-specific styles for provider-console.
 *
 * Tokens + base-styles + nav + stepper now come from @moonlight/ui at the
 * pinned tag — fetched and concatenated into public/styles.css by src/build.ts.
 * This file contains ONLY selectors the lib does not ship.
 */

/* Tables */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0;
}

th, td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border);
}

th {
  color: var(--text-muted);
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Grafana */
.grafana-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(500px, 1fr));
  gap: 1.5rem;
  margin-top: 1rem;
}

.grafana-panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 8px;
  padding: 1rem;
  overflow: hidden;
}

.grafana-panel iframe {
  border-radius: 4px;
}

/* Empty-state extensions for code/details/summary (lib ships .empty-state base) */
.empty-state details {
  margin-top: 1rem;
}

.empty-state summary {
  cursor: pointer;
  color: var(--primary);
  font-size: 0.875rem;
}

.empty-state pre {
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1rem;
  margin-top: 0.75rem;
  overflow-x: auto;
  font-size: 0.8rem;
  font-family: var(--font-mono);
  color: var(--text-muted);
}

.empty-state code {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  background: var(--bg);
  padding: 0.1rem 0.3rem;
  border-radius: 3px;
}

/* hint-text anchor extensions (lib ships .hint-text base) */
.hint-text a {
  color: var(--primary);
  text-decoration: none;
}

.hint-text a:hover {
  text-decoration: underline;
}

/* Membership banner */
.membership-banner {
  padding: 0.75rem 1.5rem;
  font-size: 0.875rem;
  font-weight: 500;
  text-align: center;
}

.membership-banner.revoked {
  background: rgba(239, 68, 68, 0.1);
  border-bottom: 1px solid var(--inactive);
  color: var(--inactive);
}

.membership-banner.restored {
  background: rgba(34, 197, 94, 0.1);
  border-bottom: 1px solid var(--active);
  color: var(--active);
}

/* Modals */
.modal-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
}

.modal-overlay[hidden] {
  display: none;
}

.modal {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.5rem;
  width: 90%;
  max-width: 460px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
}

.modal-header h3 {
  margin: 0;
  color: var(--text);
  font-size: 1rem;
  text-transform: none;
  letter-spacing: 0;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.25rem;
  cursor: pointer;
  padding: 0.25rem;
  line-height: 1;
}

.modal-close:hover {
  color: var(--text);
}

/* Jurisdiction picker */
.jurisdiction-picker {
  position: absolute;
  left: 0;
  right: 0;
  z-index: 10;
  background: var(--bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  max-height: 200px;
  overflow-y: auto;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.jurisdiction-list {
  padding: 0.25rem 0;
}

.jurisdiction-option {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.3rem 0.75rem;
  font-size: 0.8rem;
  cursor: pointer;
  color: var(--text);
}

.jurisdiction-option:hover {
  background: var(--surface);
}
.jurisdiction-option.selected {
  background: var(--surface);
  color: var(--active);
}

.jurisdiction-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 0.35rem;
  margin-bottom: 0.5rem;
}

.jurisdiction-tag {
  display: inline-flex;
  align-items: center;
  background: var(--border);
  color: var(--text);
  padding: 0.15rem 0.5rem;
  border-radius: 4px;
  font-size: 0.75rem;
}

/* Provider dashboard — column items with fade in/out */
.dashboard-column {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  min-height: 22rem;
  max-height: 28rem;
  overflow-y: auto;
}

.dashboard-item {
  padding: 0.4rem 0.55rem;
  border: 1px solid var(--border);
  border-radius: 4px;
  font-size: 0.75rem;
  cursor: pointer;
  opacity: 0;
  transition: opacity 250ms ease;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.4rem;
}

.dashboard-item.is-visible {
  opacity: 1;
}

/* Live/Range mode tabs */
.mode-tab {
  border: 0;
  background: transparent;
  color: var(--text-muted);
  padding: 0.2rem 0.7rem;
  font-size: 0.8rem;
  cursor: pointer;
}
.mode-tab[data-active="true"] {
  background: var(--primary);
  color: white;
}
.mode-tab:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}
