/* ==========================================================================
   style.css — Styles de l'installation "Quelle est ta couleur ?"
   ========================================================================== */

/* --- Reset & Base --- */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  background: #0a0a1a;
  color: #e0e0e0;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  overflow: hidden;
  width: 100vw;
  height: 100vh;
}

/* --- Canvas p5.js --- */
canvas {
  display: block;
  position: absolute;
  top: 0;
  left: 0;
}

/* ==========================================================================
   Overlays UI
   ========================================================================== */

/* --- Texte permanent au-dessus de la vidéo --- */
#texte-haut {
  position: absolute;
  top: 2%;
  left: 50%;
  transform: translateX(-50%);
  width: 80%;
  max-width: 800px;
  text-align: center;
  font-size: 1.3rem;
  font-style: italic;
  color: rgba(255, 255, 255, 0.85);
  z-index: 10;
  pointer-events: none;
  line-height: 1.5;
}

/* --- Zone sous la vidéo : texte + boutons --- */
#zone-bas {
  position: absolute;
  bottom: 2%;
  left: 50%;
  transform: translateX(-50%);
  width: 90%;
  max-width: 800px;
  display: none;
  flex-direction: column;
  align-items: center;
  z-index: 20;
  text-align: center;
}

.texte-bas {
  font-size: 1.15rem;
  color: rgba(255, 255, 255, 0.9);
  margin-bottom: 1.2rem;
  line-height: 1.5;
}

.texte-bas .couleur-predite {
  font-weight: bold;
  padding: 0.15rem 0.8rem;
  border-radius: 0.4rem;
  color: #fff;
}

.boutons-couleur {
  display: flex;
  gap: 1.2rem;
  flex-wrap: wrap;
  justify-content: center;
}

.btn-couleur {
  width: 70px;
  height: 70px;
  border: 3px solid rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: visible;
}

.btn-couleur:hover {
  transform: scale(1.15);
  border-color: rgba(255, 255, 255, 0.8);
  box-shadow: 0 0 25px rgba(255, 255, 255, 0.3);
}

.btn-couleur:active {
  transform: scale(0.95);
}

.btn-couleur .btn-label {
  position: absolute;
  bottom: -20px;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.8);
  white-space: nowrap;
}

.btn-couleur[data-couleur="rouge"]  { background: #e74c3c; }
.btn-couleur[data-couleur="bleu"]   { background: #3498db; }
.btn-couleur[data-couleur="vert"]   { background: #2ecc71; }
.btn-couleur[data-couleur="jaune"]  { background: #f1c40f; }
.btn-couleur[data-couleur="violet"] { background: #9b59b6; }
.btn-couleur[data-couleur="orange"] { background: #f39c12; }

/* --- Bouton "Faire une prédiction" --- */
#btn-prediction {
  position: absolute;
  bottom: 5%;
  left: 50%;
  transform: translateX(-50%);
  display: none;
  padding: 1rem 2.5rem;
  font-size: 1.2rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.4);
  border-radius: 2rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
  z-index: 20;
  animation: pulse 2s ease-in-out infinite;
}

#btn-prediction:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.7);
  transform: translateX(-50%) scale(1.05);
}

@keyframes pulse {
  0%, 100% { box-shadow: 0 0 0 0 rgba(255, 255, 255, 0.2); }
  50% { box-shadow: 0 0 20px 5px rgba(255, 255, 255, 0.15); }
}

/* --- Résultat texte --- */
.resultat-texte {
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.resultat-correct {
  color: #2ecc71 !important;
}

.resultat-incorrect {
  color: #e74c3c !important;
}

/* --- Écran résultat combiné (merci + pédagogique + suivant) --- */
#ecran-resultat {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 30;
  background: rgba(10, 10, 26, 0.85);
  backdrop-filter: blur(10px);
}

.resultat-contenu {
  max-width: 700px;
  padding: 3rem;
  text-align: left;
  animation: fadeIn 0.6s ease-out;
}

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

.resultat-contenu h2 {
  font-size: 1.8rem;
  color: #fff;
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.resultat-contenu p {
  font-size: 1.1rem;
  line-height: 1.8;
  color: rgba(255, 255, 255, 0.85);
  margin-bottom: 1rem;
}

.resultat-contenu em {
  font-style: italic;
  color: #f1c40f;
}

.resultat-contenu strong {
  color: #fff;
  font-weight: 600;
}

.btn-suivant {
  display: inline-block;
  margin-top: 2rem;
  padding: 0.8rem 2.5rem;
  font-size: 1.1rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-radius: 2rem;
  cursor: pointer;
  transition: all 0.3s ease;
  font-family: inherit;
}

.btn-suivant:hover {
  background: rgba(255, 255, 255, 0.2);
  border-color: rgba(255, 255, 255, 0.6);
}

/* --- Indicateur d'entraînement --- */
#indicateur-training {
  position: absolute;
  top: 1rem;
  left: 1rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  z-index: 50;
  display: none;
}

#indicateur-training .dot {
  display: inline-block;
  width: 8px;
  height: 8px;
  border-radius: 50%;
  background: #f39c12;
  margin-right: 0.5rem;
  animation: blink 1s infinite;
}

@keyframes blink {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.3; }
}

/* ==========================================================================
   Bouton & Modal "En savoir plus"
   ========================================================================== */

#btn-ensavoirplus {
  position: absolute;
  bottom: 1rem;
  left: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.6);
  background: transparent;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
}

