/* ============================================================================
   Muskel-Tabellenabfrage v2
   Desktop: Horizontale Tabelle  |  Mobil: Kompakte Karten
   ============================================================================ */

/* ------------------------------------------------------------------
   Icon-Styling (SVG-Bilder in Buttons)
   ------------------------------------------------------------------ */

.modus-icon {
  width: 16px;
  height: 16px;
  display: inline-block;
  vertical-align: middle;
}

.mt-icon {
  width: 14px;
  height: 14px;
  display: inline-block;
  vertical-align: middle;
}

/* Icons in aktiven/hellen Buttons invertieren */
.modus-btn.active .modus-icon {
  filter: brightness(0) invert(1);
}

/* ------------------------------------------------------------------
   Modus-Umschalter
   ------------------------------------------------------------------ */

.abfrage-modus-toggle {
  display: flex;
  gap: 0.5rem;
  justify-content: center;
  margin-bottom: 1rem;
}

.modus-btn {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  padding: 0.5rem 1.1rem;
  background: white;
  border: 2px solid var(--tint-2);
  border-radius: 10px;
  cursor: pointer;
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--grey-4);
  transition: all 0.2s ease;
}

.modus-btn:hover {
  border-color: var(--tint-3);
  color: var(--primary);
}

.modus-btn.active {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.modus-btn.active svg { stroke: white; }

/* ------------------------------------------------------------------
   Toolbar (Controls + Progress + Nav in einer Zeile)
   ------------------------------------------------------------------ */

.mt-toolbar {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-bottom: 0.75rem;
  flex-wrap: wrap;
  justify-content: center;
}

.mt-toolbar-group {
  display: flex;
  align-items: center;
  gap: 0.4rem;
}

.mt-btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.35rem;
  padding: 0.45rem 0.85rem;
  border-radius: 10px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 2px solid transparent;
  white-space: nowrap;
  line-height: 1;
}

.mt-btn-primary {
  background: var(--primary);
  color: white;
  border-color: var(--primary);
}

.mt-btn-primary:hover:not(:disabled) {
  background: var(--shade-1);
  border-color: var(--shade-1);
}

.mt-btn-secondary {
  background: white;
  color: var(--grey-5);
  border-color: var(--tint-2);
}

.mt-btn-secondary:hover:not(:disabled) {
  border-color: var(--shade-1);
  background: var(--tint-1);
}

.mt-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
}

.mt-btn-solutions.solutions-active {
  background: #059669 !important;
  border-color: #059669 !important;
  color: white !important;
}

.mt-btn-solutions.solutions-active:hover {
  background: #047857 !important;
  border-color: #047857 !important;
}

/* Hint-Button */
.mt-btn-hint {
  background: white;
  color: var(--primary);
  border: 2px dashed var(--primary);
}

.mt-btn-hint:hover {
  background: var(--tint-1);
}

/* Progress inline */
.mt-progress-inline {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: var(--grey-4);
  white-space: nowrap;
}

.mt-progress-bar-mini {
  width: 60px;
  height: 4px;
  background: var(--tint-2);
  border-radius: 2px;
  overflow: hidden;
}

.mt-progress-fill-mini {
  height: 100%;
  background: var(--primary);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ------------------------------------------------------------------
   Container
   ------------------------------------------------------------------ */

.mt-container {
  background: white;
  border-radius: 14px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.07);
  overflow: hidden;
}

.mt-error {
  background: #fee2e2;
  color: #991b1b;
  padding: 1.5rem;
  text-align: center;
  border-radius: 12px;
  margin: 1rem;
}

/* ------------------------------------------------------------------
   DESKTOP: Horizontale Tabelle
   ------------------------------------------------------------------ */

.mt-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 0.85rem;
}

.mt-table th {
  position: sticky;
  top: 0; 
  background: var(--primary);
  color: white;
  z-index: 5;
  text-align: left;
  padding: 10px 12px;
  font-weight: 700;
  font-size: 0.75rem;
  text-transform: uppercase;
  letter-spacing: 0.4px;
  white-space: nowrap;
}

.mt-table th:first-child {
  border-radius: 14px 0 0 0;
}

.mt-table th:last-child {
  border-radius: 0 14px 0 0;
}

.mt-table td {
  padding: 10px 12px;
  vertical-align: top;
  border-bottom: 1px solid var(--tint-2);
  min-width: 100px;
  background: white;
}

/* Vorgegebene Zellen deutlich abgesetzt */
.mt-table td.mt-cell-given {
  background: var(--tint-2);
}

.mt-sol-item {
  font-size: 0.85rem;
  color: var(--grey-5);
  line-height: 1.45;
  padding: 1px 0;
}

.mt-sol-item::before {
  content: "\2022\00a0";
  color: var(--primary);
}

.mt-sol-item:only-child::before {
  content: none;
}

/* Eingabefeld in Tabellenzelle */
.mt-table .mt-input {
  width: 100%;
  min-height: 36px;
  resize: vertical;
  border: 1.5px solid var(--tint-2);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 0.85rem;
  font-family: inherit;
  color: var(--grey-5);
  background: white;
  line-height: 1.4;
  transition: border-color 0.15s ease;
}

