/* JWT Token Decoder & Claims Inspector — content styles.
   Prefix: --jwt-  /  .jwt-

   Reference point: the token's own three-dot-separated structure, made
   visible — one card per segment (header / payload / signature), not a
   single blob of decoded JSON. The card-per-segment layout is a genuine
   structural echo of what a JWT actually is, not decoration.

   THIS FILE STYLES THE CONTENT AREA ONLY. Chrome is owned by chrome.css. */

:root {
  --jwt-surface: #ffffff;
  --jwt-panel:   #f5f6f4;
  --jwt-line:    #dadedb;
  --jwt-text:    #14181a;
  --jwt-muted:   #5e6862;
  --jwt-good:    #1c7a4c;
  --jwt-bad:     #b3261e;
  --jwt-warn:    #9a6b12;
  --jwt-mono:    ui-monospace, SFMono-Regular, "JetBrains Mono", Menlo, Consolas, monospace;
}

.jwt-wrap {
  width: 100%;
  max-width: 52rem;
  margin-inline: auto;
  padding-inline: 1.5rem;
}

/* ── Input ───────────────────────────────────────────────────────────────── */

.jwt-input-panel {
  margin-bottom: 1rem;
}

.jwt-input-panel label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--jwt-muted);
}

.jwt-input {
  width: 100%;
  box-sizing: border-box;
  min-height: 6rem;
  padding: 0.75rem 0.875rem;
  font-family: var(--jwt-mono);
  font-size: 0.8125rem;
  line-height: 1.6;
  color: var(--jwt-text);
  background: var(--jwt-surface);
  border: 1px solid var(--jwt-line);
  border-radius: 2px;
  resize: vertical;
  word-break: break-all;
}

.jwt-input:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: -1px;
}

.jwt-error {
  margin: 0.5rem 0 0;
  font-size: 0.8125rem;
  color: var(--jwt-bad);
}

/* ── Primary action button ──────────────────────────────────────────────── */

.jwt-btn {
  display: block;
  width: 100%;
  padding: 0.75rem 1.5rem;
  font-family: inherit;
  font-size: 0.9375rem;
  font-weight: 700;
  color: var(--tf-accent-ink);
  background: var(--tf-accent);
  border: 1px solid var(--tf-accent);
  border-radius: 2px;
  cursor: pointer;
  margin-bottom: 1.5rem;
}

.jwt-btn:hover  { background: var(--tf-accent-hover);  border-color: var(--tf-accent-hover); }
.jwt-btn:active { background: var(--tf-accent-active); border-color: var(--tf-accent-active); }

.jwt-btn:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: 2px;
}

/* ── Expiry banner ───────────────────────────────────────────────────────── */

.jwt-expiry-banner {
  padding: 0.75rem 1rem;
  margin-bottom: 1rem;
  font-size: 0.875rem;
  font-weight: 700;
  border: 1px solid var(--jwt-line);
  border-left: 3px solid var(--jwt-muted);
  border-radius: 2px;
  background: var(--jwt-panel);
  color: var(--jwt-text);
}

.jwt-expiry--valid   { border-left-color: var(--jwt-good); color: var(--jwt-good); }
.jwt-expiry--expired { border-left-color: var(--jwt-bad);  color: var(--jwt-bad); }
.jwt-expiry--pending { border-left-color: var(--jwt-warn); color: var(--jwt-warn); }
.jwt-expiry--unknown { border-left-color: var(--jwt-muted); color: var(--jwt-muted); }

/* ── Three-segment card row ──────────────────────────────────────────────── */

.jwt-segments {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 0.75rem;
  margin-bottom: 1rem;
}

@media (max-width: 40rem) {
  .jwt-segments { grid-template-columns: 1fr; }
}

.jwt-segment {
  border: 1px solid var(--jwt-line);
  border-radius: 2px;
  overflow: hidden;
  background: var(--jwt-surface);
}

.jwt-segment-label {
  margin: 0;
  padding: 0.5rem 0.75rem;
  font-size: 0.6875rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--jwt-muted);
  background: var(--jwt-panel);
  border-bottom: 1px solid var(--jwt-line);
}

.jwt-code {
  margin: 0;
  padding: 0.75rem;
  min-height: 7rem;
  max-height: 12rem;
  overflow: auto;
  font-family: var(--jwt-mono);
  font-size: 0.75rem;
  line-height: 1.6;
  white-space: pre-wrap;
  word-break: break-word;
  color: var(--jwt-text);
}

.jwt-code--sig {
  word-break: break-all;
  color: var(--jwt-muted);
}

/* ── Claims panel ────────────────────────────────────────────────────────── */

.jwt-claims-panel {
  margin-bottom: 1rem;
}

.jwt-claims-title {
  margin: 0 0 0.5rem;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--jwt-muted);
}

.jwt-claims-list {
  list-style: none;
  margin: 0;
  padding: 0;
  border: 1px solid var(--jwt-line);
  border-radius: 2px;
  overflow: hidden;
  background: var(--jwt-surface);
}

.jwt-claim-row {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  gap: 1rem;
  padding: 0.5rem 0.75rem;
  font-size: 0.8125rem;
  border-bottom: 1px solid var(--jwt-line);
}

.jwt-claim-row:last-child { border-bottom: none; }

.jwt-claim-name {
  color: var(--jwt-muted);
  font-weight: 600;
  flex: 0 0 auto;
}

.jwt-claim-value {
  font-family: var(--jwt-mono);
  color: var(--jwt-text);
  text-align: right;
  word-break: break-word;
}

/* ── Verify panel ────────────────────────────────────────────────────────── */

.jwt-verify-panel {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border: 1px solid var(--jwt-line);
  border-radius: 2px;
  background: var(--jwt-panel);
}

.jwt-field label {
  display: block;
  margin-bottom: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--jwt-muted);
}

.jwt-field input {
  width: 100%;
  box-sizing: border-box;
  padding: 0.625rem 0.75rem;
  font-family: var(--jwt-mono);
  font-size: 0.8125rem;
  color: var(--jwt-text);
  background: var(--jwt-surface);
  border: 1px solid var(--jwt-line);
  border-radius: 2px;
}

.jwt-field input:focus-visible {
  outline: 2px solid var(--tf-accent);
  outline-offset: -1px;
}

.jwt-verify-status {
  margin: 0.75rem 0 0;
  font-size: 0.8125rem;
  font-weight: 600;
}

.jwt-verify-status--idle    { color: var(--jwt-muted); }
.jwt-verify-status--good    { color: var(--jwt-good); }
.jwt-verify-status--bad     { color: var(--jwt-bad); }
.jwt-verify-status--unknown { color: var(--jwt-warn); }

/* ── Ad slots ───────────────────────────────────────────────────────────── */

.jwt-ad {
  min-height: 280px;
  margin: 2rem auto 0;
  max-width: 52rem;
  padding-inline: 1.5rem;
}

@media (max-width: 26rem) {
  .jwt-wrap,
  .jwt-ad { padding-inline: 1rem; }
}

/* tf:dark-palette — generated by migrate_chrome.py */
/* Neutrals inherit the shared chrome tokens so all tools share one
   ground; brand hues are kept and lightened, never inverted. */
[data-theme="dark"] {
  --jwt-surface: var(--tf-surface);
  --jwt-panel: var(--tf-surface);
  --jwt-line: var(--tf-rule);
  --jwt-text: var(--tf-ink);
  --jwt-muted: var(--tf-ink-soft);
  --jwt-good: #5fd099;
  --jwt-bad: #da8581;
  --jwt-warn: #d5b270;
}
