.audio-player-container {
  background: linear-gradient(145deg, rgba(255, 255, 255, 0.12), rgba(255, 255, 255, 0.04));
  backdrop-filter: blur(10px) saturate(135%);
  -webkit-backdrop-filter: blur(10px) saturate(135%);
  border-radius: 14px;
  box-shadow:
    0 12px 30px rgba(15, 23, 42, 0.22),
    inset 0 1px 0 rgba(255, 255, 255, 0.24);
  border: 2px solid rgba(255, 255, 255, 0.55);
  outline: 1.5px solid rgba(12, 18, 32, 0.3); /* slightly stronger edge so front/back separate */
  outline-offset: -1px;
  background-clip: padding-box; /* keep border separate from glass */
  padding: 12px 12px;
  width: min(600px, 100%);
  display: none;
  color: #1f2937;
  margin-left: 8px;
  margin-right: 8px;
  overflow: hidden; /* keep the glass blur clean at the edges */
  position: relative;
}

/* Now Playing Info */
.now-playing-info {
  margin-top: 5px;
  font-size: 15px;
  color: #1f2937;
  text-align: center;
}

.audio-player {
  --control-size: 3.4em;
  --space: 0.5em;
}

.controls {
  display: flex;
  align-items: center;
  width: 100%;
  gap: var(--space); /* ensures spacing between controls */
  color: #1f2937;
}

/* Make the slider container fill the available space and stack its children vertically */
.slider {
  flex: 1;
  display: flex;
  flex-direction: column;
}

/* The range input takes the full width of its container */
.timeline {
  -webkit-appearance: none;
  width: 100%;
  height: 0.5em;
  background-color: rgba(255, 255, 255, 0.12);
  border-radius: 5px;
  background-size: 0% 100%;
  background-image: linear-gradient(90deg, rgba(11, 18, 32, 0.9), rgba(15, 23, 42, 0.9));
  background-repeat: no-repeat;
  border: 1px solid rgba(15, 23, 42, 0.2);
  background-clip: padding-box; /* keep gradient clean inside the border */
  appearance: none;
  outline: none;
}

/* Slider Thumb Styling */
/* WebKit browsers (Chrome, Safari) */
.timeline::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background-color: #0f172a;
  cursor: pointer;
  border: 2px solid #0b1220;
  outline: none;
}

/* Firefox */
.timeline::-moz-range-thumb {
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background-color: #0f172a;
  cursor: pointer;
  border: 2px solid #0b1220;
  outline: none;
}

/* Internet Explorer and Edge */
.timeline::-ms-thumb {
  width: 1em;
  height: 1em;
  border-radius: 50%;
  background-color: #0f172a;
  cursor: pointer;
  border: 2px solid #0b1220;
  outline: none;
}


/* Remove default track styling */
.timeline::-webkit-slider-runnable-track,
.timeline::-moz-range-track,
.timeline::-ms-track {
  -webkit-appearance: none;
  box-shadow: none;
  border: none;
  background: transparent;
}

/* Style the time info (positioned right below the slider) */
.now-playing-info {
  text-align: center;
  font-size: 1em;
  margin-top: 0.25em;
}

.player-button,
.sound-button {
  width: var(--control-size);
  height: var(--control-size);
  background: transparent;
  border: none;
  border-radius: 50%;
  box-shadow: none;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  transition: background-color 0.15s ease, transform 0.1s ease;
  padding: 0;
  line-height: 1;
  overflow: visible;
}

.player-button:hover,
.sound-button:hover {
  background: rgba(15, 23, 42, 0.08);
  transform: translateY(-1px);
}

.player-button:active,
.sound-button:active {
  transform: translateY(0);
  background: rgba(15, 23, 42, 0.12);
}

.player-button:focus-visible,
.sound-button:focus-visible {
  outline: 2px solid rgba(20, 33, 61, 0.85);
  outline-offset: 2px;
}

.player-button svg,
.sound-button svg {
  width: var(--control-size);
  height: var(--control-size);
  display: block;
  pointer-events: none;
}

.player-button svg path,
.sound-button svg path {
  fill: var(--dark-background);
}

.timeline::-webkit-slider-thumb,
.timeline::-moz-range-thumb,
.timeline::-ms-thumb {
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.18);
}

/* Minimize button */
.minimize-button {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 18px;
  height: 18px;
  border-radius: 8px;
  border: 1px solid rgba(15, 23, 42, 0.18);
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 6px 14px rgba(15, 23, 42, 0.16);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
}

.minimize-button:hover {
  transform: translateY(-1px);
  box-shadow: 0 10px 20px rgba(15, 23, 42, 0.18);
}

.minimize-button:active {
  transform: translateY(0);
}

.minimize-button svg {
  width: 16px;
  height: 16px;
  stroke: currentColor;
  stroke-width: 1.6;
  fill: none;
}

.minimize-button .icon-expand {
  display: none;
}

/* Collapsed state */
.audio-player-container.collapsed {
  padding: 8px 48px 8px 12px;
}

.audio-player-container.collapsed .audio-player,
.audio-player-container.collapsed .now-playing-info {
  display: none;
}

.audio-player-container.collapsed .minimize-button .icon-collapse {
  display: none;
}

.audio-player-container.collapsed .minimize-button .icon-expand {
  display: inline-flex;
}
