/* ==========================================================================
   Cémantix Solver — Modal de Trajectoire IA & Notifications Toast
   ========================================================================== */

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 5.5rem;
  right: 2rem;
  background: var(--accent);
  color: #ffffff;
  padding: 0.75rem 1.25rem;
  border-radius: var(--radius-md);
  font-size: 0.85rem;
  font-weight: 600;
  box-shadow: var(--shadow-md);
  opacity: 0;
  transform: translateY(20px);
  pointer-events: none;
  transition: opacity 0.3s ease, transform 0.3s ease;
  z-index: 1000;
}

.toast.show {
  opacity: 1;
  transform: translateY(0);
}

@media (max-width: 768px) {
  .toast {
    bottom: 8rem;
    right: 1rem;
  }
}

/* Backdrop Flouté */
.modal-backdrop {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.78);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
  z-index: 1000;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 1rem;
  animation: modalFadeIn 0.2s cubic-bezier(0.16, 1, 0.3, 1);
}

@keyframes modalFadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

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

/* Carte de la Modal */
.trajectory-modal-card {
  max-width: 860px;
  width: 100%;
  max-height: 88vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  padding: 0;
  border: 1px solid var(--border-color);
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), var(--shadow-glow);
  animation: modalScaleIn 0.25s cubic-bezier(0.16, 1, 0.3, 1);
  background: var(--bg-card);
}

/* En-tête Modal */
.modal-header {
  padding: 1.25rem 1.5rem;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: flex-start;
  justify-content: space-between;
  background: rgba(255, 255, 255, 0.02);
}

.modal-title-group h2 {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--text-main);
  margin: 0.2rem 0;
}

.modal-badges {
  display: flex;
  gap: 0.5rem;
  align-items: center;
}

.modal-target-word {
  font-size: 0.95rem;
  color: var(--text-muted);
}

.modal-close-btn {
  background: none;
  border: none;
  color: var(--text-muted);
  font-size: 1.35rem;
  cursor: pointer;
  padding: 0.25rem 0.6rem;
  border-radius: var(--radius-sm);
  transition: var(--transition);
  line-height: 1;
}

.modal-close-btn:hover {
  color: var(--text-main);
  background: rgba(255, 255, 255, 0.1);
}

/* Barre des KPIs Synthétiques */
.trajectory-summary-bar {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(160px, 1fr));
  gap: 0.75rem;
  padding: 1rem 1.5rem;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid var(--border-color);
}

.summary-metric {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.55rem 0.85rem;
  background: var(--bg-app);
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
}

.summary-metric .metric-icon {
  font-size: 1.35rem;
}

.summary-metric .metric-body {
  display: flex;
  flex-direction: column;
}

.summary-metric .metric-label {
  font-size: 0.72rem;
  text-transform: uppercase;
  letter-spacing: 0.04em;
  color: var(--text-dim);
}

.summary-metric .metric-num {
  font-size: 1rem;
  font-weight: 700;
  color: var(--text-main);
  font-family: var(--font-mono);
}

/* Barre de Filtrage */
.trajectory-filter-bar {
  padding: 0.75rem 1.5rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 1rem;
  flex-wrap: wrap;
  border-bottom: 1px solid var(--border-color);
  background: rgba(255, 255, 255, 0.01);
}

.filter-group-wrapper {
  display: flex;
  align-items: center;
  gap: 0.65rem;
}

.filter-label {
  font-size: 0.82rem;
  color: var(--text-muted);
  font-weight: 500;
}

/* Corps Scrollable de la Trajectoire */
.trajectory-scroll-body {
  flex: 1;
  overflow-y: auto;
  padding: 1.25rem 1.5rem;
  max-height: calc(88vh - 280px);
}

