/* ============================================================================
   ECOL2.COM - STYLES GLOBAUX
   ============================================================================ */

:root {
  --primary: #0d6efd;
  --success: #059669;
  --warning: #d97706;
  --purple: #7c3aed;
  --gray-50: #f8f9fa;
  --gray-100: #e2e8f0;
  --gray-700: #334155;
  --transition: all 0.2s ease;
}

/* ============================================================================
   BASE & TYPOGRAPHY
   ============================================================================ */

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  line-height: 1.6;
}

.feature-icon {
  width: 4rem;
  height: 4rem;
  border-radius: 0.75rem;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.icon-link {
  text-decoration: none;
  transition: var(--transition);
}

.icon-link:hover {
  text-decoration: underline;
  transform: translateX(4px);
}

/* ============================================================================
   QUIZ CONTAINERS
   ============================================================================ */

.quiz-container {
  max-width: 900px;
  margin: 0 auto;
}

/* Theme Cards */
.theme-card {
  cursor: pointer;
  transition: var(--transition);
  border: 2px solid var(--gray-100);
  height: 100%;
}

.theme-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.1);
}

.theme-card.primary:hover { border-color: var(--primary); box-shadow: 0 8px 20px rgba(13, 110, 253, 0.15); }
.theme-card.success:hover { border-color: var(--success); box-shadow: 0 8px 20px rgba(5, 150, 105, 0.15); }
.theme-card.warning:hover { border-color: var(--warning); box-shadow: 0 8px 20px rgba(217, 119, 6, 0.15); }
.theme-card.purple:hover { border-color: var(--purple); box-shadow: 0 8px 20px rgba(124, 58, 237, 0.15); }

.theme-number {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  font-weight: 600;
  border-radius: 50%;
  font-size: 0.875rem;
}

/* Énoncé */
.enonce-box {
  background: var(--gray-50);
  border-left: 4px solid var(--primary);
  padding: 1rem 1.25rem;
  border-radius: 0.375rem;
  font-size: 1.05rem;
  line-height: 1.6;
}

/* Validation des champs */
.form-control.is-valid-custom {
  border-color: #198754;
  background-color: #d1e7dd;
}

.form-control.is-invalid-custom {
  border-color: #dc3545;
  background-color: #f8d7da;
}

