/* ===================================================================
   FLASHCARDS & 3D INTERACTIVE FLIP DECK
   =================================================================== */

.btn-flashcards-pill {
  background: linear-gradient(135deg, #7c3aed 0%, #6366f1 100%);
  color: #ffffff !important;
  font-weight: 700;
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.45rem 0.95rem;
  border-radius: var(--radius-sm);
  border: none;
  box-shadow: 0 2px 8px rgba(124, 58, 237, 0.3);
  transition: var(--transition);
}

.btn-flashcards-pill:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(124, 58, 237, 0.45);
}

.flashcards-layout {
  padding: 1.25rem 0 3rem;
  max-width: 960px;
  margin: 0 auto;
}

.fc-container {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

/* Toolbar */
.fc-toolbar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 0.75rem;
  padding: 0.85rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  box-shadow: var(--shadow-sm);
}

.fc-toolbar-left, .fc-toolbar-right {
  display: flex;
  align-items: center;
  gap: 0.75rem;
}

.fc-deck-badge {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-weight: 700;
  color: var(--text-primary);
}

.fc-view-toggle {
  display: flex;
  background: var(--bg-tertiary);
  padding: 3px;
  border-radius: var(--radius-md);
  gap: 3px;
}

.fc-view-toggle .btn-toggle {
  background: none;
  border: none;
  padding: 0.35rem 0.75rem;
  font-size: 0.8rem;
  font-weight: 600;
  border-radius: var(--radius-sm);
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.fc-view-toggle .btn-toggle.active {
  background: var(--bg-secondary);
  color: var(--text-primary);
  box-shadow: var(--shadow-sm);
}

.btn-icon-mini {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  width: 34px;
  height: 34px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  font-size: 0.95rem;
  transition: var(--transition);
}

.btn-icon-mini:hover {
  background: var(--bg-accent);
}

/* Generator Panel */
.fc-generator-panel {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.fc-generator-header {
  text-align: center;
  max-width: 650px;
  margin: 0 auto 1.75rem;
}

.fc-hero-icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.fc-generator-header h2 {
  font-size: 1.6rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.5rem;
}

.fc-generator-header p {
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.5;
}

.fc-generator-grid {
  display: grid;
  grid-template-columns: 1.2fr 1fr;
  gap: 1.5rem;
}

@media (max-width: 768px) {
  .fc-generator-grid {
    grid-template-columns: 1fr;
  }
}

/* Dropzone */
.fc-dropzone {
  border: 2px dashed #8b5cf6;
  background: rgba(139, 92, 246, 0.04);
  border-radius: var(--radius-lg);
  padding: 2.25rem 1.5rem;
  text-align: center;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 0.5rem;
}

.fc-dropzone:hover, .fc-dropzone.dragover {
  background: rgba(139, 92, 246, 0.1);
  border-color: #6d28d9;
  transform: scale(1.01);
}

.dropzone-icon {
  font-size: 2.8rem;
}

.dropzone-text strong {
  display: block;
  font-size: 0.95rem;
  color: var(--text-primary);
  margin-bottom: 0.2rem;
}

.dropzone-text span {
  font-size: 0.78rem;
  color: var(--text-muted);
}

.fc-file-details {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  padding: 0.75rem 1rem;
  margin-top: 0.75rem;
}

.fc-file-details .file-icon {
  font-size: 1.5rem;
}

.fc-file-details .file-meta {
  flex: 1;
  display: flex;
  flex-direction: column;
}

.fc-file-details .file-meta strong {
  font-size: 0.88rem;
  color: var(--text-primary);
  word-break: break-all;
}

.fc-file-details .file-meta span {
  font-size: 0.75rem;
  color: var(--text-muted);
}

/* Sample chips */
.fc-samples-box {
  margin-top: 1.25rem;
}

.fc-samples-box label {
  display: block;
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-secondary);
  margin-bottom: 0.5rem;
  text-transform: none;
  letter-spacing: 0.03em;
}

.fc-samples-chips {
  display: flex;
  flex-wrap: wrap;
  gap: 0.45rem;
}

.btn-chip {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-sm);
  padding: 0.35rem 0.75rem;
  font-size: 0.78rem;
  font-weight: 600;
  color: var(--text-secondary);
  cursor: pointer;
  transition: var(--transition);
}

.btn-chip:hover {
  background: var(--primary-50);
  border-color: var(--primary-500);
  color: var(--primary-600);
  transform: translateY(-1px);
}

/* Settings Box */
.fc-settings-box {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  display: flex;
  flex-direction: column;
  gap: 0.85rem;
}

