/* =====================================================
   CBT APP - MAIN STYLESHEET (Modern Edition - BOLD)
   Design tokens + tema modern dengan dukungan dark mode via data-bs-theme
   Tampilan lebih tegas dengan kontras tinggi dan visual weight yang kuat
   ===================================================== */

:root {
  --font-display: 'Lexend', 'Segoe UI', system-ui, -apple-system, sans-serif;
  --font-body: 'Inter', 'Segoe UI', system-ui, -apple-system, sans-serif;

  /* Surfaces & text - Enhanced contrast */
  --cbt-canvas: #EEF1FA;
  --cbt-surface: #FFFFFF;
  --cbt-surface-2: #F4F6FC;
  --cbt-border: #D8DCE8;
  --cbt-ink: #0A0E24;
  --cbt-ink-soft: #3D4359;
  --cbt-ink-faint: #6B7290;

  /* Brand palette - More saturated */
  --cbt-primary: #2B47D4;
  --cbt-primary-dark: #1E33B8;
  --cbt-primary-light: #E8EDFE;
  --cbt-accent: #F5A524;
  --cbt-success: #0F9B68;
  --cbt-danger: #DC2B47;
  --cbt-info: #0895B0;
  --cbt-warning: #F5A524;

  /* Sidebar - More impactful */
  --cbt-sidebar-w: 272px;
  --cbt-sidebar-bg-1: #080B24;
  --cbt-sidebar-bg-2: #141B5A;
  --cbt-sidebar-text: #AEB6E8;
  --cbt-sidebar-text-strong: #FFFFFF;

  /* Shape & elevation - Stronger shadows */
  --cbt-radius-sm: .55rem;
  --cbt-radius: .9rem;
  --cbt-radius-lg: 1.3rem;
  --cbt-shadow-sm: 0 2px 4px rgba(18,22,43,.08), 0 2px 2px rgba(18,22,43,.06);
  --cbt-shadow: 0 12px 28px -10px rgba(18,22,43,.22);
  --cbt-shadow-lg: 0 28px 64px -14px rgba(18,22,43,.35);
  --cbt-topbar-bg: rgba(255,255,255,.92);
}

[data-bs-theme="dark"] {
  --cbt-canvas: #080A14;
  --cbt-surface: #10121D;
  --cbt-surface-2: #151825;
  --cbt-border: #2A2E42;
  --cbt-ink: #F0F2FA;
  --cbt-ink-soft: #B8BED8;
  --cbt-ink-faint: #7A8098;
  --cbt-primary-light: rgba(43,71,212,.2);
  --cbt-sidebar-bg-1: #040610;
  --cbt-sidebar-bg-2: #0E1228;
  --cbt-topbar-bg: rgba(16,18,29,.92);
}

* { scrollbar-width: thin; scrollbar-color: var(--cbt-ink-faint) transparent; }
::-webkit-scrollbar { width: 8px; height: 8px; }
::-webkit-scrollbar-thumb { background: var(--cbt-ink-faint); border-radius: 10px; }
::-webkit-scrollbar-track { background: transparent; }

html { scroll-behavior: smooth; }

body {
  font-family: var(--font-body);
  background-color: var(--cbt-canvas);
  color: var(--cbt-ink);
  transition: background-color .2s ease, color .2s ease;
  -webkit-font-smoothing: antialiased;
  font-weight: 450;
}

h1, h2, h3, h4, h5, h6,
.card-header, .fs-3.fw-bold, .stat-value {
  font-family: var(--font-display);
  letter-spacing: -0.015em;
  font-weight: 700;
}

a { text-decoration: none; }

:focus-visible {
  outline: 3px solid var(--cbt-primary);
  outline-offset: 2px;
}

/* ---------- Layout ---------- */
.cbt-wrapper {
  display: flex;
  min-height: 100vh;
}

.cbt-sidebar {
  width: var(--cbt-sidebar-w);
  flex-shrink: 0;
  background:
    radial-gradient(120% 140% at 0% 0%, rgba(255,255,255,.09), transparent 55%),
    linear-gradient(180deg, var(--cbt-sidebar-bg-1) 0%, var(--cbt-sidebar-bg-2) 100%);
  color: var(--cbt-sidebar-text);
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  overflow-y: auto;
  z-index: 1030;
  transition: transform .25s ease;
  border-right: 2px solid rgba(255,255,255,.08);
  box-shadow: 4px 0 24px -8px rgba(0,0,0,.3);
}

