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

html, body { height: 100%; overflow: hidden; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at top left, rgba(96,120,255,0.12), transparent 28%),
    radial-gradient(circle at bottom right, rgba(95,125,255,0.08), transparent 28%),
    #080a13;
  color: #e0e0e0;
  display: flex;
  align-items: stretch;
}

.container {
  display: grid;
  grid-template-columns: 300px 1fr;
  width: 100%;
  height: 100vh;
}

/* ---- Sidebar ---- */
.panel {
  background: rgba(12,16,34,0.98);
  border-right: 1px solid rgba(70,80,150,0.18);
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}

.panel-header {
  padding: 24px 20px 18px;
  border-bottom: 1px solid rgba(71,88,197,0.2);
  background: linear-gradient(180deg, rgba(30,37,74,0.98), rgba(11,14,30,0.98));
  flex-shrink: 0;
}

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

.brand-logo {
  width: 96px; height: auto; min-width: 96px;
  border-radius: 18px; padding: 8px;
  filter: drop-shadow(0 0 18px rgba(95,125,255,0.35));
}

.brand-label {
  font-size: 10px; letter-spacing: 0.16em;
  text-transform: uppercase; color: #8ea0ff; margin-bottom: 4px;
}

.panel-header h1 {
  font-size: 22px; font-weight: 700; color: #fff; letter-spacing: -0.3px; margin: 0;
}

