/* Mock Exams Page Styles */

.mock-container {
  max-width: 1200px;
  margin: 2rem auto;
  padding: 2rem;
}

.mock-container h1 {
  text-align: center;
  color: rgb(97, 2, 121);
  margin-bottom: 1rem;
}

.mock-container .instructions {
  text-align: center;
  font-size: 1.1rem;
  color: #666;
  margin-bottom: 2rem;
}

/* Exam Selector Styles */
.exam-selector-container {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: white;
  border-radius: 15px;
  border: 3px solid #6564b6;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
}

.exam-selector-container label {
  display: block;
  font-weight: bold;
  color: rgb(97, 2, 121);
  margin-bottom: 0.75rem;
  font-size: 1.1rem;
}

.exam-dropdown {
  width: 100%;
  padding: 0.75rem 1rem;
  font-size: 1rem;
  border: 2px solid #ddd;
  border-radius: 10px;
  background: white;
  cursor: pointer;
  transition: all 0.3s;
}

.exam-dropdown:focus {
  outline: none;
  border-color: #6564b6;
  box-shadow: 0 0 0 3px rgba(101, 100, 182, 0.15);
}

.exam-dropdown option {
  padding: 0.5rem;
}

/* Score Oblongs in Dropdown */
.score-oblong {
  display: inline-block;
  padding: 0.2rem 0.6rem;
  margin-left: 0.5rem;
  border-radius: 12px;
  font-weight: bold;
  font-size: 0.85rem;
}

.badge-bright-green {
  background-color: #4caf50;
  color: white;
}

.badge-light-green {
  background-color: #81c784;
  color: white;
}

.badge-light-orange {
  background-color: #ffb74d;
  color: #333;
}

.badge-light-red {
  background-color: #e57373;
  color: white;
}

