/* === Weakness Dashboard Panel === */
.weakness-panel {
  background: white; border-radius: 20px; padding: 1.5rem;
  box-shadow: 0 4px 20px rgba(91,94,244,0.06);
  border: 2px solid #f0f2ff; margin-bottom: 1.5rem;
}
.weakness-panel h3 { font-size: 1.15rem; font-weight: 900; margin-bottom: 0.3rem; }
.wp-sub { font-size: 0.85rem; color: #64748b; margin-bottom: 1rem; }
.wp-tabs { display: flex; gap: 0.5rem; margin-bottom: 1rem; }
.wp-tab {
  padding: 0.4rem 1rem; border-radius: 50px; font-weight: 800; font-size: 0.8rem;
  border: 2px solid #e8eaff; background: white; color: #64748b; cursor: pointer;
  transition: all 0.2s;
}
.wp-tab.active { background: #5b5ef4; color: white; border-color: #5b5ef4; }
.wp-tab:hover:not(.active) { border-color: #5b5ef4; color: #5b5ef4; }

/* Weakness Cards */
.weakness-cards { display: flex; flex-direction: column; gap: 0.75rem; }
.wk-card {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem 1.2rem; border-radius: 16px; border: 2px solid;
  transition: all 0.3s; cursor: pointer; position: relative; overflow: hidden;
}
.wk-card:hover { transform: translateX(4px); box-shadow: 0 6px 20px rgba(0,0,0,0.06); }
.wk-card::before {
  content: ''; position: absolute; left: 0; top: 0; bottom: 0; width: 4px;
}
.wk-card.critical { border-color: #fecaca; background: #fef2f2; }
.wk-card.critical::before { background: #dc2626; }
.wk-card.weak { border-color: #fed7aa; background: #fff7ed; }
.wk-card.weak::before { background: #f97316; }
.wk-card.average { border-color: #fef08a; background: #fefce8; }
.wk-card.average::before { background: #eab308; }

.wk-severity { font-size: 1.4rem; flex-shrink: 0; }
.wk-info { flex: 1; min-width: 0; }
.wk-topic { font-weight: 800; font-size: 0.95rem; color: #1a1a2e; margin-bottom: 0.2rem; text-transform: capitalize; }
.wk-category { font-size: 0.75rem; font-weight: 700; color: #64748b; text-transform: uppercase; letter-spacing: 0.5px; }
.wk-meta { display: flex; align-items: center; gap: 0.75rem; flex-shrink: 0; }
.wk-score {
  font-weight: 900; font-size: 1.1rem; min-width: 50px; text-align: center;
  padding: 0.3rem 0.6rem; border-radius: 10px; background: rgba(255,255,255,0.7);
}
.wk-trend { font-size: 0.8rem; font-weight: 800; display: flex; align-items: center; gap: 0.2rem; }
.wk-trend.improving { color: #22c55e; }
.wk-trend.declining { color: #dc2626; }
.wk-trend.stable { color: #64748b; }
.wk-trend.new { color: #5b5ef4; }
.wk-action {
  padding: 0.4rem 0.8rem; border-radius: 10px; border: none;
  font-weight: 800; font-size: 0.78rem; cursor: pointer; transition: all 0.2s;
  background: linear-gradient(135deg, #5b5ef4, #7209b7); color: white;
}
.wk-action:hover { transform: scale(1.05); box-shadow: 0 4px 12px rgba(91,94,244,0.3); }

/* Peer Comparison */
.peer-section { margin-top: 1.5rem; }
.peer-card {
  display: flex; align-items: center; gap: 1rem;
  padding: 1rem; border-radius: 14px; background: #f0f7ff;
  border: 1.5px solid #bfdbfe; margin-bottom: 0.75rem;
}
.peer-icon { font-size: 1.5rem; }
.peer-info { flex: 1; }
.peer-msg { font-weight: 700; font-size: 0.9rem; color: #1e40af; margin-bottom: 0.2rem; }
.peer-sub { font-size: 0.8rem; color: #3b82f6; }
.peer-bar-wrap { display: flex; align-items: center; gap: 0.5rem; margin-top: 0.5rem; }
.peer-bar { flex: 1; height: 8px; background: #e0e7ff; border-radius: 50px; overflow: hidden; position: relative; }
.peer-bar-you { height: 100%; border-radius: 50px; transition: width 0.6s; position: absolute; top: 0; left: 0; }
.peer-bar-avg { height: 100%; border-radius: 50px; position: absolute; top: 0; left: 0; opacity: 0.3; }
.peer-label { font-size: 0.72rem; font-weight: 800; min-width: 50px; }

/* Challenge Section */
.challenge-section { margin-top: 1.5rem; }
.challenge-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)); gap: 0.75rem; }
.ch-card {
  padding: 1rem; border-radius: 16px; background: white;
  border: 2px solid #e8eaff; transition: all 0.3s; position: relative;
}
.ch-card.completed { border-color: #86efac; background: #f0fdf4; }
.ch-card:hover { transform: translateY(-2px); box-shadow: 0 6px 20px rgba(91,94,244,0.1); }
.ch-header { display: flex; align-items: center; gap: 0.75rem; margin-bottom: 0.5rem; }
.ch-icon { font-size: 1.5rem; }
.ch-name { font-weight: 900; font-size: 0.95rem; }
.ch-xp { font-size: 0.72rem; font-weight: 800; color: #5b5ef4; background: #eef0ff; padding: 0.15rem 0.5rem; border-radius: 50px; margin-left: auto; }
.ch-desc { font-size: 0.82rem; color: #64748b; margin-bottom: 0.75rem; }
.ch-progress-bar { height: 6px; background: #eeeeff; border-radius: 50px; overflow: hidden; }
.ch-progress-fill { height: 100%; border-radius: 50px; transition: width 0.5s; background: linear-gradient(90deg, #5b5ef4, #7209b7); }
.ch-card.completed .ch-progress-fill { background: linear-gradient(90deg, #22c55e, #16a34a); }
.ch-progress-text { font-size: 0.72rem; font-weight: 800; color: #64748b; margin-top: 0.3rem; text-align: right; }
.ch-completed-tag {
  position: absolute; top: -1px; right: -1px; background: #22c55e; color: white;
  font-size: 0.68rem; font-weight: 900; padding: 0.2rem 0.6rem;
  border-radius: 0 14px 0 10px;
}

/* Drill Modal */
.drill-overlay {
  position: fixed; inset: 0; background: rgba(0,0,0,0.5); z-index: 1000;
  display: flex; align-items: center; justify-content: center;
  opacity: 0; transition: opacity 0.3s; pointer-events: none;
}
.drill-overlay.active { opacity: 1; pointer-events: all; }
.drill-modal {
  background: white; border-radius: 24px; padding: 2rem; max-width: 600px; width: 95%;
  max-height: 85vh; overflow-y: auto; transform: translateY(20px); transition: transform 0.3s;
  box-shadow: 0 20px 60px rgba(0,0,0,0.2);
}
.drill-overlay.active .drill-modal { transform: translateY(0); }
.drill-header { display: flex; justify-content: space-between; align-items: center; margin-bottom: 1.5rem; }
.drill-title { font-weight: 900; font-size: 1.2rem; }
.drill-close {
  width: 36px; height: 36px; border-radius: 50%; border: 2px solid #e8eaff;
  background: white; font-size: 1.1rem; cursor: pointer; display: flex;
  align-items: center; justify-content: center; transition: all 0.2s;
}
.drill-close:hover { border-color: #dc2626; color: #dc2626; }
.drill-progress { margin-bottom: 1.5rem; }
.drill-progress-bar { height: 6px; background: #eeeeff; border-radius: 50px; overflow: hidden; }
.drill-progress-fill { height: 100%; background: linear-gradient(90deg, #5b5ef4, #7209b7); border-radius: 50px; transition: width 0.4s; }
.drill-count { font-size: 0.78rem; font-weight: 800; color: #64748b; margin-top: 0.3rem; }
.drill-question {
  padding: 1.5rem; border-radius: 16px; background: #f8f9ff; border: 2px solid #e8eaff; margin-bottom: 1rem;
}
.drill-q-type { font-size: 0.72rem; font-weight: 800; color: #5b5ef4; text-transform: uppercase; margin-bottom: 0.5rem; }
.drill-q-text { font-weight: 700; font-size: 1rem; line-height: 1.6; }
.drill-input {
  width: 100%; padding: 0.8rem 1rem; border: 2px solid #e8eaff; border-radius: 12px;
  font-size: 1rem; font-family: 'Nunito', sans-serif; margin-bottom: 1rem;
  transition: border-color 0.2s;
}
.drill-input:focus { outline: none; border-color: #5b5ef4; }
.drill-options { display: flex; flex-direction: column; gap: 0.5rem; margin-bottom: 1rem; }
.drill-option {
  padding: 0.75rem 1rem; border: 2px solid #e8eaff; border-radius: 12px;
  font-weight: 700; font-size: 0.95rem; cursor: pointer; transition: all 0.2s;
  background: white;
}
.drill-option:hover { border-color: #5b5ef4; background: #f0f2ff; }
.drill-option.selected { border-color: #5b5ef4; background: #eef0ff; }
.drill-option.correct { border-color: #22c55e; background: #f0fdf4; }
.drill-option.wrong { border-color: #dc2626; background: #fef2f2; }
.drill-actions { display: flex; gap: 0.75rem; justify-content: flex-end; }
.drill-btn {
  padding: 0.6rem 1.5rem; border-radius: 12px; font-weight: 800; font-size: 0.9rem;
  border: none; cursor: pointer; transition: all 0.2s;
}
.drill-btn-primary { background: linear-gradient(135deg, #5b5ef4, #7209b7); color: white; }
.drill-btn-primary:hover { box-shadow: 0 6px 20px rgba(91,94,244,0.3); transform: translateY(-1px); }
.drill-btn-secondary { background: #f0f2ff; color: #5b5ef4; }
.drill-result {
  text-align: center; padding: 2rem;
}
.drill-result-score { font-size: 3rem; font-weight: 900; margin-bottom: 0.5rem; }
.drill-result-msg { font-size: 1.1rem; font-weight: 700; color: #64748b; margin-bottom: 1.5rem; }

/* Badge Popup */
.badge-popup {
  position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%) scale(0.8);
  z-index: 2000; opacity: 0; transition: all 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
  pointer-events: none;
}
.badge-popup.show { opacity: 1; transform: translate(-50%, -50%) scale(1); pointer-events: all; }
.badge-popup-inner {
  background: white; border-radius: 24px; padding: 2rem 3rem;
  text-align: center; box-shadow: 0 20px 60px rgba(91,94,244,0.3);
  border: 3px solid #5b5ef4;
}
.badge-popup-icon { font-size: 4rem; margin-bottom: 0.5rem; animation: badgeBounce 0.5s ease 0.3s; }
@keyframes badgeBounce { 0%,100% { transform: scale(1); } 50% { transform: scale(1.3); } }
.badge-popup-title { font-size: 0.8rem; font-weight: 800; color: #5b5ef4; text-transform: uppercase; letter-spacing: 1px; }
.badge-popup-name { font-size: 1.3rem; font-weight: 900; margin: 0.3rem 0; }
.badge-popup-desc { font-size: 0.85rem; color: #64748b; margin-bottom: 0.5rem; }
.badge-popup-xp {
  font-weight: 900; color: white; background: linear-gradient(135deg, #5b5ef4, #7209b7);
  padding: 0.3rem 1rem; border-radius: 50px; display: inline-block; font-size: 0.9rem;
}

/* Exam Priority Colors */
.exam-priority-list { display: flex; flex-direction: column; gap: 0.5rem; }
.ep-item {
  display: flex; align-items: center; gap: 0.75rem;
  padding: 0.75rem 1rem; border-radius: 12px; border: 1.5px solid #e8eaff;
  background: white; transition: all 0.2s;
}
.ep-item.urgent { border-color: #fecaca; background: #fef2f2; }
.ep-item.focus { border-color: #fed7aa; background: #fff7ed; }
.ep-item:hover { transform: translateX(3px); }
.ep-rank { width: 28px; height: 28px; border-radius: 50%; display: flex; align-items: center; justify-content: center; font-weight: 900; font-size: 0.78rem; color: white; flex-shrink: 0; }
.ep-rank.critical { background: #dc2626; }
.ep-rank.weak { background: #f97316; }
.ep-rank.average { background: #eab308; }
.ep-rank.strong { background: #22c55e; }
.ep-topic { flex: 1; font-weight: 700; font-size: 0.9rem; }
.ep-marks { font-weight: 800; font-size: 0.8rem; color: #5b5ef4; }
.ep-time { font-size: 0.75rem; font-weight: 700; color: #64748b; }

/* Responsive */
@media (max-width: 768px) {
  .challenge-grid { grid-template-columns: 1fr; }
  .wk-card { flex-wrap: wrap; }
  .wk-meta { width: 100%; justify-content: space-between; margin-top: 0.5rem; }
  .drill-modal { padding: 1.5rem; }
  .badge-popup-inner { padding: 1.5rem 2rem; }
}
