/**
 * ── AMBIENT SOUND CONTROLLER (HOANG HO LUXURY DESIGN SYSTEM) ──
 * Floating audio pill with animated soundwave, volume slider & tooltip
 */

.hoangho-sound-controller {
  position: fixed;
  bottom: 30px;
  left: 32px;
  z-index: 998;
  display: flex;
  align-items: center;
  gap: 12px;
  background: rgba(13, 26, 18, 0.88);
  backdrop-filter: blur(16px);
  -webkit-backdrop-filter: blur(16px);
  border: 1px solid rgba(201, 168, 76, 0.25);
  border-radius: 40px;
  padding: 8px 16px 8px 12px;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35), 0 0 1px rgba(201, 168, 76, 0.4);
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  user-select: none;
}

.hoangho-sound-controller:hover {
  border-color: rgba(201, 168, 76, 0.5);
  box-shadow: 0 16px 40px rgba(0, 0, 0, 0.45), 0 0 16px rgba(201, 168, 76, 0.2);
  transform: translateY(-2px);
}

/* Nút bấm chính (Icon sóng âm) */
.sound-toggle-btn {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  border: 1px solid rgba(201, 168, 76, 0.4);
  background: rgba(201, 168, 76, 0.1);
  color: var(--gold, #C9A84C);
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  transition: all 0.25s ease;
  position: relative;
  flex-shrink: 0;
}

.sound-toggle-btn:hover {
  background: rgba(201, 168, 76, 0.2);
  border-color: var(--gold, #C9A84C);
  transform: scale(1.04);
}

.sound-toggle-btn:focus-visible {
  outline: 2px solid var(--gold, #C9A84C);
  outline-offset: 2px;
}

/* 4 vạch sóng âm Equalizer */
.sound-waves {
  display: flex;
  align-items: center;
  gap: 3px;
  height: 16px;
}

.sound-wave-bar {
  width: 2.5px;
  background: var(--gold, #C9A84C);
  border-radius: 2px;
  transition: height 0.2s ease, opacity 0.2s ease;
}

/* Chiều cao trạng thái dừng */
.sound-wave-bar:nth-child(1) { height: 4px; }
.sound-wave-bar:nth-child(2) { height: 6px; }
.sound-wave-bar:nth-child(3) { height: 5px; }
.sound-wave-bar:nth-child(4) { height: 3px; }

/* Trạng thái đang phát (Playing) */
.hoangho-sound-controller.is-playing .sound-wave-bar {
  animation: soundWavePulse 1.2s ease-in-out infinite alternate;
}

.hoangho-sound-controller.is-playing .sound-wave-bar:nth-child(1) { animation-delay: 0.1s; }
.hoangho-sound-controller.is-playing .sound-wave-bar:nth-child(2) { animation-delay: 0.4s; }
.hoangho-sound-controller.is-playing .sound-wave-bar:nth-child(3) { animation-delay: 0.2s; }
.hoangho-sound-controller.is-playing .sound-wave-bar:nth-child(4) { animation-delay: 0.5s; }

@keyframes soundWavePulse {
  0% { height: 3px; }
  50% { height: 16px; }
  100% { height: 6px; }
}

/* Trạng thái Muted / Tắt */
.hoangho-sound-controller.is-muted .sound-waves,
.hoangho-sound-controller.is-paused .sound-waves {
  opacity: 0.45;
}

.hoangho-sound-controller.is-muted .sound-wave-bar,
.hoangho-sound-controller.is-paused .sound-wave-bar {
  animation: none !important;
  height: 3px !important;
}

/* Thông tin bài hát & Nhãn */
.sound-info {
  display: flex;
  flex-direction: column;
  justify-content: center;
  pointer-events: none;
}

.sound-eyebrow {
  font-family: var(--body, 'Inter', sans-serif);
  font-size: 9px;
  letter-spacing: 0.18em;
  text-transform: uppercase;
  color: var(--gold, #C9A84C);
  opacity: 0.85;
  line-height: 1.2;
}

.sound-title {
  font-family: var(--display, 'Cormorant Garamond', Georgia, serif);
  font-size: 14px;
  font-style: italic;
  color: var(--ivory, #F7F2E8);
  white-space: nowrap;
  line-height: 1.2;
}

/* Thanh điều khiển âm lượng mini (Volume Slider) */
.sound-volume-wrap {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-left: 4px;
  opacity: 0;
  max-width: 0;
  overflow: hidden;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
}

.hoangho-sound-controller:hover .sound-volume-wrap {
  opacity: 1;
  max-width: 90px;
  margin-left: 8px;
}

.sound-volume-slider {
  -webkit-appearance: none;
  appearance: none;
  width: 65px;
  height: 3px;
  background: rgba(247, 242, 232, 0.2);
  border-radius: 2px;
  outline: none;
  cursor: pointer;
  transition: background 0.2s ease;
}

.sound-volume-slider:hover {
  background: rgba(201, 168, 76, 0.4);
}

.sound-volume-slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gold, #C9A84C);
  cursor: pointer;
  box-shadow: 0 0 8px rgba(201, 168, 76, 0.6);
  transition: transform 0.15s ease;
}

.sound-volume-slider::-webkit-slider-thumb:hover {
  transform: scale(1.25);
}

.sound-volume-slider::-moz-range-thumb {
  width: 11px;
  height: 11px;
  border-radius: 50%;
  background: var(--gold, #C9A84C);
  border: none;
  cursor: pointer;
}

/* Responsive Mobile */
@media (max-width: 768px) {
  .hoangho-sound-controller {
    bottom: 20px;
    left: 16px;
    padding: 6px 12px 6px 8px;
  }
  .sound-info {
    display: none; /* Rút gọn trên mobile để tránh đè màn hình */
  }
  .sound-volume-wrap {
    display: none;
  }
}
