/* ============================================
   quiz-dev — style.css
   Complément Tailwind : animations, éditeur,
   transitions globales.
   ============================================ */

/* ----- Smooth scroll & base transition ----- */
* {
  scroll-behavior: smooth;
  box-sizing: border-box;
}

/* ----- Flashcard flip animation ----- */

.card-flip {
  perspective: 1000px;
  min-height: 14rem;
}

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

/* When .is-flipped is added to .card-flip, the card rotates */
.card-flip.is-flipped .card-inner {
  transform: rotateY(180deg);
}

.card-front,
.card-back {
  position: absolute;
  inset: 0;
  backface-visibility: hidden;
  -webkit-backface-visibility: hidden;
}

.card-back {
  transform: rotateY(180deg);
}

/* ----- Code editor ----- */

#code-editor {
  font-family: 'Courier New', Courier, monospace;
  line-height: 1.6;
  tab-size: 2;
  letter-spacing: 0.01em;
}

/* ----- Console output ----- */

#console-output {
  font-family: 'Courier New', Courier, monospace;
  font-size: 0.8125rem;
}

/* ----- Exercise list sidebar ----- */

#exercise-list li {
  cursor: pointer;
  transition: background-color 0.15s ease;
  border-left: 3px solid transparent;
}

#exercise-list li:hover {
  background-color: #eff6ff;
}

#exercise-list li.active {
  background-color: #eff6ff;
  border-left-color: #2563eb;
}

/* ----- Filter buttons ----- */

.filter-btn {
  transition: background-color 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.filter-btn.active-theme {
  background-color: #2563eb !important;
  color: #ffffff !important;
  border-color: #2563eb !important;
}

.status-btn.active-status {
  background-color: #1f2937 !important;
  color: #ffffff !important;
}

/* ----- Tab buttons ----- */

.tab-btn {
  transition: background-color 0.15s ease, color 0.15s ease, box-shadow 0.15s ease;
}

/* ----- Timer pulse when low time ----- */

@keyframes pulse-red {
  0%, 100% { color: #dc2626; }
  50%       { color: #fca5a5; }
}

.timer-low {
  animation: pulse-red 1s ease-in-out infinite;
}

/* ----- Feedback box colors ----- */

.feedback-success {
  background-color: #f0fdf4;
  border: 1px solid #86efac;
  color: #15803d;
}

.feedback-error {
  background-color: #fef2f2;
  border: 1px solid #fca5a5;
  color: #dc2626;
}

/* ----- Hint box animation ----- */

#hint-box {
  animation: slideDown 0.25s ease-out;
}

@keyframes slideDown {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}

/* ----- Difficulty badge colors ----- */
.diff-easy   { background-color: #dcfce7; color: #15803d; }
.diff-medium { background-color: #fef9c3; color: #a16207; }
.diff-hard   { background-color: #fee2e2; color: #dc2626; }

/* ----- Output elements styling for MS DOM ----- */
#ms-output .badge {
  display: inline-block;
  padding: 0.25rem 0.65rem;
  margin: 0.2rem;
  font-size: 0.75rem;
  font-weight: 600;
  border-radius: 9999px;
  background-color: #dbeafe;
  color: #1e40af;
  border: 1px solid #bfdbfe;
}

#ms-output .card, #ms-output .movie-card {
  padding: 0.75rem 1rem;
  margin-bottom: 0.5rem;
  border-radius: 0.5rem;
  border: 1px solid #e5e7eb;
  background-color: #f9fafb;
}

#ms-output .card.movie {
  border-left: 4px solid #2563eb;
  background-color: #eff6ff;
}

#ms-output .card.series {
  border-left: 4px solid #16a34a;
  background-color: #f0fdf4;
}

/* ----- Responsive sidebar on small screens ----- */
/* La sidebar se replie en bandeau scrollable (géré par les classes Tailwind
   md:* dans les pages) ; on ne la masque plus. */

/* ----- Touches clavier ----- */
.kbd {
  display: inline-block;
  min-width: 1.5rem;
  padding: 0 0.375rem;
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.6875rem;
  font-weight: 500;
  line-height: 1.25rem;
  text-align: center;
  color: #4b5563;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-bottom-width: 2px;
  border-radius: 0.375rem;
}
.kbd-dark {
  color: #e5e7eb;
  background: rgba(255, 255, 255, 0.08);
  border-color: rgba(255, 255, 255, 0.2);
}

/* ----- Nav mobile : bandeau scrollable sans barre visible ----- */
header nav {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
header nav::-webkit-scrollbar {
  display: none;
}
