/* === QUIZZ BDE - Style Kahoot-like === */

@import url('https://fonts.googleapis.com/css2?family=Nunito:wght@600;700;800;900&display=swap');

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

:root {
  --purple: #46178F;
  --purple-light: #6C2DC7;
  --red: #E21B3C;
  --blue: #1368CE;
  --yellow: #D89E00;
  --green: #26890C;
  --orange: #E87D0D;
  --dark: #1a0533;
  --darker: #0e0120;
  --white: #FFFFFF;
  --gray: rgba(255,255,255,0.3);
}

body {
  font-family: 'Nunito', sans-serif;
  background: var(--dark);
  color: var(--white);
  min-height: 100vh;
  overflow-x: hidden;
}

/* === ÉCRANS === */
.screen {
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  min-height: 100vh;
  padding: 20px;
  text-align: center;
}

.screen.active {
  display: flex;
}

/* === LOGO / TITRE === */
.logo {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 2px;
  margin-bottom: 10px;
  background: linear-gradient(135deg, var(--red), var(--yellow), var(--green), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  font-size: 1.1rem;
  color: var(--gray);
  margin-bottom: 30px;
  font-weight: 600;
}

/* === FORMULAIRES === */
.form-group {
  width: 100%;
  max-width: 360px;
  margin-bottom: 16px;
}

.form-group input {
  width: 100%;
  padding: 16px 20px;
  border: 3px solid var(--purple-light);
  border-radius: 12px;
  background: rgba(255,255,255,0.08);
  color: var(--white);
  font-size: 1.1rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  text-align: center;
  outline: none;
  transition: border-color 0.2s;
}

.form-group input::placeholder {
  color: rgba(255,255,255,0.4);
  font-weight: 600;
}

.form-group input:focus {
  border-color: var(--yellow);
}

/* === BOUTONS === */
.btn {
  display: inline-block;
  padding: 16px 40px;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 800;
  cursor: pointer;
  transition: transform 0.15s, box-shadow 0.15s;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.btn:active {
  transform: scale(0.96);
}

.btn-primary {
  background: var(--purple-light);
  color: var(--white);
  box-shadow: 0 4px 0 #4a1a8a;
}

.btn-primary:hover {
  background: #7b3dd4;
}

.btn-green {
  background: var(--green);
  color: var(--white);
  box-shadow: 0 4px 0 #1d6a09;
}

.btn-red {
  background: var(--red);
  color: var(--white);
  box-shadow: 0 4px 0 #b01530;
}

.btn-yellow {
  background: var(--yellow);
  color: var(--darker);
  box-shadow: 0 4px 0 #a67a00;
}

.btn-blue {
  background: var(--blue);
  color: var(--white);
  box-shadow: 0 4px 0 #0e52a3;
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

/* === ERREUR === */
.error-msg {
  color: var(--red);
  font-weight: 700;
  margin-top: 10px;
  min-height: 24px;
}

/* === QUESTION (JOUEUR) === */
.question-header {
  width: 100%;
  max-width: 600px;
  margin-bottom: 20px;
}

.question-number {
  font-size: 0.9rem;
  color: var(--yellow);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 2px;
  margin-bottom: 8px;
}

.question-text {
  font-size: 1.4rem;
  font-weight: 800;
  line-height: 1.3;
  padding: 20px;
  background: var(--purple);
  border-radius: 16px;
  box-shadow: 0 6px 0 rgba(0,0,0,0.3);
}

/* === GRILLE DE RÉPONSES (20 participants, mobile) === */
.answers-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 10px;
  width: 100%;
  max-width: 600px;
  padding: 0 4px;
}

.answer-btn {
  padding: 14px 10px;
  border: none;
  border-radius: 10px;
  font-size: 0.95rem;
  font-family: 'Nunito', sans-serif;
  font-weight: 700;
  color: var(--white);
  cursor: pointer;
  transition: transform 0.12s, opacity 0.2s;
  text-align: center;
  word-break: break-word;
}

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

.answer-btn.selected {
  outline: 4px solid var(--white);
  outline-offset: -4px;
  transform: scale(1.03);
}

.answer-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
  transform: none;
}

/* Couleurs assignées dynamiquement en JS via data-color */
.answer-btn[data-color="red"] { background: var(--red); box-shadow: 0 3px 0 #b01530; }
.answer-btn[data-color="blue"] { background: var(--blue); box-shadow: 0 3px 0 #0e52a3; }
.answer-btn[data-color="yellow"] { background: var(--yellow); color: var(--darker); box-shadow: 0 3px 0 #a67a00; }
.answer-btn[data-color="green"] { background: var(--green); box-shadow: 0 3px 0 #1d6a09; }
.answer-btn[data-color="orange"] { background: var(--orange); box-shadow: 0 3px 0 #b5650a; }

/* === ATTENTE === */
.waiting-icon {
  font-size: 4rem;
  margin-bottom: 20px;
  animation: pulse 1.5s ease-in-out infinite;
}

@keyframes pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50% { transform: scale(1.15); opacity: 0.7; }
}

.waiting-text {
  font-size: 1.3rem;
  font-weight: 700;
  color: var(--gray);
}

/* === RÉSULTAT RÉPONSE === */
.result-icon {
  font-size: 5rem;
  margin-bottom: 10px;
}

.result-text {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 8px;
}

.result-score {
  font-size: 1rem;
  color: var(--yellow);
  font-weight: 700;
}

/* === ADMIN === */
.admin-panel {
  width: 100%;
  max-width: 500px;
}

.admin-title {
  font-size: 1.4rem;
  font-weight: 800;
  margin-bottom: 20px;
  color: var(--yellow);
}

.admin-info {
  background: rgba(255,255,255,0.06);
  border-radius: 12px;
  padding: 16px;
  margin-bottom: 16px;
  text-align: left;
}

.admin-info-label {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 1px;
  color: var(--gray);
  font-weight: 700;
}

.admin-info-value {
  font-size: 1.2rem;
  font-weight: 800;
  margin-top: 4px;
}

.admin-actions {
  display: flex;
  flex-direction: column;
  gap: 12px;
  margin-top: 20px;
}

.admin-actions .btn {
  width: 100%;
}

.player-count-badge {
  display: inline-block;
  background: var(--green);
  color: var(--white);
  padding: 4px 14px;
  border-radius: 20px;
  font-weight: 800;
  font-size: 1rem;
}

/* === DISPLAY (PROJECTEUR) === */
.display-container {
  width: 100%;
  height: 100vh;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 40px;
}

.display-question {
  font-size: 2.5rem;
  font-weight: 900;
  line-height: 1.3;
  text-align: center;
  max-width: 900px;
  margin-bottom: 40px;
  padding: 30px 40px;
  background: var(--purple);
  border-radius: 20px;
  box-shadow: 0 8px 0 rgba(0,0,0,0.3);
}

.display-question-number {
  font-size: 1.2rem;
  color: var(--yellow);
  font-weight: 800;
  text-transform: uppercase;
  letter-spacing: 3px;
  margin-bottom: 12px;
}

/* Progress bar */
.progress-container {
  width: 100%;
  max-width: 700px;
  margin-bottom: 30px;
}

.progress-label {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 10px;
  color: var(--gray);
}

.progress-bar-bg {
  width: 100%;
  height: 30px;
  background: rgba(255,255,255,0.1);
  border-radius: 15px;
  overflow: hidden;
}

.progress-bar-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--green), var(--blue));
  border-radius: 15px;
  transition: width 0.4s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 800;
  font-size: 0.9rem;
  min-width: 40px;
}

/* Classement */
.leaderboard {
  width: 100%;
  max-width: 700px;
}

.leaderboard-title {
  font-size: 1.5rem;
  font-weight: 800;
  margin-bottom: 16px;
  color: var(--yellow);
  text-transform: uppercase;
  letter-spacing: 2px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 12px 20px;
  margin-bottom: 8px;
  border-radius: 12px;
  background: rgba(255,255,255,0.06);
  transition: transform 0.3s;
}

.leaderboard-item:nth-child(1) {
  background: linear-gradient(135deg, rgba(255,215,0,0.25), rgba(255,215,0,0.05));
  border: 2px solid rgba(255,215,0,0.4);
}

.leaderboard-item:nth-child(2) {
  background: linear-gradient(135deg, rgba(192,192,192,0.2), rgba(192,192,192,0.05));
  border: 2px solid rgba(192,192,192,0.3);
}

.leaderboard-item:nth-child(3) {
  background: linear-gradient(135deg, rgba(205,127,50,0.2), rgba(205,127,50,0.05));
  border: 2px solid rgba(205,127,50,0.3);
}

.leaderboard-rank {
  font-size: 1.4rem;
  font-weight: 900;
  width: 40px;
  text-align: center;
  margin-right: 16px;
}

.leaderboard-name {
  flex: 1;
  font-size: 1.2rem;
  font-weight: 700;
}

.leaderboard-score {
  font-size: 1.2rem;
  font-weight: 800;
  color: var(--yellow);
}

/* Podium final */
.podium {
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 16px;
  margin-bottom: 30px;
}

.podium-place {
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.podium-bar {
  width: 140px;
  border-radius: 12px 12px 0 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  padding: 20px 10px;
}

.podium-bar.first {
  height: 200px;
  background: linear-gradient(180deg, #FFD700, #B8860B);
}

.podium-bar.second {
  height: 150px;
  background: linear-gradient(180deg, #C0C0C0, #808080);
}

.podium-bar.third {
  height: 110px;
  background: linear-gradient(180deg, #CD7F32, #8B4513);
}

.podium-name {
  font-size: 1.3rem;
  font-weight: 900;
  margin-bottom: 6px;
}

.podium-score-text {
  font-size: 1rem;
  font-weight: 700;
  opacity: 0.9;
}

.podium-rank {
  font-size: 2rem;
  font-weight: 900;
  margin-bottom: 8px;
}

/* === DISPLAY WAITING === */
.display-waiting {
  text-align: center;
}

.display-logo {
  font-size: 5rem;
  font-weight: 900;
  background: linear-gradient(135deg, var(--red), var(--yellow), var(--green), var(--blue));
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  margin-bottom: 20px;
}

.display-status {
  font-size: 1.5rem;
  color: var(--gray);
  font-weight: 700;
}

.display-player-count {
  font-size: 2rem;
  font-weight: 900;
  margin-top: 20px;
  color: var(--green);
}

/* === ANIMATIONS === */
.fade-in {
  animation: fadeIn 0.3s ease;
}

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

/* === SCROLLABLE pour mobile (20 réponses) === */
.answers-scroll {
  width: 100%;
  max-width: 600px;
  max-height: calc(100vh - 200px);
  overflow-y: auto;
  padding: 0 4px 20px;
  -webkit-overflow-scrolling: touch;
}

/* Hide scrollbar but keep scroll */
.answers-scroll::-webkit-scrollbar {
  width: 4px;
}
.answers-scroll::-webkit-scrollbar-thumb {
  background: var(--purple-light);
  border-radius: 2px;
}

/* === RESPONSIVE === */
@media (max-width: 480px) {
  .logo { font-size: 2.2rem; }
  .question-text { font-size: 1.1rem; padding: 14px; }
  .answers-grid { gap: 8px; }
  .answer-btn { padding: 12px 8px; font-size: 0.85rem; }
  .display-question { font-size: 1.5rem; }
}

@media (min-width: 768px) {
  .answers-grid {
    grid-template-columns: repeat(4, 1fr);
  }
}
