/* Quiz Page Styles */

/* Quiz Cards */
.quiz-card {
  transition: all 0.3s ease;
  overflow: hidden;
  position: relative;
  border-radius: 1rem;
  height: 100%;
  display: flex;
  flex-direction: column;
}

.quiz-card:hover {
  transform: translateY(-8px);
  box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.1),
    0 10px 10px -5px rgba(0, 0, 0, 0.04);
}

.quiz-card .image-container {
  position: relative;
  overflow: hidden;
  height: 200px;
}

.quiz-card .image-container img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  transition: transform 0.5s ease;
}

.quiz-card:hover .image-container img {
  transform: scale(1.1);
}

.quiz-card .category-badge {
  position: absolute;
  top: 12px;
  right: 12px;
  z-index: 10;
  padding: 4px 10px;
  border-radius: 9999px;
  font-size: 0.75rem;
  font-weight: 600;
  transition: all 0.3s ease;
}

.quiz-card:hover .category-badge {
  transform: translateY(-2px);
}

.quiz-card .quiz-info {
  padding: 1.5rem;
  flex: 1;
  display: flex;
  flex-direction: column;
}

.quiz-card .quiz-info h3 {
  margin-bottom: 0.5rem;
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  line-height: 1.4;
  transition: color 0.3s ease;
}

.quiz-card:hover .quiz-info h3 {
  color: #ea580c;
}

