/* ===================================================================
   SYSTEM BRANDING & DYNAMIC THEME VARIABLES
   =================================================================== */
:root {
  --primary-color: #2563eb;
  --primary-hover: #1d4ed8;
  --primary-light: #eff6ff;
  --primary-text: #ffffff;
  --secondary-color: #475569;
  --accent-color: #f59e0b;
  --success-color: #10b981;
  --danger-color: #ef4444;
  --bg-color: #f8fafc;
  --card-bg: #ffffff;
  --border-color: #e2e8f0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
  background-color: var(--bg-color);
  color: #1e293b;
  min-height: 100vh;
}

/* Custom Primary Color classes to support dynamic theme picker */
.bg-theme {
  background-color: var(--primary-color) !important;
  color: var(--primary-text) !important;
}

.bg-theme-light {
  background-color: var(--primary-light) !important;
}

.text-theme {
  color: var(--primary-color) !important;
}

.border-theme {
  border-color: var(--primary-color) !important;
}

.hover-bg-theme:hover {
  background-color: var(--primary-hover) !important;
}

/* ===================================================================
   KATEX & MATH FORMULA STYLING
   =================================================================== */
.katex {
  font-size: 1.15em !important;
  line-height: 1.2;
}

.katex-display {
  margin: 0.75em 0 !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0.25em 0;
}

/* ===================================================================
   EXAM TAKING & QUESTION NAVIGATION
   =================================================================== */
.question-pill {
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 0.875rem;
  font-weight: 600;
  border-radius: 0.5rem;
  transition: all 0.2s ease;
  cursor: pointer;
  border: 1px solid var(--border-color);
  background-color: #ffffff;
}

.question-pill:hover {
  border-color: var(--primary-color);
  transform: translateY(-1px);
}

.question-pill.active {
  background-color: var(--primary-color);
  color: #ffffff;
  border-color: var(--primary-color);
  box-shadow: 0 4px 6px -1px rgba(37, 99, 235, 0.3);
}

.question-pill.answered {
  background-color: #dcfce7;
  color: #166534;
  border-color: #86efac;
}

.question-pill.answered.active {
  background-color: var(--primary-color);
  color: #ffffff;
}

.question-pill.flagged {
  border-color: #f59e0b;
  position: relative;
}

.question-pill.flagged::after {
  content: '';
  position: absolute;
  top: 2px;
  right: 2px;
  width: 7px;
  height: 7px;
  background-color: #f59e0b;
  border-radius: 50%;
}

/* Option Cards */
.choice-card {
  border: 1.5px solid #e2e8f0;
  border-radius: 0.625rem;
  padding: 0.875rem 1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
  background-color: #ffffff;
}

.choice-card:hover {
  border-color: #93c5fd;
  background-color: #f8fafc;
}

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

/* True / False 4-Item Grid Styling */
.tf-row {
  display: grid;
  grid-template-columns: auto 1fr auto auto;
  align-items: center;
  gap: 1rem;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #f1f5f9;
  border-radius: 0.375rem;
}

.tf-row:hover {
  background-color: #f8fafc;
}

/* ===================================================================
   ANTI-CHEAT SYSTEM STYLES
   =================================================================== */
.anti-cheat-overlay {
  position: fixed;
  inset: 0;
  background-color: rgba(15, 23, 42, 0.92);
  z-index: 99999;
  display: flex;
  align-items: center;
  justify-content: center;
  backdrop-filter: blur(8px);
  animation: fadeIn 0.2s ease-out;
}

.anti-cheat-card {
  background: white;
  border-radius: 1rem;
  max-width: 540px;
  width: 90%;
  padding: 2rem;
  box-shadow: 0 25px 50px -12px rgba(0, 0, 0, 0.25);
  border-top: 6px solid #ef4444;
  animation: scaleUp 0.25s cubic-bezier(0.16, 1, 0.3, 1);
}

.warning-pulse {
  animation: pulseWarning 1.5s infinite;
}

@keyframes pulseWarning {
  0% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.5); }
  70% { transform: scale(1.03); box-shadow: 0 0 0 14px rgba(239, 68, 68, 0); }
  100% { transform: scale(1); box-shadow: 0 0 0 0 rgba(239, 68, 68, 0); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

@keyframes scaleUp {
  from { opacity: 0; transform: scale(0.95); }
  to { opacity: 1; transform: scale(1); }
}

/* ===================================================================
   TOAST NOTIFICATIONS
   =================================================================== */
#toast-container {
  position: fixed;
  bottom: 5.5rem; /* Avoid collision with Netlify bottom-right badge */
  right: 1.5rem;
  z-index: 9999;
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
  pointer-events: none;
}

.toast {
  pointer-events: auto;
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.875rem 1.25rem;
  border-radius: 0.5rem;
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1), 0 4px 6px -4px rgba(0, 0, 0, 0.1);
  font-size: 0.9rem;
  font-weight: 500;
  animation: slideInRight 0.3s cubic-bezier(0.16, 1, 0.3, 1);
  background-color: white;
}

@keyframes slideInRight {
  from { transform: translateX(100%); opacity: 0; }
  to { transform: translateX(0); opacity: 1; }
}

/* ===================================================================
   LIVE EXAM EDITOR STYLES
   =================================================================== */
.editor-question-card {
  border: 1px solid #e2e8f0;
  border-radius: 0.75rem;
  background-color: #ffffff;
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.editor-question-card:hover {
  border-color: #cbd5e1;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.05);
}

.editor-question-card.active-editing {
  border-color: var(--primary-color);
  box-shadow: 0 0 0 2px var(--primary-light);
}

/* Image preview modal */
.img-zoom-modal {
  position: fixed;
  inset: 0;
  background-color: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 99999;
  cursor: zoom-out;
}

.img-zoom-modal img {
  max-width: 90vw;
  max-height: 90vh;
  object-fit: contain;
  border-radius: 0.5rem;
}

/* ===================================================================
   SYSTEM SECURITY & ANTI-COPY / ANTI-DEVTOOLS
   =================================================================== */
/* Prevent text highlighting across exam areas */
.no-select, body.security-locked, .question-card, .exam-content {
  -webkit-user-select: none !important;
  -moz-user-select: none !important;
  -ms-user-select: none !important;
  user-select: none !important;
}

/* Allow text selection inside genuine input areas */
input, textarea, [contenteditable="true"] {
  -webkit-user-select: text !important;
  -moz-user-select: text !important;
  -ms-user-select: text !important;
  user-select: text !important;
}

/* ===================================================================
   MODERN DASHBOARD HUB CARDS (MICRO-INTERACTIONS)
   =================================================================== */
.hub-card {
  transition: all 0.28s cubic-bezier(0.16, 1, 0.3, 1);
  will-change: transform, box-shadow;
  border: 1px solid rgba(226, 232, 240, 0.8);
  position: relative;
  overflow: hidden;
}

.hub-card:hover {
  transform: translateY(-4px) scale(1.012);
  box-shadow: 0 16px 30px -8px rgba(37, 99, 235, 0.12), 0 4px 10px -2px rgba(0, 0, 0, 0.04);
  border-color: var(--primary-color);
}

.hub-card:active {
  transform: translateY(-1px) scale(0.995);
}

.hub-icon-wrapper {
  transition: transform 0.25s ease;
}

.hub-card:hover .hub-icon-wrapper {
  transform: scale(1.1) rotate(-3deg);
}

