/* ═══════════════════════════════════════════════════════════
   Tuurio Auth Studio — Dark Developer Console
   Version 1.0.0 (2025-07-15) — Tuurio GmbH, Berlin
   https://id.tuurio.com
   ═══════════════════════════════════════════════════════════ */

@import url("https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&family=JetBrains+Mono:wght@400;500&family=Outfit:wght@500;600;700;800&display=swap");

/* ── Design tokens ─────────────────────────────────────── */

:root {
  color-scheme: dark;

  /* Surfaces */
  --bg: #080d19;
  --bg-card: rgba(255, 255, 255, 0.025);
  --bg-card-hover: rgba(255, 255, 255, 0.04);
  --bg-raised: rgba(255, 255, 255, 0.055);
  --bg-inset: rgba(0, 0, 0, 0.25);
  --bg-code: #060a14;

  /* Borders */
  --border: rgba(255, 255, 255, 0.07);
  --border-hover: rgba(255, 255, 255, 0.13);
  --border-accent: rgba(6, 182, 212, 0.25);

  /* Text */
  --text: #f1f5f9;
  --text-secondary: #cbd5e1;
  --text-muted: #64748b;
  --text-dim: #475569;

  /* Accent — Tuurio teal */
  --accent: #22d3ee;
  --accent-strong: #06b6d4;
  --accent-dim: rgba(6, 182, 212, 0.12);
  --accent-glow: rgba(6, 182, 212, 0.06);

  /* Semantic */
  --success: #34d399;
  --success-dim: rgba(52, 211, 153, 0.12);
  --warning: #fbbf24;
  --warning-dim: rgba(251, 191, 36, 0.12);
  --error: #f87171;
  --error-dim: rgba(248, 113, 113, 0.12);

  /* Depth */
  --shadow: 0 1px 2px rgba(0, 0, 0, 0.3), 0 8px 24px rgba(0, 0, 0, 0.25);
  --shadow-lg: 0 4px 12px rgba(0, 0, 0, 0.3), 0 24px 64px rgba(0, 0, 0, 0.35);
  --glow: 0 0 60px var(--accent-glow);

  /* Shape */
  --radius: 12px;
  --radius-sm: 8px;
  --radius-lg: 16px;

  /* Typography */
  font-family: "DM Sans", system-ui, -apple-system, sans-serif;
  line-height: 1.6;
  font-weight: 400;
  color: var(--text);
  background: var(--bg);

  font-synthesis: none;
  text-rendering: optimizeLegibility;
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}

/* ── Reset ─────────────────────────────────────────────── */

*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  background: var(--bg);
}

/* Ambient light effect */
body::before {
  content: "";
  position: fixed;
  inset: 0;
  background:
    radial-gradient(ellipse 50% 60% at 15% 45%, rgba(6, 182, 212, 0.06) 0%, transparent 100%),
    radial-gradient(ellipse 40% 50% at 85% 15%, rgba(124, 58, 237, 0.035) 0%, transparent 100%);
  pointer-events: none;
  z-index: 0;
}

#app {
  min-height: 100vh;
  position: relative;
  z-index: 1;
}

a {
  color: inherit;
  text-decoration: none;
}

button {
  font-family: inherit;
}

/* ── Layout ────────────────────────────────────────────── */

.app {
  min-height: 100vh;
  display: grid;
  grid-template-columns: 340px minmax(0, 1fr);
  gap: 40px;
  padding: 40px;
  max-width: 1280px;
  margin: 0 auto;
}

.side-panel {
  position: sticky;
  top: 40px;
  align-self: start;
  display: flex;
  flex-direction: column;
  gap: 28px;
  max-height: calc(100vh - 80px);
  overflow-y: auto;
  scrollbar-width: none;
}

.side-panel::-webkit-scrollbar {
  display: none;
}

.main-panel {
  display: flex;
  flex-direction: column;
  gap: 24px;
  min-width: 0;
}

.stack {
  display: grid;
  gap: 16px;
}

/* ── Brand ─────────────────────────────────────────────── */

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

.logo-mark {
  width: 38px;
  height: 38px;
  display: grid;
  place-items: center;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--accent-strong), #f59e0b);
  color: white;
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  flex-shrink: 0;
}

.brand-name {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 0.95rem;
  margin: 0;
  color: var(--text);
}

.brand-subtitle {
  margin: 1px 0 0;
  color: var(--text-muted);
  font-size: 0.78rem;
}

/* ── Side card (hero) ──────────────────────────────────── */