.fc-settings-box h3 {
  font-size: 0.95rem;
  font-weight: 700;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 0.4rem;
  margin-bottom: 0.25rem;
}

.field-hint {
  font-size: 0.74rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
  display: block;
}

.fc-checkbox-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.82rem;
  color: var(--text-secondary);
  cursor: pointer;
  user-select: none;
}

/* Loader */
.fc-loading-box {
  text-align: center;
  padding: 2.5rem 1rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-lg);
  margin-top: 1.5rem;
}

.fc-spinner {
  width: 44px;
  height: 44px;
  border: 4px solid rgba(139, 92, 246, 0.2);
  border-top-color: #8b5cf6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
  margin: 0 auto 1rem;
}

.fc-loader-bar {
  width: 100%;
  max-width: 320px;
  height: 6px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  margin: 1rem auto 0;
  overflow: hidden;
}

.fc-loader-fill {
  width: 25%;
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6, #3b82f6);
  border-radius: var(--radius-sm);
  animation: pulse-loader 1.5s ease-in-out infinite;
}

@keyframes pulse-loader {
  0% { transform: translateX(-100%); width: 30%; }
  50% { width: 60%; }
  100% { transform: translateX(350%); width: 30%; }
}

/* -------------------------------------------------------------
   ACTIVE 3D FLASHCARD STAGE
   ------------------------------------------------------------- */
.fc-player-panel {
  display: flex;
  flex-direction: column;
  gap: 1.25rem;
}

.fc-stats-bar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 0.5rem;
  padding: 0.75rem 1.25rem;
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
}

.fc-stat-item .stat-num {
  font-size: 1.15rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-right: 0.35rem;
}

.fc-stat-item .stat-label {
  font-size: 0.78rem;
  color: var(--text-muted);
  text-transform: none;
  font-weight: 600;
}

.fc-stat-pill {
  display: inline-flex;
  align-items: center;
  gap: 0.35rem;
  padding: 0.25rem 0.65rem;
  border-radius: var(--radius-sm);
  font-size: 0.8rem;
  font-weight: 700;
}

.pill-mastered {
  background: var(--success-50);
  color: var(--success-700);
  border: 1px solid var(--success-500);
}

.pill-learning {
  background: var(--warning-50);
  color: var(--warning-700);
  border: 1px solid var(--warning-500);
}

.pill-hard {
  background: var(--danger-50);
  color: var(--danger-700);
  border: 1px solid var(--danger-500);
}

/* Progress track */
.fc-progress-track {
  width: 100%;
  height: 8px;
  background: var(--border-light);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.fc-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #8b5cf6 0%, #3b82f6 50%, #10b981 100%);
  border-radius: var(--radius-sm);
  transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* 3D Card Stage */
.fc-stage {
  perspective: 1400px;
  display: flex;
  justify-content: center;
  margin: 0.5rem 0;
}

.fc-card {
  width: 100%;
  max-width: 720px;
  min-height: 400px;
  cursor: pointer;
  position: relative;
  outline: none;
  border-radius: var(--radius-lg);
}

.fc-card:focus-visible {
  box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.5);
}

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

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

