/* Quiz System Styles - Enhanced Mobile-First Design */

.quiz-container {
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
  border: 2px solid #93c5fd;
  border-radius: 12px;
  padding: 24px;
  margin: 32px 0;
  box-shadow: 0 8px 24px rgba(59, 130, 246, 0.15);
  position: relative;
  overflow: hidden;
}

.quiz-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background: linear-gradient(90deg, #3b82f6, #8b5cf6, #ec4899);
}

.quiz-header {
  text-align: center;
  margin-bottom: 24px;
  padding: 20px;
  background: white;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.05);
}

.quiz-header h2 {
  font-size: 24px;
  font-weight: 800;
  color: #1e293b;
  margin: 0 0 8px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
}

.quiz-header p {
  font-size: 15px;
  color: #475569;
  margin: 0;
  line-height: 1.6;
}

.quiz-content {
  background: white;
  border-radius: 10px;
  padding: 24px;
  min-height: 200px;
}

.quiz-progress {
  margin-bottom: 24px;
}

.quiz-progress-bar {
  background: #e0e7ff;
  height: 10px;
  border-radius: 20px;
  overflow: hidden;
  margin-bottom: 12px;
  box-shadow: inset 0 2px 4px rgba(0, 0, 0, 0.1);
}

.quiz-progress-fill {
  background: linear-gradient(90deg, #3b82f6 0%, #8b5cf6 50%, #ec4899 100%);
  height: 100%;
  transition: width 0.4s cubic-bezier(0.4, 0, 0.2, 1);
  border-radius: 20px;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
}

.quiz-progress-text {
  text-align: center;
  font-size: 13px;
  color: #1e293b;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.quiz-question {
  background: #f8fafc;
  padding: 20px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.quiz-question h3 {
  font-size: 18px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 20px 0;
  line-height: 1.6;
  padding-left: 28px;
  position: relative;
}

.quiz-question h3::before {
  content: 'Q';
  position: absolute;
  left: 0;
  top: -2px;
  background: linear-gradient(135deg, #3b82f6, #8b5cf6);
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: 800;
}

.quiz-context {
  background: #fef3c7;
  border-left: 4px solid #f59e0b;
  padding: 12px 16px;
  margin: 0 0 20px 0;
  font-size: 14px;
  color: #78350f;
  border-radius: 6px;
}

.quiz-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.quiz-option {
  display: flex;
  align-items: center;
  padding: 14px 16px;
  border: 2px solid #cbd5e1;
  border-radius: 10px;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: white;
  position: relative;
}

.quiz-option:hover {
  border-color: #3b82f6;
  background: #eff6ff;
  transform: scale(1.02);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.15);
}

.quiz-option:active {
  transform: scale(0.98);
}

.quiz-option.selected {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #e0e7ff 100%);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.2);
}

.quiz-option.selected::after {
  content: '✓';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: #3b82f6;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 14px;
}

/* Immediate Feedback Styles */

.quiz-option-correct {
  border-color: #10b981 !important;
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%) !important;
  animation: correctPulse 0.5s ease;
}

.quiz-option-correct::after {
  content: '✓';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: #10b981;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 18px;
  animation: scaleIn 0.3s ease;
}

.quiz-option-incorrect {
  border-color: #ef4444 !important;
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%) !important;
  animation: incorrectShake 0.5s ease;
}

.quiz-option-incorrect::after {
  content: '×';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: #ef4444;
  color: white;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 20px;
  animation: scaleIn 0.3s ease;
}

.quiz-option-correct-reveal {
  border-color: #10b981 !important;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%) !important;
  animation: fadeIn 0.5s ease;
}

.quiz-option-correct-reveal::after {
  content: '✓';
  position: absolute;
  right: 16px;
  top: 50%;
  transform: translateY(-50%);
  background: #10b981;
  color: white;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
  opacity: 0.8;
}