#btn-ensavoirplus:hover {
  color: rgba(255, 255, 255, 0.9);
  border-color: rgba(255, 255, 255, 0.5);
  background: rgba(255, 255, 255, 0.05);
}

#modal-ensavoirplus {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 200;
  backdrop-filter: blur(10px);
}

#modal-ensavoirplus.visible {
  display: flex;
}

.modal-esp-contenu {
  max-width: 700px;
  max-height: 85vh;
  overflow-y: auto;
  padding: 2.5rem;
  position: relative;
  animation: fadeIn 0.3s ease-out;
}

.modal-esp-contenu h2 {
  font-size: 1.6rem;
  color: #fff;
  margin-bottom: 1.5rem;
  font-weight: 400;
}

.modal-esp-contenu h3 {
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.9);
  margin: 1.5rem 0 0.6rem;
  font-weight: 500;
}

.modal-esp-contenu p {
  font-size: 0.95rem;
  line-height: 1.7;
  color: rgba(255, 255, 255, 0.75);
  margin-bottom: 0.8rem;
}

.modal-esp-contenu strong {
  color: #fff;
  font-weight: 600;
}

/* ==========================================================================
   Footer
   ========================================================================== */

#footer-sem {
  position: absolute;
  bottom: 1rem;
  left: 50%;
  transform: translateX(-50%);
  font-size: 0.75rem;
  color: rgba(255, 255, 255, 0.3);
  z-index: 5;
  pointer-events: none;
  white-space: nowrap;
}

/* ==========================================================================
   Panneau Data-Viz
   ========================================================================== */

#btn-dataviz {
  position: absolute;
  top: 1rem;
  right: 1rem;
  z-index: 100;
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 0.5rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
}

#btn-dataviz:hover {
  background: rgba(255, 255, 255, 0.2);
}

#panneau-dataviz {
  position: absolute;
  top: 0;
  right: -420px;
  width: 400px;
  height: 100vh;
  background: rgba(15, 15, 35, 0.95);
  backdrop-filter: blur(20px);
  z-index: 90;
  transition: right 0.4s ease;
  overflow-y: auto;
  padding: 2rem;
  border-left: 1px solid rgba(255, 255, 255, 0.1);
}

#panneau-dataviz.ouvert {
  right: 0;
}

#panneau-dataviz h2 {
  font-size: 1.3rem;
  color: #fff;
  margin-bottom: 1.5rem;
  font-weight: 400;
}

#panneau-dataviz h3 {
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.7);
  margin: 1.5rem 0 0.8rem;
  font-weight: 400;
}

/* --- Stats --- */
.stat-nombre {
  font-size: 2.5rem;
  font-weight: 300;
  color: #fff;
  margin-bottom: 0.5rem;
}

.stat-label {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
}

/* --- Bar chart --- */
.chart-bar {
  display: flex;
  align-items: center;
  margin-bottom: 0.6rem;
}

.chart-bar .bar-label {
  width: 60px;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.7);
  text-transform: capitalize;
}

.chart-bar .bar-track {
  flex: 1;
  height: 20px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  overflow: hidden;
  margin: 0 0.5rem;
}

.chart-bar .bar-fill {
  height: 100%;
  border-radius: 4px;
  transition: width 0.5s ease;
}

.chart-bar .bar-count {
  width: 30px;
  text-align: right;
  font-size: 0.8rem;
  color: rgba(255, 255, 255, 0.6);
}

