/**
 * Skills Dashboard Styles
 * Complements the SkillsMap theme
 */

/* Toggle Button */
.dashboard-toggle-btn {
  position: fixed;
  top: 16px;
  left: 16px;
  z-index: 9999;
  display: flex;
  align-items: center;
  gap: 8px;
  background: rgba(15, 23, 36, 0.9);
  border: 2px solid rgba(114, 214, 255, 0.5);
  color: var(--panel-text, #e5e7f0);
  padding: 10px 16px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-family: "Segoe UI", Roboto, sans-serif;
  transition: transform 160ms ease, background 160ms ease, border-color 160ms ease;
}

.dashboard-toggle-btn:hover,
.dashboard-toggle-btn:focus-visible {
  transform: translateY(-1px);
  background: rgba(15, 23, 36, 0.95);
  border-color: rgba(114, 214, 255, 0.8);
  outline: none;
}

.dashboard-toggle-btn.active {
  background: rgba(114, 214, 255, 0.2);
  border-color: rgba(114, 214, 255, 0.9);
}

.dashboard-toggle-btn .icon {
  font-size: 18px;
}

.dashboard-toggle-btn .label {
  font-weight: 500;
}

/* Dashboard Panel */
.dashboard-panel {
  position: fixed;
  top: 0;
  left: -420px;
  width: 400px;
  height: 100vh;
  background: var(--panel-bg, rgba(15, 23, 36, 0.95));
  backdrop-filter: blur(20px);
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.3);
  transition: left 320ms cubic-bezier(0.4, 0, 0.2, 1);
  z-index: 9998;
  overflow-y: auto;
  color: var(--panel-text, #e5e7f0);
}

.dashboard-panel.open {
  left: 0;
}

.dashboard-panel::-webkit-scrollbar {
  width: 8px;
}

.dashboard-panel::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.dashboard-panel::-webkit-scrollbar-thumb {
  background: rgba(114, 214, 255, 0.3);
  border-radius: 4px;
}

/* Close Button */
.dashboard-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: transparent;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 28px;
  cursor: pointer;
  padding: 4px 8px;
  line-height: 1;
  transition: color 160ms ease;
}

.dashboard-close:hover {
  color: rgba(255, 255, 255, 1);
}

/* Header */
.dashboard-header {
  padding: 32px 24px 16px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.dashboard-header h2 {
  margin: 0 0 4px;
  font-size: 24px;
  font-weight: 600;
  color: #f5f7ff;
}

.dashboard-subtitle {
  margin: 0;
  font-size: 13px;
  color: rgba(226, 235, 255, 0.7);
}

/* Content */
.dashboard-content {
  padding: 16px 24px 32px;
}

/* Sections */
.dashboard-section {
  margin-bottom: 28px;
}

.dashboard-section h3 {
  margin: 0 0 14px;
  font-size: 14px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: rgba(114, 214, 255, 0.9);
}

/* Stats Grid */
.stats-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}

.stat-card {
  background: rgba(255, 255, 255, 0.06);
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 10px;
  padding: 16px;
  text-align: center;
}

.stat-card.loading {
  opacity: 0.5;
}

.stat-value {
  display: block;
  font-size: 28px;
  font-weight: 700;
  color: #72d6ff;
  margin-bottom: 4px;
}

.stat-label {
  font-size: 11px;
  color: rgba(226, 235, 255, 0.7);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

/* Category Progress */
.category-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.category-item {
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 12px 14px;
}

.category-header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 8px;
}

.category-emoji {
  font-size: 20px;
}

.category-name {
  flex: 1;
  font-size: 14px;
  font-weight: 500;
  color: #f5f7ff;
}

.category-percent {
  font-size: 13px;
  font-weight: 600;
  color: #72d6ff;
}

.category-item .progress-bar {
  height: 6px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.category-item .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #72d6ff, #4ecdc4);
  border-radius: 3px;
  transition: width 400ms ease;
}

.category-footer {
  margin-top: 6px;
}

.skills-count {
  font-size: 11px;
  color: rgba(226, 235, 255, 0.6);
}

/* Activity List */
.activity-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.activity-item {
  display: grid;
  grid-template-columns: 1fr auto auto auto;
  gap: 10px;
  align-items: center;
  padding: 10px 0;
  border-bottom: 1px solid rgba(255, 255, 255, 0.06);
}

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

.activity-game {
  font-size: 13px;
  font-weight: 500;
  color: #f5f7ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.activity-score {
  font-size: 12px;
  font-weight: 600;
  color: #72d6ff;
}

