/* ============================================================
   Article Reader (Listen to Article) — Ganspar Life Sciences
   ============================================================ */

.article-reader-container {
  margin-bottom: 35px;
  background: linear-gradient(135deg, #ffffff 0%, #f4f8fd 100%);
  border: 1px solid #dce8f6;
  border-radius: 18px;
  padding: 24px 28px;
  box-shadow: 0 10px 30px rgba(7, 58, 114, 0.06);
  position: relative;
  overflow: hidden;
  transition: all 0.3s ease;
}

.article-reader-container::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 5px;
  height: 100%;
  background: linear-gradient(to bottom, #073a72, #2daae1);
  border-top-left-radius: 18px;
  border-bottom-left-radius: 18px;
}

/* Header row */
.reader-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 15px;
  margin-bottom: 18px;
}

.reader-title-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.reader-badge {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  background: rgba(7, 58, 114, 0.08);
  color: #073a72;
  font-weight: 700;
  font-size: 0.88rem;
  padding: 6px 14px;
  border-radius: 20px;
  letter-spacing: 0.3px;
}

.reader-badge i {
  font-size: 1rem;
  color: #073a72;
}

.reader-time-estimate {
  font-size: 0.85rem;
  color: #64748b;
  font-weight: 500;
  display: flex;
  align-items: center;
  gap: 6px;
}

/* Equalizer Bars Animation */
.reader-equalizer {
  display: inline-flex;
  align-items: flex-end;
  gap: 3px;
  height: 16px;
  margin-left: 6px;
}

.reader-equalizer span {
  width: 3px;
  height: 4px;
  background: #073a72;
  border-radius: 2px;
  transition: height 0.2s ease;
}

.reader-equalizer.is-active span {
  animation: eqBounce 1.2s infinite ease-in-out;
}

.reader-equalizer.is-active span:nth-child(1) { animation-delay: 0.0s; }
.reader-equalizer.is-active span:nth-child(2) { animation-delay: 0.2s; }
.reader-equalizer.is-active span:nth-child(3) { animation-delay: 0.4s; }
.reader-equalizer.is-active span:nth-child(4) { animation-delay: 0.1s; }
.reader-equalizer.is-active span:nth-child(5) { animation-delay: 0.3s; }

@keyframes eqBounce {
  0%, 100% { height: 4px; }
  50% { height: 16px; }
}

/* Controls row */
.reader-controls-wrapper {
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-wrap: wrap;
  gap: 16px;
  margin-top: 10px;
}

.reader-main-controls {
  display: flex;
  align-items: center;
  gap: 12px;
}

