/* 跟讀模式樣式 */
.follow-along-mode {
  line-height: 2.2;
  font-size: 1.1rem;
  background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%);
  padding: 1.5rem;
  border-radius: 12px;
  box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.1);
}

.follow-along-text {
  font-family: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
  line-height: 2.5;
  font-size: 1.2rem;
  color: #374151;
  letter-spacing: 0.02em;
}

.follow-word {
  display: inline;
  padding: 2px 4px;
  margin: 0 1px;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
  position: relative;
}

.follow-word:hover {
  background-color: #e5e7eb;
  transform: translateY(-1px);
}

.follow-word.active-word {
  background-color: #3b82f6;
  color: white;
  font-weight: 600;
  transform: scale(1.05);
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.4);
  z-index: 10;
}

.follow-word.completed-word {
  background-color: #10b981;
  color: white;
  opacity: 0.8;
}

.follow-word.active-word::before {
  content: '';
  position: absolute;
  top: -8px;
  left: 50%;
  transform: translateX(-50%);
  width: 0;
  height: 0;
  border-left: 4px solid transparent;
  border-right: 4px solid transparent;
  border-bottom: 6px solid #3b82f6;
}

/* 跟讀控制面板 */
.follow-along-controls {
  background: white;
  border: 1px solid #e5e7eb;
  border-radius: 12px;
  padding: 1rem;
  margin-bottom: 1rem;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05);
}

.control-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 1rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid #e5e7eb;
}

.control-header h4 {
  margin: 0;
  color: #374151;
  font-size: 1rem;
  font-weight: 600;
}

.control-header h4 i {
  color: #3b82f6;
  margin-right: 0.5rem;
}

/* 進度條樣式 */
.progress-container {
  margin-bottom: 1rem;
}

.progress-bar {
  width: 100%;
  height: 8px;
  background-color: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  position: relative;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #3b82f6 0%, #1d4ed8 100%);
  border-radius: 4px;
  transition: width 0.1s ease;
  position: relative;
}

.progress-fill::after {
  content: '';
  position: absolute;
  top: 0;
  right: 0;
  width: 4px;
  height: 100%;
  background: rgba(255, 255, 255, 0.8);
  border-radius: 2px;
}

.time-display {
  display: flex;
  justify-content: space-between;
  margin-top: 0.5rem;
  font-size: 0.875rem;
  color: #6b7280;
  font-family: 'JetBrains Mono', monospace;
}

/* 單詞統計 */
.word-stats {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.875rem;
  color: #6b7280;
  padding-top: 0.5rem;
  border-top: 1px solid #f3f4f6;
}

.word-stats span {
  display: flex;
  align-items: center;
  gap: 0.25rem;
}

/* 播放時的視覺效果 */
.text-display-card.playing {
  border: 2px solid #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.2);
}

.follow-along-mode.playing {
  background: linear-gradient(135deg, #dbeafe 0%, #bfdbfe 100%);
}

/* 跟讀按鈕樣式 */
#followAlongBtn {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  border: none;
  color: white;
  transition: all 0.2s ease;
}

#followAlongBtn:hover {
  background: linear-gradient(135deg, #059669 0%, #047857 100%);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(16, 185, 129, 0.3);
}

#followAlongBtn:disabled {
  background: #9ca3af;
  cursor: not-allowed;
  transform: none;
  box-shadow: none;
}

/* 響應式設計 */
@media (max-width: 768px) {
  .follow-along-text {
    font-size: 1.1rem;
    line-height: 2.2;
  }
  
  .follow-word {
    padding: 3px 5px;
    margin: 0 2px;
  }
  
  .control-header {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  
  .word-stats {
    flex-direction: column;
    gap: 0.5rem;
    align-items: stretch;
  }
  
  .time-display {
    font-size: 0.8rem;
  }
}

/* 動畫效果 */
@keyframes highlightPulse {
  0% { 
    transform: scale(1);
    box-shadow: 0 0 0 0 rgba(59, 130, 246, 0.7);
  }
  50% { 
    transform: scale(1.05);
    box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.3);
  }
  100% { 
    transform: scale(1.05);
    box-shadow: 0 0 0 8px rgba(59, 130, 246, 0);
  }
}

.follow-word.active-word {
  animation: highlightPulse 0.5s ease-out;
}

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

.follow-along-controls {
  animation: slideDown 0.3s ease-out;
}

/* 深色主題支援 */
[data-theme="dark"] .follow-along-mode {
  background: linear-gradient(135deg, #1f2937 0%, #111827 100%);
  color: #f9fafb;
}

[data-theme="dark"] .follow-along-text {
  color: #f3f4f6;
}

[data-theme="dark"] .follow-word:hover {
  background-color: #374151;
}

[data-theme="dark"] .follow-along-controls {
  background: #1f2937;
  border-color: #374151;
  color: #f3f4f6;
}

[data-theme="dark"] .control-header {
  border-bottom-color: #374151;
}

[data-theme="dark"] .control-header h4 {
  color: #f3f4f6;
}

[data-theme="dark"] .progress-bar {
  background-color: #374151;
}

[data-theme="dark"] .time-display {
  color: #9ca3af;
}

[data-theme="dark"] .word-stats {
  color: #9ca3af;
  border-top-color: #374151;
}

[data-theme="dark"] .text-display-card.playing {
  border-color: #3b82f6;
  box-shadow: 0 0 20px rgba(59, 130, 246, 0.3);
}

[data-theme="dark"] .follow-along-mode.playing {
  background: linear-gradient(135deg, #1e3a8a 0%, #1e40af 100%);
}

/* 無障礙支援 */
@media (prefers-reduced-motion: reduce) {
  .follow-word,
  .progress-fill,
  .follow-along-controls {
    transition: none;
    animation: none;
  }
  
  .follow-word.active-word {
    transform: none;
    animation: none;
  }
}

/* 高對比度支援 */
@media (prefers-contrast: high) {
  .follow-word.active-word {
    background-color: #000000;
    color: #ffffff;
    border: 2px solid #ffffff;
  }
  
  .follow-word.completed-word {
    background-color: #006600;
    color: #ffffff;
    border: 1px solid #ffffff;
  }
  
  .progress-fill {
    background: #000000;
  }
}

/* 歷史記錄中的跟讀支援標誌 */
.history-item .tag.follow-along-support {
  background: linear-gradient(135deg, #10b981 0%, #059669 100%);
  color: white;
  font-weight: 500;
}

/* 工具提示樣式 */
.follow-word[title] {
  position: relative;
}

.follow-word:hover::after {
  content: attr(title);
  position: absolute;
  bottom: 100%;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.8);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 0.75rem;
  white-space: nowrap;
  z-index: 1000;
  pointer-events: none;
}

/* 功能徽章樣式 */
.feature-badge {
  display: flex;
  align-items: center;
}

.badge {
  padding: 0.25rem 0.5rem;
  border-radius: 0.375rem;
  font-size: 0.75rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
}

.badge-new {
  background-color: #10b981;
  color: white;
}

/* 跟讀信息卡片樣式 */
.follow-along-info {
  border-left: 4px solid #10b981;
  background: linear-gradient(135deg, #ecfdf5 0%, #d1fae5 100%);
}

.follow-along-info .info-icon {
  background: #10b981;
  color: white;
}
