/* ============================================================
   MEP-Karteikarten Styles
   ============================================================ */

.mep-page {
  min-height: 100vh;
  background: #0f1119;
  color: #e8eaf0;
  font-family: 'Inter', sans-serif;
  padding-bottom: 60px;
  padding-left: 220px;
}
@media (max-width: 768px) { .mep-page { padding-left: 0; padding-bottom: 80px; } }

/* ── Info-Leiste (unten) ─────────────────────────────────── */
.mep-info-bar {
  display: flex; align-items: center; gap: 12px;
  margin-top: 40px; padding: 12px 16px;
  max-width: 1000px; width: 100%; box-sizing: border-box;
  background: #13161f; border: 1px solid #1e2233; border-radius: 10px;
}
.mep-info-back {
  display: flex; align-items: center; gap: 6px;
  color: #6b7280; font-size: 13px; font-weight: 600;
  text-decoration: none; transition: color 0.15s;
}
.mep-info-back:hover { color: #e8eaf0; }
.mep-info-sep { color: #3a4055; font-size: 14px; }
.mep-info-title { font-size: 13px; font-weight: 700; color: #e8eaf0; }
.mep-info-badge {
  background: linear-gradient(135deg, #f0a03c, #e8742a); color: #fff;
  font-size: 11px; font-weight: 700; letter-spacing: 0.08em;
  padding: 2px 8px; border-radius: 20px; margin-left: auto;
}

/* ── Main ────────────────────────────────────────────────── */
.mep-page main {
  display: flex;
  flex-direction: column;
  align-items: center;
  min-height: 80vh;
  justify-content: flex-start;
  max-width: 1100px;
  margin: 0 auto;
  width: 100%;
  padding: 28px 24px;
  box-sizing: border-box;
}

/* ── Intro-Banner ────────────────────────────────────────── */
.mep-intro {
  background: linear-gradient(135deg, #1a1f30, #1e2535);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 14px;
  padding: 20px 24px;
  margin: 0 auto 20px;
  max-width: 1000px;
  width: 100%;
  box-sizing: border-box;
}
.mep-intro h2 {
  font-size: 16px;
  font-weight: 700;
  color: #e8eaf0;
  margin: 0 0 8px;
}
.mep-intro p {
  font-size: 14px;
  color: #9aa0b0;
  margin: 0;
  line-height: 1.6;
}

/* ── Fach-Tabs ───────────────────────────────────────────── */
.mep-tabs {
  display: flex;
  gap: 8px;
  padding: 0;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto 20px;
  flex-wrap: wrap;
}

.mep-tab {
  padding: 7px 16px;
  border-radius: 20px;
  border: 1px solid rgba(255,255,255,0.1);
  background: transparent;
  color: #9aa0b0;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s;
}
.mep-tab:hover {
  border-color: rgba(255,255,255,0.2);
  color: #e8eaf0;
}
.mep-tab.active         { background: #e8742a; border-color: #e8742a; color: #fff; }
.mep-tab.rbh.active     { background: #e85d4a; border-color: #e85d4a; }
.mep-tab.bwh.active     { background: #3b82f6; border-color: #3b82f6; }
.mep-tab.mikp.active    { background: #f0a03c; border-color: #f0a03c; }
.mep-tab.zib.active     { background: #a78bfa; border-color: #a78bfa; }
.mep-tab.ntg.active     { background: #4ade80; border-color: #4ade80; color: #0a1a0a; }

/* ── Progress Bar ────────────────────────────────────────── */
.mep-progress-row {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 0;
  max-width: 1000px;
  width: 100%;
  margin: 0 auto 20px;
}

.mep-progress-bar-wrap {
  flex: 1;
  background: rgba(255,255,255,0.07);
  border-radius: 6px;
  height: 8px;
  overflow: hidden;
}

.mep-progress-bar-fill {
  height: 100%;
  border-radius: 6px;
  background: linear-gradient(90deg, #4ade80, #22d3a0);
  transition: width 0.4s ease;
}

.mep-progress-text {
  font-size: 13px;
  color: #9aa0b0;
  white-space: nowrap;
  font-weight: 600;
  min-width: 80px;
  text-align: right;
}

/* ── Karte Container ─────────────────────────────────────── */
.mep-card-area {
  max-width: 600px;
  width: 100%;
  margin: 0 auto;
  padding: 0;
}

.mep-card-wrapper {
  perspective: 1200px;
  width: 100%;
}

.mep-card {
  width: 100%;
  min-height: 560px;
  position: relative;
  transform-style: preserve-3d;
  transition: transform 0.65s cubic-bezier(0.4, 0, 0.2, 1);
}

.mep-card.flipped {
  transform: rotateY(180deg);
}

.mep-card-face {
  position: absolute;
  top: 0; left: 0; right: 0;
  min-height: 560px;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  border-radius: 16px;
  background: #141824;
  border: 1px solid rgba(255,255,255,0.09);
  padding: 28px 32px;
  display: flex;
  flex-direction: column;
}

.mep-card-back {
  transform: rotateY(180deg);
  background: #141824;
}

/* ── Fach-Badge ──────────────────────────────────────────── */
.mep-fach-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  letter-spacing: 0.4px;
  align-self: flex-start;
  margin-bottom: 20px;
}

.mep-fach-badge[data-fach="RBH"]  { background: rgba(232,93,74,0.18);  color: #e85d4a; border: 1px solid rgba(232,93,74,0.3); }
.mep-fach-badge[data-fach="BWH"]  { background: rgba(59,130,246,0.18); color: #60a5fa; border: 1px solid rgba(59,130,246,0.3); }
.mep-fach-badge[data-fach="MIKP"] { background: rgba(240,160,60,0.18); color: #f0a03c; border: 1px solid rgba(240,160,60,0.3); }
.mep-fach-badge[data-fach="ZIB"]  { background: rgba(167,139,250,0.18); color: #a78bfa; border: 1px solid rgba(167,139,250,0.3); }
.mep-fach-badge[data-fach="NTG"]  { background: rgba(74,222,128,0.18); color: #4ade80; border: 1px solid rgba(74,222,128,0.3); }

/* ── Vorderseite ─────────────────────────────────────────── */
.mep-question-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 12px;
}

.mep-question-text {
  font-size: 19px;
  font-weight: 700;
  color: #e8eaf0;
  line-height: 1.5;
  flex: 1;
  margin-bottom: 24px;
}

.mep-answer-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 8px;
}

.mep-textarea {
  width: 100%;
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 10px;
  padding: 14px 16px;
  color: #e8eaf0;
  font-size: 15px;
  font-family: 'Inter', sans-serif;
  resize: vertical;
  min-height: 100px;
  line-height: 1.5;
  transition: border-color 0.2s;
  box-sizing: border-box;
}
.mep-textarea:focus {
  outline: none;
  border-color: rgba(232,116,42,0.5);
  background: rgba(255,255,255,0.06);
}
.mep-textarea::placeholder { color: #4a5060; }

.mep-aufdecken-btn {
  margin-top: 16px;
  padding: 13px 24px;
  background: linear-gradient(135deg, #e8742a, #d4621a);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  align-self: stretch;
}
.mep-aufdecken-btn:hover {
  background: linear-gradient(135deg, #f08040, #e8742a);
  transform: translateY(-1px);
}

/* ── Rückseite ───────────────────────────────────────────── */
.mep-back-frage {
  font-size: 14px;
  font-weight: 600;
  color: #9aa0b0;
  line-height: 1.5;
  margin-bottom: 14px;
  padding: 10px 14px;
  background: rgba(255,255,255,0.03);
  border-left: 3px solid rgba(255,255,255,0.12);
  border-radius: 0 8px 8px 0;
}

.mep-back-label {
  font-size: 12px;
  font-weight: 600;
  color: #6b7280;
  text-transform: uppercase;
  letter-spacing: 0.8px;
  margin-bottom: 6px;
}

.mep-user-answer-box {
  background: rgba(255,255,255,0.04);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  color: #c8cad6;
  line-height: 1.5;
  margin-bottom: 6px;
  min-height: 48px;
  white-space: pre-wrap;
}

.mep-match-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 3px 12px;
  border-radius: 20px;
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 16px;
}
.mep-match-badge.hoch   { background: rgba(74,222,128,0.15);  color: #4ade80;  border: 1px solid rgba(74,222,128,0.3); }
.mep-match-badge.mittel { background: rgba(240,160,60,0.15);  color: #f0a03c;  border: 1px solid rgba(240,160,60,0.3); }
.mep-match-badge.niedrig{ background: rgba(232,93,74,0.15);   color: #e85d4a;  border: 1px solid rgba(232,93,74,0.3); }
.mep-match-badge.leer   { background: rgba(107,114,128,0.15); color: #6b7280;  border: 1px solid rgba(107,114,128,0.3); }

.mep-correct-answer {
  background: rgba(74,222,128,0.06);
  border: 1px solid rgba(74,222,128,0.2);
  border-radius: 10px;
  padding: 16px;
  font-size: 14px;
  color: #d8f8e6;
  line-height: 1.7;
  flex: 1;
  margin-bottom: 20px;
  white-space: pre-wrap;
  overflow-y: auto;
  max-height: 220px;
}

/* ── Bewertungs-Buttons ──────────────────────────────────── */
.mep-rating-row {
  display: grid;
  grid-template-columns: 1fr 1fr 1fr;
  gap: 10px;
}

.mep-rating-btn {
  padding: 11px 8px;
  border: none;
  border-radius: 10px;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
}
.mep-rating-btn:hover { transform: translateY(-2px); }

.mep-rating-btn.nochmal {
  background: rgba(232,93,74,0.2);
  color: #e85d4a;
  border: 1px solid rgba(232,93,74,0.3);
}
.mep-rating-btn.nochmal:hover { background: rgba(232,93,74,0.35); }

.mep-rating-btn.schwer {
  background: rgba(240,160,60,0.2);
  color: #f0a03c;
  border: 1px solid rgba(240,160,60,0.3);
}
.mep-rating-btn.schwer:hover { background: rgba(240,160,60,0.35); }

.mep-rating-btn.leicht {
  background: rgba(74,222,128,0.2);
  color: #4ade80;
  border: 1px solid rgba(74,222,128,0.3);
}
.mep-rating-btn.leicht:hover { background: rgba(74,222,128,0.35); }

.mep-rating-sub {
  font-size: 10px;
  font-weight: 500;
  opacity: 0.7;
}

/* ── Empty State ─────────────────────────────────────────── */
.mep-empty {
  text-align: center;
  padding: 60px 24px;
  max-width: 500px;
  margin: 0 auto;
}
.mep-empty-icon { font-size: 56px; margin-bottom: 16px; }
.mep-empty-title { font-size: 22px; font-weight: 700; color: #e8eaf0; margin-bottom: 8px; }
.mep-empty-sub { font-size: 15px; color: #6b7280; line-height: 1.5; }
.mep-empty-next { font-size: 13px; color: #4ade80; margin-top: 12px; font-weight: 600; }

/* ── Upgrade-Banner ──────────────────────────────────────── */
.mep-upgrade-bar {
  max-width: 600px;
  width: 100%;
  margin: 16px auto 0;
  background: linear-gradient(135deg, rgba(232,116,42,0.15), rgba(240,160,60,0.1));
  border: 1px solid rgba(232,116,42,0.3);
  border-radius: 12px;
  padding: 14px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  flex-wrap: wrap;
}
.mep-upgrade-bar-text { font-size: 14px; color: #e8eaf0; }
.mep-upgrade-bar-text strong { color: #f0a03c; }
.mep-upgrade-bar-btn {
  background: linear-gradient(135deg, #e8742a, #d4621a);
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 8px 18px;
  font-size: 13px;
  font-weight: 700;
  cursor: pointer;
  white-space: nowrap;
}
.mep-upgrade-bar-btn:hover { background: #f08040; }

/* ── Karte existiert – min-height placeholder ───────────── */
.mep-card-placeholder {
  min-height: 480px;
}

/* Volle Breite damit margin:auto auf Kindelementen korrekt zentriert */
#mep-content {
  width: 100%;
}

/* ── Layout-Wrapper: Karte + Sidebar nebeneinander ───────── */
.mep-layout-wrapper {
  display: flex;
  gap: 16px;
  align-items: flex-start;
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
  box-sizing: border-box;
}

/* Karten-Bereich: flex:1 statt max-width fix */
.mep-layout-wrapper .mep-card-area {
  flex: 1;
  min-width: 0;
  max-width: none;
  margin: 0;
}

/* ── Sidebar ─────────────────────────────────────────────── */
.mep-sidebar {
  width: 200px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Sidebar-Karte (gemeinsamer Block) */
.mep-sb-card {
  background: #12161f;
  border: 1px solid #1e2233;
  border-radius: 12px;
  padding: 12px 14px;
  box-sizing: border-box;
}

/* Header-Zeile: Label links, Zahl rechts */
.mep-sb-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
}

.mep-sb-label {
  font-size: 12px;
  font-weight: 700;
  color: #e8eaf0;
}

.mep-sb-count {
  font-size: 12px;
  color: #9aa0b0;
  font-weight: 600;
}

/* Fortschrittsbalken-Wrap */
.mep-sb-bar-wrap {
  background: rgba(255,255,255,0.07);
  border-radius: 3px;
  height: 6px;
  overflow: hidden;
}

/* 3px-Variante für Fach-Blöcke */
.mep-sb-bar-thin .mep-sb-bar-wrap {
  height: 3px;
}

.mep-sb-bar-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.4s ease;
}

.mep-sb-bar-orange { background: #e8742a; }
.mep-sb-bar-green  { background: #4ade80; }

/* Zeilen in Gesamt/Fach-Block */
.mep-sb-rows {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.mep-sb-row {
  display: flex;
  align-items: center;
  gap: 7px;
  font-size: 12px;
}

.mep-sb-dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  flex-shrink: 0;
}

.mep-sb-row-label {
  flex: 1;
  color: #9aa0b0;
  font-weight: 500;
}

.mep-sb-row-num {
  font-weight: 700;
  color: #e8eaf0;
  min-width: 20px;
  text-align: right;
}

/* Fachname-Zeile in Fach-Block */
.mep-sb-fach-title {
  font-size: 12px;
  font-weight: 700;
  margin-bottom: 8px;
}

/* ── Responsive ──────────────────────────────────────────── */
@media (max-width: 768px) {
  .mep-layout-wrapper {
    flex-direction: column;
  }
  .mep-sidebar {
    width: 100%;
    flex-direction: row;
    flex-wrap: wrap;
  }
  .mep-sb-card {
    flex: 1 1 calc(50% - 5px);
    min-width: 140px;
  }
  #mep-sb-faecher {
    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    width: 100%;
  }
  #mep-sb-faecher .mep-sb-card {
    flex: 1 1 calc(50% - 5px);
  }
}

/* ── Upgrade-Banner (Free/Standard) ─────────────────────── */
.mep-upgrade-banner {
  background: rgba(232, 116, 42, 0.1);
  border: 1px solid rgba(232, 116, 42, 0.3);
  border-radius: 10px;
  padding: 10px 16px;
  font-size: 13px;
  color: #e8eaf0;
  margin: 0 auto 16px;
  max-width: 1000px;
  width: 100%;
  box-sizing: border-box;
}
.mep-upgrade-banner a {
  color: #e8742a;
  font-weight: 600;
  text-decoration: none;
}
.mep-upgrade-banner a:hover {
  text-decoration: underline;
}

@media (max-width: 600px) {
  .mep-card-face { padding: 20px; }
  .mep-question-text { font-size: 16px; }
  .mep-rating-btn { padding: 9px 4px; font-size: 12px; }
  .mep-tabs { gap: 6px; }
  .mep-tab { padding: 6px 12px; font-size: 12px; }
  .mep-sidebar {
    flex-direction: column;
  }
  .mep-sb-card {
    flex: 1 1 100%;
  }
  #mep-sb-faecher {
    flex-direction: column;
  }
}
