/**
 * ============================================================================
 * InstituteCRM — Exam Management & Student Examination Interface Styles
 * Follows the Aurora design system (Dark & Light mode, Glassmorphism)
 * ============================================================================
 */

/* ========================================================================== */
/* Exam Management General Components                                          */
/* ========================================================================== */

.exam-header {
  display: flex;
  flex-wrap: wrap;
  align-items: flex-start;
  justify-content: space-between;
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.exam-filters-bar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  margin-bottom: 1.25rem;
}

.exam-status-pills {
  display: flex;
  gap: 0.35rem;
  flex-wrap: wrap;
}

.exam-pill {
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 500;
  border-radius: 999px;
  background: var(--muted);
  color: var(--muted-foreground);
  border: 1px solid transparent;
  cursor: pointer;
  transition: all 0.15s ease;
}

.exam-pill:hover {
  background: var(--card-subtle);
  color: var(--foreground);
}

.exam-pill.active {
  background: var(--primary);
  color: var(--primary-foreground);
  border-color: var(--primary);
  box-shadow: 0 2px 8px var(--primary-glow);
}

/* Exam Cards Grid */
.exam-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.exam-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 1rem;
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  transition: transform 0.2s ease, box-shadow 0.2s ease, border-color 0.2s ease;
  position: relative;
  overflow: hidden;
}

.exam-card:hover {
  transform: translateY(-2px);
  border-color: var(--border-strong);
  box-shadow: var(--shadow-lg);
}

.exam-card-head {
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
}

