html, body {
  height: 100%;
  width: 100%;
  margin: 0;
  padding: 0;
}


body {
  font-family: sans-serif;
  background: #121212;
  color: #fff;

  display: flex;
  align-items: center;
  flex-direction: column;
  height: 100vh;
  width: 100%;
  box-sizing: border-box;
}

/* Visualizer as background - hidden initially */
.visualizer {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  gap: 2px;
  padding: 0 10px;
  pointer-events: none;
  z-index: 1;
  opacity: 0; /* Start invisible */
  transition: opacity 0.4s ease; /* Smooth fade in */
}

/* When music is playing, fade in */
.visualizer.active {
opacity: 0.33;
}

.bar {
  flex: 1;
  width: 100%;
  height: 100%;
  background: white;
  border-radius: 4px;
  transition: height 0.08s linear;
}


/* === OPEN PLAYLIST BUTTON === */
#open-playlist {
  width: 100%;

  height:55px;
  border-radius: 11px;
  gap: 20px 15px;

  text-align: left;

  background: #434863;
  box-shadow: 0px 4px 8px rgba(0, 0, 0, 0.2);
  transition: background 0.8s cubic-bezier(.4,0,.2,1);
  color: rgba(255, 255, 255, 0.7);

  border: none;
  font-size: 1.1rem;
  cursor: pointer;

  flex-shrink: 0;
}

#video-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background: rgba(0,0,0,0.4); /* semi-transparent black */
  pointer-events: none; /* allows clicks to pass through */
  z-index: 1; /* sits above video but below controls */
}

#bg-video {
  position: absolute;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  height: 100%;
  max-width: 500px;
  object-fit: cover;
  z-index: 0;
  opacity: 0;
  display: block;
  transition: opacity 0.5s ease;
}

#bg-video.show {
  opacity: 1;
}


/* === PLAYLIST SHEET === */
/* CLOSED */
#playlist-sheet {
  position: fixed;
  inset: 0;
  background: linear-gradient(to bottom, #181a1e, #000);
  transform: translateY(100%);
  transition: transform 0.55s cubic-bezier(.22,1,.36,1);
  will-change: transform;
  pointer-events: none;
  z-index: 1000;
  /*display: flex;*/
  flex-direction: column;
  overflow:hidden;
}


/* OPEN */
#playlist-sheet.open {
  transform: translateY(0);
  pointer-events: auto;
}

/* === PLAYLIST LIST ===  */ 
#playlist {
  list-style: none;
  margin: 0;
  overflow-y: auto;
  max-height: 70vh;
}


#libraryPlaylist {
  width: calc(100% - 25px);
  list-style: none;
  margin: 0;
  padding: 0;
  overflow: hidden;
  overflow-y: auto;
  border-radius: 8px;
}

.screen-viewport {
  touch-action: pan-y;
}


.mini-player {
  display: flex;
  align-items: center;


  width: 100%;
  padding: 10px 12px;

  background: rgba(255, 255, 255, 0.1);
  border: none;
  /*border-radius: 12px;*/

  color: white;
  cursor: pointer;
}

#mini-cover {
  width: 42px;
  height: 42px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

.mini-text {
  flex: 1;
  overflow: hidden;
}

#mini-title {
  display: block;
  font-size: 14px;
  font-weight: 600;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: white;
}

#mini-artist {
  display: block;
  font-size: 12px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  color: #dedede;
}

.mini-controls {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 28px;
  height: 28px;
}

.mini-controls svg {
  width: 22px;
  height: 22px;
  fill: white;
  cursor: pointer;
}

#mini-pause {
  display: none; /* default */
}

.screen-title {
  margin-left: 5px;
}

#topBar {
  display: flex;
}

/* MAIN CONTAINER  */
.music-container {
  /*padding: 1rem;
  background: linear-gradient(to bottom, #2c2c2c, #121212);*/

  box-sizing: border-box;

  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;

  gap: 20px;
  width: 100%;
  /*max-width: 450px;*/

  display: block;
  margin-left: auto;
  margin-right: auto;
  
}

.player-content {
  position: relative; /* Creates stacking context */
  z-index: 2; /* Above visualizer */
}

