/* ==========================================================================
   DESIGN SYSTEM & VARIABLES
   ========================================================================== */
:root {
  /* Color Palette */
  --bg-main: #0b0f19;
  --bg-card: rgba(17, 24, 39, 0.6);
  --border-card: rgba(255, 255, 255, 0.06);
  --border-card-hover: rgba(59, 130, 246, 0.3);
  
  --primary-gradient: linear-gradient(135deg, #3b82f6 0%, #1d4ed8 100%);
  --primary-glow: rgba(59, 130, 246, 0.35);
  --success-gradient: linear-gradient(135deg, #10b981 0%, #047857 100%);
  --success-glow: rgba(16, 185, 129, 0.25);
  --danger-gradient: linear-gradient(135deg, #ef4444 0%, #b91c1c 100%);
  --danger-glow: rgba(239, 68, 68, 0.25);
  --warning-gradient: linear-gradient(135deg, #f59e0b 0%, #b45309 100%);
  
  --text-main: #f3f4f6;
  --text-muted: #9ca3af;
  --text-dark: #111827;
  
  --shadow-main: 0 8px 32px 0 rgba(0, 0, 0, 0.37);
  --shadow-glow: 0 0 20px rgba(59, 130, 246, 0.15);
  
  /* Fonts */
  --font-family: 'Inter', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
  
  /* Transitions */
  --transition-fast: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  --transition-normal: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

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

body {
  font-family: var(--font-family);
  background-color: var(--bg-main);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  overflow-x: hidden;
  position: relative;
  line-height: 1.6;
}

/* Background glowing orbs */
.bg-glow {
  position: fixed;
  width: 500px;
  height: 500px;
  border-radius: 50%;
  filter: blur(120px);
  z-index: -1;
  opacity: 0.15;
  pointer-events: none;
}

.bg-glow-1 {
  background: radial-gradient(circle, #3b82f6 0%, #1d4ed8 100%);
  top: -10%;
  left: -10%;
  animation: float-slow 20s infinite alternate;
}

.bg-glow-2 {
  background: radial-gradient(circle, #8b5cf6 0%, #6d28d9 100%);
  bottom: -10%;
  right: -10%;
  animation: float-slow 25s infinite alternate-reverse;
}

@keyframes float-slow {
  0% { transform: translate(0, 0) scale(1); }
  100% { transform: translate(60px, 40px) scale(1.1); }
}

/* Custom Scrollbar */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}
::-webkit-scrollbar-track {
  background: rgba(15, 23, 42, 0.5);
}
::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.1);
  border-radius: 4px;
}
::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.2);
}

/* ==========================================================================
   LAYOUT CONTAINERS
   ========================================================================== */
.app-container {
  width: 100%;
  max-width: 680px;
  padding: 20px;
  z-index: 10;
  transition: var(--transition-normal);
}

/* Premium Glassmorphism Card */
.view-card {
  background: var(--bg-card);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--border-card);
  border-radius: 24px;
  padding: 40px;
  box-shadow: var(--shadow-main);
  transition: var(--transition-normal);
  transform: translateY(0);
}

.view-card:hover {
  border-color: var(--border-card-hover);
  box-shadow: var(--shadow-main), var(--shadow-glow);
}

.view-card.xl-card {
  max-width: 1000px;
  width: 100%;
}

.view-card.hidden {
  display: none !important;
}

.app-container:has(.xl-card) {
  max-width: 1040px;
}

/* ==========================================================================
   TYPOGRAPHY & UTILITIES
   ========================================================================== */
.text-center { text-align: center; }
.mt-3 { margin-top: 1rem; }
.mt-4 { margin-top: 1.5rem; }
.mb-0 { margin-bottom: 0 !important; }
.mb-3 { margin-bottom: 1rem; }
.mb-4 { margin-bottom: 1.5rem; }
.text-truncate {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.block-center {
  display: block;
  margin-left: auto;
  margin-right: auto;
}

.main-title {
  font-size: 2.2rem;
  font-weight: 800;
  background: linear-gradient(135deg, #ffffff 30%, #a5b4fc 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  margin-bottom: 0.5rem;
  letter-spacing: -0.025em;
}

.subtitle {
  color: var(--text-muted);
  font-size: 1rem;
  font-weight: 500;
  margin-bottom: 1.5rem;
}

.info-text {
  font-size: 1rem;
  color: #d1d5db;
  margin-bottom: 2rem;
  font-weight: 400;
}

.badge {
  display: inline-block;
  padding: 6px 16px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  color: #93c5fd;
  font-size: 0.85rem;
  font-weight: 600;
  border-radius: 50px;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

/* ==========================================================================
   INPUTS, SELECTS & BUTTONS
   ========================================================================== */
.form-group {
  margin-bottom: 1.8rem;
  text-align: left;
}

.form-group label {
  display: block;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.5rem;
  color: #e5e7eb;
}

.input-wrapper {
  position: relative;
}

.input-icon {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  font-size: 1.1rem;
  transition: var(--transition-fast);
  z-index: 5;
}

input[type="text"],
input[type="password"] {
  width: 100%;
  padding: 14px 16px 14px 48px;
  background: rgba(15, 23, 42, 0.6);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 1rem;
  transition: var(--transition-normal);
}

input:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

input:focus + .input-icon {
  color: #3b82f6;
}

/* Advanced Custom Select Styling */
select {
  width: 100%;
  padding: 14px 40px 14px 48px;
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 12px;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 0.95rem;
  appearance: none;
  -webkit-appearance: none;
  -moz-appearance: none;
  cursor: pointer;
  transition: var(--transition-normal);
}

select:focus {
  outline: none;
  border-color: #3b82f6;
  background: rgba(15, 23, 42, 0.8);
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.2);
}

select option {
  background: #111827;
  color: var(--text-main);
  padding: 10px;
}

.select-wrapper {
  position: relative;
}

.select-wrapper::after {
  content: '\f078';
  font-family: 'Font Awesome 6 Free';
  font-weight: 900;
  position: absolute;
  right: 18px;
  top: 50%;
  transform: translateY(-50%);
  color: var(--text-muted);
  pointer-events: none;
  font-size: 0.9rem;
}

/* Buttons */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 14px 28px;
  font-size: 1rem;
  font-weight: 600;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: var(--font-family);
  transition: var(--transition-normal);
  text-decoration: none;
  position: relative;
  overflow: hidden;
}

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

.btn-primary:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.5);
}

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