.quiz-card .info-row {
  display: flex;
  align-items: center;
  font-size: 0.875rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

.quiz-card .info-row i {
  margin-right: 0.5rem;
  min-width: 1rem;
  text-align: center;
}

.quiz-card .quiz-footer {
  border-top: 1px solid #e5e7eb;
  padding-top: 1rem;
  margin-top: auto;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.quiz-card .quiz-footer .attempts {
  font-size: 0.875rem;
  color: #6b7280;
}

.quiz-card .quiz-footer .start-btn {
  padding: 0.5rem 1rem;
  background-color: #ea580c;
  color: white;
  border-radius: 9999px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.quiz-card .quiz-footer .start-btn:hover {
  background-color: #c2410c;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

/* Quiz Details Page Styles */
.quiz-details {
  display: flex;
  flex-direction: column;
  width: 100%;
  padding: 1.5rem;
  background: white;
  border-radius: 0.5rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
  margin-bottom: 2rem;
}

.quiz-details-header {
  margin-bottom: 1.5rem;
  text-align: center;
}

.quiz-details-header h1 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
  line-height: 1.2;
}

.quiz-details-header .category {
  display: inline-block;
  padding: 0.25rem 0.75rem;
  border-radius: 9999px;
  font-size: 0.875rem;
  font-weight: 600;
  margin-bottom: 1rem;
}

.quiz-details-description {
  margin-bottom: 1.5rem;
  text-align: center;
  max-width: 800px;
  margin-left: auto;
  margin-right: auto;
}

.quiz-details-meta {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 1rem;
  margin-bottom: 1.5rem;
}

.meta-item {
  background: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
  transition: all 0.3s ease;
}

.meta-item:hover {
  transform: translateY(-5px);
  box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.1);
}

.meta-item .value {
  font-size: 1.8rem;
  font-weight: 700;
  color: #f97316;
  margin-bottom: 0.5rem;
}

.meta-item .label {
  color: #6b7280;
  font-size: 0.875rem;
}

.quiz-action {
  display: flex;
  flex-direction: column;
  align-items: center;
  margin-top: 1.5rem;
}

.start-quiz-btn {
  background: linear-gradient(to right, #f97316, #fb923c);
  color: white;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  transition: all 0.3s ease;
  box-shadow: 0 4px 6px -1px rgba(249, 115, 22, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  border: none;
  cursor: pointer;
}

.start-quiz-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 10px 15px -3px rgba(249, 115, 22, 0.3);
}

.start-quiz-btn:disabled {
  background: linear-gradient(to right, #9ca3af, #6b7280);
  cursor: not-allowed;
  opacity: 0.7;
}

.quiz-action .text-sm {
  margin-top: 1rem;
  text-align: center;
  color: #6b7280;
  font-size: 0.875rem;
}

.bg-yellow-100 {
  background: linear-gradient(
    to right,
    rgba(255, 236, 179, 0.5),
    rgba(255, 249, 219, 0.5)
  ) !important;
  border-left: 4px solid #f59e0b !important;
  border-radius: 0.75rem !important;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06) !important;
}

/* Quiz Taking Interface */
.quiz-interface {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.quiz-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 2rem;
  padding-bottom: 1rem;
  border-bottom: 1px solid #e5e7eb;
}

.question-counter {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
}

.quiz-timer {
  background-color: #f3f4f6;
  padding: 0.5rem 1rem;
  border-radius: 9999px;
  display: flex;
  align-items: center;
  gap: 0.5rem;
}

.quiz-timer i {
  color: #ea580c;
}

.quiz-timer.warning {
  background-color: #fef3c7;
  color: #92400e;
}

.quiz-timer.danger {
  background-color: #fee2e2;
  color: #b91c1c;
  animation: pulse 1s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.7;
  }
}

.question {
  margin-bottom: 2rem;
}

.question-text {
  font-size: 1.25rem;
  font-weight: 600;
  color: #1f2937;
  margin-bottom: 1.5rem;
  line-height: 1.5;
}

.options-list {
  display: flex;
  flex-direction: column;
  gap: 1rem;
}

.option {
  padding: 1rem;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
}

.option:hover {
  border-color: #ea580c;
  background-color: #fff8f6;
}

.option.selected {
  border-color: #ea580c;
  background-color: #fff8f6;
}

.option input[type="radio"] {
  margin-right: 1rem;
  width: 1.25rem;
  height: 1.25rem;
  accent-color: #ea580c;
}

.option .option-text {
  flex: 1;
}

.option.correct {
  border-color: #10b981;
  background-color: #ecfdf5;
}

.option.incorrect {
  border-color: #ef4444;
  background-color: #fef2f2;
}

.option .indicator {
  margin-left: 1rem;
  display: none;
}

.option.correct .indicator.correct,
.option.incorrect .indicator.incorrect {
  display: block;
}

.quiz-navigation {
  margin-top: 2rem;
  display: flex;
  justify-content: space-between;
}

.quiz-navigation button {
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.quiz-navigation .prev-btn {
  background-color: #f3f4f6;
  color: #4b5563;
}

.quiz-navigation .prev-btn:hover {
  background-color: #e5e7eb;
}

.quiz-navigation .next-btn,
.quiz-navigation .submit-btn {
  background-color: #ea580c;
  color: white;
}

.quiz-navigation .next-btn:hover,
.quiz-navigation .submit-btn:hover {
  background-color: #c2410c;
}

.quiz-navigation button:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* Question Progress Bar */
.question-progress {
  margin-bottom: 2rem;
}

.progress-bar {
  height: 0.5rem;
  background-color: #e5e7eb;
  border-radius: 9999px;
  overflow: hidden;
}

.progress-bar .progress {
  height: 100%;
  background-color: #ea580c;
  transition: width 0.3s ease;
}

/* Quiz Results */
.quiz-results {
  max-width: 800px;
  margin: 0 auto;
  padding: 2rem;
  background-color: white;
  border-radius: 1rem;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.results-header {
  text-align: center;
  margin-bottom: 2rem;
}

.results-header .title {
  font-size: 2rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 0.5rem;
}

.results-header .subtitle {
  color: #6b7280;
}

.results-summary {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 1rem;
  margin-bottom: 2rem;
}

.results-summary .summary-item {
  background-color: #f9fafb;
  padding: 1rem;
  border-radius: 0.5rem;
  text-align: center;
}

.results-summary .summary-item .value {
  font-size: 1.5rem;
  font-weight: 700;
  margin-bottom: 0.25rem;
}

.results-summary .summary-item.score .value {
  color: #ea580c;
}

.results-summary .summary-item.correct .value {
  color: #10b981;
}

.results-summary .summary-item.incorrect .value {
  color: #ef4444;
}

.results-summary .summary-item.time .value {
  color: #3b82f6;
}

.results-summary .summary-item .label {
  font-size: 0.875rem;
  color: #6b7280;
}

.result-message {
  text-align: center;
  margin-bottom: 2rem;
  padding: 1.5rem;
  border-radius: 0.5rem;
}

.result-message.pass {
  background-color: #ecfdf5;
  color: #065f46;
  border: 1px solid #10b981;
}

.result-message.fail {
  background-color: #fef2f2;
  color: #991b1b;
  border: 1px solid #ef4444;
}

.result-message .icon {
  font-size: 2.5rem;
  margin-bottom: 0.5rem;
}

.result-message .message-title {
  font-size: 1.25rem;
  font-weight: 700;
  margin-bottom: 0.5rem;
}

.certificate-container {
  text-align: center;
  margin-top: 2rem;
  padding: 1.5rem;
  background-color: #f3f4f6;
  border-radius: 0.5rem;
}

.certificate-container .title {
  font-size: 1.25rem;
  font-weight: 700;
  color: #1f2937;
  margin-bottom: 1rem;
}

.certificate-info {
  margin-bottom: 1.5rem;
}

.certificate-info .info-item {
  margin-bottom: 0.5rem;
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 0.5rem;
}

.certificate-info .info-item i {
  color: #ea580c;
}

.download-certificate-btn {
  padding: 0.75rem 1.5rem;
  background-color: #ea580c;
  color: white;
  border-radius: 9999px;
  font-weight: 600;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  gap: 0.5rem;
}

.download-certificate-btn:hover {
  background-color: #c2410c;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 1rem;
  margin-top: 2rem;
}

.results-actions button,
.results-actions a {
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  font-weight: 600;
  transition: all 0.3s ease;
}

.retry-quiz-btn {
  background-color: #ea580c;
  color: white;
}

.retry-quiz-btn:hover {
  background-color: #c2410c;
  transform: translateY(-2px);
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1),
    0 2px 4px -1px rgba(0, 0, 0, 0.06);
}

.back-to-quizzes-btn {
  background-color: #f3f4f6;
  color: #4b5563;
}

.back-to-quizzes-btn:hover {
  background-color: #e5e7eb;
  transform: translateY(-2px);
}

/* Responsive fixes for mobile devices */
@media (max-width: 640px) {
  .quiz-details-header h1 {
    font-size: 1.5rem;
  }

  .quiz-details-meta {
    grid-template-columns: repeat(2, 1fr);
  }

  .meta-item .value {
    font-size: 1.5rem;
  }

  .meta-item .label {
    font-size: 0.75rem;
  }

  .start-quiz-btn {
    width: 100%;
    max-width: 250px;
  }

  #view-previous-attempts {
    width: 100%;
    max-width: 250px;
    justify-content: center;
  }
}

/* Ensure previous attempts button is responsive */
#view-previous-attempts {
  background-color: #e5e7eb;
  color: #4b5563;
  font-weight: 600;
  padding: 0.75rem 1.5rem;
  border-radius: 9999px;
  margin-top: 1rem;
  transition: all 0.3s ease;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border: none;
  cursor: pointer;
}

#view-previous-attempts:hover {
  background-color: #d1d5db;
  transform: translateY(-2px);
}

/* Responsive modal for smaller screens */
@media (max-width: 640px) {
  #previous-attempts-modal .bg-white {
    margin: 0.5rem;
    max-height: 85vh;
  }

  #previous-attempts-content table {
    display: block;
    width: 100%;
    overflow-x: auto;
  }

  #previous-attempts-content th,
  #previous-attempts-content td {
    white-space: nowrap;
    padding: 0.5rem;
  }
}
