/* OLONE — встроенный audio player (сообщения + global mini player) */

.bubble-audio {
  display: flex;
  align-items: center;
  gap: 10px;
  min-width: 0;
  max-width: min(100%, 340px);
  padding: 10px 12px;
  border-radius: 14px;
  background: linear-gradient(135deg, rgba(142, 36, 170, 0.22), rgba(94, 53, 177, 0.14));
  border: 1px solid rgba(255, 255, 255, 0.08);
  transition: box-shadow 0.2s ease, border-color 0.2s ease;
}

.bubble-audio--active {
  border-color: rgba(186, 104, 255, 0.55);
  box-shadow: 0 0 0 1px rgba(186, 104, 255, 0.25);
}

.bubble-audio__cover {
  flex: 0 0 44px;
  width: 44px;
  height: 44px;
  border-radius: 10px;
  overflow: hidden;
  background: linear-gradient(145deg, #6a1b9a, #4527a0);
  position: relative;
  flex-shrink: 0;
}

/* Обложка ИЛИ иконка — никогда оба */
.bubble-audio__cover-img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
  opacity: 0;
  transition: opacity 0.2s ease;
}

.bubble-audio__cover--has-art .bubble-audio__cover-img {
  opacity: 1;
}

.bubble-audio__cover-icon {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  opacity: 0.9;
  transition: opacity 0.2s ease;
}

.bubble-audio__cover--has-art .bubble-audio__cover-icon {
  opacity: 0;
  pointer-events: none;
  visibility: hidden;
}

.bubble-audio__cover--fallback .bubble-audio__cover-img {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

.bubble-audio--active .bubble-audio__cover--fallback .bubble-audio__cover-icon,
.bubble-audio__cover--playing.bubble-audio__cover--fallback .bubble-audio__cover-icon {
  animation: olone-audio-pulse 1.2s ease-in-out infinite;
}

#oloneGlobalAudioPlayer .bubble-audio__cover {
  flex: 0 0 48px;
  width: 48px;
  height: 48px;
  border-radius: 10px;
}

@keyframes olone-audio-pulse {
  0%,
  100% {
    transform: scale(1);
    opacity: 0.85;
  }
  50% {
    transform: scale(1.08);
    opacity: 1;
  }
}

.bubble-audio__play {
  flex: 0 0 36px;
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.14);
  color: var(--text, #fff);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s ease, transform 0.1s ease;
}

.bubble-audio__play:hover {
  background: rgba(255, 255, 255, 0.22);
}

.bubble-audio__play:active {
  transform: scale(0.96);
}

.bubble-audio__body {
  flex: 1 1 auto;
  min-width: 0;
}

.bubble-audio__title {
  font-size: 13px;
  font-weight: 600;
  line-height: 1.25;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: var(--text, #fff);
}

.bubble-audio__artist {
  font-size: 11px;
  color: var(--muted, rgba(255, 255, 255, 0.55));
  margin-top: 2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.bubble-audio__progress-wrap {
  margin-top: 6px;
  display: flex;
  align-items: center;
  gap: 6px;
}

.bubble-audio__time {
  flex: 0 0 auto;
  font-size: 10px;
  font-variant-numeric: tabular-nums;
  color: var(--muted, rgba(255, 255, 255, 0.5));
  min-width: 28px;
}

.bubble-audio__bar {
  flex: 1 1 auto;
  height: 4px;
  border-radius: 2px;
  background: rgba(255, 255, 255, 0.12);
  cursor: pointer;
  position: relative;
  overflow: hidden;
}

.bubble-audio__bar-fill {
  position: absolute;
  left: 0;
  top: 0;
  bottom: 0;
  width: 0%;
  background: linear-gradient(90deg, #ab47bc, #7e57c2);
  border-radius: 2px;
  transition: width 0.08s linear;
}

.bubble-audio__wave {
  display: none;
}

.bubble.out .bubble-audio {
  background: linear-gradient(135deg, rgba(106, 27, 154, 0.35), rgba(69, 39, 160, 0.2));
}

#oloneGlobalAudioPlayer {
  position: fixed;
  left: 0;
  right: 0;
  bottom: 0;
  z-index: 12000;
  display: none;
  align-items: center;
  gap: 12px;
  padding: 10px 14px calc(10px + env(safe-area-inset-bottom, 0px));
  background: rgba(18, 18, 22, 0.96);
  backdrop-filter: blur(14px);
  border-top: 1px solid rgba(255, 255, 255, 0.1);
  box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.45);
  transform: translateY(100%);
  transition: transform 0.25s ease;
}

#oloneGlobalAudioPlayer.olone-global-audio--visible {
  display: flex;
  transform: translateY(0);
}

