@import url("https://fonts.googleapis.com/css2?family=Roboto:ital,wght@0,100..900;1,100..900&display=swap");

:root {
  --primary-color: #1db954;
  --black: #000;
  --dark-grey: #121212;
  --medium-grey: #181818;
  --light-grey: #282828;
  --text-primary: #fff;
  --text-secondary: #b3b3b3;
}

* {
  margin: 0;
  padding: 0;
  font-family: "Roboto", sans-serif;
  box-sizing: border-box;
}

body {
  background-color: var(--black);
  color: var(--text-primary);
  overflow: hidden; /* Prevent body scroll */
}

.container {
  height: 100vh;
  padding: 8px;
  gap: 8px;
  padding-bottom: 90px; /* Space for playbar */
}

.left {
  width: 25vw;
  max-width: 350px;
  display: flex;
  flex-direction: column;
  gap: 8px;
  transition: transform 0.3s ease-in-out;
}

.right {
  width: 75vw;
  flex-grow: 1;
  background-color: var(--dark-grey);
  border-radius: 8px;
  position: relative;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.home,
.library {
  background-color: var(--dark-grey);
  border-radius: 8px;
  padding: 1rem;
}

.spotify-logo {
  font-weight: bold;
  color: var(--primary-color);
  padding: 10px;
  font-size: 24px;
}

.home ul li {
  display: flex;
  align-items: center;
  gap: 15px;
  list-style: none;
  padding: 10px 0;
  font-weight: bold;
  cursor: pointer;
  opacity: 0.7;
  transition: opacity 0.1s ease;
}
.home ul li:hover,
.home ul li.active {
  opacity: 1;
}

.home ul li img {
  width: 24px;
}

.library {
  flex-grow: 1;
  overflow-y: auto;
  position: relative;
}
.heading {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 10px;
}
.add-playlist {
  background-color: transparent;
  color: var(--text-secondary);
  border: none;
  font-size: 24px;
  cursor: pointer;
  transition: color 0.2s ease;
}
.add-playlist:hover {
  color: var(--text-primary);
}
.playlists-container,
.songList {
  padding: 0 10px;
}
.playlists-container h4,
.songList h4 {
  color: var(--text-secondary);
  font-size: 14px;
  margin-bottom: 10px;
}

/* Playlist item styling */
#playlistsList {
  list-style: none;
}
#playlistsList li {
  padding: 8px 12px;
  cursor: pointer;
  opacity: 0.9;
  transition: all 0.25s ease;
  border: 1px solid #333; /* 👈 Always visible border */
  border-radius: 6px;
  margin-bottom: 6px;
  background-color: var(--medium-grey); /* 👈 same as artist card bg */
}
#playlistsList li:hover {
  opacity: 1;
  background-color: var(--light-grey);
  transform: scale(1.06); /* zoom effect */
}

/* Recently Played list styling */
#playList {
  counter-reset: songCount; /* 👈 for numbering */
  padding: 0;
  max-height: 45vh;
  overflow-y: auto;
  scrollbar-width: none; /* Firefox */
}
#playList::-webkit-scrollbar {
  display: none; /* Chrome, Safari */
}

#playList li.songItem {
  padding: 8px 12px;
  cursor: pointer;
  border-radius: 6px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  font-size: 14px;
  border: 1px solid #333; /* 👈 Always visible border */
  transition: all 0.25s ease;
  margin-bottom: 6px;
  background-color: var(--medium-grey); /* 👈 same as artist card bg */
  display: flex;
  align-items: center;
}

/* Numbering before each song */
#playList li.songItem::before {
  counter-increment: songCount;
  content: counter(songCount) ". ";
  font-weight: 600;
  margin-right: 8px;
  color: var(--text-secondary);
}

#playList li.songItem:hover {
  background-color: var(--light-grey);
  transform: scale(1.07);
}

/* Active (currently playing) song */
#playList li.songItem.active {
  background-color: var(--primary-color);
  color: var(--black);
  font-weight: bold;
  border-color: var(--primary-color);
}
/* Active song ka number bhi black ho */
#playList li.songItem.active::before {
  color: var(--black);
}

