/* JWT Decoder Styles */

.jwt-container {
  padding: 1rem 1.5rem;
  max-width: 100%;
}

/* Two-column layout */
.jwt-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
  height: calc(100vh - 140px);
  min-height: 400px;
}

.jwt-left,
.jwt-right {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  min-height: 0;
}

/* Sections */
.jwt-section {
  background: var(--card-bg);
  border: 1px solid var(--border-color);
  border-radius: 0.5rem;
  overflow: hidden;
  display: flex;
  flex-direction: column;
}

.jwt-left .jwt-section:first-child {
  flex: 1;
  min-height: 0;
}

.jwt-right .jwt-section {
  flex-shrink: 0;
}

/* Common panel styles */
.panel-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border-bottom: 1px solid var(--border-color);
  flex-shrink: 0;
}

.panel-header h3 {
  font-size: 0.875rem;
  font-weight: 600;
  color: var(--text-color);
  margin: 0;
}

.header-buttons {
  display: flex;
  gap: 0.375rem;
}

.btn-small {
  padding: 0.25rem 0.625rem;
  font-size: 0.75rem;
  border: 1px solid var(--border-color);
  border-radius: 0.25rem;
  background: white;
  color: var(--text-color);
  cursor: pointer;
  transition: background-color 0.2s;
}

.btn-small:hover {
  background: #f1f5f9;
}

.btn-small.btn-copy {
  background-color: var(--primary-color);
  color: white;
  border-color: var(--primary-color);
}

.btn-small.btn-copy:hover {
  background-color: var(--primary-hover);
}

/* JWT Input with color overlay */
.jwt-input-wrap {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow: hidden;
}

.jwt-highlight {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  padding: 1rem;
  font-size: 0.8125rem;
  font-family: 'Courier New', monospace;
  line-height: 1.6;
  word-break: break-all;
  white-space: pre-wrap;
  pointer-events: none;
  overflow-y: auto;
}

.jwt-highlight .jwt-seg-header {
  color: #fb015b;
}

.jwt-highlight .jwt-seg-dot {
  color: #64748b;
}

.jwt-highlight .jwt-seg-payload {
  color: #d63aff;
}

.jwt-highlight .jwt-seg-signature {
  color: #00b9f1;
}

.jwt-textarea {
  position: relative;
  flex: 1;
  width: 100%;
  height: 100%;
  padding: 1rem;
  border: none;
  font-size: 0.8125rem;
  font-family: 'Courier New', monospace;
  resize: none;
  line-height: 1.6;
  outline: none;
  word-break: break-all;
  white-space: pre-wrap;
  color: transparent;
  caret-color: var(--text-color);
  background: transparent;
}

/* Decoded code blocks */
.jwt-code {
  margin: 0;
  padding: 1rem;
  font-size: 0.8125rem;
  font-family: 'Courier New', monospace;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-word;
}

.jwt-placeholder {
  color: #94a3b8;
}

/* JSON syntax colors */
.jwt-code .json-key {
  color: #881391;
}

.jwt-code .json-string {
  color: #0b7285;
}

.jwt-code .json-number {
  color: #c2255c;
}

.jwt-code .json-boolean {
  color: #e67700;
}

.jwt-code .json-null {
  color: #868e96;
}

/* Claims table */
.jwt-claims-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.8125rem;
}

.jwt-claims-table th,
.jwt-claims-table td {
  padding: 0.5rem 1rem;
  text-align: left;
  border-bottom: 1px solid var(--border-color);
}

.jwt-claims-table th {
  background: #f8fafc;
  font-weight: 600;
  color: var(--text-color);
  white-space: nowrap;
  width: 1%;
}

.jwt-claims-table td {
  font-family: 'Courier New', monospace;
}

.jwt-claims-table tr:last-child th,
.jwt-claims-table tr:last-child td {
  border-bottom: none;
}

.claim-label {
  font-weight: 600;
  color: #881391;
  font-family: 'Courier New', monospace;
}

.claim-value {
  color: #475569;
}

.claim-status {
  font-size: 0.75rem;
  padding: 0.125rem 0.5rem;
  border-radius: 0.25rem;
  font-weight: 600;
  margin-left: 0.5rem;
}

.claim-status.valid {
  background: #dcfce7;
  color: #166534;
}

.claim-status.expired {
  background: #fef2f2;
  color: #991b1b;
}

/* Signature verification */
.jwt-verify-body {
  padding: 1rem;
  display: flex;
  gap: 0.75rem;
  align-items: center;
}

.jwt-verify-body .form-input {
  flex: 1;
  font-family: 'Courier New', monospace;
  font-size: 0.8125rem;
}

#jwt-verify-result {
  font-size: 0.8125rem;
  font-weight: 600;
  white-space: nowrap;
}

#jwt-verify-result.sig-valid {
  color: #166534;
}

#jwt-verify-result.sig-invalid {
  color: #991b1b;
}

#jwt-verify-result.sig-pending {
  color: #94a3b8;
  font-weight: 400;
}

/* Responsive */
@media (max-width: 768px) {
  .jwt-layout {
    grid-template-columns: 1fr;
    height: auto;
  }

  .jwt-textarea {
    min-height: 120px;
  }

  .jwt-verify-body {
    flex-direction: column;
    align-items: stretch;
  }
}