.btn-success {
  background: var(--success-gradient);
  color: white;
  box-shadow: 0 4px 14px var(--success-glow);
}

.btn-success:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.btn-danger {
  background: var(--danger-gradient);
  color: white;
  box-shadow: 0 4px 14px var(--danger-glow);
}

.btn-danger:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(239, 68, 68, 0.4);
}

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

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.15);
  border-color: rgba(255, 255, 255, 0.2);
}

.btn-sm {
  padding: 10px 18px;
  font-size: 0.9rem;
  border-radius: 8px;
}

.btn-block {
  width: 100%;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none !important;
  box-shadow: none !important;
}

.btn-icon-right {
  margin-left: 10px;
}

.btn-icon-left {
  margin-right: 10px;
}

.btn-link {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  transition: var(--transition-fast);
  padding: 4px 8px;
  border-radius: 4px;
}

.btn-link:hover {
  color: #3b82f6;
}

/* Logo icon decorative container */
.logo-icon {
  width: 72px;
  height: 72px;
  background: rgba(59, 130, 246, 0.1);
  border: 2px solid rgba(59, 130, 246, 0.25);
  border-radius: 20px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 2.2rem;
  color: #60a5fa;
  margin-bottom: 1.5rem;
}

.logo-icon.success {
  background: rgba(16, 185, 129, 0.1);
  border-color: rgba(16, 185, 129, 0.25);
  color: #34d399;
}

/* ==========================================================================
   QUIZ SELECTION GRID & CARDS (NEW)
   ========================================================================== */
