/* ============================================
   SETUP PAGE — QuizMaster Pro
   ============================================ */

/* ---------- Page-level fade-in ---------- */
@keyframes fadeIn {
  from { opacity: 0; }
  to   { opacity: 1; }
}

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

@keyframes pulseGlow {
  0%, 100% { text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.3); }
  50%      { text-shadow: 0 0 30px rgba(255, 215, 0, 0.8), 0 0 60px rgba(255, 215, 0, 0.4); }
}

body {
  animation: fadeIn 0.6s ease-out;
}

/* ---------- Container ---------- */
.setup-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem 1.5rem 4rem;
}

/* ---------- Header ---------- */
.setup-header {
  text-align: center;
  margin-bottom: 3rem;
  animation: slideUp 0.6s ease-out both;
}

.logo {
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 2px;
  line-height: 1.15;
  margin: 0 0 0.5rem;
}

.logo .accent {
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.3);
  animation: pulseGlow 3s ease-in-out infinite;
}

.tagline {
  color: rgba(255, 255, 255, 0.6);
  font-size: 1.1rem;
  font-weight: 400;
  margin: 0;
}

/* ---------- Sections ---------- */
.setup-section {
  margin-bottom: 2rem;
  padding: 2rem;
  animation: slideUp 0.6s ease-out both;
}

.setup-section:nth-child(2) { animation-delay: 0.1s; }
.setup-section:nth-child(3) { animation-delay: 0.2s; }
.setup-section:nth-child(4) { animation-delay: 0.3s; }
.setup-section:nth-child(5) { animation-delay: 0.4s; }

.setup-section h2 {
  font-size: 1.5rem;
  font-weight: 700;
  margin: 0 0 1.5rem;
  color: rgba(255, 255, 255, 0.95);
}

/* ---------- Settings grid ---------- */
.settings-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 1.5rem;
}

.setting-item label {
  display: block;
  margin-bottom: 0.5rem;
  font-weight: 600;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
}

.setting-item input {
  width: 100%;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 1.1rem;
  font-family: 'Outfit', sans-serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  box-sizing: border-box;
}

.setting-item input:focus {
  border-color: #ffd700;
  outline: none;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.25), 0 0 4px rgba(255, 215, 0, 0.15);
}

/* ---------- Team form ---------- */
.team-form {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
}

.team-form input[type="text"] {
  flex: 1;
  min-width: 200px;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  font-size: 1.1rem;
  font-family: 'Outfit', sans-serif;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.team-form input[type="text"]::placeholder {
  color: rgba(255, 255, 255, 0.35);
}

.team-form input[type="text"]:focus {
  border-color: #ffd700;
  outline: none;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.25), 0 0 4px rgba(255, 215, 0, 0.15);
}