.exam-badge {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  font-size: 0.72rem;
  font-weight: 600;
  border-radius: 999px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

.exam-badge.draft { background: rgba(148, 163, 184, 0.15); color: #94a3b8; border: 1px solid rgba(148, 163, 184, 0.3); }
.exam-badge.scheduled { background: rgba(59, 130, 246, 0.15); color: #60a5fa; border: 1px solid rgba(59, 130, 246, 0.3); }
.exam-badge.published { background: rgba(16, 185, 129, 0.15); color: #34d399; border: 1px solid rgba(16, 185, 129, 0.3); }
.exam-badge.ongoing { background: rgba(245, 158, 11, 0.15); color: #fbbf24; border: 1px solid rgba(245, 158, 11, 0.3); animation: pulse-slow 2s infinite; }
.exam-badge.completed { background: rgba(99, 102, 241, 0.15); color: #818cf8; border: 1px solid rgba(99, 102, 241, 0.3); }
.exam-badge.archived { background: rgba(100, 116, 139, 0.15); color: #94a3b8; border: 1px solid rgba(100, 116, 139, 0.3); }

@keyframes pulse-slow {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.6; }
}

.exam-card-title {
  font-size: 1.125rem;
  font-weight: 700;
  color: var(--foreground);
  margin: 0 0 0.35rem 0;
  line-height: 1.35;
}

.exam-card-desc {
  font-size: 0.82rem;
  color: var(--muted-foreground);
  margin: 0 0 1rem 0;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
  line-height: 1.45;
}

.exam-meta-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.5rem 0.75rem;
  padding: 0.85rem 0;
  border-top: 1px solid var(--border);
  border-bottom: 1px solid var(--border);
  margin-bottom: 1rem;
  font-size: 0.8rem;
}

.exam-meta-item {
  display: flex;
  flex-direction: column;
}

.exam-meta-label {
  font-size: 0.7rem;
  color: var(--muted-foreground);
  text-transform: uppercase;
  letter-spacing: 0.03em;
  margin-bottom: 0.15rem;
}

.exam-meta-value {
  font-weight: 600;
  color: var(--foreground);
}

.exam-card-actions {
  display: flex;
  flex-wrap: wrap;
  gap: 0.5rem;
  align-items: center;
  margin-top: auto;
}

/* ========================================================================== */
/* Super Admin Exam Dashboard Controls                                        */
/* ========================================================================== */

.super-master-box {
  background: var(--gradient-surface);
  border: 1px solid var(--border-strong);
  border-radius: 1.25rem;
  padding: 1.5rem;
  margin-bottom: 1.75rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1.25rem;
  position: relative;
  overflow: hidden;
}

.super-master-box::before {
  content: "";
  position: absolute;
  top: 0; right: 0; width: 200px; height: 100%;
  background: radial-gradient(circle at top right, var(--primary-subtle), transparent 70%);
  pointer-events: none;
}

.super-master-info h3 {
  font-size: 1.25rem;
  font-weight: 700;
  margin: 0 0 0.35rem 0;
}

.super-master-info p {
  font-size: 0.875rem;
  color: var(--muted-foreground);
  margin: 0;
  max-width: 36rem;
}

.super-master-toggle {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--card);
  padding: 0.65rem 1.25rem;
  border-radius: 999px;
  border: 1px solid var(--border);
}

/* ========================================================================== */
/* Question Builder Modal & Canvas                                            */
/* ========================================================================== */

.qb-modal-body {
  display: grid;
  grid-template-columns: 1fr;
  gap: 1.5rem;
  max-height: 75vh;
  overflow-y: auto;
  padding: 1.25rem;
}

@media (min-width: 900px) {
  .qb-layout {
    display: grid;
    grid-template-columns: 1fr 380px;
    gap: 1.5rem;
    align-items: flex-start;
  }
}

.qb-question-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.15rem;
  margin-bottom: 0.85rem;
  transition: all 0.15s ease;
  position: relative;
}

.qb-question-card:hover {
  border-color: var(--border-strong);
}

.qb-question-head {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.65rem;
  font-size: 0.85rem;
}

.qb-question-text {
  font-size: 0.95rem;
  font-weight: 500;
  color: var(--foreground);
  margin: 0 0 0.85rem 0;
  line-height: 1.5;
}

.qb-option-list {
  display: flex;
  flex-direction: column;
  gap: 0.45rem;
  margin-bottom: 0.85rem;
}

.qb-option-item {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.5rem 0.75rem;
  background: var(--card-subtle);
  border: 1px solid var(--border);
  border-radius: 0.5rem;
  font-size: 0.85rem;
}

.qb-option-item.correct {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.35);
  color: #34d399;
}

.qb-option-badge {
  width: 1.4rem;
  height: 1.4rem;
  border-radius: 50%;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.72rem;
  font-weight: 700;
  flex-shrink: 0;
}

.qb-option-item.correct .qb-option-badge {
  background: #10b981;
  color: #ffffff;
}

.qb-actions-row {
  display: flex;
  gap: 0.4rem;
  align-items: center;
  justify-content: flex-end;
  border-top: 1px solid var(--border);
  padding-top: 0.65rem;
  margin-top: 0.65rem;
}

/* ========================================================================== */
/* Student Examination Live Interface                                         */
/* ========================================================================== */

.exam-runner-shell {
  min-height: 100vh;
  background: var(--background);
  color: var(--foreground);
  display: flex;
  flex-direction: column;
  font-family: var(--font-body, inherit);
}

.exam-runner-topbar {
  background: var(--card);
  border-bottom: 1px solid var(--border);
  padding: 0.85rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  position: sticky;
  top: 0;
  z-index: 50;
  box-shadow: var(--shadow-sm);
}

.exam-timer-box {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  background: var(--card-subtle);
  border: 1px solid var(--border-strong);
  padding: 0.5rem 1.15rem;
  border-radius: 999px;
  font-variant-numeric: tabular-nums;
  font-weight: 700;
  font-size: 1.1rem;
  color: var(--foreground);
  transition: all 0.3s ease;
}

.exam-timer-box.warning {
  background: rgba(245, 158, 11, 0.15);
  border-color: #f59e0b;
  color: #fbbf24;
}

.exam-timer-box.danger {
  background: rgba(239, 68, 68, 0.18);
  border-color: #ef4444;
  color: #f87171;
  animation: pulse-slow 1s infinite;
}

.exam-runner-body {
  flex: 1;
  display: grid;
  grid-template-columns: 1fr;
  gap: 1rem;
  padding: 1rem;
  max-width: 1040px;
  width: 100%;
  margin: 0 auto;
}

@media (min-width: 900px) {
  .exam-runner-body {
    grid-template-columns: 1fr 280px;
  }
}

.exam-question-pane {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.15rem 1.35rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
}

.exam-q-prompt {
  font-size: 1.05rem;
  font-weight: 600;
  line-height: 1.5;
  margin: 0.85rem 0 1.15rem 0;
  color: var(--foreground);
}

/* MCQ Options Inputs in Student Portal - Compact & Clean */
.exam-choice-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  margin-bottom: 1.25rem;
}

.exam-choice-option {
  display: flex;
  align-items: center;
  gap: 0.65rem;
  padding: 0.55rem 0.85rem;
  background: var(--card-subtle);
  border: 1.5px solid var(--border);
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.15s ease;
  user-select: none;
}

.exam-choice-option:hover {
  background: var(--secondary);
  border-color: var(--border-strong);
}

.exam-choice-option.selected {
  background: var(--primary-subtle);
  border-color: var(--primary);
  box-shadow: 0 0 0 1px var(--primary);
}

.exam-choice-letter {
  width: 1.6rem;
  height: 1.6rem;
  border-radius: 50%;
  background: var(--muted);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  flex-shrink: 0;
  color: var(--foreground);
  transition: all 0.15s ease;
}

.exam-choice-option.selected .exam-choice-letter {
  background: var(--primary);
  color: var(--primary-foreground);
}

.exam-choice-text {
  font-size: 0.92rem;
  line-height: 1.35;
  color: var(--foreground);
}

/* True / False Option Cards - Compact */
.exam-tf-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.exam-tf-card {
  padding: 0.75rem 1rem;
  border: 1.5px solid var(--border);
  background: var(--card-subtle);
  border-radius: 0.5rem;
  cursor: pointer;
  text-align: center;
  font-size: 0.95rem;
  font-weight: 600;
  transition: all 0.2s ease;
}

.exam-tf-card:hover {
  border-color: var(--border-strong);
  background: var(--secondary);
}

.exam-tf-card.selected {
  border-color: var(--primary);
  background: var(--primary-subtle);
  color: var(--primary);
}

/* Written Answer Textarea */
.exam-written-input {
  width: 100%;
  min-height: 160px;
  background: var(--input-bg);
  border: 1.5px solid var(--border);
  border-radius: 0.65rem;
  padding: 0.85rem;
  color: var(--foreground);
  font-size: 0.92rem;
  line-height: 1.5;
  resize: vertical;
  transition: border-color 0.2s ease;
  margin-bottom: 1rem;
}

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

/* Question Palette (Sidebar) - Compact */
.exam-palette-pane {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1rem;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-sm);
  position: sticky;
  top: 4.5rem;
  max-height: calc(100vh - 5.5rem);
  overflow-y: auto;
}

