@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800&family=Fira+Code:wght@400;500&display=swap');

:root {
  --bg-base: #0d0f14;
  --bg-surface: #141720;
  --bg-card: #1a1e2b;
  --bg-elevated: #1f2535;
  --accent-orange: #ff6b2b;
  --accent-amber: #f59e0b;
  --accent-glow: rgba(255, 107, 43, 0.15);
  --text-primary: #f0f2f8;
  --text-secondary: #8b95b0;
  --text-muted: #4a5068;
  --border: #1e2540;
  --border-bright: #2a3050;
  --code-bg: #0b0e18;
  --sidebar-w: 280px;
  --header-h: 64px;
  --radius: 12px;
  --radius-sm: 8px;
}

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

html {
  scroll-behavior: smooth;
}

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-base);
  color: var(--text-primary);
  display: flex;
  flex-direction: column;
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== HEADER ===== */
header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: var(--header-h);
  background: rgba(13, 15, 20, 0.85);
  backdrop-filter: blur(20px);
  border-bottom: 1px solid var(--border);
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0 24px;
  z-index: 100;
}

.header-logo {
  display: flex;
  align-items: center;
  gap: 12px;
  text-decoration: none;
}

.logo-icon {
  width: 38px;
  height: 38px;
  background: linear-gradient(135deg, var(--accent-orange), var(--accent-amber));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  box-shadow: 0 0 20px rgba(255, 107, 43, 0.4);
}

.logo-name {
  font-size: 16px;
  font-weight: 700;
  background: linear-gradient(135deg, #fff 40%, var(--accent-orange));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.logo-tag {
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: 0.08em;
  text-transform: uppercase;
  margin-top: 1px;
}

.header-badge {
  background: var(--accent-glow);
  border: 1px solid rgba(255, 107, 43, 0.3);
  color: var(--accent-orange);
  font-size: 11px;
  font-weight: 600;
  padding: 4px 10px;
  border-radius: 20px;
  letter-spacing: 0.05em;
}

/* ===== LAYOUT ===== */
.layout {
  display: flex;
  padding-top: var(--header-h);
  min-height: 100vh;
}

/* ===== SIDEBAR ===== */
.sidebar {
  width: var(--sidebar-w);
  position: fixed;
  top: var(--header-h);
  left: 0;
  bottom: 0;
  background: var(--bg-surface);
  border-right: 1px solid var(--border);
  overflow-y: auto;
  padding: 24px 0 40px;
  scrollbar-width: thin;
  scrollbar-color: var(--border-bright) transparent;
}

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

.sidebar::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 2px;
}

.sidebar-section {
  margin-bottom: 8px;
}

.sidebar-section-title {
  font-size: 10px;
  font-weight: 700;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--text-muted);
  padding: 12px 20px 6px;
}

.sidebar-link {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 9px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 13.5px;
  font-weight: 450;
  border-left: 2px solid transparent;
  transition: all 0.18s ease;
  cursor: pointer;
}

.sidebar-link:hover {
  color: var(--text-primary);
  background: rgba(255, 255, 255, 0.04);
  border-left-color: var(--border-bright);
}

.sidebar-link.active {
  color: var(--accent-orange);
  background: var(--accent-glow);
  border-left-color: var(--accent-orange);
  font-weight: 600;
}

.sidebar-link .link-icon {
  font-size: 15px;
}

.sidebar-divider {
  height: 1px;
  background: var(--border);
  margin: 12px 20px;
}

/* ===== MAIN CONTENT ===== */
main {
  margin-left: var(--sidebar-w);
  flex: 1;
  padding: 48px 56px 80px;
  max-width: calc(100% - var(--sidebar-w));
}

/* ===== TAB PANELS ===== */
.tab-panel {
  display: none;
}

.tab-panel.active {
  display: block;
}

/* ===== HERO BANNER ===== */
.doc-hero {
  background: linear-gradient(135deg, var(--bg-card) 0%, #1a1530 100%);
  border: 1px solid var(--border-bright);
  border-radius: 16px;
  padding: 40px 48px;
  margin-bottom: 40px;
  position: relative;
  overflow: hidden;
}

.doc-hero::before {
  content: '';
  position: absolute;
  top: -60px;
  right: -60px;
  width: 240px;
  height: 240px;
  background: radial-gradient(circle, rgba(255, 107, 43, 0.12) 0%, transparent 70%);
  pointer-events: none;
}

.doc-hero-eyebrow {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.14em;
  text-transform: uppercase;
  color: var(--accent-orange);
  margin-bottom: 10px;
}

.doc-hero h1 {
  font-size: 32px;
  font-weight: 800;
  line-height: 1.2;
  background: linear-gradient(135deg, var(--text-primary) 60%, var(--accent-amber));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 12px;
}

.doc-hero p {
  color: var(--text-secondary);
  font-size: 15px;
  line-height: 1.6;
  max-width: 600px;
}

.hero-pills {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  margin-top: 20px;
}

.pill {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  color: var(--text-secondary);
  font-size: 12px;
  font-weight: 500;
  padding: 5px 12px;
  border-radius: 20px;
}

/* ===== CONTENT SECTIONS ===== */
.section {
  margin-bottom: 48px;
  scroll-margin-top: calc(var(--header-h) + 20px);
}

.section-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border);
}

