@import url('https://fonts.googleapis.com/css2?family=JetBrains+Mono:wght@400;700&family=Inter:wght@400;600;700&display=swap');

:root {
  --bg: #0a0a0a;
  --surface: #1a1a1a;
  --surface2: #242424;
  --border: #2e2e2e;
  --text: #e6e6e6;
  --text-dim: #888;
  --accent: #ff8c42;
  --accent-dim: #cc6f35;
  --green: #50fa7b;
  --red: #ff5555;
  --blue: #8be9fd;
  --purple: #bd93f9;
  --yellow: #f1fa8c;
  --mono: 'JetBrains Mono', monospace;
  --sans: 'Inter', system-ui, sans-serif;
  --sidebar-w: 260px;
}

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

body {
  background: var(--surface);
  color: var(--text);
  font-family: var(--sans);
  line-height: 1.7;
  display: flex;
  height: 100vh;
  overflow: hidden;
}

/* ── Sidebar ── */
.sidebar {
  width: var(--sidebar-w);
  height: calc(100vh - 2rem);
  background: var(--surface);
  position: fixed;
  top: 1rem;
  left: 1rem;
  transition: width .25s ease;
  z-index: 10;
  border-radius: 12px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  /* Hide any scrollbars */
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.sidebar::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}
.sidebar-header {
  display: flex;
  align-items: center;
  gap: .6rem;
  padding: 1rem 1rem 1.2rem;
  border-bottom: 1px solid var(--border);
  position: relative;
  flex-shrink: 0;
}
.sidebar-scrollable-area {
  flex: 1;
  overflow-y: scroll;
  overflow-x: hidden;
  padding: 1rem 0;
  /* Hide scrollbar but keep scrollable - all browsers */
  scrollbar-width: none !important; /* Firefox */
  -ms-overflow-style: none !important; /* IE and Edge */
}
.sidebar-scrollable-area::-webkit-scrollbar {
  display: none !important; /* Chrome, Safari, Opera */
  width: 0 !important;
  height: 0 !important;
  background: transparent !important;
}
.sidebar-scrollable-area::-webkit-scrollbar-track {
  display: none !important;
}
.sidebar-scrollable-area::-webkit-scrollbar-thumb {
  display: none !important;
}
.sidebar-footer-wrapper {
  display: flex;
  align-items: center;
  margin: 1rem 1rem 1rem 1rem;
  position: relative;
  padding-left: 20px;
  flex-shrink: 0;
}
body.sidebar-collapsed .sidebar { width: 52px; }
body.sidebar-collapsed .sidebar-logo-text,
body.sidebar-collapsed .sidebar-collapse-inline,
body.sidebar-collapsed .sidebar-footer-pane,
body.sidebar-collapsed .sidebar-footer-wrapper .sign-out-btn {
  display: none !important;
}
body.sidebar-collapsed .sidebar-footer-wrapper { display: flex; justify-content: center; padding-left: 0; }
body.sidebar-collapsed .sidebar-footer-pfp { position: static; transform: none; margin-top: 1rem; }
body.sidebar-collapsed .sidebar-header { justify-content: center; padding: 1rem 0 1.2rem; }

.sidebar-logo-img {
  width: 28px;
  height: 28px;
  flex-shrink: 0;
}

.sidebar-logo-text {
  font-family: var(--mono);
  font-size: 1.1rem;
  color: var(--accent);
  white-space: nowrap;
}

.sidebar-collapse-inline {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: .3rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  margin-left: auto;
}
.sidebar-collapse-inline:hover { background: var(--surface2); color: var(--text); }
.sidebar-collapse-inline svg { width: 16px; height: 16px; flex-shrink: 0; }

.sidebar-collapse {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: .4rem;
  border-radius: 4px;
  display: none; /* Only show when collapsed */
  align-items: center;
  justify-content: center;
  margin: .5rem auto;
}
.sidebar-collapse:hover { background: var(--surface2); color: var(--text); }
.sidebar-collapse svg { width: 16px; height: 16px; flex-shrink: 0; }

body.sidebar-collapsed .sidebar-collapse {
  display: flex;
}

.sidebar-section {
  padding: 0 .8rem;
  margin-bottom: .5rem;
}

.sidebar-toggle-row {
  display: flex;
  align-items: center;
  width: 100%;
  border-radius: 4px;
  transition: background .15s;
}
.sidebar-toggle-row:hover {
  background: var(--surface2);
}
.sidebar-toggle-row.active-section {
  background: transparent;
}