.header {
  display: flex;
  justify-content: space-between;
  background-color: var(--medium-grey);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  padding: 15px 24px;
  align-items: center;
  position: sticky;
  top: 0;
  z-index: 11;
}
.header .nav {
  display: flex;
  align-items: center;
  gap: 16px;
}
.nav-arrow {
  display: flex;
  gap: 8px;
}
.nav-arrow button {
  background: rgba(255, 255, 255, 0.1);
  border: none;
  color: white;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  cursor: pointer;
  transition: background-color 0.2s ease;
}
.nav-arrow button:hover {
  background: rgba(255, 255, 255, 0.2);
}
.buttons > * {
  margin: 0 12px;
}
.signupbtn {
  background-color: transparent;
  color: var(--text-secondary);
  font-weight: bold;
  border: none;
  cursor: pointer;
  font-size: 16px;
  transition: color 0.2s ease, transform 0.2s ease;
}
.signupbtn:hover {
  color: var(--text-primary);
  transform: scale(1.05);
}
.loginbtn {
  background-color: white;
  border-radius: 21px;
  color: black;
  padding: 12px 28px;
  cursor: pointer;
  border: none;
  font-size: 16px;
  font-weight: bold;
  transition: transform 0.2s ease;
}
.loginbtn:hover {
  transform: scale(1.05);
}
.user-profile {
  display: flex;
  align-items: center;
  gap: 15px;
}
.logout-btn {
  background-color: var(--primary-color);
  color: white;
  border: none;
  padding: 8px 15px;
  border-radius: 20px;
  cursor: pointer;
}

.main-content-wrapper {
  overflow-y: auto;
  flex-grow: 1;
  height: 100%;
}
.main-content,
.view-content {
  padding: 0 24px 16px 24px;
}

/* Sticky Header Logic */
.popularArtists {
  display: flex;
  flex-direction: column;
  height: 100%;
}
.artists-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  position: sticky;
  top: 0;
  background-color: rgba(18, 18, 18, 0.8);
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  z-index: 10;
  padding: 16px 0;
  margin: 0 -24px; /* Extend to full width */
  padding-left: 24px;
  padding-right: 24px;
}

.cardContainer {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(250px, 1fr));
  gap: 24px;
  padding-top: 16px;
}

.card {
  display: flex;
  align-items: center;
  gap: 15px;
  width: 100%;
  background-color: var(--medium-grey);
  border-radius: 8px;
  padding: 12px;
  cursor: pointer;
  transition: background-color 0.3s ease;
}
.card:hover {
  background-color: var(--light-grey);
}
.card img {
  width: 60px;
  height: 60px;
  border-radius: 8px;
  object-fit: cover;
}
.card .artist-info {
  text-align: left;
}
.card h2 {
  font-size: 16px;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.card p {
  font-size: 13px;
  color: var(--text-secondary);
  margin-top: 2px;
}

/* --- PLAYBAR --- */
.playbar-container {
  position: fixed;
  bottom: 0;
  left: 0;
  width: 100%;
  background-color: #181818;
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 14px 20px;
  color: white;
  z-index: 1001;
  border-top: 1px solid var(--light-grey);
  border-top: 1px solid var(--light-grey);
  gap: 20px;
}
.playbar-container .song-info {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
  min-width: 180px;
  overflow: hidden;
}
.song-info img {
  width: 56px;
  height: 56px;
  border-radius: 6px;
  object-fit: cover;
}
.song-details {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}
.song-details #song-title {
  font-size: 14px;
  font-weight: 500;
  margin: 0;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.song-details #song-artist {
  font-size: 12px;
  color: var(--text-secondary);
  margin-top: 2px;
}
.playbar-container .center {
  flex: 2;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 8px;
  max-width: 700px;
}
.controls {
  display: flex;
  align-items: center;
  gap: 16px;
}
.spotify-button {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 16px;
  transition: color 0.2s ease;
}
.spotify-button:hover {
  color: var(--text-primary);
}
.play-button {
  background-color: var(--primary-color);
  color: black;
  width: 32px;
  height: 32px;
  border-radius: 50%;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}
