/**
 * Quiz Player Styles
 * Dedicated CSS for the new quiz system
 * @version 1.0
 */

/* ==========================================
   QUIZ INSTRUCTIONS PAGE
   ========================================== */

.quiz-instructions {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.quiz-header-banner {
  background: linear-gradient(135deg, #e91e63, #f48fb1);
  color: white;
  padding: 40px;
  border-radius: 16px;
  margin-bottom: 32px;
  text-align: center;
}

.quiz-header-banner h1 {
  margin: 0 0 8px 0;
  font-size: 2rem;
}

.quiz-header-banner p {
  margin: 0;
  opacity: 0.9;
  font-size: 1.1rem;
}

.quiz-info-box {
  background: #fce4ec;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.quiz-info-box h3 {
  margin-top: 0;
  color: #c2185b;
}

.quiz-info-box ul {
  margin: 8px 0;
  padding-left: 24px;
}

.quiz-info-box li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.quiz-rules-box {
  background: #fff3e0;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 32px;
}

.quiz-rules-box h3 {
  margin-top: 0;
  color: #f57c00;
}

.quiz-rules-box ul {
  margin: 8px 0;
  padding-left: 24px;
}

.quiz-start-actions {
  text-align: center;
  padding: 20px;
}

/* ==========================================
   QUIZ PLAYER LAYOUT
   ========================================== */

.quiz-player {
  max-width: 1000px;
  margin: 0 auto;
  padding: 20px;
}

/* Header Bar with Timer and Progress */
.quiz-header-bar {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: linear-gradient(135deg, #e91e63, #f48fb1);
  color: white;
  padding: 16px 24px;
  border-radius: 12px;
  margin-bottom: 24px;
  position: sticky;
  top: 0;
  z-index: 100;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
}

.quiz-timer {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 1.5rem;
  font-weight: 700;
  transition: all 0.3s;
}

.quiz-timer .timer-icon {
  font-size: 1.3rem;
}

.quiz-timer.timer-warning {
  color: #ff9800;
  animation: pulse-warning 2s infinite;
}

.quiz-timer.timer-critical {
  color: #f44336;
  animation: pulse-critical 1s infinite;
}

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

@keyframes pulse-critical {
  0%, 100% { opacity: 1; transform: scale(1); }
  50% { opacity: 0.7; transform: scale(1.1); }
}

.quiz-progress-info {
  display: flex;
  align-items: center;
  gap: 12px;
  font-size: 1rem;
}

.separator {
  opacity: 0.6;
}

/* Question Palette */
.quiz-palette {
  background: white;
  padding: 16px;
  border-radius: 12px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.palette-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 12px;
  padding-bottom: 8px;
  border-bottom: 2px solid #e0e0e0;
}

.palette-header span {
  font-weight: 600;
  color: #424242;
}

.btn-icon {
  background: transparent;
  border: none;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 8px;
  transition: transform 0.2s;
}

.btn-icon:hover {
  transform: scale(1.1);
}

.palette-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(50px, 1fr));
  gap: 8px;
  transition: all 0.3s;
}

.palette-grid.collapsed {
  display: none;
}

.palette-item {
  padding: 10px;
  border: 2px solid #e0e0e0;
  background: white;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  font-weight: 500;
  text-align: center;
}

.palette-item:hover {
  border-color: #e91e63;
  transform: translateY(-2px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}

.palette-item.current {
  border-color: #e91e63;
  background: #e91e63;
  color: white;
  font-weight: 700;
}

.palette-item.answered {
  background: #10b981;
  color: white;
  border-color: #10b981;
}

.palette-item.answered.current {
  background: #e91e63;
  border-color: #e91e63;
}

.palette-item.essay {
  border-style: dashed;
}

/* Question Container */
.quiz-content-wrapper {
  background: white;
  border-radius: 12px;
  padding: 32px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
  margin-bottom: 24px;
}

.question-container {
  margin-bottom: 32px;
}

.question-badge {
  display: flex;
  gap: 8px;
  margin-bottom: 12px;
}

.badge-mcq,
.badge-essay,
.badge-type {
  display: inline-block;
  padding: 4px 12px;
  border-radius: 20px;
  font-size: 0.85rem;
  font-weight: 600;
}

.badge-mcq {
  background: #e3f2fd;
  color: #1976d2;
}

.badge-essay {
  background: #f3e5f5;
  color: #7b1fa2;
}

.badge-type {
  background: #fff3e0;
  color: #f57c00;
}

.question-number {
  font-size: 0.9rem;
  color: #757575;
  margin-bottom: 12px;
  font-weight: 500;
}

.question-text {
  font-size: 1.2rem;
  font-weight: 500;
  margin-bottom: 24px;
  line-height: 1.6;
  color: #212121;
}

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

.option-label {
  display: flex;
  align-items: center;
  padding: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s;
  background: white;
}

.option-label:hover {
  border-color: #e91e63;
  background: #fce4ec;
  transform: translateX(4px);
}

.option-label.selected {
  border-color: #e91e63;
  background: #fce4ec;
}

.option-label input[type="radio"] {
  display: none;
}

.option-marker {
  width: 20px;
  height: 20px;
  border: 2px solid #bdbdbd;
  border-radius: 50%;
  flex-shrink: 0;
  margin-right: 12px;
  position: relative;
  transition: all 0.2s;
}

.option-label.selected .option-marker {
  border-color: #e91e63;
  background: #e91e63;
}

.option-label.selected .option-marker::after {
  content: '';
  position: absolute;
  width: 8px;
  height: 8px;
  background: white;
  border-radius: 50%;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
}

.option-text {
  flex: 1;
  font-size: 1rem;
  line-height: 1.5;
}

.option-text strong {
  color: #e91e63;
  margin-right: 8px;
}

/* Essay Question */
.essay-requirements {
  margin-bottom: 16px;
  padding: 12px;
  background: #e8f5e9;
  border-radius: 6px;
}

.essay-requirements small {
  color: #2e7d32;
  font-weight: 500;
}

.essay-textarea {
  width: 100%;
  padding: 16px;
  border: 2px solid #e0e0e0;
  border-radius: 8px;
  font-size: 1rem;
  font-family: inherit;
  line-height: 1.6;
  resize: vertical;
  transition: border-color 0.2s;
}

.essay-textarea:focus {
  outline: none;
  border-color: #e91e63;
}

.essay-footer {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 12px;
}

.word-counter {
  font-size: 0.9rem;
  color: #757575;
}

#word-count {
  font-weight: 700;
  font-size: 1.1rem;
}

#word-count.word-count-low {
  color: #f44336;
}