.sidebar-toggle-link {
  display: flex;
  align-items: center;
  gap: .6rem;
  flex: 1;
  color: var(--text-dim);
  font-family: var(--sans);
  font-size: .85rem;
  font-weight: 500;
  padding: .6rem .8rem;
  text-decoration: none;
  white-space: nowrap;
  transition: color .15s;
}
.sidebar-toggle-link:hover {
  color: var(--text);
  text-decoration: none;
}
.sidebar-toggle-row.active-section .sidebar-toggle-link {
  color: var(--accent);
}
.sidebar-toggle-link svg.folder-icon {
  width: 16px;
  height: 16px;
  color: var(--text-dim);
  transition: color .15s;
}
.sidebar-toggle-link i.folder-icon {
  width: 16px;
  font-size: 16px;
  color: var(--text-dim);
  transition: color .15s;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sidebar-toggle-link:hover svg.folder-icon,
.sidebar-toggle-link:hover i.folder-icon {
  color: var(--text);
}
.sidebar-toggle-row.active-section svg.folder-icon,
.sidebar-toggle-row.active-section i.folder-icon {
  color: var(--accent);
}

.sidebar-toggle-arrow {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: .5rem .6rem;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 0 4px 4px 0;
  transition: color .15s;
}
.sidebar-toggle-arrow:hover {
  color: var(--text);
}
.sidebar-toggle-arrow .arrow {
  font-size: .6rem;
  transition: transform .2s;
}
.sidebar-toggle-arrow .arrow.open {
  transform: rotate(90deg);
}

/* Collapsed toggle rules */
body.sidebar-collapsed .sidebar-section {
  padding: 0 .4rem;
}
body.sidebar-collapsed .sidebar-toggle-row {
  justify-content: center;
}
body.sidebar-collapsed .sidebar-toggle-link {
  justify-content: center;
  padding: .5rem 0;
}
body.sidebar-collapsed .sidebar-toggle-text,
body.sidebar-collapsed .sidebar-toggle-arrow {
  display: none !important;
}
body.sidebar-collapsed .sidebar-links {
  display: none !important;
}

.sidebar-links {
  list-style: none;
  padding: 0 0 0 0.2rem;
  margin: 0 0 0 1.2rem;
  border-left: 1px solid transparent;
  overflow: hidden;
  max-height: 0;
  transition: max-height .3s ease;
}
.sidebar-links.open { max-height: 2000px; }
.sidebar-links li {
  display: block;
  margin-bottom: 0;
}

.sidebar-links a {
  display: block;
  color: var(--text-dim);
  text-decoration: none;
  font-size: .85rem;
  padding: .35rem .6rem .35rem 0.5rem;
  border-radius: 0;
  transition: background .15s, color .15s, border-left .15s;
  white-space: nowrap;
  border-left: 2px solid var(--text-dim);
  margin-left: -1px;
}
.sidebar-links a:hover {
  background: var(--surface2);
  color: var(--text);
  border-left-color: var(--text);
  text-decoration: none;
}
.sidebar-links a.active {
  color: var(--accent);
  background: transparent;
  border-left-color: var(--accent);
  border-radius: 0;
}

/* ── Main content ── */
.main {
  margin-left: calc(var(--sidebar-w) + 2rem);
  flex: 1;
  padding: 0 1rem 1rem 0;
  transition: margin-left .25s ease;
  display: flex;
  flex-direction: column;
  height: 100vh;
  overflow: hidden;
}
body.sidebar-collapsed .main { margin-left: calc(52px + 2rem); }

.main-body-row {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  width: 100%;
}

.main-content-column {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  height: 100%;
}
.header-pane {
  background: var(--surface);
  border-radius: 12px;
  padding: 0;
  margin-bottom: 0.2rem;
  flex-shrink: 0;
}
.header-pane .breadcrumbs {
  margin: 0;
  padding: 0.5rem 1rem;
  border-bottom: none;
  background: transparent;
  position: static;
}
.main-inner {
  background: var(--bg);
  border-radius: 12px;
  padding: 3rem 3rem 3rem;
  flex: 1;
  overflow-y: auto;
  position: relative;
  z-index: 1;
  scrollbar-color: var(--surface) transparent;
  scrollbar-width: auto;
}

.loader {
  border: 4px solid var(--surface2);
  border-top: 4px solid var(--accent);
  border-radius: 50%;
  width: 30px;
  height: 30px;
  animation: spin 1s linear infinite;
  margin: 5rem auto;
  display: none;
}
@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.main-inner::-webkit-scrollbar {
  width: 14px;
}

.main-inner::-webkit-scrollbar-button {
  display: none;
  width: 0;
  height: 0;
}

.main-inner::-webkit-scrollbar-track {
  background: transparent;
}

.main-inner::-webkit-scrollbar-thumb {
  background: var(--surface);
  border-radius: 7px;
}

/* ── Breadcrumbs ── */
.breadcrumbs {
  position: sticky;
  top: 0;
  background: var(--bg);
  z-index: 10;
  padding: 1.5rem 0 1rem;
  margin-bottom: 2rem;
  border-bottom: 1px solid var(--border);
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--text-dim);
}
.breadcrumb-item {
  background: transparent;
  border: 1px solid transparent;
  color: var(--text-dim);
  padding: 0.2rem 0.4rem;
  border-radius: 4px;
  cursor: pointer;
  font-family: var(--mono);
  font-size: 0.8rem;
  transition: all 0.15s;
  outline: none;
}
.breadcrumb-item:hover {
  background: var(--surface2);
  color: var(--text-dim);
  border-color: transparent;
  outline: none;
}
.breadcrumbs .sep { margin: 0 .4rem; }

