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

body {
  display: flex;
  height: 100vh;
  font-family: "Segoe UI", system-ui, sans-serif;
  background: #f0f2f5;
  color: #1a1a2e;
  overflow: hidden;
}

/* ── Hamburger (mobile only) ── */
#menu-toggle {
  display: none;
  position: fixed;
  top: 12px; left: 12px;
  z-index: 300;
  width: 42px; height: 42px;
  border-radius: 10px;
  border: none;
  background: #0f3460;
  color: #fff;
  font-size: 20px;
  cursor: pointer;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 10px #0004;
}

/* ── Overlay (mobile) ── */
#overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: #0007;
  z-index: 150;
}
#overlay.active { display: block; }

/* ── Sidebar ── */
#sidebar {
  width: 280px;
  min-width: 220px;
  background: #0f3460;
  color: #e2e8f0;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  flex-shrink: 0;
  z-index: 200;
  transition: transform 0.28s ease;
}

.sidebar-header {
  padding: 16px 14px 10px;
  background: #0a2744;
  flex-shrink: 0;
}

.logo-row {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  margin-bottom: 12px;
}
.logo-ajkd {
  display: block;
  font-size: 26px;
  font-weight: 800;
  letter-spacing: 3px;
  color: #63b3ed;
}
.logo-sub {
  font-size: 11px;
  color: #a0aec0;
  letter-spacing: 0.3px;
}
#sidebar-close {
  display: none;
  background: none;
  border: none;
  color: #90cdf4;
  font-size: 18px;
  cursor: pointer;
  padding: 2px 6px;
  line-height: 1;
}

.search-wrap { position: relative; }
#search {
  width: 100%;
  padding: 8px 12px;
  border-radius: 6px;
  border: none;
  background: #1a3a5c;
  color: #e2e8f0;
  font-size: 13px;
  outline: none;
}
#search::placeholder { color: #718096; }
#search:focus { background: #1e4976; box-shadow: 0 0 0 2px #63b3ed55; }

#search-results {
  position: absolute;
  top: calc(100% + 4px);
  left: 0; right: 0;
  background: #1e3a5f;
  border-radius: 6px;
  list-style: none;
  z-index: 500;
  box-shadow: 0 8px 24px #0008;
  max-height: 280px;
  overflow-y: auto;
}
#search-results li a {
  display: block;
  padding: 8px 12px;
  color: #e2e8f0;
  text-decoration: none;
  font-size: 13px;
  border-bottom: 1px solid #2d5080;
}
#search-results li a:hover { background: #2a5a8a; }

/* ── Tree ── */
#tree {
  overflow-y: auto;
  flex: 1;
  padding: 8px 0 16px;
  scrollbar-width: thin;
  scrollbar-color: #2d5080 transparent;
}

/* Level 1: main category */
#tree > details { border-bottom: 1px solid #1a3a5c; }
#tree > details > summary {
  padding: 10px 14px;
  cursor: pointer;
  font-size: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.6px;
  color: #90cdf4;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
#tree > details > summary::-webkit-details-marker { display: none; }
#tree > details > summary::before {
  content: "▶";
  font-size: 9px;
  transition: transform 0.2s;
  color: #63b3ed;
  flex-shrink: 0;
}
#tree > details[open] > summary::before { transform: rotate(90deg); }
#tree > details > summary:hover { background: #1a3a5c; }

/* Level 2: sub-category */
#tree > details > details {
  border-top: 1px solid #1a3a5c80;
}
#tree > details > details > summary {
  padding: 8px 14px 8px 30px;
  cursor: pointer;
  font-size: 11px;
  font-weight: 600;
  text-transform: none;
  letter-spacing: 0.2px;
  color: #68d0c8;
  list-style: none;
  display: flex;
  align-items: center;
  gap: 6px;
  user-select: none;
}
#tree > details > details > summary::-webkit-details-marker { display: none; }
#tree > details > details > summary::before {
  content: "▶";
  font-size: 8px;
  transition: transform 0.2s;
  color: #4fd1c5;
  flex-shrink: 0;
}
#tree > details > details[open] > summary::before { transform: rotate(90deg); }
#tree > details > details > summary:hover { background: #1a3a5c; }

#tree ul { list-style: none; }
#tree ul li a {
  display: block;
  padding: 7px 14px 7px 26px;
  color: #cbd5e0;
  text-decoration: none;
  font-size: 13px;
  line-height: 1.4;
  border-left: 3px solid transparent;
  transition: background 0.15s, color 0.15s;
}
/* Extra indent for disease links inside sub-categories */
#tree > details > details ul li a { padding-left: 40px; }
#tree ul li a:hover { background: #1a3a5c; color: #fff; border-left-color: #4299e1; }
#tree ul li.active a { background: #1a4a7a; color: #fff; border-left-color: #63b3ed; font-weight: 600; }

/* ── Main content ── */
#content {
  flex: 1;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  min-width: 0;
}

#viewer { display: none; width: 100%; height: 100%; border: none; }

#welcome {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 40px 24px;
}
.welcome-inner { max-width: 560px; text-align: center; }
.welcome-inner h1 { font-size: 26px; font-weight: 800; color: #0f3460; margin-bottom: 16px; }
.welcome-inner p { color: #4a5568; line-height: 1.7; margin-bottom: 12px; font-size: 15px; }

.stats { display: flex; justify-content: center; gap: 24px; margin-top: 32px; flex-wrap: wrap; }
.stat { text-align: center; color: #4a5568; font-size: 13px; }
.stat span { display: block; font-size: 26px; font-weight: 800; color: #0f3460; }

/* ── Mobile ── */
@media (max-width: 767px) {
  #sidebar {
    position: fixed;
    top: 0; left: 0; bottom: 0;
    width: 300px;
    transform: translateX(-100%);
    box-shadow: 4px 0 24px #0005;
  }
  #sidebar.open { transform: translateX(0); }
  #sidebar-close { display: block; }
  #menu-toggle { display: flex; }
  #content { width: 100%; }
  #welcome { padding: 70px 20px 30px; }
  .welcome-inner h1 { font-size: 20px; }
}