/* PLAYER CARD */
.player {
  margin-top: 15px;
  width: 90%;
  text-align: center;
  /*backdrop-filter: blur(6px);*/
  overflow: hidden;

  flex: 1;
  overflow-y: auto;
  padding: 1.2rem;
}

/* === NOW PLAYING SECTION === */
.now-playing {
  display: flex;
  flex-direction: column;
}

.now-playing img {
  width: 100%;
  max-width: 400px;
  aspect-ratio: 1 / 1;
  object-fit: cover;
  border-radius: 11px;
  margin-bottom: 2.5rem;

  display: block;
  margin-left: auto;
  margin-right: auto;
}

.cover-wrapper {
  width: 100%;
  /*height: 400px;*/
  overflow: hidden;
  position: relative;

  display: block;
  margin-left: auto;
  margin-right: auto;
}

#cover {

  object-fit: cover;

  transform: translateX(0);
  transition: transform 0.55s cubic-bezier(.22,1,.36,1);
  will-change: transform;
}

/* slide states */
#cover.slide-out-left {
  transform: translateX(-300%);
}

#cover.slide-out-right {
  transform: translateX(300%);
}

#cover.slide-in-right {
  transform: translateX(300%);
}

#cover.slide-in-left {
  transform: translateX(-300%);
}

#cover.no-transition {
  transition: none;
}




.now-playing h2,
.now-playing p {
  text-align: left;
}

.now-playing h2 {
  margin: 5px 0 2px;
  font-size: clamp(1.35rem, 4vw, 1.6rem);
  font-weight: 700;
}

.now-playing p {
  margin: 0;
  font-size: clamp(0.9rem, 3vw, 1.1rem);
  color: #abaab6ec;
  margin-bottom: 10px;
}

.search-head {
  display: flex;
  justify-content: center;
  gap: 1vh;
}


.toggle-playlist-btn {
  position: relative;

  margin-bottom: 8px;
  padding: 1px;
  cursor: pointer;

  background: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color: white;

  z-index: 1;
}


#toggle-playlist svg {
  padding: 13px;
  width: 20px;
  height: 20px;
  color: white;

  z-index: 1;
}

/* default (white) */
#toggle-playlist {
  color: white;

  z-index: 1;
}



/* === SEEK BAR === */
#seek-bar {
  width: 100%;
  margin: 12px 0;
  -webkit-appearance: none;
  height: 5px;
  background: #555;
  border-radius: 5px;
  outline: none;
}

#seek-bar::-webkit-slider-thumb {
  -webkit-appearance: none;
  width: 14px;
  height: 14px;
  background: rgb(255, 255, 255);
  border-radius: 50%;
  cursor: pointer;
}

/* === TIME INFO === */
.time-info {
  display: flex;
  justify-content: space-between;
  font-size: 0.9rem;
  color: #ccc;
  margin-bottom: 10px;
}

/* === CONTROLS SECTION === */
.controls {
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 10px 0 10px;
}

.controls button,
.icon-btn {
  background: transparent;  
  border: none;
  color: white;            
  cursor: pointer;
  transition: transform 0.08s; 
  padding: 1.5vh;
  border-radius: 100px;
}

/* Make SVG icons bigger without changing button size */
.icon-btn svg {
  width: 25px;
  height: 25px;
  display: block;
}

#prev svg {
  transform: scaleX(-1);
}

#shuffle svg {
  width: 23px;
  height: 23px;
}


#repeat svg {
  width: 24px;
  height: 24px;
}

/* Make the Play/Pause button bigger */
#play svg {
  width: 70px;
  height: 70px;
}

#play {
  padding: 0px; /* a bit more space around the bigger icon */
}
#play {
  /*background: #3b6842;*/
  transition: transform 0.15s ease, background 0.2s;
}

#play:hover {
  /*background: #4caf50;*/
  transform: scale(1.1);
}

#play:active {
  transform: scale(1.05);
}


/* Hover + press effects for non-active buttons */
.icon-btn:hover:not(.mode-active),
.controls button:hover:not(.mode-active) {
  transform: translateY(-2px);
}

.icon-btn:active:not(.mode-active),
.controls button:active:not(.mode-active) {
  transform: translateY(0);
}

/* Active mode (shuffle/repeat) buttons */
.icon-btn.mode-active,
.controls button.mode-active {
  background: #49f56600;           
  color: #49f566;               /*color of the button changes but not the bakcground*/
  font-weight: bold;
}