.quiz-grid {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 1.5rem;
}

/* Wrapper für aktuelle Quizze */
.quiz-section {
  display: flex;
  flex-direction: column;
  gap: 16px;
  margin-top: 1.5rem;
}

/* Akkordeon "Zur Wiederholung" */
.past-quiz-accordion {
  margin-top: 1.5rem;
  border: 1px solid rgba(139, 92, 246, 0.2);
  border-radius: 18px;
  overflow: hidden;
  background: rgba(139, 92, 246, 0.03);
}

.past-quiz-accordion-header {
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 24px;
  background: transparent;
  border: none;
  color: var(--text-main);
  font-family: var(--font-family);
  font-size: 1rem;
  font-weight: 700;
  cursor: pointer;
  text-align: left;
  transition: var(--transition-normal);
  letter-spacing: -0.01em;
}

.past-quiz-accordion-header:hover {
  background: rgba(139, 92, 246, 0.07);
}

.past-quiz-count {
  display: inline-flex;
  align-items: center;
  margin-left: 10px;
  padding: 2px 9px;
  background: rgba(139, 92, 246, 0.15);
  border: 1px solid rgba(139, 92, 246, 0.25);
  color: #c4b5fd;
  font-size: 0.78rem;
  font-weight: 700;
  border-radius: 50px;
  vertical-align: middle;
}

.accordion-icon {
  color: var(--text-muted);
  transition: transform 0.3s ease;
  flex-shrink: 0;
}

.past-quiz-accordion-header.open .accordion-icon {
  transform: rotate(180deg);
}

.past-quiz-accordion-body {
  overflow: hidden;
  max-height: 0;
  transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
              padding 0.3s ease;
  padding: 0 16px;
}

.past-quiz-accordion-body[aria-hidden="false"] {
  max-height: 10000px;
  padding: 0 16px 16px;
}

.past-grid {
  margin-top: 8px;
}

/* Leichte optische Trennung für Past-Quiz-Cards */
.past-grid .quiz-card {
  border-color: rgba(139, 92, 246, 0.12);
}

.past-grid .quiz-card:hover {
  border-color: rgba(139, 92, 246, 0.45);
  box-shadow: 0 10px 25px rgba(139, 92, 246, 0.15);
}


.quiz-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 18px;
  padding: 24px;
  cursor: pointer;
  transition: var(--transition-normal);
  display: flex;
  flex-direction: column;
  text-align: left;
  position: relative;
  overflow: hidden;
}

.quiz-card:hover {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(59, 130, 246, 0.5);
  transform: translateY(-4px);
  box-shadow: 0 10px 25px rgba(59, 130, 246, 0.15);
}

.quiz-card-title {
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
  margin-bottom: 8px;
  line-height: 1.4;
  padding-right: 60px; /* Space for the score/badge */
}

.quiz-card-desc {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
  margin-bottom: 20px;
  flex-grow: 1;
}

.quiz-card-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-top: 1px solid rgba(255, 255, 255, 0.05);
  padding-top: 14px;
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 500;
}

.quiz-card-meta i {
  color: #60a5fa;
  margin-right: 6px;
}

.quiz-status-badge {
  position: absolute;
  top: 24px;
  right: 24px;
  font-size: 0.8rem;
  font-weight: 700;
  padding: 4px 10px;
  border-radius: 6px;
  text-transform: uppercase;
}

.quiz-status-badge.completed {
  background: rgba(16, 185, 129, 0.1);
  border: 1px solid rgba(16, 185, 129, 0.2);
  color: #34d399;
}

.quiz-status-badge.pending {
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.1);
  color: var(--text-muted);
}

/* ==========================================================================
   QUIZ SUB-ELEMENTS
   ========================================================================== */
.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1.5rem;
}

.section-indicator {
  font-size: 0.85rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: #818cf8;
  max-width: 70%;
  text-align: left;
}

.quiz-meta {
  font-size: 0.9rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 12px;
}

