/* FamilyLine OPS / NOC Console v2 — NOC Dashboard Styles
 * Design Spec: docs/design/ops-noc-console-v2-design-spec.md
 * Ticket: T-164
 */

:root {
  /* Backgrounds (neutral dark, not blue-tinted) */
  --bg-body:    #111111;
  --bg-surface: #1a1a1a;
  --bg-elevated:#222222;
  --bg-inset:   #0d0d0d;

  /* Text */
  --fg-primary:   #e8e8e8;
  --fg-secondary: #a0a0a0;
  --fg-muted:     #666666;

  /* Status colors */
  --ok:      #2ee59d;
  --ok-bg:   rgba(46,229,157,0.12);
  --warn:    #ffa726;
  --warn-bg: rgba(255,167,38,0.12);
  --fail:    #ef5350;
  --fail-bg: rgba(239,83,80,0.12);

  /* Accents */
  --accent: #42a5f5;
  --line:   rgba(255,255,255,0.08);

  /* Fonts */
  --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --font-mono: 'JetBrains Mono', ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
}

* { box-sizing: border-box; }

html, body {
  height: 100%;
  margin: 0;
  background: var(--bg-body);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

.hidden { display: none !important; }

.muted { color: var(--fg-muted); }

body.ops-auth-locked .noc-header,
body.ops-auth-locked .noc-tabs,
body.ops-auth-locked .noc-content,
body.ops-auth-locked .modal {
  display: none !important;
}

body.ops-auth-locked {
  overflow: hidden;
}

.ops-auth-gate {
  position: fixed;
  inset: 0;
  z-index: 200;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  background:
    radial-gradient(circle at top, rgba(66,165,245,0.16), transparent 32%),
    linear-gradient(180deg, #0b0b0b 0%, #141414 100%);
}

.ops-auth-gate.hidden {
  display: none !important;
}

.ops-auth-gate__card {
  width: min(420px, 100%);
  padding: 28px;
  border: 1px solid var(--line);
  border-radius: 16px;
  background: rgba(26,26,26,0.96);
  box-shadow: 0 24px 80px rgba(0,0,0,0.45);
}

.ops-auth-gate__logo {
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 18px;
  background: linear-gradient(135deg, #42a5f5 0%, #1565c0 100%);
  border-radius: 10px;
  color: #fff;
  font-weight: 700;
  font-size: 18px;
}

.ops-auth-gate__title {
  margin: 0 0 10px;
  font-size: 24px;
  font-weight: 700;
}

.ops-auth-gate__text {
  margin: 0 0 18px;
  color: var(--fg-secondary);
  line-height: 1.5;
}

.ops-auth-gate__input {
  width: 100%;
  margin-bottom: 14px;
}

.ops-auth-gate__actions {
  display: flex;
  justify-content: flex-end;
}

.ops-auth-gate__hint {
  min-height: 18px;
  margin-top: 12px;
  color: var(--warn);
}

/* Header (48px sticky) */
.noc-header {
  height: 48px;
  position: sticky;
  top: 0;
  z-index: 50;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 20px;
  background: rgba(17,17,17,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.noc-header__brand {
  display: flex;
  align-items: center;
  gap: 12px;
}

.noc-logo {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 6px;
  font-weight: 700;
  font-size: 14px;
  color: white;
}

.noc-header__title {
  font-size: 15px;
  font-weight: 600;
  color: var(--fg-primary);
}

.noc-header__right {
  display: flex;
  align-items: center;
  gap: 16px;
}

.noc-header__updated {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
}

.noc-header__auth {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: none;
  border: 1px solid var(--line);
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  transition: border-color 0.15s;
}

.noc-header__auth:hover { border-color: var(--accent); }
.noc-header__auth.authed { border-color: var(--ok); color: var(--ok); }
.noc-header__auth.paused { border-color: var(--warn); color: var(--warn); }

.noc-header__profile {
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  color: var(--fg-muted);
  font-size: 14px;
}

.noc-auth-dropdown {
  position: absolute;
  top: 48px;
  right: 60px;
  width: 280px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 16px;
  box-shadow: 0 8px 24px rgba(0,0,0,0.4);
  z-index: 51;
}

/* Auth dropdown layout */
.noc-auth-dropdown .auth-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.noc-auth-dropdown .auth-label {
  font-size: 11px;
  font-weight: 600;
  letter-spacing: 0.04em;
  color: var(--fg-muted);
  text-transform: uppercase;
}

.noc-auth-dropdown .auth-sep {
  height: 1px;
  background: var(--line);
  margin: 12px 0;
}

.noc-auth-dropdown input[type="file"] {
  width: 100%;
  color: var(--fg-secondary);
}

.noc-auth-dropdown .auth-key-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
}

.noc-auth-dropdown .hint {
  padding: 0;
}

.noc-auth-dropdown.hidden { display: none; }

.noc-auth-dropdown .input {
  width: 100%;
  margin-bottom: 12px;
}

.noc-auth-dropdown .btn-row {
  display: flex;
  gap: 8px;
}

.noc-auth-dropdown .btn-row .btn { flex: 1; }

/* Tab Bar (40px sticky) */
.noc-tabs {
  height: 40px;
  position: sticky;
  top: 48px;
  z-index: 49;
  display: flex;
  align-items: stretch;
  gap: 0;
  padding: 0 20px;
  background: rgba(17,17,17,0.95);
  backdrop-filter: blur(12px);
  border-bottom: 1px solid var(--line);
}

.noc-tab {
  padding: 0 16px;
  font-size: 12px;
  font-weight: 500;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--fg-muted);
  background: none;
  border: none;
  border-bottom: 2px solid transparent;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
}

.noc-tab:hover { color: var(--fg-secondary); }

.noc-tab--active {
  color: var(--fg-primary);
  border-bottom-color: var(--accent);
}

/* Content Area */
.noc-content {
  flex: 1;
  overflow-y: auto;
  padding: 20px 24px;
}

.noc-error {
  margin: 0 0 16px 0;
  padding: 12px 16px;
  border-radius: 8px;
  border: 1px solid var(--fail);
  background: var(--fail-bg);
  color: var(--fail);
}

.noc-error.hidden { display: none; }

/* Grid Layouts */
.grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.routing-side-stack {
  display: grid;
  gap: 16px;
  align-content: start;
}

#routing-source-kv {
  padding: 12px 16px;
}

#routing-source-kv > div {
  padding-left: 12px;
}

.grid-3 {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 16px;
}

.layout-sidebar {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 16px;
}

@media (max-width: 1024px) {
  .grid-3 { grid-template-columns: 1fr 1fr; }
}

@media (max-width: 768px) {
  .grid-2, .grid-3, .layout-sidebar { grid-template-columns: 1fr; }
  .noc-header__title { display: none; }
}

/* Cards */
.card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.card__title {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--line);
}

