/* ============================================
   ARTICLE PAGE STYLES
   Magazine-style layout with TTS player
   ============================================ */

/* Reading Progress */
.article-reading-progress {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: rgba(0, 0, 0, 0.1);
  z-index: 9999;
}

.article-reading-progress__fill {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4a6fa5, #d6bd9f);
  transition: width 0.1s ease-out;
}

[data-theme="dark"] .article-reading-progress {
  background: rgba(255, 255, 255, 0.1);
}

/* Header - Use tan/gold to match site footer */
.article-header {
  background: #d6bd9f;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  padding: 16px 0;
  position: sticky;
  top: 4px;
  z-index: 100;
}

[data-theme="dark"] .article-header {
  background: #252542;
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.article-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  flex-wrap: wrap;
  gap: 12px;
}

.article-back-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #4a6fa5;
  text-decoration: none;
  font-weight: 500;
  padding: 8px 16px;
  border-radius: 20px;
  background: rgba(74, 111, 165, 0.1);
  transition: all 0.2s ease;
}

.article-back-link:hover {
  background: #4a6fa5;
  color: #fff;
}

[data-theme="dark"] .article-back-link {
  color: #d6bd9f;
  background: rgba(214, 189, 159, 0.1);
}

[data-theme="dark"] .article-back-link:hover {
  background: #d6bd9f;
  color: #1a1a2e;
}

.article-source-link {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  color: #666;
  text-decoration: none;
  font-size: 0.9rem;
  transition: color 0.2s;
}

.article-source-link:hover {
  color: #4a6fa5;
}

[data-theme="dark"] .article-source-link {
  color: #aaa;
}

[data-theme="dark"] .article-source-link:hover {
  color: #d6bd9f;
}

/* Main */
.article-main {
  padding-bottom: 60px;
  overflow-x: visible; /* Override main style.css to enable sticky TOC */
}

.article-container {
  max-width: 1200px;
  margin: 0 auto;
  padding: 0 20px;
  overflow-x: visible; /* Override main style.css to enable sticky TOC */
}

/* Ensure article layout allows sticky positioning */
.article-layout {
  overflow: visible;
}

/* Hero */
.article-hero {
  position: relative;
  width: 100%;
  height: 400px;
  border-radius: 16px;
  overflow: hidden;
  margin-bottom: 32px;
}

.article-hero__img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.article-hero__overlay {
  position: absolute;
  inset: 0;
  background: linear-gradient(to top, rgba(0,0,0,0.85) 0%, rgba(0,0,0,0.5) 40%, rgba(0,0,0,0.2) 70%, transparent 100%);
}

.article-hero__content {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  padding: 32px;
  color: #fff;
}

.article-meta {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 12px;
  font-size: 0.9rem;
  flex-wrap: wrap;
}

.article-category {
  background: #d6bd9f;
  color: #1a1a2e;
  padding: 4px 12px;
  border-radius: 12px;
  font-weight: 600;
  font-size: 0.8rem;
  text-transform: uppercase;
}

.article-meta__dot {
  opacity: 0.6;
}

.article-title {
  font-size: 2.5rem;
  font-weight: 700;
  line-height: 1.2;
  margin-bottom: 12px;
  text-shadow: 0 2px 10px rgba(0,0,0,0.5);
  color: #fff;
}

.article-subtitle {
  font-size: 1.1rem;
  line-height: 1.6;
  max-width: 700px;
  color: #fff;
  text-shadow: 0 1px 6px rgba(0,0,0,0.4);
}