/* .play-button:hover {
  transform: scale(1.1);
} */
.progress-bar-container {
  display: flex;
  align-items: center;
  gap: 8px;
  width: 100%;
}
#current-time,
#duration {
  font-size: 12px;
  color: var(--text-secondary);
  min-width: 35px;
  text-align: center;
}
.playbar-container .right-controls {
  flex: 1;
  display: flex;
  justify-content: flex-end;
  min-width: 180px;
}
.main-volume-control {
  display: flex;
  align-items: center;
  gap: 10px;
}
#volume-icon {
  font-size: 16px;
}

/* --- SLIDER STYLES --- */
.slider-wrapper {
  position: relative;
  width: 100%;
  display: flex;
  align-items: center;
}
#volume-wrapper {
  width: 100px;
}
input[type="range"] {
  -webkit-appearance: none;
  appearance: none;
  background: transparent;
  width: 100%;
  height: 4px;
  outline: none;
  cursor: pointer;
  --track-bg: #4d4d4d;
  --track-fill: #fff;
  background: linear-gradient(
    to right,
    var(--track-fill) var(--value-percent, 0%),
    var(--track-bg) var(--value-percent, 0%)
  );
}
.slider-wrapper:hover input[type="range"] {
  --track-fill: var(--primary-color);
}
input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  height: 12px;
  width: 12px;
  background: white;
  border-radius: 50%;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.slider-wrapper:hover input[type="range"]::-webkit-slider-thumb {
  opacity: 1;
}
input[type="range"]::-moz-range-thumb {
  height: 12px;
  width: 12px;
  background: white;
  border-radius: 50%;
  border: none;
}
.slider-tooltip {
  position: absolute;
  bottom: 20px;
  background-color: var(--light-grey);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 12px;
  transform: translateX(-50%);
  pointer-events: none;
  opacity: 0;
  transition: opacity 0.2s ease;
}
.slider-wrapper:hover .slider-tooltip {
  opacity: 1;
}

/* MODALS */
.modal {
  display: none;
  position: fixed;
  z-index: 1002;
  left: 0;
  top: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.7);
  justify-content: center;
  align-items: center;
}
.modal-content {
  background-color: var(--light-grey);
  padding: 30px;
  width: 90%;
  max-width: 450px;
  border-radius: 8px;
  box-shadow: 0 5px 15px rgba(0, 0, 0, 0.5);
  position: relative;
}
.close-button {
  color: var(--text-secondary);
  position: absolute;
  top: 15px;
  right: 20px;
  font-size: 28px;
  font-weight: bold;
  cursor: pointer;
  transition: color 0.2s ease;
}
.close-button:hover {
  color: var(--text-primary);
}
.modal-header {
  text-align: center;
  margin-bottom: 25px;
  font-size: 24px;
  font-weight: bold;
}
.form-group {
  margin-bottom: 15px;
}
.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: bold;
  font-size: 14px;
}
.form-group input {
  width: 100%;
  padding: 12px;
  border: 1px solid #555;
  border-radius: 5px;
  background-color: var(--dark-grey);
  color: var(--text-primary);
  font-size: 16px;
}
.modal-content button[type="submit"] {
  background-color: var(--primary-color);
  color: white;
  padding: 14px 20px;
  border: none;
  border-radius: 25px;
  cursor: pointer;
  font-size: 16px;
  font-weight: bold;
  width: 100%;
  margin-top: 10px;
  transition: transform 0.2s ease;
}
.modal-content button[type="submit"]:hover {
  transform: scale(1.03);
}

