/**
 * Reading Section Styles
 * Independent scrolling for passages and questions
 */

/* Custom scrollbar styling for reading section */
.reading-scroll-container {
  scrollbar-width: thin;
  scrollbar-color: #4A90E2 transparent;
}

.reading-scroll-container::-webkit-scrollbar {
  width: 8px;
}

.reading-scroll-container::-webkit-scrollbar-track {
  background: transparent;
}

.reading-scroll-container::-webkit-scrollbar-thumb {
  background-color: #4A90E2;
  border-radius: 4px;
  transition: background-color 0.2s;
}

.reading-scroll-container::-webkit-scrollbar-thumb:hover {
  background-color: #357ABD;
}

/* Smooth scrolling */
.reading-scroll-container {
  scroll-behavior: smooth;
  -webkit-overflow-scrolling: touch;
}

.reading-exam-title-bar {
  padding: 20px;
  text-align: center;
  margin-bottom: 0;
  color: #fff;
  background: linear-gradient(135deg, #A78BFA 0%, #6D4DE8 100%);
  box-shadow: 0 18px 42px rgba(109, 77, 232, 0.16);
}

.reading-view-answers-strip {
  padding: 12px;
  text-align: center;
  background: rgba(167, 139, 250, 0.14);
  border-top: 1px solid rgba(142, 110, 239, 0.16);
  border-bottom: 1px solid rgba(142, 110, 239, 0.16);
}

.reading-view-answers-button {
  padding: 8px 32px;
  border: 2px solid #8E6EEF;
  border-radius: 8px;
  color: #6D4DE8;
  background: transparent;
  font-size: 14px;
  font-weight: 700;
  cursor: pointer;
  transition: color 0.2s ease, background 0.2s ease, border-color 0.2s ease;
}

.reading-view-answers-button:hover,
.reading-view-answers-button:focus-visible {
  color: #fff;
  background: #A78BFA;
  border-color: #A78BFA;
  outline: none;
}

/* Section headers - sticky positioning */
.reading-section-header {
  position: sticky;
  top: 0;
  background: var(--surface-strong);
  z-index: 10;
  padding: 24px 32px;
  border-bottom: 2px solid var(--line);
}

/* Question section styling */
.reading-question-section {
  margin-bottom: 40px;
  padding-bottom: 32px;
  border-bottom: 2px solid var(--line);
}

.reading-question-section:last-of-type {
  border-bottom: none;
}

/* Question item styling */
.reading-question-item {
  padding-bottom: 16px;
  border-bottom: 1px solid var(--line);
  margin-bottom: 20px;
}

.reading-question-item:last-child {
  border-bottom: none;
  margin-bottom: 0;
}

.reading-fill-gap-paragraph {
  display: block;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
  white-space: pre-wrap;
}

.reading-fill-gap-paragraph .question-inline-input {
  display: inline-block;
  width: min(180px, 42vw);
  min-height: 34px;
  margin: 0 5px;
  padding: 6px 10px;
  vertical-align: baseline;
}

.reading-fill-gap-paragraph .question-inline-input--compact {
  width: min(150px, 38vw);
}

.reading-fill-gap-lines {
  display: grid;
  gap: 18px;
}

.reading-fill-gap-line {
  display: flex;
  align-items: baseline;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.65;
}

.reading-fill-gap-line > .question-no {
  flex: 0 0 auto;
}

.reading-fill-gap-line__content {
  min-width: 0;
}

.reading-match-letter-preview {
  display: grid;
  gap: 10px;
  color: var(--text);
  font-size: 15px;
  line-height: 1.6;
}

.reading-match-letter-introduction {
  margin-bottom: 8px;
  padding: 0;
  white-space: normal;
}

.reading-match-letter-line {
  display: block;
}

.question-inline-letter-input {
  display: inline-block;
  width: 48px;
  min-height: 34px;
  margin: 0 5px;
  padding: 5px 9px;
  text-align: center;
  text-transform: uppercase;
  vertical-align: baseline;
}

/* Question number badge */
.reading-question-number {
  display: inline-block;
  width: 28px;
  height: 28px;
  background: var(--primary);
  color: white;
  border-radius: 50%;
  text-align: center;
  line-height: 28px;
  font-size: 14px;
  margin-right: 10px;
  font-weight: 700;
}

/* Input field styling */
.reading-answer-input {
  width: 100%;
  padding: 10px;
  border: 2px solid var(--line);
  border-radius: 4px;
  font-size: 14px;
  background: var(--surface-strong);
  color: var(--text);
  transition: border-color 0.2s;
}

.reading-answer-input:focus {
  outline: none;
  border-color: #4A90E2;
  box-shadow: 0 0 0 3px rgba(74, 144, 226, 0.1);
}

/* Passage text styling */
.reading-passage-text {
  line-height: 1.8;
  color: #000;
  font-size: 15px;
  white-space: pre-wrap;
}

.reading-passage-text strong,
.reading-passage-text em,
.reading-passage-text p,
.reading-passage-text span {
  color: #000;
}

html[data-theme='dark'] .reading-passage-text,
html[data-theme='dark'] .reading-passage-text strong,
html[data-theme='dark'] .reading-passage-text em,
html[data-theme='dark'] .reading-passage-text p,
html[data-theme='dark'] .reading-passage-text span {
  color: var(--text);
}

html[data-theme='dark'] .reading-exam-title-bar {
  background: linear-gradient(135deg, #2D1B4E 0%, #1E1B2B 100%);
  box-shadow: 0 18px 42px rgba(0, 0, 0, 0.24);
}

html[data-theme='dark'] .reading-view-answers-strip {
  background: rgba(167, 139, 250, 0.12);
  border-color: rgba(196, 181, 253, 0.18);
}

html[data-theme='dark'] .reading-view-answers-button {
  color: #F7F3FF;
  border-color: #A78BFA;
}

html[data-theme='dark'] .reading-view-answers-button:hover,
html[data-theme='dark'] .reading-view-answers-button:focus-visible {
  color: #fff;
  background: #A78BFA;
  border-color: #A78BFA;
}

/* Mobile responsive */
@media (max-width: 768px) {
  .reading-split-layout {
    grid-template-columns: 1fr !important;
    height: auto !important;
  }
  
  .reading-scroll-container {
    max-height: 400px;
  }
  
  .reading-section-header {
    padding: 16px 20px;
  }
  
  .reading-question-section {
    padding: 0 20px 24px 20px;
  }
}

/* Print styles */
@media print {
  .reading-scroll-container {
    overflow: visible !important;
    height: auto !important;
  }
}
