/* ============================================================
   FLASHCARD LIBRARY — Main Page Styling
   ============================================================ */

.flashcards-body {
  background: linear-gradient(180deg, #F3E8FF 0%, #FFFFFF 100%);
  min-height: 100vh;
}

.text-gradient {
  background: linear-gradient(90deg, #8B5CF6, #EC4899);
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  color: transparent;
}

/* ============================================================
   HERO
   ============================================================ */
.fc-hero {
  padding: 40px 0 32px;
  text-align: center;
}

.fc-hero-title {
  font-family: 'Fredoka', sans-serif;
  font-size: clamp(1.6rem, 6vw, 2.4rem);
  font-weight: 700;
  color: #0F172A;
  margin: 0 0 12px;
  line-height: 1.15;
}

.fc-hero-subtitle {
  font-size: .95rem;
  color: #64748B;
  max-width: 560px;
  margin: 0 auto 24px;
  line-height: 1.5;
}

.fc-hero-stats {
  display: flex;
  justify-content: center;
  gap: 24px;
  list-style: none;
  padding: 0;
  margin: 0;
}

.fc-hero-stats li {
  text-align: center;
}

.fc-hero-stats strong {
  display: block;
  font-family: 'Fredoka', sans-serif;
  font-size: 1.5rem;
  font-weight: 700;
  color: #8B5CF6;
  line-height: 1;
}

.fc-hero-stats span {
  font-size: .75rem;
  color: #64748B;
  font-weight: 600;
}

/* ============================================================
   CONTROLS
   ============================================================ */
.fc-controls {
  padding: 0 0 24px;
}

.fc-controls-panel {
  background: #fff;
  border-radius: 24px;
  padding: 20px;
  box-shadow: 0 8px 24px rgba(15,23,42,.06);
  display: grid;
  gap: 16px;
}

/* Search */
.fc-search {
  position: relative;
  display: flex;
  align-items: center;
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 14px;
  padding: 0 16px;
  transition: all .2s cubic-bezier(.4,0,.2,1);
}

.fc-search:focus-within {
  border-color: #8B5CF6;
  box-shadow: 0 0 0 4px rgba(139,92,246,.1);
  background: #fff;
}

.fc-search svg {
  flex-shrink: 0;
  color: #94A3B8;
}

.fc-search input {
  flex: 1;
  border: none;
  outline: none;
  background: transparent;
  padding: 14px 12px;
  font-family: 'Nunito', sans-serif;
  font-size: .95rem;
  font-weight: 600;
  color: #0F172A;
}

.fc-search input::placeholder {
  color: #CBD5E1;
  font-weight: 400;
}

.fc-search-clear {
  flex-shrink: 0;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  background: #E2E8F0;
  color: #64748B;
  cursor: pointer;
  font-size: 1.2rem;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all .2s;
}

.fc-search-clear:hover {
  background: #CBD5E1;
  color: #0F172A;
}

/* Option group */
.fc-option-group {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.fc-option-full {
  grid-column: 1 / -1;
}

.fc-option-label {
  font-family: 'Fredoka', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  color: #0B2D6B;
}

/* Size tabs */
.fc-size-tabs {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}

.fc-size-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  transition: all .2s cubic-bezier(.4,0,.2,1);
}

.fc-size-tab:hover {
  border-color: #8B5CF6;
  transform: translateY(-2px);
}

.fc-size-tab.active {
  background: #F3E8FF;
  border-color: #8B5CF6;
  box-shadow: 0 4px 12px rgba(139,92,246,.2);
}

.fc-size-icon {
  font-size: 1rem;
  line-height: 1;
}

.fc-size-name {
  font-family: 'Fredoka', sans-serif;
  font-size: .85rem;
  font-weight: 700;
  color: #0B2D6B;
}

.fc-size-desc {
  font-size: .65rem;
  color: #64748B;
  font-weight: 600;
}

/* Toggle tabs */
.fc-toggle-tabs {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 6px;
}

.fc-toggle-tab {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 12px 8px;
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 12px;
  cursor: pointer;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: .85rem;
  color: #0B2D6B;
  transition: all .2s cubic-bezier(.4,0,.2,1);
}

.fc-toggle-tab:hover {
  border-color: #8B5CF6;
}

.fc-toggle-tab.active {
  background: #F3E8FF;
  border-color: #8B5CF6;
  color: #7C3AED;
  box-shadow: 0 4px 12px rgba(139,92,246,.2);
}

/* Category filters */
.fc-category-filters {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.fc-cat-chip {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 8px 14px;
  background: #F8FAFC;
  border: 2px solid #E2E8F0;
  border-radius: 999px;
  cursor: pointer;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  font-size: .8rem;
  color: #0B2D6B;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  white-space: nowrap;
}

.fc-cat-chip:hover {
  border-color: #8B5CF6;
  transform: translateY(-1px);
}

.fc-cat-chip.active {
  background: linear-gradient(135deg, #8B5CF6, #A78BFA);
  border-color: transparent;
  color: #fff;
  box-shadow: 0 4px 12px rgba(139,92,246,.3);
}

.fc-cat-chip-icon {
  font-size: 1rem;
}

.fc-cat-chip-count {
  font-size: .7rem;
  opacity: .7;
}

/* Actions */
.fc-actions {
  display: grid;
  grid-template-columns: 1fr 1fr 1.5fr;
  gap: 8px;
  padding-top: 8px;
  border-top: 1px dashed #E2E8F0;
}

.fc-action-btn {
  padding: 12px 16px;
  border-radius: 12px;
  border: none;
  cursor: pointer;
  font-family: 'Fredoka', sans-serif;
  font-weight: 700;
  font-size: .85rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all .2s cubic-bezier(.4,0,.2,1);
}

.fc-action-btn:hover {
  transform: translateY(-2px);
}

.fc-action-secondary {
  background: #F8FAFC;
  color: #0B2D6B;
  border: 2px solid #E2E8F0;
}

.fc-action-secondary:hover {
  background: #fff;
  border-color: #8B5CF6;
  color: #7C3AED;
}

.fc-action-primary {
  background: linear-gradient(135deg, #8B5CF6, #A78BFA);
  color: #fff;
  box-shadow: 0 6px 16px rgba(139,92,246,.35);
}

.fc-action-primary:hover {
  box-shadow: 0 10px 24px rgba(139,92,246,.45);
}

.fc-action-primary:disabled {
  opacity: .4;
  cursor: not-allowed;
  box-shadow: none;
  transform: none;
}

/* Info */
.fc-info {
  font-size: .78rem;
  color: #64748B;
  margin: 0;
  text-align: center;
  font-style: italic;
}

/* ============================================================
   GRID
   ============================================================ */
.fc-grid-section {
  padding: 0 0 60px;
}

.fc-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(130px, 1fr));
  gap: 12px;
}

.fc-card {
  position: relative;
  aspect-ratio: 1;
  background: #fff;
  border: 3px solid #E2E8F0;
  border-radius: 18px;
  cursor: pointer;
  padding: 8px;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  transition: all .2s cubic-bezier(.4,0,.2,1);
  overflow: hidden;
  box-shadow: 0 4px 12px rgba(15,23,42,.05);
}

.fc-card:hover {
  border-color: #8B5CF6;
  transform: translateY(-4px);
  box-shadow: 0 12px 28px rgba(139,92,246,.2);
}

.fc-card.selected {
  border-color: #8B5CF6;
  background: #F3E8FF;
  box-shadow: 0 8px 24px rgba(139,92,246,.35), 0 0 0 3px rgba(139,92,246,.2);
}

.fc-card.selected::after {
  content: "✓";
  position: absolute;
  top: 8px;
  right: 10px;
  width: 26px;
  height: 26px;
  background: #8B5CF6;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: .85rem;
  font-family: 'Fredoka', sans-serif;
  box-shadow: 0 4px 12px rgba(139,92,246,.4);
  animation: fcCheckPop .3s cubic-bezier(.34,1.56,.64,1);
}

@keyframes fcCheckPop {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

.fc-card-image {
  flex: 1;
  width: 100%;
  display: flex;
  align-items: center;
  justify-content: center;
  min-height: 0;
}

.fc-card-image svg {
  width: 100%;
  height: 100%;
  max-width: 100px;
  max-height: 100px;
  display: block;
}

.fc-card-label {
  font-family: 'Fredoka', sans-serif;
  font-size: .75rem;
  font-weight: 700;
  color: #0B2D6B;
  text-align: center;
  text-transform: uppercase;
  letter-spacing: .02em;
  line-height: 1.1;
  padding: 0 4px;
  word-break: break-word;
  min-height: 1.2em;
}

.fc-card.no-label .fc-card-label {
  display: none;
}

/* Empty state */
.fc-empty {
  text-align: center;
  padding: 60px 20px;
  color: #94A3B8;
}

.fc-empty-icon {
  font-size: 4rem;
  margin-bottom: 12px;
  opacity: .6;
}

.fc-empty-title {
  font-family: 'Fredoka', sans-serif;
  font-size: 1.2rem;
  font-weight: 700;
  color: #475569;
  margin: 0 0 6px;
}

.fc-empty-desc {
  font-size: .9rem;
  margin: 0;
}

/* ============================================================
   RESPONSIVE
   ============================================================ */
@media (min-width: 640px) {
  .fc-controls-panel {
    padding: 24px;
    grid-template-columns: 1fr 1fr;
  }

  .fc-search {
    grid-column: 1 / -1;
  }

  .fc-grid {
    grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
    gap: 16px;
  }

  .fc-card-image svg {
    max-width: 120px;
    max-height: 120px;
  }

  .fc-card-label {
    font-size: .85rem;
  }
}

@media (min-width: 1024px) {
  .fc-controls-panel {
    grid-template-columns: 2fr 1fr 1fr;
  }

  .fc-search {
    grid-column: 1 / -1;
  }

  .fc-option-full {
    grid-column: 1 / -1;
  }

  .fc-actions {
    grid-column: 1 / -1;
    grid-template-columns: auto auto 1fr;
    justify-content: flex-end;
  }

  .fc-info {
    grid-column: 1 / -1;
  }

  .fc-grid {
    grid-template-columns: repeat(auto-fill, minmax(170px, 1fr));
  }

  .fc-card-image svg {
    max-width: 140px;
    max-height: 140px;
  }
}

/* ============================================================
   A11Y
   ============================================================ */
@media (prefers-reduced-motion: reduce) {
  .fc-card,
  .fc-size-tab,
  .fc-toggle-tab,
  .fc-cat-chip,
  .fc-action-btn {
    transition: none;
  }
}