/* ===================================================================
   Handbook Human Resource, Tempat Belajar
   Design system: palet hijau (#043e0a / #066e0a), font Manrope
   =================================================================== */

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

:root {
  --primary-dark: #043e0a;
  --primary-green: #066e0a;
  --tint-light: #e8f3e6;
  --tint-mid: #b9d9b4;
  --paper: #faf8f3;
  --paper-alt: #f2efe6;
  --text-body: #1c2b1c;
  --text-muted: #4b5c4b;
  --border-soft: #d9e6d6;
  --code-bg: #0d2410;
  --font: 'Manrope', -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;

  --sidebar-width: 300px;
}

* { box-sizing: border-box; }

html, body {
  margin: 0;
  padding: 0;
  font-family: var(--font);
  background: var(--paper);
  color: var(--text-body);
  line-height: 1.7;
}

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

/* ---------- Layout shell ---------- */
.app {
  display: flex;
  min-height: 100vh;
}

/* ---------- Sidebar ---------- */
.sidebar {
  width: var(--sidebar-width);
  flex-shrink: 0;
  background: var(--primary-dark);
  color: var(--paper);
  padding: 24px 0 60px;
  overflow-y: auto;
  height: 100vh;
  position: sticky;
  top: 0;
}

.sidebar-brand {
  display: block;
  padding: 0 24px 20px;
  font-weight: 800;
  font-size: 1.05rem;
  color: #fff;
  border-bottom: 1px solid rgba(255,255,255,0.12);
  margin-bottom: 12px;
}
.sidebar-brand span {
  display: block;
  font-weight: 500;
  font-size: 0.78rem;
  color: var(--tint-mid);
  margin-top: 2px;
}
.sidebar-brand:hover { text-decoration: none; opacity: 0.9; }

.nav-section {
  border-bottom: 1px solid rgba(255,255,255,0.08);
}
.nav-section-title {
  cursor: pointer;
  list-style: none;
  padding: 12px 24px;
  margin: 0;
  font-size: 0.78rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  text-transform: uppercase;
  color: var(--tint-mid);
  opacity: 0.9;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.nav-section-title::-webkit-details-marker { display: none; }
.nav-section-title::after {
  content: '›';
  transform: rotate(90deg);
  transition: transform 0.15s ease;
  font-size: 0.95rem;
  opacity: 0.8;
}
.nav-section[open] > .nav-section-title::after { transform: rotate(270deg); }
.nav-section-title:hover { background: rgba(255,255,255,0.05); opacity: 1; }
.nav-section-standalone {
  padding-top: 4px;
  border-bottom: none;
}
.nav-section-standalone a.bab-link {
  font-weight: 700;
  color: #eafbe8;
  padding: 12px 24px;
}
.nav-section-standalone a.bab-link.active { color: #fff; }

.sidebar nav a.bab-link {
  display: block;
  padding: 9px 24px;
  font-size: 0.86rem;
  color: var(--tint-mid);
  border-left: 3px solid transparent;
}
.sidebar nav a.bab-link.active {
  color: #fff;
  background: var(--primary-green);
  border-left-color: #fff;
  font-weight: 700;
}
.sidebar nav a.bab-link:hover { color: #fff; text-decoration: none; }

/* ---------- Search box (sidebar) ---------- */
.sidebar-search {
  position: relative;
  padding: 0 20px 16px;
  margin-bottom: 8px;
  border-bottom: 1px solid rgba(255,255,255,0.12);
}
.sidebar-search input {
  width: 100%;
  box-sizing: border-box;
  padding: 9px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255,255,255,0.18);
  background: rgba(255,255,255,0.08);
  color: #fff;
  font-family: var(--font);
  font-size: 0.85rem;
}
.sidebar-search input::placeholder { color: var(--tint-mid); opacity: 0.8; }
.sidebar-search input:focus {
  outline: none;
  border-color: var(--tint-mid);
  background: rgba(255,255,255,0.14);
}
.search-results {
  display: none;
  position: absolute;
  left: 20px;
  right: 20px;
  top: calc(100% - 12px);
  background: #fff;
  color: var(--text-body);
  border-radius: 10px;
  box-shadow: 0 12px 30px rgba(0,0,0,0.35);
  max-height: 340px;
  overflow-y: auto;
  z-index: 50;
}
.search-results.open { display: block; }
.search-results a {
  display: block;
  padding: 10px 14px;
  font-size: 0.85rem;
  color: var(--text-body);
  border-bottom: 1px solid var(--border-soft);
}
.search-results a:last-child { border-bottom: none; }
.search-results a:hover { background: var(--tint-light); text-decoration: none; }
.search-results a .term-name { font-weight: 700; color: var(--primary-dark); display: block; }
.search-results a .term-cat { font-size: 0.72rem; color: var(--text-muted); }
.search-results .no-result { padding: 12px 14px; font-size: 0.82rem; color: var(--text-muted); }

/* ---------- Term cards ---------- */
.term-card {
  background: #fff;
  border: 1px solid var(--border-soft);
  border-left: 4px solid var(--primary-green);
  border-radius: 12px;
  padding: 18px 22px;
  margin: 0 0 18px;
  scroll-margin-top: 20px;
}
.term-card-header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 10px;
}
.term-icon-wrap {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--tint-light);
  display: flex;
  align-items: center;
  justify-content: center;
}
.term-icon {
  width: 22px;
  height: 22px;
  color: var(--primary-green);
}
.term-card h3 {
  margin: 0;
  font-size: 1.08rem;
  color: var(--primary-dark);
}
.term-card .term-label {
  font-size: 0.72rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--primary-green);
  display: block;
  margin-bottom: 2px;
}
.term-card p { margin: 0 0 10px; font-size: 0.94rem; }
.term-card p:last-child { margin-bottom: 0; }

