@import url('https://cdnjs.cloudflare.com/ajax/libs/font-awesome/6.5.1/css/all.min.css');
/* shared-cbt.css - Desain Profesional & Bersih untuk Sistem Ujian CBT */
@import url('https://fonts.googleapis.com/css2?family=Plus+Jakarta+Sans:wght@400;500;600;700;800&display=swap');

:root {
  --primary: #db2777;
  --primary-hover: #be185d;
  --primary-light: #fdf2f8;
  --secondary: #500724;
  --accent: #ec4899;
  --success: #16a34a;
  --warning: #d97706;
  --danger: #dc2626;
  --bg: #fff5f9;
  --card: #ffffff;
  --border: #fbcfe8;
  --text: #1e293b;
  --muted: #64748b;
}

* { box-sizing: border-box; margin: 0; padding: 0; }
body {
  font-family: 'Plus Jakarta Sans', -apple-system, BlinkMacSystemFont, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

/* Navbar Navigasi Antar Modul (Hanya muncul di halaman manajemen/dashboard, BUKAN di layar ujian siswa) */
.top-nav {
  background: var(--secondary);
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: 0 2px 10px rgba(0,0,0,0.15);
}
.brand {
  font-weight: 800;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  color: #fff;
  text-decoration: none;
}
.brand span {
  background: var(--accent);
  padding: 2px 8px;
  border-radius: 6px;
  font-size: 0.75rem;
}
.nav-links {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
}
.nav-links a {
  color: #cbd5e1;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 600;
  padding: 0.45rem 0.85rem;
  border-radius: 8px;
  transition: all 0.2s;
}
.nav-links a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-links a.active { background: var(--primary); color: #fff; }

.container { max-width: 1280px; margin: 1.5rem auto; padding: 0 1.25rem; }
.header-banner {
  background: linear-gradient(135deg, #9d174d 0%, #ec4899 100%);
  color: white;
  padding: 1.5rem 2rem;
  border-radius: 14px;
  margin-bottom: 1.5rem;
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  gap: 1rem;
}
.header-banner h1 { font-size: 1.4rem; font-weight: 800; }
.header-banner p { font-size: 0.9rem; opacity: 0.9; margin-top: 0.25rem; }

.grid-2 { display: grid; grid-template-columns: repeat(auto-fit, minmax(340px, 1fr)); gap: 1.25rem; }
.grid-3 { display: grid; grid-template-columns: repeat(auto-fit, minmax(260px, 1fr)); gap: 1.25rem; }
.grid-4 { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 1rem; }

.card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.25rem;
  box-shadow: 0 1px 3px rgba(0,0,0,0.04);
  margin-bottom: 1.25rem;
}
.card-title {
  font-size: 1.05rem;
  font-weight: 700;
  margin-bottom: 1rem;
  padding-bottom: 0.65rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 0.5rem;
}

.stat-box {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 12px;
  padding: 1.1rem;
}
.stat-label { font-size: 0.8rem; color: var(--muted); font-weight: 600; text-transform: uppercase; }
.stat-val { font-size: 1.65rem; font-weight: 800; color: var(--secondary); margin-top: 0.25rem; }

.form-group { margin-bottom: 0.9rem; }
label { display: block; font-size: 0.83rem; font-weight: 600; margin-bottom: 0.35rem; color: #334155; }
input, select, textarea {
  width: 100%;
  padding: 0.6rem 0.8rem;
  border: 1px solid #cbd5e1;
  border-radius: 8px;
  font-family: inherit;
  font-size: 0.9rem;
  transition: border 0.2s;
}
input:focus, select:focus, textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(219,39,119,0.16);
}

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.55rem 1rem;
  border-radius: 8px;
  font-weight: 600;
  font-size: 0.85rem;
  cursor: pointer;
  border: none;
  transition: all 0.15s;
  text-decoration: none;
}
.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover { background: var(--primary-hover); }
.btn-success { background: var(--success); color: #fff; }
.btn-success:hover { background: #15803d; }
.btn-warning { background: var(--warning); color: #fff; }
.btn-danger { background: var(--danger); color: #fff; }
.btn-outline { background: #fff; border: 1px solid #cbd5e1; color: var(--text); }
.btn-outline:hover { background: #f1f5f9; }
.btn-sm { padding: 0.35rem 0.65rem; font-size: 0.78rem; }

.table-wrap { overflow-x: auto; }
table { width: 100%; border-collapse: collapse; font-size: 0.87rem; }
th, td { padding: 0.7rem 0.85rem; text-align: left; border-bottom: 1px solid var(--border); }
th { background: #f1f5f9; font-weight: 700; color: #334155; font-size: 0.8rem; text-transform: uppercase; }
tr:hover td { background: #f8fafc; }

.badge {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  border-radius: 999px;
  font-size: 0.75rem;
  font-weight: 700;
}
.badge-blue { background: #fce7f3; color: #9d174d; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-amber { background: #fef3c7; color: #92400e; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-gray { background: #f1f5f9; color: #475569; }

.tabs { display: flex; gap: 0.5rem; border-bottom: 2px solid var(--border); margin-bottom: 1.25rem; flex-wrap: wrap; }
.tab-btn {
  padding: 0.6rem 1.1rem;
  background: none;
  border: none;
  font-weight: 700;
  font-size: 0.88rem;
  color: var(--muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
}
.tab-btn.active { color: var(--primary); border-bottom-color: var(--primary); }

.alert {
  padding: 0.85rem 1rem;
  border-radius: 8px;
  font-size: 0.88rem;
  margin-bottom: 1rem;
  border-left: 4px solid;
}
.alert-info { background: #fdf2f8; border-color: #db2777; color: #831843; }
.alert-warn { background: #fffbeb; border-color: #d97706; color: #92400e; }
.alert-danger { background: #fef2f2; border-color: #dc2626; color: #991b1b; }

@media print {
  .no-print, .top-nav { display: none !important; }
  body { background: #fff; }
  .card { box-shadow: none; border: 1px solid #000; }
}


/* === LEFT SIDEBAR LAYOUT (MENU SEBELAH KIRI) === */
body.has-sidebar {
  display: flex;
  min-height: 100vh;
  background: var(--bg);
}

body.has-sidebar .top-nav {
  width: 260px;
  min-width: 260px;
  flex-shrink: 0;
  height: 100vh;
  position: sticky;
  top: 0;
  left: 0;
  flex-direction: column;
  align-items: stretch;
  justify-content: flex-start;
  padding: 1.25rem 1rem;
  gap: 1.25rem;
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 4px 0 18px rgba(15, 23, 42, 0.12);
  overflow-y: auto;
  z-index: 60;
}

body.has-sidebar .top-nav .brand {
  padding: 0.5rem 0.65rem 1rem 0.65rem;
  border-bottom: 1px solid rgba(255, 255, 255, 0.12);
  font-size: 1.15rem;
  justify-content: space-between;
}

body.has-sidebar .top-nav .nav-links {
  flex-direction: column;
  width: 100%;
  gap: 0.45rem;
  flex: 1;
}

body.has-sidebar .top-nav .nav-links a {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  width: 100%;
  padding: 0.7rem 0.9rem;
  font-size: 0.88rem;
  border-radius: 9px;
  color: #cbd5e1;
  transition: all 0.18s ease;
}

body.has-sidebar .top-nav .nav-links a:hover {
  background: rgba(255, 255, 255, 0.12);
  color: #ffffff;
  transform: translateX(3px);
}

body.has-sidebar .top-nav .nav-links a.active {
  background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(219, 39, 119, 0.35);
}

body.has-sidebar .top-nav .nav-links a.logout-link {
  margin-top: auto;
  background: rgba(239, 68, 68, 0.2);
  border: 1px solid rgba(248, 113, 113, 0.3);
  color: #fecaca;
}

body.has-sidebar .top-nav .nav-links a.logout-link:hover {
  background: rgba(220, 38, 38, 0.85);
  color: #ffffff;
}

body.has-sidebar > .container {
  flex: 1;
  min-width: 0;
  max-width: 100%;
  margin: 0;
  padding: 1.5rem 1.75rem;
}

@media (max-width: 860px) {
  body.has-sidebar {
    flex-direction: column;
  }
  body.has-sidebar .top-nav {
    width: 100%;
    min-width: 100%;
    height: auto;
    position: sticky;
    padding: 0.85rem 1rem;
    gap: 0.75rem;
  }
  body.has-sidebar .top-nav .brand {
    padding-bottom: 0.5rem;
  }
  body.has-sidebar .top-nav .nav-links {
    flex-direction: row;
    flex-wrap: wrap;
  }
  body.has-sidebar .top-nav .nav-links a {
    width: auto;
    padding: 0.45rem 0.75rem;
  }
  body.has-sidebar .top-nav .nav-links a.logout-link {
    margin-top: 0;
  }
  body.has-sidebar > .container {
    padding: 1.1rem;
  }
}

@media print {
  body.has-sidebar { display: block; }
  body.has-sidebar .top-nav { display: none !important; }
  body.has-sidebar > .container { padding: 0; }
}


body.has-sidebar .top-nav .nav-links a i {
  width: 20px;
  text-align: center;
  font-size: 1rem;
  color: #94a3b8;
  transition: color 0.18s ease, transform 0.18s ease;
  flex-shrink: 0;
}
body.has-sidebar .top-nav .nav-links a:hover i {
  color: #f472b6;
  transform: scale(1.08);
}
body.has-sidebar .top-nav .nav-links a.active i {
  color: #ffffff;
}
body.has-sidebar .top-nav .nav-links a.logout-link i {
  color: #fca5a5;
}
body.has-sidebar .top-nav .nav-links a.logout-link:hover i {
  color: #ffffff;
}


/* =========================================================
   CBT MODERN TOAST & DIALOG NOTIFICATION SYSTEM
   ========================================================= */
#cbt-toast-container {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 99999;
  display: flex;
  flex-direction: column;
  gap: 12px;
  pointer-events: none;
}

.cbt-toast {
  pointer-events: auto;
  position: relative;
  min-width: 320px;
  max-width: 410px;
  background: rgba(255, 255, 255, 0.97);
  backdrop-filter: blur(12px);
  border-radius: 12px;
  padding: 14px 18px;
  box-shadow: 0 14px 32px -4px rgba(15, 23, 42, 0.16),
              0 4px 12px -2px rgba(15, 23, 42, 0.08);
  border: 1px solid rgba(226, 232, 240, 0.9);
  border-left: 5px solid #ec4899;
  display: flex;
  align-items: flex-start;
  gap: 12px;
  overflow: hidden;
  font-family: inherit;
  animation: cbtToastIn 0.4s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cbt-toast.closing {
  animation: cbtToastOut 0.35s cubic-bezier(0.4, 0, 1, 1) forwards;
}

.cbt-toast.success { border-left-color: #10b981; }
.cbt-toast.success .cbt-toast-icon { background: #ecfdf5; color: #10b981; }
.cbt-toast.success .cbt-toast-progress { background: linear-gradient(90deg, #10b981, #34d399); }

.cbt-toast.warning { border-left-color: #f59e0b; }
.cbt-toast.warning .cbt-toast-icon { background: #fffbeb; color: #f59e0b; }
.cbt-toast.warning .cbt-toast-progress { background: linear-gradient(90deg, #f59e0b, #fbbf24); }

.cbt-toast.error { border-left-color: #ef4444; }
.cbt-toast.error .cbt-toast-icon { background: #fef2f2; color: #ef4444; }
.cbt-toast.error .cbt-toast-progress { background: linear-gradient(90deg, #ef4444, #f87171); }

.cbt-toast.info { border-left-color: #ec4899; }
.cbt-toast.info .cbt-toast-icon { background: #fdf2f8; color: #db2777; }
.cbt-toast.info .cbt-toast-progress { background: linear-gradient(90deg, #db2777, #f472b6); }

.cbt-toast-icon {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  margin-top: 1px;
}

.cbt-toast-icon svg {
  width: 19px;
  height: 19px;
}

.cbt-toast-body {
  flex: 1;
  min-width: 0;
}

.cbt-toast-title {
  font-size: 14px;
  font-weight: 700;
  color: #0f172a;
  margin-bottom: 3px;
  line-height: 1.3;
}

.cbt-toast-msg {
  font-size: 13px;
  color: #475569;
  line-height: 1.45;
  word-wrap: break-word;
}

.cbt-toast-close {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.cbt-toast-close:hover {
  background: #f1f5f9;
  color: #0f172a;
}

.cbt-toast-progress {
  position: absolute;
  bottom: 0;
  left: 0;
  height: 3.5px;
  width: 100%;
  transform-origin: left;
  animation: cbtToastProgress var(--duration, 4000ms) linear forwards;
}

.cbt-toast:hover .cbt-toast-progress {
  animation-play-state: paused;
}

@keyframes cbtToastIn {
  0% {
    opacity: 0;
    transform: translateX(100%) scale(0.95);
  }
  100% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
}

@keyframes cbtToastOut {
  0% {
    opacity: 1;
    transform: translateX(0) scale(1);
  }
  100% {
    opacity: 0;
    transform: translateX(110%) scale(0.95);
  }
}

@keyframes cbtToastProgress {
  0% { transform: scaleX(1); }
  100% { transform: scaleX(0); }
}

@media (max-width: 480px) {
  #cbt-toast-container {
    top: 12px;
    right: 12px;
    left: 12px;
  }
  .cbt-toast {
    min-width: unset;
    max-width: unset;
    width: 100%;
  }
}


/* =========================================================
   CBT MODERN CONFIRMATION MODAL (HAPUS, LOGOUT, RESET, SUBMIT)
   ========================================================= */
.cbt-modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.58);
  backdrop-filter: blur(6px);
  z-index: 100000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  opacity: 0;
  animation: cbtModalFadeIn 0.22s ease forwards;
}

.cbt-modal-backdrop.closing {
  animation: cbtModalFadeOut 0.2s ease forwards;
}

.cbt-modal-box {
  width: 100%;
  max-width: 420px;
  background: #ffffff;
  border-radius: 16px;
  padding: 1.5rem 1.65rem;
  box-shadow: 0 25px 50px -12px rgba(15, 23, 42, 0.32),
              0 0 0 1px rgba(226, 232, 240, 0.9);
  text-align: center;
  transform: scale(0.92) translateY(10px);
  animation: cbtModalPopIn 0.28s cubic-bezier(0.16, 1, 0.3, 1) forwards;
}

.cbt-modal-backdrop.closing .cbt-modal-box {
  animation: cbtModalPopOut 0.2s ease forwards;
}

.cbt-modal-icon {
  width: 54px;
  height: 54px;
  border-radius: 14px;
  margin: 0 auto 1rem auto;
  display: flex;
  align-items: center;
  justify-content: center;
}

.cbt-modal-icon svg {
  width: 26px;
  height: 26px;
}

.cbt-modal-icon.danger {
  background: #fef2f2;
  color: #dc2626;
  border: 1px solid #fecaca;
}

.cbt-modal-icon.warning {
  background: #fffbeb;
  color: #d97706;
  border: 1px solid #fde68a;
}

.cbt-modal-icon.info {
  background: #fdf2f8;
  color: #db2777;
  border: 1px solid #fbcfe8;
}

.cbt-modal-title {
  font-size: 1.12rem;
  font-weight: 800;
  color: #0f172a;
  margin-bottom: 0.45rem;
}

.cbt-modal-msg {
  font-size: 0.9rem;
  color: #475569;
  line-height: 1.55;
  margin-bottom: 1.4rem;
}

.cbt-modal-actions {
  display: flex;
  gap: 0.65rem;
  justify-content: center;
}

.cbt-modal-btn {
  flex: 1;
  padding: 0.65rem 1rem;
  border-radius: 10px;
  font-size: 0.88rem;
  font-weight: 700;
  cursor: pointer;
  border: none;
  transition: all 0.16s ease;
  font-family: inherit;
}

.cbt-modal-btn.cancel {
  background: #f1f5f9;
  color: #334155;
  border: 1px solid #cbd5e1;
}

.cbt-modal-btn.cancel:hover {
  background: #e2e8f0;
  color: #0f172a;
}

.cbt-modal-btn.danger {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(220, 38, 38, 0.28);
}

.cbt-modal-btn.danger:hover {
  background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
}

.cbt-modal-btn.warning {
  background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(217, 119, 6, 0.28);
}

.cbt-modal-btn.info {
  background: linear-gradient(135deg, #ec4899 0%, #be185d 100%);
  color: #ffffff;
  box-shadow: 0 4px 12px rgba(219, 39, 119, 0.28);
}

@keyframes cbtModalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes cbtModalFadeOut {
  from { opacity: 1; }
  to { opacity: 0; }
}

@keyframes cbtModalPopIn {
  from { opacity: 0; transform: scale(0.92) translateY(10px); }
  to { opacity: 1; transform: scale(1) translateY(0); }
}

@keyframes cbtModalPopOut {
  from { opacity: 1; transform: scale(1) translateY(0); }
  to { opacity: 0; transform: scale(0.94) translateY(8px); }
}


/* Footer Copyright */
.cbt-footer {
  margin-top: 2rem;
  padding: 1rem 1.25rem;
  text-align: center;
  font-size: 0.82rem;
  font-weight: 600;
  color: #9d174d;
  border-top: 1px solid #fbcfe8;
  background: rgba(253, 242, 248, 0.7);
  border-radius: 0 0 12px 12px;
}

/* Password Input dengan Tombol Mata (Show/Hide Password) */
.password-field-wrap {
  position: relative;
  display: flex;
  align-items: center;
  width: 100%;
}
.password-field-wrap input {
  padding-right: 2.6rem !important;
}
.password-toggle-btn {
  position: absolute;
  right: 0.45rem;
  top: 50%;
  transform: translateY(-50%);
  background: transparent;
  border: none;
  color: #64748b;
  cursor: pointer;
  width: 2rem;
  height: 2rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 6px;
  font-size: 0.95rem;
  transition: color 0.15s, background 0.15s;
}
.password-toggle-btn:hover {
  color: var(--primary);
  background: #fdf2f8;
}
.password-toggle-btn:focus {
  outline: none;
  color: var(--primary);
}

/* Sidebar Guru Profile Card & Avatar */
.sidebar-profile-card {
  font-size: 0.75rem;
  color: #fbcfe8;
  padding: 0.65rem 0.75rem;
  background: rgba(219, 39, 119, 0.32);
  border: 1px solid rgba(244, 114, 182, 0.25);
  border-radius: 10px;
  margin-bottom: 0.45rem;
}
.sidebar-profile-top {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  margin-bottom: 0.45rem;
  padding-bottom: 0.45rem;
  border-bottom: 1px dashed rgba(255, 255, 255, 0.24);
}
.sidebar-avatar {
  width: 40px;
  height: 40px;
  border-radius: 999px;
  object-fit: cover;
  border: 2px solid #f472b6;
  background: #831843;
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.85rem;
  flex-shrink: 0;
}


/* ============================================================================
   EDITOR SOAL GAYA WORD, RUMUS MATEMATIKA & INPUT GAMBAR (V2.2)
   ============================================================================ */
.word-editor-shell {
  border: 2px solid #f9a8d4;
  border-radius: 12px;
  background: #ffffff;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(219, 39, 119, 0.06);
  transition: border-color 0.2s, box-shadow 0.2s;
}
.word-editor-shell:focus-within {
  border-color: var(--primary);
  box-shadow: 0 0 0 3px rgba(219, 39, 119, 0.14);
}
.word-ribbon {
  background: linear-gradient(180deg, #fff5f9 0%, #fce7f3 100%);
  border-bottom: 1px solid #f9a8d4;
  padding: 0.5rem 0.65rem;
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
}
.word-ribbon-row {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
}
.word-sep {
  width: 1px;
  height: 22px;
  background: #f472b6;
  opacity: 0.45;
  margin: 0 0.2rem;
}
.word-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-width: 30px;
  height: 30px;
  padding: 0 0.5rem;
  border-radius: 6px;
  border: 1px solid #f9a8d4;
  background: #ffffff;
  color: #500724;
  font-size: 0.8rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.14s ease;
  user-select: none;
}
.word-btn:hover {
  background: #db2777;
  color: #ffffff;
  border-color: #db2777;
  transform: translateY(-1px);
}
.word-btn.math-tpl {
  background: #fdf2f8;
  border-color: #ec4899;
  color: #9d174d;
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: 0.86rem;
}
.word-btn.math-tpl:hover {
  background: #be185d;
  color: #ffffff;
}
.math-palette-bar {
  background: #ffffff;
  border: 1px solid #fbcfe8;
  border-radius: 8px;
  padding: 0.4rem 0.5rem;
}
.math-cat-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
  margin-bottom: 0.35rem;
}
.math-cat-btn {
  padding: 2px 8px;
  border-radius: 999px;
  border: 1px solid #fbcfe8;
  background: #fff5f9;
  color: #831843;
  font-size: 0.72rem;
  font-weight: 700;
  cursor: pointer;
}
.math-cat-btn.active {
  background: #db2777;
  color: #ffffff;
  border-color: #db2777;
}
.math-symbols-grid {
  display: flex;
  flex-wrap: wrap;
  gap: 0.25rem;
}
.sym-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border-radius: 6px;
  border: 1px solid #e2e8f0;
  background: #f8fafc;
  color: #0f172a;
  font-family: 'Cambria Math', 'Times New Roman', serif;
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}
.sym-btn:hover {
  background: #fce7f3;
  border-color: #db2777;
  color: #9d174d;
}
.word-page-canvas {
  background: #f8fafc;
  padding: 0.75rem;
}
.word-editable-area {
  min-height: 145px;
  max-height: 360px;
  overflow-y: auto;
  background: #ffffff;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  padding: 0.9rem 1.1rem;
  font-size: 0.98rem;
  line-height: 1.75;
  color: #0f172a;
  outline: none;
  box-shadow: inset 0 1px 3px rgba(0,0,0,0.03);
}
.word-editable-area:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}
.word-editable-area table,
.cbt-rich-content table {
  border-collapse: collapse;
  margin: 0.5rem 0;
  width: auto;
  max-width: 100%;
}
.word-editable-area td, .word-editable-area th,
.cbt-rich-content td, .cbt-rich-content th {
  border: 1px solid #94a3b8;
  padding: 0.35rem 0.65rem;
  min-width: 48px;
}
.word-editable-area img,
.cbt-rich-content img {
  max-width: 100%;
  max-height: 320px;
  border-radius: 8px;
  margin: 0.25rem 0.35rem;
  vertical-align: middle;
  transition: outline 0.12s ease;
}
.word-editable-area img {
  cursor: pointer;
}
.word-editable-area img.cbt-img-selected {
  outline: 2.5px solid var(--primary);
  outline-offset: 2px;
}
.cbt-img-align-inline {
  display: inline-block;
  vertical-align: middle;
  margin: 0 5px;
}
.cbt-img-align-center {
  display: block;
  margin: 8px auto;
}
.cbt-img-align-left {
  display: block;
  margin: 8px auto 8px 0;
}
.cbt-img-align-right {
  display: block;
  margin: 8px 0 8px auto;
}
.img-floating-toolbar {
  display: none;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.3rem;
  background: #fdf2f8;
  border: 1px solid #f472b6;
  border-radius: 8px;
  padding: 0.4rem 0.65rem;
  margin-top: 0.45rem;
  font-size: 0.76rem;
}

/* Pecahan & Akar Matematika (Tampil identik di Editor, Ujian Siswa & Pembahasan) */
.cbt-frac {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  vertical-align: middle;
  margin: 0 3px;
  font-family: 'Cambria Math', 'Times New Roman', serif;
  line-height: 1.15;
}
.cbt-frac > .cbt-num {
  padding: 0 5px 2px 5px;
  border-bottom: 1.5px solid currentColor;
  text-align: center;
  min-width: 18px;
}
.cbt-frac > .cbt-den {
  padding: 2px 5px 0 5px;
  text-align: center;
  min-width: 18px;
}
.cbt-sqrt {
  display: inline-flex;
  align-items: stretch;
  vertical-align: middle;
  margin: 0 2px;
  font-family: 'Cambria Math', 'Times New Roman', serif;
}
.cbt-sqrt-rad {
  font-size: 1.15em;
  line-height: 1;
  padding-right: 1px;
}
.cbt-sqrt-body {
  border-top: 1.5px solid currentColor;
  padding: 0 4px;
  min-width: 18px;
}

/* Dropzone Upload Gambar Soal */
.img-dropzone {
  border: 2px dashed #f472b6;
  border-radius: 10px;
  background: #fff5f9;
  padding: 0.85rem;
  text-align: center;
  cursor: pointer;
  transition: all 0.18s ease;
}
.img-dropzone:hover, .img-dropzone.dragover {
  background: #fce7f3;
  border-color: #db2777;
}
.img-preview-card {
  position: relative;
  display: inline-block;
  margin-top: 0.6rem;
  border: 1px solid #fbcfe8;
  border-radius: 10px;
  padding: 0.4rem;
  background: #ffffff;
}
.img-preview-card img {
  max-height: 190px;
  max-width: 100%;
  border-radius: 8px;
  display: block;
}

/* Input Opsi PG dengan Tombol Matematika & Gambar */
.pg-option-box {
  border: 1px solid #fbcfe8;
  border-radius: 10px;
  padding: 0.55rem 0.65rem;
  background: #fffafc;
}
.pg-opt-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.22rem;
  margin-bottom: 0.35rem;
  align-items: center;
}
.pg-opt-mini-btn {
  padding: 1px 6px;
  font-size: 0.75rem;
  font-weight: 700;
  border-radius: 5px;
  border: 1px solid #f9a8d4;
  background: #ffffff;
  color: #831843;
  cursor: pointer;
  font-family: 'Cambria Math', 'Times New Roman', serif;
}
.pg-opt-mini-btn:hover {
  background: #db2777;
  color: #ffffff;
}
.pg-opt-editable {
  min-height: 38px;
  background: #ffffff;
  border: 1px solid #cbd5e1;
  border-radius: 7px;
  padding: 0.45rem 0.65rem;
  font-size: 0.9rem;
  line-height: 1.5;
  outline: none;
}
.pg-opt-editable:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(219, 39, 119, 0.14);
}
.pg-opt-editable:empty:before {
  content: attr(data-placeholder);
  color: #94a3b8;
  pointer-events: none;
}
.pg-opt-editable img {
  max-height: 95px;
  max-width: 100%;
  border-radius: 6px;
  display: block;
  margin-top: 4px;
}

/* Lightbox Zoom Gambar di Layar Peserta */
.cbt-img-zoomable {
  cursor: zoom-in;
  transition: transform 0.15s ease;
}
.cbt-img-zoomable:hover {
  transform: scale(1.01);
}
.cbt-lightbox {
  position: fixed;
  inset: 0;
  background: rgba(15, 23, 42, 0.88);
  z-index: 10000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 1.5rem;
  cursor: zoom-out;
}
.cbt-lightbox img {
  max-width: 94vw;
  max-height: 90vh;
  border-radius: 12px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.5);
  background: #fff;
}