#oloneGlobalAudioPlayer .bubble-audio {
  max-width: none;
  flex: 1 1 auto;
  background: transparent;
  border: none;
  padding: 0;
}

.olone-global-audio__nav {
  flex: 0 0 auto;
  display: flex;
  gap: 4px;
}

.olone-global-audio__nav button {
  width: 36px;
  height: 36px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.1);
  color: var(--text, #fff);
  cursor: pointer;
  font-size: 16px;
}

.olone-global-audio__nav button:hover {
  background: rgba(255, 255, 255, 0.18);
}

.olone-global-audio__close {
  flex: 0 0 auto;
  width: 36px;
  height: 36px;
  margin-left: 2px;
  border: none;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.08);
  color: var(--muted, rgba(255, 255, 255, 0.75));
  cursor: pointer;
  font-size: 22px;
  line-height: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 0.15s ease, color 0.15s ease;
}

.olone-global-audio__close:hover {
  background: rgba(255, 255, 255, 0.16);
  color: var(--text, #fff);
}

.olone-global-audio__vol {
  flex: 0 0 118px;
  min-width: 118px;
  display: none;
  align-items: center;
  gap: 6px;
}

.olone-global-audio__vol-label {
  font-size: 10px;
  color: var(--muted, rgba(255, 255, 255, 0.5));
  min-width: 30px;
  text-align: right;
  font-variant-numeric: tabular-nums;
  flex: 0 0 auto;
}

.olone-global-audio__vol-track {
  flex: 1 1 auto;
  min-width: 0;
  height: 20px;
  display: flex;
  align-items: center;
}

/* Кастомный range: ползунок от края до края трека */
.olone-global-audio__vol-range {
  -webkit-appearance: none;
  appearance: none;
  width: 100%;
  height: 20px;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  cursor: pointer;
  --vol-fill: 85%;
}

.olone-global-audio__vol-range:focus {
  outline: none;
}

.olone-global-audio__vol-range:focus-visible::-webkit-slider-thumb {
  box-shadow: 0 0 0 2px rgba(171, 71, 188, 0.45);
}

.olone-global-audio__vol-range::-webkit-slider-runnable-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: linear-gradient(
    to right,
    #ab47bc 0%,
    #ab47bc var(--vol-fill, 0%),
    rgba(255, 255, 255, 0.22) var(--vol-fill, 0%),
    rgba(255, 255, 255, 0.22) 100%
  );
}

.olone-global-audio__vol-range::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 12px;
  height: 12px;
  margin-top: -4px;
  border-radius: 50%;
  background: #ab47bc;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

.olone-global-audio__vol-range::-moz-range-track {
  width: 100%;
  height: 4px;
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.22);
  border: none;
}

.olone-global-audio__vol-range::-moz-range-progress {
  height: 4px;
  border-radius: 999px 0 0 999px;
  background: #ab47bc;
  border: none;
}

.olone-global-audio__vol-range::-moz-range-thumb {
  width: 12px;
  height: 12px;
  border-radius: 50%;
  background: #ab47bc;
  border: 2px solid rgba(255, 255, 255, 0.92);
  box-shadow: 0 1px 4px rgba(0, 0, 0, 0.35);
}

@media (min-width: 768px) {
  .olone-global-audio__vol {
    display: flex;
  }
}

body.olone-global-audio-on {
  padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 767px) {
  body.olone-global-audio-on.mobile-active-chat {
    padding-bottom: calc(72px + env(safe-area-inset-bottom, 0px));
  }

  #oloneGlobalAudioPlayer {
    left: 8px;
    right: 8px;
    bottom: calc(56px + env(safe-area-inset-bottom, 0px));
    border-radius: 14px;
    border: 1px solid rgba(255, 255, 255, 0.1);
  }
}
