@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&display=swap');

:root {
  --primary: #4f46e5;       /* Indigo */
  --primary-hover: #4338ca;
  --primary-light: #e0e7ff;
  --text-main: #1e293b;     /* Slate 800 */
  --text-muted: #64748b;    /* Slate 500 */
  --bg-app: #f8fafc;        /* Slate 50 */
  --bg-card: #ffffff;
  --border: #e2e8f0;        /* Slate 200 */
  --shadow-sm: 0 1px 2px 0 rgb(0 0 0 / 0.05);
  --shadow-md: 0 4px 6px -1px rgb(0 0 0 / 0.1), 0 2px 4px -2px rgb(0 0 0 / 0.1);
  --shadow-lg: 0 10px 15px -3px rgb(0 0 0 / 0.1), 0 4px 6px -4px rgb(0 0 0 / 0.1);
  --radius-sm: 6px;
  --radius-md: 12px;
  --radius-lg: 16px;
  --success-bg: #f0fdf4;
  --success-border: #bbf7d0;
  --success-text: #166534;
}

body {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  background-color: var(--bg-app);
  color: var(--text-main);
  margin: 0;
  padding: 0;
  line-height: 1.6;
  -webkit-font-smoothing: antialiased;
}

.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

@media (max-width: 640px) {
  .container {
    padding: 1rem 1rem;
  }
}

/* Header & Typography */
h1 {
  font-size: 2rem;
  font-weight: 700;
  letter-spacing: -0.025em;
  color: #0f172a;
  margin-top: 0;
  margin-bottom: 1.5rem;
}

@media (max-width: 640px) {
  h1 {
    font-size: 1.6rem;
  }
}

p.subtitle {
  color: var(--text-muted);
  font-size: 1.1rem;
  margin-top: -1rem;
  margin-bottom: 2rem;
}

/* Nav & Breadcrumbs */
nav {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  font-size: 0.875rem;
  font-weight: 500;
  color: var(--text-muted);
  margin-bottom: 2rem;
  padding: 0.75rem 1rem;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

nav a {
  color: var(--primary);
  text-decoration: none;
  transition: color 0.2s;
}

nav a:hover {
  color: var(--primary-hover);
  text-decoration: underline;
}

nav span {
  color: #cbd5e1;
  margin: 0 0.5rem;
  user-select: none;
}

/* Search Bar */
.search-container {
  margin-bottom: 2rem;
  position: relative;
}

.search-input {
  width: 100%;
  padding: 1rem 1.25rem;
  border: 2px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-family: inherit;
  font-weight: 500;
  box-sizing: border-box;
  background-color: var(--bg-card);
  box-shadow: var(--shadow-sm);
  outline: none;
  transition: all 0.2s;
}

.search-input:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px rgba(79, 70, 229, 0.1), var(--shadow-sm);
}

.search-results {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  max-height: 350px;
  overflow-y: auto;
  margin-top: 0.5rem;
  box-shadow: var(--shadow-lg);
  display: none;
  position: absolute;
  width: 100%;
  z-index: 50;
  box-sizing: border-box;
}

.search-item {
  padding: 1rem 1.25rem;
  border-bottom: 1px solid var(--border);
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  text-align: left;
}

@media (min-width: 640px) {
  .search-item {
    flex-direction: row;
    align-items: center;
    justify-content: space-between;
  }
}

.search-item:last-child {
  border-bottom: none;
}

.search-item .course-info {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  flex-grow: 1;
}

.search-item .course-code {
  background: var(--primary-light);
  color: var(--primary);
  padding: 0.25rem 0.5rem;
  border-radius: var(--radius-sm);
  font-size: 0.75rem;
  font-weight: 700;
  font-family: monospace;
}

.search-item .course-name {
  color: var(--text-main);
  font-weight: 500;
  font-size: 0.95rem;
}

.search-item a {
  background: var(--primary);
  color: white;
  padding: 0.5rem 1rem;
  border-radius: var(--radius-sm);
  font-weight: 600;
  font-size: 0.85rem;
  text-decoration: none;
  text-align: center;
  transition: background 0.2s;
}

.search-item a:hover {
  background: var(--primary-hover);
}

