/**
 * Chapter Quiz Styles
 * Comprehensive styling for multi-question chapter quizzes
 */

/* Main Container */
.chapter-quiz {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, Cantarell, sans-serif;
}

/* Header */
.cq-header {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  padding: 30px;
  background: linear-gradient(135deg, #2C3E50 0%, #34495E 100%);
  border-radius: 12px;
  color: white;
  margin-bottom: 30px;
}

.cq-title h2 {
  margin: 0 0 10px 0;
  font-size: 28px;
}

.cq-description {
  margin: 0;
  opacity: 0.9;
  font-size: 14px;
}

.cq-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 20px;
  background: rgba(255, 255, 255, 0.1);
  border-radius: 8px;
  font-size: 20px;
  font-weight: bold;
  min-width: 100px;
  justify-content: center;
}

.cq-timer-warning {
  animation: pulse-timer 1s ease-in-out infinite;
}

@keyframes pulse-timer {
  0%, 100% { transform: scale(1); }
  50% { transform: scale(1.05); }
}

.cq-timer-icon {
  font-size: 24px;
}

/* Progress Bar */
.cq-progress-container {
  margin-bottom: 30px;
}

.cq-progress-bar {
  width: 100%;
  height: 8px;
  background: #ECF0F1;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 8px;
}

.cq-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #16A085 0%, #27AE60 100%);
  transition: width 0.3s ease;
}

.cq-progress-text {
  text-align: center;
  font-size: 14px;
  color: #7F8C8D;
  font-weight: 600;
}

/* Question Container */
.cq-question-container {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  margin-bottom: 30px;
}

.cq-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 20px;
  padding-bottom: 15px;
  border-bottom: 2px solid #ECF0F1;
}

.cq-question-number {
  font-size: 14px;
  font-weight: 600;
  color: #16A085;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cq-flag-button {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  background: transparent;
  border: 2px solid #ECF0F1;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  color: #7F8C8D;
  transition: all 0.2s;
}

.cq-flag-button:hover {
  border-color: #3498DB;
  color: #3498DB;
}

.cq-flag-icon {
  font-size: 16px;
}

.cq-question-text {
  font-size: 18px;
  color: #2C3E50;
  line-height: 1.6;
  margin-bottom: 25px;
}

/* Options */
.cq-options {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cq-option {
  display: flex;
  align-items: center;
  gap: 15px;
  padding: 16px 20px;
  background: #F8F9FA;
  border: 2px solid #ECF0F1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  text-align: left;
  font-size: 16px;
  position: relative;
}

.cq-option:hover {
  border-color: #16A085;
  background: #E8F6F3;
}

.cq-option.cq-selected {
  border-color: #16A085;
  background: #D5F4E6;
}

.cq-option-letter {
  width: 36px;
  height: 36px;
  background: #ECF0F1;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: bold;
  color: #2C3E50;
  flex-shrink: 0;
}

.cq-selected .cq-option-letter {
  background: #16A085;
  color: white;
}

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

.cq-option-check {
  opacity: 0;
  color: #16A085;
  font-size: 20px;
  transition: opacity 0.2s;
}

.cq-selected .cq-option-check {
  opacity: 1;
}

/* Navigation */
.cq-navigation {
  display: flex;
  gap: 15px;
  justify-content: center;
  margin-bottom: 30px;
}

.cq-nav-button {
  padding: 12px 30px;
  background: #2C3E50;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 16px;
  font-weight: 600;
  transition: all 0.2s;
}

.cq-nav-button:hover:not(:disabled) {
  background: #1A252F;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.cq-nav-button:disabled {
  background: #BDC3C7;
  cursor: not-allowed;
  opacity: 0.5;
}

.cq-nav-button.cq-submit {
  background: #27AE60;
}

.cq-nav-button.cq-submit:hover {
  background: #229954;
}

.cq-nav-button.cq-review {
  background: #3498DB;
}

.cq-nav-button.cq-review:hover {
  background: #2874A6;
}

.cq-nav-button.cq-retry {
  background: #E67E22;
}

.cq-nav-button.cq-retry:hover {
  background: #D68910;
}

/* Question Navigator */
.cq-question-navigator {
  background: white;
  border-radius: 12px;
  padding: 20px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
}

.cq-nav-title {
  font-size: 14px;
  font-weight: 600;
  color: #7F8C8D;
  margin-bottom: 15px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cq-nav-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(45px, 1fr));
  gap: 10px;
}

