/* CBT Madrasah Terintegrasi - Styling Navbar 1 Baris, Sidebar Treeview, Arab RTL Harakat, Exam View & Cetak */

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

/* Navbar Atas: Selalu 1 baris bersih tanpa turun menjadi 2 baris */
.cbt-topbar {
  min-height: 52px;
  padding-top: 0.25rem;
  padding-bottom: 0.25rem;
  overflow: hidden;
}
.cbt-topbar-left,
.cbt-topbar-right {
  min-width: 0;
}
.cbt-topbar-brand {
  padding-left: 0.35rem;
  min-width: 0;
}

/* Sidebar Collapsible AdminLTE 3: Rapi, Hierarkis, Tidak Menumpuk */
.cbt-sidebar .nav-sidebar > .nav-item > .nav-link {
  padding-top: 0.52rem;
  padding-bottom: 0.52rem;
  font-size: 0.81rem;
  font-weight: 600;
  letter-spacing: 0.02em;
}
.cbt-sidebar .nav-sidebar > .nav-item > .nav-link p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 185px;
}
.cbt-sidebar .nav-treeview > .nav-item > .nav-link {
  padding-top: 0.4rem;
  padding-bottom: 0.4rem;
  font-size: 0.82rem;
  font-weight: 400;
}
.cbt-sidebar .nav-treeview > .nav-item > .nav-link p {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 175px;
}
.cbt-sidebar .nav-treeview > .nav-item > .nav-link.active {
  background-color: rgba(40, 167, 69, 0.25) !important;
  color: #ffffff !important;
  font-weight: 600;
  border-left: 3px solid #28a745;
}
.cbt-sidebar .nav-treeview > .nav-item > .nav-link .nav-icon {
  font-size: 0.65rem;
  margin-right: 0.35rem;
}
.cbt-section-highlight {
  box-shadow: 0 0 0 3px rgba(40, 167, 69, 0.35);
  transition: box-shadow 0.3s ease;
}

.arabic-rtl {
  direction: rtl;
  unicode-bidi: plaintext;
  line-height: 2.25;
  font-size: 1.25rem;
}

.font-amiri { font-family: 'Amiri', 'Traditional Arabic', serif; }
.font-noto-arabic { font-family: 'Noto Naskh Arabic', 'Traditional Arabic', serif; }
.font-scheherazade { font-family: 'Scheherazade New', 'Traditional Arabic', serif; }

.harakat-toolbar .btn {
  font-family: 'Amiri', serif;
  font-size: 1.15rem;
  min-width: 34px;
  padding: 2px 6px;
}

.tabular-nums {
  font-variant-numeric: tabular-nums;
}