/* List Cards */
ul.list-view {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

ul.list-view li {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
  transition: transform 0.2s, box-shadow 0.2s;
}

ul.list-view li:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

ul.list-view li a {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 1.25rem 1.5rem;
  color: var(--text-main);
  text-decoration: none;
  font-weight: 600;
  transition: color 0.2s;
}

ul.list-view li a:hover {
  color: var(--primary);
}

ul.list-view li a .chevron {
  color: var(--text-muted);
  font-weight: bold;
}

/* Soal Page Elements */
.meta-info {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin-bottom: 2rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.badge {
  background: #f1f5f9;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-weight: 600;
  color: var(--text-main);
}

/* Question Cards */
.soal {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.5rem;
  margin-bottom: 1.5rem;
  box-shadow: var(--shadow-sm);
  text-align: left;
}

.soal p.pertanyaan {
  font-size: 1.05rem;
  font-weight: 600;
  margin-top: 0;
  margin-bottom: 1.25rem;
  display: flex;
  gap: 0.5rem;
}

.soal p.pertanyaan span.num {
  color: var(--primary);
}

.pilihan {
  list-style: none;
  padding: 0;
  margin: 0 0 1.25rem 0;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.pilihan li {
  padding: 0.75rem 1rem;
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  font-size: 0.95rem;
  transition: background 0.15s, border-color 0.15s;
}

.pilihan li:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

/* Answer Toggles */
.btn-jawaban {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid #cbd5e1;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  box-sizing: border-box;
  transition: all 0.2s;
}

@media (min-width: 640px) {
  .btn-jawaban {
    width: auto;
  }
}

.btn-jawaban:hover {
  background: #e2e8f0;
  border-color: #94a3b8;
}

.jawaban {
  background: var(--success-bg);
  border-left: 4px solid #22c55e;
  border-top: 1px solid var(--success-border);
  border-right: 1px solid var(--success-border);
  border-bottom: 1px solid var(--success-border);
  border-radius: var(--radius-md);
  padding: 1rem 1.25rem;
  margin-top: 1rem;
  font-size: 0.95rem;
  color: var(--success-text);
  box-shadow: var(--shadow-sm);
  display: none;
  animation: fadeIn 0.3s ease-out;
}

.jawaban strong {
  color: #15803d;
}

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

/* AI Latihan Section */
.ai-section {
  background: linear-gradient(135deg, #e0e7ff 0%, #e879f9 200%);
  border: 1px solid #c7d2fe;
  border-radius: var(--radius-lg);
  padding: 2rem;
  margin-top: 3.5rem;
  text-align: left;
  box-shadow: var(--shadow-sm);
}

.ai-section h2 {
  font-size: 1.4rem;
  color: #1e1b4b;
  margin-top: 0;
  margin-bottom: 0.5rem;
}

.ai-section p {
  color: #312e81;
  font-size: 0.95rem;
  margin-bottom: 1.25rem;
}

.prompt-box {
  background: rgba(255, 255, 255, 0.85);
  backdrop-filter: blur(8px);
  border: 1px solid #a5b4fc;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  font-size: 0.875rem;
  font-family: monospace;
  white-space: pre-wrap;
  line-height: 1.6;
  color: #1e1b4b;
  max-height: 200px;
  overflow-y: auto;
  user-select: all;
  box-shadow: inset var(--shadow-sm);
}

.btn-copy {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: var(--radius-md);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  margin-top: 1rem;
  width: 100%;
  box-sizing: border-box;
  transition: background 0.2s, transform 0.1s;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
}

@media (min-width: 640px) {
  .btn-copy {
    width: auto;
  }
}

.btn-copy:hover {
  background: var(--primary-hover);
}

.btn-copy:active {
  transform: scale(0.98);
}

/* Mode Selector */
.mode-selector {
  display: flex;
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.35rem;
  margin-bottom: 2rem;
  gap: 0.25rem;
}

.mode-btn {
  flex: 1;
  display:inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  background: transparent;
  color: var(--text-muted);
  padding: 0.6rem 1rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
  gap: 0.5rem;
}

.mode-btn:hover {
  background: rgba(255, 255, 255, 0.5);
  color: var(--text-main);
}

.mode-btn.active {
  background: var(--bg-card);
  color: var(--primary);
  box-shadow: var(--shadow-sm);
}

/* Exam Mode Selection Styles */
.mode-exam-active .pilihan li, .mode-belajar-active .pilihan li {
  cursor: pointer;
}

.pilihan li.selected {
  border-color: var(--primary);
  background: var(--primary-light);
  color: #1e1b4b;
  font-weight: 500;
}

.pilihan li.correct {
  border-color: var(--success-border);
  background: var(--success-bg);
  color: var(--success-text);
  font-weight: 600;
}

.pilihan li.incorrect {
  border-color: #fecaca; /* red-200 */
  background: #fef2f2; /* red-50 */
  color: #991b1b; /* red-800 */
  font-weight: 600;
}

/* Exam Buttons & Banner */
.exam-submit-container {
  margin-top: 2rem;
  text-align: center;
}

.btn-submit-exam {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.8rem 2rem;
  border-radius: var(--radius-md);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  box-shadow: 0 4px 6px -1px rgba(79, 70, 229, 0.2);
  transition: all 0.2s;
}

.btn-submit-exam:hover {
  background: var(--primary-hover);
}

.score-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 2rem;
  text-align: center;
  font-size: 1.1rem;
  color: #14532d;
  box-shadow: var(--shadow-sm);
}

/* Print Panel styling */
.print-panel {
  background: #f8fafc;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 1.25rem;
  margin-bottom: 2rem;
}
.print-panel p {
  margin: 0 0 0.75rem 0;
  font-weight: 500;
  color: var(--text-main);
}
.print-options {
  margin-bottom: 1rem;
}
.print-options label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.95rem;
  cursor: pointer;
  font-weight: 500;
}
.btn-print-action {
  background: var(--primary);
  color: white;
  border: none;
  padding: 0.6rem 1.25rem;
  border-radius: var(--radius-sm);
  font-size: 0.875rem;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.2s;
}
.btn-print-action:hover {
  background: var(--primary-hover);
}

/* Print Styles */
@media print {
  body {
    background: white !important;
    color: black !important;
    font-size: 11pt;
  }
  .container {
    max-width: 100% !important;
    padding: 0 !important;
  }
  nav, .mode-selector, .btn-jawaban, .ai-section, .btn-copy, .exam-submit-container, .score-banner, .print-panel, .no-print {
    display: none !important;
  }
  .soal {
    border: none !important;
    box-shadow: none !important;
    padding: 0 !important;
    margin-bottom: 2rem !important;
    page-break-inside: avoid;
  }
  .pilihan li {
    background: transparent !important;
    border: none !important;
    padding: 0.2rem 0 !important;
  }
  .jawaban {
    display: block !important;
    background: transparent !important;
    border: none !important;
    box-shadow: none !important;
    padding: 0.5rem 0 0 0 !important;
    color: black !important;
    font-style: italic;
  }
  body.hide-answers-print .jawaban {
    display: none !important;
  }
}

/* Layout Baru Ujian Simulasi (CBT Style) */
.exam-container {
  max-width: 1100px;
  margin: 100px auto 3rem auto;
  padding: 0 1.5rem;
}

.exam-header {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  background: rgba(255, 255, 255, 0.95);
  backdrop-filter: blur(8px);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 2rem;
  display: flex;
  justify-content: space-between;
  align-items: center;
  z-index: 1000;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

@media (max-width: 640px) {
  .exam-header {
    padding: 0.75rem 1rem;
  }
}

.exam-header-left h2 {
  font-size: 1.25rem;
  margin: 0;
  font-weight: 700;
  color: var(--text-main);
}

.exam-header-left p {
  font-size: 0.85rem;
  margin: 0;
  color: var(--text-muted);
  font-weight: 500;
}

.timer-box {
  background: #f1f5f9;
  border: 1px solid var(--border);
  border-radius: var(--radius-md);
  padding: 0.5rem 1rem;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

@media (max-width: 640px) {
  .timer-box {
    padding: 0.35rem 0.75rem;
  }
}

.timer-label {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-muted);
}

#countdown-timer {
  font-family: monospace;
  font-size: 1.15rem;
  font-weight: 700;
  color: var(--primary);
}

/* CBT Columns */
.exam-layout {
  display: flex;
  gap: 2rem;
  align-items: flex-start;
}

@media (max-width: 900px) {
  .exam-layout {
    flex-direction: column;
    gap: 1.5rem;
  }
}

.exam-main {
  flex: 1;
  min-width: 0;
  width: 100%;
}

.exam-sidebar {
  width: 280px;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  position: sticky;
  top: 100px;
  box-shadow: var(--shadow-sm);
  box-sizing: border-box;
}

@media (max-width: 900px) {
  .exam-sidebar {
    width: 100%;
    position: static;
  }
}

.exam-sidebar h3 {
  margin: 0 0 1rem 0;
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  border-bottom: 1px solid var(--border);
  padding-bottom: 0.5rem;
}

/* Number Grid */
.number-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.number-btn {
  background: #f8fafc;
  border: 1px solid var(--border);
  color: var(--text-muted);
  padding: 0.6rem 0;
  font-family: inherit;
  font-weight: 700;
  font-size: 0.875rem;
  border-radius: var(--radius-sm);
  cursor: pointer;
  text-align: center;
  transition: all 0.15s;
}

.number-btn:hover {
  background: #f1f5f9;
  border-color: #cbd5e1;
}

.number-btn.active {
  border-color: var(--primary);
  box-shadow: 0 0 0 2px var(--primary-light);
  color: var(--primary);
  background: white;
}

.number-btn.answered {
  background: var(--primary-light);
  color: var(--primary);
  border-color: #a5b4fc;
}

.number-btn.flagged {
  background: #fef08a; /* yellow-200 */
  color: #854d0e; /* yellow-800 */
  border-color: #fde047;
}

.number-btn.correct {
  background: var(--success-bg) !important;
  color: var(--success-text) !important;
  border-color: var(--success-border) !important;
}

.number-btn.incorrect {
  background: #fef2f2 !important; /* red-50 */
  color: #991b1b !important; /* red-800 */
  border-color: #fecaca !important; /* red-200 */
}

/* Navigasi Buttons */
.exam-nav-buttons {
  display: flex;
  justify-content: space-between;
  margin-top: 1.5rem;
  gap: 0.75rem;
}

.btn-nav {
  background: #f1f5f9;
  color: var(--text-main);
  border: 1px solid #cbd5e1;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-weight: 600;
  font-size: 0.9rem;
  cursor: pointer;
  transition: all 0.2s;
  flex: 1;
  text-align: center;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
  box-sizing: border-box;
}

.btn-nav:hover {
  background: #e2e8f0;
}

.btn-nav.flag-btn {
  background: #fffbeb; /* yellow-50 */
  border-color: #fde047;
  color: #854d0e;
}

.btn-nav.flag-btn:hover {
  background: #fef9c3;
}

.btn-nav.flag-btn.active {
  background: #eab308; /* yellow-500 */
  color: white;
  border-color: #ca8a04;
}

.btn-nav.primary-btn {
  background: var(--primary);
  color: white;
  border: none;
}

.btn-nav.primary-btn:hover {
  background: var(--primary-hover);
}

/* Legend Container */
.legend-container {
  font-size: 0.8rem;
  color: var(--text-muted);
  border-top: 1px solid var(--border);
  padding-top: 0.75rem;
  margin-top: 1.25rem;
}

.legend-item {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.4rem;
  font-weight: 500;
}

.legend-color {
  width: 14px;
  height: 14px;
  border-radius: 3px;
  border: 1px solid var(--border);
}

.legend-color.answered { background: var(--primary-light); border-color: #a5b4fc; }
.legend-color.flagged { background: #fef08a; border-color: #fde047; }
.legend-color.unanswered { background: #f8fafc; }
.legend-color.correct { background: var(--success-bg); border-color: var(--success-border); }
.legend-color.incorrect { background: #fef2f2; border-color: #fecaca; }

/* Exam Result Banner */
.exam-result-banner {
  background: linear-gradient(135deg, #f0fdf4 0%, #dcfce7 100%);
  border: 1px solid #bbf7d0;
  border-radius: var(--radius-lg);
  padding: 1.75rem;
  margin-bottom: 2.5rem;
  text-align: center;
  color: #14532d;
  box-shadow: var(--shadow-md);
}

.exam-result-banner h3 {
  margin: 0 0 0.5rem 0;
  font-size: 1.4rem;
  font-weight: 700;
}

.exam-result-banner p {
  margin: 0.25rem 0;
}



