/*
  Created by ShibZ — AF lab console.
  Dark theme inspired by jwt.io (charcoal surfaces, Auth0-style coral accent, monospace code blocks).
*/

:root {
  --bg: #0d0d12;
  --surface: #16161f;
  --surface-elevated: #1f1f2a;
  --border: #34343f;
  --text: #f4f4f7;
  --text-muted: #9b9ba8;
  --accent: #eb5424;
  --accent-hover: #ff6a3d;
  --success: #00d4aa;
  --warning: #f5a524;
  --danger: #ff5f6e;
  --input-bg: #0f0f16;
  --mono: "JetBrains Mono", "Fira Code", "Consolas", monospace;
  --sans: "DM Sans", system-ui, -apple-system, "Segoe UI", sans-serif;
  --radius: 10px;
  --shadow: 0 8px 32px rgba(0, 0, 0, 0.45);
}

*,
*::before,
*::after {
  box-sizing: border-box;
}

html {
  font-size: 15px;
  scroll-behavior: smooth;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: var(--sans);
  background: var(--bg);
  background-image: radial-gradient(
      ellipse 100% 60% at 50% -25%,
      rgba(235, 84, 36, 0.08) 0%,
      transparent 55%
    ),
    radial-gradient(ellipse 70% 50% at 100% 100%, rgba(99, 102, 241, 0.06) 0%, transparent 45%);
  color: var(--text);
  line-height: 1.55;
  display: flex;
  flex-direction: column;
}

a {
  color: var(--accent);
  text-decoration: none;
}

a:hover {
  color: var(--accent-hover);
  text-decoration: underline;
}

.site-header {
  border-bottom: 1px solid var(--border);
  background: rgba(22, 22, 31, 0.92);
  backdrop-filter: blur(12px);
  position: sticky;
  top: 0;
  z-index: 10;
}

.site-header__inner {
  max-width: 1400px;
  margin: 0 auto;
  padding: 1rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: baseline;
  justify-content: space-between;
  gap: 0.75rem;
}

.site-header__top {
  display: flex;
  align-items: flex-start;
  gap: 0.85rem;
  flex-wrap: wrap;
  width: 100%;
}

.site-header__logo-link {
  flex-shrink: 0;
  line-height: 0;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  padding: 4px;
}

.site-header__logo-link:hover {
  border-color: var(--accent);
}

.site-header__logo {
  width: 44px;
  height: 44px;
  object-fit: contain;
  display: block;
  filter: brightness(1.85) contrast(1.05) saturate(0.9);
}

.site-header__title-block {
  flex: 1;
  min-width: min(100%, 280px);
}

.site-header h1 {
  margin: 0;
  font-size: 1.35rem;
  font-weight: 600;
  letter-spacing: -0.02em;
  color: var(--text);
}

.site-header__meta {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.site-header__meta--row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem 0.85rem;
  margin-top: 0.35rem;
}

.site-header__meta-label {
  margin-right: 0.25rem;
}

.header-nef-label {
  font-size: 0.72rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin: 0;
}

.header-nef-select {
  width: auto;
  min-width: 14rem;
  max-width: min(22rem, 100%);
  font-family: var(--mono);
  font-size: 0.78rem;
  padding: 0.35rem 0.55rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  margin: 0;
}

.header-nef-select:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

.layout {
  flex: 1;
  max-width: 1400px;
  margin: 0 auto;
  padding: 1.5rem;
  width: 100%;
  display: grid;
  grid-template-columns: minmax(320px, 420px) 1fr;
  gap: 1.5rem;
  align-items: start;
}

@media (max-width: 1024px) {
  .layout {
    grid-template-columns: 1fr;
  }
}

.header-alt-link {
  font-size: 0.78rem;
  font-weight: 600;
  margin-left: 0.25rem;
  white-space: nowrap;
}

.panel {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  overflow: hidden;
}

.panel__head {
  padding: 0.85rem 1.1rem;
  background: var(--surface-elevated);
  border-bottom: 1px solid var(--border);
  font-weight: 600;
  font-size: 0.9rem;
  letter-spacing: 0.02em;
  text-transform: uppercase;
  color: var(--text-muted);
}

.panel__body {
  padding: 1.1rem;
}

label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: var(--text-muted);
  margin-bottom: 0.35rem;
}

