/**
 * Frontend Styles for MasterStudy Quiz Winners
 */

/* Quiz History */
.msqw-quiz-history {
  max-width: 1200px;
  margin: 0 auto;
}

/* Stats Cards */
.msqw-stats-cards {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
}

.msqw-stat-card {
  display: flex;
  align-items: center;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: transform 0.3s ease;
}

.msqw-stat-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.msqw-stat-card .stat-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #f0f0f1;
  margin-right: 15px;
}

.msqw-stat-card .stat-icon .dashicons {
  font-size: 24px;
  width: 24px;
  height: 24px;
}

.msqw-stat-card.success .stat-icon {
  background: #d4edda;
  color: #155724;
}

.msqw-stat-card.warning .stat-icon {
  background: #fff3cd;
  color: #856404;
}

.msqw-stat-card.info .stat-icon {
  background: #d1ecf1;
  color: #0c5460;
}

.msqw-stat-card .stat-value {
  font-size: 28px;
  font-weight: bold;
  color: #1e1e1e;
  margin-bottom: 5px;
}

.msqw-stat-card .stat-label {
  font-size: 14px;
  color: #646970;
}

/* History Section */
.msqw-history-section {
  margin-top: 30px;
}

.msqw-history-section h3 {
  font-size: 24px;
  margin-bottom: 20px;
}

.msqw-history-list {
  display: grid;
  gap: 20px;
}

.msqw-history-item {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  border-left: 4px solid #646970;
}

.msqw-history-item.passed {
  border-left-color: #46b450;
}

.msqw-history-item.failed {
  border-left-color: #dc3232;
}

.msqw-history-item .history-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
}

.msqw-history-item .quiz-title {
  margin: 0;
  font-size: 18px;
  color: #1e1e1e;
}

.msqw-history-item .quiz-status {
  padding: 4px 12px;
  border-radius: 12px;
  font-size: 12px;
  font-weight: 600;
  text-transform: uppercase;
}

.msqw-history-item .badge-passed {
  background: #d4edda;
  color: #155724;
}

.msqw-history-item .badge-failed {
  background: #f8d7da;
  color: #721c24;
}

.msqw-history-item .history-content {
  display: flex;
  align-items: center;
  gap: 20px;
}

/* Score Circle */
.quiz-score .score-circle {
  position: relative;
  width: 80px;
  height: 80px;
}

.circular-chart {
  display: block;
}

.circle-bg {
  fill: none;
  stroke: #f0f0f1;
  stroke-width: 3.8;
}

.circle {
  fill: none;
  stroke: #46b450;
  stroke-width: 2.8;
  stroke-linecap: round;
  animation: progress 1s ease-out forwards;
}

.msqw-history-item.failed .circle {
  stroke: #dc3232;
}

.score-circle .percentage {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: bold;
  color: #1e1e1e;
}

@keyframes progress {
  0% {
    stroke-dasharray: 0 100;
  }
}

/* Quiz Details */
.quiz-details {
  flex: 1;
}

.quiz-details p {
  margin: 8px 0;
  color: #646970;
}

.quiz-details .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
  vertical-align: middle;
  margin-right: 5px;
}

.view-quiz-link {
  display: inline-flex;
  align-items: center;
  color: #2271b1;
  text-decoration: none;
  font-weight: 600;
}

.view-quiz-link:hover {
  color: #135e96;
}

/* Leaderboard */
.msqw-leaderboard {
  background: #fff;
  border-radius: 8px;
  padding: 30px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.leaderboard-title {
  font-size: 24px;
  margin-bottom: 20px;
  text-align: center;
}

.leaderboard-list {
  display: grid;
  gap: 15px;
}

.leaderboard-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 8px;
  transition: all 0.3s ease;
}

.leaderboard-item:hover {
  background: #f0f0f1;
  transform: translateX(5px);
}

