/* ============================================================
   FK-Trainer — Design-Tokens (Rot/Weiß)
   ============================================================ */
:root{
  --white:      #FFFFFF;
  --off-white:  #F6F5F3;
  --red:        #C8102E;
  --red-dark:   #96001F;
  --red-tint:   #FBE9EA;
  --black:      #1B1B1B;
  --gray:       #6E6E6E;
  --line:       #E4E1DC;
  --correct:    #1E7A34;
  --correct-lt: #E7F3EA;
  --wrong:      var(--red);
  --wrong-lt:   var(--red-tint);
  --card-shadow: 0 14px 32px -18px rgba(27,27,27,0.28);

  --font-display: 'Archivo', 'Arial Narrow', sans-serif;
  --font-body: 'Source Sans 3', 'Segoe UI', sans-serif;
  --font-mono: 'IBM Plex Mono', 'Courier New', monospace;
}

*{ box-sizing: border-box; }

/* [hidden] muss IMMER gewinnen – sonst überschreiben Klassen mit eigenem
   display (z. B. display:flex) das hidden-Attribut und Elemente bleiben
   trotz hidden sichtbar. */
[hidden]{ display: none !important; }

html, body{
  margin:0;
  padding:0;
  background: var(--off-white);
  color: var(--black);
  font-family: var(--font-body);
  min-height:100vh;
}

h1, h2, h3{
  font-family: var(--font-display);
  font-weight: 800;
  margin:0;
  letter-spacing: 0.01em;
}

button{ font-family: inherit; }

/* ============================================================
   Header
   ============================================================ */
.app-header{
  display:flex;
  flex-wrap:wrap;
  align-items:flex-end;
  justify-content:space-between;
  gap: 1.25rem;
  padding: 1.75rem clamp(1rem, 4vw, 3rem) 1.25rem;
  background: var(--white);
  border-bottom: 4px solid var(--red);
}

.app-header__eyebrow{
  display:block;
  font-family: var(--font-mono);
  font-size: 0.72rem;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gray);
  margin-bottom: 0.35rem;
}

.app-header h1{
  font-size: clamp(1.7rem, 3vw, 2.2rem);
  color: var(--black);
  text-transform: uppercase;
}

.app-header__mark{
  color: var(--red);
}

.tabs{
  display:flex;
  gap: 0.4rem;
  flex-wrap: wrap;
}

.tab{
  background: var(--white);
  border: 1.5px solid var(--line);
  color: var(--black);
  padding: 0.55rem 1.1rem;
  border-radius: 999px;
  font-size: 0.88rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}

.tab:hover{ border-color: var(--red); color: var(--red); }

.tab.is-active{
  background: var(--red);
  border-color: var(--red);
  color: var(--white);
}

.tab:focus-visible, button:focus-visible, input:focus-visible, textarea:focus-visible{
  outline: 2px solid var(--red-dark);
  outline-offset: 2px;
}

/* ============================================================
   Drawers — Fächer-Übersicht (Signature-Element)
   ============================================================ */
.drawers{
  padding: 1.25rem clamp(1rem, 4vw, 3rem) 0;
}

.drawers__row{
  display:flex;
  gap: 0.6rem;
  overflow-x:auto;
  padding-bottom: 0.4rem;
}

.drawer{
  flex: 1 0 auto;
  min-width: 92px;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 3px;
  padding: 0.6rem 0.7rem;
  text-align:center;
  box-shadow: var(--card-shadow);
  transition: transform 0.2s ease, border-color 0.2s ease;
}

.drawer__label{
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--gray);
  display:block;
  margin-bottom: 0.3rem;
}

.drawer__count{
  font-family: var(--font-mono);
  font-size: 1.35rem;
  font-weight: 600;
  color: var(--black);
}

.drawer.is-pulse{
  transform: translateY(-3px);
  box-shadow: 0 0 0 2px rgba(0,0,0,0.12), var(--card-shadow);
}

/* ============================================================
   Main / Panels
   ============================================================ */
main{
  padding: 1.75rem clamp(1rem, 4vw, 3rem) 3rem;
  max-width: 760px;
  margin: 0 auto;
}

.panel{ display:none; }
.panel.is-active{ display:block; }

/* ============================================================
   Karte
   ============================================================ */
.card-stage{
  display:flex;
  justify-content:center;
}

.card{
  width:100%;
  max-width: 560px;
  background: var(--white);
  color: var(--black);
  border-radius: 4px;
  box-shadow: var(--card-shadow);
  position: relative;
  border: 1px solid var(--line);
}

.card__tab{
  position:absolute;
  top: -0.9rem;
  left: 1.5rem;
  background: var(--red);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.85rem;
  border-radius: 3px;
  box-shadow: 0 4px 10px -4px rgba(0,0,0,0.35);
}

.card__body{
  padding: 2.25rem 1.75rem 1rem;
  min-height: 220px;
}

.card__label{
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.12em;
  text-transform: uppercase;
  color: var(--gray);
  margin: 0 0 0.4rem;
}

.card__question{
  font-size: 1.2rem;
  line-height: 1.6;
  margin: 0;
  font-weight: 600;
}

