/* Skill Challenges Module Styles */

/* Hero Section */
.hero-section {
  margin-bottom: 2rem;
}

.hero-card {
  background: linear-gradient(135deg, var(--primary-color), var(--secondary-color));
  color: white;
  padding: 2rem;
  border-radius: 12px;
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.hero-icon {
  font-size: 3rem;
}

.hero-content h2 {
  margin: 0 0 0.5rem 0;
  font-size: 1.5rem;
}

.hero-content p {
  margin: 0;
  opacity: 0.9;
}

/* Info Banner */
.info-banner {
  background: #e3f2fd;
  border-left: 4px solid #2196f3;
  padding: 1rem 1.5rem;
  border-radius: 8px;
  margin-bottom: 1.5rem;
  display: flex;
  gap: 1rem;
  align-items: flex-start;
}

.info-icon {
  font-size: 1.5rem;
}

.info-content strong {
  display: block;
  color: #1565c0;
  margin-bottom: 0.25rem;
}

.info-content p {
  margin: 0;
  color: #424242;
  font-size: 0.9rem;
  line-height: 1.5;
}

/* Subscription Banner */
.subscription-banner {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  padding: 1.5rem;
  border-radius: 12px;
  margin-bottom: 1.5rem;
}

.subscription-content {
  display: flex;
  align-items: center;
  gap: 1.5rem;
}

.subscription-icon {
  font-size: 2rem;
}

.subscription-text {
  flex: 1;
}

.subscription-text h3 {
  margin: 0 0 0.25rem 0;
  font-size: 1.1rem;
}

.subscription-text p {
  margin: 0;
  opacity: 0.9;
  font-size: 0.9rem;
}

.subscription-banner .btn {
  background: white;
  color: #667eea;
}

/* Filters Bar */
.filters-bar {
  display: flex;
  gap: 1rem;
  margin-bottom: 1.5rem;
  flex-wrap: wrap;
  align-items: center;
}

.filter-group {
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.filter-group label {
  font-size: 0.85rem;
  color: #666;
  white-space: nowrap;
}

.filter-group select {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  background: white;
  cursor: pointer;
}

.search-box {
  margin-left: auto;
}

.search-box input {
  padding: 0.5rem 1rem;
  border: 1px solid #ddd;
  border-radius: 8px;
  font-size: 0.9rem;
  width: 250px;
  max-width: 100%;
}

/* Milestone Alerts */
.milestone-alerts {
  margin-bottom: 1.5rem;
}

.milestone-alert {
  background: linear-gradient(135deg, #ff6b6b 0%, #feca57 100%);
  color: white;
  padding: 1rem 1.5rem;
  border-radius: 10px;
  margin-bottom: 0.75rem;
  display: flex;
  align-items: center;
  gap: 1rem;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.milestone-alert-icon {
  font-size: 1.5rem;
}

.milestone-alert-content {
  flex: 1;
}

.milestone-alert-content strong {
  display: block;
  font-size: 1rem;
}

.milestone-alert-content span {
  font-size: 0.85rem;
  opacity: 0.9;
}

/* Challenges Grid */
.challenges-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(350px, 1fr));
  gap: 1.5rem;
}

.challenge-card {
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
  overflow: hidden;
  transition: transform 0.2s, box-shadow 0.2s;
  cursor: pointer;
}

.challenge-card:hover {
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

.challenge-card-header {
  padding: 1.25rem;
  border-bottom: 1px solid #f0f0f0;
}

.challenge-card-header-top {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  margin-bottom: 0.75rem;
}

.challenge-card-title {
  font-size: 1.1rem;
  font-weight: 600;
  color: #333;
  margin: 0;
  line-height: 1.3;
}

.challenge-badge {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  white-space: nowrap;
}

.challenge-badge.speed {
  background: #e3f2fd;
  color: #1976d2;
}

.challenge-badge.accuracy {
  background: #e8f5e9;
  color: #388e3c;
}

.challenge-badge.comprehensive {
  background: #fff3e0;
  color: #f57c00;
}

.challenge-badge.live {
  background: #ffebee;
  color: #d32f2f;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: 0.7; }
}

.challenge-meta {
  display: flex;
  gap: 1rem;
  font-size: 0.85rem;
  color: #666;
}

.challenge-meta span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

.challenge-card-body {
  padding: 1.25rem;
}

.challenge-exam {
  font-size: 0.85rem;
  color: #666;
  margin-bottom: 0.75rem;
}

.challenge-exam strong {
  color: #333;
}

.challenge-description {
  font-size: 0.9rem;
  color: #555;
  line-height: 1.5;
  margin-bottom: 1rem;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.challenge-rewards {
  background: #f8f9fa;
  padding: 0.75rem;
  border-radius: 8px;
}

.challenge-rewards-title {
  font-size: 0.8rem;
  color: #666;
  margin-bottom: 0.5rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.challenge-rewards-list {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.5rem;
  font-size: 0.85rem;
}

.challenge-rewards-list .reward-item {
  display: flex;
  justify-content: space-between;
}

.challenge-rewards-list .reward-rank {
  color: #666;
}

.challenge-rewards-list .reward-amount {
  color: #2e7d32;
  font-weight: 600;
}

.challenge-card-footer {
  padding: 1rem 1.25rem;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.challenge-participants {
  font-size: 0.85rem;
  color: #666;
}

.challenge-participants strong {
  color: #333;
}

.challenge-entry-fee {
  font-size: 1.1rem;
  font-weight: 700;
  color: var(--primary-color);
}

/* Milestone Progress */
.milestone-progress {
  padding: 0 1.25rem 1rem;
}

.milestone-progress-bar {
  height: 6px;
  background: #e0e0e0;
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 0.5rem;
}

.milestone-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #ff6b6b, #feca57);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.milestone-progress-text {
  display: flex;
  justify-content: space-between;
  font-size: 0.75rem;
  color: #999;
}

/* Loading State */
.loading-state {
  text-align: center;
  padding: 3rem;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 3px solid #f3f3f3;
  border-top: 3px solid var(--primary-color);
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 1rem;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Modal Styles */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: 1rem;
}

.modal-content {
  background: white;
  border-radius: 16px;
  width: 100%;
  max-width: 450px;
  max-height: 90vh;
  overflow-y: auto;
  position: relative;
  animation: modalSlideIn 0.3s ease;
}

.modal-content.modal-large {
  max-width: 700px;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translateY(-20px) scale(0.95);
  }
  to {
    opacity: 1;
    transform: translateY(0) scale(1);
  }
}

.modal-close {
  position: absolute;
  top: 1rem;
  right: 1rem;
  width: 32px;
  height: 32px;
  border: none;
  background: #f0f0f0;
  border-radius: 50%;
  font-size: 1.25rem;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: background 0.2s;
}

.modal-close:hover {
  background: #e0e0e0;
}

.modal-header {
  padding: 1.5rem;
  border-bottom: 1px solid #f0f0f0;
  padding-right: 3rem;
}

.modal-header h2 {
  margin: 0;
  font-size: 1.25rem;
}

.modal-body {
  padding: 1.5rem;
}

.modal-footer {
  padding: 1rem 1.5rem;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: flex-end;
  gap: 0.75rem;
}

/* Challenge Detail Modal Content */
.challenge-detail-section {
  margin-bottom: 1.5rem;
}

.challenge-detail-section:last-child {
  margin-bottom: 0;
}

.challenge-detail-section h3 {
  font-size: 0.85rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  margin-bottom: 0.75rem;
}

.challenge-detail-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  border-bottom: 1px solid #f5f5f5;
}

.challenge-detail-label {
  color: #666;
  font-size: 0.9rem;
}

.challenge-detail-value {
  color: #333;
  font-weight: 500;
  font-size: 0.9rem;
}

/* Payment Modal */
.payment-summary {
  background: #f8f9fa;
  border-radius: 10px;
  padding: 1rem;
  margin-bottom: 1.5rem;
}

.payment-row {
  display: flex;
  justify-content: space-between;
  padding: 0.5rem 0;
  font-size: 0.9rem;
}

.payment-row.total {
  border-top: 1px solid #ddd;
  margin-top: 0.5rem;
  padding-top: 0.75rem;
  font-weight: 700;
  font-size: 1rem;
}

.payment-methods h4 {
  margin: 0 0 0.75rem 0;
  font-size: 0.9rem;
  color: #666;
}

.payment-option {
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.75rem 1rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  margin-bottom: 0.5rem;
  cursor: pointer;
  transition: all 0.2s;
}

.payment-option:hover {
  border-color: var(--primary-color);
  background: #f5f0ff;
}

.payment-option.selected {
  border-color: var(--primary-color);
  background: #f5f0ff;
}

.payment-icon {
  font-size: 1.25rem;
}

/* My Challenges List */
.my-challenge-item {
  display: flex;
  align-items: center;
  gap: 1rem;
  padding: 1rem;
  border-bottom: 1px solid #f0f0f0;
}

.my-challenge-item:last-child {
  border-bottom: none;
}

.my-challenge-info {
  flex: 1;
}

.my-challenge-title {
  font-weight: 600;
  margin-bottom: 0.25rem;
}

.my-challenge-meta {
  font-size: 0.85rem;
  color: #666;
}

.my-challenge-status {
  padding: 0.25rem 0.75rem;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
}

.my-challenge-status.completed {
  background: #e8f5e9;
  color: #388e3c;
}

.my-challenge-status.in-progress {
  background: #fff3e0;
  color: #f57c00;
}

.my-challenge-status.upcoming {
  background: #e3f2fd;
  color: #1976d2;
}

.my-challenge-status.joined {
  background: #f3e5f5;
  color: #7b1fa2;
}

/* Leaderboard */
.reward-structure {
  margin-bottom: 1.5rem;
}

.reward-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 0.75rem;
}

.reward-item {
  padding: 0.75rem;
  border-radius: 8px;
  text-align: center;
}

.reward-item.rank1 {
  background: #fff8e1;
  border: 1px solid #ffc107;
}

.reward-item.rank2 {
  background: #f5f5f5;
  border: 1px solid #9e9e9e;
}

.reward-item.rank3 {
  background: #efebe9;
  border: 1px solid #8d6e63;
}

.reward-item.rank4 {
  background: #e8f5e9;
  border: 1px solid #4caf50;
}

.reward-item .rank {
  display: block;
  font-size: 0.85rem;
  margin-bottom: 0.25rem;
}

.reward-item .amount {
  display: block;
  font-size: 1.1rem;
  font-weight: 700;
  color: #2e7d32;
}

.leaderboard-table-container {
  overflow-x: auto;
}

.leaderboard-table {
  width: 100%;
  border-collapse: collapse;
}

.leaderboard-table th,
.leaderboard-table td {
  padding: 0.75rem;
  text-align: left;
  border-bottom: 1px solid #f0f0f0;
}

.leaderboard-table th {
  font-size: 0.8rem;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: #666;
  background: #f8f9fa;
}

.leaderboard-table td {
  font-size: 0.9rem;
}

.leaderboard-table .rank-cell {
  font-weight: 700;
  font-size: 1.1rem;
}

.leaderboard-table .rank-1 { color: #f9a825; }
.leaderboard-table .rank-2 { color: #757575; }
.leaderboard-table .rank-3 { color: #8d6e63; }

.leaderboard-table .reward-cell {
  color: #2e7d32;
  font-weight: 600;
}

/* Toast Notification */
.toast {
  position: fixed;
  bottom: 2rem;
  left: 50%;
  transform: translateX(-50%) translateY(100px);
  background: #333;
  color: white;
  padding: 0.75rem 1.5rem;
  border-radius: 8px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  transition: transform 0.3s ease;
  z-index: 1100;
}

.toast.show {
  transform: translateX(-50%) translateY(0);
}

.toast-icon {
  font-size: 1.25rem;
}

/* Responsive */
@media (max-width: 768px) {
  .hero-card {
    flex-direction: column;
    text-align: center;
  }

  .filters-bar {
    flex-direction: column;
    align-items: stretch;
  }

  .filter-group {
    width: 100%;
  }

  .filter-group select {
    flex: 1;
  }

  .search-box {
    margin-left: 0;
    width: 100%;
  }

  .search-box input {
    width: 100%;
  }

  .challenges-grid {
    grid-template-columns: 1fr;
  }

  .subscription-content {
    flex-direction: column;
    text-align: center;
  }

  .reward-grid {
    grid-template-columns: 1fr;
  }

  .challenge-rewards-list {
    grid-template-columns: 1fr;
  }
}