/* ============================================
   READING PRACTICE MODE STYLES
   ============================================ */

/* Force width for article and questions panels during reading practice */
.reading-practice-article-width {
  width: 70% !important;
}

.reading-practice-questions-width {
  width: 30% !important;
  right: 0 !important;
}

/* Blur Effect */
.reading-blur {
  filter: blur(8px);
  pointer-events: none;
  user-select: none;
  -webkit-user-select: none;
  -moz-user-select: none;
  -ms-user-select: none;
}

/* Questions Hidden Overlay */
.reading-practice-questions-hidden-overlay {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 100;
  pointer-events: none;
}

.questions-hidden-message {
  padding: 40px 50px;
  text-align: center;
  max-width: 400px;
}

.questions-hidden-message h3 {
  color: #2c3e50;
  font-size: 24px;
  margin: 0 0 10px 0;
  font-weight: 600;
}

.questions-hidden-message p {
  color: #34495e;
  margin: 0;
  font-size: 14px;
  opacity: 0.8;
}

.questions-hidden-message i {
  color: #2374b7;
}

/* ============================================
   START OVERLAY
   ============================================ */
.reading-start-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.85);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10000;
  animation: fadeIn 0.3s ease;
}

@keyframes fadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}

.reading-start-container {
  background: white;
  padding: 40px 50px;
  border-radius: 12px;
  text-align: center;
  max-width: 600px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.3);
  animation: slideUp 0.4s ease;
}

