/* Sanfte Seitenübergänge zwischen den Navigationen */
@view-transition {
  navigation: auto;
}

:root {
  --bg: #0f172a;
  --surface: #1e293b;
  --surface-2: #334155;
  --primary: #6366f1;
  --primary-hover: #4f46e5;
  --text: #e2e8f0;
  --text-muted: #94a3b8;
  --success: #22c55e;
  --error: #ef4444;
  --radius: 12px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  background: var(--bg);
  color: var(--text);
  line-height: 1.5;
}

a {
  color: inherit;
  text-decoration: none;
}

h1 {
  margin-top: 0;
}

code {
  background: var(--surface-2);
  padding: 0.1em 0.4em;
  border-radius: 6px;
  font-size: 0.9em;
}

.error {
  color: var(--error);
}

/* ---------- Login ---------- */
.page-login {
  display: grid;
  place-items: center;
  min-height: 100vh;
  padding: 1rem;
}

.auth-card {
  background: var(--surface);
  padding: 2.5rem;
  border-radius: var(--radius);
  width: 100%;
  max-width: 360px;
  box-shadow: 0 20px 40px rgba(0, 0, 0, 0.3);
}

.auth-card h1 {
  margin: 0 0 0.25rem;
  text-align: center;
}

.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-top: 0;
}

#login-form {
  display: flex;
  flex-direction: column;
  gap: 1rem;
  margin-top: 1.5rem;
}

label {
  display: flex;
  flex-direction: column;
  gap: 0.35rem;
  font-size: 0.9rem;
  color: var(--text-muted);
}

input[type="text"],
input[type="password"] {
  padding: 0.6rem 0.75rem;
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  background: var(--bg);
  color: var(--text);
  font-size: 1rem;
}

input:focus {
  outline: 2px solid var(--primary);
  border-color: transparent;
}

button {
  cursor: pointer;
  font-size: 1rem;
  border: none;
  border-radius: 8px;
}

#login-form button,
.btn-primary {
  background: var(--primary);
  color: white;
  padding: 0.7rem;
  font-weight: 600;
  transition: background 0.15s;
}

#login-form button:hover,
.btn-primary:hover {
  background: var(--primary-hover);
}

.hint {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  margin-bottom: 0;
  margin-top: 1.5rem;
}

/* ---------- Topbar ---------- */
.topbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 1rem 1.5rem;
  background: var(--surface);
  border-bottom: 1px solid var(--surface-2);
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 1rem;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-ghost {
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--surface-2);
  padding: 0.4rem 0.8rem;
}

.btn-ghost:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ---------- Container ---------- */
.container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem;
}

/* Tool-Modus: breiterer Container ohne künstliche Maximalbreite */
.container-tool {
  padding: 1.5rem;
}

/* ---------- Persönliches Dashboard ---------- */
.db-layout {
  max-width: 900px;
  margin: 0 auto;
  padding: 2.5rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 2.5rem;
}

.db-hero {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 1.5rem;
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 2rem 2.5rem;
  flex-wrap: wrap;
}

.db-eyebrow {
  margin: 0 0 0.25rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-weight: 600;
}

.db-headline {
  margin: 0 0 0.25rem;
  font-size: 2rem;
}

.db-sub {
  margin: 0;
  color: var(--text-muted);
}

.btn-cta {
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
  background: var(--primary);
  color: white;
  padding: 0.85rem 1.75rem;
  border-radius: 10px;
  font-weight: 700;
  font-size: 1rem;
  white-space: nowrap;
  transition: background 0.15s, transform 0.15s;
}

.btn-cta:hover {
  background: var(--primary-hover);
  transform: translateY(-2px);
}

.btn-arrow {
  font-size: 1.1rem;
  transition: transform 0.15s;
}

.btn-cta:hover .btn-arrow {
  transform: translateX(3px);
}

/* Stats-Reihe */
.db-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 1rem;
}

.stat-card {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
}

.stat-icon {
  font-size: 1.5rem;
  margin-bottom: 0.25rem;
}

.stat-value {
  font-size: 1.75rem;
  font-weight: 700;
  color: var(--text);
}

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

