/* === KURSOR PLATFORM STYLES === */
:root {
  --primary: #6366f1;
  --primary-dark: #4f46e5;
  --secondary: #f59e0b;
  --success: #10b981;
  --danger: #ef4444;
  --info: #3b82f6;
  --purple: #a855f7;
  --pink: #ec4899;
  --bg: #f8fafc;
  --bg-card: #ffffff;
  --text: #1e293b;
  --text-muted: #64748b;
  --border: #e2e8f0;
  --gradient-1: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  --gradient-2: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
  --gradient-3: linear-gradient(135deg, #4facfe 0%, #00f2fe 100%);
  --gradient-4: linear-gradient(135deg, #43e97b 0%, #38f9d7 100%);
  --gradient-5: linear-gradient(135deg, #fa709a 0%, #fee140 100%);
  --shadow-sm: 0 2px 8px rgba(0,0,0,0.06);
  --shadow: 0 4px 16px rgba(0,0,0,0.08);
  --shadow-lg: 0 12px 40px rgba(0,0,0,0.12);
  --radius: 16px;
  --radius-sm: 10px;
  --radius-lg: 24px;
}

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

body {
  font-family: 'Nunito', 'Comfortaa', system-ui, -apple-system, sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

a { color: var(--primary); text-decoration: none; }
a:hover { text-decoration: underline; }

/* === NAVBAR === */
.navbar {
  background: white;
  padding: 14px 32px;
  box-shadow: var(--shadow-sm);
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: sticky;
  top: 0;
  z-index: 100;
}
.navbar-logo {
  display: flex; align-items: center; gap: 12px;
  font-weight: 800; font-size: 20px; color: var(--primary-dark);
}
.navbar-logo img { height: 42px; }
.navbar-menu { display: flex; gap: 8px; align-items: center; }
.navbar-menu a {
  padding: 10px 16px; border-radius: var(--radius-sm); color: var(--text);
  font-weight: 600; transition: all 0.2s; text-decoration: none;
}
.navbar-menu a:hover { background: #eef2ff; color: var(--primary-dark); }
.navbar-menu a.active { background: var(--primary); color: white; }
.navbar-user {
  display: flex; align-items: center; gap: 12px;
  padding: 6px 14px; background: #f1f5f9; border-radius: 30px;
}
.navbar-user .avatar {
  width: 36px; height: 36px; border-radius: 50%;
  background: var(--gradient-1); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 700;
}

/* === CONTAINER === */
.container { max-width: 1280px; margin: 0 auto; padding: 32px; }

/* === BUTTONS === */
.btn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 12px 24px; border-radius: var(--radius-sm);
  border: none; cursor: pointer; font-weight: 700; font-size: 15px;
  transition: all 0.2s; font-family: inherit;
  background: var(--primary); color: white;
}
.btn:hover { transform: translateY(-2px); box-shadow: var(--shadow); }
.btn-lg { padding: 16px 32px; font-size: 17px; }
.btn-secondary { background: var(--secondary); }
.btn-success { background: var(--success); }
.btn-danger { background: var(--danger); }
.btn-outline { background: white; color: var(--primary); border: 2px solid var(--primary); }
.btn-ghost { background: transparent; color: var(--text); }
.btn-ghost:hover { background: #f1f5f9; }

/* === CARDS === */
.card {
  background: var(--bg-card); border-radius: var(--radius);
  padding: 24px; box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.card:hover { box-shadow: var(--shadow); }

/* === DASHBOARD === */
.welcome-banner {
  background: var(--gradient-1); color: white;
  padding: 32px; border-radius: var(--radius-lg);
  display: flex; align-items: center; gap: 24px;
  margin-bottom: 28px; position: relative; overflow: hidden;
}
.welcome-banner h1 { font-size: 32px; margin-bottom: 8px; }
.welcome-banner p { font-size: 17px; opacity: 0.95; }
.welcome-banner .mascot { height: 160px; flex-shrink: 0; }

.stats-grid {
  display: grid; grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
  gap: 16px; margin-bottom: 28px;
}
.stat-card {
  background: white; padding: 20px; border-radius: var(--radius);
  display: flex; align-items: center; gap: 14px;
  box-shadow: var(--shadow-sm);
}
.stat-icon {
  width: 52px; height: 52px; border-radius: 14px;
  display: flex; align-items: center; justify-content: center;
  font-size: 26px;
}
.stat-icon.blue { background: #dbeafe; color: var(--info); }
.stat-icon.green { background: #d1fae5; color: var(--success); }
.stat-icon.orange { background: #fed7aa; color: var(--secondary); }
.stat-icon.purple { background: #e9d5ff; color: var(--purple); }
.stat-icon.pink { background: #fce7f3; color: var(--pink); }
.stat-value { font-size: 26px; font-weight: 800; color: var(--text); }
.stat-label { font-size: 13px; color: var(--text-muted); font-weight: 600; }

.section-title {
  font-size: 22px; font-weight: 800; margin-bottom: 16px;
  display: flex; align-items: center; gap: 10px;
}

.progress-bar {
  width: 100%; height: 12px; background: #e2e8f0;
  border-radius: 20px; overflow: hidden;
}
.progress-fill {
  height: 100%; background: var(--gradient-4);
  transition: width 0.5s ease;
}

/* === TASK CARDS === */
.tasks-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr));
  gap: 18px;
}
.task-card {
  background: white; border-radius: var(--radius); padding: 20px;
  box-shadow: var(--shadow-sm); cursor: pointer; transition: all 0.2s;
  border: 2px solid transparent; position: relative; overflow: hidden;
}
.task-card:hover { transform: translateY(-4px); box-shadow: var(--shadow-lg); border-color: var(--primary); }
.task-card .lang-badge {
  display: inline-block; padding: 4px 12px; border-radius: 20px;
  font-size: 12px; font-weight: 700; margin-bottom: 10px;
}
.lang-scratch { background: #fef3c7; color: #92400e; }
.lang-python { background: #dbeafe; color: #1e40af; }
.lang-html { background: #fed7aa; color: #9a3412; }
.lang-java { background: #fee2e2; color: #991b1b; }
.lang-cpp { background: #e0e7ff; color: #3730a3; }
.lang-csharp { background: #ddd6fe; color: #5b21b6; }
.lang-roblox { background: #fce7f3; color: #9d174d; }
.lang-blockly { background: #d1fae5; color: #065f46; }
.lang-minecraft { background: #d1fae5; color: #14532d; }
.lang-blender { background: #fed7aa; color: #7c2d12; }
.lang-unity { background: #f3e8ff; color: #6b21a8; }
.lang-design { background: #fce7f3; color: #831843; }
.lang-cyber { background: #e0e7ff; color: #312e81; }
.lang-datascience { background: #ccfbf1; color: #115e59; }

.task-card h3 { font-size: 17px; margin-bottom: 6px; }
.task-card .task-meta {
  display: flex; gap: 12px; align-items: center;
  margin-top: 12px; font-size: 13px; color: var(--text-muted);
}
.task-status {
  position: absolute; top: 16px; right: 16px;
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px; font-weight: 700;
}
.status-done { background: var(--success); color: white; }
.status-progress { background: var(--secondary); color: white; }
.status-locked { background: #e2e8f0; color: var(--text-muted); }

.difficulty {
  display: inline-flex; gap: 3px;
}
.difficulty span { width: 6px; height: 6px; border-radius: 50%; background: #e2e8f0; }
.difficulty span.active { background: var(--secondary); }

/* === FILTERS === */
.filters {
  display: flex; flex-wrap: wrap; gap: 8px;
  background: white; padding: 16px; border-radius: var(--radius);
  margin-bottom: 20px; box-shadow: var(--shadow-sm);
}
.filter-chip {
  padding: 8px 16px; border-radius: 20px; background: #f1f5f9;
  cursor: pointer; font-weight: 600; font-size: 14px;
  transition: all 0.2s; border: none; font-family: inherit;
}
.filter-chip:hover { background: #e2e8f0; }
.filter-chip.active { background: var(--primary); color: white; }
.search-input {
  flex: 1; min-width: 200px; padding: 10px 16px;
  border: 2px solid var(--border); border-radius: 20px;
  font-size: 14px; font-family: inherit;
}
.search-input:focus { outline: none; border-color: var(--primary); }

/* === TASK PAGE === */
.task-layout {
  display: grid; grid-template-columns: 1fr 1.3fr; gap: 24px;
}
@media (max-width: 900px) { .task-layout { grid-template-columns: 1fr; } }

.task-info-panel {
  background: white; border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.task-explanation {
  background: #f0f9ff; padding: 18px; border-radius: var(--radius-sm);
  border-left: 4px solid var(--info); margin-top: 16px;
}
.task-explanation h4 { color: var(--info); margin-bottom: 8px; }
.task-explanation pre {
  background: #1e293b; color: #e2e8f0; padding: 14px;
  border-radius: 8px; overflow-x: auto; font-size: 13px;
  font-family: 'Fira Code', 'Courier New', monospace;
  margin: 10px 0;
}
.task-explanation code {
  background: #e0e7ff; padding: 2px 6px; border-radius: 4px;
  font-family: 'Fira Code', monospace; font-size: 13px;
}

.hint-block {
  background: #fef3c7; padding: 14px; border-radius: var(--radius-sm);
  border-left: 4px solid var(--secondary); margin-top: 12px;
}
.hint-block.locked {
  background: #f1f5f9; border-left-color: #94a3b8;
  text-align: center; cursor: pointer;
}

.video-embed {
  position: relative; padding-bottom: 56.25%; height: 0;
  border-radius: var(--radius-sm); overflow: hidden; margin: 16px 0;
  background: #000;
}
.video-embed iframe {
  position: absolute; top:0; left:0; width: 100%; height: 100%; border: 0;
}

/* === TASK SOLVER UI === */
.solver-panel {
  background: white; border-radius: var(--radius); padding: 24px;
  box-shadow: var(--shadow-sm);
}
.quiz-options { display: flex; flex-direction: column; gap: 10px; margin-top: 14px; }
.quiz-option {
  padding: 14px 18px; background: #f8fafc; border: 2px solid var(--border);
  border-radius: var(--radius-sm); cursor: pointer; transition: all 0.2s;
  font-weight: 600; display: flex; align-items: center; gap: 12px;
}
.quiz-option:hover { border-color: var(--primary); background: #eef2ff; }
.quiz-option.selected { border-color: var(--primary); background: #eef2ff; }
.quiz-option.correct { border-color: var(--success); background: #d1fae5; }
.quiz-option.wrong { border-color: var(--danger); background: #fee2e2; }
.quiz-option .option-letter {
  width: 32px; height: 32px; border-radius: 50%; background: var(--primary);
  color: white; display: flex; align-items: center; justify-content: center;
  font-weight: 700; flex-shrink: 0;
}

.code-input {
  width: 100%; min-height: 200px; padding: 14px;
  font-family: 'Fira Code', 'Courier New', monospace; font-size: 14px;
  background: #1e293b; color: #e2e8f0; border: 0;
  border-radius: var(--radius-sm); resize: vertical;
}
.code-input:focus { outline: 2px solid var(--primary); }

.fill-blank-input {
  background: #fef3c7; border: 2px dashed var(--secondary);
  padding: 4px 10px; border-radius: 6px; font-family: 'Fira Code', monospace;
  font-size: 14px; min-width: 80px;
}

.drag-area {
  background: #f8fafc; border: 2px dashed var(--border);
  border-radius: var(--radius-sm); padding: 14px; min-height: 200px;
}
.drag-item {
  background: white; padding: 12px 16px; margin: 6px 0;
  border-radius: 8px; box-shadow: var(--shadow-sm); cursor: grab;
  font-family: 'Fira Code', monospace; font-size: 14px;
  border-left: 4px solid var(--primary); user-select: none;
}
.drag-item:active { cursor: grabbing; opacity: 0.6; }
.drag-item.over { border-top: 2px solid var(--primary); }

.feedback {
  margin-top: 16px; padding: 16px; border-radius: var(--radius-sm);
  display: flex; align-items: flex-start; gap: 12px; font-weight: 600;
}
.feedback.success { background: #d1fae5; color: #065f46; }
.feedback.error { background: #fee2e2; color: #991b1b; }
.feedback.info { background: #dbeafe; color: #1e40af; }
.feedback img { height: 50px; }

/* === MASCOT BUBBLE === */
.mascot-bubble {
  display: flex; gap: 14px; align-items: flex-start;
  background: #eef2ff; padding: 16px; border-radius: var(--radius);
  margin-bottom: 18px;
}
.mascot-bubble img { height: 90px; flex-shrink: 0; }
.mascot-bubble .speech {
  background: white; padding: 14px 18px; border-radius: var(--radius-sm);
  position: relative; flex: 1;
}
.mascot-bubble .speech::before {
  content: ''; position: absolute; left: -10px; top: 20px;
  border: 10px solid transparent; border-right-color: white;
}

/* === LOGIN === */
.login-page {
  min-height: 100vh; background: var(--gradient-1);
  display: flex; align-items: center; justify-content: center; padding: 20px;
}
.login-box {
  background: white; border-radius: var(--radius-lg);
  padding: 40px; max-width: 460px; width: 100%;
  box-shadow: var(--shadow-lg); text-align: center;
}
.login-box .logo { height: 80px; margin-bottom: 16px; }
.login-box h1 { font-size: 28px; margin-bottom: 8px; color: var(--primary-dark); }
.login-box p { color: var(--text-muted); margin-bottom: 24px; }
.form-group { margin-bottom: 16px; text-align: left; }
.form-group label { font-weight: 700; font-size: 14px; margin-bottom: 6px; display: block; }
.form-input {
  width: 100%; padding: 12px 16px; border: 2px solid var(--border);
  border-radius: var(--radius-sm); font-size: 15px; font-family: inherit;
}
.form-input:focus { outline: none; border-color: var(--primary); }

/* === ADMIN === */
.admin-layout {
  display: grid; grid-template-columns: 240px 1fr; min-height: 100vh;
}
.admin-sidebar {
  background: #1e293b; color: white; padding: 24px 0;
}
.admin-sidebar .logo {
  padding: 0 24px 24px; display: flex; align-items: center; gap: 10px;
  border-bottom: 1px solid #334155; margin-bottom: 16px;
  font-weight: 800;
}
.admin-sidebar .logo img { height: 36px; background: white; border-radius: 8px; padding: 4px; }
.admin-sidebar a {
  display: flex; align-items: center; gap: 10px;
  padding: 12px 24px; color: #cbd5e1; font-weight: 600;
  border-left: 4px solid transparent;
}
.admin-sidebar a:hover { background: #334155; color: white; text-decoration: none; }
.admin-sidebar a.active { background: #334155; color: white; border-left-color: var(--secondary); }
.admin-main { padding: 32px; background: #f1f5f9; }
.admin-main h1 { margin-bottom: 20px; }

.table {
  width: 100%; background: white; border-radius: var(--radius);
  overflow: hidden; box-shadow: var(--shadow-sm); border-collapse: collapse;
}
.table th, .table td { padding: 14px 16px; text-align: left; border-bottom: 1px solid var(--border); }
.table th { background: #f8fafc; font-weight: 700; font-size: 13px; color: var(--text-muted); text-transform: uppercase; letter-spacing: 0.5px; }
.table tr:hover { background: #f8fafc; }

.modal-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5);
  display: none; align-items: center; justify-content: center;
  z-index: 1000; padding: 20px;
}
.modal-overlay.active { display: flex; }
.modal {
  background: white; border-radius: var(--radius);
  padding: 28px; max-width: 600px; width: 100%;
  max-height: 90vh; overflow-y: auto;
}
.modal h2 { margin-bottom: 16px; }

.badge {
  display: inline-block; padding: 4px 10px; border-radius: 20px;
  font-size: 12px; font-weight: 700;
}
.badge-success { background: #d1fae5; color: #065f46; }
.badge-warning { background: #fef3c7; color: #92400e; }
.badge-danger { background: #fee2e2; color: #991b1b; }
.badge-info { background: #dbeafe; color: #1e40af; }

/* === LEADERBOARD === */
.leader-list { display: flex; flex-direction: column; gap: 8px; }
.leader-item {
  background: white; padding: 16px 20px; border-radius: var(--radius);
  display: flex; align-items: center; gap: 16px; box-shadow: var(--shadow-sm);
}
.leader-rank {
  width: 44px; height: 44px; border-radius: 50%;
  background: var(--gradient-1); color: white;
  display: flex; align-items: center; justify-content: center;
  font-weight: 800; font-size: 18px;
}
.leader-rank.gold { background: linear-gradient(135deg, #fbbf24, #f59e0b); }
.leader-rank.silver { background: linear-gradient(135deg, #d1d5db, #9ca3af); }
.leader-rank.bronze { background: linear-gradient(135deg, #fb923c, #ea580c); }
.leader-info { flex: 1; }
.leader-info .name { font-weight: 700; font-size: 16px; }
.leader-info .stats { font-size: 13px; color: var(--text-muted); }
.leader-points { font-size: 22px; font-weight: 800; color: var(--secondary); }

/* === BADGES (achievements) === */
.badges-grid {
  display: grid; grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 14px;
}
.badge-card {
  background: white; padding: 18px; border-radius: var(--radius);
  text-align: center; box-shadow: var(--shadow-sm);
  transition: all 0.2s;
}
.badge-card.earned { background: linear-gradient(135deg, #fef3c7, #fed7aa); }
.badge-card.locked { opacity: 0.4; }
.badge-card .badge-emoji { font-size: 48px; margin-bottom: 8px; }
.badge-card .badge-name { font-weight: 700; font-size: 13px; }

/* === RESPONSIVE === */
@media (max-width: 768px) {
  .navbar { padding: 12px 16px; flex-wrap: wrap; }
  .navbar-menu { order: 3; width: 100%; justify-content: center; flex-wrap: wrap; }
  .container { padding: 16px; }
  .welcome-banner { flex-direction: column; text-align: center; padding: 24px; }
  .welcome-banner h1 { font-size: 24px; }
  .admin-layout { grid-template-columns: 1fr; }
  .admin-sidebar { display: none; }
}

/* Animations */
@keyframes bounce { 0%, 100% { transform: translateY(0); } 50% { transform: translateY(-8px); } }
.bounce { animation: bounce 1s ease infinite; }

@keyframes fadeIn { from { opacity: 0; transform: translateY(10px); } to { opacity: 1; transform: translateY(0); }}
.fade-in { animation: fadeIn 0.4s ease; }

.confetti-burst { position: fixed; pointer-events: none; z-index: 9999; }

/* Streak fire */
.streak-fire { color: #ef4444; }