/* Status Components */
.pill {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 999px;
  font-family: var(--font-mono);
  font-size: 12px;
  font-weight: 600;
  border: 1px solid transparent;
}

.pill.ok  { border-color: var(--ok);  color: var(--ok);  background: var(--ok-bg); }
.pill.warn{ border-color: var(--warn); color: var(--warn); background: var(--warn-bg); }
.pill.fail{ border-color: var(--fail); color: var(--fail); background: var(--fail-bg); }
.pill.unknown { border-color: var(--fg-muted); color: var(--fg-muted); background: rgba(102,102,102,0.12); }

.dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  display: inline-block;
}

.dot.ok  { background: var(--ok); }
.dot.warn{ background: var(--warn); }
.dot.fail{ background: var(--fail); }
.dot.unknown { background: var(--fg-muted); }

/* Status Bar (Map tab) */
.noc-status-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  height: 40px;
  margin-bottom: 16px;
}

.noc-status-pills {
  display: flex;
  align-items: center;
  gap: 12px;
}

.noc-status-bar__time {
  font-family: var(--font-mono);
  font-size: 12px;
  color: var(--fg-muted);
}

/* Topology Canvas (SVG Map) */
.topo-canvas {
  background: var(--bg-inset);
  border: 1px solid var(--line);
  border-radius: 8px;
  min-height: 480px;
  position: relative;
  overflow: hidden;
}

.topo-canvas svg {
  width: 100%;
  height: 480px;
  display: block;
}

.topo-node {
  cursor: pointer;
}

.topo-node rect.bg {
  fill: var(--bg-surface);
  stroke: var(--line);
  stroke-width: 1;
  transition: stroke 0.15s;
}

.topo-node:hover rect.bg {
  stroke: var(--accent);
}

.topo-node rect.status-strip {
  rx: 0 0 6px 6px;
}

.topo-node text.node-id {
  fill: var(--fg-primary);
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  text-anchor: middle;
  pointer-events: none;
}

.topo-node text.node-role {
  fill: var(--fg-muted);
  font-family: var(--font-mono);
  font-size: 10px;
  text-anchor: middle;
  pointer-events: none;
}

.topo-line {
  fill: none;
  stroke-width: 1.5;
  stroke-linecap: round;
}