.section-icon {
  width: 36px;
  height: 36px;
  background: var(--accent-glow);
  border: 1px solid rgba(255, 107, 43, 0.25);
  border-radius: 9px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  flex-shrink: 0;
}

.section-header h2 {
  font-size: 20px;
  font-weight: 700;
  color: var(--text-primary);
}

.section-header .section-tag {
  margin-left: auto;
  font-size: 10px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--text-muted);
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  padding: 3px 9px;
  border-radius: 5px;
}

/* ===== API ENDPOINT CARDS ===== */
.endpoint-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  margin-bottom: 16px;
  overflow: hidden;
  transition: border-color 0.2s;
}

.endpoint-card:hover {
  border-color: var(--border-bright);
}

.endpoint-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 18px;
  cursor: pointer;
  user-select: none;
}

.method-badge {
  font-family: 'Fira Code', monospace;
  font-size: 11px;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  letter-spacing: 0.06em;
  min-width: 54px;
  text-align: center;
}

.method-get {
  background: rgba(34, 197, 94, 0.15);
  color: #4ade80;
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.method-post {
  background: rgba(59, 130, 246, 0.15);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.method-put {
  background: rgba(245, 158, 11, 0.15);
  color: #fbbf24;
  border: 1px solid rgba(245, 158, 11, 0.25);
}

.method-del {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.25);
}

.method-ws {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.25);
}

.endpoint-path {
  font-family: 'Fira Code', monospace;
  font-size: 13.5px;
  color: var(--text-primary);
  flex: 1;
}

.endpoint-desc {
  font-size: 12.5px;
  color: var(--text-muted);
}

.auth-badge {
  font-size: 11px;
  padding: 3px 8px;
  border-radius: 5px;
  background: rgba(245, 158, 11, 0.12);
  border: 1px solid rgba(245, 158, 11, 0.25);
  color: var(--accent-amber);
}

.endpoint-body {
  display: none;
  border-top: 1px solid var(--border);
  padding: 18px;
}

.endpoint-body.open {
  display: block;
}

.endpoint-section-label {
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--text-muted);
  margin-bottom: 8px;
  margin-top: 14px;
}

.endpoint-section-label:first-child {
  margin-top: 0;
}

/* ===== CODE BLOCKS ===== */
pre {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 16px 20px;
  overflow-x: auto;
  font-family: 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.7;
  color: #c9d1d9;
  margin: 0;
}

code {
  font-family: 'Fira Code', monospace;
  font-size: 12.5px;
  background: var(--code-bg);
  border: 1px solid var(--border);
  padding: 2px 7px;
  border-radius: 5px;
  color: #c9d1d9;
}

pre code {
  background: none;
  border: none;
  padding: 0;
  font-size: inherit;
}

.json-key {
  color: #79c0ff;
}

.json-str {
  color: #a5d6ff;
}

.json-num {
  color: #f2cc60;
}

.json-bool {
  color: #ff7b72;
}

.json-null {
  color: #ff7b72;
}

/* ===== TABLES ===== */
.table-wrap {
  overflow-x: auto;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  margin-bottom: 8px;
}

table {
  width: 100%;
  border-collapse: collapse;
  font-size: 13px;
}

thead {
  background: var(--bg-elevated);
}

thead th {
  padding: 11px 16px;
  text-align: left;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--text-muted);
}

tbody tr {
  border-top: 1px solid var(--border);
}

tbody tr:hover {
  background: rgba(255, 255, 255, 0.02);
}

tbody td {
  padding: 11px 16px;
  color: var(--text-secondary);
  vertical-align: top;
}

tbody td:first-child {
  color: var(--text-primary);
}

/* ===== INFO BOXES ===== */
.info-box {
  display: flex;
  gap: 12px;
  padding: 14px 16px;
  border-radius: var(--radius-sm);
  margin: 12px 0;
  font-size: 13.5px;
  line-height: 1.6;
}

.info-box.note {
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93c5fd;
}

.info-box.tip {
  background: rgba(34, 197, 94, 0.08);
  border: 1px solid rgba(34, 197, 94, 0.2);
  color: #86efac;
}

.info-box.warn {
  background: rgba(245, 158, 11, 0.08);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fcd34d;
}

.info-box-icon {
  font-size: 16px;
  flex-shrink: 0;
  margin-top: 1px;
}

/* ===== USER DOC CARDS ===== */
.role-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
  gap: 16px;
  margin-bottom: 32px;
}

