/* Game-like Dashboard Styles */

:root {
  --primary-color: #2a2a2a;
  --primary-light: #444444;
  --primary-dark: #111111;
  --secondary-color: #00ff64;
  --secondary-light: #66ffa6;
  --secondary-dark: #00b248;
  --background-dark: #121212;
  --background-card: #0b0b0b;
  --text-primary: #e6e6e6;
  --text-secondary: rgba(255, 255, 255, 0.6);
  --success-color: #00ff64;
  --warning-color: #ffb000;
  --danger-color: #ff3d00;
  --border-radius: 18px;
  --card-shadow: 0 8px 16px rgba(0, 0, 0, 0.4);
}

/* Main Dashboard Layout */
.course-content-shell.is-dashboard {
  padding-top: 0 !important;
}

.game-dashboard {
  max-width: 1200px;
  width: 100%;
  margin: 0 auto;
  padding: 20px;
  display: grid;
  grid-template-columns: repeat(12, 1fr);
  grid-gap: 20px;
  color: var(--text-primary);
}

/* Player Card */
.player-card {
  grid-column: span 12;
  background: var(--background-card);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}



.player-badge-container {
  position: relative;
  width: 100px;
  height: 100px;
  border-radius: 50%;
  overflow: hidden;
  margin-right: 20px;
  cursor: pointer;
}

.player-badge-container img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

.badge-change-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.3s ease;
  color: white;
}

.player-badge-container:hover .badge-change-overlay {
  opacity: 1;
}

.badge-change-overlay i {
  font-size: 24px;
  margin-bottom: 5px;
}

.player-info {
  flex: 1;
}

.gamertag-container {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
}

.gamertag-container h2 {
  margin: 0;
  font-size: 2rem;
  color: #ffffff;
}

.player-level {
  margin-left: 15px;
  background: #1a1a1a;
  border: 1px solid rgba(255, 255, 255, 0.12);
  color: #ffffff;
  padding: 5px 10px;
  border-radius: 20px;
  font-weight: bold;
  font-size: 0.9rem;
  box-shadow: 0 3px 6px rgba(0, 0, 0, 0.3);
  display: flex;
  align-items: center;
}

.level-indicator {
  font-size: 0.7rem;
  opacity: 0.8;
  margin-right: 5px;
}

.xp-bar-container {
  width: 100%;
  max-width: 400px;
}

.xp-bar {
  height: 10px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 5px;
  overflow: hidden;
  margin-bottom: 5px;
}

.xp-fill {
  height: 100%;
  background: #ffffff;
  width: 0%;
  transition: width 1s ease-in-out;
  border-radius: 5px;
}

.xp-text {
  font-size: 0.8rem;
  color: var(--text-secondary);
  text-align: right;
}

/* Stats Grid */
.stats-grid {
  grid-column: span 12;
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  grid-gap: 20px;
}

.stat-tile {
  background: var(--background-card);
  border-radius: var(--border-radius);
  padding: 20px;
  display: flex;
  align-items: center;
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  position: relative;
  overflow: hidden;
}



.stat-icon {
  width: 82px;
  height: 82px;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-right: 18px;
  flex: 0 0 82px;
}

.stat-icon-img {
  display: block;
  width: 82px;
  height: 82px;
  object-fit: contain;
  pointer-events: none;
  user-select: none;
}

.stat-info {
  flex: 1;
}

.stat-value {
  font-size: 2rem;
  font-weight: bold;
  margin-bottom: 5px;
  color: #ffffff;
}

.stat-label {
  font-size: 0.9rem;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 1px;
}

/* Dashboard Panels */
.dashboard-panel {
  background: var(--background-card);
  border-radius: var(--border-radius);
  box-shadow: var(--card-shadow);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: visible;
  display: flex;
  flex-direction: column;
}

.achievements-panel {
  grid-column: span 12;
}

.activity-panel {
  grid-column: span 6;
}

.mastery-panel {
  grid-column: span 6;
}

.panel-header {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.2);
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: var(--border-radius) var(--border-radius) 0 0;
}

.panel-header h2 {
  margin: 0;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
}

.panel-header h2 i {
  margin-right: 10px;
  color: #ffffff;
}

.panel-content {
  padding: 20px;
  overflow: visible;
  flex: 1;
}