.fc-card-face {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  min-height: 400px;
  border-radius: var(--radius-lg);
  border: 2px solid var(--border-light);
  background: var(--bg-secondary);
  padding: 2rem 2.25rem;
  display: flex;
  flex-direction: column;
  justify-content: space-between;
  box-shadow: var(--shadow-lg);
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.fc-card:hover .fc-card-face {
  border-color: #8b5cf6;
  box-shadow: 0 12px 28px -5px rgba(139, 92, 246, 0.18);
}

.fc-card-front {
  background: var(--bg-secondary);
}

.fc-card-back {
  transform: rotateY(180deg);
  background: linear-gradient(180deg, var(--bg-secondary) 0%, rgba(16, 185, 129, 0.04) 100%);
  border-color: rgba(16, 185, 129, 0.4);
}

.fc-card-topbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.fc-tag-badge {
  font-size: 0.75rem;
  font-weight: 800;
  text-transform: none;
  letter-spacing: 0.05em;
  padding: 0.3rem 0.75rem;
  border-radius: var(--radius-sm);
  background: rgba(139, 92, 246, 0.12);
  color: #7c3aed;
  border: 1px solid rgba(139, 92, 246, 0.3);
}

.fc-tag-answer {
  background: rgba(16, 185, 129, 0.12);
  color: var(--success-700);
  border-color: rgba(16, 185, 129, 0.3);
}

.fc-card-num {
  font-family: var(--font-mono);
  font-size: 0.82rem;
  font-weight: 700;
  color: var(--text-muted);
}

.fc-card-body {
  margin: 1.5rem 0;
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.fc-card-question {
  font-size: 1.35rem;
  font-weight: 700;
  line-height: 1.45;
  color: var(--text-primary);
  margin-bottom: 0.75rem;
}

.fc-card-hint {
  font-size: 0.85rem;
  color: var(--text-muted);
  font-style: normal;
}

.fc-card-answer {
  font-size: 1.15rem;
  font-weight: 600;
  line-height: 1.5;
  color: var(--text-primary);
  margin-bottom: 1rem;
}

.fc-card-points {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

.fc-point-item {
  display: flex;
  align-items: flex-start;
  gap: 0.5rem;
  font-size: 0.92rem;
  color: var(--text-secondary);
  line-height: 1.45;
}

.fc-point-item::before {
  content: "•";
  color: #8b5cf6;
  font-weight: 800;
}

.fc-card-tip-box {
  margin-top: 1rem;
  padding: 0.65rem 0.85rem;
  background: var(--warning-50);
  border-left: 3px solid var(--warning-500);
  border-radius: var(--radius-sm);
  font-size: 0.82rem;
  color: var(--warning-700);
}

.fc-card-footer {
  text-align: center;
  padding-top: 0.75rem;
  border-top: none;
}

.fc-flip-hint {
  font-size: 0.8rem;
  color: var(--text-muted);
}

/* Action controls */
.fc-action-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1rem;
}

.btn-flip-main {
  padding: 0.8rem 2rem;
  font-size: 1rem;
  font-weight: 700;
  border-radius: var(--radius-sm);
  box-shadow: 0 4px 14px rgba(59, 130, 246, 0.35);
}

/* Spaced Repetition Rating */
.fc-mastery-rating-box {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 1.25rem;
  text-align: center;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.75rem;
}

.fc-mastery-rating-box .rating-title {
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--text-secondary);
  text-transform: none;
  letter-spacing: 0.04em;
}

.rating-buttons {
  display: flex;
  gap: 0.75rem;
  width: 100%;
  max-width: 540px;
}

.btn-rating {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 0.6rem;
  padding: 0.75rem 1rem;
  border-radius: var(--radius-md);
  border: 2px solid transparent;
  cursor: pointer;
  transition: var(--transition);
  background: var(--bg-tertiary);
}

.btn-rating-hard {
  border-color: rgba(239, 68, 68, 0.3);
  color: var(--danger-600);
}

.btn-rating-hard:hover {
  background: var(--danger-50);
  border-color: var(--danger-500);
  transform: translateY(-2px);
}

.btn-rating-medium {
  border-color: rgba(245, 158, 11, 0.3);
  color: var(--warning-600);
}

.btn-rating-medium:hover {
  background: var(--warning-50);
  border-color: var(--warning-500);
  transform: translateY(-2px);
}

.btn-rating-easy {
  border-color: rgba(16, 185, 129, 0.3);
  color: var(--success-600);
}

.btn-rating-easy:hover {
  background: var(--success-50);
  border-color: var(--success-500);
  transform: translateY(-2px);
}

.btn-rating .rating-text {
  display: flex;
  flex-direction: column;
  text-align: left;
}

.btn-rating .rating-text strong {
  font-size: 0.9rem;
}

.btn-rating .rating-text small {
  font-size: 0.7rem;
  opacity: 0.7;
}

/* Quiz mode */
.fc-quiz-panel {
  max-width: 720px;
  margin: 0 auto;
}

.fc-quiz-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2rem;
  box-shadow: var(--shadow-md);
}

.fc-quiz-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 1rem;
}

.fc-quiz-prompt {
  font-size: 1.25rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 1.25rem;
  line-height: 1.4;
}

.fc-quiz-options {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
  margin-bottom: 1.25rem;
}

.fc-quiz-opt {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.85rem 1rem;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-md);
  cursor: pointer;
  transition: var(--transition);
  font-size: 0.95rem;
  color: var(--text-primary);
}

.fc-quiz-opt:hover {
  background: var(--primary-50);
  border-color: var(--primary-500);
}

.fc-quiz-opt.correct {
  background: var(--success-50) !important;
  border-color: var(--success-500) !important;
  color: var(--success-700) !important;
}

.fc-quiz-opt.wrong {
  background: var(--danger-50) !important;
  border-color: var(--danger-500) !important;
  color: var(--danger-700) !important;
}

.fc-quiz-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* Completion summary */
.fc-completion-box {
  max-width: 600px;
  margin: 2rem auto;
  text-align: center;
}

.completion-card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-light);
  border-radius: var(--radius-lg);
  padding: 2.5rem 2rem;
  box-shadow: var(--shadow-xl);
}