/* Optional: maintain press transform for active buttons */
.icon-btn.mode-active:active,
.controls button.mode-active:active {
  transform: translateY(0);
}

.secondControls{
  display: flex;
  justify-content: center;
  gap: 1.5rem;
  margin: 10px 0 10px;
}

.setTimer{
  display: block;
  margin-left: auto;
}

#timer{
  margin-right: 20px;
  
  background: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color: white;

  height: 40px;
  width: 40px;
}

#timer.active svg {
  fill: #4CAF50;
}

#queue{
  margin-left: 20px;

  background: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color: white;

  height: 40px;
  width: 40px;
}

.options-btn{
  display: block;
  margin-left: auto;

  background: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color: white;

  height: 30px;
  width: 35px;
}

.options{
  margin-left: auto;
  margin-top: 15px;

  padding: 1px;

  background: transparent;
  border: none;
  outline: none;
  appearance: none;
  -webkit-appearance: none;
  color: rgb(0, 0, 0);

  height: 30px;
  width: 35px;
}

.playlists-screen{
  position: relative;
}

.optionItem {
  display: none;
}

.songRequestScreen {
  position: absolute;
  left: 0;
  bottom: 0;

  width: 100%;
  height: 100%;

  background: #121212;
  z-index: 50;

  transform: translateY(100%);
  transition: transform 0.35s ease;
}

.songRequestScreen.active {
  transform: translateY(0);
}

.songRequestScreen iframe {
  width: 100%;
  height: 100%;
  border: none;
}

.closeRequest {
  position: absolute;
  top: 10px;
  left: 50%;
  transform: translateX(-50%);

  font-size: 24px;
  background: none;
  border: none;
  color: white;
  cursor: pointer;
  z-index: 2;
}



#timerScreen {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 80%;
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(10px);
  border-radius: 20px 20px 0 0;
  z-index: 1000;
  flex-direction: column;
  transform: translateY(2000%);
  transition: transform 0.55s cubic-bezier(.22,1,.36,1);
}

#timerScreen.open {
  display: flex;
  transform: translateY(50%);
}

.timerContent {
  display: flex;
  flex-direction: column;
  height: 0%;
}

.timerContent h2 {
  margin: 0;
  font-size: 1.5rem;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
  color: white;
}

.timer-input-section {
  flex: 1;
  display: flex;
  flex-direction: column;
  justify-content: center;
  align-items: center;
  padding: 20px;
  gap: 20px;
}

#timerMinutes {
  width: 100%;
  max-width: 200px;
  padding: 14px 16px;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.1);
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 8px;
  color: white;
  text-align: center;
  box-sizing: border-box;
}

#timerMinutes:focus {
  outline: none;
  border-color: #4CAF50;
  background: rgba(255, 255, 255, 0.15);
}

#timerMinutes::placeholder {
  color: rgba(255, 255, 255, 0.5);
}

.timerButtons {
  display: flex;
  gap: 12px;
  width: 100%;
  max-width: 200px;
}

.timerButtons button {
  flex: 1;
  padding: 14px 0;
  font-size: 0.95rem;
  font-weight: 500;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.2s ease;
}

#startTimer {
  background: #4CAF50;
  color: white;
}

#startTimer:hover {
  background: #45a049;
}

#cancelTimer {
  background: rgba(255, 255, 255, 0.1);
  color: white;
  border: 1px solid rgba(255, 255, 255, 0.2);
}

#cancelTimer:hover {
  background: rgba(255, 255, 255, 0.2);
}

#queueScreen {
  border-radius: 20px;

  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 68%;
  background: rgba(13, 17, 23, 0.95);
  backdrop-filter: blur(10px);
  z-index: 1000;
  flex-direction: column;

  transform: translateY(2000%);
  transition: transform 0.55s cubic-bezier(.22,1,.36,1);
}

#queueScreen.open {
  display: flex;
  transform: translateY(50%);
}

#queueScreen.closed {
  transform: translateY(2000%);
  transition: transform 0.55s cubic-bezier(.22,1,.36,1);
}

.queue-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 20px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.queue-header h2 {
  margin: 0;
  font-size: 1.5rem;
}