.cbt-sidebar .brand {
  padding: 1.5rem 1.35rem 1.2rem;
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.15rem;
  color: var(--cbt-sidebar-text-strong);
  display: flex;
  align-items: center;
  gap: .7rem;
  border-bottom: 2px solid rgba(255,255,255,.1);
  line-height: 1.2;
}

.cbt-sidebar .brand .brand-mark {
  width: 42px;
  height: 42px;
  border-radius: .8rem;
  background: linear-gradient(135deg, var(--cbt-primary), #5C6DE8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.3rem;
  color: #ffffff;
  flex-shrink: 0;
  box-shadow: 0 8px 18px -4px rgba(10, 48, 235, 0.945);
  border: 2px solid rgba(255,255,255,.15);
}

.cbt-sidebar .brand .brand-sub {
  display: block;
  font-family: var(--font-body);
  font-weight: 500;
  font-size: .72rem;
  color: var(--cbt-sidebar-text);
  opacity: .85;
  letter-spacing: .03em;
}

.cbt-sidebar nav.nav {
  padding: 1rem .85rem 1.6rem;
  gap: .2rem;
}

.cbt-sidebar .nav-section-title {
  text-transform: uppercase;
  font-size: .7rem;
  font-weight: 700;
  letter-spacing: .1em;
  color: rgba(255, 251, 0, 0.815);
  padding: 1.1rem .7rem .5rem;
}

.cbt-sidebar .nav-link {
  color: var(--cbt-sidebar-text);
  padding: .65rem .85rem;
  border-radius: .7rem;
  font-size: .92rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: .75rem;
  position: relative;
  transition: all .18s ease;
}

.cbt-sidebar .nav-link i {
  font-size: 1.1rem;
  width: 1.4rem;
  text-align: center;
  flex-shrink: 0;
  opacity: .9;
}

.cbt-sidebar .nav-link:hover {
  background: rgba(226, 12, 12, 0.1);
  color: #fff;
  transform: translateX(3px);
}

.cbt-sidebar .nav-link.active {
  background: linear-gradient(90deg, var(--cbt-primary), #4A5CE8);
  color: #fff;
  font-weight: 700;
  box-shadow: 0 10px 22px -6px rgba(43,71,212,.65);
  border: 1px solid rgba(255,255,255,.12);
}

.cbt-sidebar .nav-link.active i { opacity: 1; }

.cbt-sidebar-backdrop {
  display: none;
  position: fixed;
  inset: 0;
  background: rgba(10,12,22,.65);
  backdrop-filter: blur(3px);
  z-index: 1025;
}
.cbt-sidebar-backdrop.show { display: block; }

.cbt-content {
  margin-left: var(--cbt-sidebar-w);
  flex-grow: 1;
  width: calc(100% - var(--cbt-sidebar-w));
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.cbt-topbar {
  background: var(--cbt-topbar-bg);
  backdrop-filter: blur(12px);
  border-bottom: 2px solid var(--cbt-border);
  padding: .95rem 1.6rem;
  position: sticky;
  top: 0;
  z-index: 1020;
  box-shadow: 0 2px 8px -2px rgba(0,0,0,.08);
}

.cbt-topbar .page-title-eyebrow {
  font-size: .76rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .08em;
  color: var(--cbt-ink-faint);
  margin-bottom: .15rem;
}

.cbt-topbar h5 {
  font-family: var(--font-display);
  font-weight: 700;
  color: var(--cbt-ink);
  font-size: 1.25rem;
}

.cbt-icon-btn {
  width: 40px;
  height: 40px;
  border-radius: .7rem;
  border: 2px solid var(--cbt-border);
  background: var(--cbt-surface);
  color: var(--cbt-ink-soft);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: all .18s ease;
  font-weight: 600;
}
.cbt-icon-btn:hover { 
  background: var(--cbt-primary-light); 
  color: var(--cbt-primary); 
  border-color: var(--cbt-primary);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px -2px rgba(43,71,212,.3);
}

.cbt-user-chip {
  display: flex;
  align-items: center;
  gap: .65rem;
  padding: .4rem .85rem .4rem .4rem;
  border-radius: 50rem;
  border: 2px solid var(--cbt-border);
  background: var(--cbt-surface);
  color: var(--cbt-ink);
  font-size: .88rem;
  font-weight: 700;
  transition: all .18s ease;
}
.cbt-user-chip:hover { 
  border-color: var(--cbt-primary); 
  color: var(--cbt-ink);
  box-shadow: 0 4px 12px -2px rgba(43,71,212,.25);
}

.cbt-avatar {
  width: 34px;
  height: 34px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--cbt-primary), #5C6DE8);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: .82rem;
  font-weight: 800;
  flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.2);
}
.cbt-avatar-photo {
  background-size: cover;
  background-position: center;
  background-repeat: no-repeat;
  border: 2px solid rgba(0,0,0,.12);
}

.cbt-main {
  padding: 1.75rem;
  flex-grow: 1;
  animation: cbtFadeIn .35s ease;
}

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

@media (prefers-reduced-motion: reduce) {
  .cbt-main { animation: none; }
  * { scroll-behavior: auto !important; }
}

/* ---------- Cards & Components ---------- */
.card {
  border: 2px solid var(--cbt-border);
  border-radius: var(--cbt-radius);
  box-shadow: var(--cbt-shadow-sm);
  background-color: var(--cbt-surface);
  color: var(--cbt-ink);
  transition: all .2s ease;
}

.card:hover {
  box-shadow: var(--cbt-shadow);
  transform: translateY(-2px);
}

.card-header {
  background-color: var(--cbt-surface) !important;
  border-bottom: 2px solid var(--cbt-border);
  font-weight: 700;
  color: var(--cbt-ink);
  font-size: 1.05rem;
  padding: 1.1rem 1.25rem;
}

.card.shadow-sm { box-shadow: var(--cbt-shadow) !important; }

.stat-card {
  border: none;
  border-radius: var(--cbt-radius-lg);
  padding: 1.5rem 1.5rem;
  color: #fff;
  position: relative;
  overflow: hidden;
  box-shadow: var(--cbt-shadow-lg);
  transition: all .25s ease;
}

.stat-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 32px 72px -16px rgba(18,22,43,.4);
}

