/* ==========================================================
   PROFESSOR EXPERIENCE - WebPrime
   style.css - Chat Professor + Reveal progressif
   ========================================================== */

/* ==================== VARIABLES ==================== */
:root {
  --primary-orange: #ffb156;
  --primary-hover: #e09a40;
  --primary-light: #ffc87a;
  --bg-dark: #0a0a0a;
  --bg-card: #1a1a1a;
  --bg-card-hover: #252525;
  --border-dark: #2a2a2a;
  --text-white: #ffffff;
  --text-gray: #9ca3af;
  --text-light: #d1d5db;
  --alert-red: #ff3344;
}

/* ==================== RESET & BASE ==================== */
*, *::before, *::after {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

html, body {
  width: 100%;
  height: 100%;
  overflow: hidden;
  font-family: 'Inter', sans-serif;
  background: #000;
}

body {
  color: var(--text-light);
  position: relative;
}

.hidden {
  display: none !important;
}

/* ==================== IFRAME SITE EN FOND ==================== */
#site-preview {
  position: fixed;
  inset: 0;
  width: 100%;
  height: 100%;
  border: none;
  z-index: 0;
}

#site-overlay {
  position: fixed;
  inset: 0;
  z-index: 1;
  background: rgba(0, 0, 0, 0.95);
  backdrop-filter: blur(20px);
  transition: all 1.2s ease;
}

/* ==================== BARRE DE PROGRESSION ==================== */
#progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(255, 255, 255, 0.05);
  z-index: 50;
}

#progress-fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--primary-orange), var(--primary-light));
  box-shadow: 0 0 10px rgba(255, 177, 86, 0.5), 0 0 20px rgba(255, 177, 86, 0.2);
  transition: width 0.6s ease;
  border-radius: 0 2px 2px 0;
}

/* ==================== PARTICULES ==================== */
#particles {
  position: fixed;
  inset: 0;
  z-index: 2;
  pointer-events: none;
  overflow: hidden;
}

.particle {
  position: absolute;
  width: 2px;
  height: 2px;
  background: rgba(255, 177, 86, 0.3);
  border-radius: 50%;
  animation: particle-float linear infinite;
}

.particle:nth-child(1)  { left: 5%;  animation-duration: 18s; animation-delay: 0s;    width: 3px; height: 3px; }
.particle:nth-child(2)  { left: 15%; animation-duration: 22s; animation-delay: -3s;  }
.particle:nth-child(3)  { left: 25%; animation-duration: 16s; animation-delay: -6s;   width: 3px; height: 3px; }
.particle:nth-child(4)  { left: 35%; animation-duration: 24s; animation-delay: -2s;  }
.particle:nth-child(5)  { left: 45%; animation-duration: 20s; animation-delay: -8s;   width: 4px; height: 4px; }
.particle:nth-child(6)  { left: 55%; animation-duration: 17s; animation-delay: -4s;  }
.particle:nth-child(7)  { left: 65%; animation-duration: 21s; animation-delay: -10s;  width: 3px; height: 3px; }
.particle:nth-child(8)  { left: 75%; animation-duration: 19s; animation-delay: -1s;  }
.particle:nth-child(9)  { left: 85%; animation-duration: 23s; animation-delay: -7s;   width: 3px; height: 3px; }
.particle:nth-child(10) { left: 92%; animation-duration: 15s; animation-delay: -5s;  }
.particle:nth-child(11) { left: 10%; animation-duration: 26s; animation-delay: -12s; }
.particle:nth-child(12) { left: 70%; animation-duration: 14s; animation-delay: -9s;   width: 4px; height: 4px; }

@keyframes particle-float {
  0%   { transform: translateY(100vh) rotate(0deg);   opacity: 0; }
  10%  { opacity: 0.6; }
  90%  { opacity: 0.6; }
  100% { transform: translateY(-20vh) rotate(360deg);  opacity: 0; }
}

/* ==================== ZONE CHAT ==================== */
#chat-zone {
  position: fixed;
  bottom: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  max-width: 600px;
  height: 100%;
  z-index: 10;
  display: flex;
  flex-direction: column;
  padding: 20px 15px;
  transition: opacity 1s ease;
}

#chat-zone.fade-out {
  opacity: 0;
  pointer-events: none;
}

/* ==================== MESSAGES ==================== */
#chat-messages {
  flex: 1;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  justify-content: flex-end;
  gap: 10px;
  padding-bottom: 15px;
  scrollbar-width: none;
}

#chat-messages::-webkit-scrollbar {
  display: none;
}