/* TTS Player - Use warm site colors instead of blue */
.article-tts-player {
  background: linear-gradient(135deg, #3d3a50 0%, #2d2b3d 100%);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 32px;
  color: #fff;
  box-shadow: 0 8px 32px rgba(61, 58, 80, 0.3);
}

[data-theme="dark"] .article-tts-player {
  background: linear-gradient(135deg, #252542 0%, #1a1a2e 100%);
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

.tts-player__header {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-bottom: 20px;
}

.tts-player__icon {
  font-size: 1.5rem;
}

.tts-player__title {
  font-size: 1.1rem;
  font-weight: 600;
}

.tts-player__controls {
  display: flex;
  justify-content: center;
  align-items: center;
  gap: 12px;
  margin-bottom: 20px;
}

.tts-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 48px;
  height: 48px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.9);
  color: #3d3a50;
  font-size: 1.1rem;
  cursor: pointer;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.tts-btn i,
.tts-btn svg {
  display: flex;
  align-items: center;
  justify-content: center;
  fill: currentColor;
}

.tts-btn:hover {
  background: #d6bd9f;
  color: #1a1a2e;
  transform: scale(1.08);
}

.tts-btn:focus-visible {
  outline: 3px solid #d6bd9f;
  outline-offset: 2px;
}

.tts-btn--play,
.tts-btn--pause {
  width: 64px;
  height: 64px;
  font-size: 1.5rem;
  background: #fff;
  color: #3d3a50;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
}

.tts-btn--play:hover,
.tts-btn--pause:hover {
  background: #d6bd9f;
  color: #1a1a2e;
}

[data-theme="dark"] .tts-btn {
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
}

[data-theme="dark"] .tts-btn:hover {
  background: #d6bd9f;
  color: #1a1a2e;
}

[data-theme="dark"] .tts-btn--play,
[data-theme="dark"] .tts-btn--pause {
  background: #d6bd9f;
  color: #1a1a2e;
}

.tts-btn--stop {
  background: #ff7b7b;
  color: #fff;
}

.tts-btn--stop:hover {
  background: #ff5252;
}

[data-theme="dark"] .tts-btn--stop {
  background: #ff6b6b;
  color: #fff;
}

.tts-btn--skip {
  width: 44px;
  height: 44px;
  font-size: 1rem;
}

.tts-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.tts-player__progress {
  margin-bottom: 16px;
}

.tts-progress-bar {
  width: 100%;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  overflow: hidden;
  margin-bottom: 8px;
}

.tts-progress-bar__fill {
  height: 100%;
  width: 0%;
  background: #d6bd9f;
  border-radius: 3px;
  transition: width 0.3s ease;
}

.tts-status {
  font-size: 0.85rem;
  opacity: 0.8;
}

.tts-player__speed {
  display: flex;
  align-items: center;
  gap: 10px;
  font-size: 0.9rem;
}

.tts-speed-select {
  padding: 6px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.9rem;
  cursor: pointer;
}

.tts-speed-select option {
  background: #3d3a50;
  color: #fff;
}

.tts-hint {
  margin-top: 12px;
  font-size: 0.8rem;
  opacity: 0.6;
}

/* Article Layout - TOC on left, Article on right with proper spacing */
.article-layout {
  display: grid;
  grid-template-columns: 280px 1fr;
  gap: 40px;
  padding: 32px 20px;
  max-width: 1200px;
  margin: 0 auto;
}

/* TOC sticks to viewport while scrolling */
.article-toc {
  width: 100%;
  position: sticky;
  top: 100px;
  max-height: calc(100vh - 120px);
  overflow-y: auto;
  align-self: start;
}

/* When TOC is hidden, article takes full width and centers */
.article-layout.toc-hidden {
  grid-template-columns: 1fr;
  max-width: 800px;
}

.article-layout.toc-hidden .article-toc {
  display: none;
}

/* Article content container with subtle background for readability */
.article-content {
  max-width: 720px;
  background: #fff;
  padding: 32px;
  border-radius: 12px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.06);
  user-select: text;
  -webkit-user-select: text;
  -moz-user-select: text;
  -ms-user-select: text;
}

[data-theme="dark"] .article-content {
  background: #1e1e32;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

@media (max-width: 900px) {
  .article-layout {
    grid-template-columns: 1fr;
    padding: 16px;
  }
  
  /* Hide desktop TOC on mobile, show mobile toggle */
  .article-toc {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    top: auto;
    max-height: 60vh;
    border-radius: 20px 20px 0 0;
    z-index: 1000;
    transform: translateY(100%);
    transition: transform 0.3s ease, opacity 0.3s ease;
    opacity: 0;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
  }
  
  .article-toc.mobile-visible {
    display: block;
    transform: translateY(0);
    opacity: 1;
  }
  
  .article-toc.collapsed {
    width: auto;
    padding: 16px;
  }
  
  .article-toc.collapsed .article-toc__text {
    display: inline;
  }
  
  .article-toc.collapsed .article-toc__pill {
    width: auto;
    height: auto;
    padding: 10px 14px;
  }
  
  .article-toc.collapsed .article-toc__num {
    margin-right: 10px;
  }
  
  .article-toc__header {
    padding-bottom: 12px;
  }
  
  .article-toc__toggle {
    display: none;
  }
}

/* Mobile TOC Toggle Button */
.mobile-toc-toggle {
  display: none;
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  border-radius: 50%;
  background: #4a6fa5;
  color: #fff;
  border: none;
  box-shadow: 0 4px 16px rgba(74, 111, 165, 0.35);
  cursor: pointer;
  z-index: 999;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.mobile-toc-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 20px rgba(74, 111, 165, 0.4);
}

.mobile-toc-toggle:active {
  transform: scale(0.95);
}

.mobile-toc-toggle svg {
  width: 24px;
  height: 24px;
}

.mobile-toc-toggle.active {
  background: #d6bd9f;
  color: #1a1a2e;
}

[data-theme="dark"] .mobile-toc-toggle {
  background: #d6bd9f;
  color: #1a1a2e;
  box-shadow: 0 4px 16px rgba(214, 189, 159, 0.35);
}

[data-theme="dark"] .mobile-toc-toggle:hover {
  box-shadow: 0 6px 20px rgba(214, 189, 159, 0.4);
}

[data-theme="dark"] .mobile-toc-toggle.active {
  background: #4a6fa5;
  color: #fff;
}

/* Mobile TOC Overlay */
.mobile-toc-overlay {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 998;
  opacity: 0;
  transition: opacity 0.3s ease;
}

.mobile-toc-overlay.visible {
  display: block;
  opacity: 1;
}

[data-theme="dark"] .mobile-toc-overlay {
  background: rgba(0, 0, 0, 0.7);
}

/* Mobile TOC Close Button */
.mobile-toc-close {
  position: absolute;
  top: 12px;
  right: 12px;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #f0f0f0;
  border: none;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  color: #666;
  transition: all 0.2s ease;
}

.mobile-toc-close:hover {
  background: #e0e0e0;
  color: #333;
}

[data-theme="dark"] .mobile-toc-close {
  background: #3d3a50;
  color: #aaa;
}

[data-theme="dark"] .mobile-toc-close:hover {
  background: #4d4a60;
  color: #fff;
}

@media (max-width: 900px) {
  .mobile-toc-toggle {
    display: flex;
  }
  
  .mobile-toc-close {
    display: flex;
  }
}

/* Reduced motion for mobile */
@media (prefers-reduced-motion: reduce) {
  .article-toc,
  .mobile-toc-toggle,
  .mobile-toc-overlay {
    transition: none;
  }
}

/* Table of Contents - Pill Navigation Design */
/* Note: sticky positioning is set in Article Layout section above */
.article-toc {
  background: #ffffff;
  border-radius: 16px;
  padding: 16px;
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.08);
  border: 1px solid rgba(0, 0, 0, 0.06);
  display: flex;
  flex-direction: column;
  transition: all 0.3s ease;
}

/* Collapsed state - hide completely */
.article-toc.collapsed {
  display: none;
}

[data-theme="dark"] .article-toc {
  background: #2d2b3d;
  border-color: rgba(255, 255, 255, 0.08);
  box-shadow: 0 2px 12px rgba(0, 0, 0, 0.3);
}

/* TOC Header with Progress and Toggle */
.article-toc__header {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
  flex-shrink: 0;
}

[data-theme="dark"] .article-toc__header {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

/* Progress Bar */
.article-toc__progress {
  flex: 1;
  height: 4px;
  background: #e8e8e8;
  border-radius: 4px;
  overflow: hidden;
}

[data-theme="dark"] .article-toc__progress {
  background: #3d3a50;
}

.article-toc__progress-bar {
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #4a6fa5, #6b8fc7);
  border-radius: 4px;
  transition: width 0.2s ease;
}

[data-theme="dark"] .article-toc__progress-bar {
  background: linear-gradient(90deg, #d6bd9f, #e8d4bc);
}

/* Toggle Button */
.article-toc__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  border: none;
  background: #f0f0f0;
  border-radius: 8px;
  cursor: pointer;
  color: #666;
  transition: all 0.2s ease;
  flex-shrink: 0;
}

.article-toc__toggle:hover {
  background: #e0e0e0;
  color: #333;
}

.article-toc__toggle svg {
  transition: transform 0.3s ease;
}

[data-theme="dark"] .article-toc__toggle {
  background: #3d3a50;
  color: #aaa;
}

[data-theme="dark"] .article-toc__toggle:hover {
  background: #4d4a60;
  color: #fff;
}

/* Floating TOC toggle button (appears when TOC is hidden) */
.article-toc-show-btn {
  position: fixed;
  bottom: 30px;
  left: 30px;
  height: 48px;
  padding: 0 20px;
  border-radius: 24px;
  background: linear-gradient(135deg, #4a6fa5, #6b8fc7);
  color: white;
  border: 2px solid white;
  cursor: pointer;
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  transition: transform 0.2s ease, box-shadow 0.2s ease;
  animation: tocBtnPulse 2s ease-in-out infinite;
}

@keyframes tocBtnPulse {
  0%, 100% { box-shadow: 0 4px 20px rgba(74, 111, 165, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(74, 111, 165, 0.7); }
}

.article-toc-show-btn:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.4);
  animation: none;
}

.article-toc-show-btn.visible {
  display: flex;
}

[data-theme="dark"] .article-toc-show-btn {
  background: linear-gradient(135deg, #d6bd9f, #c4a882);
  border-color: #2d2b3d;
  color: #2d2b3d;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.5);
}

[data-theme="dark"] .article-toc-show-btn:hover {
  box-shadow: 0 6px 24px rgba(0, 0, 0, 0.6);
}

@keyframes tocBtnPulseDark {
  0%, 100% { box-shadow: 0 4px 20px rgba(214, 189, 159, 0.4); }
  50% { box-shadow: 0 4px 30px rgba(214, 189, 159, 0.7); }
}

[data-theme="dark"] .article-toc-show-btn {
  animation: tocBtnPulseDark 2s ease-in-out infinite;
}

/* List Styles */
.article-toc__list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.article-toc__list li {
  margin: 0;
}

/* Pill Navigation Links */
.article-toc__pill {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  color: #555;
  text-decoration: none;
  font-size: 0.85rem;
  font-weight: 500;
  border-radius: 50px;
  background: #f5f5f5;
  transition: all 0.2s ease;
  border: 1px solid transparent;
}

.article-toc__pill:hover {
  background: #e8f0f8;
  color: #4a6fa5;
  transform: translateX(4px);
}

.article-toc__pill.active {
  background: #4a6fa5;
  color: #fff;
  border-color: #4a6fa5;
  box-shadow: 0 2px 8px rgba(74, 111, 165, 0.25);
}

.article-toc__pill.active:hover {
  transform: translateX(4px);
  background: #3d5f8a;
}

/* Number Badge */
.article-toc__num {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 22px;
  height: 22px;
  background: rgba(0, 0, 0, 0.08);
  border-radius: 50%;
  font-size: 0.75rem;
  font-weight: 600;
  margin-right: 10px;
  flex-shrink: 0;
  transition: all 0.2s ease;
}

.article-toc__pill:hover .article-toc__num {
  background: rgba(74, 111, 165, 0.15);
  color: #4a6fa5;
}

.article-toc__pill.active .article-toc__num {
  background: rgba(255, 255, 255, 0.2);
  color: #fff;
}

/* Text Label */
.article-toc__text {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  transition: opacity 0.2s ease;
}

/* Dark Mode Pill Styles */
[data-theme="dark"] .article-toc__pill {
  background: #3d3a50;
  color: #ccc;
}

[data-theme="dark"] .article-toc__pill:hover {
  background: #4d4a60;
  color: #d6bd9f;
}

[data-theme="dark"] .article-toc__pill.active {
  background: #d6bd9f;
  color: #1a1a2e;
  border-color: #d6bd9f;
  box-shadow: 0 2px 8px rgba(214, 189, 159, 0.25);
}

[data-theme="dark"] .article-toc__pill.active:hover {
  background: #c9ad8f;
}

[data-theme="dark"] .article-toc__num {
  background: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .article-toc__pill:hover .article-toc__num {
  background: rgba(214, 189, 159, 0.2);
  color: #d6bd9f;
}

[data-theme="dark"] .article-toc__pill.active .article-toc__num {
  background: rgba(0, 0, 0, 0.15);
  color: #1a1a2e;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .article-toc,
  .article-toc__pill,
  .article-toc__toggle svg,
  .article-toc__progress-bar,
  .article-toc__num,
  .article-toc__nav {
    transition: none;
  }
  
  .article-toc__pill:hover,
  .article-toc__pill.active:hover {
    transform: none;
  }
}

/* ===== ENHANCED TOC FEATURES ===== */

/* Enhanced Content Container */
.article-toc__enhanced {
  margin-bottom: 12px;
}

/* Reading Time Badge per Section */
.article-toc__time {
  font-size: 0.65rem;
  color: #888;
  background: rgba(0, 0, 0, 0.05);
  padding: 2px 6px;
  border-radius: 10px;
  margin-left: auto;
  flex-shrink: 0;
  font-weight: 500;
}

[data-theme="dark"] .article-toc__time {
  background: rgba(255, 255, 255, 0.08);
  color: #aaa;
}

.article-toc__pill.active .article-toc__time {
  background: rgba(255, 255, 255, 0.2);
  color: rgba(255, 255, 255, 0.9);
}

[data-theme="dark"] .article-toc__pill.active .article-toc__time {
  background: rgba(0, 0, 0, 0.15);
  color: rgba(0, 0, 0, 0.7);
}

/* Section Completion Checkmark */
.article-toc__check {
  display: none;
  width: 16px;
  height: 16px;
  margin-left: 8px;
  color: #22c55e;
  flex-shrink: 0;
  opacity: 0;
  transform: scale(0.5);
  transition: opacity 0.3s ease, transform 0.3s ease;
}

.article-toc__pill.completed .article-toc__check {
  display: flex;
  opacity: 1;
  transform: scale(1);
}

.article-toc__pill.completed {
  opacity: 0.7;
}

.article-toc__pill.completed:hover {
  opacity: 1;
}

/* Scroll Position Indicator */
.article-toc__position-indicator {
  position: absolute;
  left: 0;
  width: 3px;
  background: linear-gradient(180deg, #4a6fa5, #6b8fc7);
  border-radius: 3px;
  transition: top 0.15s ease, height 0.15s ease;
  z-index: 1;
}

[data-theme="dark"] .article-toc__position-indicator {
  background: linear-gradient(180deg, #d6bd9f, #e8d4bc);
}

.article-toc__nav {
  position: relative;
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  overflow-x: hidden;
  scrollbar-width: thin;
  scrollbar-color: rgba(0, 0, 0, 0.2) transparent;
}

.article-toc__nav::-webkit-scrollbar {
  width: 6px;
}

.article-toc__nav::-webkit-scrollbar-track {
  background: transparent;
}

.article-toc__nav::-webkit-scrollbar-thumb {
  background: rgba(0, 0, 0, 0.2);
  border-radius: 3px;
}

.article-toc__nav::-webkit-scrollbar-thumb:hover {
  background: rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .article-toc__nav {
  scrollbar-color: rgba(255, 255, 255, 0.2) transparent;
}

[data-theme="dark"] .article-toc__nav::-webkit-scrollbar-thumb {
  background: rgba(255, 255, 255, 0.2);
}

[data-theme="dark"] .article-toc__nav::-webkit-scrollbar-thumb:hover {
  background: rgba(255, 255, 255, 0.3);
}

/* Jump Navigation Buttons */
.article-toc__jump-btns {
  display: flex;
  gap: 8px;
  margin-top: 12px;
  padding-top: 12px;
  border-top: 1px solid rgba(0, 0, 0, 0.06);
}

[data-theme="dark"] .article-toc__jump-btns {
  border-top-color: rgba(255, 255, 255, 0.08);
}

.article-toc__jump-btn {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  padding: 8px 12px;
  background: #f0f0f0;
  border: none;
  border-radius: 8px;
  font-size: 0.75rem;
  font-weight: 500;
  color: #555;
  cursor: pointer;
  transition: all 0.2s ease;
}

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

.article-toc__jump-btn svg {
  width: 14px;
  height: 14px;
}

[data-theme="dark"] .article-toc__jump-btn {
  background: #3d3a50;
  color: #aaa;
}

[data-theme="dark"] .article-toc__jump-btn:hover {
  background: #4d4a60;
  color: #fff;
}

/* Section Preview Tooltip */
.article-toc__preview {
  position: absolute;
  left: calc(100% + 12px);
  top: 50%;
  transform: translateY(-50%);
  width: 280px;
  padding: 12px 16px;
  background: #fff;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.08);
  font-size: 0.85rem;
  line-height: 1.5;
  color: #555;
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.2s ease, visibility 0.2s ease;
  z-index: 100;
  pointer-events: none;
}

.article-toc__preview::before {
  content: '';
  position: absolute;
  left: -8px;
  top: 50%;
  transform: translateY(-50%);
  border: 8px solid transparent;
  border-right-color: #fff;
  border-left: none;
}

.article-toc__pill:hover .article-toc__preview {
  opacity: 1;
  visibility: visible;
}

[data-theme="dark"] .article-toc__preview {
  background: #3d3a50;
  color: #ccc;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .article-toc__preview::before {
  border-right-color: #3d3a50;
}

/* Bookmarkable Sections */
.article-toc__bookmark {
  width: 18px;
  height: 18px;
  margin-left: 6px;
  padding: 0;
  background: none;
  border: none;
  color: #aaa;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease, color 0.2s ease;
  flex-shrink: 0;
}

.article-toc__pill:hover .article-toc__bookmark {
  opacity: 1;
}

.article-toc__bookmark:hover {
  color: #f59e0b;
}

.article-toc__bookmark.bookmarked {
  opacity: 1;
  color: #f59e0b;
}

.article-toc__bookmark svg {
  width: 14px;
  height: 14px;
}

/* Resume Reading Prompt */
.article-toc__resume {
  display: none;
  align-items: center;
  gap: 8px;
  padding: 10px 14px;
  margin-bottom: 12px;
  background: linear-gradient(135deg, #fef3c7, #fde68a);
  border-radius: 10px;
  font-size: 0.8rem;
  color: #92400e;
  cursor: pointer;
  transition: all 0.2s ease;
  border: 1px solid rgba(146, 64, 14, 0.1);
}

.article-toc__resume:hover {
  background: linear-gradient(135deg, #fde68a, #fcd34d);
  transform: translateX(4px);
}

.article-toc__resume.visible {
  display: flex;
}

.article-toc__resume svg {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
}

.article-toc__resume-text {
  flex: 1;
}

.article-toc__resume-section {
  font-weight: 600;
}

.article-toc__resume-dismiss {
  padding: 4px;
  background: none;
  border: none;
  color: #92400e;
  cursor: pointer;
  opacity: 0.6;
  transition: opacity 0.2s ease;
}

.article-toc__resume-dismiss:hover {
  opacity: 1;
}

[data-theme="dark"] .article-toc__resume {
  background: linear-gradient(135deg, #3d3a50, #4d4a60);
  color: #d6bd9f;
  border-color: rgba(214, 189, 159, 0.2);
}

[data-theme="dark"] .article-toc__resume:hover {
  background: linear-gradient(135deg, #4d4a60, #5d5a70);
}

[data-theme="dark"] .article-toc__resume-dismiss {
  color: #d6bd9f;
}

/* Mini-map Visual */
.article-toc__minimap {
  display: flex;
  flex-direction: row;
  gap: 3px;
  padding: 8px 0;
  margin-bottom: 8px;
}

[data-theme="dark"] .article-toc__minimap {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.article-toc__minimap-section {
  height: 6px;
  min-width: 8px;
  background: #e8e8e8;
  border-radius: 3px;
  position: relative;
  transition: background 0.2s ease;
  cursor: pointer;
  flex: 1;
}

.article-toc__minimap-section:hover {
  background: #d0d0d0;
}

.article-toc__minimap-section.active {
  background: #4a6fa5;
}

.article-toc__minimap-section.completed {
  background: #22c55e;
}

.article-toc__minimap-section.completed.active {
  background: #16a34a;
}

[data-theme="dark"] .article-toc__minimap-section {
  background: #3d3a50;
}

[data-theme="dark"] .article-toc__minimap-section:hover {
  background: #4d4a60;
}

[data-theme="dark"] .article-toc__minimap-section.active {
  background: #d6bd9f;
}

/* Minimap Reading Position Marker */
.article-toc__minimap-marker {
  position: absolute;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(74, 111, 165, 0.3);
  border-radius: 2px;
  transition: width 0.1s ease;
}

[data-theme="dark"] .article-toc__minimap-marker {
  background: rgba(214, 189, 159, 0.3);
}

/* Keyboard Focus Styles */
.article-toc__pill:focus {
  outline: 2px solid #4a6fa5;
  outline-offset: 2px;
}

.article-toc__pill:focus:not(:focus-visible) {
  outline: none;
}

[data-theme="dark"] .article-toc__pill:focus {
  outline-color: #d6bd9f;
}

/* Collapsed State - Hide Extra Elements */
.article-toc.collapsed .article-toc__time,
.article-toc.collapsed .article-toc__check,
.article-toc.collapsed .article-toc__bookmark,
.article-toc.collapsed .article-toc__preview,
.article-toc.collapsed .article-toc__jump-btns,
.article-toc.collapsed .article-toc__minimap,
.article-toc.collapsed .article-toc__resume,
.article-toc.collapsed .article-toc__position-indicator {
  display: none;
}

/* Mobile Swipe Indicator */
.article-toc__swipe-indicator {
  display: none;
  width: 40px;
  height: 4px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 2px;
  margin: 0 auto 12px;
}

[data-theme="dark"] .article-toc__swipe-indicator {
  background: rgba(255, 255, 255, 0.2);
}

@media (max-width: 900px) {
  .article-toc__swipe-indicator {
    display: block;
  }
  
  .article-toc__preview {
    display: none !important;
  }
  
  .article-toc__bookmark {
    opacity: 1;
  }
  
  .article-toc__position-indicator {
    display: none;
  }
}

/* Reduced Motion for New Features */
@media (prefers-reduced-motion: reduce) {
  .article-toc__check,
  .article-toc__preview,
  .article-toc__resume,
  .article-toc__minimap-section,
  .article-toc__position-indicator,
  .article-toc__bookmark {
    transition: none;
  }
}


.article-content section {
  margin-bottom: 48px;
}

.article-content h2 {
  font-size: 1.8rem;
  font-weight: 700;
  color: #1a1a2e;
  margin-bottom: 24px;
  padding-top: 24px;
  border-top: 1px solid rgba(0, 0, 0, 0.08);
  line-height: 1.3;
}

.article-content section:first-child h2 {
  border-top: none;
  padding-top: 0;
}

[data-theme="dark"] .article-content h2 {
  color: #fff;
  border-top-color: rgba(255, 255, 255, 0.1);
}

.article-content h3 {
  font-size: 1.3rem;
  font-weight: 600;
  color: #333;
  margin: 28px 0 16px;
  line-height: 1.4;
}

[data-theme="dark"] .article-content h3 {
  color: #e0e0e0;
}

.article-content p {
  font-size: 1.1rem;
  line-height: 1.9;
  color: #333;
  margin-bottom: 24px;
  letter-spacing: 0.01em;
}

[data-theme="dark"] .article-content p {
  color: #d0d0d0;
}

.article-content ul {
  margin: 16px 0;
  padding-left: 24px;
}

.article-content li {
  font-size: 1.05rem;
  line-height: 1.85;
  color: #333;
  margin-bottom: 14px;
  padding-left: 8px;
}

[data-theme="dark"] .article-content li {
  color: #d0d0d0;
}

.article-content strong {
  color: #1a1a2e;
}

[data-theme="dark"] .article-content strong {
  color: #fff;
}

/* TTS Reading Highlight - Smooth transitions */
.article-content h2,
.article-content h3,
.article-content p,
.article-content li {
  transition: background-color 0.4s ease, box-shadow 0.4s ease, transform 0.3s ease;
}

.tts-reading {
  background: rgba(74, 111, 165, 0.12);
  border-radius: 12px;
  box-shadow: inset 0 0 0 2px rgba(74, 111, 165, 0.25);
  animation: tts-glow 1.5s ease-in-out infinite;
}

@keyframes tts-glow {
  0%, 100% { box-shadow: inset 0 0 0 2px rgba(74, 111, 165, 0.25); }
  50% { box-shadow: inset 0 0 0 2px rgba(74, 111, 165, 0.45); }
}

[data-theme="dark"] .tts-reading {
  background: rgba(214, 189, 159, 0.15);
  box-shadow: inset 0 0 0 2px rgba(214, 189, 159, 0.25);
}


@media (prefers-reduced-motion: reduce) {
  .tts-reading {
    animation: none;
  }
}

/* Word-level TTS highlighting */
.tts-word {
  display: inline;
  transition: background-color 0.15s ease, color 0.15s ease;
  border-radius: 4px;
}

.tts-word.tts-current-word {
  background: linear-gradient(135deg, #4a6fa5, #5a7fb5);
  color: #fff;
  padding: 1px 4px;
  margin: 0 -2px;
  border-radius: 4px;
  box-shadow: 0 2px 8px rgba(74, 111, 165, 0.4);
}

[data-theme="dark"] .tts-word.tts-current-word {
  background: linear-gradient(135deg, #d6bd9f, #c4ab8d);
  color: #1a1a2e;
}

/* TTS Engine Toggle Button */
.tts-engine-toggle {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  background: linear-gradient(135deg, #d6bd9f 0%, #b89b5e 100%);
  color: #1a1a2e;
  border: none;
  border-radius: 20px;
  font-size: 0.8rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.2s ease;
  margin-left: auto;
}

.tts-engine-toggle:hover {
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(214, 189, 159, 0.4);
}

/* TTS Voice Selector */
.tts-player__voice {
  display: flex;
  align-items: center;
  gap: 8px;
}

.tts-player__voice label {
  font-size: 0.9rem;
  color: rgba(255, 255, 255, 0.9);
}

.tts-voice-select {
  padding: 6px 10px;
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  font-size: 0.85rem;
  cursor: pointer;
  min-width: 120px;
}

.tts-voice-select option {
  background: #1a1a2e;
  color: #fff;
}

/* TTS Player Enhanced Controls */
.tts-player__row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-bottom: 16px;
  flex-wrap: wrap;
}

.tts-player__volume {
  display: flex;
  align-items: center;
  gap: 10px;
  flex: 1;
  min-width: 180px;
}

.tts-volume-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.15);
  color: #fff;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tts-volume-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.tts-volume-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.tts-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  flex: 1;
  height: 6px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  outline: none;
  cursor: pointer;
}

.tts-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #d6bd9f;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
  transition: transform 0.15s ease;
}

.tts-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.2);
}

.tts-volume-slider::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border: none;
  border-radius: 50%;
  background: #d6bd9f;
  cursor: pointer;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.3);
}

.tts-volume-value {
  font-size: 0.8rem;
  opacity: 0.8;
  min-width: 36px;
  text-align: right;
}

.tts-player__options {
  display: flex;
  align-items: center;
  gap: 12px;
}

.tts-option-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 20px;
  background: transparent;
  color: rgba(255, 255, 255, 0.7);
  font-size: 0.8rem;
  cursor: pointer;
  transition: all 0.2s ease;
}

.tts-option-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
}

.tts-option-btn.active {
  background: #d6bd9f;
  color: #1a1a2e;
  border-color: #d6bd9f;
}

.tts-option-btn svg,
.sleep-timer-btn svg,
.tts-download-btn svg {
  width: 14px;
  height: 14px;
  fill: currentColor;
}

.tts-time-remaining {
  display: flex;
  align-items: center;
  gap: 6px;
  font-size: 0.85rem;
  opacity: 0.8;
}

.tts-time-remaining svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
  opacity: 0.7;
}

/* Responsive TTS player */
@media (max-width: 600px) {
  .tts-player__row {
    flex-direction: column;
    align-items: stretch;
  }
  
  .tts-player__volume {
    width: 100%;
  }
  
  .tts-player__options {
    justify-content: center;
  }
}

/* Article Footer */
.article-footer {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .article-footer {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.article-source-box {
  background: #f8f9fa;
  border-radius: 12px;
  padding: 24px;
  margin-bottom: 24px;
}

[data-theme="dark"] .article-source-box {
  background: #252542;
}

.article-source-box h3 {
  font-size: 1rem;
  font-weight: 700;
  margin-bottom: 16px;
  color: #333;
}

[data-theme="dark"] .article-source-box h3 {
  color: #fff;
}

.article-source-box ul {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-source-box li {
  margin-bottom: 8px;
}

.article-source-box a {
  color: #4a6fa5;
  text-decoration: none;
  font-size: 0.95rem;
}

.article-source-box a:hover {
  text-decoration: underline;
}

[data-theme="dark"] .article-source-box a {
  color: #d6bd9f;
}

.article-share {
  display: flex;
  align-items: center;
  gap: 16px;
}

.article-share span {
  font-size: 0.95rem;
  color: #666;
}

[data-theme="dark"] .article-share span {
  color: #aaa;
}

.article-share__buttons {
  display: flex;
  gap: 8px;
}

.share-btn {
  width: 40px;
  height: 40px;
  border: 1px solid #ddd;
  border-radius: 50%;
  background: #fff;
  color: #666;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.share-btn:hover {
  background: #4a6fa5;
  border-color: #4a6fa5;
  color: #fff;
}

[data-theme="dark"] .share-btn {
  background: #252542;
  border-color: #444;
  color: #aaa;
}

[data-theme="dark"] .share-btn:hover {
  background: #d6bd9f;
  border-color: #d6bd9f;
  color: #1a1a2e;
}

.share-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
}

/* Related Articles */
.article-related {
  margin-top: 48px;
  padding-top: 32px;
  border-top: 2px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .article-related {
  border-top-color: rgba(255, 255, 255, 0.1);
}

.article-related__title {
  font-size: 1.3rem;
  font-weight: 700;
  margin-bottom: 20px;
  color: #1a1a2e;
}

[data-theme="dark"] .article-related__title {
  color: #fff;
}

.article-related__grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(250px, 1fr));
  gap: 20px;
}

.related-card {
  background: #f8f9fa;
  border-radius: 12px;
  text-decoration: none;
  transition: all 0.2s ease;
  display: block;
  overflow: hidden;
}

.related-card:hover {
  background: #e9ecef;
  transform: translateY(-4px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12);
}

[data-theme="dark"] .related-card {
  background: #252542;
}

[data-theme="dark"] .related-card:hover {
  background: #303055;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
}

.related-card__img {
  width: 100%;
  height: 140px;
  object-fit: cover;
  display: block;
}

.related-card__content {
  padding: 16px;
}

.related-card__category {
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  color: #4a6fa5;
  margin-bottom: 8px;
}

[data-theme="dark"] .related-card__category {
  color: #d6bd9f;
}

.related-card__title {
  font-size: 1rem;
  font-weight: 600;
  color: #1a1a2e;
  margin-bottom: 6px;
  line-height: 1.4;
}

[data-theme="dark"] .related-card__title {
  color: #fff;
}

.related-card__meta {
  font-size: 0.8rem;
  color: #666;
}

[data-theme="dark"] .related-card__meta {
  color: #aaa;
}

/* Page Footer */
.article-page-footer {
  background: #f8f9fa;
  padding: 32px 20px;
  text-align: center;
}

[data-theme="dark"] .article-page-footer {
  background: #252542;
}

.footer-back-link {
  display: inline-block;
  color: #4a6fa5;
  text-decoration: none;
  font-weight: 600;
  margin-bottom: 16px;
}

[data-theme="dark"] .footer-back-link {
  color: #d6bd9f;
}

.footer-disclaimer {
  font-size: 0.85rem;
  color: #888;
  max-width: 600px;
  margin: 0 auto;
}

/* High Contrast Mode */
[data-high-contrast="true"] .article-tts-player {
  border: 3px solid #000;
}

[data-high-contrast="true"] .tts-btn {
  border: 2px solid #fff;
}

[data-high-contrast="true"] .article-content h2,
[data-high-contrast="true"] .article-content h3 {
  color: #000;
}

[data-high-contrast="true"] .article-content p,
[data-high-contrast="true"] .article-content li {
  color: #000;
}

[data-high-contrast="true"] .tts-reading {
  background: #ffeb3b;
}

[data-high-contrast="true"] .article-toc {
  border: 2px solid #000;
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
  .article-reading-progress__fill,
  .tts-progress-bar__fill,
  .tts-reading {
    transition: none;
  }
}

/* Mobile Responsive */
@media (max-width: 768px) {
  .article-hero {
    height: 300px;
    border-radius: 0;
    margin: 0 -20px 24px;
    width: calc(100% + 40px);
  }
  
  .article-hero__content {
    padding: 20px;
  }
  
  .article-title {
    font-size: 1.6rem;
  }
  
  .article-subtitle {
    font-size: 0.95rem;
  }
  
  .article-tts-player {
    padding: 16px;
    border-radius: 12px;
  }
  
  .tts-btn--play,
  .tts-btn--pause {
    width: 56px;
    height: 56px;
  }
  
  .tts-hint {
    display: none;
  }
  
  .article-content h2 {
    font-size: 1.5rem;
  }
  
  .article-content p {
    font-size: 1rem;
  }
}

/* ============================================
   READING CONTROLS PANEL
   Floating toolbar for reading customization
   ============================================ */

.reading-controls {
  position: fixed;
  right: 20px;
  top: 50%;
  transform: translateY(-50%);
  z-index: 90;
  display: flex;
  flex-direction: column;
  gap: 8px;
  background: #fff;
  padding: 12px;
  border-radius: 16px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid rgba(0, 0, 0, 0.08);
  transition: all 0.3s ease;
}

[data-theme="dark"] .reading-controls {
  background: #252542;
  border-color: rgba(255, 255, 255, 0.1);
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.4);
}

.reading-controls__toggle {
  position: absolute;
  left: -40px;
  top: 50%;
  transform: translateY(-50%);
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #d6bd9f;
  color: #1a1a2e;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
  transition: all 0.2s ease;
}

.reading-controls__toggle:hover {
  transform: translateY(-50%) scale(1.1);
}

.reading-controls.collapsed {
  transform: translateY(-50%) translateX(calc(100% + 30px));
}

.reading-controls.collapsed .reading-controls__toggle {
  left: -50px;
}

.reading-control-btn {
  width: 44px;
  height: 44px;
  border-radius: 12px;
  background: var(--bg-surface, #f5f5f5);
  color: var(--text-primary, #1a1a2e);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  position: relative;
}

.reading-control-btn:hover {
  background: #d6bd9f;
  color: #1a1a2e;
}

.reading-control-btn.active {
  background: #d6bd9f;
  color: #1a1a2e;
}

.reading-control-btn svg {
  width: 20px;
  height: 20px;
  fill: currentColor;
}

.reading-control-btn__tooltip {
  position: absolute;
  right: calc(100% + 10px);
  top: 50%;
  transform: translateY(-50%);
  background: #1a1a2e;
  color: #fff;
  padding: 6px 12px;
  border-radius: 6px;
  font-size: 0.75rem;
  white-space: nowrap;
  opacity: 0;
  visibility: hidden;
  transition: all 0.2s ease;
  pointer-events: none;
}

.reading-control-btn:hover .reading-control-btn__tooltip {
  opacity: 1;
  visibility: visible;
}

[data-theme="dark"] .reading-control-btn {
  background: #3d3a50;
  color: #e0e0e0;
}

[data-theme="dark"] .reading-control-btn:hover,
[data-theme="dark"] .reading-control-btn.active {
  background: #d6bd9f;
  color: #1a1a2e;
}

[data-theme="dark"] .reading-control-btn__tooltip {
  background: #fff;
  color: #1a1a2e;
}

/* Font Size Controls */
.reading-controls__font-size {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 8px 0;
  border-bottom: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}

.reading-controls__font-label {
  font-size: 0.65rem;
  text-transform: uppercase;
  color: var(--text-muted, #6c757d);
  letter-spacing: 0.5px;
}

.reading-controls__font-btns {
  display: flex;
  gap: 4px;
}

.reading-controls__font-btns button {
  width: 32px;
  height: 32px;
  border-radius: 8px;
  background: var(--bg-surface, #f5f5f5);
  color: var(--text-primary, #1a1a2e);
  border: none;
  cursor: pointer;
  font-weight: 600;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.reading-controls__font-btns button:hover {
  background: var(--accent-color, #4a6fa5);
  color: #fff;
}

[data-theme="dark"] .reading-controls__font-btns button {
  background: #3d3a50;
  color: #e0e0e0;
}

[data-theme="dark"] .reading-controls__font-btns button:hover {
  background: #d6bd9f;
  color: #1a1a2e;
}

/* Time Remaining Indicator */
.reading-controls__time {
  text-align: center;
  padding: 8px 0;
  border-top: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}

.reading-controls__time-value {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-primary, #1a1a2e);
}

.reading-controls__time-label {
  font-size: 0.65rem;
  color: var(--text-muted, #6c757d);
}

[data-theme="dark"] .reading-controls__time-value {
  color: #e0e0e0;
}

/* Reading Mode Styles */
body.article-reading-mode .header,
body.article-reading-mode .article-toc,
body.article-reading-mode .article-share,
body.article-reading-mode .article-related,
body.article-reading-mode .mb-footer {
  display: none !important;
}

body.article-reading-mode .article-layout {
  display: block;
}

body.article-reading-mode .article-content {
  max-width: 700px;
  margin: 0 auto;
}

body.article-reading-mode .article-main {
  padding-top: 40px;
}

/* Font Size Modifiers - Target ALL text elements */
body[data-article-font="small"] .article-content {
  font-size: 0.9rem;
}
body[data-article-font="small"] .article-content h2 {
  font-size: 1.5rem;
}
body[data-article-font="small"] .article-content h3 {
  font-size: 1.1rem;
}
body[data-article-font="small"] .article-content p,
body[data-article-font="small"] .article-content li {
  font-size: 0.95rem;
}

body[data-article-font="normal"] .article-content {
  font-size: 1rem;
}
body[data-article-font="normal"] .article-content h2 {
  font-size: 1.8rem;
}
body[data-article-font="normal"] .article-content h3 {
  font-size: 1.3rem;
}
body[data-article-font="normal"] .article-content p,
body[data-article-font="normal"] .article-content li {
  font-size: 1.1rem;
}

body[data-article-font="large"] .article-content {
  font-size: 1.15rem;
}
body[data-article-font="large"] .article-content h2 {
  font-size: 2rem;
}
body[data-article-font="large"] .article-content h3 {
  font-size: 1.5rem;
}
body[data-article-font="large"] .article-content p,
body[data-article-font="large"] .article-content li {
  font-size: 1.25rem;
}

body[data-article-font="x-large"] .article-content {
  font-size: 1.3rem;
}
body[data-article-font="x-large"] .article-content h2 {
  font-size: 2.3rem;
}
body[data-article-font="x-large"] .article-content h3 {
  font-size: 1.7rem;
}
body[data-article-font="x-large"] .article-content p,
body[data-article-font="x-large"] .article-content li {
  font-size: 1.4rem;
}

/* Line Spacing Modifiers */
body[data-article-spacing="compact"] .article-content p,
body[data-article-spacing="compact"] .article-content li {
  line-height: 1.5;
}

body[data-article-spacing="normal"] .article-content p,
body[data-article-spacing="normal"] .article-content li {
  line-height: 1.75;
}

body[data-article-spacing="relaxed"] .article-content p,
body[data-article-spacing="relaxed"] .article-content li {
  line-height: 2;
}

/* Mobile Reading Controls */
@media (max-width: 768px) {
  .reading-controls {
    right: 10px;
    padding: 8px;
    gap: 6px;
  }
  
  .reading-control-btn {
    width: 38px;
    height: 38px;
  }
  
  .reading-controls__font-btns button {
    width: 28px;
    height: 28px;
    font-size: 0.85rem;
  }
  
  .reading-control-btn__tooltip {
    display: none;
  }
}

/* ============================================
   TEXT SELECTION STYLING (prevents layout shift)
   ============================================ */
.article-content ::selection {
  background: rgba(255, 235, 59, 0.4);
  color: inherit;
}

.article-content ::-moz-selection {
  background: rgba(255, 235, 59, 0.4);
  color: inherit;
}

[data-theme="dark"] .article-content ::selection {
  background: rgba(126, 87, 194, 0.5);
  color: inherit;
}

[data-theme="dark"] .article-content ::-moz-selection {
  background: rgba(126, 87, 194, 0.5);
  color: inherit;
}

/* ============================================
   TEXT HIGHLIGHT FEATURE
   ============================================ */

.user-highlight {
  background: linear-gradient(120deg, #fff176 0%, #ffeb3b 100%);
  border-radius: 3px;
  cursor: pointer;
  /* No padding/margin to prevent layout shift during highlighting */
  box-decoration-break: clone;
  -webkit-box-decoration-break: clone;
}

.user-highlight:hover {
  background: linear-gradient(120deg, #ffca28 0%, #ffc107 100%);
  /* No box-shadow to prevent layout shift */
}

[data-theme="dark"] .user-highlight {
  background: linear-gradient(120deg, #5c6bc0 0%, #7e57c2 100%);
  color: #fff;
}

[data-theme="dark"] .user-highlight:hover {
  background: linear-gradient(120deg, #7e57c2 0%, #9575cd 100%);
}

/* ============================================
   BOOKMARK PROMPT
   ============================================ */

.bookmark-prompt {
  position: fixed;
  bottom: 20px;
  left: 50%;
  transform: translateX(-50%);
  background: var(--bg-card, #fff);
  padding: 16px 24px;
  border-radius: 12px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 1001;
  animation: slideUp 0.3s ease;
  border: 1px solid var(--border-color, rgba(0, 0, 0, 0.08));
}

@keyframes slideUp {
  from {
    transform: translateX(-50%) translateY(100px);
    opacity: 0;
  }
  to {
    transform: translateX(-50%) translateY(0);
    opacity: 1;
  }
}

.bookmark-prompt span {
  color: var(--text-primary, #1a1a2e);
  font-weight: 500;
}

.bookmark-prompt button {
  padding: 8px 16px;
  border-radius: 8px;
  border: none;
  cursor: pointer;
  font-weight: 500;
  transition: all 0.2s ease;
}

.bookmark-prompt__yes {
  background: var(--accent-color, #4a6fa5);
  color: #fff;
}

.bookmark-prompt__yes:hover {
  filter: brightness(1.1);
}

.bookmark-prompt__no {
  background: var(--bg-surface, #f5f5f5);
  color: var(--text-primary, #1a1a2e);
}

.bookmark-prompt__no:hover {
  background: var(--bg-tertiary, #e9ecef);
}

[data-theme="dark"] .bookmark-prompt {
  background: #252542;
  border-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .bookmark-prompt span {
  color: #e0e0e0;
}

[data-theme="dark"] .bookmark-prompt__yes {
  background: #d6bd9f;
  color: #1a1a2e;
}

[data-theme="dark"] .bookmark-prompt__no {
  background: #3d3a50;
  color: #e0e0e0;
}

/* Mini Floating TTS Player */
.tts-mini-player {
  position: fixed;
  bottom: 24px;
  right: 24px;
  background: linear-gradient(135deg, #3d3a50 0%, #2d2b3d 100%);
  border-radius: 50px;
  padding: 12px 20px;
  display: flex;
  align-items: center;
  gap: 12px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.3);
  z-index: 1000;
  transform: translateY(100px);
  opacity: 0;
  transition: all 0.3s ease;
  color: #fff;
}

.tts-mini-player.visible {
  transform: translateY(0);
  opacity: 1;
}

.tts-mini-player__btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.9);
  color: #3d3a50;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  transition: all 0.2s ease;
}

.tts-mini-player__btn:hover {
  background: #d6bd9f;
  transform: scale(1.1);
}

.tts-mini-player__btn--play {
  width: 48px;
  height: 48px;
  font-size: 1.2rem;
}

.tts-mini-player__info {
  display: flex;
  flex-direction: column;
  gap: 2px;
  max-width: 200px;
}

.tts-mini-player__title {
  font-size: 0.75rem;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.tts-mini-player__status {
  font-size: 0.85rem;
  font-weight: 500;
}

.tts-mini-player__progress {
  width: 80px;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
}

.tts-mini-player__progress-fill {
  height: 100%;
  background: #d6bd9f;
  transition: width 0.3s ease;
}

.tts-mini-player__close {
  width: 24px;
  height: 24px;
  border-radius: 50%;
  border: none;
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.tts-mini-player__close:hover {
  background: rgba(255, 107, 107, 0.8);
}

[data-theme="dark"] .tts-mini-player {
  background: linear-gradient(135deg, #252542 0%, #1a1a2e 100%);
}

/* Sleep Timer Dropdown */
.sleep-timer-container {
  position: relative;
}

.sleep-timer-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 12px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.2);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.sleep-timer-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.sleep-timer-btn.active {
  background: #d6bd9f;
  color: #1a1a2e;
  border-color: #d6bd9f;
}

.sleep-timer-dropdown {
  position: absolute;
  bottom: 100%;
  left: 0;
  background: #3d3a50;
  border-radius: 12px;
  padding: 8px;
  margin-bottom: 8px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.3);
  display: none;
  min-width: 140px;
}

.sleep-timer-dropdown.visible {
  display: block;
}

.sleep-timer-option {
  display: block;
  width: 100%;
  padding: 10px 12px;
  border: none;
  background: transparent;
  color: #fff;
  text-align: left;
  cursor: pointer;
  border-radius: 6px;
  font-size: 0.9rem;
  transition: background 0.2s;
}

.sleep-timer-option:hover {
  background: rgba(255, 255, 255, 0.1);
}

.sleep-timer-option.active {
  background: #d6bd9f;
  color: #1a1a2e;
}

/* Keyboard Shortcuts Overlay */
.keyboard-shortcuts-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.7);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  opacity: 0;
  visibility: hidden;
  transition: all 0.3s ease;
}

.keyboard-shortcuts-overlay.visible {
  opacity: 1;
  visibility: visible;
}

.keyboard-shortcuts-modal {
  background: #fff;
  border-radius: 16px;
  padding: 32px;
  max-width: 500px;
  width: 90%;
  max-height: 80vh;
  overflow-y: auto;
}

[data-theme="dark"] .keyboard-shortcuts-modal {
  background: #252542;
  color: #e0e0e0;
}

.keyboard-shortcuts-modal h3 {
  font-size: 1.5rem;
  margin-bottom: 24px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.keyboard-shortcuts-list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.keyboard-shortcuts-list li {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

[data-theme="dark"] .keyboard-shortcuts-list li {
  border-bottom-color: rgba(255, 255, 255, 0.08);
}

.keyboard-shortcuts-list kbd {
  background: #f0f0f0;
  padding: 4px 12px;
  border-radius: 6px;
  font-family: monospace;
  font-size: 0.9rem;
  border: 1px solid #ddd;
}

[data-theme="dark"] .keyboard-shortcuts-list kbd {
  background: #3d3a50;
  border-color: #555;
}

.keyboard-shortcuts-close {
  margin-top: 24px;
  width: 100%;
  padding: 12px;
  border: none;
  border-radius: 8px;
  background: #4a6fa5;
  color: #fff;
  cursor: pointer;
  font-size: 1rem;
  transition: background 0.2s;
}

.keyboard-shortcuts-close:hover {
  background: #3d5d8a;
}

/* Download Audio Button */
.tts-download-btn {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 8px 16px;
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.3);
  background: rgba(255, 255, 255, 0.1);
  color: #fff;
  cursor: pointer;
  font-size: 0.85rem;
  transition: all 0.2s ease;
}

.tts-download-btn:hover {
  background: rgba(255, 255, 255, 0.2);
}

.tts-download-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.tts-download-btn.downloading {
  pointer-events: none;
}

.tts-download-btn.downloading::after {
  content: '';
  width: 14px;
  height: 14px;
  border: 2px solid transparent;
  border-top-color: #fff;
  border-radius: 50%;
  animation: spin 0.8s linear infinite;
}

@keyframes spin {
  to { transform: rotate(360deg); }
}

/* Notes Panel */
.article-notes-panel {
  position: fixed;
  right: -400px;
  top: 0;
  bottom: 0;
  width: 400px;
  background: #fff;
  box-shadow: -4px 0 24px rgba(0, 0, 0, 0.15);
  z-index: 1001;
  transition: right 0.3s ease;
  display: flex;
  flex-direction: column;
}

.article-notes-panel.visible {
  right: 0;
}

[data-theme="dark"] .article-notes-panel {
  background: #1e1e32;
}

.notes-panel__header {
  padding: 20px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.1);
  display: flex;
  justify-content: space-between;
  align-items: center;
}

[data-theme="dark"] .notes-panel__header {
  border-bottom-color: rgba(255, 255, 255, 0.1);
}

.notes-panel__title {
  font-size: 1.2rem;
  font-weight: 600;
}

.notes-panel__close {
  width: 32px;
  height: 32px;
  border: none;
  border-radius: 8px;
  background: transparent;
  cursor: pointer;
  font-size: 1.2rem;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.notes-panel__close:hover {
  background: rgba(0, 0, 0, 0.1);
}

.notes-panel__content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.notes-textarea {
  width: 100%;
  min-height: 300px;
  padding: 16px;
  border: 1px solid rgba(0, 0, 0, 0.1);
  border-radius: 12px;
  font-family: inherit;
  font-size: 1rem;
  line-height: 1.6;
  resize: vertical;
  background: #f8f9fa;
}

.notes-panel__actions {
  display: flex;
  gap: 10px;
  margin-top: 15px;
  padding-top: 15px;
  border-top: 1px solid rgba(0, 0, 0, 0.1);
}

.notes-panel__btn {
  flex: 1;
  padding: 10px 16px;
  border: none;
  border-radius: 8px;
  font-size: 0.9rem;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  transition: all 0.2s;
}

.notes-panel__btn--clear {
  background: #f0f0f5;
  color: #666;
}

.notes-panel__btn--clear:hover {
  background: #e0e0ea;
}

.notes-panel__btn--export {
  background: #b89b5e;
  color: #fff;
}

.notes-panel__btn--export:hover {
  background: #a08550;
}

[data-theme="dark"] .notes-panel__actions {
  border-top-color: rgba(255, 255, 255, 0.1);
}

[data-theme="dark"] .notes-panel__btn--clear {
  background: #3a3a5a;
  color: #ccc;
}

[data-theme="dark"] .notes-panel__btn--clear:hover {
  background: #4a4a6a;
}

[data-theme="dark"] .notes-textarea {
  background: #252542;
  border-color: rgba(255, 255, 255, 0.1);
  color: #e0e0e0;
}

.notes-save-status {
  font-size: 0.85rem;
  color: #666;
  margin-top: 8px;
}

[data-theme="dark"] .notes-save-status {
  color: #999;
}

/* Key Takeaways Section */
.article-takeaways {
  background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
  border-radius: 16px;
  padding: 24px;
  margin-bottom: 32px;
  border-left: 4px solid #4a6fa5;
}

[data-theme="dark"] .article-takeaways {
  background: linear-gradient(135deg, #252542 0%, #1a1a2e 100%);
  border-left-color: #d6bd9f;
}

.article-takeaways__title {
  font-size: 1.2rem;
  font-weight: 700;
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 10px;
}

.article-takeaways__list {
  list-style: none;
  padding: 0;
  margin: 0;
}

.article-takeaways__list li {
  position: relative;
  padding-left: 28px;
  margin-bottom: 12px;
  line-height: 1.6;
}

.article-takeaways__list li::before {
  content: '✓';
  position: absolute;
  left: 0;
  color: #4a6fa5;
  font-weight: bold;
}

[data-theme="dark"] .article-takeaways__list li::before {
  color: #d6bd9f;
}

@media (max-width: 768px) {
  .tts-mini-player {
    left: 16px;
    right: 16px;
    bottom: 16px;
    border-radius: 16px;
  }
  
  .tts-mini-player__info {
    flex: 1;
  }
  
  .article-notes-panel {
    width: 100%;
    right: -100%;
  }
  
  .keyboard-shortcuts-modal {
    padding: 24px;
  }
}

/* Print Styles */
@media print {
  .reading-controls,
  .header,
  .mb-footer,
  .article-tts-player,
  .article-toc,
  .article-share,
  .article-related,
  .bookmark-prompt,
  .tts-mini-player,
  .article-notes-panel,
  .keyboard-shortcuts-overlay {
    display: none !important;
  }
  
  .article-content {
    max-width: 100%;
  }
  
  .user-highlight {
    background: #ffeb3b !important;
    -webkit-print-color-adjust: exact;
    print-color-adjust: exact;
  }
}

/* ============================================
   SAVE ARTICLE BUTTON
   ============================================ */

.article-actions {
  margin: 30px 0;
  display: flex;
  justify-content: center;
}

.save-article-btn {
  display: inline-flex;
  align-items: center;
  gap: 10px;
  padding: 14px 28px;
  background: linear-gradient(135deg, #b89b5e 0%, #d6bd9f 100%);
  color: #fff;
  border: none;
  border-radius: 30px;
  font-family: 'Poppins', sans-serif;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.3s ease;
  box-shadow: 0 4px 15px rgba(184, 155, 94, 0.3);
}

.save-article-btn:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 20px rgba(184, 155, 94, 0.4);
}

.save-article-btn.is-saved {
  background: #10b981;
  box-shadow: 0 4px 15px rgba(16, 185, 129, 0.3);
}

.save-article-btn.is-saved:hover {
  box-shadow: 0 6px 20px rgba(16, 185, 129, 0.4);
}

.save-article-btn i {
  font-size: 1.1rem;
  transition: transform 0.3s ease;
}

.save-article-btn.is-saved i {
  animation: bookmarkPop 0.3s ease;
}

@keyframes bookmarkPop {
  0% { transform: scale(1); }
  50% { transform: scale(1.3); }
  100% { transform: scale(1); }
}

.save-article-btn:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

[data-theme="dark"] .save-article-btn {
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
}

[data-theme="dark"] .save-article-btn:hover {
  box-shadow: 0 6px 20px rgba(0, 0, 0, 0.4);
}
