/* ============ Awimut Flashcards ============ */

:root {
  --bg-card: var(--paper);
  --text-muted: rgba(19, 26, 34, .62);
  --border: rgba(19, 26, 34, .12);
}
[data-theme="dark"] {
  --text-muted: rgba(236, 237, 237, .62);
  --border: rgba(255, 255, 255, .10);
}

/* Header partagé minimal */
.hub-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 22px;
  border-bottom: 1px solid var(--border);
  background: var(--bg);
  position: sticky;
  top: 0;
  z-index: 50;
}
.hub-header .brand {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  text-decoration: none;
  color: var(--text);
  font-weight: 700;
}
.hub-header .brand-logo {
  width: 36px;
  height: 36px;
  border-radius: 10px;
  background: linear-gradient(135deg, #FF9900, #FF6B00);
  color: white;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
}
.hub-header .brand-name { font-size: 16px; }
.hub-header .brand-name-az { font-weight: 800; }
.hub-header .brand-name-hub { color: var(--text-muted); font-weight: 600; }
.hub-header .header-actions { display: inline-flex; gap: 8px; }
.hub-header .header-btn {
  width: 38px;
  height: 38px;
  border-radius: 10px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text);
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  font-family: inherit;
}
.hub-header .header-btn:hover { border-color: var(--accent); color: var(--accent); }
.theme-icon-sun { display: none; }
.theme-icon-moon { display: inline; }
[data-theme="dark"] .theme-icon-sun { display: inline; }
[data-theme="dark"] .theme-icon-moon { display: none; }

.hub-footer {
  text-align: center;
  padding: 32px 20px;
  border-top: 1px solid var(--border);
  margin-top: 40px;
}
.hub-footer p { margin: 4px 0; color: var(--text-muted); font-size: 13px; }
.hub-footer .footer-credit { color: var(--text); font-weight: 600; }
.hub-footer a { color: var(--accent); text-decoration: none; }
.hub-footer a:hover { text-decoration: underline; }

#flashcards-app {
  max-width: 1100px;
  margin: 0 auto;
  padding: 24px 20px 80px;
  min-height: calc(100vh - 200px);
}

/* ===== Hub ===== */
.fc-intro {
  text-align: center;
  margin-bottom: 32px;
}
.fc-intro h1 {
  font-size: clamp(28px, 5vw, 42px);
  font-weight: 800;
  margin: 0 0 14px;
  color: var(--text);
  line-height: 1.1;
}
.fc-intro p {
  color: var(--text-muted);
  font-size: 16px;
  max-width: 620px;
  margin: 0 auto;
  line-height: 1.6;
}

/* Stats globales */
.fc-stats {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 14px;
  margin-bottom: 24px;
}
@media (max-width: 600px) { .fc-stats { grid-template-columns: 1fr; } }
.fc-stat {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 18px 20px;
  text-align: center;
}
.fc-stat-value {
  font-size: 28px;
  font-weight: 800;
  color: var(--accent);
  line-height: 1;
  margin-bottom: 6px;
}
.fc-stat-label {
  font-size: 13px;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: .5px;
}

/* Sélecteur de rythme */
.fc-pace {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 16px 18px;
  margin-bottom: 20px;
  display: flex;
  align-items: center;
  gap: 14px;
  flex-wrap: wrap;
}
.fc-pace-label {
  font-size: 13px;
  color: var(--text-muted);
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: .5px;
}
.fc-pace-options {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}
.fc-pace-btn {
  background: var(--bg);
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 16px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
  transition: all .2s;
}
.fc-pace-btn:hover { border-color: var(--accent); }
.fc-pace-btn.active {
  background: var(--accent);
  color: white;
  border-color: var(--accent);
}

/* Decks */
.fc-decks {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 16px;
}
@media (max-width: 900px) { .fc-decks { grid-template-columns: repeat(2, 1fr); } }
@media (max-width: 560px) { .fc-decks { grid-template-columns: 1fr; } }
.fc-deck {
  position: relative;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 16px;
  padding: 18px 20px;
  cursor: pointer;
  text-align: left;
  font-family: inherit;
  color: var(--text);
  transition: transform .2s, border-color .2s, box-shadow .2s;
  width: 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
  overflow: hidden;
}
.fc-deck::before {
  content: "";
  position: absolute;
  top: 0; left: 0; right: 0;
  height: 3px;
  background: var(--deck-color, var(--accent));
}
.fc-deck:hover {
  transform: translateY(-2px);
  border-color: var(--deck-color, var(--accent));
  box-shadow: 0 10px 24px rgba(0,0,0,.15);
}
.fc-deck-icon { font-size: 26px; }
.fc-deck-title {
  font-size: 16px;
  font-weight: 700;
  margin: 0;
}
.fc-deck-meta {
  font-size: 12px;
  color: var(--text-muted);
}
.fc-deck-meta strong { color: var(--deck-color, var(--accent)); font-weight: 700; }
.fc-deck-progress {
  height: 4px;
  background: var(--border);
  border-radius: 2px;
  overflow: hidden;
  margin-top: 4px;
}
.fc-deck-progress-fill {
  height: 100%;
  background: var(--deck-color, var(--accent));
  transition: width .4s;
}

/* Bouton "tout réviser" */
.fc-action-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  flex-wrap: wrap;
  gap: 10px;
}
.fc-action-bar h2 {
  font-size: 18px;
  font-weight: 700;
  margin: 0;
  color: var(--text);
}
.fc-reset-progress {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text-muted);
  font-size: 12px;
  padding: 8px 14px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
}
.fc-reset-progress:hover { color: var(--text); border-color: var(--accent); }