/* Bulle de message commune */
.chat-bubble {
  max-width: 85%;
  padding: 12px 16px;
  border-radius: 16px;
  font-size: 0.95rem;
  line-height: 1.5;
  animation: bubble-in 0.4s ease-out;
}

@keyframes bubble-in {
  0%   { opacity: 0; transform: translateY(15px) scale(0.95); }
  100% { opacity: 1; transform: translateY(0) scale(1); }
}

/* Message Ghostface (gauche) */
.bubble-ghost {
  align-self: flex-start;
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  color: var(--text-light);
  border-bottom-left-radius: 4px;
}

.bubble-ghost .ghost-header {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 6px;
}

.bubble-ghost .ghost-avatar {
  width: 28px;
  height: 28px;
  border-radius: 50%;
  overflow: hidden;
  border: 1px solid rgba(255, 177, 86, 0.3);
  flex-shrink: 0;
}

.bubble-ghost .ghost-avatar img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.bubble-ghost .ghost-name {
  font-family: 'Montserrat', sans-serif;
  font-size: 0.85rem;
  font-weight: 700;
  color: var(--primary-orange);
  letter-spacing: 1px;
}

.bubble-ghost .ghost-text {
  color: var(--text-light);
}

/* Question spéciale */
.bubble-ghost.question .ghost-text {
  font-weight: 500;
}

/* Reaction de Ghostface */
.bubble-ghost.reaction-good .ghost-text {
  color: #4ade80;
}

.bubble-ghost.reaction-bad .ghost-text {
  color: var(--alert-red);
  font-family: 'Montserrat', sans-serif; font-weight: 900;
  font-size: 0.85rem;
}

/* Message utilisateur (droite) */
.bubble-user {
  align-self: flex-end;
  background: linear-gradient(135deg, var(--primary-orange), var(--primary-hover));
  color: var(--bg-dark);
  font-weight: 600;
  border-bottom-right-radius: 4px;
}

/* Indicateur de frappe */
.typing-indicator {
  align-self: flex-start;
  display: flex;
  gap: 4px;
  padding: 14px 18px;
  background: var(--bg-card);
  border: 1px solid var(--border-dark);
  border-radius: 16px;
  border-bottom-left-radius: 4px;
  animation: bubble-in 0.3s ease-out;
}

.typing-dot {
  width: 8px;
  height: 8px;
  background: var(--text-gray);
  border-radius: 50%;
  animation: typing-bounce 1.2s ease-in-out infinite;
}

.typing-dot:nth-child(2) { animation-delay: 0.15s; }
.typing-dot:nth-child(3) { animation-delay: 0.3s; }

@keyframes typing-bounce {
  0%, 60%, 100% { transform: translateY(0); opacity: 0.4; }
  30%           { transform: translateY(-6px); opacity: 1; }
}

/* ==================== ZONE RÉPONSES ==================== */
#chat-answers {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 10px 0;
  min-height: 0;
}

#chat-answers:empty {
  display: none;
}

.answer-btn {
  display: flex;
  align-items: center;
  gap: 12px;
  width: 100%;
  padding: 14px 16px;
  background: rgba(26, 26, 26, 0.8);
  border: 1px solid var(--border-dark);
  border-radius: 12px;
  color: var(--text-light);
  font-family: 'Inter', sans-serif;
  font-size: 0.93rem;
  text-align: left;
  cursor: pointer;
  transition: all 0.3s ease;
}

.answer-btn:hover {
  border-color: rgba(255, 177, 86, 0.6);
  background: rgba(40, 40, 40, 0.9);
  transform: translateX(4px);
}

.answer-letter {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  min-width: 32px;
  border-radius: 50%;
  background: rgba(255, 177, 86, 0.15);
  border: 1px solid rgba(255, 177, 86, 0.4);
  font-family: 'Montserrat', sans-serif;
  font-size: 1rem;
  color: var(--primary-orange);
}

.answer-text {
  flex: 1;
}

/* ==================== POP-UP FLOOD ==================== */
#popup-flood {
  position: fixed;
  inset: 0;
  z-index: 100;
  pointer-events: none;
  overflow: hidden;
}

.error-popup {
  position: absolute;
  width: clamp(220px, 35vw, 320px);
  background: #1a1a1a;
  border: 2px solid var(--alert-red);
  border-radius: 8px;
  box-shadow: 0 0 20px rgba(255, 51, 68, 0.4), 0 4px 15px rgba(0, 0, 0, 0.6);
  animation: popup-spawn 0.3s ease-out;
  overflow: hidden;
}