.mt-table .mt-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.1);
}

.mt-table .mt-input::placeholder {
  color: var(--grey-1);
  font-size: 0.78rem;
}

/* User-Eingabe im Lösungsmodus */
.mt-cell-solution {
  margin-bottom: 4px;
}

.mt-cell-user {
  margin-top: 4px;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.8rem;
  font-style: italic;
  background: rgba(230, 126, 34, 0.08);
  /* border-left: 3px solid var(--tint-3);*/
  color: var(--grey-4);
}

/* ------------------------------------------------------------------
   MOBIL: Kompakte Karte
   ------------------------------------------------------------------ */

.mt-card {
  padding: 0;
}

.mt-row {
  display: flex;
  flex-direction: column;
  padding: 8px 14px;
  border-bottom: 1px solid var(--tint-2);
}

.mt-row:last-child {
  border-bottom: none;
}

/* Vorgegebene Zeilen deutlich abgesetzt */
.mt-row-given {
  background: var(--tint-2);
}

.mt-label {
  font-size: 0.65rem;
  font-weight: 700;
  color: var(--primary);
  text-transform: uppercase;
  letter-spacing: 0.4px;
  margin-bottom: 2px;
}

.mt-val {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
}

.mt-tag {
  font-size: 0.85rem;
  color: var(--grey-5);
  line-height: 1.3;
}

.mt-tag:not(:last-child)::after {
  content: ";";
  color: var(--grey-1);
  margin-left: 1px;
}

/* Eingabefeld mobil */
.mt-card .mt-input {
  width: 100%;
  min-height: 34px;
  resize: none;
  border: 1.5px solid var(--tint-2);
  border-radius: 6px;
  padding: 6px 8px;
  font-size: 16px; /* iOS Zoom verhindern */
  font-family: inherit;
  color: var(--grey-5);
  background: white;
  line-height: 1.4;
  margin-top: 2px;
}

.mt-card .mt-input:focus {
  outline: none;
  border-color: var(--primary);
  box-shadow: 0 0 0 2px rgba(230, 126, 34, 0.1);
}

.mt-card .mt-input::placeholder {
  color: var(--grey-1);
  font-size: 0.78rem;
}

.mt-card .mt-cell-user {
  margin-top: 3px;
  padding: 3px 6px;
  border-radius: 4px;
  font-size: 0.78rem;
  font-style: italic;
  background: rgba(230, 126, 34, 0.08);
  /* border-left: 3px solid var(--tint-3); */
  color: var(--grey-4);
}

/* ------------------------------------------------------------------
   Abschluss
   ------------------------------------------------------------------ */

.mt-done {
  text-align: center;
  padding: 2.5rem 1rem;
}

.mt-done h2 {
  font-size: 1.8rem;
  color: var(--primary);
  font-weight: 700;
  margin-bottom: 0.3rem;
}

.mt-done p {
  font-size: 1rem;
  color: var(--grey-4);
  margin-bottom: 1.5rem;
}

/* ------------------------------------------------------------------
   Mobile: Sticky Hint-Button am unteren Rand
   ------------------------------------------------------------------ */

.mt-sticky-hint {
  display: none;
}

@media (max-width: 800px) {
  .mt-sticky-hint {
    display: block;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 8px 12px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.95);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    border-top: 1px solid var(--tint-2);
    z-index: 100;
    text-align: center;
  }

  .mt-sticky-hint .mt-btn-hint {
    width: 100%;
    padding: 10px;
    font-size: 0.85rem;
  }

  /* Desktop-Hint in Toolbar auf mobil ausblenden */
  .mt-hint-desktop {
    display: none !important;
  }

  /* Contribute-Badge auf mobil ausblenden */
  .contribute-badge {
    display: none !important;
  }

  /* Toolbar kompakter */
  .mt-toolbar {
    gap: 0.3rem;
    margin-bottom: 0.5rem;
  }

  .mt-btn {
    padding: 0.4rem 0.65rem;
    font-size: 0.75rem;
  }

  /* Modus-Toggle kompakter */
  .abfrage-modus-toggle {
    margin-bottom: 0.5rem;
  }

  .modus-btn {
    padding: 0.4rem 0.75rem;
    font-size: 0.78rem;
  }

  .modus-icon {
    width: 14px;
    height: 14px;
  }

  /* Platz für den Sticky-Hint unten */
  #tabelleSection {
    padding-bottom: 60px;
  }

  /* Quiz-Title kleiner */
  .quiz-title h1 {
    font-size: 1.25rem !important;
    margin-bottom: 0.3rem;
  }

  .mt-done h2 {
    font-size: 1.4rem;
  }
}

/* Desktop: Hint-Button in Toolbar sichtbar, Sticky versteckt */
@media (min-width: 801px) {
  .mt-sticky-hint {
    display: none !important;
  }
}

/* Kleine Smartphones */
@media (max-width: 380px) {
  .modus-icon { display: none; }
  .mt-progress-bar-mini { width: 40px; }

  .mt-btn {
    padding: 0.35rem 0.5rem;
    font-size: 0.72rem;
  }
}