/* ===== Session ===== */
.fc-session-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 14px;
  padding: 14px 18px;
  margin-bottom: 22px;
  gap: 12px;
}
.fc-session-back {
  background: transparent;
  border: 1px solid var(--border);
  color: var(--text);
  padding: 8px 12px;
  border-radius: 10px;
  cursor: pointer;
  font-family: inherit;
  font-size: 13px;
  font-weight: 600;
}
.fc-session-back:hover { border-color: var(--accent); }
.fc-session-title { text-align: center; min-width: 0; flex: 1; }
.fc-session-title h2 { margin: 0; font-size: 16px; color: var(--accent); font-weight: 700; }
.fc-session-title p { margin: 2px 0 0; font-size: 12px; color: var(--text-muted); }
.fc-session-counter {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  color: var(--text-muted);
}
.fc-session-counter strong { color: var(--text); }

/* La carte */
.fc-card-stage {
  perspective: 1200px;
  margin: 0 auto 24px;
  max-width: 640px;
  height: 360px;
}
@media (max-width: 600px) { .fc-card-stage { height: 320px; } }

.fc-card {
  position: relative;
  width: 100%;
  height: 100%;
  transform-style: preserve-3d;
  transition: transform .55s cubic-bezier(.4, 0, .2, 1);
  cursor: pointer;
  user-select: none;
}
.fc-card.flipped { transform: rotateY(180deg); }

.fc-card-face {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 22px;
  padding: 28px;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  text-align: center;
  box-shadow: 0 18px 40px rgba(0,0,0,.18);
  overflow: auto;
}
.fc-card-face-back { transform: rotateY(180deg); }
.fc-card-tag {
  position: absolute;
  top: 14px;
  left: 18px;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--text-muted);
  font-weight: 600;
}
.fc-card-tip {
  position: absolute;
  bottom: 14px;
  font-size: 11px;
  color: var(--text-muted);
  letter-spacing: .5px;
}
.fc-card-q {
  font-size: clamp(20px, 3vw, 26px);
  font-weight: 700;
  color: var(--text);
  line-height: 1.3;
  max-width: 90%;
}
.fc-card-a {
  font-size: clamp(15px, 2vw, 18px);
  color: var(--text);
  line-height: 1.55;
  max-width: 92%;
}
.fc-card-a strong { color: var(--accent); }

/* Animations swipe */
.fc-card-stage.leave-left { animation: leaveLeft .35s ease forwards; }
.fc-card-stage.leave-right { animation: leaveRight .35s ease forwards; }
.fc-card-stage.enter { animation: enterCard .35s ease; }
@keyframes leaveLeft {
  to { transform: translateX(-130%) rotate(-12deg); opacity: 0; }
}
@keyframes leaveRight {
  to { transform: translateX(130%) rotate(12deg); opacity: 0; }
}
@keyframes enterCard {
  from { transform: translateY(20px) scale(.96); opacity: 0; }
  to { transform: translateY(0) scale(1); opacity: 1; }
}

/* Boutons d'action */
.fc-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  margin-top: 8px;
}
.fc-action {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: var(--bg-card);
  cursor: pointer;
  font-size: 26px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .2s, border-color .2s;
  font-family: inherit;
  color: var(--text);
}
.fc-action:hover { transform: translateY(-3px); }
.fc-action.fc-action-bad { border-color: rgba(255,107,107,.5); color: #ff6b6b; }
.fc-action.fc-action-bad:hover { border-color: #ff6b6b; }
.fc-action.fc-action-soon { border-color: rgba(255,153,0,.5); color: #FF9900; }
.fc-action.fc-action-soon:hover { border-color: #FF9900; }
.fc-action.fc-action-good { border-color: rgba(81,207,102,.5); color: #51cf66; }
.fc-action.fc-action-good:hover { border-color: #51cf66; }
.fc-action-label {
  display: block;
  font-size: 11px;
  text-transform: uppercase;
  letter-spacing: .5px;
  margin-top: 6px;
  color: var(--text-muted);
  text-align: center;
}
.fc-action-wrap {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
}

.fc-progress-bar {
  height: 6px;
  background: var(--border);
  border-radius: 3px;
  overflow: hidden;
  margin: 18px auto 0;
  max-width: 640px;
}
.fc-progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, #FF9900, #ffd43b);
  transition: width .3s;
}

/* Écran fin de session */
.fc-end {
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-radius: 18px;
  padding: 40px 28px;
  text-align: center;
  max-width: 520px;
  margin: 40px auto;
}
.fc-end-icon { font-size: 64px; margin-bottom: 14px; }
.fc-end h2 { font-size: 26px; font-weight: 800; margin: 0 0 12px; color: var(--text); }
.fc-end p { color: var(--text-muted); margin: 0 0 20px; }
.fc-end-stats {
  display: flex;
  gap: 14px;
  justify-content: center;
  margin: 18px 0;
  flex-wrap: wrap;
}
.fc-end-actions {
  display: flex;
  gap: 12px;
  justify-content: center;
  flex-wrap: wrap;
  margin-top: 12px;
}
.fc-end-btn {
  padding: 12px 22px;
  border-radius: 12px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  font-size: 14px;
  border: 1px solid var(--border);
  background: var(--bg);
  color: var(--text);
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  transition: transform .2s;
}
.fc-end-btn.primary {
  background: linear-gradient(135deg, #FF9900, #FF6B00);
  color: white;
  border: none;
}
.fc-end-btn:hover { transform: translateY(-2px); }
