/* Text-to-Speech Controls Styling */

.tts-controls {
  margin-bottom: 2rem;
  padding: 1.5rem;
  background: var(--glass, rgba(5, 14, 8, 0.72));
  border: 1px solid rgba(255, 255, 255, 0.08);
  border-radius: 8px;
  backdrop-filter: blur(10px);
}

.tts-controls-inner {
  display: flex;
  align-items: center;
  gap: 1.5rem;
  flex-wrap: wrap;
}

.tts-label {
  display: flex;
  align-items: center;
  gap: 0.6rem;
  font-weight: 500;
  font-size: 0.95rem;
  color: var(--text, #effaf2);
  white-space: nowrap;
}

.tts-icon {
  color: var(--accent, #b6ea5f);
  flex-shrink: 0;
}

.tts-label-text {
  letter-spacing: 0.3px;
}

.tts-controls-buttons {
  display: flex;
  align-items: center;
  gap: 0.8rem;
  flex-wrap: wrap;
}

.tts-btn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 6px;
  background: rgba(255, 255, 255, 0.05);
  color: var(--accent, #b6ea5f);
  cursor: pointer;
  transition: all 0.2s ease;
  font-size: 0;
}

.tts-btn:hover:not(.hidden) {
  background: rgba(182, 234, 95, 0.1);
  border-color: rgba(182, 234, 95, 0.3);
  transform: translateY(-1px);
}

.tts-btn:active:not(.hidden) {
  transform: translateY(0);
}

.tts-btn svg {
  width: 18px;
  height: 18px;
}

.tts-btn.hidden {
  display: none;
}

/* Paragraph Highlighting */
.article-body p.tts-highlighted,
.article-body li.tts-highlighted,
.article-body h2.tts-highlighted {
  background: rgba(182, 234, 95, 0.15);
  padding: 0.5rem;
  border-left: 3px solid var(--accent, #b6ea5f);
  transition: all 0.3s ease;
  border-radius: 2px;
}


/* Visual Feedback - Playing State */
.tts-icon-speaker {
  animation: none;
  transition: color 0.3s ease;
}

.tts-controls.tts-playing .tts-icon-speaker {
  animation: tts-pulse 1.5s ease-in-out infinite;
}

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

.tts-progress {
  margin-top: 0.8rem;
  height: 2px;
  background: rgba(255, 255, 255, 0.06);
  border-radius: 1px;
  overflow: hidden;
}

.tts-progress-bar {
  height: 100%;
  background: linear-gradient(90deg, var(--accent, #b6ea5f), rgba(182, 234, 95, 0.6));
  border-radius: 1px;
  width: 0%;
  transition: width 0.3s ease;
  box-shadow: 0 0 8px rgba(182, 234, 95, 0.4);
}

.tts-controls.tts-playing .tts-progress-bar {
  box-shadow: 0 0 12px rgba(182, 234, 95, 0.6);
}

/* Responsive Design */
@media (max-width: 768px) {
  .tts-controls {
    padding: 1rem;
  }

  .tts-controls-inner {
    gap: 1rem;
  }

  .tts-controls-buttons {
    gap: 0.6rem;
  }

  .tts-btn {
    width: 32px;
    height: 32px;
  }

  .tts-btn svg {
    width: 16px;
    height: 16px;
  }

  .tts-label-text {
    font-size: 0.75rem;
    letter-spacing: 0.2px;
  }

  .tts-controls-buttons {
    flex-grow: 1;
  }
}

@media (max-width: 480px) {
  .tts-controls {
    padding: 0.8rem;
  }

  .tts-controls-inner {
    flex-direction: column;
    align-items: flex-start;
    gap: 0.8rem;
  }

  .tts-label {
    width: 100%;
  }

  .tts-controls-buttons {
    width: 100%;
    justify-content: space-between;
  }
}

/* Error message */
.tts-error {
  margin-top: 0.6rem;
  font-size: 0.8rem;
  color: #ffbd59;
  opacity: 0.9;
  animation: tts-fade-out 6s ease forwards;
}

@keyframes tts-fade-out {
  0%, 70% { opacity: 0.9; }
  100% { opacity: 0; }
}

/* Accessibility */
.tts-btn:focus-visible {
  outline: 2px solid var(--accent, #b6ea5f);
  outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
  .tts-btn,
  .tts-progress-bar,
  .tts-icon-speaker {
    transition: none;
    animation: none;
  }
}
