/* ══════════════════════════════════════════════════════════
   CivicLearn v2 — Flashcards
   ══════════════════════════════════════════════════════════ */

#flashcardsApp {
  display: grid;
  gap: 24px;
  align-items: center;
  justify-items: center;
  text-align: center;
  margin-top: 16px;
}

/* ── Topic selector ── */
.fc-topics-wrapper {
  max-width: 720px;
  width: 100%;
}

.fc-topic-toggles {
  display: flex;
  flex-wrap: wrap;
  justify-content: center;
  gap: 8px;
  margin: 10px 0 20px;
}

/* Reuse .topic-chip from test-v2.css — these overrides center them */
.fc-topic-toggles .topic-chip {
  font-size: 13px;
}

/* flashcards-lu.js uses .selected (not .active) */
.fc-topic-toggles .topic-chip.selected {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

/* ── Segmented control (All / Weak) ── */
.fc-segmented {
  display: inline-flex;
  gap: 3px;
  padding: 3px;
  border-radius: 10px;
  background: var(--surface);
  border: 1px solid var(--border);
  margin: 6px 0 14px;
}

.fc-segmented button {
  font-family: var(--font);
  font-size: 13px;
  font-weight: 600;
  padding: 6px 16px;
  border-radius: 8px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  cursor: pointer;
  transition: all 0.18s ease;
}

.fc-segmented button:hover { color: var(--text); }

.fc-segmented button.active {
  background: var(--accent);
  color: white;
  box-shadow: 0 1px 4px rgba(0,0,0,0.08);
}

.fc-segmented button:focus { outline: none; }

/* ── Start button (must override test-v2.css #startBtn display:none) ── */
#startBtn.fc-btn-primary {
  display: inline-flex !important;
  font-family: var(--font);
  background: var(--accent);
  color: white;
  border-radius: var(--radius-sm);
  padding: 10px 24px;
  font-weight: 600;
  font-size: 14px;
  border: none;
  margin-top: 10px;
  cursor: pointer;
  transition: all 0.18s ease;
}

#startBtn.fc-btn-primary:hover {
  background: #0b6265;
  transform: translateY(-1px);
}

/* ── Card ── */
.flashcard {
  width: 100%;
  max-width: 480px;
  height: 280px;
  perspective: 1000px;
}

.card-inner {
  position: relative;
  width: 100%;
  height: 100%;
  transition: transform 0.55s cubic-bezier(0.22,1,0.36,1);
  transform-style: preserve-3d;
  cursor: pointer;
  box-shadow: var(--shadow);
  border-radius: var(--radius);
  background: var(--surface);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 28px;
}

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

.card-front,
.card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 17px;
  font-weight: 500;
  line-height: 1.55;
  padding: 24px;
  border-radius: var(--radius);
  letter-spacing: -0.01em;
}

.card-front {
  color: var(--text);
}

.card-back {
  transform: rotateY(180deg);
  background: var(--accent);
  color: white;
  font-weight: 600;
}

/* Placeholder before start */
.flashcard.placeholder {
  display: flex !important;
  align-items: center;
  justify-content: center;
  background-color: var(--surface);
  background-repeat: no-repeat;
  background-position: center;
  background-size: contain;
  border-radius: var(--radius);
  box-shadow: var(--shadow);
  opacity: 0.3;
  transition: opacity 0.3s ease;
}

.flashcard.placeholder .card-inner {
  display: none !important;
}

/* ── Controls ── */
.controls {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
  justify-content: center;
  margin-top: 8px;
}

.controls button {
  font-family: var(--font);
  font-size: 13.5px;
  font-weight: 600;
  padding: 9px 20px;
  border-radius: var(--radius-sm);
  border: 1.5px solid var(--border);
  background: var(--surface);
  color: var(--text);
  cursor: pointer;
  transition: all 0.18s ease;
}

.controls button:hover {
  border-color: var(--accent);
  background: var(--accent-soft);
  color: var(--accent);
}

.controls button.primary {
  background: var(--accent);
  border-color: var(--accent);
  color: white;
}

.controls button.primary:hover {
  background: #0b6265;
}

/* Navigation arrows */
.controls-row {
  display: flex;
  gap: 10px;
  justify-content: center;
  margin-top: 4px;
}

.fc-nav {
  background: none;
  border: none;
  cursor: pointer;
  padding: 4px;
  opacity: 0.5;
  transition: opacity 0.15s;
}

.fc-nav:hover { opacity: 1; }

.fc-nav svg circle { stroke: var(--accent); }
.fc-nav svg path { stroke: var(--accent); }

/* Status */
.fc-status {
  margin-top: 8px;
  font-size: 13px;
  font-weight: 500;
  color: var(--text-muted);
}

/* Layout alignment */
.flashcards-layout.left {
  max-width: 760px;
}

/* Disable flash during transitions */
.no-transition .card-inner {
  transition: none !important;
}

/* ── CZ: bilingual cards (Czech + translation) and picture cards ── */
.flashcard { height: 330px; }
.card-front,
.card-back {
  overflow-y: auto;
  text-align: center;
}
.card-front > .fc-q,
.card-back > .fc-a { max-height: 100%; margin: auto 0; }
.card-front u { text-decoration-thickness: 2px; text-underline-offset: 3px; }
.card-back img { background: #fff; padding: 4px; }
.card-back .fc-a-letter { font-size: 20px; font-weight: 800; }
@media (max-width: 480px) {
  .flashcard { height: 360px; }
  .card-front, .card-back { font-size: 15.5px; padding: 18px; }
}
