/* Arc Quiz dApp - Main Styles */
/* Custom animations and effects not covered by Tailwind */

:root {
  --arc-blue: #3b82f6;
  --arc-purple: #8b5cf6;
  --arc-green: #22c55e;
  --arc-yellow: #eab308;
  --arc-orange: #f97316;
  --arc-red: #ef4444;
  --arc-dark: #030712;
  --arc-card: #111827;
  --arc-border: rgba(255,255,255,0.08);
}

/* ── Base ────────────────────────────────────────────────────────────────────── */
* { box-sizing: border-box; margin: 0; padding: 0; }
body { font-family: 'Inter', -apple-system, BlinkMacSystemFont, 'Segoe UI', system-ui, sans-serif; }

/* ── Scrollbar ───────────────────────────────────────────────────────────────── */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: #0f172a; }
::-webkit-scrollbar-thumb { background: #334155; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #475569; }

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

@keyframes slideInRight {
  from { opacity: 0; transform: translateX(30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes slideInLeft {
  from { opacity: 0; transform: translateX(-30px); }
  to { opacity: 1; transform: translateX(0); }
}

@keyframes scaleIn {
  from { opacity: 0; transform: scale(0.85); }
  to { opacity: 1; transform: scale(1); }
}

@keyframes bounce {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-8px); }
}

@keyframes pulse-ring {
  0% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.5); }
  70% { box-shadow: 0 0 0 15px rgba(59, 130, 246, 0); }
  100% { box-shadow: 0 0 0 0 rgba(59, 130, 246, 0); }
}

@keyframes glow-green {
  0%, 100% { box-shadow: 0 0 10px rgba(34, 197, 94, 0.3); }
  50% { box-shadow: 0 0 25px rgba(34, 197, 94, 0.7); }
}

@keyframes glow-red {
  0%, 100% { box-shadow: 0 0 10px rgba(239, 68, 68, 0.3); }
  50% { box-shadow: 0 0 25px rgba(239, 68, 68, 0.7); }
}

@keyframes timerPulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.5; }
}

@keyframes correctFlash {
  0% { background-color: transparent; }
  20% { background-color: rgba(34, 197, 94, 0.3); }
  100% { background-color: rgba(34, 197, 94, 0.1); }
}

@keyframes wrongFlash {
  0% { background-color: transparent; }
  20% { background-color: rgba(239, 68, 68, 0.3); }
  100% { background-color: rgba(239, 68, 68, 0.1); }
}

@keyframes shimmer {
  0% { background-position: -200% 0; }
  100% { background-position: 200% 0; }
}

