/* ═══ Flashcards de mostra (assets/flashcards.js) ═══
   Calcat de la sessió de OposUp/src/pages/Flashcards.tsx (branca redisseny):
   ExamHeader variant="practice" (títol + posició), Tabs "Totes / Les que no sé",
   pila de targetes amb gir 3D, StatusBadge, botons "La sé" / "No la sé" i
   resum (ScoreRing + StatTile, de quiz.css) + ResultActions.
   Llista de piles = Item outline sm + ItemMedia amb el número de tema.

   Sense JS (.fc sense .is-active) es veuen totes les targetes amb pregunta i
   resposta: és el contingut indexable. */

.fc { display: flex; flex-direction: column; gap: 24px; }

/* Sense JS: llista de pregunta / resposta */
.fc-cards { list-style: none; display: flex; flex-direction: column; gap: 12px; }
.fc-static { background: var(--card); border: 1px solid var(--border); border-radius: 12px; padding: 16px 20px; box-shadow: var(--shadow-sm); }
.fc-static .fc-deck { font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-foreground); margin-bottom: 8px; }
.fc-static .fc-q { font-size: 16px; font-weight: 600; line-height: 1.5; color: var(--foreground); }
.fc-static .fc-a { margin-top: 8px; font-size: 15px; line-height: 1.6; color: var(--muted-foreground); }

.fc.is-active .fc-cards { display: none; }
.fc.is-finished .fc-session { display: none; }

/* ExamHeader variant="practice": ExitSlot (buit) + títol + posició */
.fc-header { display: flex; align-items: center; gap: 12px; padding: 12px 16px; background: var(--card); border: 1px solid var(--border); border-radius: 12px; }
.fc-header-spacer { width: 40px; flex-shrink: 0; }
.fc-header-title { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; text-align: center; font-size: 16px; font-weight: 500; color: var(--muted-foreground); }
.fc-header-pos { display: flex; justify-content: flex-end; min-width: 40px; flex-shrink: 0; font-size: 16px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted-foreground); }

.fc-session { display: flex; flex-direction: column; gap: 24px; }

/* Tabs (TabsList h-10 rounded-md bg-muted p-1 / TabsTrigger) */
.fc-tabs { display: inline-flex; align-self: flex-start; height: 40px; align-items: center; padding: 4px; border-radius: 6px; background: var(--muted); color: var(--muted-foreground); }
.fc-tabs button {
  display: inline-flex; align-items: center; justify-content: center; white-space: nowrap;
  height: 100%; padding: 6px 12px; border: 0; border-radius: 2px; background: transparent;
  font: inherit; font-size: 14px; font-weight: 500; color: inherit; cursor: pointer; transition: all 0.15s;
}
.fc-tabs button[aria-selected="true"] { background: var(--background); color: var(--foreground); box-shadow: var(--shadow-sm); }
.fc-tabs button:disabled { opacity: 0.5; pointer-events: none; }
.fc-tabs button:focus-visible { outline: none; box-shadow: 0 0 0 2px var(--background), 0 0 0 4px var(--ring); }

/* Pila: dues targetes de fons + la targeta que gira */
.fc-stack { position: relative; isolation: isolate; }
.fc-stack-back { position: absolute; z-index: -1; border: 1px solid var(--border); border-radius: 12px; background: var(--card); }
.fc-stack-back.b1 { left: 12px; right: 12px; top: 8px; bottom: -8px; }
.fc-stack-back.b2 { left: 24px; right: 24px; top: 16px; bottom: -16px; z-index: -2; }
.fc-stack-back[hidden] { display: none; }

.fc-scene { perspective: 1000px; }
.fc-scene.is-entering { animation: fc-enter 0.3s ease-out; }
@keyframes fc-enter { from { opacity: 0; transform: translateY(16px) scale(0.95); } to { opacity: 1; transform: none; } }