.side-card {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border-accent);
  border-radius: var(--radius-lg);
  padding: 28px;
  box-shadow: var(--glow), var(--shadow);
}

.side-card h1 {
  font-family: "Outfit", sans-serif;
  font-weight: 800;
  font-size: 1.85rem;
  line-height: 1.15;
  margin: 0 0 14px;
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, var(--text) 30%, var(--accent));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.side-card > .muted {
  font-size: 0.85rem;
  line-height: 1.55;
}

/* ── Side list (meta) ──────────────────────────────────── */

.side-list {
  display: flex;
  flex-direction: column;
  gap: 2px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.side-list-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  transition: background 0.15s ease;
}

.side-list-item:hover {
  background: var(--bg-card-hover);
}

.side-list-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border-radius: var(--radius-sm);
  background: var(--accent-dim);
  color: var(--accent);
  flex-shrink: 0;
}

.side-list-icon svg {
  width: 16px;
  height: 16px;
}

.side-list-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.side-list-value {
  display: block;
  font-size: 0.85rem;
  font-weight: 500;
  color: var(--text-secondary);
  margin-top: 1px;
}

/* Legacy side-list (kept for backward compat) */
.side-list > div:not(.side-list-item) {
  padding: 10px 16px;
}

.side-list > div:not(.side-list-item) .eyebrow {
  font-size: 0.7rem;
  display: block;
  margin-bottom: 2px;
}

.side-list p {
  margin: 2px 0 0;
  font-weight: 500;
  font-size: 0.85rem;
  color: var(--text-secondary);
}

/* ── Cards ─────────────────────────────────────────────── */

.card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 24px;
  box-shadow: var(--shadow);
  animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

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

.card-hero {
  border-color: var(--border-accent);
  box-shadow: var(--glow), var(--shadow);
}

.card-hero:hover {
  border-color: rgba(6, 182, 212, 0.35);
}

/* removed: .card-soft and .card-panel are no longer distinct in dark theme */

.card-title {
  font-family: "Outfit", sans-serif;
  font-weight: 700;
  font-size: 1.4rem;
  margin: 0 0 6px;
  letter-spacing: -0.01em;
  color: var(--text);
}

.card-header {
  display: grid;
  gap: 6px;
  margin-bottom: 20px;
}

/* ── Section headers (icon + title) ────────────────────── */

.section-header {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  margin-bottom: 18px;
}

.section-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  flex-shrink: 0;
  margin-top: 1px;
}

.section-icon svg {
  width: 18px;
  height: 18px;
}

.section-title {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 1rem;
  margin: 0;
  color: var(--text);
}

.section-header .muted {
  font-size: 0.82rem;
  margin-top: 2px;
}

/* ── Typography helpers ────────────────────────────────── */

.eyebrow {
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--accent);
}

.muted {
  color: var(--text-muted);
  margin: 0;
  font-size: 0.875rem;
}

.helper {
  font-size: 0.8rem;
  color: var(--text-dim);
}

.link {
  color: var(--accent);
  text-decoration: underline;
  text-decoration-color: rgba(6, 182, 212, 0.3);
  text-underline-offset: 2px;
  transition: text-decoration-color 0.15s ease;
  word-break: break-all;
}

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

/* ── Badges ────────────────────────────────────────────── */

.badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}

.badge svg {
  width: 14px;
  height: 14px;
}

.badge-success {
  background: var(--success-dim);
  color: var(--success);
  border: 1px solid rgba(52, 211, 153, 0.2);
}

.badge-neutral {
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-muted);
  border: 1px solid var(--border);
}

.badge-error {
  background: var(--error-dim);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

/* ── Status indicators (sidebar) ───────────────────────── */

.status-row {
  margin-top: 18px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.status-row .muted {
  font-size: 0.8rem;
  font-family: "JetBrains Mono", monospace;
  color: var(--text-dim);
}

.status {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--border);
}

.status::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--text-dim);
  flex-shrink: 0;
}

.status-good {
  background: var(--success-dim);
  color: var(--success);
  border-color: rgba(52, 211, 153, 0.2);
}

.status-good::before {
  background: var(--success);
  box-shadow: 0 0 8px var(--success);
  animation: pulse 2s ease-in-out infinite;
}

.status-neutral {
  color: var(--text-muted);
}

.status-neutral::before {
  background: var(--text-dim);
}

.status-bad {
  background: var(--error-dim);
  color: var(--error);
  border-color: rgba(248, 113, 113, 0.2);
}

.status-bad::before {
  background: var(--error);
}

