/* ============================================
   EXPAND CONTENT — Rich Expandable Sections
   ============================================ */

/* Section List */
.expand-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Expandable Item */
.expand-item {
  background: var(--card);
  border: 1.5px solid var(--ab);
  border-radius: var(--r);
  overflow: hidden;
  transition: all .3s ease;
}

.expand-item:hover {
  border-color: var(--a);
  box-shadow: var(--sh);
}

.expand-item.g:hover {
  border-color: var(--gold);
  box-shadow: 0 4px 24px rgba(201, 150, 10, .12);
}

.expand-item.active {
  border-color: var(--a);
  box-shadow: var(--sh2);
}

.expand-item.g.active {
  border-color: var(--gold);
  box-shadow: 0 8px 32px rgba(201, 150, 10, .18);
}

/* Header (clickable) */
.expand-head {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 18px;
  cursor: pointer;
  user-select: none;
  transition: background .2s;
}

.expand-head:hover {
  background: var(--al);
}

.expand-item.g .expand-head:hover {
  background: var(--gl);
}

.expand-ico {
  width: 40px;
  height: 40px;
  border-radius: 10px;
  background: var(--al);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--a);
  font-size: .9rem;
  flex-shrink: 0;
  transition: all .3s;
}

.expand-item.g .expand-ico {
  background: var(--gl);
  color: var(--gold);
}

.expand-item.active .expand-ico {
  background: linear-gradient(135deg, var(--a), var(--a2));
  color: #fff;
  box-shadow: 0 4px 12px rgba(91, 53, 232, .3);
}

.expand-item.g.active .expand-ico {
  background: linear-gradient(135deg, var(--gold), var(--g2));
  color: #1a0a00;
  box-shadow: 0 4px 12px rgba(201, 150, 10, .3);
}

.expand-info {
  flex: 1;
  min-width: 0;
}

.expand-name {
  font-family: var(--font-title);
  font-size: .9rem;
  font-weight: 700;
  color: var(--text);
  margin-bottom: 2px;
}

.expand-sub {
  font-size: .75rem;
  color: var(--muted);
  line-height: 1.4;
}

.expand-tags {
  display: flex;
  gap: 5px;
  flex-wrap: wrap;
  margin-top: 4px;
}

.expand-tag {
  font-size: .6rem;
  padding: 2px 7px;
  border-radius: 100px;
  background: var(--al);
  color: var(--a);
  border: 1px solid var(--ab);
  font-weight: 600;
}

.expand-item.g .expand-tag {
  background: var(--gl);
  color: var(--gold);
  border-color: var(--gb);
}

.expand-arrow {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  background: var(--bg);
  border: 1px solid var(--ab);
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--muted);
  font-size: .7rem;
  flex-shrink: 0;
  transition: all .3s;
}

.expand-item.active .expand-arrow {
  transform: rotate(180deg);
  background: var(--al);
  color: var(--a);
  border-color: var(--a);
}

.expand-item.g.active .expand-arrow {
  background: var(--gl);
  color: var(--gold);
  border-color: var(--gold);
}

/* Body (expandable content) */
.expand-body {
  max-height: 0;
  overflow: hidden;
  transition: max-height .5s cubic-bezier(.4, 0, .2, 1);
}

.expand-item.active .expand-body {
  max-height: 2000px;
}

.expand-content {
  padding: 0 18px 18px;
  border-top: 1px solid var(--ab);
  margin-top: 0;
  padding-top: 16px;
}

.expand-item.g .expand-content {
  border-top-color: var(--gb);
}

/* Content Styling */
.expand-content p {
  color: var(--text2);
  font-size: .84rem;
  line-height: 1.75;
  margin-bottom: 12px;
}

.expand-content strong,
.expand-content b {
  color: var(--text);
  font-weight: 600;
}

.expand-content ul,
.expand-content ol {
  padding-left: 20px;
  color: var(--text2);
  font-size: .84rem;
  margin-bottom: 12px;
}