.completion-card .trophy-icon {
  font-size: 3.5rem;
  margin-bottom: 0.75rem;
}

.completion-card h2 {
  font-size: 1.75rem;
  font-weight: 800;
  color: var(--text-primary);
  margin-bottom: 0.35rem;
}

.mastery-score-card {
  margin: 1.5rem 0;
  padding: 1.25rem;
  background: var(--bg-tertiary);
  border-radius: var(--radius-md);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 1.25rem;
}

.mastery-percent {
  font-size: 2.5rem;
  font-weight: 900;
  color: var(--success-600);
}

.mastery-meta {
  text-align: left;
  display: flex;
  flex-direction: column;
}

.mastery-meta strong {
  font-size: 1.05rem;
  color: var(--text-primary);
}

.mastery-meta span {
  font-size: 0.85rem;
  color: var(--text-muted);
}

.completion-actions {
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}

/* Dark mode adjustments */
[data-theme="dark"] .fc-card-front {
  background: linear-gradient(180deg, #111827 0%, #1f2937 100%);
}

[data-theme="dark"] .fc-card-back {
  background: linear-gradient(180deg, #111827 0%, rgba(16, 185, 129, 0.12) 100%);
}

[data-theme="dark"] .fc-dropzone {
  background: rgba(139, 92, 246, 0.08);
  border-color: #a78bfa;
}

[data-theme="dark"] .fc-card-tip-box {
  background: rgba(245, 158, 11, 0.15);
  color: #fde68a;
}


/* Clean SVG Indicator Utilities */
.icon-svg {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  fill: currentColor;
  flex-shrink: 0;
}
.icon-svg-stroke {
  display: inline-block;
  width: 1.15em;
  height: 1.15em;
  vertical-align: -0.2em;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
  flex-shrink: 0;
}
.btn .icon-svg-stroke,
.btn .icon-svg,
.badge-pro-pill .icon-svg-stroke,
.btn-unlock-pill .icon-svg-stroke,
.btn-freemium-pill .icon-svg-stroke,
.mode-card h4 .icon-svg-stroke,
.mode-card h4 .icon-svg,
.btn-chip .icon-svg-stroke {
  margin-right: 0.35rem;
}
.indicator-dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  margin-right: 0.4rem;
  vertical-align: 0.08em;
}
.indicator-green {
  background: #10b981;
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.6);
}
.indicator-amber {
  background: #f59e0b;
  box-shadow: 0 0 6px rgba(245, 158, 11, 0.6);
}
.indicator-red {
  background: #ef4444;
  box-shadow: 0 0 6px rgba(239, 68, 68, 0.6);
}

/* Before a deck exists the toolbar is just "Back" and the title */
.fc-toolbar[data-view="generator"] .fc-toolbar-right,
.fc-toolbar[data-view="generator"] #fc-deck-count-badge {
  display: none;
}

#btn-exit-fc {
  white-space: nowrap;
  flex-shrink: 0;
}

.fc-toolbar-left {
  min-width: 0;
}

.fc-deck-badge {
  min-width: 0;
}

#fc-deck-title {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#fc-deck-count-badge {
  white-space: nowrap;
  flex-shrink: 0;
}

/* Phones: title on its own line, deck controls in one tidy row, icon-only "New" */
@media (max-width: 640px) {
  .fc-toolbar {
    padding: 0.75rem;
    gap: 0.6rem;
  }

  .fc-toolbar-left,
  .fc-toolbar-right {
    width: 100%;
    gap: 0.5rem;
  }

  .fc-deck-badge {
    flex: 1;
    font-size: 0.9rem;
  }

  .fc-view-toggle {
    flex: 1;
  }

  .fc-view-toggle .btn-toggle {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.3rem;
    white-space: nowrap;
    padding: 0.45rem 0.4rem;
  }

  #btn-fc-new {
    width: 38px;
    height: 38px;
    padding: 0;
    margin: 0;
    flex-shrink: 0;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }

  #btn-fc-new .fc-btn-label {
    display: none;
  }

  .fc-generator-panel {
    padding: 1rem;
  }

  .fc-generator-panel .freemium-banner {
    padding: 1.1rem !important;
    gap: 0.9rem;
  }

  .fc-generator-panel .freemium-banner-left {
    min-width: 0;
  }

  .fc-generator-panel .freemium-banner-right,
  .fc-generator-panel .freemium-banner .btn-gold {
    width: 100%;
    margin: 0;
    justify-content: center;
  }

  /* Up to two lines for the deck title instead of cutting it off */
  #fc-deck-title {
    white-space: normal;
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    line-height: 1.25;
  }
}