/* SEARCH & OTHER VIEWS */
.search-box {
  padding: 1rem;
}
#searchInput {
  width: 100%;
  max-width: 350px;
  padding: 12px 20px;
  border-radius: 25px;
  border: none;
  background-color: var(--light-grey);
  color: white;
  font-size: 16px;
}
.searchResults,
.song-list-view {
  margin-top: 20px;
}
.song-list-header {
  display: flex;
  align-items: flex-end;
  gap: 20px;
  margin-bottom: 30px;
  margin-top: 13px;
}
.song-list-header img {
  width: 200px;
  height: 200px;
  border-radius: 8px;
  object-fit: cover;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.6);
}
.song-list-header .info p {
  font-size: 14px;
  font-weight: bold;
}
.song-list-header .info h1 {
  font-size: 4rem;
  margin: 0;
}
.song-list-view {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

/* Song item border and hover */
.songItem {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 12px;
  border-radius: 8px;
  cursor: pointer;
  transition: all 0.25s ease;
  border: 1px solid #333; /* 👈 Always visible border */
  background-color: rgba(255, 255, 255, 0.02); /* halka background */
}

.songItem:hover {
  background-color: rgba(255, 255, 255, 0.08); /* hover bg */
  transform: scale(1.02); /* 👈 zoom effect */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* soft shadow */
}

.songItem img {
  width: 55px;
  height: 55px;
  border-radius: 8px;
  object-fit: cover;
  transition: transform 0.3s ease;
}

.songItem:hover img {
  transform: scale(1.05); /* image bhi thoda zoom hoga */
}

.songItem .info {
  flex-grow: 1;
}

.songItem .info h3 {
  font-size: 16px;
  font-weight: 500;
}

.songItem .info p {
  font-size: 14px;
  color: var(--text-secondary);
}

.play-icon {
  color: var(--primary-color);
  font-size: 20px;
  visibility: hidden;
  opacity: 0;
  transition: opacity 0.25s ease, transform 0.25s ease;
}

.songItem:hover .play-icon {
  visibility: visible;
  opacity: 1;
  transform: scale(1.2); /* play icon thoda pop-up hoga */
}

/* CONTEXT MENU */
.context-menu {
  position: absolute;
  z-index: 1005;
  background-color: var(--light-grey);
  border-radius: 5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  padding: 5px;
  min-width: 180px;
}
.context-menu ul {
  list-style: none;
}
.context-menu ul li {
  padding: 10px 15px;
  cursor: pointer;
  border-radius: 3px;
  position: relative;
  display: flex;
  justify-content: space-between;
  align-items: center;
}
.context-menu ul li:hover {
  background-color: #3e3e3e;
}
.context-menu .submenu {
  display: none;
  position: absolute;
  left: 100%;
  top: -5px;
  background-color: var(--light-grey);
  border-radius: 5px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.5);
  padding: 5px;
}
.context-menu li:hover > .submenu {
  display: block;
}

/* UTILITY */
.hidden {
  display: none !important;
}

/* RESPONSIVE DESIGN */
.hamburger-menu,
.close-library-btn {
  display: none;
  font-size: 24px;
  cursor: pointer;
}

@media (max-width: 768px) {
  body {
    overflow: auto;
  }
  .container {
    padding: 0;
    padding-bottom: 80px; /* playbar ke liye jagah, 120 -> 80 */
  }
  .left {
    position: fixed;
    left: 0;
    top: 0;
    height: 100%;
    width: 80%;
    max-width: 300px;
    z-index: 1003;
    transform: translateX(-100%);
    background-color: var(--black);
    padding: 10px;
  }
  .left.open {
    transform: translateX(0);
  }
  .right {
    width: 100%;
    border-radius: 0;
  }
  .hamburger-menu,
  .close-library-btn {
    display: block;
  }
  .header .nav {
    gap: 8px;
  }
  .nav-arrow {
    display: none;
  }

  /* Mobile Playbar Layout */
  .playbar-container {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    /* padding: 10px 15px; */
    gap: 10px;
    background: var(--medium-grey);
    z-index: 1002;
    display: flex;
    flex-wrap: wrap;
    align-items: center;
    justify-content: space-between;
  }
  .playbar-container .song-info {
    order: 1;
    width: 100%;
    min-width: unset;
  }
  .playbar-container .center {
    order: 2;
    width: 100%;
  }
  .playbar-container .right-controls {
    display: none;
  }

  /* Mobile Artist Card Layout */
  .cardContainer {
    display: flex;
    flex-direction: column;
    gap: 10px;
  }

  .song-list-header {
    flex-direction: column;
    text-align: center;
    align-items: center;
  }
  .song-list-header .info h1 {
    font-size: 2.5rem;
  }
}