.tool-tagline { margin: 6px 0 0; font-size: 12px; color: #b5bfff; }

.panel-body {
  flex: 1; overflow-y: auto; padding: 16px 20px;
  display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin; scrollbar-color: #2a2a2a transparent;
}
.panel-body::-webkit-scrollbar { width: 4px; }
.panel-body::-webkit-scrollbar-thumb { background: #2a2a2a; border-radius: 4px; }

.section-title {
  font-size: 10px; font-weight: 600; text-transform: uppercase;
  letter-spacing: 0.8px; color: #444; margin-bottom: 8px;
}

textarea {
  width: 100%;
  background: #111420;
  border: 1px solid #1e2340;
  border-radius: 8px;
  color: #e0e0e0;
  font-size: 11px;
  font-family: 'Menlo','Monaco','Courier New',monospace;
  padding: 10px;
  resize: none;
  height: 130px;
  outline: none;
  transition: border-color .15s;
  line-height: 1.5;
  word-break: break-all;
}
textarea:focus { border-color: #3a4070; }

hr { border: none; border-top: 1px solid #1c1c1c; }
.hidden { display: none !important; }

/* ---- Token status ---- */
.token-status {
  font-size: 11px;
  padding: 8px 10px;
  border-radius: 7px;
  font-weight: 600;
}
.token-status.valid   { background: rgba(0,200,120,0.08); color: #00c878; border: 1px solid rgba(0,200,120,0.2); }
.token-status.invalid { background: rgba(255,80,80,0.08); color: #ff6060; border: 1px solid rgba(255,80,80,0.2); }
.token-status.expired { background: rgba(255,160,0,0.08); color: #ffa040; border: 1px solid rgba(255,160,0,0.2); }

/* ---- Expiry ---- */
.expiry-block {}
.expiry-content { font-size: 12px; line-height: 1.7; color: #888; }
.expiry-content strong { color: #e0e0e0; font-weight: 600; display: block; margin-bottom: 2px; }

/* ---- About ---- */
.about-list { display: flex; flex-direction: column; gap: 7px; margin-bottom: 10px; }
.about-row { display: flex; align-items: center; gap: 8px; font-size: 11px; color: #666; }
.about-dot { width: 8px; height: 8px; border-radius: 50%; flex-shrink: 0; }
.about-note {
  font-size: 10px; color: #333; line-height: 1.5;
  border-left: 2px solid #1e2340; padding-left: 8px;
}

/* ---- Output side ---- */
.output-side { display: flex; flex-direction: column; height: 100vh; overflow: hidden; }

.output-topbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 12px 20px;
  border-bottom: 1px solid rgba(70,80,150,0.18);
  background: rgba(10,13,28,0.8);
  flex-shrink: 0; gap: 10px;
}

.status-badge {
  font-size: 11px; font-weight: 600; padding: 3px 10px;
  border-radius: 20px;
}
.status-badge.idle    { background: rgba(100,100,120,0.2); color: #555; border: 1px solid #222; }
.status-badge.valid   { background: rgba(0,200,120,0.12); color: #00c878; border: 1px solid rgba(0,200,120,0.25); }
.status-badge.expired { background: rgba(255,160,0,0.12); color: #ffa040; border: 1px solid rgba(255,160,0,0.25); }
.status-badge.invalid { background: rgba(255,80,80,0.12); color: #ff6060; border: 1px solid rgba(255,80,80,0.25); }

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

/* ---- JWT parts visual ---- */
.parts-visual { display: flex; align-items: center; gap: 4px; }
.part-pill {
  height: 6px; border-radius: 3px;
  display: inline-block;
}
.header-pill  { width: 36px; background: #e5a96a; }
.payload-pill { width: 80px; background: #79c7a0; }
.sig-pill     { width: 52px; background: #8ea0ff; }
.part-sep { color: #333; font-size: 12px; font-weight: 700; }

/* ---- Sections ---- */
.sections-area {
  flex: 1; overflow-y: auto; padding: 20px;
  display: flex; flex-direction: column; gap: 16px;
  scrollbar-width: thin; scrollbar-color: #1e1e1e transparent;
}
.sections-area::-webkit-scrollbar { width: 6px; }
.sections-area::-webkit-scrollbar-thumb { background: #1e1e1e; border-radius: 4px; }

.empty-state {
  flex: 1; display: flex; flex-direction: column;
  align-items: center; justify-content: center; gap: 12px;
}
.empty-state p { font-size: 13px; color: #2a2a3a; }

/* ---- Decoded section card ---- */
.decode-section {
  background: rgba(15,20,25,0.6);
  border: 1.5px solid #1a1f30;
  border-radius: 10px;
  overflow: hidden;
}

.decode-section-header {
  display: flex; align-items: center; justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #1a1f30;
}

.section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px;
}

.section-label-dot { width: 8px; height: 8px; border-radius: 50%; }

.section-copy-btn {
  display: flex; align-items: center; gap: 5px;
  background: rgba(95,125,255,0.08);
  border: 1px solid rgba(95,125,255,0.15);
  border-radius: 6px;
  color: #555; font-size: 10px; cursor: pointer;
  padding: 3px 8px; transition: all .15s;
}
.section-copy-btn:hover { background: rgba(95,125,255,0.18); color: #8ea0ff; }
.section-copy-btn.copied { color: #00c878; border-color: rgba(0,200,120,0.3); }

.decode-section pre {
  margin: 0; padding: 14px 16px;
  font-family: 'Menlo','Monaco','Courier New',monospace;
  font-size: 12px; line-height: 1.7;
  white-space: pre-wrap; word-break: break-all;
}

/* Signature section */
.sig-section {
  background: rgba(15,20,25,0.6);
  border: 1.5px solid #1a1f30;
  border-radius: 10px;
  padding: 12px 16px;
  display: flex; align-items: center; gap: 10px;
}
.sig-section-label {
  display: flex; align-items: center; gap: 8px;
  font-size: 11px; font-weight: 700;
  text-transform: uppercase; letter-spacing: 0.8px; color: #8ea0ff;
}
.sig-note { font-size: 11px; color: #333; }

/* Syntax colors */
.json-key    { color: #8ea0ff; }
.json-string { color: #79c7a0; }
.json-number { color: #e5a96a; }
.json-bool   { color: #c788e0; }
.json-null   { color: #c788e0; }

/* ---- Mobile ---- */
@media (max-width: 700px) {
  html, body { overflow: auto; height: auto; }
  .container { grid-template-columns: 1fr; height: auto; min-height: 100vh; }
  .panel { height: auto; overflow: visible; border-right: none; border-bottom: 1px solid rgba(70,80,150,0.18); }
  .panel-body { overflow: visible; }
  .output-side { height: auto; }
}
