/* ===== ZEROCHOOL SYSTEM - GLOBAL STYLES ===== */
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700;800;900&family=Orbitron:wght@400;700;900&display=swap');

:root {
  --bg-primary: #05050f;
  --bg-secondary: #0a0a1a;
  --bg-card: rgba(15, 15, 35, 0.8);
  --bg-card-hover: rgba(20, 20, 50, 0.9);
  --purple-primary: #7c3aed;
  --purple-light: #a855f7;
  --purple-glow: #8b5cf6;
  --cyan: #06b6d4;
  --blue: #3b82f6;
  --green: #10b981;
  --red: #ef4444;
  --gold: #f59e0b;
  --text-primary: #f1f5f9;
  --text-secondary: #94a3b8;
  --border-color: rgba(139, 92, 246, 0.2);
  --border-glow: rgba(139, 92, 246, 0.5);
  --shadow-glow: 0 0 20px rgba(139, 92, 246, 0.3);
  --shadow-strong: 0 0 40px rgba(139, 92, 246, 0.5);
}

* { margin: 0; padding: 0; box-sizing: border-box; }
html { scroll-behavior: smooth; }

body {
  font-family: 'Inter', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ===== SCROLLBAR ===== */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: var(--bg-secondary); }
::-webkit-scrollbar-thumb { background: var(--purple-primary); border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: var(--purple-light); }