.team-form input[type="color"] {
  width: 50px;
  height: 45px;
  border-radius: 8px;
  cursor: pointer;
  border: none;
  padding: 2px;
  background: rgba(255, 255, 255, 0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.team-form input[type="color"]:hover {
  transform: scale(1.05);
}

/* ---------- Team list ---------- */
.team-list {
  display: grid;
  gap: 1rem;
}

.team-card {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem 1.5rem;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 12px;
  border-left: 4px solid var(--team-color, #ff4444);
  animation: slideUp 0.35s ease-out both;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.team-card:hover {
  background: rgba(255, 255, 255, 0.08);
}

.team-color-dot {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  flex-shrink: 0;
  box-shadow: 0 0 8px var(--team-color, #ff4444);
}

.team-name {
  flex: 1;
  font-weight: 600;
  font-size: 1.1rem;
  color: rgba(255, 255, 255, 0.95);
}

.remove-team-btn {
  background: transparent;
  border: none;
  color: #ff4757;
  cursor: pointer;
  font-size: 1.2rem;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  line-height: 1;
}

.remove-team-btn:hover {
  background: rgba(255, 71, 87, 0.15);
  color: #ff6b7d;
  transform: scale(1.15);
}

/* ---------- Launch section ---------- */
.launch-info {
  color: rgba(255, 255, 255, 0.6);
  margin: 0 0 1.5rem;
  font-size: 0.95rem;
}

.room-info {
  margin-top: 2rem;
  animation: slideUp 0.5s ease-out both;
}

.room-code-display {
  text-align: center;
  margin: 2rem 0;
}

.room-label {
  display: block;
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.6);
  margin-bottom: 0.5rem;
  letter-spacing: 3px;
  text-transform: uppercase;
  font-weight: 600;
}

.room-code {
  display: block;
  font-size: 3rem;
  font-weight: 900;
  letter-spacing: 8px;
  color: #ffd700;
  text-shadow: 0 0 20px rgba(255, 215, 0, 0.6), 0 0 40px rgba(255, 215, 0, 0.3);
  font-family: 'Courier New', Courier, monospace;
  animation: pulseGlow 2.5s ease-in-out infinite;
}

/* ---------- QR Code section ---------- */
.qr-section {
  text-align: center;
  margin: 2rem 0;
  animation: slideUp 0.5s ease-out 0.2s both;
}

.qr-wrapper {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  box-shadow:
    0 0 20px rgba(255, 215, 0, 0.15),
    0 0 40px rgba(255, 215, 0, 0.05),
    0 4px 24px rgba(0, 0, 0, 0.4);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.qr-wrapper:hover {
  transform: scale(1.03);
  box-shadow:
    0 0 30px rgba(255, 215, 0, 0.25),
    0 0 60px rgba(255, 215, 0, 0.1),
    0 8px 32px rgba(0, 0, 0, 0.5);
}

.qr-canvas {
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 200px;
  min-height: 200px;
}

.qr-canvas canvas {
  display: block;
  border-radius: 4px;
}

.qr-label {
  margin: 1rem 0 0.4rem;
  font-size: 1rem;
  font-weight: 600;
  color: rgba(255, 255, 255, 0.8);
}

.qr-label strong {
  color: #ffd700;
}

.qr-url {
  font-size: 0.75rem;
  font-family: 'Courier New', Courier, monospace;
  color: rgba(255, 255, 255, 0.35);
  word-break: break-all;
  margin: 0;
  padding: 0 1rem;
}

.launch-buttons {
  display: flex;
  gap: 1rem;
  justify-content: center;
  flex-wrap: wrap;
}

.help-text {
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  font-size: 0.9rem;
  margin-top: 1rem;
}

/* ---------- Button overrides ---------- */
.btn-large {
  padding: 1rem 2rem;
  font-size: 1.1rem;
}

#create-game-btn:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* ---------- Join form ---------- */
.join-form {
  display: flex;
  gap: 1rem;
  align-items: center;
  flex-wrap: wrap;
}

.join-form input {
  max-width: 200px;
  text-align: center;
  font-size: 1.3rem;
  letter-spacing: 4px;
  padding: 0.75rem 1rem;
  background: rgba(255, 255, 255, 0.08);
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  color: #fff;
  font-family: 'Outfit', sans-serif;
  font-weight: 700;
  text-transform: uppercase;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.join-form input::placeholder {
  color: rgba(255, 255, 255, 0.3);
  font-size: 0.85rem;
  letter-spacing: 1px;
  font-weight: 400;
}

.join-form input:focus {
  border-color: #ffd700;
  outline: none;
  box-shadow: 0 0 12px rgba(255, 215, 0, 0.25), 0 0 4px rgba(255, 215, 0, 0.15);
}

/* ---------- Empty state ---------- */
.team-list-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(255, 255, 255, 0.35);
  font-size: 0.95rem;
  border: 2px dashed rgba(255, 255, 255, 0.1);
  border-radius: 12px;
}

/* ---------- Responsive ---------- */
@media (max-width: 600px) {
  .setup-container {
    padding: 1.25rem 1rem 3rem;
  }

  .logo {
    font-size: 2rem;
  }

  .tagline {
    font-size: 0.95rem;
  }

  .setup-section {
    padding: 1.25rem;
  }

  .setup-section h2 {
    font-size: 1.25rem;
  }

  .settings-grid {
    grid-template-columns: 1fr;
    gap: 1rem;
  }

  .team-form {
    flex-direction: column;
  }

  .team-form input[type="text"] {
    min-width: unset;
  }

  .team-form input[type="color"] {
    width: 100%;
    height: 40px;
  }

  .team-card {
    padding: 0.75rem 1rem;
  }

  .room-code {
    font-size: 2.2rem;
    letter-spacing: 6px;
  }

  .launch-buttons {
    flex-direction: column;
  }

  .btn-large {
    width: 100%;
    text-align: center;
  }

  .join-form {
    flex-direction: column;
  }

  .join-form input {
    max-width: unset;
    width: 100%;
  }

  .join-form .btn {
    width: 100%;
    text-align: center;
  }
}

/* ---------- Section Divider ---------- */
.section-divider {
  display: flex;
  align-items: center;
  gap: 1rem;
  margin: 2.5rem 0;
  animation: slideUp 0.6s ease-out 0.15s both;
}

.divider-line {
  flex: 1;
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(255,215,0,0.3), transparent);
}

.divider-text {
  font-size: 0.85rem;
  font-weight: 700;
  letter-spacing: 3px;
  color: rgba(255,215,0,0.6);
  white-space: nowrap;
}

/* ---------- Quiz Name Input ---------- */
.setting-item-full {
  grid-column: 1 / -1;
}

/* ---------- Quiz List ---------- */
.quiz-list {
  display: grid;
  gap: 1rem;
}

.quiz-list-loading,
.quiz-list-empty {
  text-align: center;
  padding: 2rem 1rem;
  color: rgba(255,255,255,0.35);
  font-size: 0.95rem;
}

.quiz-card {
  padding: 1.25rem 1.5rem;
  background: rgba(255,255,255,0.04);
  border-radius: 12px;
  border: 1px solid rgba(255,255,255,0.08);
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  animation: slideUp 0.35s ease-out both;
}

.quiz-card:hover {
  background: rgba(255,255,255,0.07);
  border-color: rgba(255,255,255,0.15);
}

.quiz-card-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 0.75rem;
}

.quiz-card-name {
  font-size: 1.15rem;
  font-weight: 700;
  margin: 0;
  color: rgba(255,255,255,0.95);
}

.quiz-card-phase {
  font-size: 0.75rem;
  font-weight: 600;
  padding: 0.2rem 0.75rem;
  border-radius: 50px;
  letter-spacing: 1px;
  text-transform: uppercase;
}

.phase-playing {
  background: rgba(0,255,136,0.12);
  color: #00ff88;
  border: 1px solid rgba(0,255,136,0.2);
}

.phase-results {
  background: rgba(255,215,0,0.12);
  color: #ffd700;
  border: 1px solid rgba(255,215,0,0.2);
}

.phase-setup {
  background: rgba(0,212,255,0.12);
  color: #00d4ff;
  border: 1px solid rgba(0,212,255,0.2);
}

.quiz-card-meta {
  display: flex;
  gap: 1.25rem;
  margin-bottom: 1rem;
  flex-wrap: wrap;
}

.quiz-card-meta span {
  font-size: 0.8rem;
  color: rgba(255,255,255,0.45);
}

.quiz-card-code {
  font-family: 'Courier New', Courier, monospace;
  font-weight: 700;
  letter-spacing: 2px;
  color: rgba(255,215,0,0.6) !important;
}

.quiz-card-actions {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
}

.btn-sm {
  padding: 0.4rem 0.8rem;
  font-size: 0.8rem;
}