.topo-line.ok  { stroke: rgba(46,229,157,0.4); }
.topo-line.warn{ stroke: rgba(255,167,38,0.6); }
.topo-line.fail{ stroke: rgba(239,83,80,0.8); }
.topo-line.unknown { stroke: var(--line); }

.edge-path {
  stroke-width: 1.5;
  stroke-linecap: round;
  stroke: var(--line);
}

.edge-path.ok { stroke: rgba(46,229,157,0.4); }
.edge-path.warn { stroke: rgba(255,167,38,0.6); }
.edge-path.fail { stroke: rgba(239,83,80,0.8); }
.edge-path.unknown { stroke: var(--line); }

.node-card { cursor: pointer; }

.node-card__bg {
  fill: var(--bg-surface);
  stroke: rgba(255,255,255,0.3);
  stroke-width: 1.5;
}

.node-card.ok .node-card__bg {
  fill: rgba(46,229,157,0.25);
  stroke: var(--ok);
}

.node-card.warn .node-card__bg {
  fill: rgba(255,167,38,0.25);
  stroke: var(--warn);
}

.node-card.fail .node-card__bg {
  fill: rgba(239,83,80,0.22);
  stroke: var(--fail);
}

.node-card__strip.ok { fill: var(--ok); }
.node-card__strip.warn { fill: var(--warn); }
.node-card__strip.fail { fill: var(--fail); }
.node-card__strip.unknown { fill: var(--line); }

.node-card__id {
  fill: #ffffff;
  font-family: var(--font-mono);
  font-size: 13px;
  font-weight: 500;
  pointer-events: none;
}

.node-card__role {
  fill: #ffffff;
  font-family: var(--font-mono);
  font-size: 10px;
  pointer-events: none;
}

/* Route Annotations */
.topo-routes {
  border-top: 1px solid var(--line);
  padding: 16px;
  margin-top: 0;
}

.route-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 0;
  font-size: 12px;
}

.route-bullet {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.route-bullet.ok { background: var(--ok); }
.route-bullet.warn { background: var(--warn); }
.route-bullet.fail { background: var(--fail); }
.route-bullet.unknown { background: var(--fg-muted); }

.route-label {
  font-weight: 600;
  color: var(--fg-secondary);
  flex-shrink: 0;
}

.route-path {
  font-family: var(--font-mono);
  color: var(--fg-primary);
}

/* Data Table */
.data-table {
  width: 100%;
  font-size: 12px;
}

.data-table table {
  width: 100%;
  border-collapse: collapse;
}

.data-table th,
.data-table td {
  padding: 10px 12px;
  text-align: left;
  border-bottom: 1px solid var(--line);
}

.data-table th {
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.data-table tr:hover td {
  background: var(--bg-elevated);
}

.edges-table { display: grid; gap: 0; }
.edges-table > .row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  align-items: center;
}
.edges-table > .row.header {
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 11px;
  text-transform: uppercase;
}

.report-table { display: grid; gap: 0; }
.report-table > .row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr 1fr;
  gap: 8px;
  padding: 10px 12px;
  border-bottom: 1px solid var(--line);
  align-items: center;
  cursor: pointer;
}
.report-table > .row.header {
  font-weight: 600;
  color: var(--fg-muted);
  font-size: 11px;
  text-transform: uppercase;
  cursor: default;
}
.report-table > .row:not(.header):hover { background: var(--bg-elevated); }

/* Node List (sidebar) */
.noc-node-list {
  max-height: calc(100vh - 200px);
  overflow-y: auto;
}

.node-list-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 12px 16px;
  cursor: pointer;
  border-bottom: 1px solid var(--line);
  transition: background 0.1s;
}

.node-list-item:hover {
  background: var(--bg-elevated);
}

.node-list-item.active {
  background: var(--bg-elevated);
}

.node-list-item__left {
  display: flex;
  align-items: center;
  gap: 10px;
}

.node-list-item__name {
  font-family: var(--font-mono);
  font-size: 13px;
  color: var(--fg-primary);
}

.node-list-item__role {
  font-size: 11px;
  color: var(--fg-muted);
}

/* Node Detail Panels */
.noc-node-detail {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.kv-grid {
  display: grid;
  grid-template-columns: 140px 1fr;
  gap: 8px 16px;
  padding: 16px;
  font-size: 13px;
}

.kv-grid .kv-key {
  color: var(--fg-muted);
}

.kv-grid .kv-value {
  color: var(--fg-primary);
  font-family: var(--font-mono);
}

.kv-value.masked {
  color: var(--fg-muted);
  cursor: pointer;
  user-select: none;
}

.kv-value.masked:hover {
  color: var(--accent);
}

.check-list {
  padding: 8px 16px;
}

.check-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid var(--line);
}

