/* =========================================================
   GLOBAL DESIGN & COLORS
   ========================================================= */

* {
  box-sizing: border-box;
}

:root {
  --bg: #020617;
  --bg-elevated: rgba(15, 23, 42, 0.95);
  --bg-soft: rgba(15, 23, 42, 0.85);
  --border-subtle: #1f2937;

  --accent: #38bdf8;
  --accent2: #a855f7;

  --success: #22c55e;
  --danger: #ef4444;
  --warning: #eab308;

  --text-main: #e5e7eb;
  --text-muted: #9ca3af;
}

/* =========================================================
   BODY – FULL PAGE CENTERING
   ========================================================= */

body {
  margin: 0;
  min-height: 100vh;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--text-main);

  background:
    radial-gradient(circle at top left, #0ea5e9 0, transparent 45%),
    radial-gradient(circle at bottom right, #22c55e 0, transparent 50%),
    var(--bg);

  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 40px 16px;
}

/* =========================================================
   APP SHELL – CENTERED CONTAINER
   ========================================================= */

.app-shell {
  width: 100%;
  max-width: 1100px;
  margin: 0 auto;
  padding: 0 20px 40px;
}

/* =========================================================
   TOPBAR
   ========================================================= */

.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.topbar-left h1 {
  margin: 0;
  font-size: 1.9rem;
  font-weight: 700;

  background: linear-gradient(90deg, #38bdf8, #a855f7);
  -webkit-background-clip: text;
  color: transparent;
}

.topbar-left p {
  margin: 4px 0 0;
  color: var(--text-muted);
}

.topbar-right {
  display: flex;
  gap: 8px;
}

.pill {
  padding: 6px 12px;
  border-radius: 999px;
  font-size: .8rem;
  border: 1px solid rgba(255, 255, 255, 0.25);
  background: rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(10px);
}

.pill-questions { border-color: var(--accent); }
.pill-answered { border-color: var(--accent2); }

/* =========================================================
   MAIN LAYOUT – CENTERED GRID
   ========================================================= */

.app-main {
  display: grid;
  grid-template-columns: 1fr 2.2fr;
  gap: 24px;
  justify-content: center;
  align-items: flex-start;
}

/* =========================================================
   SIDEBAR – CENTERED STATS PANEL
   ========================================================= */

.sidebar {
  background: var(--bg-soft);
  border-radius: 20px;
  padding: 20px;
  border: 1px solid rgba(148, 163, 184, 0.3);
  text-align: center;
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.9);
  backdrop-filter: blur(16px);
}

.sidebar h2 {
  margin: 0 0 10px;
  font-size: 1rem;
  letter-spacing: .05em;
  text-transform: uppercase;
  color: var(--text-muted);
}


.progress-ring {
  display: flex;
  justify-content: center;
  margin: 12px 0;
}

.progress-circle {
  width: 110px; height: 110px;
  border-radius: 999px;
  border: 6px solid rgba(148, 163, 184, 0.4);
  display: flex;
  justify-content: center;
  align-items: center;

  background: conic-gradient(
    #38bdf8,
    #a855f7,
    #22c55e,
    #38bdf8
  );
  padding: 4px;
}

.progress-circle-inner {
  width: 100%; height: 100%;
  border-radius: 999px;
  background: radial-gradient(circle at top, #1e293b, #020617 55%);
  display: flex;
  align-items: center;
  justify-content: center;
}

.progress-circle-inner span {
  font-size: 1.1rem;
  font-weight: 600;
}


.sidebar-stat {
  display: flex;
  justify-content: space-between;
  margin: 6px 0;
  font-size: .9rem;
}

.sidebar-stat span { color: var(--text-muted); }


.sidebar-legend {
  margin-top: 14px;
  padding-top: 8px;
  border-top: 1px dashed rgba(148, 163, 184, 0.3);
  font-size: .8rem;
  color: var(--text-muted);
}

.legend-item {
  display: flex;
  justify-content: center;
  gap: 6px;
  margin-bottom: 4px;
}

/* =========================================================
   BADGES
   ========================================================= */

.badge {
  padding: 2px 10px;
  border-radius: 999px;
  border: 1px solid;
  font-size: .7rem;
  text-transform: uppercase;
  letter-spacing: .1em;
}

.badge-testfragen {
  border-color: var(--accent);
  background: rgba(56, 189, 248, .15);
  color: #e0f2fe;
}

.badge-uebungen {
  border-color: var(--accent2);
  background: rgba(168, 85, 247, .15);
  color: #f3e8ff;
}

/* =========================================================
   CONTENT AREA – CENTERED CARDS
   ========================================================= */

.content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 26px;
}

.card {
  width: 100%;
  max-width: 780px;
  background: var(--bg-elevated);
  border-radius: 22px;
  padding: 26px 24px 32px;
  border: 1px solid rgba(148, 163, 184, 0.35);
  box-shadow: 0 18px 45px rgba(15, 23, 42, 0.7);
  backdrop-filter: blur(14px);
}

/* =========================================================
   QUESTION CARD HEADER
   ========================================================= */

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
}

.question-number-label {
  font-size: .9rem;
  color: var(--text-muted);
}


.linear-progress {
  width: 160px;
  height: 10px;
  border-radius: 999px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(148,163,184,0.4);
  overflow: hidden;
}

