/* ============================================================
   DESIGN SYSTEM — "Pola Pikir"
   Sumber: Aplikasi Pemetaan Profil Pola Pikir (PMKKA 2026)
   ============================================================ */

/* ---------- 1. PALET WARNA (CSS Variables) ---------- */
:root {
  /* Latar & permukaan */
  --bg-body: #f1f5f9;             /* slate-100  */
  --bg-card: #ffffff;
  --bg-soft: #f8fafc;             /* slate-50   */
  --bg-muted: #f1f5f9;            /* slate-100  */

  /* Border */
  --border: #e2e8f0;              /* slate-200  */
  --border-strong: #cbd5e1;       /* slate-300  */

  /* Teks */
  --text-strong: #0f172a;         /* slate-900  */
  --text: #334155;                /* slate-700  */
  --text-muted: #64748b;          /* slate-500  */
  --text-faint: #94a3b8;          /* slate-400  */
  --text-inverse: #ffffff;

  /* Warna primer (indigo) */
  --primary-50: #eef2ff;
  --primary-100: #e0e7ff;
  --primary-200: #c7d2fe;
  --primary-400: #818cf8;
  --primary-500: #6366f1;
  --primary-600: #4f46e5;
  --primary-700: #4338ca;
  --primary-800: #3730a3;
  --primary-900: #312e81;
  --primary-950: #1e1b4b;

  /* Warna aksen */
  --sky-300: #7dd3fc;
  --sky-400: #38bdf8;
  --sky-500: #0ea5e9;
  --emerald-50: #ecfdf5;
  --emerald-400: #34d399;
  --emerald-600: #059669;
  --emerald-900: #064e3b;
  --amber-100: #fef3c7;
  --amber-200: #fde68a;
  --amber-500: #f59e0b;
  --amber-600: #d97706;
  --amber-900: #78350f;
  --rose-400: #fb7185;
  --rose-500: #f43f5e;
  --rose-600: #e11d48;

  /* Gelap (footer, banner) */
  --dark-800: #1e293b;
  --dark-900: #0f172a;
  --dark-950: #020617;

  /* Bayangan */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
  --shadow-xl: 0 20px 25px -5px rgba(0, 0, 0, 0.1);
  --shadow-indigo: 0 4px 6px -1px rgba(199, 210, 254, 0.6);

  /* Radius */
  --radius-sm: 0.5rem;
  --radius-md: 0.75rem;
  --radius-lg: 1rem;
  --radius-xl: 1.5rem;
  --radius-full: 9999px;
}

/* ---------- 2. BASE / RESET ---------- */
*,
*::before,
*::after {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: ui-sans-serif, system-ui, -apple-system, "Segoe UI",
    Roboto, "Helvetica Neue", Arial, sans-serif;
  background: var(--bg-body);
  color: var(--text);
  line-height: 1.5;
  -webkit-font-smoothing: antialiased;
}

h1, h2, h3, h4 {
  color: var(--text-strong);
  letter-spacing: -0.025em;
  margin-top: 0;
}

/* ---------- 3. LAYOUT ---------- */
.container {
  max-width: 1152px;              /* setara max-w-6xl */
  margin-left: auto;
  margin-right: auto;
  padding-left: 1rem;
  padding-right: 1rem;
}

@media (min-width: 640px) {
  .container { padding-left: 1.5rem; padding-right: 1.5rem; }
}
@media (min-width: 1024px) {
  .container { padding-left: 2rem; padding-right: 2rem; }
}

.grid-2 {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.25rem;
}
@media (min-width: 640px) {
  .grid-2 { grid-template-columns: 1fr 1fr; }
}

/* ---------- 4. TOMBOL ---------- */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  padding: 0.875rem 2rem;
  border: none;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
  text-decoration: none;
}
.btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

/* Tombol primer */
.btn-primary {
  background: var(--primary-600);
  color: var(--text-inverse);
  box-shadow: var(--shadow-indigo);
}
.btn-primary:hover {
  background: var(--primary-700);
  box-shadow: var(--shadow-lg);
}

/* Tombol sekunder / abu-abu */
.btn-secondary {
  background: #f1f5f9;
  color: var(--text);
  border: 1px solid rgba(203, 213, 225, 0.7);
}
.btn-secondary:hover {
  background: #e2e8f0;
  color: var(--text-strong);
}

/* ---------- 5. KARTU ---------- */
.card {
  background: var(--bg-card);
  border: 1px solid rgba(226, 232, 240, 0.8);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-sm);
  padding: 1.5rem 2rem;
}

.card-clickable {
  cursor: pointer;
  border: 2px solid #e2e8f0;
  border-radius: var(--radius-lg);
  background: #fff;
  padding: 1.25rem;
  transition: all 0.15s ease;
}
.card-clickable:hover {
  border-color: #cbd5e1;
}
.card-clickable.selected {
  border-color: var(--primary-600);
  background: rgba(238, 242, 255, 0.6);
  box-shadow: var(--shadow-sm);
}

/* ---------- 6. BANNER GRADASI ---------- */
.banner {
  background: linear-gradient(90deg, var(--primary-900), var(--primary-800), var(--dark-900));
  border-radius: var(--radius-xl);
  padding: 1.5rem 2.5rem;
  color: #fff;
  box-shadow: var(--shadow-xl);
  position: relative;
  overflow: hidden;
  margin-bottom: 2rem;
}
.banner h2 {
  color: #fff;
  font-size: 1.875rem;
  font-weight: 800;
  margin-bottom: 0.75rem;
}
.banner p {
  color: #cbd5e1;
  font-size: 0.875rem;
  line-height: 1.625;
}