.points-badge {
  background: rgba(245, 158, 11, 0.1);
  border: 1px solid rgba(245, 158, 11, 0.2);
  color: #fbbf24;
  padding: 2px 8px;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: 6px;
}

/* Progress bar container and fill */
.progress-bar-container {
  height: 6px;
  width: 100%;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  margin-bottom: 2.5rem;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 100%);
  border-radius: 10px;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  box-shadow: 0 0 10px rgba(139, 92, 246, 0.5);
}

/* Question box style */
.question-container {
  margin-bottom: 2rem;
  text-align: left;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: var(--text-main);
  line-height: 1.6;
}

/* Mathematische Formeln immer in einer Zeile halten (keine Umbrüche mitten im Term) */
.katex, 
.katex-html,
.katex .base,
.katex .mrel,
.katex .mbin,
.katex .mord,
.katex .mopen,
.katex .mclose,
.katex .mpunct {
  white-space: nowrap !important;
}

.katex-html {
  display: inline-block !important;
  white-space: nowrap !important;
}

.katex-display {
  margin: 0.8em 0 !important;
  white-space: normal !important;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}

.question-text .katex {
  white-space: nowrap !important;
  display: inline-block;
  vertical-align: middle;
}

.option-text .katex {
  white-space: nowrap !important;
  display: inline-block;
  vertical-align: middle;
}

.review-answers .katex,
.feedback-message .katex {
  white-space: nowrap !important;
  display: inline-block;
  vertical-align: middle;
}

/* Interactive Answer Options styling */
.options-container {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-bottom: 2rem;
}

.option-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 14px;
  padding: 16px 20px;
  display: flex;
  align-items: center;
  cursor: pointer;
  transition: var(--transition-fast);
  text-align: left;
}

.option-card:hover:not(.disabled) {
  background: rgba(255, 255, 255, 0.05);
  border-color: rgba(59, 130, 246, 0.4);
  transform: translateX(4px);
}

.option-card.selected {
  background: rgba(59, 130, 246, 0.08);
  border-color: #3b82f6;
  box-shadow: 0 0 12px rgba(59, 130, 246, 0.2);
}

.option-indicator {
  width: 22px;
  height: 22px;
  border-radius: 6px;
  border: 2px solid rgba(255, 255, 255, 0.2);
  margin-right: 16px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: var(--transition-fast);
  color: white;
  font-size: 0.8rem;
}

/* Single choice uses circles, multiple choice uses rounded squares */
.option-card.single-choice .option-indicator {
  border-radius: 50%;
}

.option-card.selected .option-indicator {
  background: #3b82f6;
  border-color: #3b82f6;
}

.option-text {
  font-size: 1rem;
  font-weight: 500;
  color: #e5e7eb;
  flex-grow: 1;
}

/* Validation states (right / wrong) */
.option-card.correct {
  background: rgba(16, 185, 129, 0.1);
  border-color: #10b981;
  box-shadow: 0 0 12px rgba(16, 185, 129, 0.2);
}

.option-card.correct .option-indicator {
  background: #10b981;
  border-color: #10b981;
}

.option-card.wrong {
  background: rgba(239, 68, 68, 0.08);
  border-color: #ef4444;
}

.option-card.wrong .option-indicator {
  background: #ef4444;
  border-color: #ef4444;
}

.option-card.disabled {
  cursor: not-allowed;
}