.cq-nav-number {
  width: 45px;
  height: 45px;
  background: #F8F9FA;
  border: 2px solid #ECF0F1;
  border-radius: 8px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: #7F8C8D;
  cursor: pointer;
  transition: all 0.2s;
  font-size: 14px;
}

.cq-nav-number:hover {
  border-color: #16A085;
  background: #E8F6F3;
}

.cq-nav-number.cq-current {
  border-color: #2C3E50;
  background: #2C3E50;
  color: white;
}

.cq-nav-number.cq-answered {
  border-color: #16A085;
  background: #D5F4E6;
  color: #16A085;
}

.cq-nav-number.cq-flagged {
  position: relative;
}

.cq-nav-number.cq-flagged::after {
  content: '🚩';
  position: absolute;
  top: -8px;
  right: -8px;
  font-size: 16px;
}

/* Review Screen */
.cq-review {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cq-review h2 {
  margin: 0 0 10px 0;
  color: #2C3E50;
}

.cq-review p {
  color: #7F8C8D;
  margin-bottom: 30px;
}

.cq-review-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
  gap: 20px;
  margin-bottom: 30px;
  padding: 20px;
  background: #F8F9FA;
  border-radius: 8px;
}

.cq-review-stat {
  text-align: center;
}

.cq-review-stat-value {
  font-size: 36px;
  font-weight: bold;
  color: #16A085;
  margin-bottom: 5px;
}

.cq-review-stat-label {
  font-size: 12px;
  color: #7F8C8D;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cq-review-warning {
  padding: 15px 20px;
  background: #FEF5E7;
  border-left: 4px solid #E67E22;
  border-radius: 4px;
  margin-bottom: 25px;
  color: #A04000;
  display: flex;
  align-items: center;
  gap: 12px;
}

.cq-warning-icon {
  font-size: 24px;
}

.cq-review-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
  margin-bottom: 30px;
}

.cq-review-item {
  padding: 20px;
  background: #F8F9FA;
  border: 2px solid #ECF0F1;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
}

.cq-review-item:hover {
  border-color: #16A085;
  background: #E8F6F3;
}

.cq-review-item.cq-unanswered {
  border-color: #E67E22;
  background: #FEF5E7;
}

.cq-review-item.cq-flagged {
  border-color: #3498DB;
  background: #EBF5FB;
}

.cq-review-item-number {
  font-size: 18px;
  font-weight: bold;
  color: #2C3E50;
  margin-bottom: 8px;
}

.cq-review-item-status {
  font-size: 14px;
  color: #7F8C8D;
}

.cq-review-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
}

/* Results */
.cq-results {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  text-align: center;
}

.cq-results-header {
  padding: 40px;
  border-radius: 12px;
  margin-bottom: 40px;
}