/* ---------- 7. BADGE ---------- */
.badge {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  font-size: 0.6875rem;
  font-weight: 600;
  padding: 0.125rem 0.5rem;
  border-radius: var(--radius-full);
}
.badge-indigo {
  background: var(--primary-50);
  color: var(--primary-700);
  border: 1px solid rgba(199, 210, 254, 0.6);
}
.badge-amber {
  background: var(--amber-100);
  color: var(--amber-900);
  border: 1px solid rgba(253, 230, 138, 0.8);
}
.badge-emerald {
  background: var(--emerald-50);
  color: var(--emerald-900);
  border: 1px solid rgba(167, 243, 208, 0.8);
}
.badge-dark {
  background: rgba(30, 41, 59, 0.6);
  color: #c7d2fe;
  border: 1px solid rgba(67, 56, 202, 0.5);
}
.badge-sky {
  background: var(--sky-500);
  color: #fff;
  border: 1px solid rgba(14, 165, 233, 0.4);
}
.info-box {
  background: rgba(14, 165, 233, 0.08);
  border: 1px solid rgba(14, 165, 233, 0.25);
  color: var(--text-strong);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  line-height: 1.5;
}
.modal-lg { max-width: 50rem; width: 100%; }

/* ---------- 8. INPUT ---------- */
.input {
  width: 100%;
  padding: 0.625rem 1rem;
  padding-left: 2.5rem;           /* ruang ikon di kiri */
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  font-size: 0.875rem;
  color: var(--text-strong);
  transition: all 0.15s ease;
}
.input:focus {
  background: #fff;
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px var(--primary-200);
}
.input-error {
  border-color: var(--rose-400);
}
.input-error:focus {
  border-color: var(--rose-500);
  box-shadow: 0 0 0 2px #fecdd3;
}
.field-label {
  display: block;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--text);
  margin-bottom: 0.375rem;
}
.field-required {
  color: var(--rose-500);
}
.field-error {
  font-size: 0.75rem;
  color: var(--rose-500);
  margin-top: 0.25rem;
}

/* ---------- 9. HEADER (sticky) ---------- */
.header {
  background: #fff;
  border-bottom: 1px solid var(--border);
  position: sticky;
  top: 0;
  z-index: 40;
  box-shadow: var(--shadow-sm);
}
.header-inner {
  display: flex;
  flex-direction: row;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1rem;
  flex-wrap: wrap;
}
.menu-toggle {
  display: none;
  background: none;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1.5rem;
  line-height: 1;
  padding: 0.25rem 0.5rem;
  cursor: pointer;
  color: var(--text-strong);
}
.header-nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 0.5rem;
}
@media (max-width: 639px) {
  .header-inner { position: relative; }
  .header-brand { padding-right: 3rem; }
  .menu-toggle {
    display: block;
    position: absolute;
    top: 0.625rem;
    right: 1rem;
    z-index: 10;
  }
  .header-nav {
    display: none !important;
    flex-basis: 100%;
    flex-direction: column;
    align-items: stretch;
    gap: 0.375rem;
    padding-top: 0.5rem;
    border-top: 1px solid var(--border);
    margin-top: 0.25rem;
  }
  .header-nav.open {
    display: flex !important;
  }
  .header-nav .btn,
  .header-nav .link,
  .header-nav .link-danger,
  .header-nav .badge {
    width: 100%;
    text-align: center;
    box-sizing: border-box;
  }
}
.header-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  text-decoration: none;
  color: inherit;
}
.header-logo {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500), var(--sky-500));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  box-shadow: var(--shadow-indigo);
  transition: transform 0.2s ease;
}
.header-brand:hover .header-logo {
  transform: scale(1.05);
}
.header-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--text-strong);
  margin: 0;
}
.header-subtitle {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin: 0;
}

/* ---------- 10. FOOTER (gelap) ---------- */
.footer {
  background: var(--dark-900);
  color: #cbd5e1;
  padding: 2rem 0;
  border-top: 1px solid var(--dark-800);
  margin-top: auto;
}
.footer-inner {
  text-align: center;
  display: flex;
  flex-direction: column;
  gap: 1rem;
}
.footer-tagline {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  font-size: 0.75rem;
  color: #94a3b8;
}
.footer-copyright {
  border-top: 1px solid rgba(30, 41, 59, 0.8);
  padding-top: 0.5rem;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  font-size: 0.75rem;
  color: #94a3b8;
}
@media (min-width: 640px) {
  .footer-copyright { flex-direction: row; }
}
.footer-copyright strong {
  color: #cbd5e1;
}

/* ---------- 11. TEKS HELPER ---------- */
.text-xs { font-size: 0.75rem; }
.text-sm { font-size: 0.875rem; }
.text-lg { font-size: 1.125rem; }
.text-xl { font-size: 1.25rem; }
.text-2xl { font-size: 1.5rem; }
.text-3xl { font-size: 1.875rem; }

