/* JWT Decoder: the colour-coded token, the status line, header/payload side by side, claims and the
   signature check. Header, payload and signature keep the same colour everywhere on the page. */

.jwt { display: flex; flex-direction: column; gap: 22px; --jwt-header: #C2410C; --jwt-payload: #7E22CE; --jwt-signature: #0E7490; }

.jwt-token { height: auto; min-height: 110px; padding: 12px 16px; font: 15px/1.5 var(--font-mono); word-break: break-all; resize: vertical; background: var(--surface-2); }

.jwt-colored {
  margin: -8px 0 0;
  padding: 12px 16px;
  font: 14px/1.55 var(--font-mono);
  word-break: break-all;
  background: var(--surface);
  border: 1.5px dashed var(--line-soft);
  border-radius: 12px;
}
.jwt-part-header { color: var(--jwt-header); }
.jwt-part-payload { color: var(--jwt-payload); }
.jwt-part-signature { color: var(--jwt-signature); }
.jwt-part-key, .jwt-part-iv { color: var(--ink-3); }
.jwt-dot { font-weight: 700; color: var(--ink); }

.jwt-status {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  padding: 14px 18px;
  font-size: 16px;
  font-weight: 600;
  border: var(--border);
  border-radius: 12px;
}
.jwt-status-dot { flex-shrink: 0; width: 14px; height: 14px; border: 2px solid var(--ink); border-radius: 50%; }
.jwt-status[data-state="valid"] { background: #ECFDF3; }
.jwt-status[data-state="valid"] .jwt-status-dot { background: #12B76A; }
.jwt-status[data-state="expired"], .jwt-status[data-state="not-yet"] { background: #FEF3F2; }
.jwt-status[data-state="expired"] .jwt-status-dot, .jwt-status[data-state="not-yet"] .jwt-status-dot { background: #F04438; }
.jwt-status[data-state="no-expiry"], .jwt-status[data-state="jwe"] { background: #FFFAEB; }
.jwt-status[data-state="no-expiry"] .jwt-status-dot, .jwt-status[data-state="jwe"] .jwt-status-dot { background: #F79009; }

.jwt-parts { display: grid; grid-template-columns: minmax(0, 2fr) minmax(0, 3fr); gap: 20px; align-items: start; }
.jwt-part { display: flex; flex-direction: column; gap: 8px; min-width: 0; }
.jwt-part-head { display: flex; align-items: center; justify-content: space-between; gap: 12px; }
.jwt-part-title, .jwt-section-title { display: flex; align-items: center; gap: 8px; margin: 0; font: 700 18px var(--font-display); }
.jwt-swatch { width: 12px; height: 12px; border: 2px solid var(--ink); border-radius: 3px; }
.jwt-swatch-header { background: var(--jwt-header); }
.jwt-swatch-payload { background: var(--jwt-payload); }
.jwt-swatch-signature { background: var(--jwt-signature); }
.jwt-mini { min-height: 34px; padding: 0 12px; font-size: 14px; box-shadow: none; }

.jwt-json {
  margin: 0;
  padding: 14px 16px;
  font: 14px/1.55 var(--font-mono);
  white-space: pre-wrap;
  overflow-wrap: anywhere;
  max-height: 420px;
  overflow: auto;
  background: var(--surface-2);
  border: var(--border);
  border-radius: 12px;
}
.jwt-jwe-note { grid-column: 2; margin: 0; padding: 14px 16px; background: #FFFAEB; border: var(--border); border-radius: 12px; }

.jwt-claims-wrap { display: flex; flex-direction: column; gap: 10px; }
.jwt-claims { width: 100%; border-collapse: collapse; font-size: 15px; background: var(--surface); border: var(--border); border-radius: 12px; overflow: hidden; }
.jwt-claims th, .jwt-claims td { padding: 10px 14px; text-align: left; vertical-align: top; border-bottom: 1px solid #D6DEEE; }
.jwt-claims tr:last-child th, .jwt-claims tr:last-child td { border-bottom: 0; }
.jwt-claims th { width: 34%; font-weight: 400; }
.jwt-claim-key { display: block; font: 700 14px var(--font-mono); color: var(--jwt-payload); }
.jwt-claim-name { display: block; font-size: 13px; color: var(--ink-3); }
.jwt-claim-value { display: block; font: 14px var(--font-mono); overflow-wrap: anywhere; }
.jwt-claim-date { display: block; margin-top: 2px; font-size: 13px; color: var(--ink-2); }

.jwt-verify { display: flex; flex-direction: column; gap: 12px; padding: 18px 20px; background: var(--surface-2); border: var(--border); border-radius: 14px; }
.jwt-alg-note { margin: 0; font-size: 14px; color: var(--ink-2); }
.jwt-key { height: auto; padding: 12px 16px; font: 14px/1.5 var(--font-mono); resize: vertical; background: var(--surface); }
.jwt-check { display: flex; align-items: center; gap: 10px; font-size: 14px; font-weight: 600; cursor: pointer; }
.jwt-check input { width: 18px; height: 18px; margin: 0; accent-color: var(--accent); }
.jwt-verify-result { margin: 0; padding: 12px 16px; font-weight: 700; border: var(--border); border-radius: 10px; }
.jwt-verify-result.is-valid { background: #ECFDF3; }
.jwt-verify-result.is-invalid, .jwt-verify-result.is-error { background: #FEF3F2; color: #B42318; }
.jwt-demo { margin: 0; font-size: 13px; color: var(--ink-3); }

@media (max-width: 860px) {
  .jwt-parts { grid-template-columns: minmax(0, 1fr); }
  .jwt-jwe-note { grid-column: auto; }
  .jwt-claims th { width: 40%; }
}