.category-intro {
  color: var(--text-muted);
  margin-bottom: 24px;
}

.sidebar-toggle {
  display: none;
}

/* ---------- Main content ---------- */
.main {
  flex: 1;
  max-width: 860px;
  margin: 0 auto;
  padding: 56px 40px 100px;
}

.eyebrow {
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--primary-green);
  text-transform: uppercase;
  letter-spacing: 0.06em;
  margin-bottom: 6px;
}

h1 {
  font-weight: 800;
  font-size: 2.1rem;
  color: var(--primary-dark);
  margin: 0 0 28px;
  line-height: 1.25;
}
h2 {
  font-weight: 800;
  font-size: 1.5rem;
  color: var(--primary-dark);
  margin: 44px 0 16px;
  padding-bottom: 8px;
  border-bottom: 2px solid var(--tint-light);
}
h3 {
  font-weight: 700;
  font-size: 1.15rem;
  color: var(--primary-dark);
  margin: 30px 0 12px;
}
p { margin: 0 0 16px; }
strong { color: var(--primary-dark); }

ul, ol { margin: 0 0 16px; padding-left: 22px; }
li { margin-bottom: 6px; }

/* ---------- Tables ---------- */
table {
  width: 100%;
  border-collapse: collapse;
  margin: 20px 0 28px;
  font-size: 0.92rem;
}
th, td {
  text-align: left;
  padding: 10px 14px;
  border: 1px solid var(--border-soft);
  vertical-align: top;
}
th {
  background: var(--tint-light);
  color: var(--primary-dark);
  font-weight: 700;
}
tr:nth-child(even) td { background: rgba(232,243,230,0.35); }

/* Mobile: stacked card tables */
@media (max-width: 640px) {
  table, thead, tbody, th, td, tr { display: block; }
  thead { display: none; }
  table { border: none; margin: 16px 0; }
  tr {
    border: 1px solid var(--border-soft);
    border-radius: 10px;
    margin-bottom: 12px;
    padding: 8px 0;
    background: #fff;
  }
  td {
    border: none;
    padding: 6px 14px;
    position: relative;
  }
  td::before {
    content: attr(data-label);
    display: block;
    font-weight: 700;
    font-size: 0.75rem;
    color: var(--primary-green);
    text-transform: uppercase;
    letter-spacing: 0.03em;
    margin-bottom: 2px;
  }
}