.expand-content li {
  margin-bottom: 6px;
  line-height: 1.6;
}

.expand-content h3 {
  font-family: var(--font-title);
  font-size: .88rem;
  font-weight: 700;
  color: var(--text);
  margin: 14px 0 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.expand-content h3 i {
  color: var(--a);
  font-size: .8rem;
}

.expand-item.g .expand-content h3 i {
  color: var(--gold);
}

/* Tip Box inside content */
.expand-tip {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(34, 197, 94, .06);
  border: 1px solid rgba(34, 197, 94, .18);
  font-size: .8rem;
  color: var(--text2);
  line-height: 1.6;
  margin: 10px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.expand-tip i {
  color: #22c55e;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Warning box */
.expand-warn {
  padding: 12px 14px;
  border-radius: 10px;
  background: rgba(239, 68, 68, .06);
  border: 1px solid rgba(239, 68, 68, .18);
  font-size: .8rem;
  color: var(--text2);
  line-height: 1.6;
  margin: 10px 0;
  display: flex;
  gap: 10px;
  align-items: flex-start;
}

.expand-warn i {
  color: #ef4444;
  margin-top: 2px;
  flex-shrink: 0;
}

/* Example Box */
.expand-example {
  padding: 12px 14px;
  border-radius: 10px;
  background: var(--al);
  border: 1px solid var(--ab);
  font-size: .8rem;
  color: var(--text2);
  line-height: 1.6;
  margin: 10px 0;
}

.expand-item.g .expand-example {
  background: var(--gl);
  border-color: var(--gb);
}

.expand-example strong {
  color: var(--a);
}

.expand-item.g .expand-example strong {
  color: var(--gold);
}

/* Step counter inside content */
.expand-step {
  display: flex;
  gap: 12px;
  align-items: flex-start;
  margin-bottom: 12px;
}

.expand-step-num {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--a), var(--a2));
  color: #fff;
  font-size: .7rem;
  font-weight: 800;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  font-family: var(--font-title);
}

.expand-item.g .expand-step-num {
  background: linear-gradient(135deg, var(--gold), var(--g2));
  color: #1a0a00;
}

.expand-step-text {
  font-size: .82rem;
  color: var(--text2);
  line-height: 1.65;
  padding-top: 2px;
}

/* Progress indicator */
.expand-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 10px;
  padding-top: 10px;
  border-top: 1px solid var(--ab);
}

.expand-progress-bar {
  flex: 1;
  height: 4px;
  border-radius: 4px;
  background: var(--ab);
  overflow: hidden;
}

.expand-progress-fill {
  height: 100%;
  border-radius: 4px;
  background: linear-gradient(90deg, var(--a), var(--a2));
  transition: width .5s ease;
}

.expand-item.g .expand-progress-fill {
  background: linear-gradient(90deg, var(--gold), var(--g2));
}

.expand-progress-label {
  font-size: .68rem;
  font-weight: 700;
  color: var(--muted);
  white-space: nowrap;
}

/* Section header divider */
.expand-section-title {
  font-family: var(--font-title);
  font-size: .72rem;
  font-weight: 800;
  letter-spacing: .08em;
  text-transform: uppercase;
  color: var(--muted);
  padding: 16px 0 8px;
  display: flex;
  align-items: center;
  gap: 8px;
}

.expand-section-title::after {
  content: '';
  flex: 1;
  height: 1px;
  background: var(--ab);
}

/* Stats row inside expanded */
.expand-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(100px, 1fr));
  gap: 8px;
  margin: 10px 0;
}

.expand-stat {
  padding: 10px;
  border-radius: 9px;
  background: var(--bg);
  border: 1px solid var(--ab);
  text-align: center;
}

.expand-stat-val {
  font-family: var(--font-title);
  font-size: 1rem;
  font-weight: 800;
  color: var(--a);
}

.expand-item.g .expand-stat-val {
  color: var(--gold);
}

.expand-stat-lab {
  font-size: .65rem;
  color: var(--muted);
  margin-top: 2px;
}

