/* Layout général de l’application d’apprentissage */

.ai-app {
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: #222;
  max-width: 1100px;
  margin: 0 auto;
  padding: 16px;
  box-sizing: border-box;
}

.ai-header {
  display: flex;
  justify-content: space-between;
  gap: 16px;
  align-items: flex-end;
  margin-bottom: 12px;
  flex-wrap: wrap;
}

.ai-course-title {
  margin: 0;
  font-size: 1.5rem;
}

.ai-section-title {
  margin: 4px 0 0;
  color: #555;
}

.ai-meta {
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
  align-items: center;
}

.ai-tag {
  background: #f0f4ff;
  color: #335;
  padding: 4px 8px;
  border-radius: 999px;
  font-size: 0.8rem;
}

/* Barre de progression */

.ai-progress {
  width: 100%;
  height: 8px;
  background: #eee;
  border-radius: 999px;
  overflow: hidden;
  margin-bottom: 16px;
}

.ai-progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #0073aa, #00c476);
  transition: width 0.4s ease;
}

/* Layout principal */

.ai-layout {
  display: grid;
  grid-template-columns: minmax(0, 2fr) minmax(260px, 1fr);
  gap: 16px;
  align-items: flex-start;
}

.ai-main {
  min-height: 260px;
}

.ai-side {
  border-left: 1px solid #eee;
  padding-left: 16px;
}

.ai-step-title {
  margin: 0 0 8px;
  font-size: 1.2rem;
}

.ai-step-content {
  min-height: 220px;
}

.ai-panel {
  background: #fafafa;
  border-radius: 8px;
  padding: 12px 14px;
  box-shadow: 0 0 0 1px #eee;
}

.ai-panel p {
  margin: 0 0 8px;
}

.ai-panel p:last-child {
  margin-bottom: 0;
}

.ai-panel-flash {
  border-left: 4px solid #ffb347;
}

/* Timer & contrôles */

.ai-timer {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 8px;
}

.ai-timer-label {
  font-size: 0.9rem;
  color: #555;
}

.ai-timer-value {
  font-weight: 600;
}

.ai-controls {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 16px;
}

.ai-btn {
  border-radius: 6px;
  border: none;
  cursor: pointer;
  font-size: 0.9rem;
  padding: 8px 10px;
  text-align: center;
}

.ai-btn-primary {
  background: #0073aa;
  color: #fff;
}

.ai-btn-primary:hover {
  background: #005f8d;
}

.ai-btn-secondary {
  background: #e9f3ff;
  color: #005f8d;
}

.ai-btn-secondary:hover {
  background: #d0e7ff;
}

.ai-btn-ghost {
  background: transparent;
  color: #0073aa;
  border: 1px solid #d0e0f0;
}

.ai-btn-ghost[disabled] {
  opacity: 0.4;
  cursor: default;
}

.ai-btn-ghost:not([disabled]):hover {
  background: #f5f8ff;
}

/* Banque de mots */

.ai-side-title {
  margin: 0 0 6px;
  font-size: 0.9rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: #666;
}

.ai-word-bank-wrapper {
  margin-bottom: 20px;
}

.ai-word-bank {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.ai-word-bank-empty {
  font-size: 0.85rem;
  color: #777;
}

.ai-token {
  border-radius: 999px;
  border: none;
  padding: 4px 8px;
  font-size: 0.85rem;
  background: #ffffff;
  box-shadow: 0 0 0 1px #d0d0d0;
  cursor: pointer;
}

.ai-token:hover {
  background: #f0f4ff;
}

.ai-token--active {
  box-shadow: 0 0 0 2px #0073aa;
}

.ai-token--used {
  opacity: 0.4;
  cursor: default;
}

/* Trous à remplir */

.ai-blank {
  min-width: 60px;
  min-height: 20px;
  border-radius: 4px;
  border: 1px dashed #bbb;
  background: #fff;
  padding: 1px 4px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  margin: 0 2px;
  font-size: 0.9rem;
  cursor: pointer;
}

.ai-blank--hover {
  border-color: #0073aa;
  background: #f0f6ff;
}

.ai-blank--filled {
  border-style: solid;
}

.ai-blank--correct {
  background: #e2ffe8;
  border-color: #2f9e44;
  color: #205b2e;
}

.ai-blank--wrong {
  background: #ffe2e2;
  border-color: #e03131;
  color: #7a1111;
}

/* Infos & feedback */

.ai-info {
  font-size: 0.85rem;
  color: #555;
}

.ai-step-info {
  margin: 0;
}

.ai-feedback {
  margin-top: 10px;
  padding-top: 8px;
  border-top: 1px dashed #ddd;
  font-size: 0.9rem;
}

/* QCM */

.ai-question {
  border: 1px solid #eee;
  border-radius: 6px;
  padding: 8px 10px;
  margin-bottom: 10px;
}

.ai-question legend {
  font-weight: 600;
  margin-bottom: 4px;
}

.ai-choice {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.9rem;
  margin-bottom: 4px;
}

.ai-choice input[type="radio"] {
  margin: 0;
}

.ai-quiz-submit {
  margin-top: 8px;
}

.ai-quiz-score {
  margin-top: 12px;
  padding: 8px;
  border-radius: 6px;
  background: #eefaf2;
}

.ai-qcm-good,
.ai-qcm-bad {
  margin: 6px 0;
  padding: 6px 8px;
  border-radius: 4px;
  font-size: 0.9rem;
}

.ai-qcm-good {
  background: #e9ffe9;
  border: 1px solid #b2e8b2;
}

.ai-qcm-bad {
  background: #ffe9e9;
  border: 1px solid #e8b2b2;
}

/* Footer / navigation sections */

.ai-footer {
  margin-top: 18px;
}

.ai-section-nav {
  display: flex;
  justify-content: space-between;
}

/* Responsive */

@media (max-width: 800px) {
  .ai-layout {
    grid-template-columns: 1fr;
  }

  .ai-side {
    border-left: none;
    border-top: 1px solid #eee;
    padding-left: 0;
    padding-top: 12px;
  }

  .ai-header {
    align-items: flex-start;
  }
}