/* ── Typography ── */
h1 {
  font-family: var(--mono);
  font-size: 1.8rem;
  color: var(--accent);
  margin-bottom: .5rem;
}
h1 + p { color: var(--text-dim); margin-bottom: 2rem; }

h2 {
  font-family: var(--mono);
  font-size: 1.4rem;
  color: var(--accent);
  margin: 2.5rem 0 1rem;
  padding-bottom: .5rem;
  border-bottom: 1px solid var(--border);
}
h2:first-child { margin-top: 0; }

h3 {
  font-size: 1.1rem;
  color: var(--text);
  margin: 2rem 0 .75rem;
}

p, li { color: var(--text); font-size: .95rem; }
p { margin-bottom: 1rem; }
ul, ol { padding-left: 1.5rem; margin-bottom: 1rem; }
li { margin-bottom: .4rem; }

a { color: var(--accent); text-decoration: none; }
a:hover { text-decoration: underline; }

strong { color: #fff; }
em { color: var(--text-dim); font-style: normal; }

/* ── Code ── */
code {
  font-family: var(--mono);
  font-size: .85rem;
  background: var(--surface2);
  padding: .15rem .4rem;
  border-radius: 3px;
  color: var(--green);
}

pre {
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: 6px;
  padding: 1.2rem 1.5rem;
  overflow-x: auto;
  margin: 1rem 0 1.5rem;
}
pre code {
  background: none;
  padding: 0;
  font-size: .85rem;
  line-height: 1.6;
  color: var(--text);
}
pre .comment { color: var(--text-dim); }
pre .string { color: var(--green); }
pre .key { color: var(--purple); }
pre .flag { color: var(--blue); }
pre .value { color: var(--yellow); }
pre .cmd { color: var(--accent); }

/* ── Labels ── */
.label {
  display: inline-block;
  font-family: var(--mono);
  font-size: .7rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  padding: .2rem .5rem;
  border-radius: 3px;
  margin-right: .4rem;
  vertical-align: middle;
}
.label-required { background: #ff555533; color: var(--red); }
.label-optional { background: #50fa7b22; color: var(--green); }

/* ── Tables ── */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 1rem 0 1.5rem;
  font-size: .9rem;
}
th, td {
  text-align: left;
  padding: .6rem .8rem;
  border-bottom: 1px solid var(--border);
}
th {
  font-family: var(--mono);
  font-size: .8rem;
  color: var(--text-dim);
  text-transform: uppercase;
  letter-spacing: .05em;
}
td code { font-size: .8rem; }

/* ── Callouts ── */
.callout {
  border-left: 3px solid var(--accent);
  background: var(--surface);
  padding: 1rem 1.2rem;
  margin: 1.5rem 0;
  border-radius: 0 6px 6px 0;
}
.callout.tip { border-left-color: var(--green); }
.callout.warn { border-left-color: var(--yellow); }
.callout .callout-title {
  font-family: var(--mono);
  font-weight: 700;
  font-size: .8rem;
  text-transform: uppercase;
  margin-bottom: .4rem;
}
.callout.tip .callout-title { color: var(--green); }
.callout.warn .callout-title { color: var(--yellow); }

/* ── Swatches ── */
.swatch-row {
  display: flex;
  gap: .5rem;
  flex-wrap: wrap;
  margin: .75rem 0 1.5rem;
}
.swatch {
  width: 3rem;
  height: 3rem;
  border-radius: 6px;
  border: 1px solid var(--border);
  position: relative;
  cursor: default;
}
.swatch::after {
  content: attr(data-hex);
  position: absolute;
  bottom: -1.4rem;
  left: 50%;
  transform: translateX(-50%);
  font-family: var(--mono);
  font-size: .6rem;
  color: var(--text-dim);
  white-space: nowrap;
}

/* ── Footer ── */
.footer-pane {
  background: var(--bg);
  border-radius: 12px;
  padding: 0.5rem 1.5rem;
  margin-top: 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  color: var(--text-dim);
  font-size: .85rem;
  flex-shrink: 0;
}

.footer-left {
  display: flex;
  align-items: center;
  gap: .8rem;
}

.footer-link {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  color: var(--text-dim);
  text-decoration: none;
  font-size: .8rem;
  transition: color .15s;
}
.footer-link:hover {
  color: var(--accent);
  text-decoration: none;
}
.footer-link svg.footer-icon {
  width: 14px;
  height: 14px;
  stroke: currentColor;
}

.footer-sep {
  color: var(--border);
  user-select: none;
}

.footer-right {
  display: flex;
  align-items: center;
  gap: .4rem;
}

.contributor-avatar-link {
  display: flex;
  align-items: center;
  text-decoration: none;
}

.contributor-avatar {
  width: 22px;
  height: 22px;
  border-radius: 50%;
  border: 1px solid var(--border);
  transition: transform .15s ease, border-color .15s ease;
}
.contributor-badge {
  display: inline-block;
  background-color: var(--accent);
  color: var(--bg);
  font-family: var(--mono);
  font-size: 0.7rem;
  font-weight: 700;
  padding: 0.1rem 0.5rem;
  border-radius: 999px;
  margin-left: 0.75rem;
  vertical-align: middle;
  text-transform: uppercase;
  text-decoration: none !important;
}

/* ── Right Sidebar (Contributor Details) ── */
.right-sidebar {
  width: 0;
  background: var(--bg);
  border-radius: 12px;
  overflow: hidden;
  transition: width .3s ease, margin-left .3s ease, padding .3s ease, border-color .3s ease, visibility .3s ease;
  display: flex;
  flex-direction: column;
  align-items: center;
  flex-shrink: 0;
  height: 100%;
  border: none;
  padding: 0;
  visibility: hidden;
}
.right-sidebar.open {
  width: 300px;
  margin-left: 1rem;
  padding: 1.5rem;
  border: 1px solid var(--border);
  visibility: visible;
}

.right-sidebar-inner {
  width: 268px; /* 300px width - 32px padding */
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
}

.right-sidebar-close {
  align-self: flex-end;
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: .3rem;
  border-radius: 4px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
  margin-bottom: 1.5rem;
}
.right-sidebar-close:hover {
  background: var(--surface2);
  color: var(--text);
}
.right-sidebar-close svg {
  width: 18px;
  height: 18px;
}

.right-sidebar-avatar {
  width: 90px;
  height: 90px;
  border-radius: 50%;
  border: 2px solid var(--accent);
  margin-bottom: 1.5rem;
}

.right-sidebar-name {
  font-family: var(--mono);
  font-size: 1.2rem;
  color: var(--text);
  margin-bottom: .5rem;
  text-align: center;
}

.right-sidebar-contributions {
  font-size: .85rem;
  color: var(--text-dim);
  margin-bottom: 2rem;
  text-align: center;
}

.right-sidebar-link {
  display: inline-flex;
  align-items: center;
  gap: .5rem;
  background: var(--surface2);
  color: var(--text);
  border: 1px solid var(--border);
  padding: .6rem 1.2rem;
  border-radius: 6px;
  text-decoration: none;
  font-size: .9rem;
  font-weight: 600;
  transition: background .15s, border-color .15s, color .15s;
}
.right-sidebar-link:hover {
  background: var(--surface);
  border-color: var(--accent);
  color: var(--accent);
  text-decoration: none;
}
.right-sidebar-link svg {
  width: 16px;
  height: 16px;
}

.sidebar-footer-pfp {
  width: 48px;
  height: 48px;
  border-radius: 50%;
  border: 3px solid var(--surface);
  position: absolute;
  left: 0;
  top: 50%;
  transform: translateY(-50%);
  margin-top: -0.4rem;
  z-index: 2;
  box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}
.sidebar-footer-pane {
  background: var(--bg);
  border-radius: 12px;
  padding: 0.5rem 1rem 1.5rem 2.5rem;
  text-align: left;
  color: var(--text-dim);
  font-size: .85rem;
  flex: 1;
  flex-shrink: 0;
  overflow: hidden;
  transition: opacity .25s ease, padding .25s ease, margin .25s ease, max-height .25s ease;
  max-height: 100px;
  opacity: 1;
}
body.sidebar-collapsed .sidebar-footer-pane {
  max-height: 0;
  opacity: 0;
  padding: 0 0.5rem;
  margin: 0;
}

#sidebar-login-btn {
  padding-bottom: 0.2rem;
  margin-bottom: 0.5rem;
}

/* ── Header Pane ── */
.header-pane {
  background: var(--surface);
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 0rem;
  flex-shrink: 0;
  width: 100%;
}

