/* TerjemahBuku app.html: shell layout dengan sidebar.
 * Mode: Operate · density 6 · scanability dulu, brand di detail presisi.
 * Sidebar di desktop fixed kiri; di mobile (<768px) jadi bottom nav bar.
 * File ini ADITIF — tidak meng-override css/style.css kecuali yang perlu
 * untuk layout shell.
 */

:root { --sbw: 228px; }

/* ---------- shell ---------- */
.app-shell { display: flex; min-height: 100dvh; }
.app-main { flex: 1; min-width: 0; margin-left: var(--sbw); }

/* ---------- sidebar (desktop) ---------- */
.sidebar {
  position: fixed;
  inset: 0 auto 0 0;
  width: var(--sbw);
  display: flex;
  flex-direction: column;
  background: var(--surface);
  border-right: 1px solid var(--line);
  z-index: 10;
  padding: 18px 12px 14px;
}
.sidebar[hidden] { display: none; }

.side-brand {
  display: flex; align-items: center; gap: 10px;
  color: var(--accent);
  padding: 4px 10px 16px;
}
.side-brand span {
  font-family: var(--serif);
  font-weight: 600;
  font-size: 1.22rem;
  letter-spacing: -0.02em;
}

.side-nav { display: flex; flex-direction: column; gap: 4px; }

.side-item {
  position: relative;
  display: flex; align-items: center; gap: 12px;
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  background: none; border: 0; border-radius: var(--radius-ctl);
  color: var(--muted);
  font-size: 0.95rem; font-family: var(--sans);
  cursor: pointer; text-align: left;
  transition: background 0.18s var(--ease-out), color 0.18s var(--ease-out);
}
.side-item:hover { background: var(--surface2); color: var(--ink); }
.side-item:active { transform: scale(0.99); }
.side-item svg { flex: none; }
a.side-item { text-decoration: none; }
/* detail presisi: bilah emas penanda item aktif, fade+scale halus */
.side-item::before {
  content: '';
  position: absolute; left: -12px; top: 10px; bottom: 10px; width: 3px;
  border-radius: 3px;
  background: var(--accent);
  opacity: 0; transform: scaleY(0.55);
  transition: opacity 0.2s var(--ease-out), transform 0.28s var(--ease-out);
  pointer-events: none;
}
.side-item.active {
  color: var(--ink);
  background: var(--surface2);
  font-weight: 600;
}
.side-item.active::before { opacity: 1; transform: none; }

.side-sep { border: 0; border-top: 1px solid var(--line); margin: 10px 4px; }
.side-foot {
  margin-top: auto;
  padding: 12px 10px 2px;
  font-size: 0.75rem;
  color: var(--muted);
  line-height: 1.5;
}

/* gate auth/paywall: sidebar disembunyikan, konten full-width */
body.no-sidebar .app-main { margin-left: 0; }
body.no-sidebar .sidebar { display: none; }

/* ---------- mobile (<768px): sidebar jadi bottom nav bar ---------- */
@media (max-width: 767.98px) {
  .app-main { margin-left: 0; }
  body.no-sidebar .app-main { margin-left: 0; }

  .sidebar {
    top: auto; right: 0; bottom: 0; left: 0;
    width: auto; height: auto;
    flex-direction: row;
    border-right: 0;
    border-top: 1px solid var(--line);
    padding: 6px 4px calc(6px + env(safe-area-inset-bottom));
    background: color-mix(in srgb, var(--surface) 96%, transparent);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
  }
  .side-brand,
  .side-sep,
  .side-foot { display: none; }
  /* dua <nav> diratakan jadi satu baris */
  .side-nav { display: contents; }
  .side-item {
    flex: 1 1 0;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 8px 2px 6px;
    font-size: 0.66rem;
    text-align: center;
    border-radius: 8px;
  }
  .side-item svg { width: 21px; height: 21px; }
  .side-item.active { background: none; color: var(--accent); }
  .side-item.active::before { display: none; }

  /* toast naik di atas bottom nav */
  .toast { bottom: calc(86px + env(safe-area-inset-bottom)); }
}

