/**
 * Dinsos Pinrang Aksesibel - Gaya Pemutar Suara (Speech Player Bar & Active Highlight)
 * @version 1.0.0
 */

/* 1. Efek Sorotan Paragraf / Elemen yang Sedang Dibacakan */
.dsp-speech-active {
  background: #fff2b8 !important;
  color: #14251d !important;
  border-radius: 6px;
  outline: 3px solid #f0b323 !important;
  scroll-margin-top: 120px;
  transition: background-color 0.25s ease, outline-color 0.25s ease;
}

html.dsp-contrast-high .dsp-speech-active {
  background: #ffff00 !important;
  color: #000000 !important;
  outline: 4px solid #ffffff !important;
}

html.dsp-dark-mode .dsp-speech-active {
  background: #713f12 !important;
  color: #fef08a !important;
  outline: 3px solid #facc15 !important;
}

/* 2. Floating Speech Player Bar */
.dsp-speech-bar {
  position: fixed;
  z-index: 99992;
  bottom: 24px;
  left: 50%;
  transform: translateX(-50%) translateY(120%);
  width: calc(100% - 32px);
  max-width: 640px;
  background: rgba(20, 83, 45, 0.96);
  color: #ffffff;
  backdrop-filter: blur(8px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 14px;
  padding: 10px 16px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.35), 0 0 0 1px rgba(0, 0, 0, 0.1);
  display: flex;
  flex-direction: column;
  gap: 8px;
  opacity: 0;
  visibility: hidden;
  transition: transform 0.35s cubic-bezier(0.16, 1, 0.3, 1), opacity 0.3s ease, visibility 0.3s ease;
  font-family: inherit;
  box-sizing: border-box;
}

.dsp-speech-bar.dsp-bar-visible {
  transform: translateX(-50%) translateY(0);
  opacity: 1;
  visibility: visible;
}

/* Responsif Mobile - Ditempatkan di atas mobile dock tema */
@media (max-width: 768px) {
  .dsp-speech-bar {
    bottom: calc(76px + env(safe-area-inset-bottom, 12px));
    width: calc(100% - 20px);
    padding: 8px 12px;
    border-radius: 12px;
  }
}

/* Bagian Atas Player: Status & Tombol Tutup */
.dsp-bar-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  font-size: 12px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  padding-bottom: 6px;
}

.dsp-bar-status {
  display: flex;
  align-items: center;
  gap: 8px;
  font-weight: 500;
  color: #e2e8f0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.dsp-status-pulse {
  width: 8px;
  height: 8px;
  background-color: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7);
  animation: dsp-pulse 1.8s infinite;
  flex-shrink: 0;
}

.dsp-status-pulse.dsp-paused {
  background-color: #facc15;
  animation: none;
}

@keyframes dsp-pulse {
  0% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(74, 222, 128, 0.7); }
  70% { transform: scale(1); box-shadow: 0 0 0 6px rgba(74, 222, 128, 0); }
  100% { transform: scale(0.95); box-shadow: 0 0 0 0 rgba(74, 222, 128, 0); }
}

.dsp-bar-close {
  background: none;
  border: none;
  color: rgba(255, 255, 255, 0.7);
  font-size: 18px;
  line-height: 1;
  padding: 2px 6px;
  cursor: pointer;
  border-radius: 4px;
}

.dsp-bar-close:hover {
  color: #ffffff;
  background: rgba(255, 255, 255, 0.15);
}

/* Bagian Kontrol Player */
.dsp-bar-controls {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 8px;
  flex-wrap: wrap;
}

.dsp-btn-group {
  display: flex;
  align-items: center;
  gap: 6px;
}

.dsp-ctrl-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  width: 38px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  transition: all 0.2s ease;
}

.dsp-ctrl-btn:hover {
  background: rgba(255, 255, 255, 0.25);
  border-color: rgba(255, 255, 255, 0.4);
}

.dsp-ctrl-btn:focus-visible {
  outline: 2px solid #f59e0b;
}

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

.dsp-ctrl-btn.dsp-play-btn {
  background: #22c55e;
  border-color: #16a34a;
  width: 44px;
  height: 38px;
}

.dsp-ctrl-btn.dsp-play-btn:hover {
  background: #16a34a;
}

/* Tombol Baca Seleksi */
.dsp-selection-btn {
  background: rgba(255, 255, 255, 0.12);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: #ffffff;
  padding: 6px 12px;
  height: 38px;
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
  transition: background-color 0.2s ease;
}

.dsp-selection-btn:hover {
  background: rgba(255, 255, 255, 0.25);
}

.dsp-selection-btn svg {
  width: 16px;
  height: 16px;
  fill: currentColor;
}

/* Pilihan Kecepatan */
.dsp-speed-select {
  background: rgba(20, 83, 45, 0.9);
  color: #ffffff;
  border: 1px solid rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  height: 38px;
  padding: 0 8px;
  font-size: 12px;
  font-weight: 600;
  cursor: pointer;
}

.dsp-speed-select:focus-visible {
  outline: 2px solid #f59e0b;
}

.dsp-speed-select option {
  background: #14532d;
  color: #ffffff;
}