.role-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  transition: all 0.22s ease;
}

.role-card:hover {
  border-color: var(--accent-orange);
  box-shadow: 0 0 24px rgba(255, 107, 43, 0.08);
  transform: translateY(-2px);
}

.role-card-icon {
  width: 48px;
  height: 48px;
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  margin-bottom: 14px;
}

.role-card.student .role-card-icon {
  background: rgba(59, 130, 246, 0.12);
  border: 1px solid rgba(59, 130, 246, 0.25);
}

.role-card.staff .role-card-icon {
  background: rgba(34, 197, 94, 0.12);
  border: 1px solid rgba(34, 197, 94, 0.25);
}

.role-card.admin .role-card-icon {
  background: rgba(255, 107, 43, 0.12);
  border: 1px solid rgba(255, 107, 43, 0.25);
}

.role-card h3 {
  font-size: 16px;
  font-weight: 700;
  margin-bottom: 6px;
}

.role-card p {
  font-size: 13px;
  color: var(--text-secondary);
  line-height: 1.55;
}

/* ===== STEP LIST ===== */
.steps {
  list-style: none;
}

.steps li {
  display: flex;
  gap: 14px;
  padding: 14px 0;
  border-bottom: 1px solid var(--border);
  font-size: 14px;
  color: var(--text-secondary);
  line-height: 1.6;
}

.steps li:last-child {
  border-bottom: none;
}

.step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--accent-glow);
  border: 1px solid rgba(255, 107, 43, 0.3);
  color: var(--accent-orange);
  font-size: 12px;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 2px;
}

/* ===== DEV DOC ===== */
.tech-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 12px;
  margin-bottom: 8px;
}

.tech-card {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 14px 16px;
  display: flex;
  align-items: flex-start;
  gap: 10px;
}

.tech-card-icon {
  font-size: 22px;
  flex-shrink: 0;
}

.tech-card-label {
  font-size: 11px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.07em;
  margin-bottom: 2px;
}

.tech-card-value {
  font-size: 13.5px;
  font-weight: 600;
  color: var(--text-primary);
}

.tree {
  background: var(--code-bg);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 18px 22px;
  font-family: 'Fira Code', monospace;
  font-size: 12.5px;
  line-height: 1.8;
  color: #c9d1d9;
  overflow-x: auto;
}

.tree .dir {
  color: #79c0ff;
  font-weight: 600;
}

.tree .file {
  color: #c9d1d9;
}

.tree .cmt {
  color: #4a5068;
}

.arch-flow {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 24px;
  margin: 12px 0;
  text-align: center;
}

.arch-layer {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0;
  flex-wrap: wrap;
}

.arch-box {
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  padding: 10px 18px;
  font-size: 13px;
  font-weight: 600;
  color: var(--text-primary);
}

.arch-arrow {
  color: var(--accent-orange);
  font-size: 18px;
  margin: 0 10px;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-base);
}

::-webkit-scrollbar-thumb {
  background: var(--border-bright);
  border-radius: 4px;
}

/* ===== FOOTER ===== */
footer {
  margin-left: var(--sidebar-w);
  border-top: 1px solid var(--border);
  padding: 20px 56px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12.5px;
  color: var(--text-muted);
}

/* ===== SEARCH BAR ===== */
.search-wrap {
  padding: 12px 16px 8px;
}

.search-input {
  width: 100%;
  background: var(--bg-elevated);
  border: 1px solid var(--border-bright);
  border-radius: 8px;
  color: var(--text-primary);
  font-family: 'Inter', sans-serif;
  font-size: 12.5px;
  padding: 8px 12px 8px 32px;
  outline: none;
  transition: border-color 0.2s;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' fill='%234a5068' viewBox='0 0 16 16'%3E%3Cpath d='M11.742 10.344a6.5 6.5 0 1 0-1.397 1.398h-.001c.03.04.062.078.098.115l3.85 3.85a1 1 0 0 0 1.415-1.414l-3.85-3.85a1.007 1.007 0 0 0-.115-.099zm-5.242 1.656a5.5 5.5 0 1 1 0-11 5.5 5.5 0 0 1 0 11z'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: 10px center;
}

.search-input:focus {
  border-color: rgba(255, 107, 43, 0.4);
}

/* ===== SYSTEM DIAGRAMS ===== */
.diagram-wrapper {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius);
  padding: 16px;
  margin-bottom: 32px;
  text-align: center;
  overflow-x: auto;
}

.diagram-img {
  max-width: 100%;
  height: auto;
  border-radius: var(--radius-sm);
  display: block;
  margin: 0 auto;
}

/* ===== RESPONSIVE ===== */
@media (max-width: 900px) {
  .sidebar {
    display: none;
  }

  main {
    margin-left: 0;
    max-width: 100%;
    padding: 32px 20px 60px;
  }

  footer {
    margin-left: 0;
  }
}