/* AUDIOPLAYER */

@keyframes slidein {
  from {
    bottom: -150px;
  }
  to {
    bottom: 0px;
  }
}

/* Audio Player Container */
#audioPlayer {
  position: fixed;
  bottom: -150px; /* Start off-screen */
  width: 100%;
  height: 150px;
  display: none; /* Initially hidden */
  z-index: 999;
  background-color: var(--secondary-background-color);
  border-top: 1px solid #333;
}

#audioPlayer.active {
  display: block; /* Show the player */
  animation: slidein 1s forwards; /* Slide-in animation */
}

/* Close Button */
.close-player-button {
  position: absolute;
  top: 0;
  right: 10px;
  background: transparent;
  border: none;
  color: #fff;
  font-size: 24px;
  cursor: pointer;
  z-index: 1000; /* Ensure it appears above other elements */
}


#audioPlayer.active {
  grid-area: audio-player;
  grid-column: 1 / -1;
  position: sticky;
  bottom: 0px;
  display: grid;
  grid-template-columns: 1fr auto 1fr;
  grid-template-rows: 48px 1fr;
  grid-column-gap: 0;
  z-index: 999;
  width: 100%;
  height: 150px;
  padding: 0;
  align-items: center;
  justify-items: center;
  background-color: var(--secondary-background-color);
}

#audioPlayer .remix {
  width: 24px;
  height: 24px;
  fill: #fff;
  filter: invert(1);
}

#audioPlayer > .transport > .play-button .remix-big {
  width: 48px;
  height: 48px;
  fill: #fff;
  filter: invert(1);
}

.wave-form {
  grid-column: 1 / -1;
  grid-row-start: 1;
  min-width: 100px;
  width: calc(100% - 2em); /* Adjusted width to account for margin */
  height: 44px;
  margin: 1em; /* Added margin */
  padding-top: 0.7em;
  justify-self: center;

}

.track-info {
  grid-row-start: 2;
  grid-column: 1;
  width: 100%;
  padding: 0 0 0 1em;
  display: flex;
  align-items: center;
  justify-content: flex-start; /* Align items to the left */
}

.track-details {
  display: flex;
  align-items: center; /* Align items to the center vertically */
  flex-wrap: nowrap; /* Prevent wrapping */
  overflow: hidden; /* Hide overflow */
}

.track-info .track-art {
  width: 64px; /* Adjust the width as needed */
  height: 64px; /* Ensure height matches the height of .track-info */
  display: flex; /* Ensures alignment of the image inside the div */
  align-items: center; /* Vertically center the image */
  justify-content: center; /* Horizontally center the image */
  flex-shrink: 0; /* Prevent the track art from shrinking */
}

.track-info .track-art img {
  max-width: 100%; /* Ensure the image scales correctly */
  max-height: 100%; /* Ensure the image scales correctly */
}

.track-info .composer-name {
  color: var(--secondary-color);
  font-weight: 700;
  font-size: 0.9rem;
  white-space: nowrap; /* Prevent line break */
  margin-left: 1rem; /* Add space between the image and text */
  flex-shrink: 1; /* Allow the composer name to shrink if needed */
  flex-grow: 0; /* Prevent the composer name from growing */
}

.track-info .track-title {
  color: var(--secondary-color);
  font-weight: 300;
  font-size: 0.9rem;
  white-space: nowrap; /* Prevent line break */
  margin-left: 0.5rem; /* Adjust the spacing between elements */
  margin-right: 0.5rem; /* Adjust the spacing between elements */
  line-height: 1.3rem;
  flex-shrink: 1; /* Allow the track title to shrink if needed */
  flex-grow: 0; /* Prevent the track title from growing */
}

/* Media query for narrow screens */
@media screen and (max-width: 768px) {
  .track-info .composer-name {
    display: none; /* Hide the composer name */
  }

  .track-info .track-title {
    white-space: normal; /* Allow the text to wrap */
    overflow: hidden; /* Hide overflow */
    text-overflow: ellipsis; /* Add ellipsis if needed */
    max-width: 100%; /* Make sure it doesn't overflow the container */
    margin-left: 1rem; /* Adjust the spacing between elements */
  }
}