.fc-flip {
  display: grid; cursor: pointer; border-radius: 12px;
  transition: transform 0.5s; transform-style: preserve-3d;
}
.fc-flip.is-flipped { transform: rotateY(180deg); }
.fc-flip:focus { outline: none; }
.fc-flip:focus-visible { box-shadow: 0 0 0 2px var(--ring); }
@media (prefers-reduced-motion: reduce) { .fc-flip { transition: none; } .fc-scene.is-entering { animation: none; } }

.fc-face {
  position: relative; grid-column: 1; grid-row: 1;
  display: flex; flex-direction: column; align-items: center; justify-content: center;
  min-height: 320px; padding: 32px; text-align: center;
  background: var(--card); border: 1px solid var(--border); border-radius: 12px; box-shadow: var(--shadow-sm);
  backface-visibility: hidden; -webkit-backface-visibility: hidden;
}
.fc-face.back { transform: rotateY(180deg); background: var(--info-light); }
.fc-face-label { margin-bottom: 16px; font-size: 12px; font-weight: 700; text-transform: uppercase; letter-spacing: 0.1em; color: var(--muted-foreground); }
.fc-face-text { font-size: 18px; font-weight: 600; line-height: 1.625; color: var(--foreground); }
.fc-face-hint { margin-top: 24px; font-size: 12px; color: var(--muted-foreground); }

/* StatusBadge: Badge outline + STATE_CLASSES (correct / incorrect) */
.fc-badge {
  position: absolute; top: 12px; right: 12px; display: inline-flex; align-items: center;
  padding: 2px 10px; border: 1px solid; border-radius: 999px; font-size: 12px; font-weight: 600;
}
.fc-badge.learned { border-color: var(--primary-border); background: var(--primary-light); color: var(--primary-dark); }
.fc-badge.pending { border-color: var(--destructive-border); background: var(--destructive-light); color: var(--destructive-dark); }

/* "La sé" / "No la sé" (Button outline amb colors d'estat) */
.fc-marks { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.fc-marks .btn { gap: 4px; }
.fc-marks .btn svg { width: 16px; height: 16px; flex-shrink: 0; }
.fc-marks .btn:disabled { opacity: 0.5; pointer-events: none; }
.fc-mark-learned { border-color: var(--primary-border) !important; color: var(--primary) !important; }
.fc-mark-learned:hover { background: var(--primary-light) !important; color: var(--primary-dark) !important; }
.fc-mark-pending { border-color: var(--destructive-border) !important; color: var(--destructive) !important; }
.fc-mark-pending:hover { background: var(--destructive-light) !important; color: var(--destructive-dark) !important; }

/* Llista de piles (Item outline size sm + ItemMedia icon size-11) */
.fc-decks { display: grid; grid-template-columns: 1fr; gap: 12px; }
@media (min-width: 768px) { .fc-decks { grid-template-columns: 1fr 1fr; } }
.fc-deck-item {
  display: flex; align-items: center; gap: 10px; padding: 12px 16px;
  border: 1px solid var(--border); border-radius: 12px; background: var(--card);
  color: inherit; text-decoration: none; transition: background-color 0.15s;
}
.fc-deck-item:hover { background: var(--muted); }
.fc-deck-num {
  display: flex; align-items: center; justify-content: center; flex-shrink: 0;
  width: 44px; height: 44px; border-radius: 8px; background: var(--muted);
  font-size: 14px; font-weight: 600; color: var(--foreground);
}
.fc-deck-body { display: flex; flex: 1; flex-direction: column; gap: 4px; min-width: 0; }
.fc-deck-title { font-size: 14px; font-weight: 500; line-height: 1.375; color: var(--foreground); }
.fc-deck-desc { font-size: 14px; line-height: 1.5; color: var(--muted-foreground); }
.fc-deck-count { flex-shrink: 0; font-size: 14px; font-weight: 600; font-variant-numeric: tabular-nums; color: var(--muted-foreground); }
