/* VISU Cloud — Developer Portal
   Refined "developer console" surface on the existing navy design system.
   Distinctive cues: a sliding accent tab indicator, Lexend-Mega stat numerals,
   monospace for every technical detail, a terminal-style API explorer, and
   staggered panel reveals. Light-theme aware via the shared tokens. */

.dev-portal {
  max-width: 1040px;
  margin: 0 auto;
  padding: var(--space-8) var(--space-6) var(--space-16);
}

.dev-head {
  display: flex;
  align-items: flex-end;
  justify-content: space-between;
  gap: var(--space-4);
  flex-wrap: wrap;
  margin-bottom: var(--space-5);
}
.dev-head h2 {
  font-family: var(--font-heading);
  font-size: var(--text-2xl);
  letter-spacing: -0.02em;
  margin: 0;
}
.dev-head p {
  color: var(--color-text-dim);
  font-size: var(--text-sm);
  margin: 4px 0 0;
}

/* ── Tab bar ─────────────────────────────────────────────────────────── */
.dev-tabs {
  display: flex;
  gap: 2px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: var(--space-6);
  overflow-x: auto;
  scrollbar-width: none;
}
.dev-tabs::-webkit-scrollbar { display: none; }
.dev-tab {
  position: relative;
  background: none;
  border: none;
  color: var(--color-text-muted);
  font-family: var(--font-body);
  font-size: var(--text-sm);
  font-weight: 500;
  padding: 12px 16px;
  cursor: pointer;
  white-space: nowrap;
  transition: color var(--transition-fast);
}
.dev-tab::after {
  content: "";
  position: absolute;
  left: 50%; right: 50%; bottom: -1px;
  height: 2px;
  background: var(--color-accent);
  border-radius: 2px 2px 0 0;
  transition: left var(--transition-normal), right var(--transition-normal);
}
.dev-tab:hover { color: var(--color-text); }
.dev-tab.active { color: var(--color-text); }
.dev-tab.active::after { left: 12px; right: 12px; }

/* ── Panels (staggered reveal) ───────────────────────────────────────── */
.dev-panel { animation: dev-fade 320ms ease both; }
.dev-panel > * { animation: dev-rise 360ms ease both; }
.dev-panel > *:nth-child(2) { animation-delay: 50ms; }
.dev-panel > *:nth-child(3) { animation-delay: 100ms; }
.dev-panel > *:nth-child(4) { animation-delay: 150ms; }
@keyframes dev-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes dev-rise { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }

/* ── Section card ────────────────────────────────────────────────────── */
.dev-section {
  background: var(--color-surface);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-lg);
  padding: var(--space-5) var(--space-6);
  margin-bottom: var(--space-5);
  box-shadow: var(--shadow-sm);
}
.dev-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: var(--space-3);
  margin-bottom: var(--space-4);
}
.dev-section-head h3 {
  font-size: var(--text-lg);
  font-weight: 600;
  margin: 0;
}
.dev-section-sub {
  color: var(--color-text-dim);
  font-size: var(--text-sm);
  margin: -6px 0 var(--space-4);
}

/* ── Stat tiles ──────────────────────────────────────────────────────── */
.dev-stat-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: var(--space-4);
  margin-bottom: var(--space-5);
}
.dev-stat {
  position: relative;
  background: linear-gradient(160deg, var(--color-surface-light), var(--color-surface));
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: var(--space-4) var(--space-5);
  overflow: hidden;
}
.dev-stat::before {
  content: "";
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 3px;
  background: var(--color-accent);
  opacity: 0.85;
}
.dev-stat-label {
  font-size: var(--text-xs);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--color-text-muted);
}
.dev-stat-value {
  font-family: var(--font-heading);
  font-size: var(--text-3xl);
  line-height: 1.1;
  margin-top: 6px;
  letter-spacing: -0.02em;
}
.dev-stat-foot { font-size: var(--text-xs); color: var(--color-text-dim); margin-top: 4px; }

/* ── Credential rows ─────────────────────────────────────────────────── */
.dev-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: var(--space-4);
  padding: var(--space-4) 0;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}
