/* Enhanced Reading Experience Styles */

/* Reading Progress Bar */
.reading-progress-bar {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  height: 4px;
  background-color: var(--bg-secondary, rgba(0, 0, 0, 0.1));
  z-index: 1000;
  transition: opacity 0.3s ease;
}

.reading-progress-fill {
  height: 100%;
  background: linear-gradient(
    90deg,
    var(--primary-color, #4f80c7),
    var(--primary-color-dark, #3e6ba3)
  );
  width: 0%;
  transition: width 0.2s ease;
  box-shadow: 0 0 10px rgba(79, 128, 199, 0.5);
}

.reading-progress-tooltip {
  position: absolute;
  top: 100%;
  right: 10px;
  background: var(--bg-color, #fafbfc);
  color: var(--text-color, #3a4a5c);
  padding: 0.5rem 0.75rem;
  border-radius: 0 0 8px 8px;
  font-size: 0.875rem;
  border: 1px solid var(--border-light, #e5e9ef);
  box-shadow: var(--shadow-soft, 0 2px 8px rgba(0, 0, 0, 0.1));
  opacity: 0;
  transform: translateY(-5px);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  white-space: nowrap;
}

.reading-progress-bar:hover .reading-progress-tooltip {
  opacity: 1;
  transform: translateY(0);
}

.reading-progress-text {
  font-weight: 600;
  margin-right: 0.5rem;
}

.reading-time-remaining {
  color: var(--text-secondary, #5a6c7e);
  font-size: 0.8rem;
}

/* Reading Time Indicator */
.reading-time-indicator {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin: 1rem 0 2rem 0;
  padding: 0.75rem 1rem;
  background: var(--bg-secondary, #f8f9fb);
  border-radius: var(--border-radius, 8px);
  border-left: 4px solid var(--primary-color, #4f80c7);
  font-size: 0.9rem;
  color: var(--text-secondary, #5a6c7e);
}

.reading-time-icon {
  font-size: 1.1rem;
}

.reading-time-text {
  font-weight: 500;
  color: var(--text-color, #3a4a5c);
}

.word-count {
  font-size: 0.8rem;
  opacity: 0.8;
}

/* Reading Controls */
.reading-controls {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  background: var(--bg-color, #fafbfc);
  border-radius: 12px;
  padding: 0.5rem;
  box-shadow: var(--shadow-medium, 0 4px 16px rgba(0, 0, 0, 0.15));
  border: 1px solid var(--border-light, #e5e9ef);
  z-index: 999;
  opacity: 0;
  transform: translateX(100%) translateY(-50%);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
}

.reading-controls:hover,
.reading-controls.active {
  opacity: 1;
  transform: translateX(0) translateY(-50%);
}

/* Show controls on scroll */
.reading-controls.visible {
  opacity: 0.7;
  transform: translateX(-10px) translateY(-50%);
}

.reading-controls.visible:hover {
  opacity: 1;
  transform: translateX(0) translateY(-50%);
}

.reading-control-btn {
  display: block;
  width: 44px;
  height: 44px;
  border: none;
  background: transparent;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
  margin: 2px 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  color: var(--text-secondary, #5a6c7e);
}

.reading-control-btn:hover {
  background: var(--primary-color, #4f80c7);
  color: white;
  transform: scale(1.05);
}

.reading-control-btn:active {
  transform: scale(0.95);
}

.reading-control-btn .icon {
  font-size: 0.9rem;
  font-weight: 500;
}

/* Reading Mode Styles */
.reading-mode-active {
  background: #fefefe !important;
  color: #2c3e50 !important;
}

.reading-mode-active .header {
  background: rgba(255, 255, 255, 0.95) !important;
  backdrop-filter: blur(10px);
  border-bottom: 1px solid #e5e9ef;
}

.reading-mode-active .footer {
  background: #f8f9fa !important;
  border-top: 1px solid #e5e9ef;
}

.reading-mode-active article,
.reading-mode-active .article-content,
.reading-mode-active main {
  max-width: 720px;
  margin-left: auto;
  margin-right: auto;
  padding-left: 2rem;
  padding-right: 2rem;
}

.reading-mode-active h1,
.reading-mode-active h2,
.reading-mode-active h3,
.reading-mode-active h4,
.reading-mode-active h5,
.reading-mode-active h6 {
  color: #2c3e50 !important;
  line-height: 1.4 !important;
}

.reading-mode-active p {
  line-height: 1.8 !important;
  margin-bottom: 1.5rem !important;
  color: #2c3e50 !important;
}

.reading-mode-active a {
  color: var(--primary-color, #4f80c7) !important;
  text-decoration: underline !important;
}

.reading-mode-active code {
  background: #f1f3f4 !important;
  padding: 0.2em 0.4em !important;
  border-radius: 4px !important;
  font-family: 'Courier New', monospace !important;
}

.reading-mode-active pre {
  background: #f8f9fa !important;
  border: 1px solid #e5e9ef !important;
  border-radius: 8px !important;
  padding: 1rem !important;
  margin: 1.5rem 0 !important;
}

/* Reading Notification */
.reading-notification {
  position: fixed;
  top: 100px;
  right: 20px;
  background: var(--primary-color, #4f80c7);
  color: white;
  padding: 0.75rem 1rem;
  border-radius: 8px;
  box-shadow: var(--shadow-medium, 0 4px 16px rgba(0, 0, 0, 0.15));
  z-index: 1001;
  opacity: 0;
  transform: translateX(100%);
  transition:
    opacity 0.3s ease,
    transform 0.3s ease;
  font-size: 0.9rem;
  font-weight: 500;
}

.reading-notification.show {
  opacity: 1;
  transform: translateX(0);
}

/* Responsive Design */
@media (max-width: 768px) {
  .reading-controls {
    right: 10px;
    scale: 0.9;
  }

  .reading-control-btn {
    width: 40px;
    height: 40px;
  }

  .reading-time-indicator {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.25rem;
    padding: 0.75rem;
    margin: 0.75rem 0 1.5rem 0;
  }

  .reading-progress-tooltip {
    right: 5px;
    font-size: 0.8rem;
    padding: 0.375rem 0.5rem;
  }

  .reading-mode-active article,
  .reading-mode-active .article-content,
  .reading-mode-active main {
    padding-left: 1rem;
    padding-right: 1rem;
  }
}

/* High Contrast Mode Support */
@media (prefers-contrast: high) {
  .reading-progress-fill {
    background: #000 !important;
  }

  .reading-controls {
    border: 2px solid #000 !important;
    background: #fff !important;
  }

  .reading-control-btn {
    border: 1px solid #000 !important;
  }

  .reading-control-btn:hover {
    background: #000 !important;
    color: #fff !important;
  }
}

/* Reduced Motion Support */
@media (prefers-reduced-motion: reduce) {
  .reading-progress-fill,
  .reading-controls,
  .reading-control-btn,
  .reading-notification,
  .reading-progress-tooltip {
    transition: none !important;
    animation: none !important;
  }

  .reading-control-btn:hover,
  .reading-control-btn:active {
    transform: none !important;
  }
}

/* Print Styles */
@media print {
  .reading-progress-bar,
  .reading-controls,
  .reading-notification {
    display: none !important;
  }

  .reading-time-indicator {
    border: 1px solid #ccc !important;
    background: transparent !important;
  }
}

/* Dark mode considerations (if implemented later) */
@media (prefers-color-scheme: dark) {
  .reading-mode-active {
    background: #1e1e1e !important;
    color: #e0e0e0 !important;
  }

  .reading-mode-active h1,
  .reading-mode-active h2,
  .reading-mode-active h3,
  .reading-mode-active h4,
  .reading-mode-active h5,
  .reading-mode-active h6,
  .reading-mode-active p {
    color: #e0e0e0 !important;
  }

  .reading-mode-active code {
    background: #2d2d2d !important;
    color: #e0e0e0 !important;
  }

  .reading-mode-active pre {
    background: #2d2d2d !important;
    border-color: #404040 !important;
    color: #e0e0e0 !important;
  }
}
