:root {
  --bg-color: #0a0a1a;
  --glass-bg: rgba(30, 30, 50, 0.6);
  --glass-border: rgba(255, 255, 255, 0.1);
  --accent-primary: #00e5ff;
  --accent-secondary: #ff00ea;
  --accent-success: #00ff88;
  --text-main: #ffffff;
  --text-muted: #94a3b8;
}

* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: 'Outfit', sans-serif;
  background: var(--bg-color);
  background-image: 
    radial-gradient(circle at 15% 50%, rgba(0, 229, 255, 0.15) 0%, transparent 50%),
    radial-gradient(circle at 85% 30%, rgba(255, 0, 234, 0.15) 0%, transparent 50%);
  color: var(--text-main);
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: flex-start;
  padding: 20px;
}

.hidden { display: none !important; }

#app {
  width: 100%;
  max-width: 1000px;
  margin: 0 auto;
}

/* Glassmorphism Utilities */
.glass-panel {
  background: var(--glass-bg);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid var(--glass-border);
  border-radius: 20px;
  padding: 24px;
  box-shadow: 0 8px 32px 0 rgba(0, 0, 0, 0.3);
}

/* Typography */
h1 {
  font-size: 2.5rem;
  font-weight: 700;
  margin-bottom: 5px;
  text-align: center;
}

h1 span {
  color: var(--accent-primary);
  text-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

.subtitle {
  text-align: center;
  color: var(--text-muted);
  margin-bottom: 30px;
}

.section-title {
  font-size: 1.5rem;
  margin-bottom: 15px;
  border-bottom: 1px solid var(--glass-border);
  padding-bottom: 10px;
}

/* Login Screen */
#login {
  max-width: 400px;
  margin: 10vh auto;
  text-align: center;
  position: relative;
  overflow: hidden;
}

.logo-glow {
  position: absolute;
  top: -50px;
  left: 50%;
  transform: translateX(-50%);
  width: 150px;
  height: 150px;
  background: var(--accent-primary);
  filter: blur(100px);
  z-index: -1;
  opacity: 0.5;
}

input {
  width: 100%;
  padding: 15px;
  background: rgba(0,0,0,0.3);
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: white;
  font-size: 1rem;
  margin-bottom: 20px;
  outline: none;
  transition: all 0.3s;
}

input:focus {
  border-color: var(--accent-primary);
  box-shadow: 0 0 15px rgba(0, 229, 255, 0.2);
}

select {
  width: 100%;
  padding: 15px;
  background: #1a1a2e;
  border: 1px solid var(--glass-border);
  border-radius: 12px;
  color: white;
  margin-bottom: 20px;
  outline: none;
}

button {
  width: 100%;
  padding: 15px;
  border: none;
  border-radius: 12px;
  font-size: 1.1rem;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.3s ease;
  position: relative;
  overflow: hidden;
}

.btn-primary {
  background: linear-gradient(135deg, #00e5ff, #0077ff);
  color: white;
  box-shadow: 0 4px 15px rgba(0, 229, 255, 0.3);
}

.btn-primary:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(0, 229, 255, 0.5);
}

.btn-secondary {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255,255,255,0.2);
}

.btn-secondary:hover {
  background: rgba(255, 255, 255, 0.2);
}

.error-text {
  color: #ff4757;
  font-size: 0.9rem;
  margin-top: 15px;
}

/* Dashboard Topbar */
.topbar {
  display: flex;
  flex-wrap: wrap;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 30px;
  gap: 20px;
}

.profile-section {
  display: flex;
  align-items: center;
  gap: 15px;
}

.avatar-container {
  position: relative;
  width: 70px;
  height: 70px;
  border-radius: 50%;
  padding: 3px;
  background: linear-gradient(135deg, var(--accent-primary), var(--accent-secondary));
  cursor: pointer;
  transition: transform 0.3s;
}

.avatar-container:hover {
  transform: scale(1.05);
}

.avatar-container img {
  width: 100%;
  height: 100%;
  border-radius: 50%;
  background: #1a1a2e;
  object-fit: cover;
}

.avatar-edit-overlay {
  position: absolute;
  bottom: 0;
  right: 0;
  background: var(--accent-secondary);
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  font-size: 12px;
  border: 2px solid var(--bg-color);
}

.level-badge {
  display: inline-block;
  background: rgba(0, 229, 255, 0.2);
  color: var(--accent-primary);
  padding: 4px 10px;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 700;
  margin-top: 5px;
  border: 1px solid rgba(0, 229, 255, 0.3);
}

.xp-container {
  flex-grow: 1;
  max-width: 400px;
}

.xp-text {
  display: flex;
  justify-content: space-between;
  margin-bottom: 8px;
  font-weight: 700;
  font-size: 0.9rem;
}

.xp-bar {
  width: 100%;
  height: 12px;
  background: rgba(0,0,0,0.5);
  border-radius: 10px;
  overflow: hidden;
  border: 1px solid var(--glass-border);
}