/* Play/Pause Button */
.reader-btn-play {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: linear-gradient(135deg, #073a72 0%, #1a5699 100%);
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  cursor: pointer;
  box-shadow: 0 6px 18px rgba(7, 58, 114, 0.28);
  transition: all 0.25s cubic-bezier(0.4, 0, 0.2, 1);
  position: relative;
  outline: none;
}

.reader-btn-play:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 24px rgba(7, 58, 114, 0.38);
  background: linear-gradient(135deg, #0a488c 0%, #2067b5 100%);
}

.reader-btn-play:active {
  transform: scale(0.96);
}

.reader-btn-play.playing {
  background: linear-gradient(135deg, #e63946 0%, #c02b36 100%);
  box-shadow: 0 6px 18px rgba(230, 57, 70, 0.32);
}

.reader-btn-play.playing:hover {
  background: linear-gradient(135deg, #d32f2f 0%, #b71c1c 100%);
  box-shadow: 0 8px 24px rgba(230, 57, 70, 0.42);
}

/* Secondary Action Buttons */
.reader-btn-action {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: #ffffff;
  border: 1px solid #dce8f6;
  color: #334155;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 0.92rem;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
}

.reader-btn-action:hover {
  background: #f1f5f9;
  color: #073a72;
  border-color: #cbd5e1;
  transform: translateY(-1px);
}

.reader-btn-action:active {
  transform: translateY(1px);
}

/* Progress & Timeline */
.reader-timeline-container {
  flex: 1;
  min-width: 200px;
  display: flex;
  flex-direction: column;
  gap: 6px;
}

.reader-progress-track {
  width: 100%;
  height: 7px;
  background: #e2e8f0;
  border-radius: 4px;
  position: relative;
  cursor: pointer;
  overflow: hidden;
  transition: height 0.2s ease;
}

.reader-progress-track:hover {
  height: 9px;
}

.reader-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: linear-gradient(90deg, #073a72, #2daae1);
  border-radius: 4px;
  transition: width 0.15s ease-out;
}

.reader-time-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.78rem;
  color: #64748b;
  font-weight: 600;
  font-variant-numeric: tabular-nums;
}

/* Tools & Settings Row */
.reader-tools {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

/* Speed Button & Dropdown */
.reader-speed-select {
  padding: 6px 12px;
  font-size: 0.82rem;
  font-weight: 600;
  color: #1e293b;
  background: #ffffff;
  border: 1px solid #dce8f6;
  border-radius: 20px;
  cursor: pointer;
  outline: none;
  transition: all 0.2s ease;
}

.reader-speed-select:hover {
  border-color: #073a72;
  color: #073a72;
}

/* Voice selector */
.reader-voice-select {
  padding: 6px 10px;
  font-size: 0.82rem;
  font-weight: 500;
  color: #1e293b;
  background: #ffffff;
  border: 1px solid #dce8f6;
  border-radius: 20px;
  cursor: pointer;
  outline: none;
  max-width: 170px;
  text-overflow: ellipsis;
  white-space: nowrap;
  overflow: hidden;
  transition: all 0.2s ease;
}

.reader-voice-select:hover {
  border-color: #073a72;
}

/* Toggle Switches */
.reader-toggle-btn {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 6px 12px;
  font-size: 0.8rem;
  font-weight: 600;
  color: #64748b;
  background: #ffffff;
  border: 1px solid #dce8f6;
  border-radius: 20px;
  cursor: pointer;
  transition: all 0.2s ease;
  outline: none;
  user-select: none;
}

.reader-toggle-btn:hover {
  border-color: #cbd5e1;
  color: #334155;
}

.reader-toggle-btn.active {
  background: rgba(7, 58, 114, 0.08);
  border-color: rgba(7, 58, 114, 0.25);
  color: #073a72;
}

.reader-toggle-btn.active i {
  color: #073a72;
}

/* Sentence Highlighting in Article Body */
.reader-sentence {
  transition: background 0.25s ease, box-shadow 0.25s ease, color 0.25s ease;
  border-radius: 3px;
  cursor: pointer;
}

.reader-sentence:hover {
  background: rgba(45, 170, 225, 0.12);
}

.reader-sentence.is-reading {
  background: #fff3bf !important;
  color: #0f172a !important;
  box-shadow: 0 0 0 3px #fff3bf;
  border-radius: 4px;
}

/* Floating Mini-Player */
.reader-mini-player {
  position: fixed;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120px);
  background: rgba(15, 23, 42, 0.92);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  color: #ffffff;
  padding: 12px 20px;
  border-radius: 50px;
  box-shadow: 0 15px 35px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.1);
  display: flex;
  align-items: center;
  gap: 16px;
  z-index: 9999;
  opacity: 0;
  pointer-events: none;
  transition: transform 0.4s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease;
  max-width: 92vw;
  width: auto;
}

.reader-mini-player.is-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  pointer-events: auto;
}

.mini-play-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  background: #2daae1;
  color: #ffffff;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(45, 170, 225, 0.4);
  transition: all 0.2s ease;
  outline: none;
}

.mini-play-btn:hover {
  transform: scale(1.08);
}

.mini-play-btn.playing {
  background: #e63946;
  box-shadow: 0 4px 12px rgba(230, 57, 70, 0.4);
}

.mini-title-wrap {
  display: flex;
  flex-direction: column;
  max-width: 220px;
}

.mini-title {
  font-size: 0.85rem;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #f8fafc;
}

.mini-status {
  font-size: 0.72rem;
  color: #94a3b8;
}

.mini-progress-track {
  width: 100px;
  height: 5px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 3px;
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.mini-progress-fill {
  position: absolute;
  top: 0;
  left: 0;
  height: 100%;
  width: 0%;
  background: #2daae1;
  border-radius: 3px;
}

.mini-close-btn {
  background: transparent;
  border: none;
  color: #94a3b8;
  cursor: pointer;
  font-size: 1rem;
  padding: 4px 6px;
  transition: color 0.2s ease;
}

.mini-close-btn:hover {
  color: #ffffff;
}

/* Fallback Notice for Unsupported Browsers */
.reader-unsupported-notice {
  display: none;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #991b1b;
  padding: 12px 16px;
  border-radius: 10px;
  font-size: 0.88rem;
  margin-bottom: 20px;
}

/* Responsive adjustments */
@media (max-width: 768px) {
  .article-reader-container {
    padding: 18px 16px;
  }
  .reader-controls-wrapper {
    flex-direction: column;
    align-items: stretch;
  }
  .reader-main-controls {
    justify-content: center;
  }
  .reader-tools {
    justify-content: center;
  }
  .reader-voice-select {
    max-width: 140px;
  }
  .mini-title-wrap {
    max-width: 120px;
  }
  .mini-progress-track {
    width: 60px;
  }
}