/* ── Buttons ───────────────────────────────────────────── */

.button-row {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 8px;
}

.button-row .button.primary {
  width: 100%;
}

.button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  border: 1px solid var(--border);
  background: var(--bg-raised);
  border-radius: var(--radius-sm);
  padding: 10px 20px;
  font-family: inherit;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--text-secondary);
  cursor: pointer;
  transition:
    background 0.15s ease,
    border-color 0.15s ease,
    color 0.15s ease,
    box-shadow 0.2s ease,
    transform 0.15s ease;
  text-decoration: none;
}

.button:hover {
  border-color: var(--border-hover);
  color: var(--text);
  transform: translateY(-1px);
}

.button:active {
  transform: translateY(0);
}

.button:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

.button.primary {
  background: var(--accent-strong);
  color: #fff;
  border-color: transparent;
  font-weight: 600;
}

.button.primary:hover {
  background: var(--accent);
  box-shadow: 0 0 24px rgba(6, 182, 212, 0.25);
}

.button.ghost {
  background: transparent;
}

.button.ghost:hover {
  background: var(--bg-card-hover);
  border-color: var(--border-hover);
}

.button.small {
  padding: 6px 12px;
  font-size: 0.78rem;
}

.btn-arrow {
  font-size: 1.1em;
  transition: transform 0.15s ease;
}

.button:hover .btn-arrow {
  transform: translateX(2px);
}

/* ── Alert ─────────────────────────────────────────────── */

.alert {
  padding: 10px 14px;
  border-radius: var(--radius-sm);
  font-size: 0.85rem;
  font-weight: 500;
  margin-top: 8px;
}

.alert-error {
  background: var(--error-dim);
  color: var(--error);
  border: 1px solid rgba(248, 113, 113, 0.2);
}

.alert-block {
  line-height: 1.6;
}

.alert-block strong {
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.alert-block code {
  background: rgba(255, 255, 255, 0.04);
  padding: 1px 6px;
  border-radius: 4px;
}

.alert-warning {
  background: rgba(251, 191, 36, 0.08);
  color: #fbbf24;
  border: 1px solid rgba(251, 191, 36, 0.2);
}

/* ── Feature grid ──────────────────────────────────────── */

.feature-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
}

.feature-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 20px;
  transition: border-color 0.2s ease, background 0.2s ease;
  animation: rise 0.5s cubic-bezier(0.16, 1, 0.3, 1) both;
}

.feature-card:nth-child(1) { animation-delay: 0.08s; }
.feature-card:nth-child(2) { animation-delay: 0.14s; }
.feature-card:nth-child(3) { animation-delay: 0.20s; }

.feature-card:hover {
  border-color: var(--border-hover);
  background: var(--bg-card-hover);
}

.feature-card .feature-icon {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: var(--accent-dim);
  color: var(--accent);
  margin-bottom: 14px;
}

.feature-card .feature-icon svg {
  width: 18px;
  height: 18px;
}

.feature-card h3 {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  font-size: 0.9rem;
  margin: 0 0 6px;
  color: var(--text);
}

.feature-card .muted {
  font-size: 0.8rem;
  line-height: 1.5;
}

/* Legacy .feature inside .feature-grid (backward compat) */
.feature h3 {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  margin: 0 0 6px;
  font-size: 0.9rem;
  color: var(--text);
}

/* ── Token panels ──────────────────────────────────────── */

.panel-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-start;
}

.panel-title {
  font-family: "Outfit", sans-serif;
  font-weight: 600;
  margin: 0 0 4px;
  font-size: 1rem;
  color: var(--text);
}

/* ── Token details (collapsible raw JWT) ───────────────── */

.token-details {
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
  margin-top: 6px;
}

.token-details[open] {
  border-color: var(--border-accent);
}

.token-summary {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 14px;
  cursor: pointer;
  background: var(--bg-raised);
  user-select: none;
  list-style: none;
  transition: background 0.15s ease;
}

.token-summary::-webkit-details-marker {
  display: none;
}

.token-summary::before {
  content: "";
  width: 0;
  height: 0;
  border-left: 5px solid var(--text-dim);
  border-top: 4px solid transparent;
  border-bottom: 4px solid transparent;
  flex-shrink: 0;
  transition: transform 0.2s ease;
}

.token-details[open] > .token-summary::before {
  transform: rotate(90deg);
}

.token-summary:hover {
  background: var(--bg-card-hover);
}

.token-preview {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.72rem;
  color: var(--text-dim);
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  min-width: 0;
}