.close-queue {
  background: none;
  border: none;
  color: white;
  font-size: 2rem;
  cursor: pointer;
  padding: 0;
  width: 40px;
  height: 40px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.queue-list {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
}

.queue-item {
  display: flex;
  align-items: center;
  padding: 10px;
  border-radius: 8px;
  margin-bottom: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.queue-item:hover {
  background: rgba(255, 255, 255, 0.1);
}

.queue-item.active-queue-song {
  background: rgba(255, 255, 255, 0.15);
  border-left: 4px solid #4CAF50;
}

.queue-cover {
  width: 50px;
  height: 50px;
  border-radius: 6px;
  margin-right: 15px;
  object-fit: cover;
}

.queue-text {
  flex: 1;
}

.queue-text div:first-child {
  font-weight: 500;
  margin-bottom: 4px;
}

.queue-text div:last-child {
  font-size: 0.9rem;
  opacity: 0.7;
}

.song-options-popup {
  position: absolute;
  width: 150px;
  background: #1e1e1e;
  border-radius: 10px;
  padding: 8px 0;
  z-index: 9999;
  box-shadow: 0 10px 25px rgba(0,0,0,0.4);
}

.option-item {
  padding: 10px 14px;
  cursor: pointer;
  color: white;
}

.option-item:hover {
  background: rgba(255,255,255,0.08);
}

#libraryPlaylistScreen {
  background: linear-gradient(to bottom, #60678f, #121212);
  transition: background 0.4s ease;
}

.library-big-controls {
  flex-direction: column;
  align-items: center;
}

/* big cover*/
.library-playlist-cover {
  width: 200px;
  height: 200px;
  object-fit: cover;
  border-radius: 24px;
  box-shadow: 0 25px 70px rgba(0,0,0,0.6);
  transition: transform .35s ease, opacity .35s ease;
}

/* buttons row */
.library-big-buttons-row {
  display: flex;
  gap: 60px;
}

/* pop animation when playlist changes */
.library-playlist-cover.pop {
  transform: scale(1.06);
  opacity: 0.85;
}


.library-big-controls {
  display: flex;
  gap: 13px;
  justify-content: center;
  margin: 10px 0 3px 0;
}

.library-big-btn svg {
  width: 23px; 
  height: 23px; /*height: 23px;*/
  display: block;
  margin: auto;
  transform: translateX(2px); /* optical centering for ▶ shape */
}

#libraryBigShuffle svg {
  transform: translateX(0); /* no shift for shuffle icon */
  width: 36px;
  height: 36px;/*height: 36px;*/
}

.library-big-btn {
  width: 50px;
  height: 50px; /*height: 50px;*/
  border-radius: 50%;
  border: none;
  background: #1db954;
  color: black;
  font-size: 38px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(0,0,0,0.35);
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.library-big-btn:active {
  transform: scale(0.94);
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}


/* VIEWPORT */
.screen-viewport {
  position: relative;
  width: 100%;
  height: 100vh;
  overflow: hidden;
}

/* TRACK that moves */
.screen-track {
  display: flex;
  width: 300%;            /* 2 screens */
  height: 100%;
  transition: transform 0.45s cubic-bezier(.25,.8,.25,1);
}

/* Each screen */
.screen {
  width: 100vw;
  height: 100%;
  flex-shrink: 0;
  overflow-y: auto;

  overflow: hidden;
}



/* Bottom nav */
.bottom-nav {
  position: fixed;
  bottom: 0px; /* sits above mini player */
  left: 0;
  width: 100%;
  height: 17%;
  display: column;
  justify-content: space-around;
  background: #00000000;
  backdrop-filter: blur(.1px);
  padding: 10px 0;
  z-index: 50;
}

.nav-buttons {
  display: flex;
  justify-content: center;
  gap: 60px;
}

.nav-btn {
  background: none;
  border: none;
  color: #aaa;
  display: flex;
  flex-direction: column;
  align-items: center;
  font-size: 12px;
}

.nav-btn svg {
  width: 22px;
  height: 22px;
  fill: white;
  margin-bottom: 4px;
}

.nav-btn.active {
  color: white;
}

.library-grid {
  display: flex;
  flex-direction: column;
  align-items: left;
  gap: 20px;
  margin-top: 30px;

  height: calc(100% - 34%);
  overflow-y: auto;
}

.library-btn {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 10px;
  cursor: pointer;
}

.library-btn img {
  width: 92px;
  height: 92px;
  object-fit: cover;
  border-radius: 0px;
  box-shadow: 0 8px 20px rgba(0,0,0,0.35);
  transition: transform 0.2s ease;
}

.library-btn:hover img {
  transform: scale(1.05);
}

.library-btn span {
  font-size: 15px;
  font-weight: 600;
  opacity: 0.9;
}

.library-btn span {
  color: white;
}



.library-playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.library-playlist-item img {
  width: 50px;
  height: 50px;
  border-radius: 8px;
}

.library-playlist-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 0;
  cursor: pointer;
}

.library-playlist-item img {
  width: 48px;
  height: 48px;
  border-radius: 8px;
}



/* === SEARCH BAR & PLAYLIST === */
#search-bar {
  margin-top: 20px;
  width: calc(100% - 25px);
  padding: 4px;
  max-width: 835px;
  height: 36px;
  border: 2px solid #ffffff00;
  border-radius: 4px;
  font-size: 14px;
  color: white;
  background-color: #ffffff1d;
  box-sizing: border-box;
  flex-shrink: 0;

  display: block;
  margin-left: auto;
  margin-right: auto;
  
  margin-bottom: 2.5vh;
}