.muted { color: var(--text-muted); }
.faint { color: var(--text-faint); }
.strong { color: var(--text-strong); }
.white { color: #fff; }
.center { text-align: center; }

/* ---------- 12. CETAK / PDF ---------- */
@media print {
  .no-print { display: none !important; }
}

/* ---------- 13. UTILITAS & KOMPONEN (JawabKita) ---------- */
.hidden { display: none !important; }

.flex { display: flex; }
.flex-col { flex-direction: column; }
.flex-wrap { flex-wrap: wrap; }
.items-center { align-items: center; }
.items-start { align-items: flex-start; }
.self-center { align-self: center; }
.justify-between { justify-content: space-between; }
.justify-end { justify-content: flex-end; }
.flex-1 { flex: 1 1 0%; }
.min-w-0 { min-width: 0; }
.shrink-0 { flex-shrink: 0; }

.gap-1 { gap: 0.25rem; }
.gap-2 { gap: 0.5rem; }
.gap-3 { gap: 0.75rem; }
.gap-4 { gap: 1rem; }

.mt-1 { margin-top: 0.25rem; }
.mt-1-5 { margin-top: 0.375rem; }
.mt-2 { margin-top: 0.5rem; }
.mt-3 { margin-top: 0.75rem; }
.mt-4 { margin-top: 1rem; }
.mb-1 { margin-bottom: 0.25rem; }
.mb-2 { margin-bottom: 0.5rem; }
.mb-3 { margin-bottom: 0.75rem; }
.mb-4 { margin-bottom: 1rem; }
.my-5 { margin-top: 1.25rem; margin-bottom: 1.25rem; }

.text-center { text-align: center; }
.break-words { overflow-wrap: break-word; }
.uppercase { text-transform: uppercase; }
.semibold { font-weight: 600; }
.text-success { color: var(--emerald-600); }
.text-danger { color: var(--rose-500); }

.grid { display: grid; }
.sm-grid { display: grid; grid-template-columns: 1fr; gap: 0.75rem; }
@media (min-width: 640px) { .sm-grid { grid-template-columns: 1fr 1fr; } }
.grid-actions { display: grid; grid-template-columns: 1fr 1fr; gap: 0.5rem; }
@media (min-width: 640px) { .grid-actions { grid-template-columns: repeat(4, 1fr); } }
@media (min-width: 640px) { .grid-actions.g5 { grid-template-columns: repeat(5, 1fr); } }

.space-y-2 > * + * { margin-top: 0.5rem; }
.space-y-3 > * + * { margin-top: 0.75rem; }
.space-y-4 > * + * { margin-top: 1rem; }

.px-2 { padding-left: 0.5rem; padding-right: 0.5rem; }
.px-3 { padding-left: 0.75rem; padding-right: 0.75rem; }

/* Input tanpa ruang ikon */
.input-plain {
  width: 100%;
  padding: 0.625rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background: var(--bg-soft);
  font-size: 0.875rem;
  color: var(--text-strong);
  transition: all 0.15s ease;
}
.input-plain:focus {
  background: #fff;
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px var(--primary-200);
}
.q-textarea {
  resize: vertical;
  min-height: 3rem;
  line-height: 1.5;
  font-family: inherit;
  white-space: pre-wrap;
  overflow-y: hidden;
}

/* Kolom teks pertanyaan & pilihan: menyesuaikan panjang teks & bisa diatur ukurannya */
textarea.qf-text,
textarea.qf-opt-input {
  font-family: inherit;
  line-height: 1.5;
  white-space: pre-wrap;
  resize: vertical;
  overflow: hidden;
  min-height: 2.75rem;
}

/* Spinner */
.spinner {
  display: inline-block;
  width: 2.25rem;
  height: 2.25rem;
  border: 3px solid var(--border-strong);
  border-top-color: var(--primary-500);
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}
@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Select */
.select {
  width: 100%;
  padding: 0.625rem 2.25rem 0.625rem 1rem;
  border-radius: var(--radius-md);
  border: 1px solid var(--border-strong);
  background-color: var(--bg-soft);
  font-size: 0.875rem;
  color: var(--text-strong);
  cursor: pointer;
  transition: all 0.15s ease;
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' width='14' height='14' viewBox='0 0 24 24' fill='none' stroke='%2364748b' stroke-width='3' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M6 9l6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 0.75rem center;
  background-size: 0.875rem;
}
.select:focus {
  background-color: #fff;
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px var(--primary-200);
}

/* Tombol kecil & variasi */
.btn-sm { padding: 0.5rem 1.125rem; font-size: 0.75rem; }
.btn-danger { background: var(--rose-600); color: #fff; }
.btn-danger:hover { background: #be123c; box-shadow: var(--shadow-lg); }
.btn-emerald { background: var(--emerald-600); color: #fff; }
.btn-emerald:hover { background: #047857; box-shadow: var(--shadow-lg); }
.btn-dashed {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  width: 100%;
  padding: 0.875rem;
  border: 2px dashed var(--primary-200);
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--primary-600);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.btn-dashed:hover { background: var(--primary-50); }

/* Tautan */
.link {
  color: var(--primary-600);
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
}
.link:hover { color: var(--primary-700); text-decoration: underline; }
.link-danger {
  color: var(--rose-600);
  font-weight: 600;
  background: none;
  border: none;
  padding: 0;
  cursor: pointer;
  font-size: inherit;
}
.link-danger:hover { color: var(--rose-500); text-decoration: underline; }
.link:disabled, .link-danger:disabled { opacity: 0.35; cursor: not-allowed; }

/* Kartu kecil */
.card-sm { padding: 1.25rem 1.5rem; }

/* Badge tambahan */
.badge-slate {
  background: var(--bg-muted);
  color: var(--text-muted);
  border: 1px solid rgba(226, 232, 240, 0.8);
}

/* Kode set soal */
.code-display {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.5rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  color: var(--primary-600);
}

/* Toggle kuis */
.quiz-toggle {
  display: inline-flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.75rem;
  font-weight: 600;
  color: var(--emerald-900);
  background: var(--emerald-50);
  border: 1px solid rgba(167, 243, 208, 0.8);
  padding: 0.2rem 0.75rem;
  border-radius: var(--radius-full);
  cursor: pointer;
}
.quiz-toggle input { accent-color: var(--emerald-600); margin: 0; }
.quiz-box {
  border: 1px solid rgba(167, 243, 208, 0.8);
  border-radius: var(--radius-md);
  background: var(--emerald-50);
  padding: 1rem;
}

/* ---------- 14. KOMPONEN LIVE (JawabKita) ---------- */
.btn-orange { background: var(--amber-600); color: #fff; }
.btn-orange:hover { background: var(--amber-500); box-shadow: var(--shadow-lg); }
.btn-dark { background: var(--dark-800); color: #fff; }
.btn-dark:hover { background: var(--dark-900); box-shadow: var(--shadow-lg); }

.live-badge { display: inline-flex; align-items: center; gap: 0.375rem; font-size: 0.75rem; font-weight: 700; color: var(--rose-500); letter-spacing: 0.05em; }
.live-dot { width: 0.5rem; height: 0.5rem; border-radius: 9999px; background: var(--rose-500); animation: livePulse 1.2s ease-in-out infinite; }
@keyframes livePulse { 0%, 100% { opacity: 1; } 50% { opacity: 0.2; } }

.view-btn { display: inline-flex; align-items: center; justify-content: center; gap: 0.4rem; padding: 0.625rem 1rem; border-radius: var(--radius-md); font-size: 0.75rem; font-weight: 600; cursor: pointer; transition: all 0.15s ease; border: 1px solid transparent; }
.view-btn.active { background: var(--primary-600); color: #fff; box-shadow: var(--shadow-indigo); }
.view-btn:not(.active) { background: var(--bg-muted); color: var(--text); border-color: rgba(203, 213, 225, 0.7); }
.view-btn:not(.active):hover { background: #e2e8f0; color: var(--text-strong); }

.bar { height: 0.375rem; background: var(--bg-muted); border-radius: 9999px; overflow: hidden; }
.bar-lg { height: 0.625rem; }
.bar-dark { background: #1e293b; }
.bar-fill { height: 100%; border-radius: 9999px; transition: width 0.5s ease; }
.bar-fill.indigo { background: var(--primary-500); }
.bar-fill.emerald { background: var(--emerald-400); }
.bar-fill.emerald-soft { background: var(--emerald-400); opacity: 0.45; }
.bar-fill.amber { background: var(--amber-400); }

.stat-cell { text-align: center; border: 1px solid var(--border); border-radius: var(--radius-lg); padding: 0.75rem; background: #fff; }

.answer-row { border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.75rem 1rem; }
.answer-row.new { box-shadow: 0 0 0 2px var(--emerald-400); }

.qr-box { width: 6rem; height: 6rem; border: 1px solid var(--border); border-radius: var(--radius-md); background: var(--bg-soft); display: flex; align-items: center; justify-content: center; overflow: hidden; font-size: 0.75rem; color: var(--text-faint); text-align: center; }

.word-cloud { margin-bottom: 1rem; padding: 1rem; background: var(--primary-50); border-radius: var(--radius-lg); display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 0.5rem 1rem; }
.word-cloud span { font-weight: 600; color: var(--primary-700); }

.badge-btn { display: inline-flex; align-items: center; gap: 0.25rem; font-size: 0.75rem; font-weight: 600; padding: 0.375rem 0.75rem; border-radius: var(--radius-full); background: var(--primary-50); color: var(--primary-700); border: 1px solid rgba(199, 210, 254, 0.6); cursor: pointer; transition: all 0.15s ease; }
.badge-btn:hover { background: var(--primary-100); }

.overlay { position: fixed; inset: 0; z-index: 50; background: var(--dark-950); overflow-y: auto; }
.overlay .container { padding-top: 2rem; padding-bottom: 2rem; }

.pres-question { font-size: 1.875rem; font-weight: 800; margin-bottom: 2.5rem; overflow-wrap: break-word; color: #fff; }
@media (min-width: 640px) { .pres-question { font-size: 3rem; } }
.pres-count { font-size: 1.875rem; font-weight: 700; color: var(--sky-300); }
.pres-star { font-size: 1.5rem; font-weight: 800; color: var(--amber-200); }
.pres-row { background: #1e293b; border-radius: var(--radius-lg); padding: 0.75rem 1.5rem; display: flex; align-items: center; gap: 1rem; }
.pres-name { font-weight: 700; color: var(--sky-300); flex-shrink: 0; }

.leader-first { background: var(--amber-100); border-radius: var(--radius-md); padding: 0.25rem 0.75rem; }
.leader-bar { width: 8rem; }
@media (min-width: 640px) { .leader-bar { width: 12rem; } }

.text-orange { color: var(--amber-600); }
.fw-bold { font-weight: 700; }
.w-8 { width: 2rem; }
.w-16 { width: 4rem; }
.pr-1 { padding-right: 0.25rem; }
.max-h-64 { max-height: 16rem; overflow-y: auto; }
.space-y-1-5 > * + * { margin-top: 0.375rem; }
.space-y-6 > * + * { margin-top: 1.5rem; }

.grid-3 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
.grid-5 { display: grid; grid-template-columns: repeat(5, 1fr); gap: 0.75rem; }
.grid-6 { display: grid; grid-template-columns: repeat(3, 1fr); gap: 0.75rem; }
@media (min-width: 640px) { .grid-6 { grid-template-columns: repeat(6, 1fr); } }

/* ---------- 15. KOMPONEN PESERTA (JawabKita) ---------- */
.mt-5 { margin-top: 1.25rem; }
.mb-6 { margin-bottom: 1.5rem; }
.font-mono { font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace; }

.code-input {
  width: 100%;
  text-align: center;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 1.875rem;
  font-weight: 700;
  letter-spacing: 0.2em;
  text-transform: uppercase;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-lg);
  padding: 1rem;
  background: var(--bg-soft);
  color: var(--text-strong);
  transition: all 0.15s ease;
}
.code-input:focus {
  outline: none;
  border-color: var(--primary-500);
  box-shadow: 0 0 0 2px var(--primary-200);
  background: #fff;
}

.pick-btn {
  font-size: 1.25rem;
  padding: 0.5rem;
  border-radius: var(--radius-lg);
  border: 1px solid var(--border);
  background: #fff;
  cursor: pointer;
  transition: all 0.15s ease;
}
.pick-btn:hover { border-color: var(--primary-500); background: var(--primary-50); }
.pick-btn.selected { border-color: var(--primary-600); background: rgba(238, 242, 255, 0.6); box-shadow: var(--shadow-indigo); }
.pick-emotion { font-size: 2rem; }

.choice-opt {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  cursor: pointer;
  transition: all 0.15s ease;
  background: #fff;
}
.choice-opt:hover { border-color: var(--primary-500); background: var(--primary-50); }
.choice-opt:has(input:checked) { border-color: var(--primary-600); background: rgba(238, 242, 255, 0.6); box-shadow: var(--shadow-indigo); }
.choice-opt input { accent-color: var(--primary-600); width: 1.25rem; height: 1.25rem; margin: 0; }

/* ---------- 16. TABEL & HALAMAN AUTH (JawabKita) ---------- */
.table-wrap { background: #fff; border: 1px solid var(--border); border-radius: var(--radius-lg); box-shadow: var(--shadow-sm); overflow-x: auto; }
.table { width: 100%; min-width: 640px; border-collapse: collapse; font-size: 0.875rem; text-align: left; }
.table th { background: var(--bg-soft); color: var(--text-muted); text-transform: uppercase; font-size: 0.6875rem; font-weight: 600; padding: 0.75rem 1rem; letter-spacing: 0.05em; white-space: nowrap; }
.table td { padding: 0.75rem 1rem; border-top: 1px solid var(--border); vertical-align: middle; }
.table tbody tr:first-child td { border-top: none; }
.row-empty { color: var(--text-faint); padding: 1rem; }

.btn-xs { padding: 0.375rem 0.75rem; font-size: 0.6875rem; }
.btn-sky { background: var(--sky-500); color: #fff; }
.btn-sky:hover { background: var(--sky-400); box-shadow: var(--shadow-lg); }

.badge-red { background: #ffe4e6; color: #9f1239; border: 1px solid rgba(254, 205, 211, 0.8); }
.badge-purple { background: #faf5ff; color: #6b21a8; border: 1px solid rgba(233, 213, 255, 0.8); }

.note-box { background: var(--bg-soft); border: 1px solid var(--border); border-radius: var(--radius-md); padding: 0.75rem; font-size: 0.75rem; color: var(--text-muted); text-align: center; }

/* ---------- 17. MODAL KONFIRMASI ---------- */
.modal-overlay {
  position: fixed;
  inset: 0;
  z-index: 60;
  background: rgba(2, 6, 23, 0.6);
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
}
.modal {
  width: 100%;
  max-width: 480px;
  background: #fff;
  border-radius: var(--radius-xl);
  box-shadow: var(--shadow-xl);
  overflow: hidden;
  animation: modalPop 0.18s ease;
  display: flex;
  flex-direction: column;
  max-height: 90vh;
}
.modal-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border);
}
.modal-icon {
  width: 3rem;
  height: 3rem;
  border-radius: var(--radius-lg);
  background: #ffe4e6;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.5rem;
  flex-shrink: 0;
}
.modal-body {
  padding: 1.25rem 1.5rem;
  overflow-y: auto;
  min-height: 0;
}
.modal-footer {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  padding: 1rem 1.5rem;
  background: var(--bg-soft);
  border-top: 1px solid var(--border);
}
@keyframes modalPop {
  from { transform: translateY(10px) scale(0.97); opacity: 0; }
  to { transform: none; opacity: 1; }
}
.warn-box {
  margin-top: 0.75rem;
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  background: #fffbeb;
  border: 1px solid #fde68a;
  color: var(--amber-900);
  border-radius: var(--radius-md);
  padding: 0.625rem 0.875rem;
  font-size: 0.8125rem;
}
.code-chip {
  display: inline-block;
  background: var(--bg-muted);
  border: 1px solid var(--border-strong);
  border-radius: var(--radius-sm);
  padding: 0.0625rem 0.5rem;
  font-weight: 700;
  letter-spacing: 0.05em;
  color: var(--primary-600);
}
.undian-stage {
  min-height: 140px;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 1rem;
  border: 2px dashed var(--border-strong);
  border-radius: var(--radius-lg);
  font-size: 2rem;
  font-weight: 800;
  color: var(--primary-700);
  background: var(--bg-soft);
  word-break: break-word;
}

/* ---------- 18. KARTU SEKSI DASHBOARD ---------- */
.step-badge {
  width: 2.5rem;
  height: 2.5rem;
  border-radius: var(--radius-md);
  background: linear-gradient(135deg, var(--primary-600), var(--primary-500));
  color: #fff;
  font-weight: 800;
  font-size: 1.125rem;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: var(--shadow-indigo);
  flex-shrink: 0;
}
.step-badge-slate {
  background: var(--dark-800);
  box-shadow: none;
}

/* Kartu "Buat Set Soal" — aksen indigo + border putus-putus */
.create-card {
  position: relative;
  border: 2px dashed var(--primary-200);
  border-radius: var(--radius-xl);
  background: linear-gradient(180deg, var(--primary-50) 0%, #fff 6rem);
  overflow: hidden;
}
.create-card::before {
  content: "";
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, var(--primary-600), var(--sky-500));
}
.create-card .card-head {
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
  margin-bottom: 1.25rem;
}

/* Kartu "Set Soal Saya" — header band abu-abu */
.list-card {
  padding: 0;
}
.list-card-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  padding: 1.25rem 1.5rem;
  background: var(--bg-soft);
  border-bottom: 1px solid var(--border);
}
.list-card-body {
  padding: 1.25rem 1.5rem 1.5rem;
}
@media (min-width: 640px) {
  .list-card-body { padding: 1.5rem 2rem 2rem; }
}

/* ---------- 19. BACKUP & RESTORE (admin) ---------- */
.backup-cell {
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
  background: var(--bg-soft);
}
.danger-zone {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border: 1px solid #fecdd3;
  background: #fff1f2;
  border-radius: var(--radius-lg);
  padding: 1rem 1.25rem;
}

/* ---------- 20. ANALISIS AI (dashboard) ---------- */
.analysis-content {
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-strong);
  overflow-wrap: break-word;
  word-break: break-word;
}
.analysis-h {
  font-size: 0.85rem;
  font-weight: 700;
  margin: 1.25rem 0 0.5rem;
  padding-bottom: 0.35rem;
  border-bottom: 1px solid var(--border);
  color: var(--text-strong);
}
.analysis-q {
  margin-bottom: 0.75rem;
  white-space: normal;
}
.analysis-q p { white-space: normal; }
.analysis-list {
  margin: 0;
  padding-left: 1.1rem;
  font-size: 0.95rem;
  line-height: 1.7;
  color: var(--text-strong);
}
.analysis-list li { margin-bottom: 0.4rem; }

.ai-history {
  background: var(--bg-soft);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.75rem;
  margin-bottom: 1rem;
}
.history-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.4rem 0;
  border-bottom: 1px dashed var(--border);
}
.history-item:last-child { border-bottom: none; }
.history-btn {
  flex: 1;
  min-width: 0;
  text-align: left;
  background: none;
  border: none;
  cursor: pointer;
  padding: 0.25rem;
  border-radius: var(--radius-sm);
  display: flex;
  flex-direction: column;
  gap: 0.1rem;
  font-size: 0.8rem;
  color: var(--text-strong);
}
.history-btn:hover { background: rgba(14, 165, 233, 0.1); }
.history-del {
  flex-shrink: 0;
  background: none;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  color: var(--text-muted);
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-sm);
}
.history-del:hover { color: #dc2626; background: #fee2e2; }
.history-dl {
  border: none;
  background: transparent;
  cursor: pointer;
  font-size: 0.8rem;
  padding: 0.25rem 0.4rem;
  border-radius: var(--radius-sm);
  color: var(--text-muted);
}
.history-dl:hover { color: var(--primary-600); background: var(--primary-100); }

/* ---------- 21. CETAK / PDF ANALISIS ---------- */
#printAnalysis, #printPartAnalysis, #printPresensi { display: none; }
@media print {
  body { background: #fff; }
  body * { visibility: hidden !important; }
  #printAnalysis, #printPartAnalysis, #printPresensi, #panduanContent,
  #printAnalysis *, #printPartAnalysis *, #printPresensi *, #panduanContent * { visibility: visible !important; }
  #printAnalysis, #printPartAnalysis, #printPresensi, #panduanContent {
    display: block !important;
    position: absolute;
    left: 0;
    top: 0;
    width: 100%;
    padding: 0.5in;
    max-width: none;
  }
  .print-report { color: #111; font-size: 12pt; line-height: 1.6; }
  .print-report + .print-report { page-break-before: always; }
  .print-head { border-bottom: 2px solid #111; padding-bottom: 0.5rem; margin-bottom: 1rem; }
  .print-title { font-size: 18pt; font-weight: 700; }
  .print-sub { font-size: 12pt; margin-top: 0.25rem; }
  .print-meta { font-size: 10pt; color: #444; margin-top: 0.25rem; }
  .print-h { font-size: 13pt; margin: 1rem 0 0.4rem; border-bottom: 1px solid #ccc; padding-bottom: 0.2rem; }
  .print-p { margin: 0.3rem 0; white-space: normal; }
  .print-q { margin-bottom: 0.75rem; page-break-inside: avoid; }
  .print-label { font-weight: 700; font-size: 10.5pt; margin-bottom: 0.15rem; }
  .print-list { margin: 0.3rem 0; padding-left: 1.2rem; }
  .print-list li { margin-bottom: 0.3rem; white-space: normal; }
  .presensi-table { width: 100%; border-collapse: collapse; margin-top: 0.75rem; }
  .presensi-table th, .presensi-table td { border: 1px solid #999; padding: 0.35rem 0.5rem; font-size: 10pt; text-align: left; }
  .presensi-table th { background: #eee; }
  .presensi-print-title { font-size: 16pt; font-weight: 700; }
}

/* ---------- REKAP & RANKING ---------- */
.recap-table { width: 100%; border-collapse: collapse; background: var(--bg-card); border: 1px solid var(--border); border-radius: var(--radius-lg); overflow: hidden; }
.recap-table th, .recap-table td { padding: 0.5rem 0.75rem; border-bottom: 1px solid var(--border); font-size: 0.875rem; }
.recap-table th { text-align: left; background: var(--bg-muted); color: var(--text-muted); text-transform: uppercase; font-size: 0.7rem; letter-spacing: 0.03em; }
.recap-table tr:last-child td { border-bottom: none; }
.recap-table tbody tr:nth-child(1) td { background: rgba(245, 158, 11, 0.08); font-weight: 600; }
.recap-table tbody tr:nth-child(2) td { background: rgba(148, 163, 184, 0.12); }
.recap-table tbody tr:nth-child(3) td { background: rgba(180, 83, 9, 0.06); }
.recap-q { padding: 0.6rem 0.75rem; border: 1px solid var(--border); border-radius: var(--radius-lg); margin-bottom: 0.5rem; background: var(--bg-soft); }

/* ---------- REKAP LAYAR PENUH / WIDE ---------- */
.recap-page { padding: 0; align-items: stretch; }
.recap-page .modal-icon { width: 2.5rem; height: 2.5rem; font-size: 1.25rem; }
.recap-shell {
  width: 100%;
  height: 100%;
  background: var(--bg, #f1f5f9);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: modalPop 0.18s ease;
}
.recap-toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  background: #fff;
  border-bottom: 1px solid var(--border);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.05);
  flex-shrink: 0;
  z-index: 2;
}
.recap-toolbar-actions { display: flex; align-items: center; gap: 0.5rem; flex-shrink: 0; }
.recap-scroll { flex: 1; overflow-y: auto; min-height: 0; padding: 1.25rem; -webkit-overflow-scrolling: touch; }
#recapBody { max-width: 1400px; margin: 0 auto; }
.recap-grid { display: block; }
.recap-col { margin-bottom: 1.5rem; }
.recap-col:last-child { margin-bottom: 0; }
.recap-col .analysis-h { margin-top: 0; }
.table-scroll { overflow-x: auto; -webkit-overflow-scrolling: touch; }

/* Tab radio-button (CSS hack, tanpa JS) */
.recap-tabs { display: block; }
.recap-tab-radio { position: absolute; opacity: 0; pointer-events: none; width: 0; }
.recap-tab-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 0.4rem;
  position: sticky;
  top: 0;
  z-index: 3;
  background: var(--bg, #f1f5f9);
  padding: 0.5rem 0 0.75rem;
}
.recap-tab-bar label {
  padding: 0.45rem 1rem;
  border-radius: 999px;
  background: #fff;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 0.85rem;
  font-weight: 600;
  cursor: pointer;
  user-select: none;
  white-space: nowrap;
  transition: all 0.15s ease;
}
.recap-tab-bar label:hover { border-color: var(--primary, #4f46e5); color: var(--primary, #4f46e5); }
.recap-tab { display: none; animation: modalPop 0.15s ease; }
#repStat:checked ~ .recap-tab-bar label[for="repStat"],
#repChart:checked ~ .recap-tab-bar label[for="repChart"],
#repRank:checked ~ .recap-tab-bar label[for="repRank"] {
  background: var(--primary, #4f46e5);
  border-color: var(--primary, #4f46e5);
  color: #fff;
  box-shadow: 0 2px 6px rgba(79, 70, 229, 0.3);
}
#repStat:checked ~ .tab-is-repStat,
#repChart:checked ~ .tab-is-repChart,
#repRank:checked ~ .tab-is-repRank { display: block; }
@media (max-width: 640px) {
  .recap-toolbar { flex-wrap: wrap; padding: 0.75rem 0.875rem; }
  .recap-toolbar-actions { width: 100%; justify-content: flex-end; }
  .recap-scroll { padding: 0.875rem; }
}

.donut { width: 96px; height: 96px; border-radius: 50%; flex-shrink: 0; box-shadow: inset 0 0 0 14px var(--bg-card); }
.dot { width: 0.625rem; height: 0.625rem; border-radius: 50%; flex-shrink: 0; }

/* ---------- ANALISIS PESERTA (PUBLIK) ---------- */
.analysis-summary {
  display: block;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.875rem;
  color: var(--primary-700);
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-soft);
}
.analysis-summary:hover { background: var(--primary-100); }
details > .analysis-summary { list-style: none; }
details > .analysis-summary::-webkit-details-marker { display: none; }
details > .analysis-summary::before { content: '▸ '; }
details[open] > .analysis-summary::before { content: '▾ '; }
.pt-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 0.75rem;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  background: var(--bg-card);
  cursor: pointer;
  user-select: none;
}
.pt-chip input { accent-color: var(--primary-600); }
.pt-chip.disabled { opacity: 0.7; cursor: not-allowed; }
.pt-chip .pt-del {
  cursor: pointer;
  font-size: 0.9rem;
  opacity: 0.65;
  padding: 0.1rem 0.25rem;
  border-radius: var(--radius-sm);
  transition: opacity 0.15s ease, background 0.15s ease;
}
.pt-chip .pt-del:hover { opacity: 1; background: var(--primary-50); }
.pt-chip .pt-del:focus-visible { outline: 2px solid var(--primary-500); outline-offset: 1px; }
.pt-chip.disabled .pt-del { cursor: pointer; }

.analysis-page .analysis-summary { overflow-wrap: anywhere; }
.analysis-page .analysis-list li { overflow-wrap: anywhere; }
.analysis-page .info-box { overflow-wrap: anywhere; }
.analysis-page details p { overflow-wrap: anywhere; }
.analysis-page .card-sm { min-width: 0; }

@media (max-width: 639px) {
  .analysis-page .banner { padding: 1.1rem 1.25rem; }
  .analysis-page .card { padding: 1rem 1.1rem; }
  .analysis-page .card-sm { padding: 0.75rem; }
  .analysis-page .pt-chip { width: 100%; }
  .analysis-page .btn { flex: 1 1 auto; }
}

.checkbox-lg {
  width: 1.35rem;
  height: 1.35rem;
  accent-color: var(--primary-600);
  flex-shrink: 0;
}

/* ---------- URUTAN PERTANYAAN ---------- */
.eq-row { cursor: grab; touch-action: pan-y; }
.eq-row:active { cursor: grabbing; }
.eq-row.eq-dragging { opacity: 0.4; border-style: dashed; }
.eq-row.eq-over { border-color: var(--primary-500); background: var(--primary-50); box-shadow: var(--shadow-indigo); }
.eq-row .link { font-size: 0.8rem; }

.preline { white-space: pre-line; }

/* ---------- DETAILS SUMMARY ---------- */
details summary::-webkit-details-marker { display: none; }
details summary::marker { display: none; content: ''; }

/* ---------- DASHBOARD TABS (radio-button CSS hack) ---------- */
input[name="dashboard-tab"] { display: none; }
.tab-bar {
  display: flex;
  gap: 0;
  margin-top: 1.5rem;
  border-bottom: 2px solid var(--border);
  overflow-x: auto;
  flex-wrap: nowrap;
  -webkit-overflow-scrolling: touch;
  scrollbar-width: none;
}
.tab-bar::-webkit-scrollbar {
  display: none;
}
.tab-label {
  padding: 0.75rem 1.5rem;
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-muted);
  cursor: pointer;
  border-bottom: 3px solid transparent;
  margin-bottom: -2px;
  transition: color 0.2s, border-color 0.2s, background 0.2s;
  user-select: none;
  border-radius: var(--radius-md) var(--radius-md) 0 0;
  flex: 0 0 auto;
  white-space: nowrap;
  -webkit-tap-highlight-color: transparent;
}
.tab-label:hover {
  color: var(--text-strong);
  background: var(--bg-muted);
}
#tab-kuis:checked ~ .tab-bar label[for="tab-kuis"] {
  color: var(--primary-600);
  border-bottom-color: var(--primary-600);
  background: var(--primary-50);
}
#tab-presensi:checked ~ .tab-bar label[for="tab-presensi"] {
  color: var(--emerald-600);
  border-bottom-color: var(--emerald-600);
  background: var(--emerald-50);
}
#tab-lms:checked ~ .tab-bar label[for="tab-lms"] {
  color: #7c3aed;
  border-bottom-color: #7c3aed;
  background: #f5f3ff;
}
.tab-panel { display: none; }
#tab-kuis:checked ~ .tab-kuis,
#tab-presensi:checked ~ .tab-presensi,
#tab-lms:checked ~ .tab-lms {
  display: block;
}

/* ---------- LMS SUB-TABS ---------- */
input[name="lms-tab"] { display: none; }
#ltab-kelas:checked ~ .tab-bar label[for="ltab-kelas"],
#ltab-stages:checked ~ .tab-bar label[for="ltab-stages"],
#ltab-peserta:checked ~ .tab-bar label[for="ltab-peserta"],
#ltab-progress:checked ~ .tab-bar label[for="ltab-progress"],
#ltab-quiz:checked ~ .tab-bar label[for="ltab-quiz"],
#ltab-badge:checked ~ .tab-bar label[for="ltab-badge"],
#ltab-pengumuman:checked ~ .tab-bar label[for="ltab-pengumuman"] {
  color: #7c3aed;
  border-bottom-color: #7c3aed;
  background: #f5f3ff;
}
#ltab-kelas:checked ~ .tab-kelas,
#ltab-stages:checked ~ .tab-stages,
#ltab-peserta:checked ~ .tab-peserta,
#ltab-progress:checked ~ .tab-progress,
#ltab-quiz:checked ~ .tab-quiz,
#ltab-badge:checked ~ .tab-badge,
#ltab-pengumuman:checked ~ .tab-pengumuman {
  display: block;
}

/* ---------- SCORE CARDS ---------- */
.score-card {
  display: flex;
  gap: 1rem;
  flex-wrap: wrap;
  margin-top: 1rem;
}
.score-card .score-item {
  flex: 1 1 140px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1rem;
  text-align: center;
}
.score-card .score-item .score-val {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--primary-700);
}
.score-card .score-item .score-label {
  font-size: 0.75rem;
  color: var(--text-muted);
  margin-top: 0.25rem;
}