/* Status Tombol Navigasi Soal Peserta */
.q-nav-btn {
  width: 38px;
  height: 38px;
  font-weight: 700;
  border-radius: 6px;
  border: 1px solid #cbd5e1;
  font-size: 0.85rem;
}
.q-nav-unanswered { background: #ffffff; color: #334155; }
.q-nav-answered { background: #16a34a; color: #ffffff; border-color: #15803d; }
.q-nav-ragu { background: #eab308; color: #1e293b; border-color: #ca8a04; }
.q-nav-active { box-shadow: 0 0 0 3px rgba(37, 99, 235, 0.45); border-color: #1d4ed8; }

/* Mode Gelap Ujian Peserta */
body.exam-dark {
  background-color: #0f172a !important;
  color: #f1f5f9 !important;
}
body.exam-dark .card,
body.exam-dark .navbar {
  background-color: #1e293b !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}
body.exam-dark .list-group-item {
  background-color: #0f172a !important;
  color: #f1f5f9 !important;
  border-color: #334155 !important;
}

.exam-option-card {
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px 14px;
  margin-bottom: 10px;
  cursor: pointer;
  transition: border-color 0.15s, background-color 0.15s;
}
.exam-option-card:hover {
  border-color: #2563eb;
}
.exam-option-card.selected {
  border-color: #1d4ed8;
  background-color: #eff6ff;
}
body.exam-dark .exam-option-card.selected {
  background-color: #1e3a8a;
  border-color: #60a5fa;
}

/* Cetak Kop Surat & Kartu Peserta */
@media print {
  .no-print, .main-header, .main-sidebar, .main-footer {
    display: none !important;
  }
  .content-wrapper {
    margin-left: 0 !important;
    background: #fff !important;
  }
  .kartu-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
  }
  .kartu-item {
    break-inside: avoid;
    page-break-inside: avoid;
  }
  .cbt-rich-content table {
    border-collapse: collapse !important;
    width: 100% !important;
  }
  .cbt-rich-content .cbt-eq,
  .cbt-rich-content math {
    break-inside: avoid;
  }
}

/* =========================================================================
 * PATCH 2.0: TRUE WYSIWYG QUESTION CONTENT (KONSISTEN EDITOR = PREVIEW = SISWA)
 * ========================================================================= */
.cbt-rich-content {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Noto Sans', 'Noto Sans Arabic', 'Noto Sans CJK JP', 'Noto Sans CJK SC', 'Noto Sans KR', sans-serif;
  font-size: 15px;
  line-height: 1.7;
  color: #1e293b;
  word-wrap: break-word;
  overflow-wrap: break-word;
}
.cbt-rich-content p {
  margin-bottom: 0.65rem;
}
.cbt-rich-content p:last-child {
  margin-bottom: 0;
}
.cbt-rich-content [dir="rtl"],
.cbt-rich-content.arabic-rtl {
  direction: rtl;
  unicode-bidi: isolate;
  font-family: 'Amiri', 'Noto Naskh Arabic', 'Scheherazade New', 'Traditional Arabic', serif;
  font-size: 1.25rem;
  line-height: 2.15;
}
.cbt-rich-content [dir="ltr"] {
  direction: ltr;
  unicode-bidi: isolate;
}
/* Isolasi rumus agar rumus di dalam paragraf Arab RTL tidak pernah terbalik urutannya */
.cbt-rich-content .cbt-eq,
.cbt-eq {
  display: inline-block;
  direction: ltr !important;
  unicode-bidi: isolate !important;
  vertical-align: middle;
  padding: 1px 4px;
  border-radius: 4px;
}
.cbt-rich-content .cbt-eq[data-display="block"],
.cbt-eq[data-display="block"] {
  display: block;
  text-align: center;
  margin: 0.6rem auto;
  padding: 6px 8px;
}
.cbt-eq-error {
  display: inline-block;
  background: #fef2f2;
  color: #b91c1c;
  border: 1px dashed #f87171;
  border-radius: 4px;
  padding: 2px 6px;
  font-size: 0.85em;
  font-family: monospace;
}
.cbt-rich-content img {
  max-width: 100%;
  height: auto;
  border-radius: 6px;
}
.cbt-rich-content figure {
  display: table;
  margin: 0.6rem auto;
  max-width: 100%;
}
.cbt-rich-content figcaption {
  caption-side: bottom;
  font-size: 0.85rem;
  color: #64748b;
  text-align: center;
  margin-top: 4px;
}
.cbt-rich-content audio,
.cbt-rich-content video {
  max-width: 100%;
  border-radius: 6px;
}
.cbt-rich-content blockquote {
  border-left: 3px solid #10b981;
  padding: 0.4rem 0.9rem;
  margin: 0.6rem 0;
  background: #f8fafc;
  color: #334155;
}
.cbt-rich-content .cbt-table-wrap {
  width: 100%;
  overflow-x: auto;
  -webkit-overflow-scrolling: touch;
  margin: 0.65rem 0;
}
.cbt-rich-content table {
  border-collapse: collapse;
  max-width: 100%;
  width: auto;
  min-width: 40%;
  margin: 0.4rem 0;
  font-size: 0.93em;
}
.cbt-rich-content table th,
.cbt-rich-content table td {
  border: 1px solid #cbd5e1;
  padding: 6px 10px;
  vertical-align: top;
}
.cbt-rich-content table thead th {
  background-color: #f1f5f9;
  font-weight: 600;
}
body.exam-dark .cbt-rich-content {
  color: #f1f5f9;
}
body.exam-dark .cbt-rich-content table th,
body.exam-dark .cbt-rich-content table td {
  border-color: #475569;
}
body.exam-dark .cbt-rich-content table thead th {
  background-color: #334155;
}

/* Preview Frame Desktop & Mobile di Halaman Tambah/Edit Soal */
.cbt-preview-sticky {
  position: sticky;
  top: 66px;
}
.cbt-preview-viewport {
  background: #f1f5f9;
  border: 1px solid #cbd5e1;
  border-radius: 10px;
  padding: 12px;
  transition: max-width 0.2s ease;
  margin: 0 auto;
}
.cbt-preview-viewport.mode-mobile {
  max-width: 375px;
  border: 8px solid #1e293b;
  border-radius: 22px;
  box-shadow: 0 10px 25px rgba(15, 23, 42, 0.16);
}
.cbt-eq-palette-btn {
  min-width: 44px;
  margin: 2px;
  font-size: 0.85rem;
}
.cbt-eq-preview-box {
  min-height: 76px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  padding: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow-x: auto;
}

/* Footer Copyright Global (Patch 2.0 — Admin, Operator, Guru, Proktor, Siswa, Login) */
.cbt-copyright-footer {
  font-size: 12px;
  color: #64748b;
  padding: 10px 16px;
  border-top: 1px solid #e2e8f0;
  background: #ffffff;
  text-align: center;
}
.cbt-copyright-footer-dark {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.78);
  padding: 10px 16px;
  text-align: center;
}

