/* =========================================
   DESIGN SYSTEM & VARIABLES
   ========================================= */
:root {
  /* Colors */
  --bg-dark: #0a0a0a;
  --bg-panel: rgba(
    24,
    24,
    27,
    0.85
  ); /* #18181B with some opacity for glass effect */
  --panel-border: rgba(255, 255, 255, 0.3);

  --primary: #64050f;
  --primary-hover: #8b0000;
  --primary-glow: rgba(100, 5, 15, 0.4);

  --secondary: #1a1a1a;
  --secondary-hover: #333333;

  --text-main: #f8fafc;
  --text-muted: #94a3b8;

  --danger: #ef4444;
  --success: #10b981;

  /* Typography */
  --font-family: "Inter", sans-serif;

  /* Animation */
  --transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* =========================================
   RESET & BASE
   ========================================= */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: var(--font-family);
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  overflow-x: hidden;
  position: relative;
  background-image:
    radial-gradient(
      circle at 10% 20%,
      rgba(100, 5, 15, 0.12) 0px,
      transparent 40%
    ),
    radial-gradient(
      circle at 90% 80%,
      rgba(100, 5, 15, 0.08) 0px,
      transparent 40%
    );
}

#app-container {
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* =========================================
   UTILITIES & COMPONENTS
   ========================================= */
.view-container {
  display: none;
  opacity: 0;
  transition: opacity 0.4s ease-in-out;
}

.view-container.active {
  display: flex;
  flex-direction: column;
  opacity: 1;
}

/* Panel (lightweight, no blur) */
.glass-panel {
  background: rgba(24, 24, 27, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.08);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.2);
}

/* Buttons */
button {
  cursor: pointer;
  font-family: var(--font-family);
  font-weight: 500;
  font-size: 0.95rem;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  border: none;
  transition: var(--transition);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.primary-btn {
  background: var(--primary);
  color: white;
  box-shadow: 0 4px 14px var(--primary-glow);
  position: relative;
  overflow: hidden;
}

.primary-btn:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
  box-shadow: 0 6px 20px var(--primary-glow);
}

.primary-btn:active {
  transform: translateY(0);
}

.primary-btn:disabled {
  opacity: 0.7;
  cursor: not-allowed;
  transform: none;
}

.secondary-btn {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-main);
  border: 1px solid var(--panel-border);
}

.secondary-btn:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mt-4 {
  margin-top: 1rem;
}

.w-100 {
  width: 100%;
}

/* Forms */
.input-group {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  text-align: left;
}

.input-group label {
  font-size: 0.875rem;
  color: var(--text-muted);
  font-weight: 500;
}

.input-group input {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.875rem 1rem;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 1rem;
  transition: var(--transition);
}

.input-group input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(0, 0, 0, 0.3);
}

.input-group input::placeholder {
  color: rgba(148, 163, 184, 0.5);
}

/* =========================================
   LOGIN & AUTH PAGE CONTAINERS
   ========================================= */
#login-view,
#set-password-view,
#enter-password-view {
  min-height: 100vh;
  display: flex !important; /* Temporarily overridden by JS active state, but need flex as base */
  flex-direction: column;
  justify-content: center;
  align-items: center;
  position: relative;
  overflow: hidden;
}

#login-view:not(.active),
#set-password-view:not(.active),
#enter-password-view:not(.active) {
  display: none !important;
}

.glow-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  z-index: -1;
  opacity: 0.6;
}

.orb-1 {
  width: 400px;
  height: 400px;
  background: var(--primary-glow);
  top: -100px;
  left: -100px;
}

.orb-2 {
  width: 300px;
  height: 300px;
  background: rgba(220, 38, 38, 0.2);
  bottom: -50px;
  right: -50px;
}

.login-card {
  width: 100%;
  max-width: 420px;
  padding: 2.5rem;
  border-radius: 20px;
  text-align: center;
  animation: slideUp 0.6s cubic-bezier(0.16, 1, 0.3, 1);
}

.logo-container {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.75rem;
  margin-bottom: 2rem;
}