.check-item:last-child { border-bottom: none; }

.check-item__name {
  font-size: 13px;
  color: var(--fg-primary);
}

.check-item__detail {
  font-size: 12px;
  color: var(--fg-muted);
  margin-left: 8px;
}

.history-list {
  padding: 8px 16px;
  max-height: 300px;
  overflow-y: auto;
}

.history-item {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid var(--line);
  font-size: 12px;
}

.history-item:last-child { border-bottom: none; }

.history-item__time {
  font-family: var(--font-mono);
  color: var(--fg-muted);
  font-size: 11px;
}

.history-item__event {
  color: var(--fg-secondary);
}

/* Stat Cards (System tab) */
.stat-card {
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  overflow: hidden;
}

.stat-card__title {
  padding: 12px 16px;
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--fg-muted);
  border-bottom: 1px solid var(--line);
}

.stat-card__body {
  padding: 16px;
}

.stat-value {
  font-family: var(--font-mono);
  font-size: 28px;
  font-weight: 700;
  color: var(--fg-primary);
  margin-bottom: 4px;
}

.stat-label {
  font-size: 12px;
  color: var(--fg-muted);
}

.stat-row-flex {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 0;
  border-bottom: 1px dashed var(--line);
}

.stat-row-flex:last-child { border-bottom: none; }

.progress-bar {
  height: 4px;
  background: var(--line);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 8px;
}

.progress-bar__fill {
  height: 100%;
  border-radius: 2px;
  transition: width 0.3s;
}

.progress-bar__fill.ok  { background: var(--ok); }
.progress-bar__fill.warn{ background: var(--warn); }
.progress-bar__fill.fail{ background: var(--fail); }

/* Form Elements */
.input {
  padding: 10px 12px;
  border-radius: 6px;
  border: 1px solid var(--line);
  background: var(--bg-inset);
  color: var(--fg-primary);
  font-family: var(--font-sans);
  font-size: 13px;
  outline: none;
  transition: border-color 0.15s;
}

.input:focus { border-color: var(--accent); }

.btn {
  padding: 10px 16px;
  border-radius: 6px;
  border: 1px solid var(--accent);
  background: rgba(66,165,245,0.15);
  color: var(--fg-primary);
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.15s, border-color 0.15s;
}

.btn:hover {
  background: rgba(66,165,245,0.25);
}

.btn--ghost {
  border-color: var(--line);
  background: transparent;
  color: var(--fg-secondary);
}

.btn--ghost:hover {
  background: var(--bg-elevated);
  color: var(--fg-primary);
}

.btn.small {
  padding: 6px 12px;
  font-size: 12px;
}

/* Reports Tab */
.noc-reports-left {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.probes-scroll-container {
  max-height: 480px; /* Approx 15 lines */
  overflow-y: auto;
}

.noc-report-detail {
  min-height: 400px;
}

.upload-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px;
}

.upload-row input[type="file"] {
  flex: 1;
  color: var(--fg-secondary);
}

.hint {
  padding: 0 16px 16px 16px;
  font-size: 12px;
  color: var(--fg-muted);
}

.pre {
  margin: 0;
  padding: 16px;
  font-family: var(--font-mono);
  font-size: 12px;
  line-height: 1.5;
  color: var(--fg-primary);
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--bg-inset);
  border-radius: 6px;
  max-height: 400px;
  overflow-y: auto;
}

.spoiler {
  margin: 16px;
}

.spoiler summary {
  cursor: pointer;
  color: var(--accent);
  font-size: 12px;
  user-select: none;
}

.spoiler summary:hover {
  text-decoration: underline;
}

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

.modal-content {
  width: 100%;
  max-width: 420px;
  background: var(--bg-surface);
  border: 1px solid var(--line);
  border-radius: 8px;
  padding: 24px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
}

.modal-content h2 {
  margin: 0 0 20px 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--fg-primary);
}

.modal-content label {
  display: block;
  font-size: 12px;
  color: var(--fg-secondary);
  margin: 16px 0 6px 0;
}

.modal-content .input {
  width: 100%;
}

.modal-actions {
  display: flex;
  gap: 12px;
  justify-content: flex-end;
  margin-top: 24px;
}

/* View Toggles */
.noc-view { display: block; }
.noc-view.hidden { display: none; }

/* Empty state */
.empty-state {
  padding: 40px;
  text-align: center;
  color: var(--fg-muted);
}

.empty-state .dot {
  margin-bottom: 12px;
}

/* Legacy compatibility - ensure old class names still work during transition */
.view.hidden { display: none; }
