/* ==============================================================================
   Mathe-Quiz Portal EF - Style Sheet
   Premium Dark Mode / Glassmorphism UI (Large Fonts)
   ============================================================================== */

:root {
  --bg-dark: #0f172a;
  --card-bg: rgba(30, 41, 59, 0.88);
  --card-border: rgba(255, 255, 255, 0.14);
  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-glow: rgba(59, 130, 246, 0.4);
  --success: #10b981;
  --success-glow: rgba(16, 185, 129, 0.3);
  --danger: #ef4444;
  --warning: #f59e0b;
  --text-main: #f8fafc;
  --text-muted: #94a3b8;
  --radius-lg: 20px;
  --radius-md: 14px;
  --shadow-lg: 0 24px 48px -12px rgba(0, 0, 0, 0.6);
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Inter', system-ui, -apple-system, sans-serif;
  background-color: var(--bg-dark);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 24px;
  position: relative;
  overflow-x: hidden;
  font-size: 18px;
  line-height: 1.6;
}

/* Background Glow Effects */
.bg-glow {
  position: fixed;
  border-radius: 50%;
  filter: blur(120px);
  pointer-events: none;
  z-index: 0;
}
.bg-glow-1 {
  top: -10%;
  left: -10%;
  width: 550px;
  height: 550px;
  background: rgba(59, 130, 246, 0.18);
}
.bg-glow-2 {
  bottom: -10%;
  right: -10%;
  width: 650px;
  height: 650px;
  background: rgba(16, 185, 129, 0.15);
}

/* Container */
.app-container {
  width: 100%;
  max-width: 860px;
  z-index: 1;
}

/* View Cards */
.view-card {
  background: var(--card-bg);
  backdrop-filter: blur(18px);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow-lg);
  overflow: hidden;
  display: none;
  flex-direction: column;
  transition: all 0.3s ease;
}
.view-card.active {
  display: flex;
  animation: fadeIn 0.4s cubic-bezier(0.16, 1, 0.3, 1);
}

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

/* Card Structure */
.card-header {
  padding: 32px 36px 24px 36px;
  border-bottom: 1px solid var(--card-border);
}
.card-body {
  padding: 36px;
}
.card-footer {
  padding: 24px 36px;
  background: rgba(15, 23, 42, 0.5);
  border-top: 1px solid var(--card-border);
}

/* Typography & Titles */
.text-center { text-align: center; }
.text-between { display: flex; justify-content: space-between; align-items: center; }

.logo-icon {
  width: 68px;
  height: 68px;
  margin: 0 auto 18px auto;
  background: linear-gradient(135deg, var(--primary), #8b5cf6);
  border-radius: 18px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 32px;
  color: white;
  box-shadow: 0 12px 24px var(--primary-glow);
}

.main-title {
  font-size: 30px;
  font-weight: 800;
  letter-spacing: -0.5px;
  margin-bottom: 8px;
}
.section-title {
  font-size: 25px;
  font-weight: 700;
}
.subtitle {
  font-size: 16px;
  color: var(--text-muted);
}
.info-text {
  font-size: 17px;
  color: var(--text-muted);
  line-height: 1.6;
  margin-bottom: 26px;
}

/* Badges */
.badge {
  display: inline-block;
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 14px;
  font-weight: 600;
  margin-top: 12px;
}
.badge-ef {
  background: rgba(59, 130, 246, 0.2);
  color: #60a5fa;
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.badge-danger {
  background: rgba(239, 68, 68, 0.2);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

/* Form Controls */
.form-group {
  margin-bottom: 24px;
  text-align: left;
}
.form-group label {
  display: block;
  font-size: 16px;
  font-weight: 600;
  margin-bottom: 10px;
  color: var(--text-main);
}
.input-wrapper input, .select-wrapper select {
  width: 100%;
  padding: 16px 20px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: white;
  font-size: 17px;
  font-family: inherit;
  outline: none;
  transition: all 0.2s ease;
}
.input-wrapper input:focus, .select-wrapper select:focus {
  border-color: var(--primary);
  box-shadow: 0 0 0 4px var(--primary-glow);
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 16px 26px;
  border-radius: var(--radius-md);
  font-size: 17px;
  font-weight: 600;
  cursor: pointer;
  border: none;
  transition: all 0.2s ease;
  gap: 10px;
}
.btn-primary {
  background: linear-gradient(135deg, var(--primary), var(--primary-hover));
  color: white;
  box-shadow: 0 6px 18px var(--primary-glow);
}
.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 10px 26px var(--primary-glow);
}
.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: var(--text-main);
  border: 1px solid var(--card-border);
}
.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.16);
}
.btn-block { width: 100%; }
.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 16px;
  cursor: pointer;
  transition: color 0.2s ease;
}
.btn-link:hover { color: var(--primary); }
.teacher-link { color: #a78bfa; font-weight: 600; font-size: 16px; }
.teacher-link:hover { color: #c4b5fd; }

.hidden { display: none !important; }

/* Quiz Grid */
.quiz-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 22px;
}
.quiz-card {
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 26px;
  cursor: pointer;
  transition: all 0.25s ease;
  position: relative;
}
.quiz-card:hover {
  border-color: var(--primary);
  transform: translateY(-3px);
  box-shadow: 0 14px 30px rgba(0, 0, 0, 0.35);
}
.quiz-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 14px;
}
.quiz-card-title {
  font-size: 21px;
  font-weight: 700;
}
.quiz-card-desc {
  font-size: 16px;
  color: var(--text-muted);
  line-height: 1.6;
}

