/*
 * SmartQuiz Flashcards — Frontend Styles
 * Scoped entirely under .sqfc-wrap  (no collision with .sq-wrap quiz styles)
 * Inherits theme font / text color. Colors via CSS custom properties.
 */

/* ── Shell ── */
.sqfc-wrap {
  box-sizing: border-box;
  font-size: inherit;
  color: inherit;
  font-family: inherit;
  line-height: inherit;
  max-width: 720px;
  margin: 0 auto;
}

.sqfc-wrap *,
.sqfc-wrap *::before,
.sqfc-wrap *::after {
  box-sizing: inherit;
}

.sqfc-loading {
  text-align: center;
  padding: 40px;
  opacity: 0.6;
}

/* ── Card wrapper (shared with quiz "card" look) ── */
.sqfc-panel {
  background: var(--sq-card-bg, #fff);
  border-radius: var(--sq-radius, 8px);
  box-shadow: var(--sq-card-shadow, 0 1px 4px rgba(0,0,0,.08));
  border: 1px solid var(--sq-border, #dee2e6);
  padding: 28px 32px;
  margin-bottom: 20px;
}

/* ── Header bar ── */
.sqfc-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 12px;
  margin-bottom: 20px;
}

.sqfc-title {
  margin: 0;
  font-size: 1.35em;
  font-weight: 800;
  line-height: 1.2;
}

.sqfc-meta {
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}

.sqfc-progress {
  font-weight: 700;
  font-size: 1em;
  color: var(--sq-accent, #5b5ef4);
  min-width: 60px;
  text-align: right;
}

.sqfc-controls {
  display: flex;
  gap: 8px;
}

/* ── Progress bar ── */
.sqfc-bar-wrap {
  height: 5px;
  background: var(--sq-border, #dee2e6);
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 24px;
}

.sqfc-bar-fill {
  height: 100%;
  background: var(--sq-accent, #5b5ef4);
  border-radius: 999px;
  transition: width 0.35s ease;
}

/* ── Flashcard 3-D flip ── */
.sqfc-card-scene {
  perspective: 1200px;
  margin-bottom: 20px;
  cursor: pointer;
  user-select: none;
}

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

.sqfc-card-scene:hover .sqfc-card:not(.sqfc-flipped) {
  transform: translateY(-2px);
}

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

.sqfc-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  border-radius: var(--sq-radius, 8px);
  border: 1.5px solid var(--sq-border, #dee2e6);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 28px 32px;
  text-align: center;
  min-height: 220px;
}

/* Front face */
.sqfc-face-front {
  background: var(--sq-card-bg, #fff);
}

/* Back face */
.sqfc-face-back {
  background: rgba(var(--sq-accent-rgb, 91,94,244), 0.05);
  border-color: var(--sq-accent, #5b5ef4);
  transform: rotateY(180deg);
}

.sqfc-face-text {
  font-size: 1.15em;
  line-height: 1.55;
  word-break: break-word;
  hyphens: auto;
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
}

.sqfc-face-hint {
  font-size: 0.78em;
  opacity: 0.45;
  margin-top: 14px;
  letter-spacing: 0.03em;
  text-transform: uppercase;
}

.sqfc-face-label {
  font-size: 0.72em;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.08em;
  color: var(--sq-accent, #5b5ef4);
  margin-bottom: 10px;
}

/* ── Buttons (mirrors quiz .sq-btn) ── */
.sqfc-btn {
  display: inline-block;
  padding: 9px 20px;
  border-radius: var(--sq-radius, 8px);
  border: none;
  cursor: pointer;
  font-size: 0.9em;
  font-family: inherit;
  font-weight: 600;
  transition: opacity 0.15s, transform 0.1s;
  text-decoration: none;
}

.sqfc-btn:hover:not(:disabled) { opacity: 0.88; transform: translateY(-1px); }
.sqfc-btn:active:not(:disabled) { transform: translateY(0); }
.sqfc-btn:disabled { opacity: 0.35; cursor: not-allowed; transform: none; }

.sqfc-btn-primary {
  background: var(--sq-accent, #5b5ef4);
  color: #fff;
}

.sqfc-btn-secondary {
  background: transparent;
  border: 1.5px solid var(--sq-border, #dee2e6);
  color: inherit;
}

/* ── Navigation row ── */
.sqfc-nav {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  flex-wrap: wrap;
}

.sqfc-nav-center {
  display: flex;
  gap: 8px;
}

/* ── Empty state ── */
.sqfc-empty {
  text-align: center;
  padding: 48px 20px;
  opacity: 0.6;
}

/* ── Responsive ── */
@media (max-width: 540px) {
  .sqfc-panel { padding: 18px 16px; }
  .sqfc-face  { padding: 20px 16px; min-height: 180px; }
  .sqfc-face-text { font-size: 1em; }
  .sqfc-header { flex-direction: column; align-items: flex-start; }
  .sqfc-nav { gap: 6px; }
}