.activity-panel .panel-content {
  height: auto;
  max-height: none;
}

.mastery-panel .panel-content {
  height: auto;
  max-height: none;
  display: flex;
  flex-direction: column;
}

/* Achievements Grid */
.achievements-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  grid-gap: 15px;
}

.achievement {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(255, 255, 255, 0.05);
  transition: background 0.2s ease;
  position: relative;
  cursor: default;
}

.achievement:hover {
  background: rgba(255, 255, 255, 0.1);
}

.achievement.locked {
  background: rgba(0, 0, 0, 0.3);
  color: rgba(255, 255, 255, 0.3);
  font-size: 24px;
}

.achievement.unlocked {
  background: rgba(255, 255, 255, 0.08); /* slightly brightened gray */
}

/* Calendar Activity */
.calendar-container {
  width: 100%;
  margin-bottom: 10px;
}

.calendar-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.calendar-title {
  font-size: 1.2rem;
  font-weight: bold;
}

.calendar-nav {
  display: flex;
  gap: 10px;
}

.calendar-nav-btn {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: var(--text-primary);
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: background 0.3s ease;
}

.calendar-nav-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.calendar-grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
  gap: 5px;
  margin-bottom: 10px;
}

.calendar-day-header {
  text-align: center;
  font-size: 0.8rem;
  color: var(--text-secondary);
  padding: 5px;
  text-transform: uppercase;
}

.calendar-day {
  aspect-ratio: 1;
  border-radius: 5px;
  background: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.9rem;
  position: relative;
  transition: background 0.3s ease;
  cursor: default;
}

.calendar-day:hover {
  background: rgba(255, 255, 255, 0.1);
}

.calendar-day.has-activity {
  background: rgba(157, 70, 255, 0.2);
}

.calendar-day.has-activity:hover {
  background: rgba(157, 70, 255, 0.3);
}

.calendar-day.today {
  background: rgba(157, 70, 255, 0.4);
}

.calendar-day.other-month {
  opacity: 0.5;
}

.day-activity-popup,
.dashboard-tooltip {
  position: absolute;
  bottom: calc(100% + 5px);
  left: 50%;
  transform: translateX(-50%);
  background: var(--background-card);
  border-radius: 5px;
  padding: 8px 12px;
  font-size: 0.8rem;
  white-space: nowrap;
  box-shadow: 0 3px 10px rgba(0, 0, 0, 0.5);
  z-index: 9999;
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
  border: none;
}

.calendar-day:hover .day-activity-popup,
.mastery-card:hover .dashboard-tooltip,
.achievement:hover .dashboard-tooltip {
  opacity: 1;
}

/* Subject Mastery */
.mastery-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-gap: 15px;
  margin-bottom: 0;
}

.mastery-card {
  padding: 15px;
  border-radius: 10px;
  text-align: center;
  background: rgba(255, 255, 255, 0.05);
  position: relative;
  transition: background 0.3s ease;
  cursor: default;
}

.mastery-card:hover {
  background: rgba(255, 255, 255, 0.1);
}

.mastery-subject {
  font-size: 1.1rem;
  font-weight: bold;
  margin-bottom: 10px;
  text-transform: capitalize;
}

.mastery-completion {
  font-size: 1.3rem;
  font-weight: bold;
}



/* Badge Selection Modal */
.game-modal {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0, 0, 0, 0.8);
  z-index: 1000;
  justify-content: center;
  align-items: center;
}

.game-modal .modal-content {
  background: var(--background-card);
  border-radius: var(--border-radius);
  width: 90%;
  max-width: 400px;
  max-height: 80vh;
  overflow: hidden;
  box-shadow: 0 0 30px rgba(157, 70, 255, 0.5);
  border: 1px solid var(--primary-color);
  position: relative;
  z-index: 1001;
}

.game-modal .modal-header {
  padding: 15px 20px;
  background: rgba(0, 0, 0, 0.3);
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.game-modal .modal-header h2 {
  margin: 0;
  font-size: 1.5rem;
  color: var(--text-primary);
}

.close-modal {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 24px;
  cursor: pointer;
  transition: color 0.3s ease;
}

.close-modal:hover {
  color: var(--text-primary);
}

.game-modal .modal-body {
  padding: 20px;
  max-height: calc(80vh - 70px);
  overflow-y: auto;
}

.badges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  grid-gap: 15px;
}