.cq-results-header.cq-passed {
  background: linear-gradient(135deg, #D5F4E6 0%, #A9DFBF 100%);
}

.cq-results-header.cq-failed {
  background: linear-gradient(135deg, #FEF5E7 0%, #FAD7A0 100%);
}

.cq-results-icon {
  font-size: 64px;
  margin-bottom: 20px;
}

.cq-results-header h2 {
  margin: 0 0 10px 0;
  font-size: 32px;
  color: #2C3E50;
}

.cq-results-header p {
  margin: 0;
  font-size: 16px;
  color: #7F8C8D;
}

.cq-results-score {
  margin: 40px 0;
  display: flex;
  justify-content: center;
}

.cq-results-score-circle {
  position: relative;
  width: 200px;
  height: 200px;
}

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

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

.cq-results-percentage {
  font-size: 48px;
  font-weight: bold;
  color: #2C3E50;
}

.cq-results-fraction {
  font-size: 18px;
  color: #7F8C8D;
}

.cq-results-stats {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(120px, 1fr));
  gap: 20px;
  margin-bottom: 40px;
}

.cq-results-stat {
  padding: 20px;
  background: #F8F9FA;
  border-radius: 8px;
}

.cq-results-stat-label {
  font-size: 12px;
  color: #7F8C8D;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  margin-bottom: 8px;
}

.cq-results-stat-value {
  font-size: 24px;
  font-weight: bold;
  color: #2C3E50;
}

.cq-results-actions {
  display: flex;
  gap: 15px;
  justify-content: center;
  flex-wrap: wrap;
}

/* Detailed Review */
.cq-detailed-review {
  background: white;
  border-radius: 12px;
  padding: 30px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.cq-detailed-review h2 {
  margin: 0 0 10px 0;
  color: #2C3E50;
}

.cq-detailed-review p {
  color: #7F8C8D;
  margin-bottom: 30px;
}

.cq-review-questions {
  display: flex;
  flex-direction: column;
  gap: 30px;
  margin-bottom: 30px;
}

.cq-review-question {
  padding: 25px;
  border-radius: 12px;
  border: 2px solid #ECF0F1;
}

.cq-review-question.cq-correct {
  border-color: #27AE60;
  background: #D5F4E6;
}

.cq-review-question.cq-incorrect {
  border-color: #E74C3C;
  background: #FADBD8;
}

.cq-review-question-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 15px;
  padding-bottom: 15px;
  border-bottom: 2px solid rgba(0,0,0,0.1);
}

.cq-review-question-number {
  font-size: 14px;
  font-weight: 600;
  color: #2C3E50;
  text-transform: uppercase;
  letter-spacing: 0.5px;
}

.cq-review-question-result {
  font-size: 14px;
  font-weight: 600;
  padding: 6px 12px;
  border-radius: 6px;
}

.cq-review-question-result.cq-correct {
  background: #27AE60;
  color: white;
}

.cq-review-question-result.cq-incorrect {
  background: #E74C3C;
  color: white;
}

.cq-review-question-text {
  font-size: 16px;
  color: #2C3E50;
  margin-bottom: 20px;
  line-height: 1.6;
}

.cq-review-options {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 15px;
}

.cq-review-option {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px 16px;
  background: white;
  border: 2px solid #ECF0F1;
  border-radius: 8px;
}

.cq-review-option.cq-correct-answer {
  border-color: #27AE60;
  background: #D5F4E6;
}

.cq-review-option.cq-user-answer:not(.cq-correct-answer) {
  border-color: #E74C3C;
  background: #FADBD8;
}

.cq-option-badge {
  margin-left: auto;
  padding: 4px 12px;
  border-radius: 6px;
  font-size: 12px;
  font-weight: 600;
}

.cq-option-badge.cq-right {
  background: #27AE60;
  color: white;
}

.cq-option-badge.cq-wrong {
  background: #E74C3C;
  color: white;
}

.cq-review-explanation {
  padding: 15px;
  background: #FEF9E7;
  border-radius: 8px;
  border-left: 4px solid #F39C12;
  font-size: 14px;
  color: #5D4037;
  line-height: 1.6;
}

/* Max Attempts */
.cq-max-attempts {
  background: white;
  border-radius: 12px;
  padding: 40px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.1);
  text-align: center;
}

.cq-max-attempts-icon {
  font-size: 72px;
  margin-bottom: 20px;
}

.cq-max-attempts h2 {
  margin: 0 0 15px 0;
  color: #2C3E50;
}

.cq-max-attempts p {
  color: #7F8C8D;
  margin-bottom: 30px;
}

/* Responsive Design */
@media (max-width: 768px) {
  .chapter-quiz {
    padding: 10px;
  }

  .cq-header {
    flex-direction: column;
    gap: 20px;
  }

  .cq-timer {
    width: 100%;
  }

  .cq-question-container {
    padding: 20px;
  }

  .cq-navigation {
    flex-direction: column;
  }

  .cq-nav-button {
    width: 100%;
  }

  .cq-nav-grid {
    grid-template-columns: repeat(auto-fill, minmax(40px, 1fr));
    gap: 8px;
  }

  .cq-nav-number {
    width: 40px;
    height: 40px;
  }

  .cq-results-stats,
  .cq-review-stats {
    grid-template-columns: 1fr 1fr;
  }

  .cq-results-actions,
  .cq-review-actions {
    flex-direction: column;
  }

  .cq-results-actions .cq-nav-button,
  .cq-review-actions .cq-nav-button {
    width: 100%;
  }
}

/* Print Styles */
@media print {
  .cq-timer,
  .cq-navigation,
  .cq-question-navigator,
  .cq-flag-button,
  .cq-results-actions,
  .cq-review-actions {
    display: none !important;
  }

  .chapter-quiz {
    max-width: 100%;
  }

  .cq-header {
    background: white;
    color: black;
    border: 1px solid #ECF0F1;
  }
}