.token-details .token-block {
  margin: 0;
  border-radius: 0;
  border-top: 1px solid var(--border);
}

.token-claims {
  display: grid;
  gap: 8px;
  margin-top: 14px;
}

/* ── Code blocks ───────────────────────────────────────── */

.token-block {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.75rem;
  background: var(--bg-code);
  color: var(--text-muted);
  padding: 16px;
  border-radius: var(--radius);
  margin: 10px 0;
  overflow-x: auto;
  max-height: 200px;
  max-width: 100%;
  word-break: break-all;
  white-space: pre-wrap;
  line-height: 1.6;
}

.code-block {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.78rem;
  background: var(--bg-code);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin: 0;
  overflow-x: auto;
  color: var(--text-secondary);
  line-height: 1.7;
}

/* ── JSON syntax highlighting ──────────────────────────── */

.hl-key { color: #93c5fd; }
.hl-str { color: #86efac; }
.hl-num { color: #fde68a; }
.hl-bool { color: #c4b5fd; }

/* ── Copy to clipboard ─────────────────────────────────── */

.copy-wrap {
  position: relative;
  min-width: 0;
}

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  padding: 4px 10px;
  font-family: "DM Sans", sans-serif;
  font-size: 0.68rem;
  font-weight: 600;
  letter-spacing: 0.04em;
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.06);
  color: var(--text-dim);
  cursor: pointer;
  transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
  z-index: 1;
}

.copy-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-secondary);
  border-color: rgba(255, 255, 255, 0.15);
}

.copy-btn.copied {
  background: var(--accent-dim);
  color: var(--accent);
  border-color: var(--border-accent);
}

/* ── Cleared state (logout) ────────────────────────────── */

.cleared-grid {
  display: grid;
  gap: 14px;
}

.cleared-item {
  display: grid;
  gap: 4px;
}

.cleared-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  letter-spacing: 0.02em;
}

.cleared-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.82rem;
  color: var(--text-secondary);
}

.cleared-empty {
  color: var(--accent);
  font-style: italic;
}

/* ── Discovery / endpoints ─────────────────────────────── */

.endpoint-grid {
  display: grid;
  gap: 0;
  border: 1px solid var(--border);
  border-radius: var(--radius);
  overflow: hidden;
}

.endpoint-item {
  display: flex;
  align-items: baseline;
  gap: 12px;
  padding: 10px 16px;
  border-bottom: 1px solid var(--border);
  transition: background 0.1s ease;
}

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

.endpoint-item:hover {
  background: var(--bg-card-hover);
}

.endpoint-label {
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text-dim);
  min-width: 110px;
  flex-shrink: 0;
}

.endpoint-value {
  font-family: "JetBrains Mono", monospace;
  font-size: 0.73rem;
  color: var(--text-muted);
  word-break: break-all;
}

/* ── Loading / spinner ─────────────────────────────────── */

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

.spinner {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: 2px solid var(--border);
  border-top-color: var(--accent);
  animation: spin 0.8s linear infinite;
}

/* ── Staggered entrance ────────────────────────────────── */

.stack > :nth-child(1) { animation-delay: 0s; }
.stack > :nth-child(2) { animation-delay: 0.06s; }
.stack > :nth-child(3) { animation-delay: 0.12s; }
.stack > :nth-child(4) { animation-delay: 0.18s; }
.stack > :nth-child(5) { animation-delay: 0.24s; }

/* ── Animations ────────────────────────────────────────── */

@keyframes rise {
  from {
    opacity: 0;
    transform: translateY(12px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

/* ── Responsive ────────────────────────────────────────── */

@media (max-width: 1024px) {
  .app {
    grid-template-columns: 1fr;
    padding: 24px;
    gap: 32px;
  }

  .side-panel {
    position: static;
    max-height: none;
  }

  .feature-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 768px) {
  .app {
    padding: 20px 16px;
    gap: 24px;
  }

  .feature-grid {
    grid-template-columns: 1fr;
  }

  .panel-header {
    flex-direction: column;
    align-items: flex-start;
  }

  .button-row {
    align-items: stretch;
  }

  .button {
    text-align: center;
  }

  .endpoint-item {
    flex-direction: column;
    gap: 4px;
  }

  .endpoint-label {
    min-width: auto;
  }

  .card {
    padding: 20px;
  }
}

@media (max-width: 480px) {
  .app {
    padding: 16px 12px;
  }

  .side-card h1 {
    font-size: 1.5rem;
  }

  .card-title {
    font-size: 1.2rem;
  }
}