.badge-item {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: hidden;
  cursor: pointer;
  transition: border-color 0.2s ease, transform 0.1s ease;
  border: 2px solid transparent;
}

.badge-item:hover {
  border-color: rgba(255, 255, 255, 0.3);
}

.badge-item:active {
  transform: translateY(2px);
}

.badge-item.selected {
  border-color: var(--secondary-color);
}

.badge-item img {
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* Empty State */
.empty-state {
  text-align: center;
  color: var(--text-secondary);
  padding: 20px;
  font-style: italic;
}

/* Error Message */
.error-message {
  color: var(--danger-color);
  text-align: center;
  padding: 20px;
  background: rgba(255, 61, 0, 0.1);
  border-radius: 8px;
  border: 1px solid rgba(255, 61, 0, 0.3);
}

/* Responsive Adjustments */
@media (max-width: 992px) {

  .activity-panel,
  .mastery-panel {
    grid-column: span 12;
  }
}

@media (max-width: 768px) {
  .player-card {
    flex-direction: column;
    text-align: center;
  }

  .player-badge-container {
    margin-right: 0;
    margin-bottom: 20px;
  }

  .gamertag-container {
    flex-direction: column;
  }

  .player-level {
    margin-left: 0;
    margin-top: 10px;
  }

  .xp-bar-container {
    margin: 0 auto;
  }

  .calendar-grid {
    grid-template-columns: repeat(7, 1fr);
    gap: 3px;
  }

  .calendar-day {
    font-size: 0.8rem;
  }
}

@media (max-width: 480px) {
  .stats-grid {
    grid-template-columns: 1fr;
  }

  .achievements-grid,
  .badges-grid {
    grid-template-columns: repeat(3, 1fr);
  }
}

/* Badge Selection Overlay - New Implementation */
.badge-select-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.85);
  z-index: 9999;
  display: flex;
  justify-content: center;
  align-items: center;
}

.badge-select-container {
  background-color: var(--background-card);
  width: 90%;
  max-width: 500px;
  border-radius: var(--border-radius);
  border: 1px solid rgba(255, 255, 255, 0.1);
  overflow: hidden;
}

.badge-select-header {
  background-color: rgba(0, 0, 0, 0.3);
  padding: 15px 20px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.badge-select-header h3 {
  margin: 0;
  color: var(--text-primary);
  font-size: 1.5rem;
}

.badge-close-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  font-size: 28px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
  margin: 0;
}

.badge-close-btn:hover {
  color: var(--text-primary);
}

.badge-select-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 15px;
  padding: 20px;
}

.badge-select-item {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 10px;
  overflow: visible;
  cursor: pointer;
  transition: transform 0.1s ease, background-color 0.2s ease;
  border: 3px solid transparent;
  background-color: rgba(255, 255, 255, 0.05);
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
}

.badge-select-item:hover {
  background-color: rgba(255, 255, 255, 0.1);
}

.badge-select-item:active {
  transform: translateY(2px);
}

.badge-select-item.selected {
  border-color: var(--secondary-color);
}

.badge-select-item img {
  width: 80%;
  height: 80%;
  object-fit: contain;
}

.badge-select-item .badge-name {
  position: absolute;
  bottom: 110%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 5px 10px;
  font-size: 12px;
  text-align: center;
  opacity: 0;
  transition: opacity 0.2s ease;
  border-radius: 4px;
  white-space: nowrap;
  pointer-events: none;
  z-index: 10000;
}

.badge-select-item .badge-name::after {
  content: '';
  position: absolute;
  top: 100%;
  left: 50%;
  transform: translateX(-50%);
  border-width: 5px;
  border-style: solid;
  border-color: rgba(0, 0, 0, 0.9) transparent transparent transparent;
}

.badge-select-item:hover .badge-name {
  opacity: 1;
  visibility: visible;
}

/* Loading Indicator */
.loading-indicator {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  display: flex;
  justify-content: center;
  align-items: center;
  background: rgba(11, 11, 11, 0.6);
  z-index: 10;
  border-radius: var(--border-radius);
  pointer-events: none;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(255, 255, 255, 0.1);
  border-radius: 50%;
  border-top-color: #ffffff;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}