.brand-logo-large {
  width: 48px;
  height: 48px;
  object-fit: contain;
  filter: drop-shadow(0 4px 8px rgba(100, 5, 15, 0.4));
}

.brand-logo-small {
  width: 28px;
  height: 28px;
  object-fit: contain;
}

.login-card h2 {
  font-size: 1.75rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.login-card .subtitle {
  color: var(--text-muted);
  font-size: 0.95rem;
  margin-bottom: 2rem;
}

#login-btn {
  width: 100%;
  padding: 0.875rem;
}

/* =========================================
   HOME PAGE (LOBBY)
   ========================================= */
#home-view {
  flex: 1;
  position: relative;
}

/* Home Background Decor */
.home-decor {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  overflow: hidden;
  z-index: 0; /* Di bawah konten utama */
  pointer-events: none; /* Agar tidak bisa diklik */
}

/* Garis Laser Animasi Kustom */
.laser-line {
  position: absolute;
  background: linear-gradient(90deg, transparent, var(--primary), transparent);
  height: 1px;
  width: 200px;
  opacity: 0.5;
  animation: scanLines 8s linear infinite;
}

.laser-1 {
  top: 30%;
  right: -200px;
  animation-delay: 0s;
}
.laser-2 {
  top: 60%;
  left: -200px;
  animation-direction: reverse;
  animation-duration: 12s;
}
.laser-3 {
  bottom: 15%;
  right: -200px;
  animation-delay: 2s;
  animation-duration: 10s;
}

@keyframes scanLines {
  0% {
    transform: translateX(0);
    opacity: 0;
  }
  10% {
    opacity: 0.5;
  }
  90% {
    opacity: 0.5;
  }
  100% {
    transform: translateX(calc(-100vw - 200px));
    opacity: 0;
  }
}

/* Disable heavy animations on mobile & reduced-motion */
@media (max-width: 768px) {
  .laser-line {
    display: none;
  }
}
@media (prefers-reduced-motion: reduce) {
  .laser-line {
    display: none;
  }
  * {
    animation: none !important;
    transition: none !important;
  }
}

/* Pastikan Navbar & Konten di atas dekorasi */
.navbar,
.dashboard-content {
  position: relative;
  z-index: 10;
}

/* Navbar */
.navbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 5%;
  border-radius: 0 0 20px 20px;
  border-bottom: 1px solid var(--panel-border);
  background-color: #64050f;
  position: sticky;
  top: 0;
  z-index: 100;
}