@keyframes correctPulse {
  0% { transform: scale(1); }
  50% { transform: scale(1.03); }
  100% { transform: scale(1); }
}

@keyframes incorrectShake {
  0%, 100% { transform: translateX(0); }
  25% { transform: translateX(-10px); }
  75% { transform: translateX(10px); }
}

@keyframes fadeIn {
  from { opacity: 0; }
  to { opacity: 1; }
}

/* Feedback Box Styles */

.quiz-feedback {
  margin-top: 24px;
  padding: 20px;
  border-radius: 10px;
  display: flex;
  align-items: flex-start;
  gap: 16px;
  animation: slideDown 0.3s ease;
}

.quiz-feedback-correct {
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border: 2px solid #10b981;
}

.quiz-feedback-incorrect {
  background: linear-gradient(135deg, #fee2e2 0%, #fecaca 100%);
  border: 2px solid #ef4444;
}

.quiz-feedback-icon {
  flex-shrink: 0;
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 24px;
  font-weight: 700;
  color: white;
}

.quiz-feedback-correct .quiz-feedback-icon {
  background: #10b981;
}

.quiz-feedback-incorrect .quiz-feedback-icon {
  background: #ef4444;
}

.quiz-feedback-content {
  flex: 1;
}

.quiz-feedback-title {
  font-size: 18px;
  font-weight: 700;
  margin-bottom: 8px;
}

.quiz-feedback-correct .quiz-feedback-title {
  color: #065f46;
}

.quiz-feedback-incorrect .quiz-feedback-title {
  color: #991b1b;
}

.quiz-feedback-explanation {
  font-size: 15px;
  line-height: 1.6;
  color: #374151;
}

/* Explanation Box (in footer) */

.quiz-explanation-box {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 20px;
  margin-top: 20px;
  font-size: 15px;
  line-height: 1.7;
  color: #475569;
  animation: slideDown 0.3s ease;
}

.quiz-explanation-box::before {
  content: '💡 Explanation';
  display: block;
  font-weight: 700;
  color: #1e293b;
  margin-bottom: 12px;
  font-size: 16px;
}

.quiz-option input[type="radio"] {
  margin: 0 12px 0 0;
  width: 20px;
  height: 20px;
  cursor: pointer;
  accent-color: #3b82f6;
}

.quiz-option-text {
  flex: 1;
  font-size: 16px;
  color: #1e293b;
  line-height: 1.5;
}

.quiz-footer {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  margin-top: 24px;
}

.quiz-btn {
  padding: 14px 28px;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 700;
  cursor: pointer;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  border: none;
  text-decoration: none;
  display: inline-block;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
  min-width: 120px;
}

.quiz-btn:active {
  transform: scale(0.95);
}

.quiz-btn-primary {
  background: linear-gradient(135deg, #3b82f6 0%, #8b5cf6 100%);
  color: white;
}

.quiz-btn-primary:hover {
  box-shadow: 0 6px 20px rgba(59, 130, 246, 0.4);
  transform: translateY(-2px);
}

.quiz-btn-secondary {
  background: white;
  color: #475569;
  border: 2px solid #cbd5e1;
  box-shadow: none;
}

.quiz-btn-secondary:hover {
  background: #f8fafc;
  border-color: #3b82f6;
  color: #3b82f6;
}

.quiz-btn-success {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
}

.quiz-btn-success:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
  transform: translateY(-2px);
}

/* Results Page */

.quiz-results {
  text-align: center;
}

.quiz-results-icon {
  font-size: 80px;
  margin-bottom: 16px;
  animation: scaleIn 0.5s ease;
}

@keyframes scaleIn {
  from {
    transform: scale(0);
    opacity: 0;
  }
  to {
    transform: scale(1);
    opacity: 1;
  }
}

.quiz-results h2 {
  font-size: 32px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 24px 0;
}

.quiz-score-circle {
  position: relative;
  width: 200px;
  height: 200px;
  margin: 0 auto 24px;
}

.quiz-score-circle svg {
  width: 100%;
  height: 100%;
  transform: rotate(-90deg);
}

.quiz-score-text {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  text-align: center;
}

.quiz-score-percentage {
  font-size: 48px;
  font-weight: 700;
  color: #3b82f6;
  display: block;
  line-height: 1;
}

.quiz-score-details {
  font-size: 14px;
  color: #64748b;
  margin-top: 8px;
}

.quiz-results-message {
  font-size: 18px;
  color: #475569;
  line-height: 1.7;
  max-width: 600px;
  margin: 0 auto 40px;
}

/* Name Input & Sharing */

.quiz-name-input-container {
  background: #f8fafc;
  border: 2px solid #e2e8f0;
  border-radius: 10px;
  padding: 24px;
  margin: 32px 0;
}

.quiz-name-input-container h3 {
  font-size: 20px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 8px 0;
}

.quiz-name-input-container p {
  font-size: 14px;
  color: #64748b;
  margin: 0 0 16px 0;
}

.quiz-name-input {
  width: 100%;
  max-width: 400px;
  padding: 12px 16px;
  font-size: 16px;
  border: 2px solid #cbd5e1;
  border-radius: 6px;
  margin-bottom: 12px;
  font-family: inherit;
}

.quiz-name-input:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.quiz-share-result {
  margin-top: 24px;
  padding: 20px;
  background: white;
  border: 2px solid #10b981;
  border-radius: 8px;
}

.quiz-share-success {
  color: #10b981;
  font-weight: 600;
  margin-bottom: 12px;
  font-size: 16px;
}

.quiz-share-url {
  width: 100%;
  padding: 12px;
  font-family: 'Courier New', monospace;
  font-size: 14px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  margin-bottom: 12px;
  background: #f8fafc;
}

.quiz-share-actions {
  display: flex;
  gap: 8px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Social share buttons */
.quiz-social-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  border-width: 2px;
  font-weight: 500;
  letter-spacing: -0.01em;
  padding-left: 10px;
  padding-right: 12px;
  line-height: 1.4;
}

/* Icon enhancement - targets first character (emoji) */
.quiz-social-btn::first-letter {
  font-size: 1.2em;
  font-weight: 600;
  margin-right: -1px;
  display: inline-block;
  transform: translateX(-0.33px);
}

.quiz-social-x { border-color: #1D9BF0; color: #0f172a; }
.quiz-social-linkedin { border-color: #0A66C2; color: #0f172a; }
.quiz-social-facebook { border-color: #1877F2; color: #0f172a; }
.quiz-social-reddit { border-color: #FF4500; color: #0f172a; }
.quiz-social-whatsapp { border-color: #25D366; color: #0f172a; }
.quiz-social-telegram { border-color: #229ED9; color: #0f172a; }
.quiz-social-hn { border-color: #FF6600; color: #0f172a; }

.quiz-social-btn:hover {
  transform: translateY(-1px);
}

/* Review Section */

.quiz-review-section {
  margin-top: 48px;
  text-align: left;
}

.quiz-review-section h3 {
  font-size: 24px;
  font-weight: 600;
  color: #1e293b;
  margin: 0 0 24px 0;
  text-align: center;
}

.quiz-review-list {
  display: flex;
  flex-direction: column;
  gap: 16px;
}

.quiz-review-item {
  border: 2px solid #e2e8f0;
  border-radius: 8px;
  padding: 16px;
  transition: all 0.2s;
}

.quiz-review-item.correct {
  border-color: #10b981;
  background: #f0fdf4;
}

.quiz-review-item.incorrect {
  border-color: #ef4444;
  background: #fef2f2;
}

.quiz-review-header {
  display: flex;
  align-items: flex-start;
  gap: 12px;
}

.quiz-review-icon {
  flex-shrink: 0;
  width: 24px;
  height: 24px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 16px;
}

.quiz-review-item.correct .quiz-review-icon {
  background: #10b981;
  color: white;
}

.quiz-review-item.incorrect .quiz-review-icon {
  background: #ef4444;
  color: white;
}

.quiz-review-question {
  flex: 1;
  font-weight: 600;
  color: #1e293b;
  line-height: 1.5;
}

.quiz-review-details {
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.quiz-review-your-answer {
  color: #ef4444;
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: 600;
}

.quiz-review-correct-answer {
  color: #10b981;
  font-size: 14px;
  margin-bottom: 8px;
  font-weight: 600;
}

.quiz-review-explanation {
  background: white;
  padding: 12px;
  border-radius: 6px;
  font-size: 14px;
  color: #475569;
  line-height: 1.6;
  margin-top: 8px;
}

/* Shared Result Banner */

.quiz-shared-banner {
  background: linear-gradient(135deg, #dbeafe 0%, #e0e7ff 100%);
  border: 2px solid #93c5fd;
  border-radius: 10px;
  padding: 32px;
  margin: 0 0 32px 0;
  position: relative;
  box-shadow: 0 4px 20px rgba(59, 130, 246, 0.15);
  animation: slideDown 0.5s ease;
}

@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.quiz-shared-content {
  display: flex;
  gap: 24px;
  align-items: center;
}

.quiz-shared-icon {
  font-size: 64px;
  flex-shrink: 0;
}

.quiz-shared-text h2 {
  font-size: 24px;
  font-weight: 700;
  color: #1e293b;
  margin: 0 0 12px 0;
}

.quiz-shared-score {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 12px;
}

.quiz-shared-percentage {
  font-size: 32px;
  font-weight: 700;
  color: #3b82f6;
}

.quiz-shared-details {
  font-size: 16px;
  color: #64748b;
}

.quiz-shared-message {
  font-size: 16px;
  color: #475569;
  line-height: 1.6;
  margin: 0 0 12px 0;
}

.quiz-shared-challenge {
  font-size: 16px;
  color: #1e293b;
  font-weight: 600;
  margin: 0;
}

.quiz-shared-close {
  position: absolute;
  top: 16px;
  right: 16px;
  background: white;
  border: none;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 24px;
  line-height: 1;
  cursor: pointer;
  color: #64748b;
  transition: all 0.2s;
}

.quiz-shared-close:hover {
  background: #f1f5f9;
  color: #1e293b;
  transform: rotate(90deg);
}

/* Toast Notification */

.quiz-toast {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: #1e293b;
  color: white;
  padding: 16px 24px;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  font-size: 14px;
  font-weight: 600;
  z-index: 10000;
  opacity: 0;
  transform: translateY(20px);
  transition: all 0.3s ease;
}

.quiz-toast.show {
  opacity: 1;
  transform: translateY(0);
}

/* Responsive Design */

/* Enhanced Mobile Responsiveness */

@media (max-width: 768px) {
  .quiz-container {
    padding: 16px;
    margin: 20px 0;
    border-radius: 10px;
  }

  .quiz-header {
    padding: 16px;
    gap: 8px;
  }

  .quiz-header h2 {
    font-size: 20px;
    flex-direction: column;
    gap: 4px;
  }

  .quiz-header p {
    font-size: 14px;
  }

  .quiz-content {
    padding: 16px;
  }

  .quiz-question {
    padding: 16px;
  }

  .quiz-question h3 {
    font-size: 16px;
    padding-left: 32px;
  }

  .quiz-question h3::before {
    width: 26px;
    height: 26px;
    font-size: 13px;
  }

  .quiz-option {
    padding: 12px 14px;
    padding-right: 52px;
  }

  .quiz-option input[type="radio"] {
    width: 18px;
    height: 18px;
  }

  .quiz-option-text {
    font-size: 14px;
    line-height: 1.5;
    word-break: break-word;
  }

  /* Mobile icon adjustments for correct/incorrect states */
  .quiz-option-correct::after,
  .quiz-option-incorrect::after {
    width: 24px;
    height: 24px;
    font-size: 16px;
    right: 14px;
  }

  .quiz-option-correct-reveal::after {
    width: 22px;
    height: 22px;
    font-size: 14px;
    right: 14px;
  }

  .quiz-feedback {
    padding: 16px;
    gap: 12px;
    flex-direction: column;
    align-items: stretch;
  }

  .quiz-feedback-icon {
    width: 32px;
    height: 32px;
    font-size: 20px;
    margin-bottom: 4px;
  }

  .quiz-option.selected::after {
    width: 22px;
    height: 22px;
    right: 12px;
    font-size: 12px;
  }

  .quiz-btn {
    padding: 12px 20px;
    font-size: 14px;
    min-width: 100px;
  }

  .quiz-footer {
    flex-direction: column;
    gap: 10px;
  }

  .quiz-footer .quiz-btn {
    width: 100%;
  }

  .quiz-results h2 {
    font-size: 22px;
  }

  .quiz-score-circle {
    width: 160px;
    height: 160px;
  }

  .quiz-score-percentage {
    font-size: 40px;
  }

  .quiz-results-message {
    font-size: 15px;
  }

  .quiz-name-input-container {
    padding: 20px 16px;
  }

  .quiz-name-input {
    font-size: 16px; /* Prevents zoom on iOS */
  }

  .quiz-shared-content {
    flex-direction: column;
    text-align: center;
    gap: 16px;
  }

  .quiz-shared-icon {
    font-size: 48px;
  }

  .quiz-shared-text h2 {
    font-size: 18px;
  }

  .quiz-shared-score {
    justify-content: center;
    flex-wrap: wrap;
  }

  .quiz-shared-percentage {
    font-size: 28px;
  }

  .quiz-shared-details {
    font-size: 14px;
  }

  .quiz-share-actions {
    flex-direction: column;
  }

  .quiz-share-actions .quiz-btn {
    width: 100%;
  }

  .quiz-review-item {
    padding: 12px;
  }

  .quiz-toast {
    right: 16px;
    left: 16px;
    bottom: 16px;
  }

  .quiz-feedback {
    padding: 16px;
    gap: 12px;
  }

  .quiz-feedback-icon {
    width: 32px;
    height: 32px;
    font-size: 20px;
  }

  .quiz-feedback-title {
    font-size: 16px;
  }

  .quiz-feedback-explanation {
    font-size: 14px;
  }

  .quiz-explanation-box {
    padding: 16px;
    font-size: 14px;
    margin-top: 16px;
  }

  .quiz-explanation-box::before {
    font-size: 15px;
    margin-bottom: 10px;
  }
}

/* Extra small devices */
@media (max-width: 480px) {
  .quiz-container {
    border-radius: 8px;
  }

  .quiz-header h2 {
    font-size: 18px;
  }

  .quiz-header p {
    font-size: 13px;
  }

  .quiz-question h3 {
    font-size: 15px;
  }

  .quiz-option {
    padding: 10px 12px;
    padding-right: 48px;
  }

  .quiz-option-text {
    font-size: 13px;
    line-height: 1.5;
    word-break: break-word;
  }

  /* Extra small mobile icon adjustments */
  .quiz-option-correct::after,
  .quiz-option-incorrect::after {
    width: 22px;
    height: 22px;
    font-size: 14px;
    right: 12px;
  }

  .quiz-option-correct-reveal::after {
    width: 20px;
    height: 20px;
    font-size: 12px;
    right: 12px;
  }

  .quiz-feedback {
    padding: 14px;
  }

  .quiz-feedback-explanation {
    font-size: 13px;
  }

  .quiz-progress-text {
    font-size: 11px;
  }
}