/* Letzte Aktivität */
.db-section-title {
  margin: 0 0 1rem;
  font-size: 1rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

.db-recent-empty {
  background: var(--surface);
  border: 1px dashed var(--surface-2);
  border-radius: var(--radius);
  padding: 2.5rem;
  text-align: center;
  color: var(--text-muted);
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.db-recent-icon {
  font-size: 2.5rem;
}

.btn-ghost-sm {
  display: inline-block;
  background: transparent;
  color: var(--text-muted);
  border: 1px solid var(--surface-2);
  border-radius: 8px;
  padding: 0.4rem 1rem;
  font-size: 0.9rem;
  cursor: pointer;
  transition: color 0.15s, border-color 0.15s;
  text-decoration: none;
}

.btn-ghost-sm:hover {
  color: var(--text);
  border-color: var(--text-muted);
}

/* ---------- Fächerübersicht ---------- */
.page-sub {
  color: var(--text-muted);
  margin: -0.5rem 0 1.5rem;
}

/* ---------- Fach-Seite (Themen-Übersicht je Fach) ---------- */
.fach-seite-header {
  margin-bottom: 1.5rem;
}

.fach-eyebrow {
  margin: 0 0 0.2rem;
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.1em;
  color: var(--primary);
  font-weight: 600;
}

.fach-vollname {
  margin: 0 0 0.4rem;
  font-size: 1.75rem;
}

.fach-beschreibung {
  margin: 0;
  color: var(--text-muted);
}

/* Stats-Leiste: horizontale Reihe von Stat-Pillen */
.fach-stats-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 2rem;
  flex-wrap: wrap;
}

.stat-pill {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: 10px;
  padding: 0.75rem 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.15rem;
  min-width: 130px;
}

.stat-pill-label {
  font-size: 0.72rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.06em;
}

.stat-pill-value {
  font-size: 1.4rem;
  font-weight: 700;
  color: var(--text);
}

/* Überschrift über dem Themen-Grid */
.themen-titel {
  margin: 0 0 1rem;
  font-size: 0.85rem;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.08em;
  font-weight: 600;
}

/* Leer-Zustand wenn noch keine Themen vorhanden */
.empty-state {
  grid-column: 1 / -1;
  text-align: center;
  padding: 3.5rem 2rem;
  color: var(--text-muted);
  background: var(--surface);
  border: 1px dashed var(--surface-2);
  border-radius: var(--radius);
}

.empty-icon {
  font-size: 2.5rem;
  display: block;
  margin-bottom: 0.75rem;
}

/* Karten: Vollname als kleiner Untertitel unter dem Kürzel */
.card-vollname {
  display: block;
  font-size: 0.78rem;
  color: var(--text-muted);
  font-weight: 400;
  margin-bottom: 0.4rem;
  line-height: 1.3;
}

/* ---------- Fach-Karten ---------- */
.card-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(220px, 1fr));
  gap: 1.25rem;
}

.card {
  background: var(--surface);
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 1.5rem;
  transition: transform 0.15s, border-color 0.15s;
}

.card:hover {
  transform: translateY(-3px);
  border-color: var(--primary);
}

.card-icon {
  font-size: 2rem;
  display: block;
  margin-bottom: 0.5rem;
}

.card h2 {
  margin: 0 0 0.25rem;
  font-size: 1.2rem;
}

.card p {
  margin: 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

/* ---------- Tabs ---------- */
.tabs {
  display: flex;
  gap: 0.5rem;
  margin-bottom: 1.5rem;
  border-bottom: 1px solid var(--surface-2);
}

.tab {
  background: transparent;
  color: var(--text-muted);
  padding: 0.6rem 1.2rem;
  border-radius: 0;
  border-bottom: 2px solid transparent;
}

.tab.active {
  color: var(--text);
  border-bottom-color: var(--primary);
}

/* ---------- Theorie ---------- */
.theorie-block {
  background: var(--surface);
  border-radius: var(--radius);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1rem;
  border: 1px solid var(--surface-2);
}

.theorie-block h3 {
  margin-top: 0;
  color: var(--primary);
}

.theorie-block p {
  margin-bottom: 0;
}

/* ---------- Quiz ---------- */
.frage {
  border: 1px solid var(--surface-2);
  border-radius: var(--radius);
  padding: 1rem 1.25rem;
  margin: 0 0 1rem;
}

.frage legend {
  font-weight: 600;
  padding: 0 0.5rem;
}

.option {
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.5rem;
  padding: 0.35rem 0;
  color: var(--text);
  cursor: pointer;
}

.frage.correct {
  border-color: var(--success);
}

.frage.wrong {
  border-color: var(--error);
}

.quiz-result {
  margin-top: 1rem;
  font-weight: 600;
  font-size: 1.1rem;
}

/* ---------- Footer ---------- */
.site-footer {
  background: var(--surface);
  border-top: 1px solid var(--surface-2);
  padding: 1rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  color: var(--text-muted);
  font-size: 0.8rem;
  flex-wrap: wrap;
}

.footer-sep {
  opacity: 0.4;
}

.footer-link {
  color: var(--text-muted);
  text-decoration: none;
  transition: color 0.15s;
}

.footer-link:hover {
  color: var(--text);
}