/* Exam Section Styling */
.exam-section {
  background: white;
  padding: 2rem;
  margin-bottom: 3rem;
  border-radius: 20px;
  border: 4px solid transparent;
  background:
    linear-gradient(white, white) padding-box,
    linear-gradient(to bottom, #8ea5f6, #6564b6) border-box;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.1);
  transition: opacity 0.3s ease;
}

.exam-section h2 {
  color: rgb(97, 2, 121);
  margin-top: 0;
  margin-bottom: 1.5rem;
  border-bottom: 2px solid #eee;
  padding-bottom: 0.5rem;
}

.exam-section.submitted {
  opacity: 0.7;
  pointer-events: none;
  background:
    linear-gradient(#f8f8f8, #f8f8f8) padding-box,
    linear-gradient(to bottom, #ccc, #999) border-box;
}

.exam-section.disabled {
  opacity: 0.7;
  pointer-events: none;
  background:
    linear-gradient(#f8f8f8, #f8f8f8) padding-box,
    linear-gradient(to bottom, #ccc, #999) border-box;
}

/* Re-enable pointer events for invigilator section even when parent is disabled */
.exam-section.disabled .invigilator-section {
  pointer-events: auto;
  opacity: 1;
}

.section-note {
  font-style: italic;
  color: #666;
  background: #f0f8ff;
  padding: 1rem;
  border-radius: 10px;
  margin-bottom: 1.5rem;
}

/* Part Section Styling */
.part-section {
  margin-bottom: 0.3rem;
  padding: 0.4rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  background: white;
}

.part-section h3 {
  color: #6564b6;
  margin-top: 0;
  margin-bottom: 0.25rem;
  font-size: 0.85rem;
}

.part-instruction {
  font-style: italic;
  color: #555;
  margin-bottom: 0.4rem;
  font-size: 0.75rem;
  line-height: 1.3;
}

/* Questions Grid - Single column layout for all screens */
.questions-grid {
  display: flex;
  flex-direction: column;
  gap: 0.5rem;
}

/* Text input grids need more spacing */
.text-input-grid {
  gap: 1rem;
}

.question-item {
  padding: 0.2rem 0.35rem;
  background: white;
  border-radius: 3px;
  border: 1px solid #e0e0e0;
  display: flex;
  flex-direction: row;
  align-items: center;
  gap: 0.3rem;
}

.question-item label {
  font-weight: bold;
  color: #444;
  font-size: 0.75rem;
  min-width: 1.6rem;
  flex-shrink: 0;
}

.question-item .radio-group {
  flex: 1;
}

/* Text input questions need more padding */
.text-input-grid .question-item {
  padding: 0.4rem 0.5rem;
  gap: 0.5rem;
}

.text-input-grid .question-item .answer-input {
  flex: 1;
  min-width: 0; /* Allow flex item to shrink below content size */
}

/* Radio Button Styling - Compact 2-row layout */
.radio-group {
  display: flex;
  gap: 0.3rem 0.4rem; /* Vertical gap smaller, horizontal gap slightly larger */
  flex-wrap: wrap; /* Allow wrapping to 2 rows */
  align-items: center;
}

.radio-option {
  display: flex;
  align-items: center;
  gap: 0.15rem; /* Minimal gap between radio button and its label */
  cursor: pointer;
  padding: 0.1rem; /* Small padding around each option for better touch target */
}

.radio-group input[type="radio"] {
  margin: 0;
  cursor: pointer;
  width: 13px;
  height: 13px;
  flex-shrink: 0;
}

.radio-group label {
  font-weight: normal;
  cursor: pointer;
  margin: 0;
  padding: 0;
  font-size: 0.8rem;
  user-select: none;
  white-space: nowrap;
}

.radio-group input[type="radio"]:checked + label {
  color: #6564b6;
  font-weight: bold;
}

/* For 8-option questions (A-H), force 2 rows on mobile */
.radio-group.eight-options {
  display: grid;
  grid-template-columns: repeat(4, auto);
  gap: 1rem 1.5rem;
  max-width: 100%;
}

@media (max-width: 640px) {
  .radio-group.eight-options {
    grid-template-columns: repeat(4, 1fr);
    gap: 0.75rem 1rem;
  }

  .radio-group.eight-options .radio-option {
    justify-content: flex-start;
  }
}

/* Text Input Styling */
.answer-input {
  padding: 0.5rem;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: border-color 0.3s;
  box-sizing: border-box;
  width: 100%; /* Full width to prevent overflow */
  max-width: 100%; /* Ensure it respects container */
}

/* Standard text inputs (for Parts 2, 3, 6) - 20 characters visible */
.answer-input.standard {
  max-width: 100%; /* Override to prevent overflow */
}

/* Wide text inputs (for Part 4 transformations) - 40 characters visible */
.answer-input.wide {
  max-width: 100%; /* Override to prevent overflow */
}

/* All inputs have max 100 characters */
.answer-input {
  max-length: 100;
}

@media (max-width: 640px) {
  .answer-input.standard,
  .answer-input.wide {
    width: 100%;
    min-width: 100%;
  }
}

.answer-input:focus {
  outline: none;
  border-color: #6564b6;
  box-shadow: 0 0 0 3px rgba(101, 100, 182, 0.15);
}

.answer-input:invalid {
  border-color: #dc3545;
}

/* Submit Container */
.submit-container {
  margin-top: 2rem;
  padding-top: 2rem;
  border-top: 2px solid #eee;
  text-align: center;
}

.btn-primary {
  background: linear-gradient(to right, #8ea5f6, #6564b6);
  color: white;
  border: none;
  padding: 1rem 2rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1.1rem;
  font-weight: bold;
  transition: all 0.3s;
  min-width: 200px;
}

.btn-primary:hover {
  background: linear-gradient(to right, #6564b6, #534f9a);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
  transform: translateY(-2px);
}

.btn-primary:disabled {
  background: #ccc;
  cursor: not-allowed;
  transform: none;
}

.btn-primary.submitted {
  background: linear-gradient(to right, #e57373, #d32f2f);
  cursor: pointer;
}

.btn-primary.submitted:hover {
  background: linear-gradient(to right, #d32f2f, #c62828);
}

.btn-primary.enabled {
  background: linear-gradient(to right, #8ea5f6, #6564b6);
}

.btn-secondary {
  background: #f5f5f5;
  color: #333;
  border: 2px solid #ddd;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s;
}

.btn-secondary:hover {
  background: #e9e9e9;
  border-color: #bbb;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1);
}

/* Status Messages */
.status-message {
  margin-top: 1rem;
  padding: 1rem;
  border-radius: 10px;
  font-weight: 500;
  animation: slideIn 0.3s ease;
}

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

.status-message.success {
  background: #d4edda;
  color: #155724;
  border: 1px solid #c3e6cb;
}

.status-message.error {
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
}

/* Invigilator Section */
.invigilator-section {
  margin-top: 1.5rem;
  padding: 1.5rem;
  background: #fff3cd;
  border: 2px solid #ffc107;
  border-radius: 10px;
  text-align: center;
}

.invigilator-section p {
  margin-top: 0;
  margin-bottom: 1rem;
  color: #856404;
  font-weight: 500;
}

.invigilator-section input {
  padding: 0.75rem;
  border: 2px solid #ffc107;
  border-radius: 8px;
  font-size: 1rem;
  margin-right: 1rem;
  min-width: 200px;
}

.invigilator-section input:focus {
  outline: none;
  border-color: #ff9800;
  box-shadow: 0 0 0 3px rgba(255, 152, 0, 0.2);
}

/* Hidden Utility */
.hidden {
  display: none !important;
}

/* Invigilator Modal Styles */
.invigilator-modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 9999;
}

.modal-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.6);
  backdrop-filter: blur(4px);
}

.modal-content {
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  background: white;
  padding: 2rem;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  max-width: 500px;
  width: 90%;
  animation: modalSlideIn 0.3s ease;
}

@keyframes modalSlideIn {
  from {
    opacity: 0;
    transform: translate(-50%, -60%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.modal-content h3 {
  margin-top: 0;
  color: rgb(97, 2, 121);
  margin-bottom: 1rem;
}

.modal-content p {
  margin-bottom: 0.75rem;
  color: #444;
}

.modal-content p.warning {
  background: #fff3cd;
  border: 2px solid #ffc107;
  padding: 0.75rem;
  border-radius: 8px;
  color: #856404;
  font-weight: 500;
  margin-top: 1rem;
}

.modal-form {
  margin-top: 1.5rem;
}

.modal-form label {
  display: block;
  font-weight: bold;
  color: #444;
  margin-bottom: 0.5rem;
}

.modal-form input {
  width: 100%;
  padding: 0.75rem;
  border: 2px solid #ddd;
  border-radius: 8px;
  font-size: 1rem;
  margin-bottom: 1rem;
}

.modal-form input:focus {
  outline: none;
  border-color: #6564b6;
  box-shadow: 0 0 0 3px rgba(101, 100, 182, 0.15);
}

.modal-buttons {
  display: flex;
  gap: 1rem;
  justify-content: flex-end;
}

.btn-cancel {
  background: #f5f5f5;
  color: #333;
  border: 2px solid #ddd;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s;
}

.btn-cancel:hover {
  background: #e9e9e9;
  border-color: #bbb;
}

.btn-delete {
  background: linear-gradient(to right, #e57373, #d32f2f);
  color: white;
  border: none;
  padding: 0.75rem 1.5rem;
  border-radius: 10px;
  cursor: pointer;
  font-size: 1rem;
  font-weight: bold;
  transition: all 0.3s;
}

.btn-delete:hover {
  background: linear-gradient(to right, #d32f2f, #c62828);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
}

.btn-delete:disabled {
  background: #ccc;
  cursor: not-allowed;
}

.modal-error {
  margin-top: 1rem;
  padding: 0.75rem;
  background: #f8d7da;
  color: #721c24;
  border: 1px solid #f5c6cb;
  border-radius: 8px;
  font-weight: 500;
}

/* Accordion Styles for Mock Parts */
.mock-part {
  margin: 0.25rem 0;
  border-radius: 4px;
  border: 1px solid #e0e0e0;
  overflow: hidden;
  transition: border-color 0.3s ease;
}

.mock-part[open] {
  border-color: #6564b6;
}

.mock-part summary {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 0.4rem 0.6rem;
  background-color: #502f77;
  color: white;
  cursor: pointer;
  font-weight: 500;
  font-size: 0.8rem;
  transition: background-color 0.3s ease;
  list-style: none;
  user-select: none;
}

.mock-part summary::-webkit-details-marker {
  display: none;
}

.mock-part summary:hover {
  background-color: rgb(155, 225, 255);
  color: #502f77;
}

.mock-part summary .part-title {
  flex: 1;
}

.progress-indicator {
  display: inline-block;
  padding: 0.25rem 0.6rem;
  border-radius: 10px;
  font-weight: bold;
  font-size: 0.75rem;
  transition: all 0.3s ease;
}

.progress-indicator[data-status="not-started"] {
  background-color: #9e9e9e;
  color: white;
}

.progress-indicator[data-status="partial"] {
  background-color: #e57373;
  color: white;
}

.progress-indicator[data-status="complete"] {
  background-color: #4caf50;
  color: white;
}

/* Accordion content padding */
.mock-part .part-section {
  padding: 0.4rem;
  background: white;
  border: none;
  margin-bottom: 0;
}

/* Responsive Design */
@media (max-width: 768px) {
  .mock-container {
    padding: 1rem;
  }

  .exam-section {
    padding: 1rem;
  }

  .btn-primary,
  .btn-secondary {
    width: 100%;
    padding: 0.875rem 1rem;
  }

  .invigilator-section input {
    width: 100%;
    margin-right: 0;
    margin-bottom: 1rem;
  }

  .part-section {
    padding: 1rem;
  }

  .mock-part summary {
    flex-direction: row; /* Keep side-by-side on tablet */
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    padding: 0.3rem 0.5rem;
  }

  .mock-part .part-section {
    padding: 0.3rem;
  }

  .part-section h3 {
    font-size: 0.8rem;
    margin-bottom: 0.2rem;
  }

  .part-instruction {
    font-size: 0.7rem;
    margin-bottom: 0.3rem;
    line-height: 1.2;
  }

  .questions-grid {
    gap: 0.15rem;
  }

  .question-item {
    padding: 0.15rem 0.25rem;
  }

  .question-item label {
    font-size: 0.7rem;
    min-width: 1.4rem;
  }

  .radio-group {
    gap: 0.25rem 0.35rem; /* Tighter vertical gap for 2-row layout */
  }

  .radio-option {
    padding: 0.08rem; /* Smaller padding on tablet */
  }

  .radio-group input[type="radio"] {
    width: 12px;
    height: 12px;
  }

  .radio-group label {
    font-size: 0.75rem;
  }
}

@media (max-width: 480px) {
  .mock-container h1 {
    font-size: 1.5rem;
  }

  .exam-section h2 {
    font-size: 1.3rem;
  }

  .part-section h3 {
    font-size: 0.75rem;
    margin-bottom: 0.15rem;
  }

  .part-instruction {
    font-size: 0.65rem;
    margin-bottom: 0.25rem;
    line-height: 1.1;
  }

  .question-item {
    padding: 0.12rem 0.2rem;
  }

  .question-item label {
    font-size: 0.65rem;
    min-width: 1.3rem;
  }

  .mock-part summary {
    flex-direction: row; /* Keep side-by-side on iPhone SE too */
    justify-content: space-between;
    align-items: center;
    gap: 0.5rem;
    font-size: 0.9rem;
    padding: 0.5rem;
  }

  .progress-indicator {
    font-size: 0.55rem;
    padding: 0.1rem 0.3rem;
    flex-shrink: 0; /* Prevent pill from shrinking */
  }

  .radio-group {
    gap: 0.2rem 0.3rem; /* Minimal vertical gap, slightly wider horizontal for iPhone SE */
  }

  .radio-option {
    padding: 0.05rem; /* Minimal padding on smallest screens */
  }

  .radio-group input[type="radio"] {
    width: 11px;
    height: 11px;
  }

  .radio-group label {
    font-size: 0.7rem;
  }

  .questions-grid {
    gap: 1rem;
  }

  .mock-part .part-section {
    padding: 0.25rem;
  }
}