/* ── Nova Insight banner ── */
.nova-insight {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(91, 53, 232, 0.14), rgba(91, 53, 232, 0.04));
  border: 1.5px solid var(--ab);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s, transform 0.2s;
}

.nova-insight:hover {
  border-color: var(--a);
  box-shadow: var(--sh);
  transform: translateY(-1px);
}

.nova-insight > i:first-child {
  flex-shrink: 0;
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, var(--a), var(--a2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.95rem;
  box-shadow: 0 4px 12px rgba(91, 53, 232, 0.35);
}

.nova-insight > div {
  flex: 1;
  min-width: 0;
}

.nova-insight strong {
  color: var(--text);
  font-size: 0.82rem;
}

.nova-insight p {
  margin: 6px 0 0;
  font-size: 0.84rem;
  line-height: 1.55;
  color: var(--text2);
}

.nova-insight > i:last-child {
  flex-shrink: 0;
  margin-top: 4px;
  opacity: 0.45;
  font-size: 0.75rem;
}

.theme-prime .nova-insight > i:first-child,
body.theme-prime .nova-insight > i:first-child {
  background: linear-gradient(135deg, var(--gold), var(--g2));
  color: #1a0a00;
  box-shadow: 0 4px 12px rgba(201, 150, 10, 0.35);
}

/* ── Générateur flashcards ── */
.fc-generator--compact {
  margin-bottom: 20px;
}

.fc-generator--compact .fc-generator-head {
  padding: 16px 18px 0;
}

.fc-generator--compact .fc-generator-body {
  padding: 12px 18px 18px;
}

.fc-generator--compact .fc-generator-textarea {
  min-height: 100px;
}

.fc-generator {
  margin-bottom: 36px;
  border-radius: 20px;
  border: 1.5px solid var(--ab);
  background: var(--card);
  overflow: hidden;
  box-shadow: var(--sh);
}

.fc-generator-head {
  display: flex;
  align-items: flex-start;
  gap: 14px;
  padding: 22px 24px 0;
}

.fc-generator-icon {
  flex-shrink: 0;
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: linear-gradient(135deg, var(--a), var(--a2));
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.1rem;
  box-shadow: 0 6px 16px rgba(91, 53, 232, 0.35);
}

.fc-generator-title {
  font-family: var(--font-title);
  font-size: 1.05rem;
  font-weight: 800;
  color: var(--text);
  margin: 0 0 6px;
  line-height: 1.25;
}

.fc-generator-sub {
  margin: 0;
  font-size: 0.84rem;
  line-height: 1.5;
  color: var(--text2);
}

.fc-generator-body {
  padding: 20px 24px 24px;
}

.fc-generator-field label {
  display: block;
  font-size: 0.72rem;
  font-weight: 700;
  letter-spacing: 0.06em;
  text-transform: uppercase;
  color: var(--muted);
  margin-bottom: 8px;
}

.fc-generator-textarea {
  width: 100%;
  min-height: 140px;
  padding: 16px 18px;
  border-radius: 14px;
  border: 1.5px solid var(--ab);
  background: var(--bg);
  color: var(--text);
  font-family: var(--font-body);
  font-size: 0.9rem;
  line-height: 1.55;
  resize: vertical;
  outline: none;
  box-sizing: border-box;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.fc-generator-textarea::placeholder {
  color: var(--muted);
  opacity: 0.85;
}

.fc-generator-textarea:focus {
  border-color: var(--a);
  box-shadow: 0 0 0 3px rgba(91, 53, 232, 0.15);
}

.fc-generator-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 8px;
  font-size: 0.72rem;
  color: var(--muted);
}

.fc-generator-btn {
  width: 100%;
  margin-top: 16px;
  padding: 14px 20px;
  border: none;
  border-radius: 12px;
  font-family: var(--font-title);
  font-size: 0.92rem;
  font-weight: 800;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  background: linear-gradient(135deg, var(--a), var(--a2));
  box-shadow: 0 6px 20px rgba(91, 53, 232, 0.35);
  transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
}

.fc-generator-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 10px 28px rgba(91, 53, 232, 0.45);
}