select,
input[type="text"],
textarea {
  width: 100%;
  font-family: inherit;
  font-size: 0.95rem;
  padding: 0.55rem 0.75rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  background: var(--input-bg);
  color: var(--text);
  margin-bottom: 0.9rem;
}

select:focus,
input:focus,
textarea:focus {
  outline: 2px solid var(--accent);
  outline-offset: 1px;
}

textarea {
  font-family: var(--mono);
  font-size: 0.82rem;
  line-height: 1.45;
  min-height: 220px;
  resize: vertical;
}

.btn-row {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  margin-top: 0.25rem;
}

button.primary {
  font-family: inherit;
  font-weight: 600;
  font-size: 0.9rem;
  padding: 0.6rem 1.25rem;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  background: linear-gradient(135deg, var(--accent) 0%, #c73d15 100%);
  color: #fff;
  box-shadow: 0 2px 16px rgba(235, 84, 36, 0.35);
}

button.primary:hover:not(:disabled) {
  filter: brightness(1.08);
}

button.primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

button.ghost {
  font-family: inherit;
  font-size: 0.85rem;
  padding: 0.55rem 0.9rem;
  border-radius: 6px;
  cursor: pointer;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--border);
}

button.ghost:hover {
  border-color: var(--accent);
  color: var(--accent);
}

.badge {
  display: inline-block;
  font-size: 0.68rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  padding: 0.2rem 0.45rem;
  border-radius: 4px;
  vertical-align: middle;
  margin-left: 0.35rem;
}

.badge--simp {
  background: rgba(245, 165, 36, 0.18);
  color: #fcd34d;
}

.badge--nonstd {
  background: rgba(255, 95, 110, 0.15);
  color: #fecaca;
}

.doc-scroll {
  max-height: calc(100vh - 8rem);
  overflow-y: auto;
  padding-right: 0.35rem;
}

.doc-scroll::-webkit-scrollbar {
  width: 8px;
}

.doc-scroll::-webkit-scrollbar-thumb {
  background: var(--border);
  border-radius: 4px;
}

/* Default index: response is the only right-column content — use viewport height. */
.doc-scroll--tall-response #result {
  max-height: calc(100vh - 11rem);
  min-height: min(360px, 45vh);
}

.doc h2 {
  font-size: 1.05rem;
  margin: 1.25rem 0 0.5rem;
  color: var(--text);
  font-weight: 600;
}

.doc h2:first-child {
  margin-top: 0;
}

.doc h3 {
  font-size: 0.88rem;
  margin: 1rem 0 0.4rem;
  color: var(--accent-hover);
  font-weight: 600;
}

.doc p,
.doc li {
  font-size: 0.88rem;
  color: var(--text-muted);
  margin: 0.4rem 0;
}

.doc ul {
  padding-left: 1.2rem;
}

.doc pre {
  font-family: var(--mono);
  font-size: 0.72rem;
  line-height: 1.4;
  background: var(--input-bg);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 0.75rem 0.85rem;
  overflow-x: auto;
  margin: 0.5rem 0;
  white-space: pre-wrap;
  word-break: break-word;
}

.doc .callout {
  border-left: 3px solid var(--accent);
  padding: 0.5rem 0.85rem;
  margin: 0.65rem 0;
  background: rgba(235, 84, 36, 0.1);
  border-radius: 0 6px 6px 0;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.result-panel .panel__body {
  padding: 0;
}

#result {
  font-family: var(--mono);
  font-size: 0.78rem;
  line-height: 1.45;
  padding: 1rem;
  margin: 0;
  min-height: 120px;
  max-height: 360px;
  overflow: auto;
  white-space: pre-wrap;
  word-break: break-word;
  background: var(--input-bg);
}

#result.ok {
  border-top: 2px solid var(--success);
}

#result.err {
  border-top: 2px solid var(--danger);
}

.site-footer {
  margin-top: auto;
  padding: 1rem 1.5rem;
  text-align: center;
  font-size: 0.82rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  background: rgba(13, 13, 18, 0.96);
}

.site-footer strong {
  color: var(--text);
  font-weight: 600;
}

.site-footer a {
  color: var(--accent-hover);
}

.site-footer a:hover {
  color: var(--accent);
}