@keyframes gradientShift {
  0% { background-position: 0% 50%; }
  50% { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

@keyframes confettiDrop {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

@keyframes countdownShake {
  0%, 100% { transform: rotate(0deg); }
  25% { transform: rotate(-5deg); }
  75% { transform: rotate(5deg); }
}

@keyframes vsFlash {
  0%, 100% { color: #fff; text-shadow: none; }
  50% { color: #f59e0b; text-shadow: 0 0 20px rgba(245,158,11,0.8); }
}

/* ── App Screens ─────────────────────────────────────────────────────────────── */
.screen { animation: fadeIn 0.35s ease-out; }

/* ── Card Components ─────────────────────────────────────────────────────────── */
.arc-card {
  background: var(--arc-card);
  border: 1px solid var(--arc-border);
  border-radius: 16px;
  transition: all 0.2s ease;
}

.arc-card-hover:hover {
  border-color: rgba(59, 130, 246, 0.35);
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.1);
  transform: translateY(-2px);
}

/* ── Buttons ─────────────────────────────────────────────────────────────────── */
.btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: white;
  border: none;
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 15px;
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb 0%, #7c3aed 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 15px rgba(59, 130, 246, 0.4);
}

.btn-primary:active { transform: translateY(0); }
.btn-primary:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  transform: none;
}

.btn-secondary {
  background: rgba(255,255,255,0.05);
  color: #94a3b8;
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  padding: 12px 24px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 15px;
}

.btn-secondary:hover {
  background: rgba(255,255,255,0.08);
  color: #e2e8f0;
  border-color: rgba(255,255,255,0.2);
}

.btn-danger {
  background: rgba(239, 68, 68, 0.1);
  color: #f87171;
  border: 1px solid rgba(239, 68, 68, 0.2);
  border-radius: 12px;
  padding: 10px 20px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
}

.btn-danger:hover {
  background: rgba(239, 68, 68, 0.2);
  border-color: rgba(239, 68, 68, 0.4);
}

/* ── Input ───────────────────────────────────────────────────────────────────── */
.arc-input {
  background: rgba(255,255,255,0.05);
  border: 1px solid rgba(255,255,255,0.1);
  border-radius: 12px;
  color: white;
  padding: 14px 16px;
  font-size: 15px;
  width: 100%;
  transition: all 0.2s ease;
  outline: none;
}

.arc-input:focus {
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.15);
}

.arc-input::placeholder { color: #475569; }

/* ── Timer ───────────────────────────────────────────────────────────────────── */
.timer-ring {
  transform: rotate(-90deg);
  transform-origin: center;
  transition: stroke-dashoffset 1s linear;
}

.timer-critical { animation: timerPulse 0.5s infinite; }

/* ── Question Options ────────────────────────────────────────────────────────── */
.option-btn {
  width: 100%;
  text-align: left;
  padding: 16px 20px;
  border-radius: 12px;
  border: 2px solid rgba(255,255,255,0.08);
  background: rgba(255,255,255,0.03);
  color: #e2e8f0;
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 15px;
  display: flex;
  align-items: center;
  gap: 12px;
}

.option-btn:hover:not(:disabled) {
  border-color: rgba(59, 130, 246, 0.4);
  background: rgba(59, 130, 246, 0.08);
  color: white;
}

.option-btn.selected {
  border-color: #3b82f6;
  background: rgba(59, 130, 246, 0.1);
}

.option-btn.correct {
  border-color: #22c55e !important;
  background: rgba(34, 197, 94, 0.1) !important;
  color: #86efac;
  animation: glow-green 1s ease;
}

.option-btn.wrong {
  border-color: #ef4444 !important;
  background: rgba(239, 68, 68, 0.1) !important;
  color: #fca5a5;
  animation: glow-red 1s ease;
}

.option-btn:disabled { cursor: not-allowed; }

.option-label {
  width: 28px;
  height: 28px;
  border-radius: 8px;
  background: rgba(255,255,255,0.08);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 13px;
  flex-shrink: 0;
  transition: all 0.2s;
}

.option-btn.correct .option-label { background: rgba(34,197,94,0.2); color: #22c55e; }
.option-btn.wrong .option-label { background: rgba(239,68,68,0.2); color: #ef4444; }
.option-btn.selected .option-label { background: rgba(59,130,246,0.2); color: #3b82f6; }

/* ── VS Screen ───────────────────────────────────────────────────────────────── */
.vs-text { animation: vsFlash 1.5s infinite; font-size: 3rem; font-weight: 900; }

/* ── Score Display ───────────────────────────────────────────────────────────── */
.score-bar {
  height: 6px;
  border-radius: 3px;
  background: rgba(255,255,255,0.1);
  overflow: hidden;
}

.score-fill {
  height: 100%;
  border-radius: 3px;
  transition: width 0.5s ease;
}

/* ── Level Cards ─────────────────────────────────────────────────────────────── */
.level-card {
  cursor: pointer;
  transition: all 0.2s ease;
  border-radius: 16px;
  border: 2px solid transparent;
  padding: 20px;
}

.level-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 8px 25px rgba(0,0,0,0.4);
}

.level-card.selected {
  border-color: #3b82f6 !important;
  box-shadow: 0 0 20px rgba(59,130,246,0.3);
}

/* ── Progress Bar ────────────────────────────────────────────────────────────── */
.progress-bar {
  height: 4px;
  background: rgba(255,255,255,0.1);
  border-radius: 2px;
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6);
  border-radius: 2px;
  transition: width 0.3s ease;
}

/* ── Wallet Badge ────────────────────────────────────────────────────────────── */
.wallet-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(59, 130, 246, 0.1);
  border: 1px solid rgba(59, 130, 246, 0.2);
  border-radius: 10px;
  padding: 8px 12px;
  font-size: 13px;
  color: #93c5fd;
  animation: pulse-ring 2s infinite;
}

/* ── Hero Section ────────────────────────────────────────────────────────────── */
.hero-gradient {
  background: linear-gradient(135deg, #0f172a 0%, #1e1b4b 50%, #0f172a 100%);
  background-size: 200% 200%;
  animation: gradientShift 8s ease infinite;
}

/* ── Network Badge ───────────────────────────────────────────────────────────── */
.network-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  background: rgba(34, 197, 94, 0.1);
  border: 1px solid rgba(34, 197, 94, 0.2);
  border-radius: 999px;
  padding: 4px 12px;
  font-size: 12px;
  color: #86efac;
  font-weight: 500;
}

.network-badge .dot {
  width: 6px;
  height: 6px;
  background: #22c55e;
  border-radius: 50%;
  animation: pulse 2s infinite;
}

/* ── Token Badge ─────────────────────────────────────────────────────────────── */
.token-usdc { color: #2775ca; }
.token-eurc { color: #1a3c8f; }

.reward-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(39, 117, 202, 0.1);
  border: 1px solid rgba(39, 117, 202, 0.2);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 12px;
  font-weight: 600;
  color: #60a5fa;
}

/* ── Match Result ────────────────────────────────────────────────────────────── */
.result-win {
  background: linear-gradient(135deg, rgba(34,197,94,0.1) 0%, rgba(16,185,129,0.05) 100%);
  border: 1px solid rgba(34,197,94,0.2);
  animation: glow-green 2s ease infinite;
}

.result-lose {
  background: linear-gradient(135deg, rgba(239,68,68,0.1) 0%, rgba(185,28,28,0.05) 100%);
  border: 1px solid rgba(239,68,68,0.2);
}

.result-tie {
  background: linear-gradient(135deg, rgba(234,179,8,0.1) 0%, rgba(180,83,9,0.05) 100%);
  border: 1px solid rgba(234,179,8,0.2);
}

/* ── Loading Spinner ─────────────────────────────────────────────────────────── */
.spinner {
  width: 36px;
  height: 36px;
  border: 3px solid rgba(255,255,255,0.1);
  border-top-color: #3b82f6;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* ── Confetti ────────────────────────────────────────────────────────────────── */
.confetti-piece {
  position: fixed;
  width: 10px;
  height: 10px;
  border-radius: 2px;
  animation: confettiDrop 3s linear forwards;
  pointer-events: none;
  z-index: 9999;
}

/* ── Leaderboard ─────────────────────────────────────────────────────────────── */
.leaderboard-row {
  transition: all 0.2s;
  border-radius: 10px;
  padding: 10px 12px;
}

.leaderboard-row:hover { background: rgba(255,255,255,0.04); }
.leaderboard-row.rank-1 { background: rgba(234,179,8,0.06); }
.leaderboard-row.rank-2 { background: rgba(148,163,184,0.06); }
.leaderboard-row.rank-3 { background: rgba(180,83,9,0.06); }

/* ── Admin Panel ─────────────────────────────────────────────────────────────── */
.admin-section {
  background: #111827;
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 16px;
  padding: 24px;
}

/* ── Toast Notification ──────────────────────────────────────────────────────── */
.toast {
  position: fixed;
  top: 20px;
  right: 20px;
  z-index: 10000;
  padding: 14px 20px;
  border-radius: 12px;
  font-size: 14px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 10px;
  max-width: 360px;
  animation: slideInRight 0.3s ease;
  box-shadow: 0 10px 30px rgba(0,0,0,0.5);
}

.toast-success { background: #052e16; border: 1px solid rgba(34,197,94,0.3); color: #86efac; }
.toast-error { background: #2d0a0a; border: 1px solid rgba(239,68,68,0.3); color: #fca5a5; }
.toast-info { background: #0c1a3b; border: 1px solid rgba(59,130,246,0.3); color: #93c5fd; }
.toast-warning { background: #1c1204; border: 1px solid rgba(234,179,8,0.3); color: #fde047; }

/* ── Mobile Responsive ───────────────────────────────────────────────────────── */
@media (max-width: 768px) {
  .option-btn { padding: 12px 14px; font-size: 14px; }
  .level-card { padding: 14px; }
  .toast { right: 12px; left: 12px; max-width: none; }
}

/* ── AI Thinking Indicator ───────────────────────────────────────────────────── */
.ai-thinking {
  display: flex;
  align-items: center;
  gap: 4px;
}

.ai-thinking .dot {
  width: 6px;
  height: 6px;
  background: #8b5cf6;
  border-radius: 50%;
  animation: bounce 1.2s infinite;
}

.ai-thinking .dot:nth-child(2) { animation-delay: 0.2s; }
.ai-thinking .dot:nth-child(3) { animation-delay: 0.4s; }

/* ── Matchmaking Queue ───────────────────────────────────────────────────────── */
.queue-pulse {
  animation: pulse-ring 2s infinite;
}

/* ── Block Explorer Link ─────────────────────────────────────────────────────── */
.explorer-link {
  color: #60a5fa;
  text-decoration: none;
  display: inline-flex;
  align-items: center;
  gap: 4px;
  font-size: 12px;
  transition: color 0.2s;
}

.explorer-link:hover { color: #93c5fd; text-decoration: underline; }

/* ── Category Badge ──────────────────────────────────────────────────────────── */
.category-badge {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: rgba(255,255,255,0.06);
  border: 1px solid rgba(255,255,255,0.08);
  border-radius: 6px;
  padding: 2px 8px;
  font-size: 11px;
  color: #94a3b8;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  font-weight: 500;
}

/* ── Smooth transitions ──────────────────────────────────────────────────────── */
.fade-in { animation: fadeIn 0.3s ease-out; }
.scale-in { animation: scaleIn 0.3s cubic-bezier(0.34, 1.56, 0.64, 1); }
.slide-right { animation: slideInRight 0.3s ease-out; }
.slide-left { animation: slideInLeft 0.3s ease-out; }
