/* ============================================
   xp.css — XP / Gamification System
   ============================================ */

/* ===== Header Widget ===== */
.xp-header-widget {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 4px 10px;
  border-radius: 6px;
  background: rgba(188, 140, 255, 0.08);
  border: 1px solid rgba(188, 140, 255, 0.2);
  cursor: pointer;
  transition: all var(--transition-fast);
  flex-shrink: 0;
}

.xp-header-widget:hover {
  background: rgba(188, 140, 255, 0.15);
  border-color: var(--accent-purple);
}

.xp-level-name {
  font-size: 0.72rem;
  font-weight: 700;
  color: var(--accent-purple);
  white-space: nowrap;
}

.xp-mini-bar {
  width: 60px;
  height: 4px;
  background: var(--bg-tertiary);
  border-radius: 2px;
  overflow: hidden;
}

.xp-mini-bar-fill {
  height: 100%;
  background: var(--accent-green);
  border-radius: 2px;
  transition: width 0.5s ease;
}

.xp-amount {
  font-size: 0.68rem;
  color: var(--text-muted);
  font-family: var(--font-mono);
  white-space: nowrap;
}

/* ===== Overlay / Modal ===== */
.xp-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
  z-index: 300;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px;
}

.xp-panel {
  background: var(--bg-card);
  border: 1px solid var(--border-primary);
  border-radius: 12px;
  width: 100%;
  max-width: 560px;
  max-height: 90vh;
  overflow-y: auto;
  padding: 28px;
  position: relative;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  animation: fadeIn 0.2s ease;
}

.xp-close-btn {
  position: absolute;
  top: 16px;
  right: 16px;
  width: 28px;
  height: 28px;
  border-radius: 4px;
  border: none;
  background: transparent;
  color: var(--text-muted);
  font-size: 20px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all var(--transition-fast);
}

.xp-close-btn:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.xp-panel h2 {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 20px;
}

.xp-panel h3 {
  font-size: 14px;
  font-weight: 700;
  color: var(--text-primary);
  margin: 20px 0 12px;
}

/* ===== Level Display ===== */
.xp-level-display {
  text-align: center;
  margin-bottom: 16px;
}

.xp-level-big {
  font-size: 1.5rem;
  font-weight: 700;
  color: var(--accent-purple);
}

.xp-level-num {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== Progress Bar ===== */
.xp-progress-bar {
  width: 100%;
  height: 8px;
  background: var(--bg-tertiary);
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 16px;
}

.xp-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-purple), var(--accent-blue));
  border-radius: 4px;
  transition: width 0.5s ease;
}

/* ===== Stats Row ===== */
.xp-stats-row {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
}

.xp-stat-item {
  flex: 1;
  text-align: center;
  padding: 12px;
  background: var(--bg-tertiary);
  border-radius: 8px;
}

.xp-stat-value {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--accent-blue);
  font-family: var(--font-mono);
}

.xp-stat-label {
  font-size: 0.68rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--text-muted);
  margin-top: 4px;
}

/* ===== History ===== */
.xp-history-list {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.xp-history-empty {
  text-align: center;
  color: var(--text-muted);
  font-size: 0.85rem;
  padding: 16px;
  font-style: italic;
}

.xp-history-item {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 10px;
  border-radius: 6px;
  background: var(--bg-tertiary);
  font-size: 0.82rem;
}

.xp-history-detail {
  flex: 1;
  color: var(--text-secondary);
}

.xp-history-amount {
  font-weight: 700;
  color: var(--accent-green);
  font-family: var(--font-mono);
  font-size: 0.78rem;
}

.xp-history-date {
  color: var(--text-muted);
  font-size: 0.72rem;
}

/* ===== Badges Grid ===== */
.xp-badges-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
}

.xp-badge-card {
  padding: 14px 10px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-primary);
  border-radius: 8px;
  text-align: center;
  opacity: 0.4;
  transition: all var(--transition-fast);
}

.xp-badge-card.earned {
  opacity: 1;
  border-color: var(--accent-purple);
  background: rgba(188, 140, 255, 0.08);
}

.xp-badge-icon {
  font-size: 1.5rem;
  margin-bottom: 6px;
}

.xp-badge-name {
  font-size: 0.78rem;
  font-weight: 700;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.xp-badge-desc {
  font-size: 0.68rem;
  color: var(--text-muted);
  line-height: 1.3;
}

/* ===== Toast ===== */
.xp-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  padding: 10px 18px;
  background: var(--bg-card);
  border: 1px solid var(--accent-green);
  border-radius: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.4);
  z-index: 500;
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 0.88rem;
  font-weight: 700;
  color: var(--accent-green);
  transform: translateY(20px);
  opacity: 0;
  transition: all 0.3s ease;
}

.xp-toast.show {
  transform: translateY(0);
  opacity: 1;
}

.xp-toast-detail {
  font-weight: 400;
  font-size: 0.8rem;
  color: var(--text-secondary);
}

/* ===== Responsive ===== */
@media (max-width: 768px) {
  .xp-header-widget {
    display: none;
  }

  .xp-badges-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .xp-stats-row {
    flex-wrap: wrap;
  }
}