.stat-card::after {
  content: '';
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.18) 1.2px, transparent 1.2px);
  background-size: 14px 14px;
  opacity: .55;
  pointer-events: none;
}

.stat-card .stat-icon {
  font-size: 1.75rem;
  opacity: .95;
  position: absolute;
  right: 1.2rem;
  top: 1.2rem;
  width: 48px;
  height: 48px;
  border-radius: .85rem;
  background: rgba(255,255,255,.22);
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid rgba(255,255,255,.15);
}

.stat-card .stat-label {
  font-size: .82rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .05em;
  opacity: .9;
  position: relative;
}

.stat-card .stat-value {
  font-size: 2.2rem;
  font-weight: 800;
  margin-top: .2rem;
  position: relative;
}

.stat-card.bg-c1 { background: linear-gradient(135deg, #2B47D4, #5C6DE8); }
.stat-card.bg-c2 { background: linear-gradient(135deg, #0A8A58, #0F9B68); }
.stat-card.bg-c3 { background: linear-gradient(135deg, #D48508, #F5A524); }
.stat-card.bg-c4 { background: linear-gradient(135deg, #B82040, #DC2B47); }
.stat-card.bg-c5 { background: linear-gradient(135deg, #067890, #0895B0); }
.stat-card.bg-c6 { background: linear-gradient(135deg, #4A28B8, #7B4FE8); }

/* Plain KPI cards used on dashboards (card + card-body) */
.card .text-muted.small { color: var(--cbt-ink-faint) !important; font-weight: 700; font-size: .78rem; text-transform: uppercase; letter-spacing: .05em; }
.card .fs-3.fw-bold { font-size: 2.1rem !important; font-weight: 800; }

/* ---------- Buttons ---------- */
.btn {
  border-radius: var(--cbt-radius-sm);
  font-weight: 700;
  font-size: .9rem;
  padding: .6rem 1.15rem;
  transition: all .18s ease;
  border-width: 2px;
}

.btn-sm { border-radius: .55rem; font-size: .85rem; }

.btn-primary {
  background-color: var(--cbt-primary);
  border-color: var(--cbt-primary);
  box-shadow: 0 8px 20px -6px rgba(43,71,212,.6);
}
.btn-primary:hover, .btn-primary:focus {
  background-color: var(--cbt-primary-dark);
  border-color: var(--cbt-primary-dark);
  transform: translateY(-2px);
  box-shadow: 0 10px 24px -6px rgba(43,71,212,.7);
}

.btn-outline-secondary, .btn-outline-primary, .btn-outline-danger {
  border-width: 2px;
  font-weight: 700;
}

.btn-outline-primary {
  color: var(--cbt-primary);
  border-color: var(--cbt-primary);
}
.btn-outline-primary:hover {
  background-color: var(--cbt-primary);
  color: #fff;
  transform: translateY(-2px);
}

.btn-danger { background-color: var(--cbt-danger); border-color: var(--cbt-danger); box-shadow: 0 6px 16px -4px rgba(220,43,71,.5); }
.btn-danger:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -4px rgba(220,43,71,.6); }

.btn-success { background-color: var(--cbt-success); border-color: var(--cbt-success); box-shadow: 0 6px 16px -4px rgba(15,155,104,.5); }
.btn-success:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -4px rgba(15,155,104,.6); }

.btn-warning { background-color: var(--cbt-warning); border-color: var(--cbt-warning); color: #fff; box-shadow: 0 6px 16px -4px rgba(245,165,36,.5); }
.btn-warning:hover { transform: translateY(-2px); box-shadow: 0 8px 20px -4px rgba(245,165,36,.6); }

/* ---------- Badges / status pills ---------- */
.badge {
  font-weight: 700;
  font-size: .76rem;
  padding: .42rem .72rem;
  border-radius: 50rem;
  letter-spacing: .02em;
  border: 1px solid rgba(255,255,255,.15);
}

.badge-status-draft { background-color: #7A84A8 !important; }
.badge-status-terjadwal { background-color: var(--cbt-accent) !important; color:#2a1e02; }
.badge-status-berlangsung { background-color: var(--cbt-success) !important; }
.badge-status-selesai { background-color: var(--cbt-primary) !important; }
.badge-status-dibatalkan { background-color: var(--cbt-danger) !important; }

/* ---------- Tables ---------- */
.table-responsive {
  border-radius: var(--cbt-radius);
  overflow: visible !important;
  border: 2px solid var(--cbt-border);
}

.table {
  color: var(--cbt-ink);
  margin-bottom: 0;
}

.table thead th {
  background-color: var(--cbt-surface-2);
  color: var(--cbt-ink-soft);
  font-size: .76rem;
  text-transform: uppercase;
  letter-spacing: .06em;
  font-weight: 800;
  border-bottom: 2px solid var(--cbt-border);
  padding: .9rem 1.1rem;
  white-space: nowrap;
}

.table tbody td {
  padding: .85rem 1.1rem;
  border-bottom: 1.5px solid var(--cbt-border);
  vertical-align: middle;
  font-weight: 500;
}

.table tbody tr:last-child td { border-bottom: none; }
.table-hover tbody tr:hover { background-color: var(--cbt-primary-light); }

/* ---------- Forms ---------- */
.form-control, .form-select {
  border-radius: var(--cbt-radius-sm);
  border: 2px solid var(--cbt-border);
  background-color: var(--cbt-surface);
  color: var(--cbt-ink);
  padding: .6rem .9rem;
  font-size: .92rem;
  font-weight: 500;
}

.form-control:focus, .form-select:focus {
  border-color: var(--cbt-primary);
  box-shadow: 0 0 0 .25rem var(--cbt-primary-light);
  background-color: var(--cbt-surface);
  color: var(--cbt-ink);
}

.form-label {
  font-weight: 700;
  font-size: .88rem;
  color: var(--cbt-ink-soft);
  margin-bottom: .45rem;
}

.form-check-input:checked {
  background-color: var(--cbt-primary);
  border-color: var(--cbt-primary);
  border-width: 2px;
}

/* ---------- Alerts ---------- */
.alert {
  border: 2px solid transparent;
  border-radius: var(--cbt-radius);
  font-size: .92rem;
  font-weight: 600;
  padding: 1rem 1.2rem;
}
.alert-info { background: var(--cbt-primary-light); color: var(--cbt-primary-dark); border-color: rgba(43,71,212,.2); }
.alert-success { background: rgba(15,155,104,.14); color: #0A6B45; border-color: rgba(15,155,104,.25); }
.alert-warning { background: rgba(245,165,36,.16); color: #7A4E06; border-color: rgba(245,165,36,.3); }
.alert-danger { background: rgba(220,43,71,.14); color: #9A1830; border-color: rgba(220,43,71,.25); }
.alert-secondary { background: var(--cbt-surface-2); color: var(--cbt-ink-soft); border-color: var(--cbt-border); }

[data-bs-theme="dark"] .alert-success { color: #4EE0A8; }
[data-bs-theme="dark"] .alert-warning { color: #FBC56B; }
[data-bs-theme="dark"] .alert-danger { color: #FF8FA0; }

.kartu-peserta-preview {
  border: 3px dashed rgba(43,71,212,.5);
  border-radius: var(--cbt-radius);
  padding: 1.1rem;
  background: var(--cbt-primary-light);
}

/* ---------- Auth / Login pages ---------- */
.auth-page {
  min-height: 100vh;
  display: flex;
  background: var(--cbt-canvas);
}

.auth-hero {
  position: relative;
  flex: 0 0 44%;
  max-width: 560px;
  background: linear-gradient(160deg, var(--cbt-sidebar-bg-1) 0%, var(--cbt-sidebar-bg-2) 100%);
  color: #fff;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 3.5rem;
  overflow: hidden;
}

.auth-hero-pattern {
  position: absolute;
  inset: 0;
  background-image: radial-gradient(rgba(255,255,255,.16) 1.6px, transparent 1.6px);
  background-size: 24px 24px;
  -webkit-mask-image: radial-gradient(120% 100% at 30% 20%, #000 40%, transparent 85%);
  mask-image: radial-gradient(120% 100% at 30% 20%, #000 40%, transparent 85%);
}

.auth-hero-content {
  position: relative;
  max-width: 380px;
}

.auth-hero-logo {
  width: 64px;
  height: 64px;
  border-radius: 1.1rem;
  background: linear-gradient(135deg, var(--cbt-primary), #5C6DE8);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.75rem;
  margin-bottom: 1.6rem;
  box-shadow: 0 12px 28px -6px rgba(43,71,212,.7);
  border: 2px solid rgba(255,255,255,.18);
}

.auth-hero-title {
  font-family: var(--font-display);
  font-weight: 800;
  font-size: 1.85rem;
  line-height: 1.25;
  margin-bottom: .7rem;
}

.auth-hero-sub {
  color: #C2C8F2;
  font-size: .96rem;
  margin-bottom: 2.2rem;
  font-weight: 500;
}

.auth-hero-list { list-style: none; padding: 0; margin: 0; display: flex; flex-direction: column; gap: 1.1rem; }
.auth-hero-list li { display: flex; align-items: center; gap: .85rem; font-size: .92rem; color: #DEE1F7; font-weight: 600; }

.auth-hero-ico {
  width: 38px;
  height: 38px;
  border-radius: .75rem;
  background: rgba(255,255,255,.14);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  color: #fff;
  border: 1.5px solid rgba(255,255,255,.12);
}

.auth-form-panel {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2.2rem 1.4rem;
}

.auth-form-wrap { width: 100%; max-width: 440px; }

.login-card {
  width: 100%;
  border-radius: var(--cbt-radius-lg);
  overflow: hidden;
  border: 2px solid var(--cbt-border);
  box-shadow: var(--cbt-shadow-lg);
}

.login-role-card {
  border-radius: var(--cbt-radius);
  border: 2px solid var(--cbt-border);
  padding: 1.5rem 1.2rem;
  text-align: center;
  transition: all .22s ease;
  text-decoration: none;
  color: inherit;
  display: block;
  background: var(--cbt-surface);
  font-weight: 600;
}
.login-role-card:hover {
  transform: translateY(-4px);
  box-shadow: var(--cbt-shadow);
  border-color: var(--cbt-primary);
  color: inherit;
}

/* ---------- Mobile responsive ---------- */
@media (max-width: 991.98px) {
  .cbt-sidebar {
    transform: translateX(-100%);
  }
  .cbt-sidebar.show {
    transform: translateX(0);
    box-shadow: var(--cbt-shadow-lg);
  }
  .cbt-content {
    margin-left: 0;
    width: 100%;
  }
  .auth-hero { display: none; }
}

/* ---------- Print (kartu peserta, dsb) ---------- */
@media print {
  .cbt-sidebar, .cbt-topbar, .no-print, .cbt-sidebar-backdrop { display: none !important; }
  .cbt-content { margin-left: 0 !important; width: 100% !important; }
}

/* ---------- Blokir download / drag media soal siswa ---------- */
audio::-webkit-media-controls-download-button,
video::-webkit-media-controls-download-button { display: none !important; }
audio, video { -webkit-user-select: none; user-select: none; }