/* Live Feedback Panel */
.live-feedback-box {
  border-radius: 14px;
  padding: 18px 22px;
  margin-top: 1.5rem;
  text-align: left;
  animation: slide-in 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.live-feedback-box.correct {
  background: rgba(16, 185, 129, 0.08);
  border: 1px solid rgba(16, 185, 129, 0.15);
  color: #a7f3d0;
}

.live-feedback-box.wrong {
  background: rgba(239, 68, 68, 0.06);
  border: 1px solid rgba(239, 68, 68, 0.15);
  color: #fecaca;
}

.feedback-header {
  font-weight: 700;
  font-size: 1.05rem;
  margin-bottom: 0.4rem;
  display: flex;
  align-items: center;
  gap: 8px;
}

.feedback-message {
  font-size: 0.95rem;
  line-height: 1.5;
}

@keyframes slide-in {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

.quiz-actions {
  display: flex;
  gap: 12px;
  align-items: center;
  justify-content: space-between;
}

/* ==========================================================================
   RESULT & CIRCLE PROGRESS
   ========================================================================== */
.score-circle-container {
  display: flex;
  justify-content: center;
  align-items: center;
  margin: 2.5rem 0;
}

.score-circle {
  position: relative;
  width: 180px;
  height: 180px;
}

.score-svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.score-track {
  fill: none;
  stroke: rgba(255, 255, 255, 0.05);
  stroke-width: 8px;
}

.score-fill {
  fill: none;
  stroke: #3b82f6;
  stroke-width: 8px;
  stroke-linecap: round;
  transition: stroke-dashoffset 1s ease-out;
}

.score-values {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  display: flex;
  flex-direction: column;
  align-items: center;
}

.score-percentage {
  font-size: 2.2rem;
  font-weight: 800;
  color: white;
}

.score-points {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-weight: 600;
  margin-top: -2px;
}

.result-message {
  font-size: 1.1rem;
  font-weight: 500;
  color: #e5e7eb;
  margin-bottom: 2.5rem;
  padding: 0 10px;
}

.card-footer-actions {
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 1.8rem;
  margin-top: 1rem;
}

/* Detailed review list accordion */
.review-section {
  text-align: left;
  border-top: 1px solid rgba(255, 255, 255, 0.08);
  padding-top: 2rem;
  margin-top: 2rem;
}

.review-title {
  font-size: 1.15rem;
  font-weight: 700;
  margin-bottom: 1.2rem;
  color: white;
  display: flex;
  align-items: center;
  gap: 10px;
}

.review-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.review-item {
  border-radius: 14px;
  padding: 18px;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
}

.review-item.correct {
  border-left: 4px solid #10b981;
}

.review-item.wrong {
  border-left: 4px solid #ef4444;
}

.review-item-header {
  font-size: 0.95rem;
  font-weight: 700;
  display: flex;
  justify-content: space-between;
  margin-bottom: 0.6rem;
  gap: 15px;
}

.review-badge {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 2px 8px;
  border-radius: 4px;
  text-transform: uppercase;
}

.review-badge.correct {
  background: rgba(16, 185, 129, 0.1);
  color: #34d399;
}

.review-badge.wrong {
  background: rgba(239, 68, 68, 0.1);
  color: #fca5a5;
}

.review-question {
  font-size: 1rem;
  font-weight: 600;
  margin-bottom: 0.8rem;
  color: #e5e7eb;
}

.review-answers {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 8px;
  padding: 10px 14px;
  margin-bottom: 0.8rem;
  font-size: 0.9rem;
}

.review-ans-row {
  margin-bottom: 4px;
}
.review-ans-row:last-child {
  margin-bottom: 0;
}

.review-explain {
  font-size: 0.9rem;
  color: var(--text-muted);
  line-height: 1.5;
}

/* ==========================================================================
   TEACHER DASHBOARD
   ========================================================================== */
.teacher-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  padding-bottom: 1.8rem;
  margin-bottom: 2rem;
  text-align: left;
}

.header-icon-left {
  margin-right: 12px;
  color: #3b82f6;
}

.teacher-header-actions {
  display: flex;
  gap: 10px;
}

/* Stats Cards */
.stats-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(210px, 1fr));
  gap: 16px;
  margin-bottom: 2.2rem;
}

.stat-card {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  border-radius: 16px;
  padding: 18px 22px;
  display: flex;
  align-items: center;
  gap: 16px;
  text-align: left;
}

.stat-icon {
  width: 48px;
  height: 48px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 12px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.25rem;
  color: #60a5fa;
  flex-shrink: 0;
}

.stat-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

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