.exam-palette-grid {
  display: grid;
  grid-template-columns: repeat(5, 1fr);
  gap: 0.45rem;
  margin: 0.75rem 0;
}

.palette-btn {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 0.45rem;
  border: 1.5px solid var(--border);
  background: var(--muted);
  color: var(--muted-foreground);
  font-weight: 700;
  font-size: 0.85rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  padding: 0;
}

.palette-btn:hover {
  border-color: var(--border-strong);
  color: var(--foreground);
}

.palette-btn.current {
  border-color: var(--primary) !important;
  box-shadow: 0 0 0 2px var(--primary-glow);
}

.palette-btn.answered {
  background: rgba(16, 185, 129, 0.2);
  border-color: #10b981;
  color: #34d399;
}

.palette-btn.flagged {
  background: rgba(245, 158, 11, 0.2);
  border-color: #f59e0b;
  color: #fbbf24;
}

/* Submission Confirmation & Success Screen (Rule 7: STRICTLY NO RESULTS) */
.exam-success-card {
  max-width: 580px;
  margin: 3rem auto;
  background: var(--card);
  border: 1px solid var(--border-strong);
  border-radius: 1.5rem;
  padding: 3rem 2rem;
  text-align: center;
  box-shadow: var(--shadow-xl);
}

.exam-success-icon {
  width: 5rem;
  height: 5rem;
  margin: 0 auto 1.5rem auto;
  border-radius: 50%;
  background: rgba(16, 185, 129, 0.15);
  color: #10b981;
  display: flex;
  align-items: center;
  justify-content: center;
}

.exam-success-title {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--foreground);
  margin: 0 0 0.5rem 0;
}

.exam-success-subtitle {
  font-size: 0.95rem;
  color: var(--muted-foreground);
  margin: 0 0 2rem 0;
  line-height: 1.5;
}

.exam-success-receipt {
  background: var(--card-subtle);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1.25rem;
  margin-bottom: 2rem;
  text-align: left;
  font-size: 0.85rem;
}

.exam-success-receipt .row {
  display: flex;
  justify-content: space-between;
  padding: 0.35rem 0;
  border-bottom: 1px dashed var(--border);
}

.exam-success-receipt .row:last-child {
  border-bottom: none;
}

/* ========================================================================== */
/* Exam Results & Score Reports Dashboard                                     */
/* ========================================================================== */

.exam-results-kpi-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1rem;
  margin-bottom: 1.25rem;
}

.exam-results-kpi-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.875rem;
  padding: 1rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.exam-results-kpi-card:hover {
  transform: translateY(-2px);
  box-shadow: var(--shadow-md);
}

.exam-results-kpi-title {
  font-size: 0.78rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--muted-foreground);
}

.exam-results-kpi-val {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--foreground);
  line-height: 1.2;
}

.exam-sheet-card {
  background: var(--card);
  border: 1px solid var(--border);
  border-radius: 0.75rem;
  padding: 1rem 1.25rem;
  margin-bottom: 1rem;
}

.exam-sheet-card.is-correct {
  border-left: 4px solid var(--success, #10b981);
}

.exam-sheet-card.is-incorrect {
  border-left: 4px solid var(--destructive, #ef4444);
}

.exam-sheet-card.is-unattempted {
  border-left: 4px solid var(--muted-foreground, #6b7280);
}