.popup-header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: var(--alert-red);
  color: #fff;
  font-family: 'Inter', sans-serif;
  font-size: 0.75rem;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.popup-icon {
  font-size: 0.9rem;
}

.popup-close {
  margin-left: auto;
  opacity: 0.7;
}

.popup-body {
  padding: 10px 12px;
  color: var(--alert-red);
  font-family: 'Inter', sans-serif;
  font-size: 0.78rem;
  font-weight: 600;
  line-height: 1.4;
}

@keyframes popup-spawn {
  0%   { opacity: 0; transform: scale(0.5) rotate(0deg); }
  50%  { transform: scale(1.1); }
  100% { opacity: 1; transform: scale(1); }
}

/* ==================== BOUTON QUITTER ==================== */
.exit-btn {
  justify-content: center;
  background: rgba(255, 51, 68, 0.15) !important;
  border-color: var(--alert-red) !important;
  color: var(--alert-red) !important;
  font-weight: 700;
  font-size: 1rem !important;
  text-transform: uppercase;
  letter-spacing: 1px;
}

.exit-btn:hover {
  background: rgba(255, 51, 68, 0.3) !important;
  transform: none !important;
}

/* ==================== MESSAGE DE VICTOIRE ==================== */
#victory-message {
  position: fixed;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  z-index: 40;
  text-align: center;
  animation: victory-appear 1.5s ease-out;
}

@keyframes victory-appear {
  0%   { opacity: 0; transform: translate(-50%, -50%) scale(0.8); }
  60%  { transform: translate(-50%, -50%) scale(1.05); }
  100% { opacity: 1; transform: translate(-50%, -50%) scale(1); }
}

.victory-title {
  font-family: 'Montserrat', sans-serif; font-weight: 900;
  font-size: clamp(1.8rem, 4vw, 3rem);
  color: var(--primary-orange);
  text-shadow:
    0 0 15px rgba(255, 177, 86, 0.5),
    0 0 40px rgba(255, 177, 86, 0.2);
  margin-bottom: 15px;
}

.victory-subtitle {
  font-family: 'Montserrat', sans-serif;
  font-size: clamp(1.1rem, 2.5vw, 1.6rem);
  color: var(--text-gray);
  line-height: 1.5;
}

/* ==================== EFFETS MAUVAISE RÉPONSE ==================== */
body.screen-shake {
  animation: screen-shake 0.6s ease;
}

@keyframes screen-shake {
  0%, 100% { transform: translate(0); }
  10%      { transform: translate(-8px, 4px); }
  20%      { transform: translate(8px, -4px); }
  30%      { transform: translate(-6px, 6px); }
  40%      { transform: translate(6px, -2px); }
  50%      { transform: translate(-4px, 4px); }
  60%      { transform: translate(4px, -4px); }
  70%      { transform: translate(-2px, 2px); }
  80%      { transform: translate(2px, -2px); }
  90%      { transform: translate(-1px, 1px); }
}

body.glitch-effect::after {
  content: '';
  position: fixed;
  inset: 0;
  background: repeating-linear-gradient(
    0deg,
    transparent,
    transparent 2px,
    rgba(255, 51, 68, 0.03) 2px,
    rgba(255, 51, 68, 0.03) 4px
  );
  z-index: 9999;
  pointer-events: none;
  animation: glitch-lines 0.3s steps(3) infinite;
}

@keyframes glitch-lines {
  0%   { transform: translateY(0); }
  33%  { transform: translateY(-5px); }
  66%  { transform: translateY(3px); }
  100% { transform: translateY(0); }
}

body.red-flash::before {
  content: '';
  position: fixed;
  inset: 0;
  background: rgba(150, 0, 0, 0.3);
  z-index: 9998;
  pointer-events: none;
  animation: flash-out 0.8s ease-out forwards;
}

@keyframes flash-out {
  0%   { opacity: 1; }
  100% { opacity: 0; }
}

/* ==================== RESPONSIVE ==================== */
@media (max-width: 768px) {
  #chat-zone {
    padding: 15px 10px;
  }

  .chat-bubble {
    max-width: 90%;
    font-size: 0.9rem;
  }

  .answer-btn {
    padding: 12px 14px;
    font-size: 0.88rem;
  }
}

@media (max-width: 480px) {
  .chat-bubble {
    max-width: 95%;
    padding: 10px 14px;
    font-size: 0.85rem;
  }

  .answer-letter {
    width: 28px;
    height: 28px;
    min-width: 28px;
    font-size: 0.9rem;
  }

  .answer-btn {
    padding: 11px 12px;
    gap: 10px;
  }
}