.stat-value {
  font-size: 1.25rem;
  font-weight: 800;
  color: white;
  margin-top: 2px;
}

.dashboard-filter-panel {
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.06);
  padding: 20px 24px;
  border-radius: 16px;
  display: flex;
  justify-content: flex-start;
  align-items: center;
}

/* Teacher Data Table */
.table-container {
  overflow-x: auto;
  border-radius: 16px;
  border: 1px solid rgba(255, 255, 255, 0.08);
  background: rgba(0, 0, 0, 0.15);
}

.teacher-table {
  width: 100%;
  border-collapse: collapse;
  text-align: left;
  font-size: 0.95rem;
}

.teacher-table th {
  background: rgba(255, 255, 255, 0.03);
  padding: 16px 20px;
  font-weight: 700;
  color: var(--text-muted);
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.teacher-table td {
  padding: 16px 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
  color: #e5e7eb;
}

.teacher-table tr:last-child td {
  border-bottom: none;
}

.teacher-table tr:hover td {
  background: rgba(255, 255, 255, 0.01);
}

.empty-row td {
  padding: 30px;
  color: var(--text-muted);
}

/* ==========================================================================
   MODAL DIALOGS
   ========================================================================== */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(11, 15, 25, 0.8);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
  animation: fade-in 0.25s ease-out;
}

.modal-overlay.hidden {
  display: none !important;
}

.modal-card {
  background: rgba(22, 28, 45, 0.95);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 20px;
  width: 100%;
  max-width: 440px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.5);
  overflow: hidden;
  animation: scale-up 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.modal-card.modal-lg {
  max-width: 680px;
}

.modal-header {
  padding: 20px 24px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  display: flex;
  justify-content: space-between;
  align-items: center;
  text-align: left;
}

.modal-header h3 {
  font-size: 1.15rem;
  font-weight: 700;
  color: white;
}

.modal-close-btn {
  background: none;
  border: none;
  font-size: 1.7rem;
  color: var(--text-muted);
  cursor: pointer;
  transition: var(--transition-fast);
  line-height: 1;
}

.modal-close-btn:hover {
  color: white;
}

.modal-body {
  padding: 24px;
  text-align: left;
}

.modal-text {
  color: #d1d5db;
  font-size: 0.95rem;
}

.max-h-drawer {
  max-height: 70vh;
  overflow-y: auto;
}

.error-text {
  color: #f87171;
  font-size: 0.85rem;
  font-weight: 600;
  margin-top: 8px;
}

.hidden {
  display: none !important;
}

/* Detail panel statistics */
.detail-student-meta {
  display: flex;
  justify-content: space-between;
  font-size: 0.95rem;
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.02);
  border: 1px solid rgba(255, 255, 255, 0.05);
  padding: 12px 18px;
  border-radius: 10px;
}

.detail-student-meta i {
  color: #3b82f6;
  margin-right: 4px;
}

.detail-modal-content {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

@keyframes fade-in {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* ==========================================================================
   RESPONSIVE DESIGN BREAKPOINTS
   ========================================================================== */
@media (max-width: 640px) {
  .view-card {
    padding: 24px 20px;
  }
  
  .main-title {
    font-size: 1.75rem;
  }
  
  .quiz-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 8px;
  }
  
  .quiz-meta {
    align-self: flex-end;
  }
  
  .progress-bar-container {
    margin-bottom: 1.5rem;
  }
  
  .teacher-header {
    flex-direction: column;
    align-items: flex-start;
    gap: 16px;
  }
  
  .teacher-header-actions {
    width: 100%;
    justify-content: flex-start;
  }
  
  .stats-grid {
    grid-template-columns: 1fr;
  }
  
  .dashboard-filter-panel {
    padding: 16px;
  }
}

/* KaTeX custom sizing styles inside cards */
.katex-display {
  margin: 0.6em 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 4px 0;
}
.katex {
  font-size: 1.05em;
}


/* ==========================================================================
   TEACHER TABS & FREIGABEN-STEUERUNG (NEU IN Q1)
   ========================================================================== */
.teacher-tabs {
  display: flex;
  gap: 12px;
  background: rgba(15, 23, 42, 0.6);
  padding: 6px;
  border-radius: 14px;
  border: 1px solid var(--border-card);
  margin-bottom: 24px;
}

.tab-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  padding: 12px 18px;
  background: transparent;
  border: none;
  border-radius: 10px;
  color: var(--text-muted);
  font-family: var(--font-family);
  font-size: 0.95rem;
  font-weight: 600;
  cursor: pointer;
  transition: var(--transition-fast);
}

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