.bar-fill[data-couleur="rouge"]  { background: #e74c3c; }
.bar-fill[data-couleur="bleu"]   { background: #3498db; }
.bar-fill[data-couleur="vert"]   { background: #2ecc71; }
.bar-fill[data-couleur="jaune"]  { background: #f1c40f; }
.bar-fill[data-couleur="violet"] { background: #9b59b6; }
.bar-fill[data-couleur="orange"] { background: #f39c12; }

/* --- Accuracy --- */
.accuracy-global {
  font-size: 1.5rem;
  color: #fff;
  font-weight: 300;
}

.accuracy-detail {
  font-size: 0.85rem;
  color: rgba(255, 255, 255, 0.5);
  margin-top: 0.3rem;
}

/* --- Galerie --- */
.galerie-grid {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 0.5rem;
  margin-top: 0.5rem;
}

.galerie-item {
  aspect-ratio: 1;
  border-radius: 8px;
  cursor: pointer;
  border: 2px solid transparent;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.galerie-item:hover {
  border-color: rgba(255, 255, 255, 0.5);
  transform: scale(1.05);
}

.galerie-item canvas {
  width: 100%;
  height: 100%;
}

/* --- Modal galerie (vue agrandie) --- */
#modal-galerie {
  position: fixed;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: rgba(0, 0, 0, 0.85);
  display: none;
  justify-content: center;
  align-items: center;
  z-index: 200;
  backdrop-filter: blur(10px);
}

#modal-galerie.visible {
  display: flex;
}

.modal-contenu {
  text-align: center;
  animation: fadeIn 0.3s ease-out;
}

.modal-contenu canvas {
  border-radius: 12px;
}

.modal-info {
  margin-top: 1rem;
  font-size: 1rem;
  color: rgba(255, 255, 255, 0.8);
}

.modal-info .couleur-badge {
  display: inline-block;
  padding: 0.3rem 1rem;
  border-radius: 1rem;
  color: #fff;
  font-weight: bold;
  margin: 0 0.3rem;
}

.modal-fermer {
  position: absolute;
  top: 2rem;
  right: 2rem;
  font-size: 2rem;
  color: #fff;
  cursor: pointer;
  background: none;
  border: none;
  font-family: inherit;
}

/* ==========================================================================
   Page Admin
   ========================================================================== */

body.admin-page {
  overflow: auto;
  background: #0f0f2a;
}

.admin-container {
  max-width: 900px;
  margin: 2rem auto;
  padding: 0 2rem;
}

.admin-container h1 {
  font-size: 2rem;
  font-weight: 300;
  color: #fff;
  margin-bottom: 2rem;
}

.admin-section {
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  padding: 1.5rem;
  margin-bottom: 1.5rem;
}

.admin-section h2 {
  font-size: 1.2rem;
  color: rgba(255, 255, 255, 0.8);
  margin-bottom: 1rem;
  font-weight: 400;
}

.admin-btn {
  padding: 0.6rem 1.5rem;
  font-size: 0.9rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  cursor: pointer;
  font-family: inherit;
  transition: all 0.3s ease;
  margin-right: 0.5rem;
  margin-bottom: 0.5rem;
}

.admin-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.admin-btn.danger {
  border-color: #e74c3c;
  color: #e74c3c;
}

.admin-btn.danger:hover {
  background: rgba(231, 76, 60, 0.2);
}

.admin-input {
  padding: 0.5rem 1rem;
  font-size: 0.9rem;
  color: #fff;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 0.5rem;
  font-family: inherit;
  width: 80px;
  margin-right: 0.5rem;
}

.admin-input:focus {
  outline: none;
  border-color: rgba(255, 255, 255, 0.5);
}

.param-row {
  display: flex;
  align-items: center;
  margin-bottom: 0.8rem;
}

.param-row label {
  width: 250px;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.7);
}

.admin-galerie {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.8rem;
  margin-top: 1rem;
}

.admin-message {
  padding: 0.8rem 1rem;
  border-radius: 0.5rem;
  margin-top: 1rem;
  font-size: 0.9rem;
  display: none;
}

.admin-message.success {
  background: rgba(46, 204, 113, 0.2);
  color: #2ecc71;
  display: block;
}

.admin-message.error {
  background: rgba(231, 76, 60, 0.2);
  color: #e74c3c;
  display: block;
}
