.idl-header {
  margin-bottom: 1rem;
}

.idl-layout {
  display: flex;
  gap: 1rem;
  min-height: calc(100vh - 200px);
}

.sidebar {
  width: 250px;
  flex-shrink: 0;
  background: #282a2e;
  border: 1px solid #373b41;
  padding: 0.75rem;
  height: fit-content;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.sidebar::-webkit-scrollbar {
  width: 8px;
}

.sidebar::-webkit-scrollbar-track {
  background: #1d1f21;
}

.sidebar::-webkit-scrollbar-thumb {
  background: #373b41;
  border-radius: 4px;
}

.sidebar::-webkit-scrollbar-thumb:hover {
  background: #4e5256;
}

.sidebar-nav {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.sidebar-section {
  display: flex;
  flex-direction: column;
}

.sidebar-section-header {
  color: #81a2be;
  text-decoration: none;
  font-weight: bold;
  font-size: 13px;
  padding: 0.5rem 0.25rem;
  border-bottom: 1px solid #373b41;
  cursor: pointer;
  display: block;
}

.sidebar-section-header:hover {
  color: #c5c8c6;
  background: #373b41;
}

.sidebar-items {
  display: flex;
  flex-direction: column;
  margin-top: 0.25rem;
  margin-bottom: 0.25rem;
}

.sidebar-item {
  color: #8abeb7;
  text-decoration: none;
  font-size: 12px;
  padding: 0.35rem 0.5rem;
  padding-left: 1rem;
  cursor: pointer;
  display: block;
}

.sidebar-item:hover {
  color: #c5c8c6;
  background: #373b41;
}

.idl-content {
  flex: 1;
  min-width: 0;
}

.section {
  margin-bottom: 2rem;
  scroll-margin-top: 1rem;
}

.item {
  display: block;
  padding: 0.75rem;
  border: 1px solid #373b41;
  background: #282a2e;
  position: relative;
  scroll-margin-top: 1rem;
}

.metadata-grid {
  display: flex;
  gap: 1rem;
  margin-bottom: 1rem;
}

.metadata-grid p {
  margin: 0;
  padding: 0.5rem;
  background: #282a2e;
  border: 1px solid #373b41;
  font-size: 12px;
}

.items-grid {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.item h3 {
  margin: 0 0 0.5rem 0;
  padding-right: 6rem;
}

.item h4 {
  margin: 0;
  margin-top: 0.5rem;
}

.item-header {
  display: flex;
  justify-content: flex-start;
  align-items: center;
  gap: 1em;
}

.item-header h3 {
  margin: 0;
  padding-right: 0;
}

.item-pills {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.item-pills > li {
  background: #373b41;
  color: #c5c8c6;
  padding: 0.25rem 0.5rem;
  font-size: 11px;
  border-radius: 2px;
  white-space: nowrap;
}

.item-pills > li.discriminator {
  background: #373b41;
  color: #f0c674;
}

.item-pills > li.pill {
  background: #373b41;
  color: #c5c8c6;
}

.item-pills > li.writable {
  background: #b294bb;
  color: #1d1f21;
}

.item-pills > li.signer {
  background: #8abeb7;
  color: #1d1f21;
}

.item-pills > li.pda {
  background: #81a2be;
  color: #1d1f21;
}

.item-info {
  display: flex;
  flex-wrap: wrap;
  gap: 1rem;
  margin-top: 0.5rem;
}

.item-info p {
  margin: 0;
  font-size: 12px;
  white-space: nowrap;
}

.field {
  margin: 0.25rem 0;
  font-size: 12px;
  padding-left: 1rem;
}

.field-header {
  display: flex;
  gap: 0.5em;
  justify-content: flex-start;
  align-items: center;
  margin-bottom: 0.25rem;
}

.field-header strong {
  margin: 0;
}

.account-type-link {
  color: #b294bb;
  text-decoration: none;
  font-size: 11px;
  font-weight: normal;
  padding: 0.125rem 0.35rem;
  background: #373b41;
  border-radius: 2px;
  cursor: pointer;
  transition:
    background 0.2s,
    color 0.2s,
    opacity 0.2s;
}

.account-type-link:hover {
  color: #c5c8c6;
  background: #4e5256;
  text-decoration: underline;
}

/* Inferred type match - dimmed to indicate uncertainty */
.account-type-link-inferred {
  opacity: 0.6;
  color: #9a7a9b;
  background: #2d2f33;
}

.account-type-link-inferred:hover {
  opacity: 0.85;
  color: #b294bb;
  background: #373b41;
}

.field-pills {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  gap: 0.25rem;
  flex-shrink: 0;
}

.field-pills > li {
  background: #373b41;
  color: #c5c8c6;
  padding: 0.125rem 0.25rem;
  font-size: 11px;
  border-radius: 2px;
  white-space: nowrap;
}

.field-pills > li.writable {
  background: #b294bb;
  color: #1d1f21;
}

.field-pills > li.signer {
  background: #8abeb7;
  color: #1d1f21;
}

.field-pills > li.pda {
  background: #81a2be;
  color: #1d1f21;
}

/* Account-specific styling for closer grouping */
.item .field strong {
  margin-bottom: 0.125rem;
}

.item .field .docs {
  margin: 0.125rem 0 0.25rem 0;
}

.item .field p {
  margin: 0.125rem 0;
}

.type-ref {
  color: #b294bb;
  text-decoration: none;
}

.type-ref:hover {
  color: #c5c8c6;
}

.type-link {
  color: #b294bb;
  text-decoration: none;
  cursor: pointer;
}

.type-link:hover {
  color: #c5c8c6;
  text-decoration: underline;
}

/* PDA styling */
.pda {
  margin: 0;
  padding: 0;
}

.pda-format {
  display: inline-block;
  padding: 0.25rem 0.5rem;
  margin-top: 0.25rem;
  background: #373b41;
  border-radius: 2px;
  font-family:
    "SF Mono", "Monaco", "Inconsolata", "Fira Code", "Fira Mono",
    "Droid Sans Mono", "Source Code Pro", monospace;
  font-size: 11px;
  color: #c5c8c6;
  white-space: wrap;
}

/* Inferred PDA styling - dimmed appearance */
.pda-inferred .pda-format {
  opacity: 0.5;
  background: #2d2f33;
  color: #969896;
}

/* Clickable inferred PDA link */
.pda-link {
  cursor: pointer;
  text-decoration: none;
  transition:
    opacity 0.2s,
    background 0.2s;
}

.pda-link:hover {
  opacity: 0.8 !important;
  background: #373b41 !important;
  text-decoration: underline;
}

/* Raw IDL collapsible section */
.raw-idl-section {
  margin-top: 0.75rem;
  border-top: 1px solid #373b41;
  padding-top: 0.5rem;
}

.raw-idl-toggle {
  background: none;
  border: none;
  color: #8abeb7;
  cursor: pointer;
  padding: 0.25rem 0;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 11px;
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.raw-idl-toggle:hover {
  color: #c5c8c6;
}

.raw-idl-toggle::before {
  content: "▶";
  display: inline-block;
  transition: transform 0.2s;
  font-size: 10px;
}

.raw-idl-toggle.expanded::before {
  transform: rotate(90deg);
}

.raw-idl-content {
  margin-top: 0.5rem;
  max-height: 0;
  overflow: hidden;
  transition: max-height 0.3s ease-out;
}

.raw-idl-content.expanded {
  max-height: 500px;
  overflow-y: auto;
}

.raw-idl-content::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

.raw-idl-content::-webkit-scrollbar-track {
  background: #1d1f21;
}

.raw-idl-content::-webkit-scrollbar-thumb {
  background: #373b41;
  border-radius: 4px;
}

.raw-idl-content::-webkit-scrollbar-thumb:hover {
  background: #4e5256;
}

.raw-idl-content pre {
  margin: 0;
  padding: 0.5rem;
  background: #1d1f21;
  border: 1px solid #373b41;
  border-radius: 2px;
  overflow-x: auto;
  font-family: "Monaco", "Menlo", "Ubuntu Mono", monospace;
  font-size: 11px;
  color: #c5c8c6;
  line-height: 1.4;
}