/* Score circle */
.score-circle {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  width: 150px;
  height: 150px;
  border-radius: 50%;
  border: 6px solid var(--primary);
  background: linear-gradient(135deg, #f0f9ff 0%, #e0f2fe 100%);
}

.score-num {
  font-size: 3.5rem;
  font-weight: 700;
  line-height: 1;
}

.score-total {
  font-size: 1.25rem;
  opacity: 0.8;
}

/* ============================================================================
   AUTOCOMPLETE (Journalisation)
   ============================================================================ */

.ac-container {
  position: relative;
  z-index: 10;
}

.ac-list {
  position: absolute;
  top: 100%;
  left: 0;
  right: 0;
  max-height: 250px;
  overflow-y: auto;
  background: #fff;
  border: 1px solid var(--gray-100);
  border-top: none;
  border-radius: 0 0 0.375rem 0.375rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  z-index: 1060;
  display: none;
  list-style: none;
  padding: 0;
  margin: 0;
}

.ac-list.open {
  display: block;
}

.ac-item {
  padding: 0.625rem 0.875rem;
  cursor: pointer;
  display: flex;
  gap: 0.5rem;
  border-bottom: 1px solid #f1f5f9;
  transition: var(--transition);
}

.ac-item:hover,
.ac-item.highlighted {
  background: #e0f2fe;
}

.ac-num {
  font-weight: 600;
  color: #1e3a5f;
  min-width: 50px;
}

.ac-nom {
  color: #64748b;
  flex: 1;
}

/* ============================================================================
   OPTIONS QCM (Droit)
   ============================================================================ */

.option-card {
  border: 2px solid var(--gray-100);
  border-radius: 0.5rem;
  padding: 1rem;
  margin-bottom: 0.75rem;
  cursor: pointer;
  transition: var(--transition);
  display: flex;
  align-items: flex-start;
  gap: 0.875rem;
}

.option-card:hover:not(.disabled) {
  border-color: var(--purple);
  background: #faf5ff;
  transform: translateX(4px);
}

.option-card.selected {
  border-color: var(--purple);
  background: #ede9fe;
}

.option-card.correct {
  border-color: #22c55e;
  background: #dcfce7;
}

.option-card.incorrect {
  border-color: #ef4444;
  background: #fee2e2;
}

.option-card.disabled {
  cursor: not-allowed;
  opacity: 0.85;
}

.option-letter {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  background: var(--gray-100);
  color: var(--gray-700);
  font-weight: 600;
  border-radius: 50%;
  flex-shrink: 0;
  font-size: 0.875rem;
}

.option-card.selected .option-letter {
  background: var(--purple);
  color: white;
}

.option-card.correct .option-letter {
  background: #22c55e;
  color: white;
}

.option-card.incorrect .option-letter {
  background: #ef4444;
  color: white;
}

/* ============================================================================
   TABLES (Analyse, Bilan)
   ============================================================================ */

.bilan-table,
.cr-table {
  font-size: 0.9rem;
}

.bilan-table th,
.cr-table th {
  background: var(--primary);
  color: white;
  text-align: center;
  padding: 0.625rem;
  font-weight: 600;
}

.bilan-table td,
.cr-table td {
  padding: 0.5rem 0.75rem;
}

.montant {
  text-align: right;
  font-family: 'Courier New', monospace;
  font-weight: 500;
}

.total-row {
  font-weight: 700;
  background: #e0f2fe !important;
}

.section-header {
  background: #f0fdf4;
  font-weight: 600;
  color: #047857;
}

/* ============================================================================
   AIDE-MÉMOIRE
   ============================================================================ */

.formule-card,
.aide-card {
  background: var(--gray-50);
  border-radius: 0.5rem;
  padding: 1.25rem;
  height: 100%;
  border: 1px solid var(--gray-100);
}

.formule-card h6,
.aide-card h6 {
  border-bottom: 2px solid var(--primary);
  padding-bottom: 0.625rem;
  margin-bottom: 0.875rem;
  font-weight: 600;
}

.formule-card code {
  background: white;
  padding: 0.375rem 0.625rem;
  border-radius: 0.25rem;
  display: block;
  margin: 0.375rem 0;
  font-size: 0.875rem;
  border: 1px solid var(--gray-100);
}

/* ============================================================================
   RESPONSIVE
   ============================================================================ */

@media (max-width: 767px) {
  .table-desktop {
    display: none !important;
  }
  .table-mobile {
    display: block !important;
  }
  
  .score-circle {
    width: 120px;
    height: 120px;
  }
  
  .score-num {
    font-size: 2.5rem;
  }
}

@media (min-width: 768px) {
  .table-desktop {
    display: block !important;
  }
  .table-mobile {
    display: none !important;
  }
}

/* ============================================================================
   ANIMATIONS
   ============================================================================ */

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.fade-in {
  animation: fadeIn 0.3s ease-out;
}

/* ============================================================================
   UTILITIES
   ============================================================================ */

.transition-all {
  transition: var(--transition);
}

.hover-lift:hover {
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
}

/* Dark mode adjustments */
[data-bs-theme="dark"] {
  --gray-50: #1e293b;
  --gray-100: #334155;
}

[data-bs-theme="dark"] .enonce-box {
  background: #1e293b;
  border-left-color: #60a5fa;
}

[data-bs-theme="dark"] .formule-card,
[data-bs-theme="dark"] .aide-card {
  background: #1e293b;
  border-color: #334155;
}

[data-bs-theme="dark"] .formule-card code {
  background: #0f172a;
  border-color: #334155;
}