.linear-progress-fill {
  height: 100%;
  width: 0%;
  transition: width .25s ease-out;
  background: linear-gradient(90deg, #38bdf8, #a855f7, #22c55e);
}

/* =========================================================
   QUESTION BODY
   ========================================================= */

.question-text {
  font-size: 1.05rem;
  line-height: 1.5;
  margin-bottom: 16px;
}

.question-text code,
.answer-content code {
  font-family: "Fira Code", monospace;
  background: #0f172a;
  padding: 2px 5px;
  border-radius: 4px;
  border: 1px solid #1f2937;
}

/* =========================================================
   BUTTONS (MODERN)
   ========================================================= */

.btn {
  padding: 8px 16px;
  border-radius: 999px;
  cursor: pointer;
  border: 1px solid var(--accent);
  background: rgba(15, 23, 42, .9);
  color: var(--text-main);
  font-size: .9rem;
  transition: 0.2s;
}

.btn:hover:not(:disabled) {
  background: linear-gradient(120deg, #38bdf8, #a855f7);
  color: #fff;
  border-color: transparent;
  transform: translateY(-2px);
  box-shadow: 0 10px 20px rgba(56,189,248,0.3);
}

.btn:disabled {
  opacity: 0.4;
  cursor: default;
}

.btn.small {
  padding: 6px 12px;
  font-size: 0.8rem;
}


.btn.success { border-color: var(--success); }
.btn.success:hover { background: linear-gradient(120deg, #22c55e,#4ade80); }

.btn.danger { border-color: var(--danger); }
.btn.danger:hover { background: linear-gradient(120deg, #ef4444,#f97316); }

.btn.ghost { border-color: rgba(255,255,255,0.3); }
.btn.ghost:hover { background: rgba(255,255,255,0.1); }

.btn.outline {
  border-color: rgba(255,255,255,0.45);
  background: transparent;
}

/* =========================================================
   ANSWER PANEL
   ========================================================= */

.answer-panel {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px dashed rgba(148,163,184,0.4);
}

.answer-panel h2 {
  color: #c4b5fd;
  margin: 0 0 8px;
}

.answer-content {
  font-size: .95rem;
  margin-bottom: 12px;
}

/* =========================================================
   SUMMARY SCREEN
   ========================================================= */

.summary-card h2 {
  font-size: 1.1rem;
  margin-bottom: 6px;
}

.summary-bar-bg {
  width: 100%;
  height: 24px;
  border-radius: 12px;
  background: rgba(255,255,255,0.1);
  border: 1px solid rgba(148,163,184,0.3);
  overflow: hidden;
  margin: 10px 0;
}

.summary-bar-fill {
  height: 100%;
  transition: width .3s;
}

.grade-good { background: linear-gradient(90deg, #22c55e,#4ade80); }
.grade-ok   { background: linear-gradient(90deg, #eab308,#facc15); }
.grade-bad  { background: linear-gradient(90deg, #ef4444,#f97316); }

.summary-bar-label {
  text-align: right;
  font-size: 0.85rem;
  margin-top: 4px;
}

.summary-stats {
  font-size: .9rem;
  list-style: none;
  padding-left: 0;
}

.summary-stats li {
  display: flex;
  justify-content: space-between;
  padding: 4px 0;
}

.summary-hint {
  margin-top: 8px;
  color: var(--text-muted);
  font-size: .8rem;
}

/* =========================================================
   ANSWERMODUS, MC & FREITEXT
   ========================================================= */

.answer-mode {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 10px;
  font-size: 0.85rem;
  color: var(--text-muted);
}

.answer-mode-buttons {
  display: flex;
  gap: 6px;
}


.mc-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 10px;
}

.choice-btn {
  width: 100%;
  text-align: left;
  justify-content: flex-start;
}

.choice-correct {
  border-color: var(--success);
  background: rgba(34, 197, 94, 0.15);
}

.choice-wrong {
  border-color: var(--danger);
  background: rgba(239, 68, 68, 0.18);
}


.text-container {
  margin-bottom: 10px;
}

.text-container label {
  display: block;
  font-size: 0.85rem;
  color: var(--text-muted);
  margin-bottom: 4px;
}

#text-answer-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.5);
  background: rgba(15, 23, 42, 0.8);
  color: var(--text-main);
  font-size: 0.9rem;
  outline: none;
  margin-bottom: 6px;
}

#text-answer-input:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 1px rgba(56, 189, 248, 0.4);
}

.text-answer-feedback {
  font-size: 0.85rem;
  min-height: 1.2em;
}

.text-feedback-ok {
  color: var(--success);
}

.text-feedback-bad {
  color: var(--danger);
}

.text-feedback-warn {
  color: var(--warning);
}

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


.card-footer {
  margin-top: 20px;
  display: flex;
  flex-wrap: wrap;
  flex-direction: column;
  gap: 12px;
  align-items: center;
}

.nav-buttons {
  display: flex;
  gap: 14px;
  justify-content: center;
}


.hidden { display: none; }

/* =========================================================
   RESPONSIVE LAYOUT
   ========================================================= */

@media (max-width: 900px) {
  .app-main {
    grid-template-columns: 1fr;
  }

  .sidebar {
    order: 2;
    margin-top: 20px;
  }

  .content {
    order: 1;
  }
}

@media (max-width: 600px) {
  .topbar {
    flex-direction: column;
    align-items: flex-start;
  }

  .self-eval-buttons {
    flex-direction: column;
  }

  .nav-buttons {
    flex-direction: column;
  }

  .card {
    padding: 20px 16px 24px;
  }

  .answer-mode {
    flex-direction: column;
    align-items: flex-start;
  }

  .answer-mode-buttons .btn {
    flex: 1;
    text-align: center;
  }
}