#xpFill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, var(--accent-primary), var(--accent-secondary));
  transition: width 0.8s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  box-shadow: 0 0 10px rgba(0, 229, 255, 0.5);
}

/* Dashboard Grid */
.dashboard-grid {
  display: grid;
  grid-template-columns: 2fr 1fr;
  gap: 30px;
}

@media (max-width: 768px) {
  .dashboard-grid {
    grid-template-columns: 1fr;
  }
}

/* Tasks */
.task {
  background: rgba(255,255,255,0.03);
  border: 1px solid var(--glass-border);
  padding: 15px 20px;
  border-radius: 15px;
  margin-bottom: 15px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  transition: all 0.3s;
}

.task:hover {
  background: rgba(255,255,255,0.06);
  transform: translateX(5px);
}

.task.special {
  border-color: var(--accent-secondary);
  box-shadow: 0 0 15px rgba(255, 0, 234, 0.1);
}

.task-info {
  display: flex;
  flex-direction: column;
}

.task-name {
  font-weight: 500;
  font-size: 1.1rem;
}

.task-xp {
  color: var(--accent-primary);
  font-size: 0.85rem;
  margin-top: 5px;
}

.task button {
  width: auto;
  padding: 10px 20px;
  border-radius: 10px;
  background: var(--accent-success);
  color: #000;
}

.task button:hover {
  background: #00cc6a;
  transform: scale(1.05);
}

/* Leaderboard */
.leaderboard-item {
  display: flex;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid var(--glass-border);
}

.leaderboard-item:last-child {
  border-bottom: none;
}

.lb-rank {
  font-size: 1.2rem;
  font-weight: 700;
  width: 30px;
  color: var(--text-muted);
}

.lb-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  margin-right: 15px;
  background: #1a1a2e;
}

.lb-info {
  flex-grow: 1;
}

.lb-name {
  font-weight: 500;
}

.lb-xp {
  font-size: 0.85rem;
  color: var(--accent-primary);
}

.leaderboard-item:nth-child(1) .lb-rank { color: gold; }
.leaderboard-item:nth-child(2) .lb-rank { color: silver; }
.leaderboard-item:nth-child(3) .lb-rank { color: #cd7f32; }

/* Admin Panel */
#adminPanel {
  margin-top: 30px;
}
.admin-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 15px;
}

/* Modal */
.modal {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  backdrop-filter: blur(5px);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 1000;
}

.modal-content {
  width: 90%;
  max-width: 450px;
}

.avatar-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 15px;
  margin-top: 20px;
}

.avatar-option {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 50%;
  background: rgba(255,255,255,0.05);
  cursor: pointer;
  transition: all 0.2s;
  border: 2px solid transparent;
}

.avatar-option:hover {
  transform: scale(1.1);
  border-color: var(--accent-primary);
}

.modal-actions {
  display: flex;
  gap: 10px;
  margin-top: 20px;
}

/* Loader */
#loadingOverlay {
  position: fixed;
  top: 0; left: 0; width: 100%; height: 100%;
  background: rgba(0,0,0,0.8);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 2000;
}

.spinner {
  width: 50px;
  height: 50px;
  border: 5px solid rgba(0, 229, 255, 0.2);
  border-top-color: var(--accent-primary);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

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

/* Badges */
.badges-container {
  display: flex;
  gap: 8px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.badge {
  font-size: 1.2rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 215, 0, 0.5);
  border-radius: 50%;
  width: 32px;
  height: 32px;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: help;
  position: relative;
  transition: transform 0.3s, box-shadow 0.3s;
}

.badge:hover {
  transform: scale(1.2);
  box-shadow: 0 0 10px rgba(255, 215, 0, 0.8);
}

.badge[title]::after {
  content: attr(title);
  position: absolute;
  top: -30px;
  background: #000;
  color: #fff;
  padding: 4px 8px;
  font-size: 0.75rem;
  border-radius: 4px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.3s;
  z-index: 100;
}

.badge:hover::after {
  opacity: 1;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 30px;
  right: 30px;
  background: rgba(30, 30, 50, 0.9);
  backdrop-filter: blur(10px);
  border: 1px solid var(--accent-primary);
  border-left: 5px solid var(--accent-primary);
  border-radius: 10px;
  padding: 15px 20px;
  display: flex;
  align-items: center;
  gap: 15px;
  box-shadow: 0 5px 20px rgba(0, 229, 255, 0.4);
  z-index: 3000;
  transform: translateX(150%);
  transition: transform 0.5s cubic-bezier(0.175, 0.885, 0.32, 1.275);
}

.toast:not(.hidden) {
  transform: translateX(0);
}

.toast-icon {
  font-size: 2rem;
}

.toast-content h4 {
  margin: 0 0 5px 0;
  color: var(--accent-primary);
}

.toast-content p {
  margin: 0;
  font-size: 0.9rem;
  color: var(--text-main);
}