.fc-generator-btn:disabled {
  opacity: 0.55;
  cursor: not-allowed;
  transform: none;
}

.fc-results {
  display: none;
  margin-top: 0;
  padding: 0 24px 24px;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
}

.fc-results.is-visible {
  display: grid;
}

.fc-results-loading,
.fc-results-error {
  grid-column: 1 / -1;
  text-align: center;
  padding: 24px 16px;
  font-size: 0.88rem;
  color: var(--muted);
}

.fc-results-error {
  color: var(--red, #ef4444);
}

.fc-card {
  height: 160px;
  cursor: pointer;
  border-radius: 14px;
  overflow: hidden;
}

.fc-card-inner {
  position: relative;
  width: 100%;
  height: 100%;
}

.fc-card-face {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  padding: 16px;
  border-radius: 14px;
  border: 1.5px solid var(--ab);
  text-align: center;
  font-size: 0.82rem;
  line-height: 1.45;
  transition: opacity 0.28s ease, transform 0.28s ease;
  box-sizing: border-box;
}

.fc-card-front {
  background: var(--bg2);
  color: var(--text);
  font-weight: 700;
  opacity: 1;
  transform: scale(1);
  z-index: 2;
}

.fc-card-back {
  background: linear-gradient(160deg, var(--al) 0%, var(--bg2) 100%);
  color: var(--a);
  font-weight: 600;
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
  z-index: 1;
}

.fc-card.is-flipped .fc-card-front {
  opacity: 0;
  transform: scale(0.97);
  pointer-events: none;
}

.fc-card.is-flipped .fc-card-back {
  opacity: 1;
  transform: scale(1);
  pointer-events: auto;
}

.fc-card-label {
  font-size: 0.62rem;
  font-weight: 800;
  letter-spacing: 0.08em;
  text-transform: uppercase;
  color: var(--muted);
}

.fc-card.is-flipped .fc-card-label {
  color: var(--a);
}

.fc-card-text {
  max-width: 100%;
  word-break: break-word;
}

.fc-card-hint {
  grid-column: 1 / -1;
  text-align: center;
  font-size: 0.72rem;
  color: var(--muted);
  margin-top: 4px;
}

/* Legacy aliases — même logique opacity (pas de texte miroir) */
.flashcard { height: 160px; cursor: pointer; border-radius: 14px; overflow: hidden; }
.flashcard-inner { position: relative; width: 100%; height: 100%; }
.flashcard-front, .flashcard-back {
  position: absolute; inset: 0;
  display: flex; flex-direction: column; align-items: center; justify-content: center; gap: 8px;
  padding: 16px; border-radius: 14px; border: 1.5px solid var(--ab);
  text-align: center; font-size: 0.82rem; line-height: 1.45;
  transition: opacity 0.28s ease, transform 0.28s ease;
}
.flashcard-front { background: var(--bg2); color: var(--text); font-weight: 700; opacity: 1; z-index: 2; }
.flashcard-back {
  background: linear-gradient(160deg, var(--al), var(--bg2));
  color: var(--a); opacity: 0; transform: scale(0.97); pointer-events: none;
}
.flashcard.flipped .flashcard-front { opacity: 0; pointer-events: none; }
.flashcard.flipped .flashcard-back { opacity: 1; transform: scale(1); pointer-events: auto; }

/* Responsive */
@media (max-width: 768px) {
  .expand-head {
    padding: 12px 14px;
  }

  .expand-ico {
    width: 34px;
    height: 34px;
    font-size: .8rem;
  }

  .expand-name {
    font-size: .84rem;
  }

  .expand-content {
    padding: 0 14px 14px;
    padding-top: 14px;
  }

  .fc-generator-head,
  .fc-generator-body {
    padding-left: 18px;
    padding-right: 18px;
  }

  .fc-results {
    padding-left: 18px;
    padding-right: 18px;
  }
}