.trajectory-list {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Carte d'un Coup Individuel */
.trajectory-step-card {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.7rem 1rem;
  border: 1px solid var(--border-color);
  border-radius: var(--radius-md);
  background: rgba(255, 255, 255, 0.02);
  transition: var(--transition);
  gap: 1rem;
}

.trajectory-step-card:hover {
  border-color: var(--border-focus);
  transform: translateX(4px);
  background: var(--bg-card-hover);
}

.trajectory-step-card.is-record {
  border-left: 3px solid var(--warning);
  background: rgba(210, 153, 34, 0.05);
}

.trajectory-step-card.is-win {
  border-left: 4px solid var(--success);
  background: rgba(63, 185, 80, 0.12);
  box-shadow: 0 0 15px rgba(63, 185, 80, 0.2);
}

/* Côté Gauche : Étape, Source, Mot */
.step-left {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  min-width: 0;
}

.step-num {
  font-family: var(--font-mono);
  font-size: 0.8rem;
  font-weight: 700;
  color: var(--text-dim);
  width: 2.2rem;
  text-align: right;
  flex-shrink: 0;
}

.step-source-badge {
  font-size: 0.68rem;
  font-weight: 600;
  padding: 2px 7px;
  border-radius: 999px;
  white-space: nowrap;
  flex-shrink: 0;
  text-transform: uppercase;
  letter-spacing: 0.03em;
}

.source-seed {
  background: rgba(56, 189, 248, 0.15);
  color: #38bdf8;
  border: 1px solid rgba(56, 189, 248, 0.35);
}

.source-rag {
  background: rgba(88, 166, 255, 0.15);
  color: #58a6ff;
  border: 1px solid rgba(88, 166, 255, 0.35);
}

.source-llm {
  background: rgba(168, 85, 247, 0.15);
  color: #c084fc;
  border: 1px solid rgba(168, 85, 247, 0.35);
}

.source-sniper {
  background: rgba(239, 68, 68, 0.15);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.35);
}

.step-word {
  font-size: 0.98rem;
  font-weight: 700;
  color: var(--text-main);
  cursor: pointer;
  transition: color 0.15s ease;
}

.step-word:hover {
  color: var(--accent);
  text-decoration: underline;
}

.step-record-star {
  color: var(--warning);
  font-size: 0.85rem;
  margin-left: 0.35rem;
  cursor: help;
}

/* Côté Droit : Météo, Température, Score ‰, Jauge */
.step-right {
  display: flex;
  align-items: center;
  gap: 0.85rem;
  flex-shrink: 0;
}

.step-weather {
  font-size: 1.15rem;
}

.step-temp {
  font-family: var(--font-mono);
  font-size: 0.92rem;
  font-weight: 600;
  color: var(--text-main);
  min-width: 4.8rem;
  text-align: right;
}

.step-permille-badge {
  font-family: var(--font-mono);
  font-size: 0.78rem;
  font-weight: 700;
  padding: 2px 7px;
  border-radius: var(--radius-sm);
  min-width: 3.8rem;
  text-align: center;
}

.step-mini-gauge {
  width: 60px;
  height: 6px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 999px;
  overflow: hidden;
}

.step-mini-gauge-bar {
  height: 100%;
  border-radius: 999px;
  transition: width 0.3s ease;
}

.step-permille-badge.tier-ice { background: rgba(56, 189, 248, 0.15); color: var(--tier-ice); }
.step-permille-badge.tier-cold { background: rgba(96, 165, 250, 0.15); color: var(--tier-cold); }
.step-permille-badge.tier-cool { background: rgba(52, 211, 153, 0.15); color: var(--tier-cool); }
.step-permille-badge.tier-warm { background: rgba(251, 191, 36, 0.15); color: var(--tier-warm); }
.step-permille-badge.tier-fire { background: rgba(248, 113, 113, 0.15); color: var(--tier-fire); }

.step-mini-gauge-bar.tier-ice { background: var(--tier-ice); }
.step-mini-gauge-bar.tier-cold { background: var(--tier-cold); }
.step-mini-gauge-bar.tier-cool { background: var(--tier-cool); }
.step-mini-gauge-bar.tier-warm { background: var(--tier-warm); }
.step-mini-gauge-bar.tier-fire { background: var(--tier-fire); }

/* Pied de Modal */
.modal-footer {
  padding: 0.85rem 1.5rem;
  border-top: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: rgba(0, 0, 0, 0.2);
}

.modal-footer-note {
  font-size: 0.78rem;
  color: var(--text-dim);
}

@media (max-width: 768px) {
  .trajectory-summary-bar {
    grid-template-columns: repeat(2, 1fr);
  }

  .step-mini-gauge {
    display: none;
  }

  .step-right {
    gap: 0.5rem;
  }
}