/* ---------- password visibility toggle ---------- */
.pw-wrap { position: relative; }
.pw-wrap input { padding-right: 46px; }
.pw-toggle {
  position: absolute;
  right: 5px;
  top: 50%;
  transform: translateY(-50%);
  background: none; border: 0; border-radius: 8px;
  color: var(--muted);
  padding: 8px;
  cursor: pointer;
  display: inline-flex; align-items: center; justify-content: center;
  transition: color 0.15s var(--ease-out), background 0.15s var(--ease-out);
}
.pw-toggle:hover { color: var(--ink); background: color-mix(in srgb, var(--ink) 8%, transparent); }
.pw-toggle:focus-visible { outline: 2px solid var(--accent); outline-offset: 1px; }
.pw-toggle svg { display: block; }

/* ---------- custom dropdown (pengganti <select> native) ---------- */
.cs { position: relative; }
/* select asli: tetap di DOM + sinkron dua arah, disembunyikan visual saja */
.cs-native {
  position: absolute !important;
  width: 1px; height: 1px;
  margin: 0; padding: 0; border: 0;
  opacity: 0; pointer-events: none;
  overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap;
}
.cs-trigger {
  width: 100%;
  display: flex; align-items: center; gap: 10px;
  background: var(--bg); color: var(--ink);
  border: 1px solid var(--line); border-radius: var(--radius-ctl);
  padding: 11px 13px; margin: 6px 0;
  font-size: 0.95rem; font-family: var(--sans); text-align: left;
  cursor: pointer;
  transition: border-color 0.2s var(--ease-out);
}
.cs-trigger:hover { border-color: var(--muted); }
.cs-trigger:focus-visible { outline: 2px solid var(--accent); outline-offset: 2px; }
.cs-trigger[aria-expanded="true"] { border-color: var(--accent); }
.cs-label {
  flex: 1; min-width: 0;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.cs-trigger > svg {
  flex: none; color: var(--muted);
  transition: transform 0.22s var(--ease-out), color 0.2s var(--ease-out);
}
.cs-trigger[aria-expanded="true"] > svg { transform: rotate(180deg); color: var(--accent); }
.cs-panel {
  position: absolute; top: calc(100% + 6px); left: 0; right: 0;
  z-index: 40;
  background: var(--surface);
  border: 1px solid var(--line); border-radius: var(--radius-ctl);
  max-height: 280px; overflow-y: auto;
  padding: 6px;
  box-shadow: 0 18px 44px rgba(0, 0, 0, 0.55);
  animation: view-in 0.18s var(--ease-out);
}
.cs-panel[hidden] { display: none; }
.cs-opt {
  padding: 10px 12px;
  border-radius: 8px;
  font-size: 0.92rem; line-height: 1.45;
  cursor: pointer;
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  color: var(--ink);
  transition: background 0.12s var(--ease-out);
}
.cs-opt:hover, .cs-opt.hl { background: var(--surface2); }
.cs-opt[aria-selected="true"] { color: var(--accent); font-weight: 600; }

/* ---------- state polish ---------- */
/* judul buku panjang: ellipsis, tidak mendorong tombol aksi */
.job-info { flex: 1; min-width: 0; }
.job-info strong {
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
  display: block;
}
/* paywall: cegah lompat layout saat catatan muncul */
#pay-note { min-height: 1.5em; }
/* baris kosong glosarium: status kosong yang rapi */
.gloss-empty { text-align: center; padding: 24px 12px; }
/* ikon di dalam .empty agar sejajar rapi */
.empty svg { display: block; margin: 0 auto 10px; color: var(--muted); }

/* ---------- reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
  .side-item, .side-item::before, .pw-toggle, .cs-trigger, .cs-trigger > svg, .cs-opt { transition: none; }
  .cs-panel { animation: none; }
}