.col1 {
  width: 48px;
  height: 100%;
}
.col2 {
  width: -webkit-calc(100% - 48px);
  width: -moz-calc(100% - 48px);
  width: calc(100% - 48px);
  height: 50%;
}

.transport {
  grid-row-start: 2;
  grid-column: 2;
}

.transport {
  display: flex;
  gap: 0;
  align-items: center;
  justify-content: center;
  width: 100%;
}

/* Play button */
.transport .play-button {
  /* Reset default button styles */
  border: none;
  background-color: transparent;
  outline: none;
  cursor: pointer;
}

/* Stop button */
.transport .stop-button {
  /* Reset default button styles */
  border: none;
  background-color: transparent;
  outline: none;
  cursor: pointer;
}

/* Skip back button */
.transport .skip-back-button {
  /* Reset default button styles */
  border: none;
  background-color: transparent;
  outline: none;
  cursor: pointer;
}

/* Skip forward button */
.transport .skip-forward-button {
  /* Reset default button styles */
  border: none;
  background-color: transparent;
  outline: none;
  cursor: pointer;
}

@media screen and (max-width: 740px) {
  #audioPlayer.active {
    height: 220px;
  }
  .transport {
    grid-row-start: 3;
    grid-column: 1 / -1;
    margin-bottom: 1em;
  }
}

.controls {
  grid-row-start: 2;
  grid-column: 3;
  width: 100%;
  height: 50px;
  margin: 0 1em;
  padding-right: 1em;
  display: flex;
  justify-content: right;
}

/* Timecode */
.timecode {
  margin: 0 0 0 1em;
  font-family: monospace;
  font-size: 0.7rem;
  font-weight: 300;
  color: var(--secondary-color);
  text-align: center;
  align-self: center;
  justify-self: center;
}

@media screen and (max-width: 740px) {
  .timecode {
    visibility: hidden;
    width: 0;
  }
}

/* Repeat button */
.repeat-button {
  width: 36px;
  height: 36px;
  margin: 0 1em;
  align-self: center;
  justify-self: center;
  /* Reset default button styles */
  border: none;
  background-color: transparent;
  outline: none;
  cursor: pointer;
}

/* Controls include volume mute/unmute, volume slider and timecode */
.volume-controls {
  display: flex;
  justify-content: space-between;
  width: 100%;
  height: 100%;
  min-width: 100px;
}

/* Volume */
#volume {
  display: flex;
  align-items: center;
}
#volume .volume-icon {
  cursor: pointer;
  margin: 0 1em;
}

#volume input[type=range].slider {
  cursor: pointer;
  width: 100%;
  margin: 0 0 0 1em;
  outline: none;
  -webkit-appearance: none;
  height: 0.5rem;
  background-color: #555;
  border-radius: var(--border-radius);
}

/*generated with Input range slider CSS style generator (version 20211225)
https://toughengineer.github.io/demo/slider-styler*/
input[type=range].slider {
  height: 0.5rem;
  -webkit-appearance: none;
}

/*progress support*/
input[type=range].slider.slider-progress {
  --range: calc(var(--max) - var(--min));
  --ratio: calc((var(--value) - var(--min)) / var(--range));
  --sx: calc(0.5 * 1.5rem + var(--ratio) * (100% - 1.5rem));
}

input[type=range].slider:focus {
  outline: none;
}


/*webkit*/
input[type=range].slider::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #FFFFFF;
  border: none;
  box-shadow: none;
  margin-top: calc(0.5rem * 0.5 - 1.5rem * 0.5);
}

input[type=range].slider::-webkit-slider-runnable-track {
  height: 0.5rem;
  border: none;
  border-radius: var(--border-radius);
  background: #555555;
  box-shadow: none;
}

input[type=range].slider::-webkit-slider-thumb:hover {
  background: #FFFFFF;
}

input[type=range].slider::-webkit-slider-thumb:active {
  background: #FFFFFF;
}