.leaderboard-item.rank-1,
.leaderboard-item.rank-2,
.leaderboard-item.rank-3 {
  background: linear-gradient(135deg, #fff9e6 0%, #fff 100%);
  border: 2px solid #ffd700;
}

.leaderboard-item.rank-2 {
  background: linear-gradient(135deg, #f5f5f5 0%, #fff 100%);
  border-color: #c0c0c0;
}

.leaderboard-item.rank-3 {
  background: linear-gradient(135deg, #fff5f0 0%, #fff 100%);
  border-color: #cd7f32;
}

.rank-number {
  min-width: 50px;
  text-align: center;
}

.medal {
  font-size: 32px;
}

.rank-text {
  font-size: 20px;
  font-weight: bold;
  color: #646970;
}

.user-info {
  display: flex;
  align-items: center;
  gap: 15px;
  flex: 1;
}

.user-avatar img {
  border-radius: 50%;
}

.user-name {
  margin: 0;
  font-size: 16px;
}

.user-attempts {
  margin: 0;
  font-size: 13px;
  color: #646970;
}

.score-badge {
  min-width: 80px;
  text-align: center;
}

.score-value {
  font-size: 24px;
  font-weight: bold;
  color: #2271b1;
}

/* Winners Display */
.msqw-winners-display {
  padding: 30px 0;
}

.winners-title {
  font-size: 28px;
  text-align: center;
  margin-bottom: 30px;
}

.winners-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 30px;
  max-width: 1200px;
  margin: 0 auto;
}

.winner-card {
  background: #fff;
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  position: relative;
}

.winner-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.winner-card.position-1 {
  border: 3px solid #ffd700;
}

.winner-card.position-2 {
  border: 3px solid #c0c0c0;
}

.winner-card.position-3 {
  border: 3px solid #cd7f32;
}

.winner-rank-badge {
  font-size: 48px;
  margin-bottom: 15px;
}

.winner-avatar img {
  border-radius: 50%;
  width: 96px;
  height: 96px;
}

.winner-name {
  margin: 15px 0 10px;
  font-size: 20px;
}

.winner-score-display {
  margin: 15px 0;
  padding: 10px;
  background: #f9f9f9;
  border-radius: 6px;
}

.score-label {
  display: block;
  font-size: 13px;
  color: #646970;
  margin-bottom: 5px;
}

.score-value {
  font-size: 24px;
  font-weight: bold;
  color: #2271b1;
}

.winner-quiz,
.winner-date {
  margin: 8px 0;
  font-size: 14px;
  color: #646970;
}

.winner-quiz .dashicons,
.winner-date .dashicons {
  vertical-align: middle;
  margin-right: 5px;
}

/* Dashboard Widget */
.msqw-dashboard-widget {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.msqw-dashboard-widget h3 {
  margin-top: 0;
  padding-bottom: 10px;
  border-bottom: 2px solid #f0f0f1;
}

.widget-stats .stat-row {
  display: flex;
  justify-content: space-between;
  padding: 10px 0;
  border-bottom: 1px solid #f0f0f1;
}

.widget-stats .stat-label {
  color: #646970;
}

.widget-stats .stat-value {
  font-weight: bold;
  color: #1e1e1e;
}

.widget-stats .stat-value.success {
  color: #46b450;
}

.widget-stats .stat-value.highlight {
  color: #2271b1;
}

.recent-quizzes {
  margin-top: 20px;
}

.recent-quizzes h4 {
  margin-bottom: 10px;
}

.quiz-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.quiz-item {
  display: flex;
  justify-content: space-between;
  padding: 8px 0;
  border-bottom: 1px solid #f0f0f1;
}

.quiz-item .quiz-score {
  font-weight: bold;
}

.quiz-item .quiz-score.passed {
  color: #46b450;
}

.quiz-item .quiz-score.failed {
  color: #dc3232;
}

/* Empty State */
.msqw-empty-state {
  text-align: center;
  padding: 40px 20px;
  color: #646970;
}

.msqw-empty-state .dashicons {
  font-size: 48px;
  width: 48px;
  height: 48px;
  opacity: 0.5;
}

.msqw-empty-state p {
  margin: 15px 0;
}

/* Enrolled Courses Section */
.msqw-courses-section {
  margin: 30px 0;
}

.msqw-courses-section h3 {
  font-size: 24px;
  margin-bottom: 20px;
}

.msqw-courses-list {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
  gap: 20px;
}

.msqw-course-card {
  background: #fff;
  border-radius: 8px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border-left: 4px solid #2271b1;
}

.msqw-course-card:hover {
  transform: translateY(-3px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.msqw-course-card .course-title {
  margin: 0 0 15px;
  font-size: 18px;
}

.msqw-course-card .course-title a {
  color: #1e1e1e;
  text-decoration: none;
}

.msqw-course-card .course-title a:hover {
  color: #2271b1;
}

.msqw-course-card .course-stats {
  display: flex;
  gap: 20px;
  margin-bottom: 15px;
}

.msqw-course-card .course-stat-item {
  display: flex;
  align-items: center;
  gap: 5px;
  font-size: 14px;
  color: #646970;
}

.msqw-course-card .course-stat-item .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

.msqw-course-card .course-stat-item .stat-value {
  font-weight: bold;
  color: #1e1e1e;
}

.msqw-course-card .course-progress-bar {
  height: 6px;
  background: #f0f0f1;
  border-radius: 3px;
  overflow: hidden;
}

.msqw-course-card .progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #2271b1 0%, #46b450 100%);
  transition: width 0.3s ease;
}

/* Points History */
.msqw-points-history {
  max-width: 1200px;
  margin: 0 auto;
}

.msqw-points-total-card {
  display: flex;
  align-items: center;
  padding: 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  color: #fff;
  margin-bottom: 30px;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.msqw-points-total-card .points-icon {
  width: 80px;
  height: 80px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.2);
  margin-right: 20px;
}

.msqw-points-total-card .points-icon .dashicons {
  font-size: 40px;
  width: 40px;
  height: 40px;
}

.msqw-points-total-card .points-value {
  font-size: 48px;
  font-weight: bold;
  margin-bottom: 5px;
}

.msqw-points-total-card .points-label {
  font-size: 18px;
  opacity: 0.9;
}

.msqw-points-section h3 {
  font-size: 24px;
  margin-bottom: 20px;
}

.msqw-points-list {
  display: grid;
  gap: 15px;
}

.msqw-point-item {
  display: flex;
  align-items: center;
  gap: 20px;
  padding: 20px;
  background: #fff;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
}

.msqw-point-item:hover {
  transform: translateX(5px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
}

.msqw-point-item .point-icon {
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  border-radius: 50%;
  background: #d4edda;
  color: #155724;
}

.msqw-point-item .point-icon .dashicons {
  font-size: 24px;
  width: 24px;
  height: 24px;
}

.msqw-point-item .point-details {
  flex: 1;
}

.msqw-point-item .point-source {
  margin: 0 0 5px;
  font-size: 16px;
  color: #1e1e1e;
}

.msqw-point-item .point-description {
  margin: 0 0 8px;
  font-size: 14px;
  color: #646970;
}

.msqw-point-item .point-date {
  margin: 0;
  font-size: 13px;
  color: #999;
}

.msqw-point-item .point-date .dashicons {
  font-size: 14px;
  width: 14px;
  height: 14px;
  vertical-align: middle;
}

.msqw-point-item .point-value {
  text-align: center;
  min-width: 80px;
}

.msqw-point-item .points-earned {
  display: block;
  font-size: 28px;
  font-weight: bold;
  color: #46b450;
  margin-bottom: 2px;
}

.msqw-point-item .points-text {
  display: block;
  font-size: 12px;
  color: #646970;
  text-transform: uppercase;
}

.msqw-points-guide {
  margin-top: 30px;
  padding: 20px;
  background: #f9f9f9;
  border-radius: 8px;
  border-left: 4px solid #2271b1;
}

.msqw-points-guide h4 {
  margin: 0 0 15px;
  font-size: 18px;
}

.msqw-points-guide .points-rules {
  list-style: none;
  padding: 0;
  margin: 0;
}

.msqw-points-guide .points-rules li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 0;
  font-size: 14px;
  color: #646970;
}

.msqw-points-guide .points-rules .dashicons {
  color: #46b450;
  font-size: 18px;
  width: 18px;
  height: 18px;
}

/* Quiz-specific Leaderboard */
.msqw-quiz-leaderboard {
  max-width: 1200px;
  margin: 0 auto;
}

.msqw-quiz-leaderboard .quiz-header {
  text-align: center;
  margin-bottom: 40px;
  padding: 30px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  color: #fff;
}

.msqw-quiz-leaderboard .quiz-title {
  margin: 0 0 10px;
  font-size: 32px;
}

.msqw-quiz-leaderboard .quiz-subtitle {
  margin: 0;
  font-size: 16px;
  opacity: 0.9;
}

.msqw-winners-section {
  margin-bottom: 40px;
}

.msqw-winners-section h3 {
  font-size: 24px;
  margin-bottom: 20px;
  text-align: center;
}

.msqw-winners-showcase {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 30px;
  margin-bottom: 40px;
}

.msqw-winners-showcase .winner-card {
  background: #fff;
  border-radius: 12px;
  padding: 30px;
  text-align: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
  transition: all 0.3s ease;
  border: 3px solid transparent;
}

.msqw-winners-showcase .winner-card:hover {
  transform: translateY(-5px);
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15);
}

.msqw-winners-showcase .winner-card.rank-1 {
  border-color: #ffd700;
}

.msqw-winners-showcase .winner-card.rank-2 {
  border-color: #c0c0c0;
}

.msqw-winners-showcase .winner-card.rank-3 {
  border-color: #cd7f32;
}

.msqw-winners-showcase .winner-medal {
  font-size: 48px;
  margin-bottom: 15px;
}

.msqw-winners-showcase .winner-avatar img {
  border-radius: 50%;
  width: 80px;
  height: 80px;
}

.msqw-winners-showcase .winner-name {
  margin: 15px 0 10px;
  font-size: 18px;
  font-weight: bold;
}

.msqw-winners-showcase .winner-score {
  font-size: 24px;
  font-weight: bold;
  color: #2271b1;
  margin: 10px 0;
}

.msqw-winners-showcase .winner-badge {
  display: inline-block;
  padding: 6px 16px;
  background: #f0f0f1;
  border-radius: 20px;
  font-size: 13px;
  font-weight: 600;
  color: #646970;
}

.msqw-leaderboard-section h3 {
  font-size: 24px;
  margin-bottom: 20px;
}

.msqw-leaderboard-table {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table thead {
  background: #f9f9f9;
}

.leaderboard-table thead th {
  padding: 15px;
  text-align: left;
  font-size: 14px;
  font-weight: 600;
  color: #646970;
  text-transform: uppercase;
  border-bottom: 2px solid #f0f0f1;
}

.leaderboard-table tbody tr {
  border-bottom: 1px solid #f0f0f1;
  transition: background 0.3s ease;
}

.leaderboard-table tbody tr:hover {
  background: #f9f9f9;
}

.leaderboard-table tbody tr.current-user {
  background: #e7f3ff;
}

.leaderboard-table tbody tr.current-user:hover {
  background: #d0e7ff;
}

.leaderboard-table tbody td {
  padding: 15px;
}

.leaderboard-table .rank-col {
  width: 80px;
  text-align: center;
}

.leaderboard-table .medal {
  font-size: 24px;
}

.leaderboard-table .rank-number {
  font-size: 16px;
  font-weight: bold;
  color: #646970;
}

.leaderboard-table .user-col {
  width: 40%;
}

.leaderboard-table .user-info {
  display: flex;
  align-items: center;
  gap: 12px;
}

.leaderboard-table .user-avatar-small img {
  border-radius: 50%;
  width: 32px;
  height: 32px;
}

.leaderboard-table .user-name {
  font-size: 15px;
  font-weight: 600;
  color: #1e1e1e;
}

.leaderboard-table .you-badge {
  display: inline-block;
  padding: 2px 8px;
  background: #2271b1;
  color: #fff;
  border-radius: 10px;
  font-size: 11px;
  margin-left: 8px;
}

.leaderboard-table .score-col {
  width: 20%;
  text-align: center;
}

.leaderboard-table .score-badge {
  display: inline-block;
  padding: 6px 16px;
  background: #d1ecf1;
  color: #0c5460;
  border-radius: 20px;
  font-weight: 600;
}

.leaderboard-table .attempts-col {
  width: 15%;
  text-align: center;
  color: #646970;
}

.msqw-actions {
  margin-top: 30px;
  text-align: center;
}

.msqw-actions .button {
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.msqw-actions .dashicons {
  font-size: 16px;
  width: 16px;
  height: 16px;
}

/* Responsive */
@media (max-width: 768px) {
  .msqw-stats-cards {
    grid-template-columns: 1fr;
  }

  .msqw-history-item .history-content {
    flex-direction: column;
    align-items: flex-start;
  }

  .leaderboard-item {
    flex-wrap: wrap;
  }

  .winners-grid {
    grid-template-columns: 1fr;
  }

  .msqw-courses-list {
    grid-template-columns: 1fr;
  }

  .msqw-point-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .msqw-point-item .point-value {
    align-self: flex-end;
  }

  .msqw-winners-showcase {
    grid-template-columns: 1fr;
  }

  .msqw-leaderboard-table {
    overflow-x: auto;
  }

  .leaderboard-table {
    min-width: 600px;
  }
}