.activity-stars .stars {
  color: #ffd700;
  font-size: 12px;
}

.activity-time {
  font-size: 11px;
  color: rgba(226, 235, 255, 0.5);
}

/* Recommendations */
.recommendation-list {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.recommendation-item {
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 12px;
}

.rec-emoji {
  font-size: 24px;
}

.rec-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.rec-name {
  font-size: 13px;
  font-weight: 500;
  color: #f5f7ff;
}

.rec-reason {
  font-size: 11px;
  color: rgba(226, 235, 255, 0.6);
}

.rec-action {
  background: rgba(114, 214, 255, 0.2);
  border: 1px solid rgba(114, 214, 255, 0.4);
  color: #72d6ff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 500;
  cursor: pointer;
  transition: background 160ms ease;
}

.rec-action:hover {
  background: rgba(114, 214, 255, 0.3);
}

/* Leaderboard */
.leaderboard-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.leaderboard-item {
  display: grid;
  grid-template-columns: 40px 1fr auto;
  gap: 10px;
  align-items: center;
  padding: 10px 12px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 6px;
}

.leaderboard-item.current-user {
  background: rgba(114, 214, 255, 0.15);
  border: 1px solid rgba(114, 214, 255, 0.3);
}

.leaderboard-item .rank {
  font-size: 14px;
  font-weight: 700;
  color: #ffd700;
}

.leaderboard-item:nth-child(1) .rank { color: #ffd700; }
.leaderboard-item:nth-child(2) .rank { color: #c0c0c0; }
.leaderboard-item:nth-child(3) .rank { color: #cd7f32; }
.leaderboard-item:nth-child(n+4) .rank { color: rgba(226, 235, 255, 0.7); }

.leaderboard-item .player {
  font-size: 13px;
  color: #f5f7ff;
}

.leaderboard-item .score {
  font-size: 13px;
  font-weight: 600;
  color: #72d6ff;
}

/* Achievements */
.achievements-list {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.achievement-item {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(255, 255, 255, 0.04);
  border-radius: 8px;
  padding: 10px 12px;
}

.achievement-icon {
  font-size: 24px;
}

.achievement-content {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
  min-width: 0;
}

.achievement-name {
  font-size: 13px;
  font-weight: 500;
  color: #f5f7ff;
}

.achievement-desc {
  font-size: 11px;
  color: rgba(226, 235, 255, 0.6);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.achievement-points {
  font-size: 12px;
  font-weight: 600;
  color: #ffd700;
  white-space: nowrap;
}

/* Games Catalog */
.games-list {
  display: flex;
  flex-direction: column;
  gap: 6px;
  max-height: 200px;
  overflow-y: auto;
}

.game-item {
  display: grid;
  grid-template-columns: 1fr auto auto;
  gap: 8px;
  align-items: center;
  padding: 8px 10px;
  background: rgba(255, 255, 255, 0.03);
  border-radius: 6px;
  cursor: pointer;
  transition: background 160ms ease;
}

.game-item:hover {
  background: rgba(114, 214, 255, 0.1);
}

.game-name {
  font-size: 13px;
  font-weight: 500;
  color: #f5f7ff;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.game-category {
  font-size: 10px;
  color: rgba(226, 235, 255, 0.5);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}

.game-difficulty {
  font-size: 10px;
  color: #ffd700;
}

/* Empty & Loading States */
.loading-placeholder,
.empty-state,
.error-state {
  text-align: center;
  padding: 20px;
  font-size: 13px;
  color: rgba(226, 235, 255, 0.5);
}

.error-state {
  color: #ff6b6b;
}

/* High Contrast Theme */
[data-theme="high-contrast"] .dashboard-toggle-btn {
  background: #ffffff;
  color: #000000;
  border-color: #000000;
}

[data-theme="high-contrast"] .dashboard-panel {
  background: rgba(0, 0, 0, 0.98);
}

[data-theme="high-contrast"] .stat-value,
[data-theme="high-contrast"] .category-percent,
[data-theme="high-contrast"] .activity-score,
[data-theme="high-contrast"] .leaderboard-item .score {
  color: #00ffff;
}

/* Mobile Responsive */
@media (max-width: 480px) {
  .dashboard-panel {
    width: 100%;
    left: -100%;
  }

  .dashboard-panel.open {
    left: 0;
  }

  .dashboard-toggle-btn {
    padding: 8px 12px;
  }

  .dashboard-toggle-btn .label {
    display: none;
  }
}
