/* BNR Quiz Block Styles */

.bnr-quiz-container {
  max-width: 800px;
  margin: 0 auto;
  padding: 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  background: #fff;
  border-radius: 12px;
}

/* Title */
.bnr-quiz-title {
  font-size: 28px;
  font-weight: 700;
  color: #333;
  text-align: center;
  margin: 0 0 30px 0;
}

/* Filters */
.bnr-quiz-filters {
  display: flex;
  gap: 20px;
  align-items: end;
  justify-content: center;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.bnr-quiz-filter {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bnr-quiz-filter label {
  font-weight: 600;
  color: #555;
  font-size: 14px;
}

.bnr-quiz-filter select {
  padding: 8px 12px;
  border: 2px solid #e1e5e9;
  border-radius: 6px;
  font-size: 14px;
  background: #fff;
  min-width: 150px;
}

.bnr-quiz-filter select:focus {
  outline: none;
  border-color: #007cba;
}

.bnr-quiz-start-btn {
  background: #007cba;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
  height: fit-content;
}

.bnr-quiz-start-btn:hover {
  background: #005a87;
}

/* Progress Bar */
.bnr-quiz-progress {
  margin-bottom: 30px;
}

.bnr-quiz-progress-bar {
  width: 100%;
  height: 8px;
  background: #e1e5e9;
  border-radius: 4px;
  overflow: hidden;
  margin-bottom: 10px;
}

.bnr-quiz-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #007cba, #00a0d2);
  transition: width 0.3s ease;
}

.bnr-quiz-progress-text {
  text-align: center;
  font-weight: 600;
  color: #666;
  font-size: 14px;
}

/* Quiz Card */
.bnr-quiz-card {
  perspective: 1000px;
  cursor: pointer;
  margin-bottom: 20px;
}

.bnr-quiz-card-inner {
  position: relative;
  width: 100%;
  height: 450px;
  text-align: center;
  transition: transform 0.6s;
  transform-style: preserve-3d;
}

.bnr-quiz-card.flipped .bnr-quiz-card-inner {
  transform: rotateY(180deg);
}

.bnr-quiz-card-front,
.bnr-quiz-card-back {
  position: absolute;
  width: 100%;
  height: 100%;
  backface-visibility: hidden;
  border-radius: 12px;
  padding: 30px;
  box-sizing: border-box;
  display: flex;
  flex-direction: column;
  justify-content: center;
}

.bnr-quiz-card-front {
  background: #f5f5f5;
  color: #000;
}

.bnr-quiz-card-back {
  background: #f5f5f5;
  color: #000;
  transform: rotateY(180deg);
}

/* Question */
.bnr-quiz-question h3 {
  font-size: 20px;
  margin: 0 0 15px 0;
  font-weight: 600;
  opacity: 0.9;
}

.bnr-quiz-question p {
  font-size: 18px;
  line-height: 1.6;
  margin: 0 0 25px 0;
  font-weight: 500;
}

/* Options */
.bnr-quiz-options {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
  margin-bottom: 25px;
  max-width: 600px;
  margin-left: auto;
  margin-right: auto;
}

.bnr-quiz-option {
  background: #fff;
  padding: 16px 20px;
  border-radius: 10px;
  font-size: 16px;
  cursor: pointer;
  transition: all 0.3s ease;
  border: 2px solid #ddd;
  font-weight: 500;
  color: #000;
}

.bnr-quiz-option:hover {
  background: #f0f0f0;
  transform: translateY(-2px);
  border-color: #007cba;
}

.bnr-quiz-option.selected {
  background: #e3f2fd;
  border-color: #007cba;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

/* Flip Hint */
.bnr-quiz-flip-hint {
  margin-top: auto;
  opacity: 0.8;
}

.bnr-quiz-flip-hint p {
  font-size: 14px;
  margin: 0;
  font-style: italic;
}

/* Answer */
.bnr-quiz-answer h3 {
  font-size: 22px;
  margin: 0 0 20px 0;
  font-weight: 700;
}

.bnr-quiz-correct-answer {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  font-size: 18px;
  font-weight: 600;
  border: 2px solid #28a745;
  color: #000;
}

.bnr-quiz-explanation {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  margin-bottom: 20px;
  flex-grow: 1;
  border: 2px solid #ddd;
  color: #000;
}

.bnr-quiz-explanation p {
  margin: 0;
  line-height: 1.6;
  font-size: 16px;
  font-weight: 500;
}

/* Actions */
.bnr-quiz-actions {
  margin-top: auto;
  display: flex;
  flex-direction: row;
  gap: 12px;
  align-items: center;
  justify-content: center;
  flex-wrap: wrap;
}

.bnr-quiz-show-answer-btn,
.bnr-quiz-next-btn,
.bnr-quiz-end-quiz-btn,
.bnr-quiz-back-to-question-btn {
  background: #007cba;
  color: white;
  border: 2px solid #007cba;
  padding: 12px 20px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  font-size: 14px;
  min-width: 120px;
  flex: 1;
  max-width: 150px;
}

.bnr-quiz-show-answer-btn:hover,
.bnr-quiz-next-btn:hover,
.bnr-quiz-end-quiz-btn:hover,
.bnr-quiz-back-to-question-btn:hover {
  background: #005a87;
  border-color: #005a87;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.bnr-quiz-end-quiz-btn {
  background: #dc3545;
  border-color: #dc3545;
}

.bnr-quiz-end-quiz-btn:hover {
  background: #c82333;
  border-color: #c82333;
}

.bnr-quiz-answer-hint {
  color: #666;
  font-size: 14px;
  font-style: italic;
  margin: 0;
  text-align: center;
}

/* Results */
.bnr-quiz-results {
  text-align: center;
  padding: 40px 20px;
}

.bnr-quiz-results h3 {
  font-size: 32px;
  color: #333;
  margin: 0 0 30px 0;
  font-weight: 700;
}

.bnr-quiz-score {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 40px;
  margin-bottom: 30px;
  flex-wrap: wrap;
}

.bnr-quiz-score-circle {
  width: 120px;
  height: 120px;
  border-radius: 50%;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  color: white;
  position: relative;
}

.bnr-quiz-score-percentage {
  font-size: 32px;
  font-weight: 700;
  line-height: 1;
}

.bnr-quiz-score-text {
  font-size: 14px;
  opacity: 0.9;
}

.bnr-quiz-score-details {
  text-align: left;
}

.bnr-quiz-score-details p {
  margin: 0 0 10px 0;
  font-size: 18px;
  color: #333;
}

.bnr-quiz-score-message {
  font-size: 16px !important;
  color: #666 !important;
  font-style: italic;
}

.bnr-quiz-results-actions {
  margin-top: 30px;
}

.bnr-quiz-restart-btn {
  background: #007cba;
  color: white;
  border: none;
  padding: 12px 24px;
  border-radius: 8px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
  font-size: 16px;
}

.bnr-quiz-restart-btn:hover {
  background: #005a87;
}

/* Detailed Results Table */
.bnr-quiz-detailed-results {
  margin-top: 40px;
  text-align: left;
}

.bnr-quiz-detailed-results h4 {
  font-size: 20px;
  color: #333;
  margin: 0 0 20px 0;
  text-align: center;
}

.bnr-quiz-results-table-container {
  overflow-x: auto;
  border-radius: 8px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.1);
}

.bnr-quiz-results-table {
  width: 100%;
  border-collapse: collapse;
  background: #fff;
  font-size: 14px;
}

.bnr-quiz-results-table thead {
  background: #f8f9fa;
}

.bnr-quiz-results-table th {
  padding: 15px 12px;
  text-align: left;
  font-weight: 600;
  color: #333;
  border-bottom: 2px solid #e1e5e9;
  font-size: 14px;
}

.bnr-quiz-results-table th:first-child {
  width: 40%;
}

.bnr-quiz-results-table th:nth-child(2),
.bnr-quiz-results-table th:nth-child(3) {
  width: 25%;
  text-align: left;
}

.bnr-quiz-results-table th:last-child {
  width: 10%;
  text-align: center;
}

.bnr-quiz-result-row {
  border-bottom: 1px solid #e1e5e9;
  transition: background-color 0.2s ease;
}

.bnr-quiz-result-row:hover {
  background: #f8f9fa;
}

.bnr-quiz-result-row.correct {
  background: #f8fff9;
}

.bnr-quiz-result-row.incorrect {
  background: #fff8f8;
}

.bnr-quiz-result-row.correct:hover {
  background: #f0fff4;
}

.bnr-quiz-result-row.incorrect:hover {
  background: #ffeaea;
}

.bnr-quiz-question-cell {
  padding: 15px 12px;
  vertical-align: top;
}

.bnr-quiz-question-header {
  display: flex;
  align-items: flex-start;
  gap: 8px;
}

.bnr-quiz-question-number {
  font-weight: 600;
  color: #007cba;
  font-size: 14px;
  flex-shrink: 0;
  margin-top: 2px;
}

.bnr-quiz-question-text {
  color: #333;
  line-height: 1.4;
  font-size: 14px;
  flex: 1;
}

.bnr-quiz-answer-cell {
  padding: 15px 12px;
  text-align: left;
  vertical-align: top;
}

.bnr-quiz-answer-content {
  display: flex;
  flex-direction: column;
  gap: 8px;
  align-items: flex-start;
}

.bnr-quiz-answer-letter {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  border-radius: 50%;
  background: #e9ecef;
  color: #495057;
  font-weight: 600;
  font-size: 12px;
  text-align: center;
  flex-shrink: 0;
}

.bnr-quiz-answer-letter.correct {
  background: #28a745;
  color: white;
}

.bnr-quiz-answer-text {
  font-size: 13px;
  color: #333;
  line-height: 1.3;
  word-wrap: break-word;
}

.bnr-quiz-status-cell {
  padding: 15px 12px;
  text-align: center;
  vertical-align: middle;
}

.bnr-quiz-status-icon {
  display: inline-block;
  width: 24px;
  height: 24px;
  line-height: 24px;
  border-radius: 50%;
  font-weight: bold;
  font-size: 14px;
}

.bnr-quiz-status-icon.correct {
  background: #28a745;
  color: white;
}

.bnr-quiz-status-icon.incorrect {
  background: #dc3545;
  color: white;
}

/* Error */
.bnr-quiz-error {
  text-align: center;
  padding: 40px 20px;
  color: #d63384;
}

.bnr-quiz-error h3 {
  font-size: 24px;
  margin: 0 0 20px 0;
}

.bnr-quiz-error p {
  font-size: 16px;
  margin: 0 0 20px 0;
}

.bnr-quiz-retry-btn {
  background: #d63384;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  font-weight: 600;
  cursor: pointer;
  transition: background 0.3s ease;
}

.bnr-quiz-retry-btn:hover {
  background: #b02a5b;
}

/* Loading */
.bnr-quiz-loading {
  text-align: center;
  padding: 40px 20px;
}

.bnr-quiz-spinner {
  width: 40px;
  height: 40px;
  border: 4px solid #e1e5e9;
  border-top: 4px solid #007cba;
  border-radius: 50%;
  animation: bnr-quiz-spin 1s linear infinite;
  margin: 0 auto 20px;
}

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

.bnr-quiz-loading p {
  color: #666;
  font-size: 16px;
  margin: 0;
}

/* Welcome */
.bnr-quiz-welcome {
  text-align: center;
  padding: 40px 20px;
  color: #666;
}

.bnr-quiz-welcome p {
  font-size: 18px;
  margin: 0;
}

/* Editor Styles */
.bnr-quiz-editor-placeholder {
  border: 2px dashed #ccc;
  padding: 20px;
  text-align: center;
  background: #f9f9f9;
  border-radius: 8px;
}

.bnr-quiz-editor-preview {
  max-width: 600px;
  margin: 0 auto;
}

.bnr-quiz-preview-title {
  font-size: 24px;
  color: #333;
  margin: 0 0 20px 0;
  text-align: center;
}

.bnr-quiz-preview-filters {
  display: flex;
  gap: 15px;
  margin-bottom: 20px;
  justify-content: center;
  flex-wrap: wrap;
}

.bnr-quiz-preview-filter {
  display: flex;
  flex-direction: column;
  gap: 5px;
}

.bnr-quiz-preview-filter label {
  font-size: 12px;
  color: #666;
  font-weight: 600;
}

.bnr-quiz-preview-filter select {
  padding: 6px 10px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 12px;
  background: #f5f5f5;
  min-width: 120px;
}

.bnr-quiz-preview-start {
  background: #007cba;
  color: white;
  border: none;
  padding: 8px 16px;
  border-radius: 4px;
  font-size: 12px;
  height: fit-content;
  align-self: end;
}

.bnr-quiz-preview-content {
  margin-top: 20px;
}

.bnr-quiz-preview-card {
  border: 2px solid #ddd;
  border-radius: 8px;
  padding: 20px;
  background: #f9f9f9;
  text-align: center;
}

.bnr-quiz-preview-question h3 {
  font-size: 18px;
  color: #333;
  margin: 0 0 10px 0;
}

.bnr-quiz-preview-question p {
  font-size: 14px;
  color: #666;
  margin: 0 0 15px 0;
}

.bnr-quiz-preview-options {
  display: flex;
  flex-direction: column;
  gap: 8px;
  margin-bottom: 15px;
}

.bnr-quiz-preview-option {
  background: #e9ecef;
  padding: 8px 12px;
  border-radius: 4px;
  font-size: 12px;
  color: #333;
}

.bnr-quiz-preview-flip {
  border-top: 1px solid #ddd;
  padding-top: 10px;
}

.bnr-quiz-preview-flip p {
  font-size: 12px;
  color: #999;
  margin: 0;
  font-style: italic;
}

.bnr-quiz-preview-note {
  text-align: center;
  font-size: 12px;
  color: #999;
  margin: 15px 0 0 0;
  font-style: italic;
}

/* Responsive Design */
@media (max-width: 768px) {
  .bnr-quiz-container {
    padding: 15px;
  }
  
  .bnr-quiz-title {
    font-size: 24px;
  }
  
  .bnr-quiz-filters {
    flex-direction: column;
    align-items: stretch;
  }
  
  .bnr-quiz-filter select {
    min-width: auto;
  }
  
  .bnr-quiz-card-front,
  .bnr-quiz-card-back {
    padding: 20px;
  }
  
  .bnr-quiz-question h3 {
    font-size: 20px;
  }
  
  .bnr-quiz-question p {
    font-size: 16px;
  }
  
  .bnr-quiz-option {
    padding: 12px 15px;
    font-size: 14px;
  }
  
  .bnr-quiz-score {
    flex-direction: column;
    gap: 20px;
  }
  
  .bnr-quiz-score-details {
    text-align: center;
  }
  
  .bnr-quiz-results-table th,
  .bnr-quiz-results-table td {
    padding: 10px 8px;
    font-size: 12px;
  }
  
  .bnr-quiz-results-table th:first-child {
    width: 35%;
  }
  
  .bnr-quiz-results-table th:nth-child(2),
  .bnr-quiz-results-table th:nth-child(3) {
    width: 27.5%;
  }
  
  .bnr-quiz-results-table th:last-child {
    width: 10%;
  }
  
  .bnr-quiz-question-header {
    flex-direction: column;
    gap: 4px;
  }
  
  .bnr-quiz-question-number {
    font-size: 12px;
  }
  
  .bnr-quiz-question-text {
    font-size: 12px;
  }
  
  .bnr-quiz-answer-content {
    gap: 4px;
  }
  
  .bnr-quiz-answer-letter {
    width: 20px;
    height: 20px;
    line-height: 20px;
    font-size: 10px;
  }
  
  .bnr-quiz-answer-text {
    font-size: 11px;
  }
  
  .bnr-quiz-status-icon {
    width: 18px;
    height: 18px;
    line-height: 18px;
    font-size: 10px;
  }
  
  .bnr-quiz-options {
    grid-template-columns: 1fr;
    gap: 8px;
  }
  
  .bnr-quiz-actions {
    flex-direction: column;
    gap: 8px;
  }
  
  .bnr-quiz-show-answer-btn,
  .bnr-quiz-next-btn,
  .bnr-quiz-end-quiz-btn,
  .bnr-quiz-back-to-question-btn {
    padding: 10px 20px;
    font-size: 13px;
    min-width: 100px;
    max-width: none;
    width: 100%;
  }
}