.card__answer{ margin-top: 1.4rem; }

.card__rule{
  border-top: 1px dashed var(--line);
  margin-bottom: 1rem;
}

.card__answer-text{
  font-size: 1.05rem;
  line-height: 1.6;
  margin:0;
}

.card__actions{
  padding: 1rem 1.75rem 1.75rem;
  display:flex;
  justify-content:center;
}

.card__judge{
  display:flex;
  gap: 0.75rem;
  width:100%;
}

/* ============================================================
   Buttons
   ============================================================ */
.btn{
  font-size: 0.95rem;
  font-weight: 700;
  padding: 0.75rem 1.4rem;
  border-radius: 6px;
  border: none;
  cursor:pointer;
  transition: transform 0.12s ease, filter 0.12s ease;
}
.btn:hover{ filter: brightness(1.08); }
.btn:active{ transform: scale(0.98); }

.btn--ghost{
  background: var(--white);
  color: var(--black);
  border: 1.5px solid var(--line);
}
.btn--ghost:hover{ border-color: var(--red); color: var(--red); }

.btn--right{
  background: var(--correct);
  color: #fff;
  flex:1;
}
.btn--wrong{
  background: var(--wrong);
  color: #fff;
  flex:1;
}

.btn--danger{
  border-color: var(--red);
  color: var(--red-dark);
}

.btn--file{ position:relative; }

.empty-state{
  max-width: 560px;
  text-align:center;
  padding: 3rem 1.5rem;
  color: var(--gray);
}

/* ============================================================
   Verwalten
   ============================================================ */
.verwalten-toolbar{
  display:flex;
  flex-wrap:wrap;
  gap: 0.6rem;
  margin-bottom: 1.75rem;
}

.add-form{
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 6px;
  padding: 1.25rem;
  margin-bottom: 2rem;
  display:flex;
  flex-direction:column;
  gap: 0.65rem;
  box-shadow: var(--card-shadow);
}

.add-form textarea{
  width:100%;
  resize: vertical;
  min-height: 3rem;
  background: var(--off-white);
  color: var(--black);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
}

.question-list{
  display:flex;
  flex-direction:column;
  gap: 0.6rem;
}

.q-row{
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 6px;
  padding: 0.9rem 1rem;
  display:flex;
  gap: 0.75rem;
  align-items:flex-start;
}

.q-row__text{ flex:1; min-width:0; }
.q-row__frage{ margin:0 0 0.3rem; font-weight:600; }
.q-row__antwort{ margin:0; font-size: 0.9rem; color: var(--gray); }
.q-row__meta{
  font-family: var(--font-mono);
  font-size: 0.7rem;
  color: var(--red-dark);
  opacity: 0.85;
  margin-top: 0.4rem;
}

.q-row__actions{
  display:flex;
  flex-direction:column;
  gap: 0.35rem;
}

.q-row textarea{
  width:100%;
  margin-bottom: 0.4rem;
  background: var(--off-white);
  color: var(--black);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.5rem 0.6rem;
  font-family: var(--font-body);
}

.icon-btn{
  background: var(--white);
  border: 1px solid var(--line);
  color: var(--black);
  border-radius: 5px;
  padding: 0.3rem 0.6rem;
  font-size: 0.8rem;
  cursor:pointer;
}
.icon-btn:hover{ border-color: var(--red); color: var(--red); }

/* ============================================================
   Statistik
   ============================================================ */
.stats{ display:flex; flex-direction:column; gap: 1.5rem; }

.stats__summary{
  display:flex;
  gap: 1rem;
  flex-wrap:wrap;
}

.stats__tile{
  flex:1;
  min-width: 140px;
  background: var(--white);
  border: 1px solid var(--line);
  border-top: 4px solid var(--red);
  border-radius: 6px;
  padding: 1rem 1.1rem;
  box-shadow: var(--card-shadow);
}

.stats__tile-value{
  font-family: var(--font-mono);
  font-size: 1.8rem;
  font-weight: 600;
  color: var(--red-dark);
}

.stats__tile-label{
  font-size: 0.8rem;
  color: var(--gray);
}

.bar-row{
  display:flex;
  align-items:center;
  gap: 0.75rem;
  margin-bottom: 0.55rem;
}

.bar-row__label{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  width: 92px;
  flex-shrink:0;
  color: var(--gray);
}

.bar-row__track{
  flex:1;
  height: 10px;
  background: var(--line);
  border-radius: 999px;
  overflow:hidden;
}

.bar-row__fill{
  height:100%;
  background: var(--red);
  border-radius: 999px;
}

.bar-row__fill.is-mastered{ background: var(--correct); }

.bar-row__count{
  font-family: var(--font-mono);
  font-size: 0.78rem;
  width: 28px;
  text-align:right;
  color: var(--gray);
}

/* ============================================================
   Responsive
   ============================================================ */
@media (max-width: 480px){
  .card__body{ padding: 2rem 1.25rem 1rem; }
  .card__actions{ padding: 1rem 1.25rem 1.5rem; }
  .drawer{ min-width: 78px; }
}