/* ===== ANIMATIONS ===== */
@keyframes fadeIn { from { opacity: 0; transform: translateY(20px); } to { opacity: 1; transform: translateY(0); } }
@keyframes slideIn { from { opacity: 0; transform: translateX(-30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes slideInRight { from { opacity: 0; transform: translateX(30px); } to { opacity: 1; transform: translateX(0); } }
@keyframes pulse { 0%,100% { opacity: 1; } 50% { opacity: 0.5; } }
@keyframes glow { 0%,100% { box-shadow: 0 0 10px rgba(139,92,246,0.3); } 50% { box-shadow: 0 0 30px rgba(139,92,246,0.8), 0 0 60px rgba(139,92,246,0.4); } }
@keyframes glowText { 0%,100% { text-shadow: 0 0 10px rgba(139,92,246,0.5); } 50% { text-shadow: 0 0 20px rgba(139,92,246,1), 0 0 40px rgba(139,92,246,0.7); } }
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
@keyframes rankUp { 0% { transform: scale(1) rotate(0deg); opacity: 1; } 50% { transform: scale(2) rotate(180deg); opacity: 0.8; } 100% { transform: scale(1) rotate(360deg); opacity: 1; } }
@keyframes particleBurst { 0% { transform: scale(0) translate(0,0); opacity: 1; } 100% { transform: scale(1) translate(var(--tx), var(--ty)); opacity: 0; } }
@keyframes shimmer { 0% { background-position: -200% center; } 100% { background-position: 200% center; } }
@keyframes progressFill { from { width: 0%; } to { width: var(--target-width); } }
@keyframes float { 0%,100% { transform: translateY(0px); } 50% { transform: translateY(-10px); } }
@keyframes scanline { 0% { transform: translateY(-100%); } 100% { transform: translateY(100vh); } }
@keyframes typewriter { from { width: 0; } to { width: 100%; } }
@keyframes blink { 50% { border-color: transparent; } }
@keyframes energyPulse { 0% { box-shadow: 0 0 5px #7c3aed, inset 0 0 5px rgba(124,58,237,0.3); } 50% { box-shadow: 0 0 20px #a855f7, 0 0 40px #7c3aed, inset 0 0 20px rgba(168,85,247,0.3); } 100% { box-shadow: 0 0 5px #7c3aed, inset 0 0 5px rgba(124,58,237,0.3); } }
@keyframes rankReveal { 0% { clip-path: circle(0%); opacity: 0; } 60% { clip-path: circle(80%); opacity: 1; } 100% { clip-path: circle(100%); opacity: 1; } }
@keyframes levelUpFlash { 0%,100% { background: transparent; } 50% { background: rgba(139,92,246,0.15); } }
@keyframes xpBarFill { from { width: 0; box-shadow: none; } to { width: var(--xp-width); box-shadow: 0 0 10px #a855f7, 0 0 20px #7c3aed; } }
@keyframes countUp { from { opacity: 0; transform: scale(0.5); } to { opacity: 1; transform: scale(1); } }
@keyframes shake { 0%,100% { transform: translateX(0); } 25% { transform: translateX(-5px); } 75% { transform: translateX(5px); } }
@keyframes bounceIn { 0% { transform: scale(0); opacity: 0; } 60% { transform: scale(1.2); opacity: 1; } 100% { transform: scale(1); } }
@keyframes nebula { 0%,100% { background-position: 0% 50%; } 50% { background-position: 100% 50%; } }

/* ===== GLASS CARD ===== */
.glass-card {
  background: var(--bg-card);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--border-color);
  border-radius: 16px;
  transition: all 0.3s ease;
}
.glass-card:hover { border-color: var(--border-glow); box-shadow: var(--shadow-glow); }

/* ===== BUTTONS ===== */
.btn-primary {
  background: linear-gradient(135deg, #7c3aed, #a855f7);
  border: none; border-radius: 10px;
  color: white; font-weight: 600;
  cursor: pointer; transition: all 0.3s ease;
  position: relative; overflow: hidden;
}
.btn-primary::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, #a855f7, #7c3aed);
  opacity: 0; transition: opacity 0.3s;
}
.btn-primary:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(139,92,246,0.5); }
.btn-primary:hover::before { opacity: 1; }
.btn-primary:active { transform: translateY(0); }

.btn-secondary {
  background: rgba(139,92,246,0.1);
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 10px; color: var(--purple-light);
  font-weight: 600; cursor: pointer; transition: all 0.3s ease;
}
.btn-secondary:hover {
  background: rgba(139,92,246,0.2);
  border-color: var(--purple-light);
  box-shadow: 0 0 15px rgba(139,92,246,0.3);
}

/* ===== INPUT FIELDS ===== */
.input-field {
  background: rgba(10, 10, 30, 0.8);
  border: 1px solid rgba(139,92,246,0.25);
  border-radius: 10px; color: var(--text-primary);
  transition: all 0.3s ease; outline: none;
  width: 100%;
}
.input-field:focus {
  border-color: var(--purple-light);
  box-shadow: 0 0 0 3px rgba(139,92,246,0.15), 0 0 15px rgba(139,92,246,0.2);
}
.input-field.error { border-color: var(--red); box-shadow: 0 0 0 3px rgba(239,68,68,0.15); }
.input-field.success { border-color: var(--green); box-shadow: 0 0 0 3px rgba(16,185,129,0.15); }

/* ===== PROGRESS BAR ===== */
.progress-bar-container { background: rgba(255,255,255,0.05); border-radius: 99px; overflow: hidden; }
.progress-bar {
  height: 100%; border-radius: 99px;
  background: linear-gradient(90deg, #7c3aed, #a855f7, #c084fc);
  background-size: 200% auto;
  animation: shimmer 3s linear infinite;
  transition: width 1s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
}
.progress-bar::after {
  content: ''; position: absolute; right: 0; top: 0; bottom: 0;
  width: 20px; background: rgba(255,255,255,0.4); border-radius: 99px;
  filter: blur(4px);
}

/* ===== RANK BADGES ===== */
.rank-badge { display: inline-flex; align-items: center; justify-content: center; border-radius: 8px; font-family: 'Orbitron', monospace; font-weight: 900; letter-spacing: 1px; }
.rank-E { background: linear-gradient(135deg, #6b7280, #9ca3af); color: #1f2937; }
.rank-D { background: linear-gradient(135deg, #92400e, #d97706); color: #451a03; }
.rank-C { background: linear-gradient(135deg, #065f46, #10b981); color: #022c22; }
.rank-B { background: linear-gradient(135deg, #1e40af, #3b82f6); color: #172554; }
.rank-A { background: linear-gradient(135deg, #7c3aed, #a855f7); color: #2e1065; }
.rank-S { background: linear-gradient(135deg, #d97706, #f59e0b, #fbbf24); color: #451a03; box-shadow: 0 0 15px rgba(245,158,11,0.5); animation: glow 2s infinite; }
.rank-SS { background: linear-gradient(135deg, #7c3aed, #ec4899, #7c3aed); background-size: 200% 200%; animation: nebula 3s ease infinite; color: white; box-shadow: 0 0 20px rgba(236,72,153,0.5); }
.rank-SSS { background: linear-gradient(135deg, #dc2626, #f97316, #dc2626); background-size: 200% 200%; animation: nebula 2s ease infinite; color: white; box-shadow: 0 0 30px rgba(220,38,38,0.7); }
.rank-NATION { background: linear-gradient(135deg, #1d4ed8, #7c3aed, #ec4899, #f59e0b); background-size: 400% 400%; animation: nebula 1.5s ease infinite; color: white; box-shadow: 0 0 40px rgba(139,92,246,0.8); }

/* ===== XP BAR ===== */
.xp-bar-glow {
  background: linear-gradient(90deg, #4c1d95, #7c3aed, #a855f7, #c084fc);
  background-size: 300% auto;
  animation: shimmer 2s linear infinite;
  box-shadow: 0 0 15px rgba(168,85,247,0.6);
  border-radius: 99px;
}

/* ===== NEON TEXT ===== */
.neon-text { animation: glowText 3s ease-in-out infinite; }
.neon-purple { color: var(--purple-light); text-shadow: 0 0 10px rgba(168,85,247,0.8); }
.neon-cyan { color: var(--cyan); text-shadow: 0 0 10px rgba(6,182,212,0.8); }
.neon-gold { color: #f59e0b; text-shadow: 0 0 10px rgba(245,158,11,0.8); }

/* ===== SIDEBAR ===== */
#sidebar { transition: transform 0.3s ease; }
.sidebar-item {
  display: flex; align-items: center; gap: 12px;
  padding: 10px 16px; border-radius: 10px;
  cursor: pointer; transition: all 0.2s ease;
  color: var(--text-secondary); font-size: 14px; font-weight: 500;
  position: relative; white-space: nowrap;
}
.sidebar-item:hover { background: rgba(139,92,246,0.1); color: var(--text-primary); }
.sidebar-item.active { background: rgba(139,92,246,0.2); color: var(--purple-light); }
.sidebar-item.active::before {
  content: ''; position: absolute; left: 0; top: 25%; bottom: 25%;
  width: 3px; background: var(--purple-light); border-radius: 0 3px 3px 0;
}
.sidebar-badge {
  margin-left: auto; padding: 2px 8px; border-radius: 99px;
  font-size: 11px; font-weight: 700;
}

/* ===== NOTIFICATION ===== */
.notification-toast {
  position: fixed; top: 80px; right: 20px; z-index: 9999;
  min-width: 300px; max-width: 400px;
  padding: 16px 20px; border-radius: 14px;
  border: 1px solid rgba(139,92,246,0.3);
  backdrop-filter: blur(20px);
  animation: slideInRight 0.4s ease, fadeIn 0.4s ease;
  box-shadow: 0 10px 40px rgba(0,0,0,0.5), 0 0 20px rgba(139,92,246,0.2);
}

/* ===== MODAL ===== */
.modal-overlay {
  position: fixed; inset: 0; z-index: 9000;
  background: rgba(0,0,0,0.8); backdrop-filter: blur(8px);
  display: flex; align-items: center; justify-content: center;
  animation: fadeIn 0.3s ease;
}
.modal-content {
  background: linear-gradient(145deg, rgba(15,15,35,0.98), rgba(10,10,25,0.98));
  border: 1px solid rgba(139,92,246,0.3);
  border-radius: 20px; max-height: 90vh; overflow-y: auto;
  animation: bounceIn 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
  box-shadow: 0 25px 80px rgba(0,0,0,0.8), 0 0 40px rgba(139,92,246,0.2);
}

/* ===== STEP INDICATOR ===== */
.step-indicator { display: flex; align-items: center; gap: 8px; }
.step-dot {
  width: 36px; height: 36px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700; font-size: 14px; transition: all 0.4s ease;
  border: 2px solid rgba(139,92,246,0.3);
  background: rgba(139,92,246,0.1);
  color: var(--text-secondary);
}
.step-dot.active { background: var(--purple-primary); border-color: var(--purple-light); color: white; box-shadow: 0 0 15px rgba(139,92,246,0.5); }
.step-dot.completed { background: var(--green); border-color: var(--green); color: white; }
.step-line { flex: 1; height: 2px; background: rgba(139,92,246,0.2); border-radius: 99px; transition: background 0.4s ease; }
.step-line.completed { background: linear-gradient(90deg, var(--green), var(--purple-primary)); }

/* ===== CARDS ANIMATIONS ===== */
.animate-in { animation: fadeIn 0.5s ease forwards; }
.animate-slide { animation: slideIn 0.5s ease forwards; }
.animate-slide-right { animation: slideInRight 0.5s ease forwards; }

/* ===== QUEST CARD ===== */
.quest-card {
  position: relative; overflow: hidden;
  border-left: 3px solid var(--purple-primary);
}
.quest-card::before {
  content: ''; position: absolute; inset: 0;
  background: linear-gradient(135deg, rgba(124,58,237,0.05), transparent);
  pointer-events: none;
}

/* ===== LEVEL UP OVERLAY ===== */
#level-up-overlay {
  position: fixed; inset: 0; z-index: 10000;
  display: none; align-items: center; justify-content: center;
  background: rgba(0,0,0,0.9);
  animation: levelUpFlash 0.5s ease;
}
#level-up-overlay.active { display: flex; }
.level-up-content { text-align: center; animation: bounceIn 0.6s cubic-bezier(0.34, 1.56, 0.64, 1); }
.level-up-badge { width: 150px; height: 150px; border-radius: 50%; display: flex; align-items: center; justify-content: center; margin: 0 auto 24px; animation: glow 1.5s infinite; }

/* ===== STATS CARD ===== */
.stat-card {
  background: rgba(139,92,246,0.05);
  border: 1px solid rgba(139,92,246,0.15);
  border-radius: 14px; transition: all 0.3s ease;
}
.stat-card:hover { background: rgba(139,92,246,0.1); border-color: rgba(139,92,246,0.35); transform: translateY(-2px); }

/* ===== AVATAR ===== */
.avatar-ring {
  border-radius: 50%; padding: 3px;
  background: linear-gradient(135deg, #7c3aed, #a855f7, #06b6d4);
}
.avatar-ring img, .avatar-ring .avatar-placeholder { border-radius: 50%; }

/* ===== LOADING ===== */
.loading-spinner {
  width: 40px; height: 40px; border-radius: 50%;
  border: 3px solid rgba(139,92,246,0.2);
  border-top-color: var(--purple-primary);
  animation: spin 0.8s linear infinite;
}

/* ===== OTP INPUT ===== */
.otp-input {
  width: 50px; height: 60px; text-align: center;
  font-size: 24px; font-weight: 700;
  background: rgba(10,10,30,0.8);
  border: 2px solid rgba(139,92,246,0.3);
  border-radius: 12px; color: white;
  transition: all 0.3s; outline: none;
}
.otp-input:focus { border-color: var(--purple-light); box-shadow: 0 0 0 3px rgba(139,92,246,0.2), 0 0 20px rgba(139,92,246,0.3); }
.otp-input.filled { border-color: var(--green); }

/* ===== CYBER GRID BG ===== */
.cyber-bg {
  background-image: linear-gradient(rgba(139,92,246,0.05) 1px, transparent 1px),
                    linear-gradient(90deg, rgba(139,92,246,0.05) 1px, transparent 1px);
  background-size: 50px 50px;
}

/* ===== STRENGTH INDICATOR ===== */
.strength-bar { height: 4px; border-radius: 99px; transition: all 0.3s; }

/* ===== ARENA ===== */
.vs-badge {
  background: linear-gradient(135deg, #dc2626, #7c3aed);
  border-radius: 50%; width: 50px; height: 50px;
  display: flex; align-items: center; justify-content: center;
  font-family: 'Orbitron', monospace; font-weight: 900;
  animation: glow 2s infinite; font-size: 14px;
}

/* ===== PREMIUM BADGE ===== */
.premium-badge {
  background: linear-gradient(135deg, #d97706, #f59e0b);
  color: #451a03; padding: 2px 10px;
  border-radius: 99px; font-size: 11px; font-weight: 700;
  letter-spacing: 0.5px; box-shadow: 0 0 10px rgba(245,158,11,0.4);
}

/* ===== WAVE PAYMENT ===== */
.wave-btn {
  background: linear-gradient(135deg, #00b4d8, #0096c7);
  border-radius: 12px; color: white; font-weight: 700;
  cursor: pointer; transition: all 0.3s; border: none;
}
.wave-btn:hover { transform: translateY(-2px); box-shadow: 0 8px 25px rgba(0,180,216,0.5); }

/* ===== LEADERBOARD ===== */
.leaderboard-row { transition: all 0.3s; }
.leaderboard-row:hover { background: rgba(139,92,246,0.1); transform: translateX(5px); }
.rank-1 { color: #f59e0b; }
.rank-2 { color: #9ca3af; }
.rank-3 { color: #d97706; }

/* ===== FOCUS TIMER ===== */
.timer-circle {
  width: 200px; height: 200px; border-radius: 50%;
  border: 4px solid rgba(139,92,246,0.2);
  display: flex; align-items: center; justify-content: center;
  position: relative; margin: 0 auto;
  background: radial-gradient(circle, rgba(139,92,246,0.1) 0%, transparent 70%);
  animation: energyPulse 3s ease-in-out infinite;
}

/* ===== MOBILE ===== */
@media (max-width: 768px) {
  #sidebar { position: fixed; left: 0; top: 0; bottom: 0; z-index: 8000; transform: translateX(-100%); }
  #sidebar.open { transform: translateX(0); }
  #sidebar-overlay { display: block; }
  .main-layout { grid-template-columns: 1fr !important; }
  .right-panel { display: none; }
}

@media (max-width: 480px) {
  .step-dot { width: 28px; height: 28px; font-size: 11px; }
  .otp-input { width: 40px; height: 50px; font-size: 20px; }
}

/* ===== PARTICLES ===== */
.particle {
  position: absolute; width: 6px; height: 6px;
  border-radius: 50%; pointer-events: none;
  animation: particleBurst 1s ease-out forwards;
}

/* ===== CONFETTI ===== */
.confetti-piece {
  position: fixed; width: 10px; height: 10px;
  pointer-events: none; z-index: 9999;
  animation: confettiFall 3s ease-in forwards;
}
@keyframes confettiFall {
  0% { transform: translateY(-100vh) rotate(0deg); opacity: 1; }
  100% { transform: translateY(100vh) rotate(720deg); opacity: 0; }
}

/* ===== HIDDEN SCROLLBAR ===== */
.no-scrollbar::-webkit-scrollbar { display: none; }
.no-scrollbar { -ms-overflow-style: none; scrollbar-width: none; }

/* ===== TOOLTIP ===== */
.tooltip { position: relative; }
.tooltip::after {
  content: attr(data-tip);
  position: absolute; bottom: calc(100% + 8px); left: 50%; transform: translateX(-50%);
  background: rgba(15,15,35,0.95); border: 1px solid rgba(139,92,246,0.3);
  padding: 6px 10px; border-radius: 8px; font-size: 12px;
  white-space: nowrap; pointer-events: none; opacity: 0;
  transition: opacity 0.2s; z-index: 100;
}
.tooltip:hover::after { opacity: 1; }

/* ===== ERROR MESSAGES ===== */
.field-error { color: #ef4444; font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }
.field-success { color: #10b981; font-size: 12px; margin-top: 4px; display: flex; align-items: center; gap: 4px; }

/* ===== CYBER LINES ===== */
.cyber-line {
  height: 1px;
  background: linear-gradient(90deg, transparent, rgba(139,92,246,0.5), rgba(139,92,246,0.8), rgba(139,92,246,0.5), transparent);
  margin: 8px 0;
}

/* ===== CHAT ===== */
.chat-bubble-user { background: linear-gradient(135deg, #7c3aed, #a855f7); border-radius: 18px 18px 4px 18px; }
.chat-bubble-ai { background: rgba(15,15,40,0.9); border: 1px solid rgba(139,92,246,0.2); border-radius: 18px 18px 18px 4px; }

/* ===== LOCATION SYSTEM — DROPDOWNS INTELLIGENTS ===== */
#country-dropdown,
#school-dropdown {
  scrollbar-width: thin;
  scrollbar-color: rgba(139,92,246,0.4) transparent;
}
#country-dropdown::-webkit-scrollbar,
#school-dropdown::-webkit-scrollbar,
#country-list::-webkit-scrollbar {
  width: 4px;
}
#country-dropdown::-webkit-scrollbar-track,
#school-dropdown::-webkit-scrollbar-track,
#country-list::-webkit-scrollbar-track {
  background: transparent;
}
#country-dropdown::-webkit-scrollbar-thumb,
#school-dropdown::-webkit-scrollbar-thumb,
#country-list::-webkit-scrollbar-thumb {
  background: rgba(139,92,246,0.4);
  border-radius: 99px;
}
#country-dropdown::-webkit-scrollbar-thumb:hover,
#school-dropdown::-webkit-scrollbar-thumb:hover {
  background: rgba(168,85,247,0.7);
}

/* Continent filter buttons */
[id^="cont-btn-"] {
  transition: all 0.2s ease;
  font-weight: 600;
}
[id^="cont-btn-"]:hover {
  background: rgba(139,92,246,0.15) !important;
  color: #a855f7 !important;
}

/* School tags (boutons sélection rapide) */
#popular-schools button {
  transition: all 0.2s ease;
}
#popular-schools button:hover {
  border-color: #a855f7 !important;
  color: #a855f7 !important;
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(139,92,246,0.2);
}

/* Résumé localisation — badges */
#location-summary span {
  transition: all 0.2s ease;
}

/* Add school form — input focus */
#add-school-form input:focus,
#add-school-form select:focus {
  border-color: #a855f7 !important;
  box-shadow: 0 0 0 3px rgba(168,85,247,0.1);
}

/* School preview badge */
#school-preview {
  transition: all 0.3s ease;
}

/* Country list item hover */
#country-list > div:last-child {
  border-bottom: none !important;
}

/* School search input focus */
#school-search-input:focus {
  border-color: #a855f7 !important;
  box-shadow: 0 0 0 3px rgba(168,85,247,0.1);
}

/* Country search input focus */
#country-search-input:focus {
  border-color: rgba(168,85,247,0.5) !important;
  box-shadow: 0 0 0 2px rgba(168,85,247,0.1);
}

/* Selected school badge */
#school-section > div:first-child > div:first-child {
  transition: all 0.3s ease;
}

/* Location step root */
#location-step-root {
  animation: fadeIn 0.4s ease forwards;
}

/* Dropdown open transition */
@keyframes dropdownOpen {
  from { opacity: 0; transform: translateY(-8px); }
  to   { opacity: 1; transform: translateY(0); }
}
#country-dropdown[style*="block"],
#school-dropdown[style*="block"] {
  animation: dropdownOpen 0.2s ease forwards;
}

/* Region / Dept sections animate */
#region-section,
#dept-section,
#school-section {
  transition: all 0.3s ease;
}

/* Mark highlight in results */
mark {
  background: rgba(139,92,246,0.3) !important;
  color: #a855f7 !important;
  border-radius: 3px;
  padding: 0 2px;
}

/* ===== DUEL ANIMATION ===== */
@keyframes duelStart {
  0% { transform: translateX(0); } 
  25% { transform: translateX(-20px); }
  75% { transform: translateX(20px); }
  100% { transform: translateX(0); }
}
.duel-shake { animation: duelStart 0.5s ease; }