input[type=range].slider.slider-progress::-webkit-slider-runnable-track {
  background: linear-gradient(#999999,#999999) 0/var(--sx) 100% no-repeat, #555555;
}

input[type=range].slider.slider-progress:hover::-webkit-slider-runnable-track {
  background: linear-gradient(#ff4600,#ff4600) 0/var(--sx) 100% no-repeat, #555555;
}

input[type=range].slider.slider-progress:active::-webkit-slider-runnable-track {
  background: linear-gradient(#ff4600,#ff4600) 0/var(--sx) 100% no-repeat, #555555;
}

/*mozilla*/
input[type=range].slider::-moz-range-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #FFFFFF;
  border: none;
  box-shadow: none;
}

input[type=range].slider::-moz-range-track {
  height: 0.5rem;
  border: none;
  border-radius: var(--border-radius);
  background: #555555;
  box-shadow: none;
}

input[type=range].slider::-moz-range-thumb:hover {
  background: #FFFFFF;
}

input[type=range].slider::-moz-range-thumb:active {
  background: #FFFFFF;
}

input[type=range].slider.slider-progress::-moz-range-track {
  background: linear-gradient(#999999,#999999) 0/var(--sx) 100% no-repeat, #555555;
}

input[type=range].slider.slider-progress:hover::-moz-range-track {
  background: linear-gradient(#ff4600,#ff4600) 0/var(--sx) 100% no-repeat, #555555;
}

input[type=range].slider.slider-progress:active::-moz-range-track {
  background: linear-gradient(#ff4600,#ff4600) 0/var(--sx) 100% no-repeat, #555555;
}

/*ms*/
input[type=range].slider::-ms-fill-upper {
  background: transparent;
  border-color: transparent;
}

input[type=range].slider::-ms-fill-lower {
  background: transparent;
  border-color: transparent;
}

input[type=range].slider::-ms-thumb {
  width: 1.5rem;
  height: 1.5rem;
  border-radius: 50%;
  background: #FFFFFF;
  border: none;
  box-shadow: none;
  margin-top: 0;
  box-sizing: border-box;
}

input[type=range].slider::-ms-track {
  height: 0.5rem;
  border-radius: var(--border-radius);
  background: #555555;
  border: none;
  box-shadow: none;
  box-sizing: border-box;
}

input[type=range].slider::-ms-thumb:hover {
  background: #FFFFFF;
}

input[type=range].slider::-ms-thumb:active {
  background: #FFFFFF;
}

input[type=range].slider.slider-progress::-ms-fill-lower {
  height: 0.5rem;
  border-radius: 0.5rem 0 0 0.5rem;
  margin: -undefined 0 -undefined -undefined;
  background: #999999;
  border: none;
  border-right-width: 0;
}

input[type=range].slider.slider-progress:hover::-ms-fill-lower {
  background: #ff4600;
}

input[type=range].slider.slider-progress:active::-ms-fill-lower {
  background: #ff4600;
}

/* Muted/disabled volume slider */

#volume .slider[disabled] {
  cursor: not-allowed;
}
#volume .slider[disabled]::-webkit-slider-thumb {
  background-color: var(--disabled-button-color);
  visibility: visible;
}
#volume .slider[disabled]::-moz-range-thumb {
  background-color: var(--disabled-button-color);
  visibility: visible;
}
#volume .slider[disabled]::-ms-thumb {
  background-color: var(--disabled-button-color);
  visibility: visible;
}
#volume .slider[disabled]::-webkit-slider-runnable-track {
  background-color: var(--disabled-button-color);
}
#volume .slider[disabled]::-moz-range-track {
  background-color: var(--disabled-button-color);
}
#volume .slider[disabled]::-ms-track {
  background-color: var(--disabled-button-color);
}

.slider-progress[disabled] {
  cursor: not-allowed;
}
.slider-progress[disabled]::-webkit-slider-thumb {
  visibility: visible;
}
.slider-progress[disabled]::-moz-range-thumb {
  visibility: visible;
}
.slider-progress[disabled]::-ms-thumb {
  visibility: visible;
}
.slider-progress[disabled]::-webkit-slider-runnable-track {
  visibility: visible;
}
.slider-progress[disabled]::-moz-range-track {
  visibility: visible;
}
.slider-progress[disabled]::-ms-track {
  visibility: visible;
}
