/* ===== TTS Player Bar ===== */
.tts-player-bar {
  display: flex;
  align-items: center;
  gap: 14px;
  background: linear-gradient(135deg, #fffdf7 0%, #fef8e8 100%);
  border: 1px solid rgba(200, 134, 10, 0.25);
  border-radius: 12px;
  padding: 13px 18px;
  margin: 0 0 20px;
  box-shadow: 0 2px 12px rgba(180, 130, 40, 0.08);
  font-family: inherit;
  box-sizing: border-box;
}

/* Nút Play/Pause */
.tts-play-btn {
  width: 46px;
  height: 46px;
  min-width: 46px;
  border-radius: 50%;
  background: linear-gradient(145deg, #d4920f, #a56a06);
  color: #fff;
  border: none;
  font-size: 0;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  transition: background 0.2s ease, transform 0.1s ease, box-shadow 0.2s ease;
  box-shadow: 0 3px 8px rgba(180, 130, 40, 0.4);
  user-select: none;
  flex-shrink: 0;
  -webkit-tap-highlight-color: transparent;
  -webkit-appearance: none;
  outline: none;
}

/* Play icon — SVG data URI, sắc nét trên mọi màn hình kể cả iOS */
.tts-play-btn::before {
  content: '';
  display: block;
  width: 22px;
  height: 22px;
  background: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M8 5v14l11-7z' fill='white'/%3E%3C/svg%3E") center / contain no-repeat;
}

/* Pause icon khi đang phát */
.tts-player-bar.tts-playing .tts-play-btn::before {
  background-image: url("data:image/svg+xml,%3Csvg viewBox='0 0 24 24' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M6 19h4V5H6v14zm8-14v14h4V5h-4z' fill='white'/%3E%3C/svg%3E");
}

.tts-play-btn:hover {
  background: linear-gradient(145deg, #c8860a, #8a5505);
  transform: scale(1.06);
  box-shadow: 0 4px 14px rgba(180, 130, 40, 0.55);
}

.tts-play-btn:active {
  background: linear-gradient(145deg, #c8860a, #8a5505);
  transform: scale(0.97);
}

/* Pulse khi idle (chưa phát) */
.tts-player-bar:not(.tts-playing) .tts-play-btn {
  animation: tts-pulse 2.5s ease-in-out infinite;
}

@keyframes tts-pulse {
  0%, 100% { box-shadow: 0 3px 8px rgba(180, 130, 40, 0.4); }
  50%       { box-shadow: 0 3px 18px rgba(180, 130, 40, 0.65); }
}

/* Khu vực track */
.tts-track {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 5px;
}

/* Hàng label + waveform */
.tts-label-row {
  display: flex;
  align-items: center;
  gap: 8px;
  line-height: 1;
}

/* Label "Nghe bài đọc" */
.tts-label {
  font-size: 13px;
  color: #6b4c12;
  font-weight: 700;
  letter-spacing: 0.2px;
  user-select: none;
}

/* Waveform — chỉ hiện khi .tts-playing */
.tts-wave {
  display: none;
  align-items: flex-end;
  gap: 2px;
  height: 16px;
}

.tts-player-bar.tts-playing .tts-wave {
  display: inline-flex;
}

.tts-wave span {
  width: 3px;
  background: #c8860a;
  border-radius: 2px;
  transform-origin: bottom;
  animation: tts-bounce 0.7s ease infinite;
}

.tts-wave span:nth-child(1) { height: 8px; }
.tts-wave span:nth-child(2) { height: 14px; animation-delay: 0.12s; }
.tts-wave span:nth-child(3) { height: 6px;  animation-delay: 0.24s; }

@keyframes tts-bounce {
  0%, 100% { transform: scaleY(0.35); }
  50%       { transform: scaleY(1); }
}

/* Progress bar wrapper */
.tts-progress {
  width: 100%;
  height: 6px;
  background: rgba(180, 130, 40, 0.15);
  border-radius: 4px;
  cursor: pointer;
  overflow: hidden;
  position: relative;
}

.tts-progress:hover {
  background: rgba(180, 130, 40, 0.25);
}

/* Fill bar */
.tts-fill {
  height: 100%;
  background: linear-gradient(90deg, #c8860a 0%, #e8a820 100%);
  border-radius: 4px;
  width: 0%;
  transition: width 0.25s linear;
  pointer-events: none;
}

/* Thời gian */
.tts-time {
  font-size: 11px;
  color: #9a7a3a;
  text-align: right;
  line-height: 1;
  font-variant-numeric: tabular-nums;
  user-select: none;
}

/* ===== Admin status area ===== */
.tts-status-wrap {
  margin-top: 10px;
  font-size: 14px;
  line-height: 1.6;
}

.tts-status-ok {
  color: #2e7d32;
  font-weight: 600;
}

/* ===== Responsive ===== */
@media (max-width: 480px) {
  .tts-player-bar {
    padding: 10px 12px;
    gap: 10px;
    border-radius: 10px;
  }

  .tts-play-btn {
    width: 40px;
    height: 40px;
    min-width: 40px;
    font-size: 15px;
  }

  .tts-label {
    font-size: 12px;
  }

  .tts-time {
    font-size: 10px;
  }
}