@media (prefers-reduced-motion: reduce){
  *{ transition: none !important; }
}

/* ============================================================
   Login / Registrierung
   ============================================================ */
.login-screen{
  min-height: 100vh;
  display:flex;
  align-items:center;
  justify-content:center;
  padding: 1.5rem;
}

.login-card{
  position:relative;
  width:100%;
  max-width: 380px;
  background: var(--white);
  border: 1px solid var(--line);
  border-radius: 4px;
  box-shadow: var(--card-shadow);
  padding: 2.25rem 1.75rem 1.75rem;
}

.login-card__tab{
  position:absolute;
  top: -0.9rem;
  left: 1.75rem;
  background: var(--red);
  color: var(--white);
  font-family: var(--font-mono);
  font-size: 0.75rem;
  font-weight: 600;
  letter-spacing: 0.06em;
  padding: 0.3rem 0.85rem;
  border-radius: 3px;
  box-shadow: 0 4px 10px -4px rgba(0,0,0,0.35);
}

.login-card h2{
  font-size: 1.3rem;
  text-transform: uppercase;
  margin-bottom: 1.4rem;
}

.auth-form{
  display:flex;
  flex-direction:column;
  gap: 1rem;
}

.field{
  display:flex;
  flex-direction:column;
  gap: 0.35rem;
}

.field__label{
  font-family: var(--font-mono);
  font-size: 0.7rem;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  color: var(--gray);
}

.field input,
.auth-form input{
  background: var(--off-white);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.65rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
  color: var(--black);
}

.field input:focus,
.auth-form input:focus{
  outline: 2px solid var(--red-dark);
  outline-offset: 1px;
}

.form-error{
  background: var(--wrong-lt);
  color: var(--red-dark);
  border-radius: 5px;
  padding: 0.55rem 0.75rem;
  font-size: 0.85rem;
  margin: 0;
}

.btn--block{ width:100%; }

.link-btn{
  display:block;
  margin: 1.25rem auto 0;
  background: none;
  border: none;
  color: var(--red-dark);
  font-size: 0.85rem;
  text-decoration: underline;
  cursor: pointer;
}

/* ============================================================
   Header-Erweiterung: Kategorie + Benutzer
   ============================================================ */
.app-header__controls{
  display:flex;
  align-items:flex-end;
  gap: 1.25rem;
  flex-wrap: wrap;
}

.kategorie-select{
  display:flex;
  flex-direction:column;
  gap: 0.3rem;
}

.kategorie-select select{
  background: var(--white);
  border: 1.5px solid var(--line);
  border-radius: 5px;
  padding: 0.5rem 0.75rem;
  font-family: var(--font-body);
  font-weight: 600;
  font-size: 0.9rem;
  color: var(--black);
  min-width: 110px;
}

.user-chip{
  display:flex;
  align-items:center;
  gap: 0.6rem;
  font-size: 0.85rem;
  color: var(--gray);
}

/* Neue-Frage-Formular: Kategorie-Textfeld gleich stylen wie Textareas */
.add-form input[type="text"]{
  background: var(--off-white);
  color: var(--black);
  border: 1px solid var(--line);
  border-radius: 5px;
  padding: 0.6rem 0.75rem;
  font-family: var(--font-body);
  font-size: 0.95rem;
}

@media (max-width: 480px){
  .app-header__controls{ width:100%; justify-content:space-between; }
}

/* ============================================================
   Nutzerverwaltung
   ============================================================ */
.field__hint{
  font-size: 0.85rem;
  color: var(--gray);
  margin: -0.5rem 0 0.25rem;
  line-height: 1.5;
}

.checkbox-field{
  display:flex;
  align-items:center;
  gap: 0.5rem;
  font-size: 0.9rem;
  color: var(--black);
}

.checkbox-field input{ width:auto; }

.badge{
  display:inline-block;
  font-family: var(--font-mono);
  font-size: 0.68rem;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  background: var(--red-tint);
  color: var(--red-dark);
  border-radius: 3px;
  padding: 0.15rem 0.45rem;
  margin-left: 0.5rem;
}

/* ============================================================
   Gesamt-Fortschrittsleiste (sichtbar in allen Tabs)
   ============================================================ */
.progress-overview{
  display:flex;
  align-items:center;
  gap: 0.85rem;
  margin-top: 0.75rem;
  padding: 0 clamp(1rem, 4vw, 3rem);
}

.progress-overview__track{
  flex:1;
  height: 8px;
  background: var(--line);
  border-radius: 999px;
  overflow:hidden;
}

.progress-overview__fill{
  height:100%;
  width:0%;
  background: linear-gradient(90deg, var(--red) 0%, var(--correct) 100%);
  border-radius: 999px;
  transition: width 0.4s ease;
}

.progress-overview__text{
  font-family: var(--font-mono);
  font-size: 0.75rem;
  color: var(--gray);
  white-space: nowrap;
}

@media (prefers-reduced-motion: reduce){
  .progress-overview__fill{ transition: none; }
}

/* ============================================================
   Logo (Login-Screen)
   ============================================================ */
.login-logo{
  display:block;
  margin: 0 auto 1.25rem;
}