/* ---------- Callout boxes ---------- */
.box {
  border-radius: 12px;
  padding: 18px 22px;
  margin: 22px 0;
  border-left: 4px solid var(--primary-green);
  background: var(--tint-light);
}
.box-title {
  font-weight: 800;
  color: var(--primary-dark);
  margin-bottom: 6px;
  display: block;
}
.box.tahukah { border-left-color: var(--primary-green); }
.box.tips { border-left-color: #b8860b; background: #faf3e2; }
.box.tips .box-title { color: #8a6607; }
.box.studycase { border-left-color: var(--primary-dark); background: #eef4ec; }
.box.insight {
  background: var(--primary-dark);
  color: var(--paper);
  border-left: none;
  border-radius: 14px;
}
.box.insight .box-title { color: #fff; }

/* ---------- Visual / diagram frame ---------- */
.visual {
  margin: 28px 0;
  padding: 20px;
  background: #fff;
  border: 1px solid var(--border-soft);
  border-radius: 14px;
  text-align: center;
}
.visual svg { max-width: 100%; height: auto; }
.visual svg .th { font-family: var(--font); font-weight: 700; font-size: 14px; fill: currentColor; }
.visual svg .ts { font-family: var(--font); font-weight: 500; font-size: 11.5px; fill: currentColor; }

/* palette-mapped node classes used inside diagrams */
.visual svg .c-green rect, .visual svg .c-green polygon { fill: var(--primary-green); stroke: var(--primary-dark); color: #fff; }
.visual svg .c-teal rect, .visual svg .c-teal polygon { fill: var(--tint-light); stroke: var(--primary-green); color: var(--primary-dark); }
.visual svg .c-coral rect, .visual svg .c-coral polygon { fill: #b8860b; stroke: #8a6607; color: #fff; }
.visual svg .c-gray rect, .visual svg .c-gray polygon { fill: #eee; stroke: #999; color: #333; }
.visual svg .box rect { fill: #fff; stroke: var(--border-soft); color: var(--text-body); }
.visual svg line, .visual svg path.arr { stroke: var(--primary-green); }

/* ---------- Code ---------- */
pre {
  background: var(--code-bg);
  color: #d9f2d6;
  padding: 18px 20px;
  border-radius: 10px;
  overflow-x: auto;
  font-family: 'Fira Code', monospace;
  font-size: 0.85rem;
  margin: 20px 0;
}
code {
  font-family: 'Fira Code', monospace;
  background: var(--tint-light);
  padding: 2px 6px;
  border-radius: 4px;
  font-size: 0.88em;
}
pre code { background: none; padding: 0; }

/* ---------- Learning objectives ---------- */
.objectives {
  background: var(--paper-alt);
  border-radius: 14px;
  padding: 22px 26px;
  margin: 0 0 32px;
  border: 1px solid var(--border-soft);
}
.objectives h3 { margin-top: 0; }

/* ---------- Footer nav within page (none per spec) ---------- */
.emoji { font-size: 1.1em; }

/* ---------- Hamburger for mobile ---------- */
.mobile-topbar {
  display: none;
}
.hamburger {
  display: none;
}

@media (max-width: 900px) {
  .app { flex-direction: column; }
  .sidebar {
    position: fixed;
    left: 0; top: 0;
    height: 100vh;
    width: 300px;
    transform: translateX(-100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 40;
    box-shadow: 4px 0 24px rgba(0,0,0,0.3);
  }
  .sidebar.open { transform: translateX(0); }
  .sidebar-brand {
    padding: 18px 20px 20px 68px; /* Leave space for fixed 42px toggle button on left */
  }

  .mobile-topbar {
    display: block;
  }
  .hamburger {
    display: flex;
    align-items: center;
    justify-content: center;
    position: fixed;
    top: 14px;
    left: 14px;
    z-index: 50;
    width: 42px;
    height: 42px;
    background: var(--primary-dark);
    color: #fff;
    border: 1px solid rgba(255, 255, 255, 0.2);
    border-radius: 10px;
    box-shadow: 0 4px 14px rgba(0,0,0,0.25);
    cursor: pointer;
    padding: 0;
    transition: background 0.2s ease, transform 0.15s ease;
  }
  .hamburger:hover {
    background: var(--primary-green);
  }
  .hamburger:active {
    transform: scale(0.94);
  }
  .hamburger svg {
    width: 22px;
    height: 22px;
    stroke: currentColor;
  }
  .hamburger .icon-hamburger {
    display: block;
  }
  .hamburger .icon-close {
    display: none;
  }
  .hamburger.active,
  body.menu-open .hamburger {
    background: var(--primary-green);
    border-color: rgba(255, 255, 255, 0.35);
  }
  .hamburger.active .icon-hamburger,
  body.menu-open .hamburger .icon-hamburger {
    display: none !important;
  }
  .hamburger.active .icon-close,
  body.menu-open .hamburger .icon-close {
    display: block !important;
  }

  .main { padding: 72px 20px 80px; }
  h1 { font-size: 1.6rem; }
}

/* ===================== PASSWORD GATE ===================== */
html.hb-locked, html.hb-locked body{ overflow:hidden; height:100%; }
html.hb-locked .app, html.hb-locked .mobile-topbar{
  filter: blur(10px) saturate(0.9);
  pointer-events: none;
  user-select: none;
  transition: filter .2s ease;
}
#hb-auth-overlay{
  position:fixed; inset:0; z-index:9999;
  display:none;
  align-items:center; justify-content:center;
  background: rgba(4,62,10,0.6);
  backdrop-filter: blur(3px);
  padding: 20px;
}
html.hb-locked #hb-auth-overlay{ display:flex; }
#hb-auth-card{
  background: var(--paper);
  border: 1px solid var(--border-soft);
  border-radius: 16px;
  padding: 34px 30px 28px;
  width: min(360px, 100%);
  box-shadow: 0 20px 60px rgba(4,62,10,0.35);
  text-align: center;
  font-family: var(--font);
  animation: hb-pop .18s ease;
}
@keyframes hb-pop{ from{ opacity:0; transform:translateY(6px) scale(.98); } to{ opacity:1; transform:translateY(0) scale(1); } }
#hb-auth-mark{
  width:44px; height:44px; border-radius:12px; margin:0 auto 16px;
  background:linear-gradient(135deg, #043e0a, #066e0a);
  display:flex; align-items:center; justify-content:center;
  color:#fff; font-family: var(--font); font-weight:800; font-size:18px;
  box-shadow: 0 4px 12px rgba(4,62,10,0.25);
}
#hb-auth-card h2{
  font-family: var(--font); font-weight:700; font-size:18px;
  color: var(--text-body); margin: 0 0 6px;
}
#hb-auth-card p{
  font-size: 13.5px; color: var(--text-muted); margin: 0 0 20px; line-height:1.5;
}
#hb-auth-form{ display:flex; flex-direction:column; gap:10px; }
#hb-auth-input{
  width:100%; padding:11px 14px; border-radius:9px;
  border:1.5px solid var(--border-soft); background:var(--paper-alt);
  font-family: var(--font); font-size:14.5px; color:var(--text-body);
  outline:none; text-align:center; letter-spacing:.03em;
  transition: border-color .15s ease;
}
#hb-auth-input:focus{ border-color: var(--primary-green); }
#hb-auth-submit{
  width:100%; padding:11px 14px; border-radius:9px; border:none; cursor:pointer;
  background: var(--primary-green); color:#fff;
  font-family: var(--font); font-weight:700; font-size:14px;
  transition: background .15s ease, transform .1s ease;
}
#hb-auth-submit:hover{ background: var(--primary-dark); }
#hb-auth-submit:active{ transform: scale(.98); }
#hb-auth-error{
  font-size:12.5px; color:#B91C1C; min-height:16px; margin-top:2px;
  font-family: var(--font); font-weight:600;
}