@keyframes slideUp {
  from {
    transform: translateY(30px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.reading-instructions h2 {
  margin-bottom: 20px;
  color: #333;
  font-size: 28px;
  font-weight: bold;
}

.reading-instructions p {
  margin-bottom: 15px;
  color: #666;
  line-height: 1.8;
  font-size: 16px;
}

.reading-start-btn {
  margin-top: 20px;
  padding: 15px 50px;
  font-size: 18px;
  font-weight: bold;
  transition: all 0.3s ease;
}

.reading-start-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 5px 20px rgba(23, 152, 250, 0.4);
}

/* ============================================
   ACTIVE CONTROLS (Timer & Tools)
   ============================================ */
.reading-active-controls {
  position: absolute;
  top: 60px;
  left: 20px;
  z-index: 1000;
  background: white;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
  padding: 12px 16px;
  animation: slideInLeft 0.3s ease;
}

@keyframes slideInLeft {
  from {
    transform: translateX(-100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

@keyframes slideInRight {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Right-side positioning variant */
.reading-active-controls-right {
  display: flex;
  width: 98%;
  justify-content: space-between;
  margin: 6px;
  left: 0;
  top: 0;
  animation: slideInRight 0.3s ease;
}

.reading-timer-panel {
  display: flex;
  align-items: center;
  gap: 6px;
}

.timer-display {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 15px;
  font-weight: bold;
  color: #2374b7;
  font-family: "Courier New", monospace;
}

.timer-display i {
  font-size: 14px;
  animation: pulse 2s infinite;
}

@keyframes pulse {
  0%,
  100% {
    opacity: 1;
  }
  50% {
    opacity: 0.6;
  }
}

.reading-finish-btn {
  padding: 5px 10px;
  font-weight: 600;
  font-size: 12px;
  white-space: nowrap;
  transition: all 0.3s ease;
  background: #28a745 !important;
  border-color: #28a745 !important;
}

.reading-finish-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 4px 15px rgba(40, 167, 69, 0.4);
  background: #218838 !important;
  border-color: #1e7e34 !important;
}

/* ============================================
   READING TOOLS
   ============================================ */
.reading-tools-panel {
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reading-tools-panel .btn-tool {
  padding: 6px 10px;
  border: 1px solid #e0e0e0;
  background: white;
  cursor: pointer;
  border-radius: 4px;
  transition: all 0.2s ease;
  white-space: nowrap;
  font-size: 12px;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

.reading-tools-panel .btn-tool i {
  font-size: 13px;
}

.reading-tools-panel .btn-tool:hover {
  background: #f5f5f5;
  border-color: #1798fa;
  transform: translateX(2px);
}

.reading-tools-panel .btn-tool.active {
  background: #1798fa;
  color: white;
  border-color: #1798fa;
  box-shadow: 0 2px 8px rgba(23, 152, 250, 0.3);
}

.reading-tools-panel .btn-tool.btn-warning {
  background: #ff9800;
  color: white;
  border-color: #ff9800;
}

.reading-tools-panel .btn-tool.btn-warning:hover {
  background: #f57c00;
  border-color: #f57c00;
}

/* Pacer Controls - Redesigned Compact Layout */
.pacer-controls {
  display: flex;
  gap: 8px;
  width: 100%;
}

/* Mode Toggle Buttons (Word/Sentence) */
.pacer-mode-toggle {
  display: flex;
  gap: 4px;
  background: #f0f0f0;
  border-radius: 6px;
  padding: 4px;
}

.btn-mode {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  background: transparent;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.btn-mode i {
  font-size: 11px;
}

.btn-mode:hover {
  background: #e0e0e0;
  color: #333;
}

.btn-mode.active {
  background: #1798fa;
  color: white;
  box-shadow: 0 2px 6px rgba(23, 152, 250, 0.3);
}

/* Focus Mode Button */
.btn-focus {
  padding: 4px 8px;
  font-size: 11px;
  font-weight: 600;
  color: #666;
  background: white;
  border: 1px solid #ddd;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 4px;
  white-space: nowrap;
}

.btn-focus i {
  font-size: 11px;
}

.btn-focus:hover {
  border-color: #1798fa;
  color: #1798fa;
}

.btn-focus.active {
  background: #673ab7;
  color: white;
  border-color: #673ab7;
  box-shadow: 0 2px 6px rgba(103, 58, 183, 0.3);
}

/* WPM Slider - Compact Version */
.wpm-slider-container {
  display: flex;
  flex-direction: column;
  gap: 6px;
  flex: 1;
  max-width: 160px;
}

.wpm-slider-header {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 10px;
  font-weight: 600;
  color: #1798fa;
}

.wpm-slider-header i {
  font-size: 11px;
}

.wpm-value {
  background: #e3f2fd;
  padding: 2px 8px;
  border-radius: 4px;
  min-width: 40px;
  text-align: center;
}

/* WPM Preset Dropdown */
.wpm-preset-dropdown {
  padding: 2px 4px;
  font-size: 11px;
  font-weight: 600;
  color: #1798fa;
  background: white;
  border: 1px solid #1798fa;
  border-radius: 4px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.wpm-preset-dropdown:hover {
  background: #e3f2fd;
}

.wpm-preset-dropdown:focus {
  border-color: #0d47a1;
  box-shadow: 0 0 0 2px rgba(23, 152, 250, 0.2);
}

.wpm-slider {
  width: 100%;
  height: 4px;
  border-radius: 2px;
  outline: none;
  -webkit-appearance: none;
  background: linear-gradient(to right, #90caf9 0%, #1798fa 50%, #0d47a1 100%);
}

.wpm-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1798fa;
  cursor: pointer;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.wpm-slider::-webkit-slider-thumb:hover {
  background: #0d47a1;
  transform: scale(1.15);
}

.wpm-slider::-moz-range-thumb {
  width: 14px;
  height: 14px;
  border-radius: 50%;
  background: #1798fa;
  cursor: pointer;
  border: none;
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.wpm-slider::-moz-range-thumb:hover {
  background: #0d47a1;
  transform: scale(1.15);
}

/* Start/Pause Pacer Button */
.btn-pacer-toggle {
  padding: 5px 10px;
  font-size: 12px;
  font-weight: 600;
  color: white !important;
  background: #28a745;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(40, 167, 69, 0.3);
  width: 70px;
}

.btn-pacer-toggle:hover {
  background: #218838;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(40, 167, 69, 0.4);
}

.btn-pacer-toggle.active {
  background: #dc3545;
  box-shadow: 0 2px 6px rgba(220, 53, 69, 0.3);
}

.btn-pacer-toggle.active:hover {
  background: #c82333;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(220, 53, 69, 0.4);
}

.btn-pacer-toggle i {
  font-size: 10px;
}

/* ============================================
   PACER - Word-by-Word Highlighting
   ============================================ */
.pacer-word {
  display: inline;
  transition: all 0.1s ease;
}

.pacer-highlight {
  background-color: #fdd835 !important;
  padding: 2px 0;
  border-radius: 3px;
  box-shadow: 0 2px 6px rgba(253, 216, 53, 0.6);
}

/* Dim already read words (passed/visited) */
.pacer-word.pacer-read {
  opacity: 0.4;
}

/* Focus Mode - Dim other words when in word mode */
.reading-practice-merge-content.focus-mode-active .pacer-word {
  opacity: 0.2;
  filter: blur(2px);
  transition: all 0.1s ease;
}

.reading-practice-merge-content.focus-mode-active .pacer-word.pacer-highlight {
  opacity: 1 !important;
  filter: none !important;
}

/* Focus Mode - Keep read words dimmed but less than unread */
.reading-practice-merge-content.focus-mode-active .pacer-word.pacer-read {
  opacity: 0.15;
  filter: blur(2px);
}

/* ============================================
   PACER - Sentence-by-Sentence Highlighting
   ============================================ */
.pacer-sentence {
  display: inline;
  transition: all 0.15s ease;
}

.pacer-sentence.pacer-highlight {
  background-color: #aed581 !important;
  padding: 4px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(174, 213, 129, 0.6);
}

/* Dim already read sentences (passed/visited) */
.pacer-sentence.pacer-read {
  opacity: 0.4;
}

/* Focus Mode - Dim other sentences (only when focus-mode-active class is present) */
.reading-practice-merge-content.focus-mode-active .pacer-sentence {
  opacity: 0.2;
  filter: blur(2px);
  transition: all 0.15s ease;
}

.reading-practice-merge-content.focus-mode-active .pacer-sentence.pacer-highlight {
  opacity: 1 !important;
  filter: none !important;
  background-color: #aed581 !important;
  padding: 4px 6px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(174, 213, 129, 0.6);
}

/* Focus Mode - Keep read sentences dimmed but less than unread */
.reading-practice-merge-content.focus-mode-active .pacer-sentence.pacer-read {
  opacity: 0.15;
  filter: blur(2px);
}

/* ============================================
   READING SUMMARY (After Finishing)
   ============================================ */
.reading-summary-panel {
  position: absolute;
  top: 60px;
  left: 20px;
  z-index: 1000;
  background: linear-gradient(135deg, #4caf50 0%, #45a049 100%);
  color: white;
  padding: 10px 18px;
  border-radius: 8px;
  box-shadow: 0 2px 10px rgba(76, 175, 80, 0.3);
  animation: bounceIn 0.5s ease;
}

/* Right-side positioning variant */
.reading-summary-panel-right {
  left: auto;
  right: 20px;
  top: 60px;
}

@keyframes bounceIn {
  0% {
    transform: scale(0.3);
    opacity: 0;
  }
  50% {
    transform: scale(1.05);
  }
  70% {
    transform: scale(0.9);
  }
  100% {
    transform: scale(1);
    opacity: 1;
  }
}

.summary-badge {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  font-weight: 600;
}

.summary-badge i {
  font-size: 16px;
  animation: checkmark 0.5s ease 0.3s backwards;
}

@keyframes checkmark {
  0% {
    transform: scale(0) rotate(-45deg);
  }
  100% {
    transform: scale(1) rotate(0deg);
  }
}

/* ============================================
   MERGED EXTRACTS VIEW
   ============================================ */
.reading-practice-merge-content {
  padding-top: 60px;
}

.extract-section {
  /* margin-bottom: 40px;
  padding-bottom: 30px; */
}

.extract-title {
  font-size: 20px;
  font-weight: bold;
  color: #2374b7;
  margin-bottom: 20px;
  padding-bottom: 12px;
  border-bottom: 3px solid #2374b7;
  letter-spacing: 0.5px;
}

.extract-divider {
  margin: 40px 0;
  border: 0;
  height: 2px;
  background: linear-gradient(to right, transparent, #ddd, transparent);
}

/* ============================================
   RESPONSIVE DESIGN
   ============================================ */
@media (max-width: 820px) {
  .reading-start-container {
    margin: 20px;
    padding: 30px 25px;
  }

  .reading-practice-merge-content {
    padding-top: 120px;
  }

  .reading-instructions h2 {
    font-size: 22px;
  }

  .reading-instructions p {
    font-size: 14px;
  }

  .reading-active-controls {
    flex-direction: column-reverse;
    gap: 10px;
  }

  .reading-active-controls-right {
    width: 94%;
  }

  .reading-active-controls,
  .reading-active-controls-right {
    left: 10px;
    right: 10px;
    top: 70px;
    padding: 15px;
    min-width: auto;
  }

  .reading-timer-panel {
    align-items: stretch;
    gap: 10px;
  }

  .timer-display {
    font-size: 20px;
    justify-content: center;
  }

  .reading-finish-btn {
    width: 100%;
  }

  .reading-tools-panel .btn-tool {
    padding: 12px;
  }

  .auto-scroll-controls {
    margin-left: 0;
    padding-left: 0;
    border-left: none;
    border-top: 2px solid #e0e0e0;
    padding-top: 10px;
  }

  .reading-summary-panel,
  .reading-summary-panel-right {
    left: 10px;
    right: 10px;
    top: 70px;
  }
}

/* ============================================
   TABLET - Medium screens (max-width: 1024px)
   ============================================ */
@media (max-width: 1024px) {
  .reading-active-controls-right {
    width: 95%;
    margin: 3px;
    padding: 8px 10px;
  }

  .pacer-controls {
    gap: 5px;
  }

  .pacer-mode-toggle {
    padding: 3px;
    gap: 3px;
  }

  .btn-mode {
    padding: 4px 6px;
    font-size: 10px;
  }

  .btn-mode i {
    font-size: 10px;
  }

  .btn-focus {
    padding: 4px 6px;
    font-size: 10px;
  }

  .btn-focus i {
    font-size: 10px;
  }

  .wpm-preset-dropdown {
    font-size: 10px;
    padding: 3px 5px;
    min-width: 85px;
  }

  .wpm-slider-container {
    max-width: 140px;
    gap: 4px;
  }

  .wpm-slider-header {
    font-size: 9px;
  }

  .wpm-slider-header i {
    font-size: 10px;
  }

  .wpm-value {
    padding: 2px 5px;
    min-width: 32px;
    font-size: 9px;
  }

  .btn-sound-toggle {
    padding: 4px 5px;
    font-size: 10px;
  }

  .btn-pacer-restart {
    padding: 5px 8px;
    font-size: 11px;
  }

  .btn-pacer-restart i {
    font-size: 11px;
  }

  .btn-pacer-toggle {
    padding: 4px 7px;
    font-size: 10px;
    width: 62px;
  }

  .btn-pacer-toggle i {
    font-size: 9px;
  }

  .timer-display {
    font-size: 13px;
  }

  .timer-display i {
    font-size: 12px;
  }

  .reading-finish-btn {
    padding: 5px 9px;
    font-size: 11px;
  }
}

/* ============================================
   SMALL MOBILE - Extra small screens (max-width: 480px)
   ============================================ */
@media (max-width: 480px) {
  .reading-active-controls,
  .reading-active-controls-right {
    padding: 8px 6px;
    gap: 6px;
    width: 99%;
    left: 2px;
    right: 2px;
  }

  /* Timer display even smaller */
  .timer-display {
    font-size: 14px;
  }

  .timer-display i {
    font-size: 12px;
  }

  .reading-finish-btn {
    padding: 6px 10px;
    font-size: 12px;
  }

  /* Ultra compact pacer controls */
  .pacer-controls {
    gap: 4px;
  }

  .pacer-mode-toggle {
    padding: 2px;
    gap: 2px;
  }

  .btn-mode {
    padding: 4px 6px;
    font-size: 9px;
  }

  .btn-mode i {
    font-size: 9px;
  }

  .btn-focus {
    padding: 4px 6px;
    font-size: 9px;
  }

  .btn-focus i {
    font-size: 9px;
  }

  .wpm-preset-dropdown {
    font-size: 9px;
    padding: 3px 4px;
    min-width: 80px;
  }

  .wpm-slider-container {
    gap: 3px;
  }

  .wpm-slider-header {
    font-size: 8px;
  }

  .wpm-slider-header i {
    font-size: 9px;
  }

  .wpm-value {
    padding: 1px 4px;
    min-width: 30px;
    font-size: 9px;
  }

  .btn-sound-toggle {
    padding: 3px 5px;
    font-size: 9px;
  }

  .wpm-slider::-webkit-slider-thumb {
    width: 12px;
    height: 12px;
  }

  .wpm-slider::-moz-range-thumb {
    width: 12px;
    height: 12px;
  }

  .btn-pacer-restart {
    padding: 4px 6px;
    font-size: 10px;
  }

  .btn-pacer-restart i {
    font-size: 10px;
  }

  .btn-pacer-toggle {
    padding: 4px 6px;
    font-size: 10px;
    min-width: 60px;
  }

  .btn-pacer-toggle i {
    font-size: 8px;
  }

  /* Start overlay responsive */
  .reading-start-container {
    margin: 15px;
    padding: 20px 15px;
  }

  .reading-instructions h2 {
    font-size: 18px;
  }

  .reading-instructions p {
    font-size: 12px;
  }

  .reading-start-btn {
    padding: 10px 16px;
    font-size: 14px;
  }
}

/* ============================================
   PRINT STYLES
   ============================================ */
@media print {
  .reading-active-controls,
  .reading-summary-panel,
  .reading-start-overlay {
    display: none !important;
  }

  .reading-blur {
    filter: none !important;
  }

  .reading-pacer-overlay {
    display: none !important;
  }
}

/* ============================================
   ACCESSIBILITY
   ============================================ */
.reading-practice-controls button:focus {
  outline: 3px solid #1798fa;
  outline-offset: 2px;
}

.reading-practice-controls button:focus:not(:focus-visible) {
  outline: none;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
  .reading-pacer-overlay {
    background: rgba(0, 0, 0, 0.2);
    border-color: #000;
  }

  .reading-highlight {
    outline: 2px solid #000;
  }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
  .reading-start-overlay,
  .reading-start-container,
  .reading-active-controls,
  .reading-summary-panel {
    animation: none !important;
  }

  .reading-pacer-overlay {
    transition: none !important;
  }

  * {
    transition: none !important;
  }
}

/* Restart Pacer Button */
.btn-pacer-restart {
  padding: 8px 12px;
  font-size: 13px;
  font-weight: 600;
  color: white !important;
  background: #6c757d;
  border: none;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s ease;
  display: flex;
  align-items: center;
  gap: 6px;
  white-space: nowrap;
  box-shadow: 0 2px 6px rgba(108, 117, 125, 0.3);
}

.btn-pacer-restart:hover {
  background: #5a6268;
  transform: translateY(-1px);
  box-shadow: 0 4px 10px rgba(108, 117, 125, 0.4);
}

.btn-pacer-restart i {
  font-size: 14px;
}