#word-count.word-count-ok {
  color: #4caf50;
}

#word-count.word-count-high {
  color: #ff9800;
}

.auto-save-indicator {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  color: #757575;
  opacity: 0.6;
  transition: opacity 0.3s;
}

.auto-save-indicator.saved {
  opacity: 1;
  color: #4caf50;
}

.save-icon {
  font-size: 1rem;
}

/* Navigation */
.quiz-navigation {
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 16px;
  margin-top: 32px;
  padding-top: 24px;
  border-top: 1px solid #e0e0e0;
}

.nav-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

/* Buttons */
.btn {
  padding: 12px 24px;
  border: none;
  border-radius: 8px;
  font-size: 1rem;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s;
  display: inline-flex;
  align-items: center;
  gap: 8px;
}

.btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.btn:active:not(:disabled) {
  transform: translateY(0);
}

.btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.btn-primary {
  background: #e91e63;
  color: white;
}

.btn-primary:hover:not(:disabled) {
  background: #c2185b;
}

.btn-secondary {
  background: #757575;
  color: white;
}

.btn-secondary:hover:not(:disabled) {
  background: #616161;
}

.btn-success {
  background: #4caf50;
  color: white;
  font-size: 1.1rem;
  padding: 14px 32px;
}

.btn-success:hover:not(:disabled) {
  background: #388e3c;
}

.btn-outline {
  background: white;
  color: #e91e63;
  border: 2px solid #e91e63;
}

.btn-outline:hover:not(:disabled) {
  background: #fce4ec;
}

.btn-large {
  padding: 16px 48px;
  font-size: 1.2rem;
}

/* Results Page */
.quiz-results {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
}

.results-header {
  text-align: center;
  padding: 40px;
  border-radius: 16px;
  margin-bottom: 32px;
}

.results-header.passed {
  background: linear-gradient(135deg, #4caf50, #81c784);
  color: white;
}

.results-header.failed {
  background: linear-gradient(135deg, #ff9800, #ffb74d);
  color: white;
}

.result-icon {
  font-size: 4rem;
  margin-bottom: 16px;
}

.results-header h2 {
  margin: 0;
  font-size: 2rem;
}

.score-summary {
  background: white;
  border-radius: 12px;
  padding: 32px;
  margin-bottom: 24px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.08);
}

.total-score {
  text-align: center;
  padding: 32px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.total-score.score-passed {
  background: linear-gradient(135deg, #e8f5e9, #c8e6c9);
}

.total-score.score-failed {
  background: linear-gradient(135deg, #fff3e0, #ffe0b2);
}

.score-label {
  font-size: 1rem;
  color: #757575;
  margin-bottom: 8px;
}

.score-value {
  font-size: 4rem;
  font-weight: 700;
  color: #212121;
  margin-bottom: 8px;
}

.score-value span {
  font-size: 2rem;
  color: #757575;
}

.score-status {
  font-size: 1.2rem;
  font-weight: 600;
}

.score-passed .score-status {
  color: #2e7d32;
}

.score-failed .score-status {
  color: #f57c00;
}

.score-breakdown {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.score-item {
  background: #f5f5f5;
  padding: 20px;
  border-radius: 8px;
  text-align: center;
}

.score-item.pending {
  background: #fff3e0;
}

.score-item-label {
  font-size: 0.9rem;
  color: #757575;
  margin-bottom: 8px;
}

.score-item-value {
  font-size: 2rem;
  font-weight: 700;
  color: #2196f3;
  margin-bottom: 4px;
}

.score-item.pending .score-item-value {
  color: #ff9800;
}

.score-item-detail {
  font-size: 0.85rem;
  color: #9e9e9e;
}

.results-info {
  background: #e3f2fd;
  padding: 24px;
  border-radius: 12px;
  margin-bottom: 24px;
}

.results-info h3 {
  margin-top: 0;
  color: #1976d2;
}

.results-info ul {
  margin: 8px 0;
  padding-left: 24px;
}

.results-info li {
  margin-bottom: 8px;
  line-height: 1.6;
}

.results-actions {
  display: flex;
  justify-content: center;
  gap: 16px;
  padding: 20px;
}

/* Loading Overlay */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.loading-spinner {
  width: 60px;
  height: 60px;
  border: 6px solid #f3f3f3;
  border-top: 6px solid #e91e63;
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

.loading-message {
  color: white;
  font-size: 1.2rem;
  margin-top: 20px;
  font-weight: 500;
}

/* Responsive Design */
@media (max-width: 768px) {
  .quiz-header-bar {
    flex-direction: column;
    gap: 12px;
  }

  .quiz-progress-info {
    flex-direction: column;
    gap: 4px;
  }

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

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

  .nav-center {
    width: 100%;
  }

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

  .score-breakdown {
    grid-template-columns: 1fr;
  }

  .results-actions {
    flex-direction: column;
  }

  .results-actions .btn {
    width: 100%;
  }
}