#playlist {
  width: calc(100% - 25px);
  list-style: none;
  margin: 0;
  padding: 0;
  overflow-y: auto;
  border: 2px solid #09c7fc00;
  border-radius: 8px;
  background-color: #11111100;

  margin-bottom: 2vh;
}


#libraryPlaylist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px;
  justify-content: flex-start;
  cursor: pointer;
}

/* small album cover */
.libraryPlaylist-cover {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  filter: blur(0.0px) brightness(0.95) contrast(0.9);
  /*low qualitysmall image just like Spotify!*/
}

/* text container */
.libraryPlaylist-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.libraryPlaylist-title,
.libraryPlaylist-artist {
  text-align: left;
}

.libraryPlaylist-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.libraryPlaylist-artist {
  font-size: 12px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* active row */
#libraryPlaylist li.active .libraryPlaylist-title{
  /*background-color: #2ecc71;*/
  color: #2ecc71;
  font-weight:700;
}

#libraryPlaylist li.active .libraryPlaylist-artist {
  opacity: 0.85;
}


/* === SCROLLBAR STYLING === */
#libraryPlaylist::-webkit-scrollbar {
  width: 6px;
}
#libraryPlaylist::-webkit-scrollbar-thumb {
  background-color: #666;
  border-radius: 3px;
}

/* === PLAYLIST ITEMS WITH COVERS === */
#playlist li {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 5px;
  justify-content: flex-start;
  cursor: pointer;
}

/* small album cover */
.playlist-cover {
  width: 42px;
  height: 42px;
  object-fit: cover;
  border-radius: 5px;
  flex-shrink: 0;
  filter: blur(0.0px) brightness(0.95) contrast(0.9);
  /*low qualitysmall image just like Spotify!*/
}

/* text container */
.playlist-text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.playlist-title,
.playlist-artist {
  text-align: left;
}

.playlist-title {
  font-size: 14px;
  font-weight: 600;
  letter-spacing: 0.2px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.playlist-artist {
  font-size: 12px;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* active row */
#playlist li.active .playlist-title{
  /*background-color: #2ecc71;*/
  color: #2ecc71;
  font-weight:700;
}

#playlist li.active .playlist-artist {
  opacity: 0.85;
}


/* === SCROLLBAR STYLING === */
#playlist::-webkit-scrollbar {
  width: 6px;
}
#playlist::-webkit-scrollbar-thumb {
  background-color: #666;
  border-radius: 3px;
}

/* === RESPONSIVE TWEAKS === */
@media (min-width: 600px) {
  .music-container {
    flex-direction: row;
    justify-content: space-around;
    align-items: flex-start;
    gap: 24px;
    max-width: 900px;
  }

  .player {
    flex: 1;
  }

  #playlist {
    max-height: 70vh;
    flex: 1;
  }

  #libraryPlaylist {
    max-height: 70vh;
    flex: 1;
  }
}