.nav-brand {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.brand-text {
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.brand-title {
  font-weight: 800;
  font-size: 1.1rem;
  letter-spacing: 1.5px;
  line-height: 1.1;
  color: #ffffff;
}

.brand-subtitle {
  font-weight: 400;
  font-size: 0.65rem;
  letter-spacing: 0.5px;
  color: rgba(255, 255, 255, 0.7);
  text-transform: lowercase;
}

.nav-actions {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.user-chip {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.9rem;
  font-weight: 500;
  color: var(--text-muted);
}

.user-chip .dot {
  width: 8px;
  height: 8px;
  background-color: var(--success);
  border-radius: 50%;
  box-shadow: 0 0 8px var(--success);
}

/* Dashboard Content */
.dashboard-content {
  flex: 1;
  padding: 3rem 5%;
  max-width: 1200px;
  margin: 0 auto;
  width: 100%;
}

.dashboard-header {
  margin-bottom: 3rem;
}

.dashboard-header h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
  letter-spacing: -0.5px;
}

.dashboard-header .highlight {
  background: linear-gradient(135deg, #ef4444, #fca5a5);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
}

.dashboard-header p {
  color: var(--text-muted);
  font-size: 1.1rem;
}

.dashboard-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
  gap: 1.5rem;
}

.card {
  border-radius: 16px;
  overflow: hidden;
  position: relative;
}

.card-header {
  padding: 1.5rem 1.5rem 1rem;
  border-bottom: 1px solid var(--panel-border);
}

.card-header h3 {
  font-size: 1.1rem;
  font-weight: 600;
}

.card-body {
  padding: 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.info-row {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.info-row .label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
}

.info-row .value {
  font-size: 1.1rem;
  font-weight: 500;
}

.badge {
  display: inline-block;
  background: rgba(100, 5, 15, 0.15);
  color: #ef4444;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.85rem;
  font-weight: 600;
  width: max-content;
}

/* Abstract Decor Card */
.abstract-decor {
  background: linear-gradient(
    135deg,
    rgba(20, 9, 10, 0.8),
    rgba(10, 10, 10, 0.9)
  );
  border: 1px solid var(--primary-glow);
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.decor-circle {
  position: absolute;
  width: 250px;
  height: 250px;
  border-radius: 50%;
  background: conic-gradient(
    from 180deg at 50% 50%,
    #64050f 0deg,
    #3a0309 180deg,
    transparent 360deg
  );
  opacity: 0.15;
  right: -50px;
  bottom: -50px;
  filter: blur(20px);
  z-index: 0;
}

.card-content {
  position: relative;
  z-index: 1;
  padding: 2rem;
}

.card-content h3 {
  font-size: 1.5rem;
  margin-bottom: 0.5rem;
}

.card-content p {
  color: var(--text-muted);
  line-height: 1.6;
}

/* =========================================
   TOAST NOTIFICATION
   ========================================= */
.toast {
  position: fixed;
  bottom: 2rem;
  right: 2rem;
  padding: 1rem 1.5rem;
  background: var(--bg-panel);
  backdrop-filter: blur(16px);
  border-left: 4px solid var(--primary);
  border-radius: 8px;
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.3);
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  z-index: 1000;
  font-weight: 500;
}

.toast.show {
  transform: translateY(0);
  opacity: 1;
}

.toast.error {
  border-left-color: var(--danger);
}

.toast.success {
  border-left-color: var(--success);
}

/* =========================================
   SPINNER & LOADER
   ========================================= */
.loader-hidden {
  display: none !important;
}

.spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  border-top-color: white;
  animation: spin 0.8s ease-in-out infinite;
}

/* =========================================
   ANIMATIONS
   ========================================= */
@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

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

.animate-fade-in {
  animation: slideUp 0.6s backwards;
}

.animate-fade-in-delayed {
  animation: slideUp 0.6s backwards 0.2s;
}

.animate-fade-in-delayed-more {
  animation: slideUp 0.6s backwards 0.4s;
}

/* =========================================
   RESPONSIVE
   ========================================= */
@media (max-width: 768px) {
  .dashboard-header h1 {
    font-size: 2rem;
  }
  .navbar {
    padding: 1rem;
  }
  .user-chip {
    display: none;
  }
  .ket-layout {
    grid-template-columns: 1fr !important;
  }
  .form-row {
    flex-direction: column !important;
  }
  .access-controls .card-body {
    flex-direction: column !important;
  }
  .quiz-header h1 {
    font-size: 1.5rem !important;
  }
}

/* =========================================
   ADMIN PANEL STYLES
   ========================================= */
.navbar-admin {
  background-color: #1a0a0d;
  border-bottom-color: rgba(245, 158, 11, 0.3);
}

.admin-section {
  margin-bottom: 2rem;
}

.admin-section h2 {
  font-size: 1.3rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.section-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.section-header h2 {
  margin-bottom: 0;
}

/* Status Badges */
.status-badge {
  padding: 0.375rem 0.875rem;
  border-radius: 9999px;
  font-size: 0.8rem;
  font-weight: 600;
}

.status-active {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
}

.status-inactive {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
  border: 1px solid rgba(239, 68, 68, 0.3);
}

/* Select Input */
.select-input {
  width: 100%;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.875rem 1rem;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 1rem;
  transition: var(--transition);
  appearance: none;
  cursor: pointer;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%2394a3b8' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 1rem center;
}

.select-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

.select-input option {
  background: #1a1a1a;
  color: var(--text-main);
}

.select-small {
  width: auto;
  padding: 0.5rem 2rem 0.5rem 0.75rem;
  font-size: 0.85rem;
}

.form-row {
  display: flex;
  gap: 1rem;
  align-items: flex-end;
}

.form-row .input-group {
  flex: 1;
}

/* Toggle Switch */
.toggle-label {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  cursor: pointer;
  font-weight: 500;
  padding: 0.5rem 1rem;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.03);
  border: 1px solid transparent;
  transition: var(--transition);
}

.toggle-label:hover {
  border-color: var(--panel-border);
  background: rgba(255, 255, 255, 0.06);
}

.toggle-input {
  display: none;
}

.toggle-slider {
  width: 44px;
  height: 24px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  position: relative;
  transition: var(--transition);
  flex-shrink: 0;
}

.toggle-slider::after {
  content: "";
  position: absolute;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: var(--text-muted);
  top: 3px;
  left: 3px;
  transition: var(--transition);
}

.toggle-input:checked + .toggle-slider {
  background: rgba(16, 185, 129, 0.3);
}

.toggle-input:checked + .toggle-slider::after {
  background: #10b981;
  transform: translateX(20px);
}

/* =========================================
   PREVIEW CARDS (Admin)
   ========================================= */
.preview-block {
  margin-top: 1.5rem;
}

.preview-block h3 {
  font-size: 1.1rem;
  font-weight: 600;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.preview-list {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

.preview-card {
  border-radius: 12px;
  overflow: hidden;
}

.preview-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1.25rem;
  border-bottom: 1px solid var(--panel-border);
}

.preview-number {
  font-weight: 700;
  font-size: 0.9rem;
  color: var(--primary-hover);
}

.preview-card-body {
  padding: 1rem 1.25rem;
}

.preview-soal {
  font-size: 0.95rem;
  line-height: 1.6;
  margin-bottom: 0.75rem;
}

.preview-answer {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.preview-answer summary {
  cursor: pointer;
  color: var(--text-muted);
  font-weight: 500;
  transition: color 0.2s;
}

.preview-answer summary:hover {
  color: var(--text-main);
}

.preview-answer p {
  margin-top: 0.5rem;
  padding: 0.75rem;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 6px;
  line-height: 1.6;
}

/* Level Badges */
.badge-easy {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
}

.badge-medium {
  background: rgba(245, 158, 11, 0.15);
  color: #f59e0b;
}

.badge-hard {
  background: rgba(239, 68, 68, 0.15);
  color: #ef4444;
}

.btn-activate {
  padding: 1rem 2rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.text-muted {
  color: var(--text-muted);
}

/* =========================================
   QUIZ PAGES (Student)
   ========================================= */
.quiz-state-container {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: calc(100vh - 200px);
}

.quiz-header {
  margin-bottom: 2rem;
}

.quiz-header h1 {
  font-size: 2rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.quiz-questions-list {
  display: flex;
  flex-direction: column;
  gap: 1.5rem;
}

.quiz-card {
  border-radius: 16px;
  overflow: hidden;
}

.quiz-card-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.15);
}

.quiz-number {
  font-weight: 700;
  font-size: 1rem;
}

.quiz-card-body {
  padding: 1.5rem;
}

.quiz-question {
  font-size: 1.05rem;
  line-height: 1.7;
  margin-bottom: 1.25rem;
}

.quiz-textarea {
  width: 100%;
  background: rgba(0, 0, 0, 0.2);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.875rem 1rem;
  border-radius: 8px;
  font-family: var(--font-family);
  font-size: 0.95rem;
  resize: vertical;
  transition: var(--transition);
  min-height: 100px;
}

.quiz-textarea:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
  background: rgba(0, 0, 0, 0.3);
}

.quiz-submit-area {
  display: flex;
  justify-content: center;
  padding: 2rem 0;
}

/* =========================================
   CODE EDITOR (Keterampilan)
   ========================================= */
.ket-layout {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1.5rem;
  align-items: start;
}

.ket-instructions .card-body {
  max-height: 70vh;
  overflow-y: auto;
}

/* Flowchart image container — override max-height to prevent cropping */
.flowchart-container.ket-instructions .card-body {
  max-height: none;
  overflow-y: visible;
}

.flowchart-container.ket-instructions .card {
  overflow: visible;
}

.flowchart-container.ket-instructions img {
  max-width: 100%;
  height: auto;
  display: block;
}

.instruction-item {
  padding: 0.875rem 1rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  margin-bottom: 0.625rem;
  border-left: 3px solid var(--panel-border);
  transition: var(--transition);
}

.instruction-item:hover {
  background: rgba(0, 0, 0, 0.25);
}

.instruction-bonus {
  border-left-color: #10b981;
  background: rgba(16, 185, 129, 0.05);
}

.instruction-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 0.375rem;
}

.instruction-num {
  font-weight: 700;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.instruction-poin {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.5rem;
  border-radius: 4px;
  background: rgba(100, 5, 15, 0.2);
  color: #fca5a5;
}

.instruction-text {
  font-size: 0.9rem;
  line-height: 1.5;
}

.ket-total-poin {
  text-align: right;
  font-size: 1.1rem;
  padding-top: 0.75rem;
  border-top: 1px solid var(--panel-border);
}

/* Editor */
.editor-card {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.editor-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.editor-wrapper {
  display: flex;
  flex: 1;
  min-height: 500px;
  max-height: 70vh;
  background: #0d0d0d;
  border-top: 1px solid var(--panel-border);
}

.line-numbers {
  width: 48px;
  padding: 1rem 0.5rem;
  text-align: right;
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  color: rgba(148, 163, 184, 0.4);
  background: rgba(0, 0, 0, 0.3);
  border-right: 1px solid rgba(255, 255, 255, 0.08);
  overflow: hidden;
  user-select: none;
  flex-shrink: 0;
}

.code-textarea {
  flex: 1;
  width: 100%;
  padding: 1rem;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  resize: none;
  outline: none;
  tab-size: 4;
  white-space: pre;
  overflow: auto;
}

.code-textarea::placeholder {
  color: rgba(148, 163, 184, 0.3);
}

/* =========================================
   REKAP PAGE
   ========================================= */
.stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.25rem;
}

.stat-number {
  font-size: 2rem;
  font-weight: 700;
  color: var(--primary-hover);
}

.stat-label {
  font-size: 0.8rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* Kelas Groups */
.rekap-kelas-group {
  margin-bottom: 1rem;
  border-radius: 12px;
  overflow: hidden;
  border: 1px solid var(--panel-border);
  background: var(--panel-bg);
}

.rekap-kelas-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1rem 1.25rem;
  cursor: pointer;
  user-select: none;
  background: rgba(0, 0, 0, 0.15);
  transition: var(--transition);
}

.rekap-kelas-header:hover {
  background: rgba(0, 0, 0, 0.25);
}

.rekap-kelas-header h3 {
  font-size: 1rem;
  font-weight: 600;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.chevron-icon {
  transition: transform 0.3s ease;
}

.collapsed .chevron-icon {
  transform: rotate(-90deg);
}

.collapsed .rekap-kelas-body {
  display: none;
}

.rekap-kelas-body {
  overflow-x: auto;
}

/* Table */
.rekap-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 0.9rem;
}

.rekap-table th,
.rekap-table td {
  padding: 0.75rem 1rem;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.rekap-table th {
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  color: var(--text-muted);
  background: rgba(0, 0, 0, 0.1);
}

.rekap-table tbody tr:hover {
  background: rgba(255, 255, 255, 0.03);
}

.td-name {
  font-weight: 500;
  max-width: 200px;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.td-nim {
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.td-time {
  font-size: 0.8rem;
  color: var(--text-muted);
}

.td-nilai {
  font-weight: 600;
}

.btn-detail {
  background: rgba(100, 5, 15, 0.2);
  color: var(--primary-hover);
  border: 1px solid rgba(100, 5, 15, 0.3);
  padding: 0.375rem 0.75rem;
  border-radius: 6px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.8rem;
  transition: var(--transition);
}

.btn-detail:hover {
  background: rgba(100, 5, 15, 0.4);
  border-color: var(--primary);
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  backdrop-filter: blur(4px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 2rem;
}

.modal-content {
  width: 100%;
  max-width: 800px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  border-radius: 16px;
  overflow: hidden;
}

.modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--panel-border);
}

.modal-header h2 {
  font-size: 1.1rem;
  font-weight: 600;
}

.modal-close {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.5rem;
  cursor: pointer;
  padding: 0 0.5rem;
  transition: color 0.2s;
}

.modal-close:hover {
  color: var(--text-main);
}

.modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid var(--panel-border);
  background: rgba(0, 0, 0, 0.1);
}

/* Detail content */
.detail-info {
  margin-bottom: 1.5rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid var(--panel-border);
}

.detail-answer-item {
  margin-bottom: 1.5rem;
  padding: 1rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
}

.detail-answer-header {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  margin-bottom: 0.75rem;
}

.detail-soal {
  margin-bottom: 1rem;
  line-height: 1.6;
}

.detail-answer-pair {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
}

.answer-block {
  padding: 0.75rem;
  border-radius: 6px;
  font-size: 0.9rem;
}

.answer-block p {
  line-height: 1.5;
  margin-top: 0.375rem;
}

.answer-label {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.answer-mhs {
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
}

.answer-mhs .answer-label {
  color: #60a5fa;
}

.answer-ref {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
}

.answer-ref .answer-label {
  color: #34d399;
}

.code-preview {
  background: #0d0d0d;
  padding: 1rem;
  border-radius: 8px;
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre;
  color: #e2e8f0;
  border: 1px solid rgba(255, 255, 255, 0.08);
}

/* Utility */
.mt-4 {
  margin-top: 1rem;
}

.badge {
  display: inline-block;
  padding: 0.25rem 0.625rem;
  border-radius: 6px;
  font-size: 0.75rem;
  font-weight: 600;
  background: rgba(255, 255, 255, 0.08);
}

.highlight {
  color: var(--primary-hover);
}

.info-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.info-row .label {
  color: var(--text-muted);
  font-size: 0.9rem;
}

.info-row .value {
  font-weight: 500;
}

.card-header {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--panel-border);
}

.card-header h3 {
  font-size: 1rem;
  font-weight: 600;
}

.card-body {
  padding: 1.25rem;
}

/* Text input */
.text-input {
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid var(--panel-border);
  color: var(--text-main);
  padding: 0.5rem 0.75rem;
  border-radius: 6px;
  font-family: var(--font-family);
  font-size: 1rem;
  transition: var(--transition);
}

.text-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 3px var(--primary-glow);
}

/* =========================================
   AUTO-GRADING UI
   ========================================= */

/* Progress bar */
.progress-bar {
  width: 100%;
  height: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 4px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--primary), #10b981);
  border-radius: 4px;
  transition: width 0.3s ease;
}

/* Grade button in table */
.td-actions {
  display: flex;
  gap: 0.375rem;
}

.btn-grade {
  background: rgba(16, 185, 129, 0.15);
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.375rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.85rem;
  transition: var(--transition);
  line-height: 1;
}

.btn-grade:hover {
  background: rgba(16, 185, 129, 0.3);
  border-color: #10b981;
}

.btn-grade:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Grading Breakdown */
.grading-breakdown {
  margin: 1rem 0;
  padding: 1rem;
  border-radius: 8px;
  background: rgba(0, 0, 0, 0.15);
  border: 1px solid var(--panel-border);
}

.breakdown-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.breakdown-item {
  padding: 0.75rem;
  border-radius: 6px;
  background: rgba(0, 0, 0, 0.1);
}

.breakdown-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
}

.breakdown-poin {
  font-weight: 700;
  color: var(--primary-hover);
  font-size: 0.9rem;
}

.breakdown-detail {
  margin-top: 0.375rem;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.breakdown-inline {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Sub items */
.sub-items {
  margin-top: 0.5rem;
  padding-left: 0.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.sub-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.375rem 0.5rem;
  border-radius: 4px;
  font-size: 0.85rem;
}

.sub-ok {
  background: rgba(16, 185, 129, 0.08);
}

.sub-fail {
  background: rgba(239, 68, 68, 0.08);
}

.sub-poin {
  font-weight: 600;
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* =========================================
   CODE RUNNER UI
   ========================================= */

/* Run button */
.run-btn {
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  border: 1px solid rgba(16, 185, 129, 0.3);
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  transition: all 0.2s ease;
}

.run-btn:hover {
  background: rgba(16, 185, 129, 0.25);
  border-color: #10b981;
}

.run-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Output panel */
.output-panel {
  margin-top: 0.75rem;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.06);
  overflow: hidden;
  background: #0d0d0d;
}

.output-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.5rem 0.75rem;
  background: rgba(255, 255, 255, 0.04);
  font-size: 0.8rem;
  color: var(--text-muted);
}

.output-clear {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.75rem;
  cursor: pointer;
  padding: 0.25rem 0.5rem;
  border-radius: 4px;
}

.output-clear:hover {
  background: rgba(255, 255, 255, 0.08);
  color: var(--text-main);
}

.output-content {
  padding: 0.75rem;
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  color: #d4d4d4;
  white-space: pre-wrap;
  word-break: break-word;
  max-height: 250px;
  overflow-y: auto;
  margin: 0;
  line-height: 1.5;
}

.output-success {
  color: #10b981;
}

.output-error {
  color: #ef4444;
}

/* Inline editor (for posttest hard) */
.inline-editor {
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  overflow: hidden;
  display: flex;
  background: #0d0d0d;
}

.inline-editor .line-numbers {
  padding: 0.75rem 0.5rem;
  min-width: 35px;
  text-align: right;
  background: rgba(255, 255, 255, 0.03);
  color: rgba(255, 255, 255, 0.25);
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  user-select: none;
  overflow: hidden;
}

.inline-editor .code-textarea {
  flex: 1;
  background: transparent;
  border: none;
  color: #e2e8f0;
  font-family: "Fira Code", monospace;
  font-size: 0.85rem;
  line-height: 1.6;
  padding: 0.75rem;
  resize: vertical;
  min-height: 200px;
  outline: none;
}

/* =========================================
   BATCH DELETE BAR
   ========================================= */
.batch-delete-bar {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(24, 24, 27, 0.95);
  border: 1px solid rgba(239, 68, 68, 0.3);
  border-radius: 12px;
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  z-index: 999;
  backdrop-filter: blur(12px);
  box-shadow:
    0 8px 32px rgba(0, 0, 0, 0.4),
    0 0 0 1px rgba(239, 68, 68, 0.1);
  animation: slideUp 0.3s ease;
}

.batch-delete-bar .batch-count {
  font-weight: 600;
  font-size: 0.95rem;
  color: #fca5a5;
}

.batch-delete-bar .btn-batch-delete {
  background: rgba(239, 68, 68, 0.8);
  color: #fff;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}

.batch-delete-bar .btn-batch-delete:hover {
  background: rgba(239, 68, 68, 1);
}

.batch-delete-bar .btn-batch-grade {
  background: rgba(16, 185, 129, 0.8);
  color: #fff;
  border: none;
  padding: 0.5rem 1.25rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 600;
  font-size: 0.9rem;
  transition: var(--transition);
}

.batch-delete-bar .btn-batch-grade:hover {
  background: rgba(16, 185, 129, 1);
}

.batch-delete-bar .btn-batch-grade:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.batch-delete-bar .btn-batch-cancel {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
  border: 1px solid var(--panel-border);
  padding: 0.5rem 1rem;
  border-radius: 8px;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.9rem;
  transition: var(--transition);
}

.batch-delete-bar .btn-batch-cancel:hover {
  background: rgba(255, 255, 255, 0.15);
  color: var(--text-main);
}

/* Checkbox styling */
.rekap-table .td-check {
  width: 40px;
  text-align: center;
}

.rekap-table .td-check input[type="checkbox"] {
  width: 16px;
  height: 16px;
  cursor: pointer;
  accent-color: #ef4444;
}

.rekap-table tr.row-selected {
  background: rgba(239, 68, 68, 0.08) !important;
}
