﻿/* ===== RESET & BASE ===== */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
:root {
  --admin: #7c3aed;
  --guru: #0ea5e9;
  --peserta: #10b981;
  --danger: #ef4444;
  --warn: #f59e0b;
  --dark: #1e293b;
  --light: #f8fafc;
  --gray: #64748b;
  --border: #e2e8f0;
  --radius: 14px;
  --shadow: 0 4px 24px rgba(0,0,0,0.10);
  --shadow-lg: 0 8px 40px rgba(0,0,0,0.16);
}
body { font-family: 'Segoe UI', sans-serif; background: var(--light); color: var(--dark); min-height: 100vh; }
body.ujian-body { background: transparent; }

/* ===== SECURITY: ANTI SELECT & DRAG ===== */
body {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
}
/* Izinkan select di input/textarea agar user bisa mengetik */
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text;
  -moz-user-select: text;
  user-select: text;
}

/* ===== NAVBAR ===== */
.navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; height: 64px;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  box-shadow: 0 2px 12px rgba(0,0,0,0.2); position: sticky; top: 0; z-index: 100;
}
.nav-brand { display: flex; align-items: center; gap: 10px; color: #fff; font-weight: 700; font-size: 1.1rem; }
.nav-brand img { height: 36px; border-radius: 6px; }
.nav-links { display: flex; gap: 8px; list-style: none; }
.nav-links a { color: #cbd5e1; text-decoration: none; padding: 8px 14px; border-radius: 8px; font-size: 0.9rem; transition: all .2s; display: flex; align-items: center; gap: 6px; }
.nav-links a:hover { background: rgba(255,255,255,0.1); color: #fff; }
.nav-links li { display: flex; align-items: center; }
.nav-links .dark-toggle { font-size: 0.82rem; padding: 7px 14px; }
.hamburger { display: none; background: none; border: none; color: #fff; font-size: 1.4rem; cursor: pointer; padding: 8px; }

/* ===== HERO ===== */
.hero {
  position: relative; min-height: 28vh; display: flex; align-items: center; justify-content: center;
  background: linear-gradient(135deg, #1e3a5f 0%, #0ea5e9 50%, #10b981 100%);
  overflow: hidden; text-align: center;
}
.hero::before {
  content: ''; position: absolute; inset: 0;
  background: url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.05'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E");
}
.hero-content { position: relative; z-index: 1; color: #fff; padding: 3% 5%; }
.hero-icon { font-size: 5vw; margin-bottom: 1.5%; animation: none; }
@keyframes float { 0%,100%{transform:translateY(0)} 50%{transform:translateY(-1vh)} }
.hero-content h1 { font-size: 1.2vw; font-weight: 400; opacity: .85; }
.hero-content h2 { font-size: 3vw; font-weight: 800; text-shadow: 0 2px 8px rgba(0,0,0,0.3); }
.hero-content h3 { font-size: 1.6vw; font-weight: 600; margin-bottom: 1%; }
.hero-content p  { font-size: 1.1vw; opacity: .8; }
@media (max-width: 768px) {
  .hero { min-height: 22vh; }
  .hero-icon { font-size: 8vw; }
  .hero-content h1 { font-size: 3vw; }
  .hero-content h2 { font-size: 6vw; }
  .hero-content h3 { font-size: 4vw; }
  .hero-content p  { font-size: 3.5vw; }
}

/* ===== CARDS ===== */
.main-cards { padding: 48px 24px; max-width: 1100px; margin: 0 auto; }
.section-title { text-align: center; font-size: 1.6rem; font-weight: 700; margin-bottom: 32px; color: var(--dark); display: flex; align-items: center; justify-content: center; gap: 10px; }
.cards-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(280px, 1fr)); gap: 24px; }
.card {
  background: #fff; border-radius: var(--radius); padding: 36px 28px; text-align: center;
  box-shadow: var(--shadow); cursor: pointer; transition: all .3s; border: 2px solid transparent;
}
.card:hover { transform: translateY(-6px); box-shadow: var(--shadow-lg); }
.card-icon { font-size: 3rem; margin-bottom: 16px; }
.card h3 { font-size: 1.4rem; font-weight: 700; margin-bottom: 10px; }
.card p { color: var(--gray); font-size: 0.9rem; margin-bottom: 24px; line-height: 1.6; }
.card-admin { border-color: var(--admin); } .card-admin .card-icon { color: var(--admin); }
.card-guru { border-color: var(--guru); } .card-guru .card-icon { color: var(--guru); }
.card-peserta { border-color: var(--peserta); } .card-peserta .card-icon { color: var(--peserta); }

/* ===== BUTTONS ===== */
.btn { display: inline-flex; align-items: center; gap: 8px; padding: 12px 24px; border-radius: 10px; border: none; font-size: 0.95rem; font-weight: 600; cursor: pointer; transition: all .2s; text-decoration: none; }
.btn-admin { background: var(--admin); color: #fff; } .btn-admin:hover { background: #6d28d9; }
.btn-guru { background: var(--guru); color: #fff; } .btn-guru:hover { background: #0284c7; }
.btn-peserta { background: var(--peserta); color: #fff; } .btn-peserta:hover { background: #059669; }
.btn-danger { background: var(--danger); color: #fff; } .btn-danger:hover { background: #dc2626; }
.btn-warn { background: var(--warn); color: #fff; } .btn-warn:hover { background: #d97706; }
.btn-gray { background: #e2e8f0; color: var(--dark); } .btn-gray:hover { background: #cbd5e1; }
.btn-success { background: #10b981; color: #fff; } .btn-success:hover { background: #059669; }
.full-btn { width: 100%; justify-content: center; }
/* Tombol kecil untuk toolbar */
.btn-sm { padding: 6px 12px !important; font-size: .78rem !important; border-radius: 8px !important; gap: 5px !important; font-weight: 600 !important; }

/* ===== MODAL ===== */
.modal-overlay { display: none; position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 999; align-items: center; justify-content: center; backdrop-filter: blur(4px); }
.modal-overlay.active { display: flex; }
.modal { background: #fff; border-radius: var(--radius); width: 90%; max-width: 420px; box-shadow: var(--shadow-lg); overflow: hidden; animation: slideUp .3s ease; }
@keyframes slideUp { from{transform:translateY(30px);opacity:0} to{transform:translateY(0);opacity:1} }
.modal-header { display: flex; align-items: center; gap: 12px; padding: 20px 24px; background: linear-gradient(135deg, var(--admin), #6d28d9); color: #fff; }
.modal-header i { font-size: 1.4rem; }
.modal-header h3 { flex: 1; font-size: 1.1rem; }
.modal-close { background: none; border: none; color: #fff; font-size: 1.2rem; cursor: pointer; padding: 4px; }
.modal-body { padding: 24px; }
.form-group { margin-bottom: 18px; }
.form-group label { display: flex; align-items: center; gap: 6px; font-size: 0.85rem; font-weight: 600; color: var(--gray); margin-bottom: 8px; }
.form-group input, .form-group select, .form-group textarea {
  width: 100%; padding: 11px 14px; border: 2px solid var(--border); border-radius: 10px;
  font-size: 0.95rem; transition: border .2s; outline: none; background: #f8fafc;
}
.form-group input:focus, .form-group select:focus, .form-group textarea:focus { border-color: var(--admin); background: #fff; }
.input-pw { position: relative; }
.input-pw input { padding-right: 44px; }
.input-pw button { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); background: none; border: none; color: var(--gray); cursor: pointer; font-size: 1rem; }
.error-msg { color: var(--danger); font-size: 0.85rem; margin-bottom: 12px; min-height: 18px; }
.error-msg-box {
  display: flex; align-items: flex-start; gap: 10px;
  background: #fee2e2; border: 1.5px solid #fca5a5; border-radius: 10px;
  padding: 12px 16px; color: #991b1b; font-size: 0.88rem; font-weight: 600;
  margin-bottom: 12px;
}
.error-msg-box i { margin-top: 2px; flex-shrink: 0; }

/* ===== FOOTER ===== */
.footer { text-align: center; padding: 20px; background: var(--dark); color: #94a3b8; font-size: 0.85rem; }

/* ===== ADMIN LAYOUT ===== */
.admin-layout { display: flex; flex-direction: column; min-height: 100vh; }

/* Top navbar admin/guru */
.app-navbar {
  display: flex; align-items: center; justify-content: space-between;
  padding: 0 24px; min-height: 64px; position: sticky; top: 0; z-index: 100;
  background: linear-gradient(135deg, #1e293b 0%, #334155 100%);
  box-shadow: 0 2px 16px rgba(0,0,0,0.2);
}
.app-navbar.admin-nav { background: linear-gradient(135deg, #581c87 0%, #7c3aed 50%, #a855f7 100%); }
.app-navbar.guru-nav { background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 50%, #0ea5e9 100%); }
.app-navbar.peserta-nav { background: linear-gradient(135deg, #065f46 0%, #059669 50%, #10b981 100%); }

.app-navbar .nav-brand {
  display: flex; align-items: center; gap: 12px; color: #fff;
  font-weight: 800; font-size: 1.05rem; white-space: nowrap;
  min-width: 0;
}
.app-navbar .nav-brand i { font-size: 1.4rem; color: rgba(255,255,255,0.95); }
.app-navbar .nav-brand span {
  display: inline-block; line-height: 1.3;
  font-weight: 800; letter-spacing: .2px;
  text-shadow: 0 1px 4px rgba(0,0,0,0.35);
  overflow: hidden; text-overflow: ellipsis; white-space: nowrap;
}
.app-navbar .nav-brand img {
  border-radius: 50%;
  background: transparent;
  padding: 0;
  box-shadow: none;
  flex-shrink: 0;
}
.app-navbar-right { 
  display: flex; align-items: center; gap: 10px; 
  flex-wrap: wrap; justify-content: flex-end;
}

/* Tombol keluar di sudut kanan atas */
.btn-logout-top {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 16px; border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9);
  font-size: 0.82rem; font-weight: 600; cursor: pointer; transition: all .2s;
  white-space: nowrap; line-height: 1;
}
.btn-logout-top:hover { background: rgba(239,68,68,0.75); border-color: #ef4444; color: #fff; }

/* Tab nav bar */
.app-tabnav {
  display: flex; align-items: stretch; gap: 0;
  background: rgba(0,0,0,0.22); padding: 0 16px;
  border-bottom: 1px solid rgba(255,255,255,0.1); overflow-x: auto;
  scrollbar-width: none;
}
.app-tabnav::-webkit-scrollbar { display: none; }
.app-tabnav a {
  display: flex; align-items: center; gap: 7px;
  padding: 12px 18px; color: rgba(255,255,255,0.65); text-decoration: none;
  font-size: 0.85rem; font-weight: 600; white-space: nowrap;
  border-bottom: 3px solid transparent; transition: all .2s;
  cursor: pointer; background: none; border-top: none; border-left: none; border-right: none;
}
.app-tabnav a:hover { color: #fff; background: rgba(255,255,255,0.1); }
.app-tabnav a.active { color: #fff; border-bottom-color: rgba(255,255,255,0.9); background: rgba(255,255,255,0.12); }
.app-tabnav .nav-logout { margin-left: auto; display: none; }

/* Warna tabnav per role */
.admin-tabnav { background: linear-gradient(90deg, #4c1d95 0%, #6d28d9 100%); }
.admin-tabnav a.active { border-bottom-color: #c4b5fd; }
.guru-tabnav { background: linear-gradient(90deg, #0c4a6e 0%, #0369a1 100%); }
.guru-tabnav a.active { border-bottom-color: #7dd3fc; }


.main-content { flex: 1; padding: 24px; background: #f1f5f9; min-height: calc(100vh - 108px); }
.top-bar { display: flex; align-items: center; justify-content: space-between; margin-bottom: 24px; }
.top-bar h1 { font-size: 1.4rem; font-weight: 700; }
.page-section { display: none; }
.page-section.active { display: block; }

/* ===== STATS CARDS ===== */
.stats-grid { display: grid; grid-template-columns: repeat(auto-fit, minmax(200px, 1fr)); gap: 16px; margin-bottom: 24px; }
.stat-card { background: #fff; border-radius: var(--radius); padding: 20px; display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow); }
.stat-icon { width: 52px; height: 52px; border-radius: 12px; display: flex; align-items: center; justify-content: center; font-size: 1.4rem; color: #fff; flex-shrink: 0; }
.stat-info h3 { font-size: 1.6rem; font-weight: 800; }
.stat-info p { font-size: 0.8rem; color: var(--gray); }

/* ===== TABLE ===== */
.table-card { background: #fff; border-radius: var(--radius); box-shadow: var(--shadow); overflow: hidden; }
.table-header { display: flex; align-items: center; justify-content: space-between; padding: 16px 20px; border-bottom: 1px solid var(--border); }
.table-header h3 { font-size: 1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
.table-actions { display: flex; gap: 8px; flex-wrap: wrap; }
table { width: 100%; border-collapse: collapse; }
th { background: #f8fafc; padding: 12px 16px; text-align: left; font-size: 0.8rem; font-weight: 700; color: var(--gray); text-transform: uppercase; letter-spacing: .5px; }
td { padding: 12px 16px; border-top: 1px solid var(--border); font-size: 0.9rem; }
tr:hover td { background: #f8fafc; }
.badge { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; }
.badge-green { background: #dcfce7; color: #166534; }
.badge-blue { background: #dbeafe; color: #1e40af; }
.badge-red { background: #fee2e2; color: #991b1b; }
.badge-yellow { background: #fef9c3; color: #854d0e; }
.action-btns { display: flex; gap: 6px; }
.icon-btn { width: 32px; height: 32px; border-radius: 8px; border: none; cursor: pointer; display: flex; align-items: center; justify-content: center; font-size: 0.85rem; transition: all .2s; }

/* ===== GURU LAYOUT ===== */
.guru-main { flex: 1; padding: 24px; background: #f0f9ff; min-height: calc(100vh - 108px); }
.guru-tabnav a.active { color: #38bdf8; border-bottom-color: #38bdf8; }
.guru-tabnav { background: #0c4a6e; }
.guru-tabnav a { color: #7dd3fc; }
.guru-tabnav a:hover { color: #e0f2fe; }
.guru-tabnav a.active { color: #fff; border-bottom-color: #38bdf8; }

/* ===== TOOLBAR SOAL (legacy) ===== */
.editor-toolbar {
  display: flex; flex-wrap: wrap; gap: 2px; padding: 8px; background: #f1f5f9;
  border: 2px solid var(--border); border-bottom: none; border-radius: 10px 10px 0 0;
}
.toolbar-btn {
  width: 32px; height: 32px; border: none; background: transparent; border-radius: 6px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; color: var(--dark); transition: all .15s; position: relative;
}
.toolbar-btn:hover { background: #e2e8f0; }
.toolbar-btn.active { background: var(--guru); color: #fff; }
.toolbar-sep { width: 1px; background: var(--border); margin: 4px 4px; }
.toolbar-select { height: 32px; border: 1px solid var(--border); border-radius: 6px; padding: 0 6px; font-size: 0.8rem; background: #fff; cursor: pointer; }
.editor-area {
  min-height: 120px;
  max-height: 220px;
  padding: 12px 16px;
  border: 2px solid var(--border);
  border-radius: 0 0 10px 10px;
  outline: none;
  font-size: 0.95rem;
  line-height: 1.7;
  background: #fff;
  overflow-y: auto;
  overflow-x: hidden;
  resize: vertical;
  width: 100%;
  box-sizing: border-box;
  scroll-behavior: smooth;
}
.editor-area:focus { border-color: var(--guru); }
.editor-area:empty::before {
  content: 'Tulis pertanyaan di sini... drag sudut kanan-bawah untuk memperbesar area.';
  color: #94a3b8; font-style: italic; pointer-events: none;
}
/* Scrollbar editor area */
.editor-area::-webkit-scrollbar { width: 6px; }
.editor-area::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
.editor-area::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
.editor-area::-webkit-scrollbar-thumb:hover { background: #94a3b8; }
.color-picker-wrap { position: relative; display: inline-flex; align-items: center; justify-content: center; }
.color-picker-wrap input[type=color] { position: absolute; inset: 0; opacity: 0; width: 100%; height: 100%; cursor: pointer; border: none; padding: 0; }

/* ===== TOOLBAR V2 (RAPI, PROFESIONAL) ===== */
.editor-toolbar-v2 {
  display: flex; flex-direction: column; gap: 6px;
  padding: 8px 10px; background: linear-gradient(180deg, #f8fafc, #f1f5f9);
  border: 1.5px solid #e2e8f0; border-bottom: none;
  border-radius: 10px 10px 0 0;
}
.ttbar-row {
  display: flex; flex-wrap: wrap; align-items: center; gap: 6px;
}
.ttbar-row-primary { padding-bottom: 6px; border-bottom: 1px dashed #e2e8f0; }
.ttbar-group {
  display: inline-flex; align-items: center; gap: 1px;
  padding: 2px; background: #fff; border: 1px solid #e2e8f0;
  border-radius: 8px; box-shadow: 0 1px 2px rgba(15, 23, 42, 0.04);
}
.ttbar-group-font { flex-wrap: nowrap; }
.editor-toolbar-v2 .toolbar-btn {
  width: 30px; height: 30px; border-radius: 6px; font-size: 0.85rem;
}
.editor-toolbar-v2 .toolbar-btn:hover { background: #e0f2fe; color: var(--guru); }
.editor-toolbar-v2 .toolbar-btn-image {
  background: linear-gradient(135deg, #10b981, #059669); color: #fff;
}
.editor-toolbar-v2 .toolbar-btn-image:hover { background: linear-gradient(135deg, #059669, #047857); color: #fff; }
.editor-toolbar-v2 .toolbar-btn-bg {
  background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
}
.editor-toolbar-v2 .toolbar-select {
  height: 30px; border: none; border-radius: 5px; background: transparent;
  font-size: 0.82rem; padding: 0 6px; color: var(--dark);
}
.editor-toolbar-v2 .toolbar-select:focus { outline: 1.5px solid var(--guru); }
.editor-toolbar-v2 .tt-font-name { min-width: 120px; }
.editor-toolbar-v2 .tt-font-size { min-width: 70px; }
.editor-toolbar-v2 .color-picker-wrap { width: 30px; height: 30px; border-radius: 6px; }
.editor-toolbar-v2 .color-picker-wrap:hover { background: #e0f2fe; }

@media (max-width: 640px) {
  .editor-toolbar-v2 .toolbar-btn { width: 28px; height: 28px; font-size: 0.78rem; }
  .editor-toolbar-v2 .tt-font-name { min-width: 100px; }
  .editor-toolbar-v2 .tt-font-size { min-width: 60px; }
}

/* ===== EDITOR IMAGE (resizable) ===== */
.editor-area img,
.editor-area .editor-img {
  max-width: 100%; height: auto; cursor: pointer;
  border-radius: 6px; transition: outline 0.15s, box-shadow 0.15s;
  vertical-align: middle;
}
.editor-area img.editor-img-selected {
  outline: 2px solid var(--guru);
  box-shadow: 0 0 0 4px rgba(14, 165, 233, 0.18);
}

/* ===== IMAGE RESIZER POPOVER ===== */
.img-resizer {
  position: fixed; z-index: 99999;
  background: #fff; border: 1px solid #e2e8f0;
  border-radius: 10px; box-shadow: 0 12px 32px rgba(15, 23, 42, 0.2);
  padding: 10px 12px; min-width: 270px;
  display: flex; flex-direction: column; gap: 8px;
  font-size: 0.82rem; color: var(--dark);
}
.img-resizer-row { display: flex; align-items: center; gap: 6px; }
.img-resizer-row label { font-size: 0.78rem; color: var(--gray); flex-shrink: 0; }
.img-resizer-row .img-size-btn,
.img-resizer-row .img-align-btn {
  flex: 1; padding: 6px 4px; border: 1px solid #e2e8f0; background: #f8fafc;
  border-radius: 6px; cursor: pointer; font-size: 0.78rem; color: var(--dark);
  transition: background 0.15s, color 0.15s;
}
.img-resizer-row .img-size-btn:hover,
.img-resizer-row .img-align-btn:hover { background: #e0f2fe; color: var(--guru); }
.img-resizer-row .img-align-btn.active { background: var(--guru); color: #fff; border-color: var(--guru); }
.img-resizer-row .img-width-slider { flex: 1; cursor: pointer; }
.img-resizer-row .img-width-val { font-size: 0.78rem; color: var(--gray); min-width: 56px; text-align: right; }
.img-resizer-row .img-delete-btn {
  margin-left: auto; padding: 6px 10px; border: none;
  background: #fee2e2; color: #991b1b; border-radius: 6px; cursor: pointer;
  font-size: 0.78rem; font-weight: 600;
}
.img-resizer-row .img-delete-btn:hover { background: #fecaca; }

/* ===== AREA SCROLL OPSI JAWABAN ===== */
#opsiPGContainer,
#opsiPGKContainer {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scroll-behavior: smooth;
}
#opsiPGContainer::-webkit-scrollbar,
#opsiPGKContainer::-webkit-scrollbar { width: 5px; }
#opsiPGContainer::-webkit-scrollbar-track,
#opsiPGKContainer::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
#opsiPGContainer::-webkit-scrollbar-thumb,
#opsiPGKContainer::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
#opsiPGContainer::-webkit-scrollbar-thumb:hover,
#opsiPGKContainer::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

#opsiJodoh {
  max-height: 240px;
  overflow-y: auto;
  overflow-x: hidden;
  padding-right: 4px;
  scroll-behavior: smooth;
}
#opsiJodoh::-webkit-scrollbar { width: 5px; }
#opsiJodoh::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
#opsiJodoh::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }
#opsiJodoh::-webkit-scrollbar-thumb:hover { background: #94a3b8; }

/* ===== OPSI JAWABAN (PG/PGK) — dukungan gambar ===== */
.opsi-row {
  display: flex; align-items: flex-start; gap: 8px;
  padding: 8px; margin-bottom: 8px;
  background: #fff; border: 1.5px solid var(--border);
  border-radius: 10px; transition: border-color 0.15s, background 0.15s;
}
.opsi-row:hover { border-color: #cbd5e1; }
.opsi-row .opsi-label {
  font-weight: 700; color: var(--guru); min-width: 24px;
  padding-top: 10px; text-align: center;
}
.opsi-row .opsi-content {
  flex: 1; display: flex; flex-direction: column; gap: 6px; min-width: 0;
}
.opsi-row .opsi-content input[type="text"] {
  width: 100%; padding: 10px 12px; border: 1.5px solid var(--border);
  border-radius: 8px; font-size: 0.9rem; outline: none;
  transition: border-color 0.15s;
}
.opsi-row .opsi-content input[type="text"]:focus { border-color: var(--guru); }
.opsi-row .opsi-actions {
  display: flex; flex-direction: column; gap: 4px; padding-top: 2px;
}
.opsi-img-btn,
.opsi-del-btn {
  width: 32px; height: 32px; border: none; border-radius: 8px;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  font-size: 0.85rem; transition: background 0.15s;
}
.opsi-img-btn { background: #dcfce7; color: #047857; }
.opsi-img-btn:hover { background: #bbf7d0; }
.opsi-img-btn.has-image { background: #047857; color: #fff; }
.opsi-del-btn { background: #fee2e2; color: var(--danger); }
.opsi-del-btn:hover { background: #fecaca; }

.opsi-img-preview {
  position: relative; display: none; align-self: flex-start;
  max-width: 100%; border-radius: 8px; overflow: hidden;
  border: 1.5px dashed #cbd5e1; padding: 4px; background: #f8fafc;
}
.opsi-img-preview.active { display: inline-block; }
.opsi-img-preview img {
  display: block; max-width: 100%; height: auto;
  border-radius: 6px; cursor: pointer;
}
.opsi-img-preview .opsi-img-remove {
  position: absolute; top: 6px; right: 6px;
  width: 26px; height: 26px; border-radius: 50%;
  border: none; background: rgba(239, 68, 68, 0.95); color: #fff;
  cursor: pointer; font-size: 0.75rem;
  display: flex; align-items: center; justify-content: center;
}
.opsi-img-preview .opsi-img-remove:hover { background: rgba(220, 38, 38, 1); }

/* Dark mode untuk toolbar v2 & resizer */
body.dark .editor-toolbar-v2 { background: linear-gradient(180deg, #1e293b, #0f172a); border-color: #334155; }
body.dark .ttbar-group { background: #0f172a; border-color: #334155; }
body.dark .editor-toolbar-v2 .toolbar-select { color: #e2e8f0; }
body.dark .editor-toolbar-v2 .toolbar-btn { color: #e2e8f0; }
body.dark .editor-toolbar-v2 .toolbar-btn:hover { background: #1e3a5f; color: #38bdf8; }
body.dark .ttbar-row-primary { border-bottom-color: #334155; }
body.dark .img-resizer { background: #1e293b; color: #e2e8f0; border-color: #334155; }
body.dark .img-resizer-row .img-size-btn,
body.dark .img-resizer-row .img-align-btn { background: #0f172a; color: #e2e8f0; border-color: #334155; }
body.dark .opsi-row { background: #0f172a; border-color: #334155; }
body.dark .opsi-row .opsi-content input[type="text"] { background: #0f172a; color: #f1f5f9; border-color: #334155; }
body.dark .opsi-img-preview { background: #1e293b; border-color: #334155; }

/* ===== TIMER CIRCLE ===== */
.timer-wrap { display: flex; flex-direction: column; align-items: center; margin-bottom: 16px; }
.timer-circle { position: relative; width: 80px; height: 80px; }
.timer-circle svg { transform: rotate(-90deg); }
.timer-circle .bg-circle { fill: none; stroke: #e2e8f0; stroke-width: 6; }
.timer-circle .prog-circle { fill: none; stroke: var(--guru); stroke-width: 6; stroke-linecap: round; transition: stroke-dashoffset .9s linear, stroke .5s; }
.timer-circle .timer-text { position: absolute; inset: 0; display: flex; align-items: center; justify-content: center; font-size: 1rem; font-weight: 800; color: var(--dark); }

/* ===== SOAL NAVIGATOR ===== */
.soal-nav { display: flex; flex-wrap: wrap; gap: 4px; }
.soal-nav-btn {
  width: 26px; height: 26px; border-radius: 5px; border: 1.5px solid var(--border);
  background: #fff; font-size: 0.7rem; font-weight: 700; cursor: pointer; transition: all .2s;
  display: flex; align-items: center; justify-content: center;
}
.soal-nav-btn.done { background: #10b981; border-color: #10b981; color: #fff; }
.soal-nav-btn.current { background: var(--guru); border-color: var(--guru); color: #fff; }
.soal-nav-btn.undone { background: #fee2e2; border-color: var(--danger); color: var(--danger); }

/* ===== UJIAN CARD ===== */
.ujian-card { background: #fff; border-radius: var(--radius); padding: 28px; box-shadow: var(--shadow); max-width: 800px; margin: 0 auto; }
#screenForm .ujian-card { background: transparent; box-shadow: none; }
.ujian-header { display: flex; align-items: center; justify-content: space-between; margin-bottom: 20px; flex-wrap: wrap; gap: 12px; }
.soal-number { font-size: 0.85rem; color: var(--gray); font-weight: 600; }
.soal-text { font-size: 1rem; line-height: 1.8; margin-bottom: 20px; padding: 16px; background: #f8fafc; border-radius: 10px; border-left: 4px solid var(--guru); }
.options-list { display: flex; flex-direction: column; gap: 10px; }
.option-item {
  display: flex; align-items: flex-start; gap: 12px; padding: 14px 16px;
  border: 2px solid var(--border); border-radius: 10px; cursor: pointer; transition: all .2s;
}
.option-item:hover { border-color: var(--guru); background: #f0f9ff; }
.option-item.selected { border-color: var(--guru); background: #e0f2fe; }
.option-item input[type=radio] { margin-top: 2px; accent-color: var(--guru); }
.option-label { font-weight: 700; color: var(--guru); min-width: 20px; }

/* ===== RESULT ===== */
.result-card { text-align: center; padding: 40px 28px; }
.result-score { font-size: 4rem; font-weight: 900; margin: 16px 0; }
.result-score.pass { color: var(--peserta); }
.result-score.fail { color: var(--danger); }
.result-msg { font-size: 1.2rem; font-weight: 600; margin-bottom: 8px; }
.result-detail { color: var(--gray); font-size: 0.9rem; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .hamburger { display: block; }
  .nav-links { display: none; flex-direction: column; position: absolute; top: 64px; left: 0; right: 0; background: #1e293b; padding: 12px; gap: 4px; }
  .nav-links.open { display: flex; }
  .main-content { padding: 16px; }
  .guru-main { padding: 16px; }
  .hero-content h2 { font-size: 6vw; }
  .cards-grid { grid-template-columns: 1fr; }
  .stats-grid { grid-template-columns: repeat(2, 1fr); }
  .table-header { flex-direction: column; align-items: flex-start; }
  .table-actions { width: 100%; justify-content: flex-start; }
}

@media (max-width: 480px) {
  .stats-grid { grid-template-columns: 1fr; }
  .ujian-card { padding: 16px; }
  .editor-toolbar { gap: 1px; }
  .toolbar-btn { width: 28px; height: 28px; font-size: 0.75rem; }
  .sidebar { width: 260px; left: -260px; }
  .sidebar.open { left: 0; }
}

/* ===== CONSISTENT STYLING FOR ALL DEVICES ===== */
/* Hamburger button - always visible on all devices */
.hamburger-btn {
  display: flex !important;
}

/* Navbar brand - responsive text */
@media (max-width: 768px) {
  .app-navbar .nav-brand span { font-size: 0.85rem; }
}

@media (max-width: 480px) {
  .app-navbar .nav-brand span { font-size: 0.8rem; }
  .app-navbar .nav-brand i { font-size: 1.2rem; }
  .hamburger-btn { width: 36px; height: 36px; font-size: 1rem; }
}

/* Sidebar - consistent width and behavior on all devices */
.sidebar {
  width: 280px;
  left: -280px;
}

@media (max-width: 480px) {
  .sidebar {
    width: 260px;
    left: -260px;
  }
}

.sidebar.open {
  left: 0;
}
/* ===== HAMBURGER BUTTON ===== */
.hamburger-btn {
  display: flex !important;
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.25);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  margin-right: 8px;
}
.hamburger-btn:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
}

/* Responsive hamburger button */
@media (max-width: 480px) {
  .hamburger-btn {
    width: 36px;
    height: 36px;
    font-size: 1rem;
    margin-right: 6px;
  }
}

/* ===== HIDE OLD TAB NAVIGATION ===== */
.app-tabnav,
.guru-tabnav,
.admin-tabnav,
#adminTabNav,
#guruTabNav {
  display: none !important;
}

/* ===== SIDEBAR ===== */
.sidebar {
  position: fixed;
  top: 0;
  left: -280px;
  width: 280px;
  height: 100vh;
  background: #fff;
  box-shadow: 4px 0 24px rgba(0,0,0,0.15);
  z-index: 50;
  transition: left .3s ease;
  overflow-y: auto;
}

/* Responsive sidebar width */
@media (max-width: 480px) {
  .sidebar {
    width: 260px;
    left: -260px;
  }
}

.sidebar.open {
  left: 0;
}

.sidebar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 20px;
  background: linear-gradient(135deg, #0c4a6e 0%, #0369a1 50%, #0ea5e9 100%);
  color: #fff;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* Responsive sidebar header */
@media (max-width: 480px) {
  .sidebar-header {
    padding: 16px;
  }
  .sidebar-header h3 {
    font-size: 1rem;
  }
}

/* Admin sidebar header */
#adminSidebar .sidebar-header {
  background: linear-gradient(135deg, #581c87 0%, #7c3aed 50%, #a855f7 100%);
}

.sidebar-header h3 {
  font-size: 1.1rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  gap: 10px;
}
.sidebar-close {
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.25);
  color: #fff;
  width: 36px;
  height: 36px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.1rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

/* Responsive sidebar close button */
@media (max-width: 480px) {
  .sidebar-close {
    width: 32px;
    height: 32px;
    font-size: 1rem;
  }
}

.sidebar-close:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
}

.sidebar-nav {
  padding: 12px;
}

.sidebar-nav a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  color: var(--dark);
  text-decoration: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all .2s;
  margin-bottom: 4px;
}

/* Responsive sidebar nav items */
@media (max-width: 480px) {
  .sidebar-nav {
    padding: 10px;
  }
  .sidebar-nav a {
    padding: 12px 14px;
    font-size: 0.9rem;
    gap: 10px;
  }
}

.sidebar-nav a i {
  font-size: 1.2rem;
  width: 24px;
  text-align: center;
  color: var(--guru);
  flex-shrink: 0;
}

/* Responsive sidebar icons */
@media (max-width: 480px) {
  .sidebar-nav a i {
    font-size: 1.1rem;
    width: 22px;
  }
}

/* Admin sidebar icons */
#adminSidebar .sidebar-nav a i {
  color: var(--admin);
}
.sidebar-nav a:hover {
  background: #f0f9ff;
  color: var(--guru);
}
/* Admin sidebar hover */
#adminSidebar .sidebar-nav a:hover {
  background: #f3e8ff;
  color: var(--admin);
}
.sidebar-nav a.active {
  background: linear-gradient(135deg, #e0f2fe, #bae6fd);
  color: var(--guru);
  font-weight: 700;
}
/* Admin sidebar active */
#adminSidebar .sidebar-nav a.active {
  background: linear-gradient(135deg, #f3e8ff, #e9d5ff);
  color: var(--admin);
}
.sidebar-overlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(0,0,0,0.5);
  z-index: 49;
  backdrop-filter: blur(2px);
}
.sidebar-overlay.active {
  display: block;
}

/* ===== TABS ===== */
.tabs { display: flex; gap: 4px; margin-bottom: 20px; background: #e2e8f0; padding: 4px; border-radius: 10px; }
.tab-btn { flex: 1; padding: 10px; border: none; background: transparent; border-radius: 8px; font-size: 0.85rem; font-weight: 600; cursor: pointer; transition: all .2s; color: var(--gray); }
.tab-btn.active { background: #fff; color: var(--dark); box-shadow: 0 2px 8px rgba(0,0,0,0.08); }

/* ===== SEARCH ===== */
.search-bar { display: flex; gap: 8px; margin-bottom: 16px; }
.search-bar input { flex: 1; padding: 10px 14px; border: 2px solid var(--border); border-radius: 10px; font-size: 0.9rem; outline: none; }
.search-bar input:focus { border-color: var(--guru); }

/* ===== UPLOAD AREA ===== */
.upload-area {
  border: 2px dashed var(--border); border-radius: 12px; padding: 32px; text-align: center;
  cursor: pointer; transition: all .2s; background: #f8fafc;
}
.upload-area:hover { border-color: var(--guru); background: #f0f9ff; }
.upload-area i { font-size: 2.5rem; color: var(--guru); margin-bottom: 12px; }
.upload-area p { color: var(--gray); font-size: 0.9rem; }

/* ===== PROGRESS BAR ===== */
.progress-bar { height: 8px; background: #e2e8f0; border-radius: 4px; overflow: hidden; margin-bottom: 8px; }
.progress-fill { height: 100%; border-radius: 4px; transition: width .5s; }

/* ===== TOOLTIP ===== */
[data-tip] { position: relative; }
[data-tip]:hover::after {
  content: attr(data-tip); position: absolute; bottom: 110%; left: 50%; transform: translateX(-50%);
  background: #1e293b; color: #fff; padding: 4px 8px; border-radius: 6px; font-size: 0.75rem;
  white-space: nowrap; z-index: 999; pointer-events: none;
}

/* ===== MISC ===== */
.flex { display: flex; } .items-center { align-items: center; } .gap-2 { gap: 8px; } .gap-3 { gap: 12px; }
.mt-2 { margin-top: 8px; } .mt-3 { margin-top: 12px; } .mt-4 { margin-top: 16px; }
.mb-2 { margin-bottom: 8px; } .mb-3 { margin-bottom: 12px; } .mb-4 { margin-bottom: 16px; }
.text-sm { font-size: 0.85rem; } .text-gray { color: var(--gray); } .font-bold { font-weight: 700; }
.w-full { width: 100%; } .text-center { text-align: center; }
.hidden { display: none !important; }
.grid-2 { display: grid; grid-template-columns: 1fr 1fr; gap: 16px; }
@media(max-width:600px){ .grid-2 { grid-template-columns: 1fr; } }
.card-white { background: #fff; border-radius: var(--radius); padding: 20px; box-shadow: var(--shadow); margin-bottom: 20px; }
.section-head { display: flex; align-items: center; justify-content: space-between; margin-bottom: 16px; flex-wrap: wrap; gap: 8px; }
.section-head h2 { font-size: 1.1rem; font-weight: 700; display: flex; align-items: center; gap: 8px; }
input[type=range] { accent-color: var(--guru); }
.chip { display: inline-flex; align-items: center; gap: 4px; padding: 3px 10px; border-radius: 20px; font-size: 0.75rem; font-weight: 600; background: #e0f2fe; color: #0369a1; }

/* ===== DARK MODE TOGGLE BUTTON ===== */
.dark-toggle {
  background: rgba(255,255,255,0.1); border: 1.5px solid rgba(255,255,255,0.35); color: rgba(255,255,255,0.9);
  border-radius: 8px; padding: 7px 14px; cursor: pointer; font-size: 0.82rem; font-weight: 600;
  display: flex; align-items: center; gap: 6px; transition: all .2s; white-space: nowrap; line-height: 1;
}
.dark-toggle:hover { background: rgba(255,255,255,0.2); border-color: rgba(255,255,255,0.7); color: #fff; }

/* ===== SIDEBAR DARK MODE ===== */
body.dark .sidebar {
  background: #1e293b;
}
body.dark .sidebar-nav a {
  color: #e2e8f0;
}
body.dark .sidebar-nav a i {
  color: #38bdf8;
}
body.dark #adminSidebar .sidebar-nav a i {
  color: #c4b5fd;
}
body.dark .sidebar-nav a:hover {
  background: #0c2d4a;
  color: #38bdf8;
}
body.dark #adminSidebar .sidebar-nav a:hover {
  background: #2e1065;
  color: #c4b5fd;
}
body.dark .sidebar-nav a.active {
  background: linear-gradient(135deg, #0c2d4a, #0c4a6e);
  color: #38bdf8;
}
body.dark #adminSidebar .sidebar-nav a.active {
  background: linear-gradient(135deg, #2e1065, #4c1d95);
  color: #c4b5fd;
}

/* ===== DARK MODE ===== */
body.dark {
  --dark: #e2e8f0;
  --light: #0f172a;
  --gray: #94a3b8;
  --border: #334155;
  background: #0f172a;
  color: #e2e8f0;
}
body.dark .card,
body.dark .stat-card,
body.dark .card-white,
body.dark .ujian-card,
body.dark .table-card { background: #1e293b; border-color: #334155; }
body.dark .main-content { background: #0f172a; }
body.dark .guru-main { background: #0c1a2e; }
body.dark th { background: #1e293b; color: #94a3b8; }
body.dark td { border-color: #334155; }
body.dark tr:hover td { background: #1e293b; }
body.dark .form-group input,
body.dark .form-group select,
body.dark .form-group textarea { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark .form-group input:focus,
body.dark .form-group select:focus { border-color: var(--guru); background: #1e293b; }
body.dark .modal { background: #1e293b; }
body.dark .modal-body { background: #1e293b; }
body.dark .editor-toolbar { background: #1e293b; border-color: #334155; }
body.dark .editor-area { background: #0f172a; border-color: #334155; color: #e2e8f0; }
body.dark .editor-area::-webkit-scrollbar-track { background: #1e293b; }
body.dark .editor-area::-webkit-scrollbar-thumb { background: #334155; }
body.dark .editor-area::-webkit-scrollbar-thumb:hover { background: #475569; }
body.dark #opsiPGContainer::-webkit-scrollbar-track,
body.dark #opsiPGKContainer::-webkit-scrollbar-track,
body.dark #opsiJodoh::-webkit-scrollbar-track { background: #1e293b; }
body.dark #opsiPGContainer::-webkit-scrollbar-thumb,
body.dark #opsiPGKContainer::-webkit-scrollbar-thumb,
body.dark #opsiJodoh::-webkit-scrollbar-thumb { background: #334155; }
body.dark #opsiPGContainer::-webkit-scrollbar-thumb:hover,
body.dark #opsiPGKContainer::-webkit-scrollbar-thumb:hover,
body.dark #opsiJodoh::-webkit-scrollbar-thumb:hover { background: #475569; }
body.dark .toolbar-select { background: #1e293b; color: #e2e8f0; border-color: #334155; }
body.dark .toolbar-btn { color: #e2e8f0; }
body.dark .toolbar-btn:hover { background: #334155; }
body.dark .soal-text { background: #1e293b; border-left-color: var(--guru); }
body.dark .option-item { border-color: #334155; }
body.dark .option-item:hover { background: #1e3a5f; border-color: var(--guru); }
body.dark .option-item.selected { background: #0c2d4a; border-color: var(--guru); }
body.dark .soal-nav-btn { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark .soal-nav-btn.undone { background: #3b1a1a; border-color: var(--danger); color: var(--danger); }
body.dark .soal-nav-btn.done { background: #10b981; border-color: #10b981; color: #fff; }
body.dark .soal-nav-btn.current { background: var(--guru); border-color: var(--guru); color: #fff; }
body.dark .tabs { background: #1e293b; }
body.dark .tab-btn.active { background: #334155; color: #e2e8f0; }
body.dark .search-bar input { background: #1e293b; border-color: #334155; color: #e2e8f0; }
body.dark .upload-area { background: #1e293b; border-color: #334155; }
body.dark .upload-area:hover { background: #0c2d4a; }
body.dark .section-title { color: #e2e8f0; }
body.dark .top-bar h1 { color: #e2e8f0; }
body.dark .top-bar button { color: #e2e8f0 !important; }
body.dark .btn-gray { background: #334155; color: #e2e8f0; }
body.dark .btn-gray:hover { background: #475569; }
/* Download dropdown — dark mode */
body.dark #_dlDrop {
  background: #1e293b !important;
  border-color: #334155 !important;
  box-shadow: 0 8px 28px rgba(0,0,0,.4) !important;
}
body.dark #_dlDrop > div:first-child { color: #64748b !important; border-bottom-color: #334155 !important; }
body.dark #_dlDrop > div[style*="height:1px"] { background: #334155 !important; }
body.dark #_dlDrop button { color: inherit !important; }
body.dark #_dlDrop button:first-of-type { color: #fca5a5 !important; }
body.dark #_dlDrop button:last-of-type  { color: #93c5fd !important; }
body.dark #_dlDrop button:first-of-type:hover { background: rgba(220,38,38,.15) !important; }
body.dark #_dlDrop button:last-of-type:hover  { background: rgba(29,78,216,.15) !important; }
body.dark .chip { background: #1e3a5f; color: #38bdf8; }
body.dark .progress-bar { background: #334155; }
body.dark [data-tip]:hover::after { background: #334155; }
body.dark .home-body { background: #0f172a; }
body.dark .footer { background: #020617; }
body.dark .main-content { background: #0f172a; }
body.dark .guru-main { background: #0c1a2e; }
body.dark .app-tabnav { background: rgba(0,0,0,0.4); border-bottom-color: rgba(255,255,255,0.08); }
body.dark .admin-tabnav { background: linear-gradient(90deg, #2e1065 0%, #4c1d95 100%); }
body.dark .guru-tabnav { background: linear-gradient(90deg, #082f49 0%, #0c4a6e 100%); }
body.dark .btn-logout-top { border-color: rgba(248,113,113,0.5); background: rgba(239,68,68,0.15); color: #fca5a5; }
body.dark .btn-logout-top:hover { background: #ef4444; border-color: #ef4444; color: #fff; }
body.dark .dark-toggle { background: rgba(255,255,255,0.08); border-color: rgba(255,255,255,0.2); color: rgba(255,255,255,0.8); }

/* ===== ANTI SCREENSHOT ===== */
.ujian-protected {
  -webkit-user-select: none;
  -moz-user-select: none;
  user-select: none;
  -webkit-touch-callout: none;
  -webkit-user-drag: none;
}
.ujian-protected img,
.ujian-protected .soal-text,
.ujian-protected .options-list {
  -webkit-user-drag: none;
  pointer-events: none;
}
.ujian-protected .option-item,
.ujian-protected button,
.ujian-protected input,
.ujian-protected select,
.ujian-protected textarea {
  pointer-events: auto;
}

/* Blur konten saat window tidak fokus */
.ujian-blurred #screenUjian .ujian-card,
.ujian-blurred #screenUjian .soal-text,
.ujian-blurred #screenUjian .options-list {
  filter: blur(12px);
  pointer-events: none;
  transition: filter .2s;
}

/* ===== WATERMARK IDENTITAS PESERTA ===== */
#ujianWatermark {
  display: block;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 10; /* di bawah navbar (z-index:100) agar tidak menutup UI */
  overflow: hidden;
  opacity: 0;
  transition: opacity .6s;
}
#ujianWatermark.active { opacity: 1; }
.wm-tile {
  position: absolute;
  white-space: nowrap;
  font-weight: 400;
  font-size: 10px;
  letter-spacing: .3px;
  color: rgba(30,58,138,0.07); /* sangat tipis — terdeteksi di screenshot, tidak ganggu baca */
  transform: rotate(-28deg);
  transform-origin: left center;
  user-select: none;
  pointer-events: none;
}

/* ===== CSS INTERFERENCE OVERLAY (warna/pattern mengacaukan capture tool) ===== */
#ujianCssShield {
  display: none;
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 500;
  /* Noise gradient diagonal tipis — terlihat normal di layar,
     menambah artefak banding di JPEG/PNG-compressed captures */
  background: repeating-linear-gradient(
    -45deg,
    transparent,
    transparent 3px,
    rgba(255,255,255,0.018) 3px,
    rgba(255,255,255,0.018) 4px
  );
  mix-blend-mode: overlay;
}
body.ujian-protected #ujianCssShield { display: block; }
/* Overlay peringatan saat blur */
#blurOverlay {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(15,23,42,0.85);
  z-index: 9999;
  align-items: center;
  justify-content: center;
  flex-direction: column;
  gap: 16px;
  color: #fff;
  text-align: center;
  padding: 20px;
}
#blurOverlay.active { display: flex; }
/* Override font pada elemen di luar sub-dialog agar tidak bentrok */
#blurOverlay > i { font-size: 3rem; color: #f59e0b; }
/* Tombol di dalam dialog anti-curang */
#antiCurangDialog button:focus { outline: 2px solid #fff; outline-offset: 2px; }
/* Pastikan teks di dalam sub-elemen tidak mewarisi opacity/font override global overlay */
#antiCurangDialog, #screenshotWarningMsg { pointer-events: auto; }

/* CSS anti print/screenshot */
@media print {
  body * { visibility: hidden !important; }
  body::after {
    content: "Dokumen ini tidak dapat dicetak.";
    visibility: visible;
    position: fixed;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 2rem;
    font-weight: 800;
    color: #ef4444;
  }
}

/* ===== MODE TAMPILAN HP / LAPTOP ===== */
.view-toggle-btn {
  display: inline-flex; align-items: center; gap: 6px;
  padding: 7px 14px; border-radius: 8px;
  border: 1.5px solid rgba(255,255,255,0.35);
  background: rgba(255,255,255,0.1); color: rgba(255,255,255,0.9);
  font-size: 0.82rem; font-weight: 600; cursor: pointer;
  transition: all .2s; white-space: nowrap;
}
.view-toggle-btn:hover { background: rgba(255,255,255,0.2); }

/* Mode HP */
body.view-hp #screenUjian > div { max-width: 480px !important; }
body.view-hp .ujian-card { padding: 16px !important; }
body.view-hp .soal-nav-btn { width: 32px !important; height: 32px !important; font-size: .75rem !important; }
body.view-hp .soal-text { font-size: .9rem !important; }
body.view-hp .option-item { padding: 10px 12px !important; font-size: .88rem !important; }
body.view-hp .timer-circle svg { width: 60px !important; height: 60px !important; }
body.view-hp .timer-text { font-size: .85rem !important; }
body.view-hp #screenForm > div { max-width: 100% !important; }
body.view-hp .grid-2 { grid-template-columns: 1fr !important; }

/* Mode Laptop (default) */
body.view-laptop #screenUjian > div { max-width: 900px !important; }




/* ===== DROPDOWN MENU TITIK TIGA ===== */
.dropdown-menu-container {
  position: relative;
  display: inline-block;
}

.btn-menu-dots {
  background: rgba(255,255,255,0.1);
  border: 1.5px solid rgba(255,255,255,0.25);
  color: #fff;
  width: 40px;
  height: 40px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
  padding: 0;
}

.btn-menu-dots:hover {
  background: rgba(255,255,255,0.2);
  border-color: rgba(255,255,255,0.4);
}

.dropdown-menu {
  display: none;
  position: absolute;
  top: calc(100% + 8px);
  right: 0;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.15);
  min-width: 220px;
  z-index: 1000;
  overflow: hidden;
  animation: dropdownSlideIn 0.2s ease;
}

@keyframes dropdownSlideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.dropdown-menu.active {
  display: block;
}

.dropdown-menu a {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  color: var(--dark);
  text-decoration: none;
  font-size: 0.9rem;
  font-weight: 500;
  transition: all .2s;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.dropdown-menu a:hover {
  background: #f0f9ff;
  color: var(--guru);
}

.dropdown-menu a i {
  font-size: 1rem;
  width: 20px;
  text-align: center;
  flex-shrink: 0;
}

.dropdown-divider {
  height: 1px;
  background: var(--border);
  margin: 4px 0;
}

/* Dark mode untuk dropdown */
body.dark .dropdown-menu {
  background: #1e293b;
  box-shadow: 0 8px 32px rgba(0,0,0,0.4);
}

body.dark .dropdown-menu a {
  color: #e2e8f0;
}

body.dark .dropdown-menu a:hover {
  background: #0c2d4a;
  color: #38bdf8;
}

body.dark .dropdown-divider {
  background: #334155;
}

/* Responsive untuk mobile */
@media (max-width: 480px) {
  .btn-menu-dots {
    width: 36px;
    height: 36px;
    font-size: 1rem;
  }
  
  .dropdown-menu {
    min-width: 200px;
    right: -8px;
  }
  
  .dropdown-menu a {
    padding: 10px 14px;
    font-size: 0.85rem;
  }
}

/* Hide dropdown saat klik di luar */
.dropdown-menu-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  z-index: 999;
}

.dropdown-menu-backdrop.active {
  display: block;
}


/* ===== TEMA APLIKASI ===== */
/* Tema Biru Lembut */
body.theme-blue {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}
body.theme-blue .card-white,
body.theme-blue .table-card,
body.theme-blue .modal {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}
body.theme-blue .app-navbar {
  background: linear-gradient(135deg, #1e40af 0%, #3b82f6 100%);
}

/* Tema Hijau Lembut */
body.theme-green {
  background: linear-gradient(135deg, #dcfce7 0%, #bbf7d0 100%);
}
body.theme-green .card-white,
body.theme-green .table-card,
body.theme-green .modal {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}
body.theme-green .app-navbar {
  background: linear-gradient(135deg, #047857 0%, #10b981 100%);
}

/* Tema Kuning Pucat */
body.theme-yellow {
  background: linear-gradient(135deg, #fef9c3 0%, #fef08a 100%);
}
body.theme-yellow .card-white,
body.theme-yellow .table-card,
body.theme-yellow .modal {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}
body.theme-yellow .app-navbar {
  background: linear-gradient(135deg, #a16207 0%, #ca8a04 100%);
}

/* Tema Abu-abu Muda */
body.theme-gray {
  background: linear-gradient(135deg, #f1f5f9 0%, #e2e8f0 100%);
}
body.theme-gray .card-white,
body.theme-gray .table-card,
body.theme-gray .modal {
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(10px);
}
body.theme-gray .app-navbar {
  background: linear-gradient(135deg, #475569 0%, #64748b 100%);
}

/* Dark mode untuk semua tema */
body.dark.theme-blue { background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%); }
body.dark.theme-green { background: linear-gradient(135deg, #064e3b 0%, #047857 100%); }
body.dark.theme-yellow { background: linear-gradient(135deg, #713f12 0%, #854d0e 100%); }
body.dark.theme-gray { background: linear-gradient(135deg, #1e293b 0%, #334155 100%); }