.tab-btn.active {
  background: var(--primary-gradient);
  color: #ffffff;
  box-shadow: 0 4px 14px var(--primary-glow);
}

.teacher-tab-content.hidden {
  display: none !important;
}

/* Info Banner for Unlocks */
.unlock-info-banner {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 16px;
  padding: 18px 22px;
  background: rgba(59, 130, 246, 0.08);
  border: 1px solid rgba(59, 130, 246, 0.25);
  border-radius: 16px;
}

.unlock-info-banner h4 {
  font-size: 1rem;
  color: #60a5fa;
  margin-bottom: 4px;
}

.unlock-info-banner p {
  font-size: 0.88rem;
  color: var(--text-muted);
  max-width: 540px;
  line-height: 1.4;
}

.unlock-quick-actions {
  display: flex;
  gap: 10px;
}

/* Unlocks Quiz Grid */
.unlock-quiz-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(310px, 1fr));
  gap: 16px;
}

.unlock-quiz-card {
  background: rgba(17, 24, 39, 0.7);
  border: 1px solid var(--border-card);
  border-radius: 16px;
  padding: 18px 20px;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  gap: 14px;
  transition: var(--transition-normal);
}

.unlock-quiz-card.is-unlocked {
  border-color: rgba(16, 185, 129, 0.35);
  background: rgba(16, 185, 129, 0.04);
}

.unlock-card-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 12px;
}

.unlock-card-title {
  font-size: 1.02rem;
  font-weight: 700;
  color: var(--text-main);
  line-height: 1.35;
}

.unlock-card-desc {
  font-size: 0.85rem;
  color: var(--text-muted);
  line-height: 1.45;
  margin-top: 6px;
}

.unlock-card-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-top: 12px;
  border-top: 1px solid rgba(255, 255, 255, 0.06);
}

.unlock-meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  display: flex;
  gap: 12px;
}

/* iOS-Style Toggle Switch */
.switch {
  position: relative;
  display: inline-block;
  width: 52px;
  height: 28px;
  flex-shrink: 0;
}

.switch input {
  opacity: 0;
  width: 0;
  height: 0;
}

.slider {
  position: absolute;
  cursor: pointer;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background-color: rgba(255, 255, 255, 0.15);
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 34px;
}

.slider:before {
  position: absolute;
  content: "";
  height: 20px;
  width: 20px;
  left: 4px;
  bottom: 4px;
  background-color: white;
  transition: .3s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 50%;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.3);
}

input:checked + .slider {
  background: var(--success-gradient);
  box-shadow: 0 0 12px var(--success-glow);
}

input:checked + .slider:before {
  transform: translateX(24px);
}

/* Sync Indicator */
.sync-indicator {
  font-size: 0.85rem;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
  transition: var(--transition-fast);
}

.sync-indicator.syncing {
  color: #60a5fa;
}

.sync-indicator.syncing i {
  animation: fa-spin 1s infinite linear;
}

.sync-indicator.success {
  color: #34d399;
}

.sync-indicator.error {
  color: #f87171;
}

/* Status Badges */
.status-pill {
  font-size: 0.75rem;
  font-weight: 700;
  padding: 3px 9px;
  border-radius: 12px;
  text-transform: uppercase;
  letter-spacing: 0.04em;
}

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

.status-pill.locked {
  background: rgba(255, 255, 255, 0.05);
  color: var(--text-muted);
  border: 1px solid rgba(255, 255, 255, 0.1);
}