/* WizardKids – main.css
   Shared styles for auth & parent pages
   Game pages use inline styles for performance.
*/

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

html { font-size: 16px; scroll-behavior: smooth; }

body {
  font-family: 'Nunito', 'Segoe UI', Arial, sans-serif;
  background: #f0f4f8;
  color: #2C3E50;
  min-height: 100vh;
  -webkit-font-smoothing: antialiased;
}

/* ── Typography ────────────────────────────────────────────────────────────── */
.font-game { font-family: 'Fredoka One', cursive; }

h1, h2, h3 { font-family: 'Fredoka One', cursive; line-height: 1.2; }

/* ── Utility ───────────────────────────────────────────────────────────────── */
.sr-only { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0,0,0,0); }
.text-center { text-align: center; }
.mt-1 { margin-top: 0.5rem; }
.mt-2 { margin-top: 1rem; }
.mt-3 { margin-top: 1.5rem; }
.mb-1 { margin-bottom: 0.5rem; }
.mb-2 { margin-bottom: 1rem; }

/* ── Card ──────────────────────────────────────────────────────────────────── */
.card {
  background: #fff;
  border-radius: 20px;
  padding: 2rem;
  box-shadow: 0 4px 24px rgba(0,0,0,0.08);
}

/* ── Buttons ───────────────────────────────────────────────────────────────── */
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 0.4rem;
  padding: 0.75rem 1.5rem;
  border: none;
  border-radius: 14px;
  cursor: pointer;
  font-family: 'Fredoka One', cursive;
  font-size: 1.05rem;
  text-decoration: none;
  transition: transform 0.15s, opacity 0.15s, box-shadow 0.15s;
  user-select: none;
}
.btn:hover  { transform: translateY(-2px); opacity: 0.92; }
.btn:active { transform: translateY(0);    opacity: 1; }

.btn-primary {
  background: linear-gradient(135deg, #9B59B6, #7B2FBE);
  color: #fff;
  box-shadow: 0 4px 15px rgba(155,89,182,0.4);
}
.btn-secondary {
  background: #f0f0f0;
  color: #555;
}
.btn-danger {
  background: #C0392B;
  color: #fff;
}
.btn-gold {
  background: linear-gradient(135deg, #F1C40F, #E67E22);
  color: #fff;
  box-shadow: 0 4px 15px rgba(241,196,15,0.4);
}
.btn-full { width: 100%; }

/* ── Forms ─────────────────────────────────────────────────────────────────── */
.form-group { margin-bottom: 1.1rem; }

.form-group label {
  display: block;
  font-weight: 700;
  font-size: 0.88rem;
  color: #555;
  margin-bottom: 0.35rem;
}

.form-group input[type="text"],
.form-group input[type="email"],
.form-group input[type="password"],
.form-group input[type="number"],
.form-group input[type="time"],
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 0.75rem 1rem;
  border: 2px solid #e0e0e0;
  border-radius: 12px;
  font-family: 'Nunito', sans-serif;
  font-size: 0.95rem;
  color: #2C3E50;
  background: #fff;
  outline: none;
  transition: border-color 0.2s;
}
.form-group input:focus,
.form-group select:focus,
.form-group textarea:focus {
  border-color: #9B59B6;
}

/* ── Alerts ─────────────────────────────────────────────────────────────────── */
.alert {
  padding: 0.75rem 1rem;
  border-radius: 12px;
  font-weight: 700;
  font-size: 0.9rem;
  margin-bottom: 1rem;
}
.alert-error   { background: #FFE5E5; border: 2px solid #FF6B6B; color: #c0392b; }
.alert-success { background: #E8F5E9; border: 2px solid #4CAF50; color: #2E7D32; }
.alert-info    { background: #E3F2FD; border: 2px solid #2196F3; color: #1565C0; }

/* ── Badges ─────────────────────────────────────────────────────────────────── */
.badge {
  display: inline-block;
  padding: 0.2rem 0.7rem;
  border-radius: 20px;
  font-size: 0.78rem;
  font-weight: 700;
}
.badge-purple { background: #F3E5F5; color: #6A1B9A; }
.badge-blue   { background: #E3F2FD; color: #1565C0; }
.badge-green  { background: #E8F5E9; color: #2E7D32; }
.badge-gold   { background: #FFF8E1; color: #E65100; }

/* ── Loading spinner ─────────────────────────────────────────────────────────── */
.spinner {
  display: inline-block;
  width: 24px;
  height: 24px;
  border: 3px solid rgba(155,89,182,0.25);
  border-top-color: #9B59B6;
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

/* ── Floating stars animation (used on auth pages) ──────────────────────────── */
.stars-bg {
  position: fixed;
  inset: 0;
  pointer-events: none;
  z-index: 0;
  overflow: hidden;
}
.star {
  position: absolute;
  border-radius: 50%;
  background: rgba(255,255,255,0.7);
  animation: twinkle var(--dur, 3s) ease-in-out infinite;
  animation-delay: var(--delay, 0s);
}
@keyframes twinkle {
  0%, 100% { opacity: 0.1; transform: scale(0.8); }
  50%       { opacity: 0.9; transform: scale(1.2); }
}

/* ── Avatar grid (profile creation) ─────────────────────────────────────────── */
.avatar-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(70px, 1fr));
  gap: 0.6rem;
  margin: 0.5rem 0 1rem;
}
.avatar-opt {
  font-size: 2.2rem;
  text-align: center;
  padding: 0.5rem;
  border-radius: 14px;
  border: 3px solid transparent;
  background: #f8f8f8;
  cursor: pointer;
  transition: all 0.2s;
}
.avatar-opt:hover  { border-color: #B07CC6; background: #F3E5F5; }
.avatar-opt.chosen { border-color: #9B59B6; background: #F3E5F5; transform: scale(1.1); }

/* ── Responsive ─────────────────────────────────────────────────────────────── */
@media (max-width: 600px) {
  .card { padding: 1.4rem; border-radius: 16px; }
  .btn  { padding: 0.65rem 1.2rem; font-size: 1rem; }
}