.dev-row:first-of-type { border-top: none; }
.dev-row.is-revoked { opacity: 0.5; }
.dev-row-main { min-width: 0; flex: 1; }
.dev-row-name {
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.dev-mono {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  color: var(--color-text-dim);
  word-break: break-all;
}
.dev-row-meta { font-size: var(--text-xs); color: var(--color-text-dim); margin-top: 5px; }
.dev-row-actions { display: flex; gap: 6px; flex-shrink: 0; flex-wrap: wrap; justify-content: flex-end; }

/* ── Scope chips ─────────────────────────────────────────────────────── */
.dev-chips { display: flex; flex-wrap: wrap; gap: 4px; margin-top: 6px; }
.dev-chip {
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  background: rgba(59, 130, 246, 0.12);
  color: var(--color-accent);
  border: 1px solid rgba(59, 130, 246, 0.22);
  padding: 1px 8px;
  border-radius: var(--radius-full);
}
.dev-chip.is-write { background: rgba(245, 158, 11, 0.12); color: var(--color-warning); border-color: rgba(245, 158, 11, 0.25); }

/* status pill */
.dev-pill {
  font-size: var(--text-xs);
  font-weight: 600;
  padding: 1px 9px;
  border-radius: var(--radius-full);
}
.dev-pill.ok { background: rgba(16, 185, 129, 0.15); color: var(--color-success); }
.dev-pill.warn { background: rgba(245, 158, 11, 0.15); color: var(--color-warning); }
.dev-pill.bad { background: rgba(239, 68, 68, 0.15); color: var(--color-danger); }

/* ── Quota bar ───────────────────────────────────────────────────────── */
.dev-quota { margin-top: 8px; max-width: 320px; }
.dev-quota-track {
  height: 6px;
  border-radius: var(--radius-full);
  background: rgba(255, 255, 255, 0.08);
  overflow: hidden;
}
.dev-quota-fill {
  height: 100%;
  border-radius: var(--radius-full);
  background: var(--color-accent);
  transition: width 600ms cubic-bezier(0.2, 0.8, 0.2, 1);
}
.dev-quota-fill.warn { background: var(--color-warning); }
.dev-quota-fill.bad { background: var(--color-danger); }
.dev-quota-cap { font-size: var(--text-xs); color: var(--color-text-dim); margin-top: 4px; }

/* ── Code blocks ─────────────────────────────────────────────────────── */
.dev-code {
  position: relative;
  background: var(--color-bg);
  border: 1px solid rgba(255, 255, 255, 0.07);
  border-radius: var(--radius-md);
  padding: 12px 14px;
  overflow: auto;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.5;
  margin-top: 6px;
}
.dev-code-head { display: flex; align-items: center; justify-content: space-between; margin-top: var(--space-4); }
.dev-code-head strong { font-size: var(--text-sm); }

/* ── Scope reference table ───────────────────────────────────────────── */
.dev-scope-table { width: 100%; border-collapse: collapse; }
.dev-scope-table td { padding: 7px 0; vertical-align: top; border-top: 1px solid rgba(255, 255, 255, 0.05); }
.dev-scope-table tr:first-child td { border-top: none; }
.dev-scope-table td:first-child { width: 200px; padding-right: var(--space-4); }

/* ── API Explorer console ────────────────────────────────────────────── */
.dev-console {
  background: var(--color-bg);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: var(--radius-md);
  overflow: hidden;
}
.dev-console-bar {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(255, 255, 255, 0.03);
  border-bottom: 1px solid rgba(255, 255, 255, 0.07);
  font-family: var(--font-mono);
  font-size: var(--text-xs);
}
.dev-method-tag {
  font-family: var(--font-mono);
  font-weight: 700;
  font-size: var(--text-xs);
  color: var(--color-success);
  background: rgba(16, 185, 129, 0.12);
  border-radius: var(--radius-sm);
  padding: 2px 8px;
}
.dev-console-body { padding: 14px; }
.dev-console-resp {
  background: #05080f;
  border-radius: var(--radius-md);
  padding: 12px 14px;
  margin-top: 12px;
  font-family: var(--font-mono);
  font-size: var(--text-xs);
  line-height: 1.5;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--color-text-dim);
}
.dev-resp-status { display: flex; align-items: center; gap: 10px; margin-bottom: 8px; flex-wrap: wrap; }
.dev-resp-headers { color: var(--color-text-muted); font-size: var(--text-xs); }

/* ── Filter toggle ───────────────────────────────────────────────────── */
.dev-filter { display: inline-flex; gap: 4px; background: var(--color-bg); border-radius: var(--radius-full); padding: 3px; }
.dev-filter button {
  border: none; background: none; color: var(--color-text-muted);
  font-size: var(--text-xs); font-weight: 500; padding: 4px 12px;
  border-radius: var(--radius-full); cursor: pointer; transition: all var(--transition-fast);
}
.dev-filter button.active { background: var(--color-accent); color: #fff; }

/* ── Empty state ─────────────────────────────────────────────────────── */
.dev-empty { text-align: center; padding: var(--space-8) var(--space-4); color: var(--color-text-dim); }
.dev-empty svg { opacity: 0.4; margin-bottom: var(--space-3); }
.dev-empty p { font-size: var(--text-sm); margin: 0 0 var(--space-4); }

/* ── Forms inside modals ─────────────────────────────────────────────── */
.dev-scope-pick {
  max-height: 240px; overflow: auto;
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: var(--radius-md);
  padding: 8px 12px;
}
.dev-scope-pick label { display: flex; gap: 8px; align-items: flex-start; padding: 5px 0; cursor: pointer; }

/* ── Responsive ──────────────────────────────────────────────────────── */
@media (max-width: 640px) {
  .dev-portal { padding: var(--space-5) var(--space-4) var(--space-12); }
  .dev-row { flex-direction: column; }
  .dev-row-actions { justify-content: flex-start; }
  .dev-stat-value { font-size: var(--text-2xl); }
}

/* Light theme: lift the console/code surfaces off pure dark */
[data-theme="light"] .dev-code,
[data-theme="light"] .dev-console,
[data-theme="light"] .dev-filter { background: var(--color-surface-light); }
[data-theme="light"] .dev-console-resp { background: #0d1b3e; color: #cdd7e6; }