/* Active Quiz View */
.quiz-top-bar {
  display: flex;
  justify-content: space-between;
  margin-bottom: 14px;
  font-size: 16px;
  font-weight: 600;
}
.progress-badge { color: var(--text-muted); }
.points-badge { color: #f59e0b; }

.progress-bar-container {
  width: 100%;
  height: 10px;
  background: rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  overflow: hidden;
}
.progress-bar-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary), var(--success));
  transition: width 0.4s ease;
}

/* Task Image Display Box */
.task-image-box {
  background: #ffffff;
  border-radius: var(--radius-md);
  padding: 16px;
  margin: 20px 0;
  text-align: center;
  border: 2px solid rgba(255, 255, 255, 0.2);
}
.task-image-box img {
  max-width: 100%;
  max-height: 360px;
  height: auto;
  border-radius: 8px;
  object-fit: contain;
}

.question-header {
  margin-bottom: 20px;
}
.section-tag {
  display: inline-block;
  font-size: 14px;
  font-weight: 700;
  text-transform: uppercase;
  color: #60a5fa;
  margin-bottom: 8px;
  letter-spacing: 0.5px;
}
.question-title {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.5;
}

/* KaTeX Formula No-Wrap Protection */
.katex, .katex-html {
  white-space: nowrap !important;
  display: inline-block;
}
.katex-display {
  display: block;
  margin: 10px 0;
  text-align: center;
}

/* Options Grid */
.options-grid {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  margin-top: 24px;
}
.option-btn {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  padding: 18px 24px;
  text-align: left;
  font-size: 17px;
  color: var(--text-main);
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 16px;
}
.option-btn:hover {
  background: rgba(59, 130, 246, 0.18);
  border-color: var(--primary);
}
.option-btn.selected {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.28);
}
.option-btn.correct {
  background: rgba(16, 185, 129, 0.28) !important;
  border-color: var(--success) !important;
  color: #34d399;
}
.option-btn.wrong {
  background: rgba(239, 68, 68, 0.28) !important;
  border-color: var(--danger) !important;
  color: #f87171;
}

/* Feedback Box */
.feedback-box {
  margin-top: 24px;
  padding: 20px 24px;
  border-radius: var(--radius-md);
  font-size: 17px;
  line-height: 1.6;
  background: rgba(15, 23, 42, 0.8);
  border-left: 5px solid var(--primary);
}
.feedback-box.success-border {
  border-left-color: var(--success);
}
.feedback-box.danger-border {
  border-left-color: var(--danger);
}

/* User Pill */
.user-pill {
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid var(--card-border);
  padding: 6px 16px;
  border-radius: 20px;
  font-size: 15px;
  font-weight: 600;
}

/* Modal */
.modal-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0, 0, 0, 0.8);
  backdrop-filter: blur(10px);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  padding: 20px;
}
.modal-card {
  background: #1e293b;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-lg);
  width: 100%;
  max-width: 680px;
  max-height: 90vh;
  display: flex;
  flex-direction: column;
  box-shadow: var(--shadow-lg);
}
.modal-header {
  padding: 24px 28px;
  border-bottom: 1px solid var(--card-border);
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.modal-body {
  padding: 28px;
  overflow-y: auto;
}
.close-btn {
  background: none;
  border: none;
  font-size: 28px;
  color: var(--text-muted);
  cursor: pointer;
}

/* Teacher Dashboard */
.teacher-tabs {
  display: flex;
  gap: 12px;
  margin-bottom: 22px;
}
.tab-btn {
  flex: 1;
  padding: 12px;
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
  color: var(--text-muted);
  cursor: pointer;
  font-weight: 600;
  font-size: 15px;
}
.tab-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.table-scroll {
  max-height: 320px;
  overflow-y: auto;
  margin-top: 12px;
  border: 1px solid var(--card-border);
  border-radius: var(--radius-md);
}
.stats-table {
  width: 100%;
  border-collapse: collapse;
  font-size: 15px;
}
.stats-table th, .stats-table td {
  padding: 12px 16px;
  text-align: left;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}
.stats-table th {
  background: rgba(15, 23, 42, 0.85);
  color: var(--text-muted);
  position: sticky;
  top: 0;
}
