@import url("https://fonts.googleapis.com/css2?family=Nunito:wght@300;500&family=Permanent+Marker&display=swap");

/* ========================
   Variables
   ======================== */
:root {
  --light-clr: #f5e9ff;
  --primary-clr: #a855f7;
  --secondary-clr: #c084fc;
  --active-clr: rgba(168, 85, 247, 0.25);
  --player-bg: rgba(40, 0, 70, 0.55);
  --scrollbar-track: #3a0ca3;
  --scrollbar-thumb: #a855f7;
}

/* ========================
   Reset
   ======================== */
*,
*::before,
*::after {
  box-sizing: border-box;
  padding: 0;
  margin: 0;
}

img {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: cover;
  user-select: none;
}

h1 {
  font-size: clamp(0.8rem, 3vw, 1rem);
}

p {
  font-size: clamp(0.7rem, 3vw, 1rem);
}

/* ========================
   Body & Background
   ======================== */
body {
  font-family: "Nunito", sans-serif;
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100vh;
  background: linear-gradient(135deg, #a0bcc0, #3a0ca3, #e0c8f6);
  background-size: 300% 300%;
  animation: bg-gradient 15s ease infinite;
}

@keyframes bg-gradient {
  0%   { background-position: 0% 50%; }
  50%  { background-position: 100% 50%; }
  100% { background-position: 0% 50%; }
}

/* ========================
   Layout
   ======================== */
main {
  position: relative;
  width: 90%;
  height: 90%;
  background: transparent;
  box-shadow: 0 0 10px rgba(168, 85, 247, 0.4);
  border-radius: 15px;
  overflow: hidden;
}

.content {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  display: grid;
  grid-template-columns: 100%;
  place-items: center;
  background: rgba(90, 0, 150, 0.2);
  backdrop-filter: blur(12px);
  -webkit-backdrop-filter: blur(12px);
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: inherit;
  box-shadow: inset 0 0 15px rgba(168, 85, 247, 0.3);
  z-index: 10;
  color: var(--light-clr);
  overflow-y: auto;
  padding: 30px 30px 10px;
}

/* ========================
   Scrollbar
   ======================== */
.content::-webkit-scrollbar {
  width: 7px;
}

.content::-webkit-scrollbar-track {
  box-shadow: inset 0 0 0.3rem var(--scrollbar-track);
  border-radius: 40px;
  margin: 18px 0;
}

.content::-webkit-scrollbar-thumb {
  background: linear-gradient(180deg, #c084fc, #9333ea, #7e22ce);
  border-radius: 40px;
}

/* ========================
   Slider + Playlist Grid
   ======================== */
.slider-playlist {
  display: grid;
  grid-template-columns: 45% 55%;
  align-items: center;
}

/* ========================
   Swiper
   ======================== */
.swiper {
  width: 300px;
  height: auto;
}

.swiper-slide {
  display: grid;
  grid-template-rows: 4fr 1fr;
  padding: 15px;
  border-radius: 10px;
  background: linear-gradient(145deg, #ede9fe, #f3e8ff);
  box-shadow: 0 0 12px rgba(168, 85, 247, 0.35);
  user-select: none;
}

.swiper-slide img {
  aspect-ratio: 1/1;
  border-radius: 5px;
  margin-bottom: 14px;
  pointer-events: none;
}

.swiper-slide h1 {
  width: max-content;
  font-family: "Permanent Marker", serif;
  letter-spacing: 2px;
  color: #4c1d95;
  text-transform: uppercase;
  transform: rotate(-3deg);
  margin: auto;
}

/* ========================
   Playlist
   ======================== */
.playlist {
  width: 100%;
}

.playlist-item {
  display: grid;
  grid-template-columns: 15% 65% 15% 5%;
  align-items: center;
  width: 100%;
  padding: 8px 10px;
  margin-bottom: 15px;
  border-bottom: 2px solid var(--primary-clr);
  color: var(--light-clr);
  cursor: pointer;
  user-select: none;
  transition: background 0.3s ease, transform 0.2s ease;
}

.playlist-item:hover {
  background: linear-gradient(90deg, rgba(168, 85, 247, 0.2), rgba(192, 132, 252, 0.15));
  transform: translateX(4px);
}

.playlist-item img {
  width: 70%;
  aspect-ratio: 1/1;
  border-radius: 5px;
}

.playlist-item .song p:nth-child(1) {
  font-weight: 500;
  margin-bottom: 3px;
}

.playlist-item .song p:nth-child(2) {
  font-weight: 300;
  opacity: 0.5;
}

.playlist-item i {
  font-size: 1.2rem;
  color: var(--light-clr);
}

.active-playlist-item {
  background: linear-gradient(90deg, rgba(192, 132, 252, 0.3), rgba(168, 85, 247, 0.4));
  border-radius: 5px;
}

/* ========================
   Player
   ======================== */
.player {
  position: sticky;
  left: 0;
  bottom: 0;
  width: 100%;
  border: 1px solid rgba(255, 255, 255, 0.25);
  border-radius: 10px;
  background: linear-gradient(135deg, rgba(55, 0, 100, 0.7), rgba(168, 85, 247, 0.2));
  backdrop-filter: blur(10px);
  -webkit-backdrop-filter: blur(10px);
  box-shadow: 0 4px 16px rgba(168, 85, 247, 0.35);
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 10px 0 5px;
  z-index: 15;
  overflow: hidden;
}

/* ========================
   Controls
   ======================== */
.controls {
  display: flex;
  justify-content: center;
  align-items: center;
  column-gap: 25px;
}

.controls i {
  font-size: 1.7rem;
  cursor: pointer;
}

.control-btn {
  background: none;
  border: none;
  color: inherit;
  cursor: pointer;
  padding: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.2s ease;
}

.control-btn:hover {
  transform: scale(1.1);
}

#playPauseBtn {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 45px;
  aspect-ratio: 1/1;
  margin: 5px 0;
  color: var(--primary-clr);
  outline: 0;
  background: linear-gradient(135deg, #ede9fe, #f3e8ff);
  border: 2px solid rgba(168, 85, 247, 0.6);
  border-radius: 50%;
  box-shadow: 0 10px 20px rgba(149, 46, 209, 0.35);
  font-size: 1.5rem;
  cursor: pointer;
  transition: all 0.3s ease;
}

#playPauseBtn:hover {
  transform: scale(1.1);
  background: linear-gradient(135deg, #c084fc, #a855f7);
  color: #fff;
}

/* ========================
   Volume
   ======================== */
.volume {
  position: relative;
  display: flex;
  align-items: center;
}

.volume i {
  color: var(--light-clr);
  font-size: 1.2rem;
}

#volume-range {
  position: absolute;
  left: 30px;
  top: 7px;
  appearance: none;
  -webkit-appearance: none;
  width: 120px;
  height: 4px;
  background: linear-gradient(90deg, #c084fc, #a855f7);
  border-radius: 4px;
  cursor: pointer;
}

#volume-range::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  background: var(--light-clr);
  width: 12px;
  aspect-ratio: 1/1;
  border-radius: 50%;
}

/* ========================
   Progress Bar
   ======================== */
#progress-bar {
  appearance: none;
  -webkit-appearance: none;
  width: 90%;
  height: 5px;
  background: linear-gradient(90deg, #ede9fe, #c084fc, #a855f7, #9333ea, #ede9fe);
  border-radius: 4px;
  margin: 12px 0 16px;
  cursor: pointer;
}

#progress-bar::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  background: var(--light-clr);
  width: 15px;
  aspect-ratio: 1/1;
  border-radius: 50%;
}

/* ========================
   Loader
   ======================== */
.loader {
  position: fixed;
  inset: 0;
  z-index: 9999;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1a0533, #2d0a4e, #1a0533);
  transition: opacity 0.6s ease, visibility 0.6s ease;
}

.loader.fade-out {
  opacity: 0;
  visibility: hidden;
}

.loader-content {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 22px;
}

.loader-icon {
  width: 68px;
  height: 68px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--primary-clr), #7c3aed);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 0 30px rgba(168, 85, 247, 0.5), 0 0 60px rgba(168, 85, 247, 0.15);
  animation: loader-pulse 1.8s ease-in-out infinite;
}

.loader-icon i {
  font-size: 1.6rem;
  color: #fff;
}

@keyframes loader-pulse {
  0%, 100% { transform: scale(1); box-shadow: 0 0 30px rgba(168, 85, 247, 0.5); }
  50% { transform: scale(1.06); box-shadow: 0 0 50px rgba(168, 85, 247, 0.7); }
}

.loader-title {
  font-family: "Permanent Marker", serif;
  font-size: 1.4rem;
  color: var(--light-clr);
  letter-spacing: 3px;
  text-transform: uppercase;
}

.loader-bar {
  width: 200px;
  height: 3px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 3px;
  overflow: hidden;
}

.loader-fill {
  width: 0%;
  height: 100%;
  background: linear-gradient(90deg, var(--secondary-clr), var(--primary-clr), #7c3aed);
  border-radius: 3px;
  transition: width 0.3s ease;
}

.loader-percent {
  font-size: 0.8rem !important;
  color: rgba(245, 233, 255, 0.4);
  font-weight: 500;
  letter-spacing: 2px;
}

/* App hidden during loading */
.app-hidden {
  opacity: 0;
  transform: translateY(15px);
  transition: opacity 0.7s ease, transform 0.7s ease;
}

.app-visible {
  opacity: 1;
  transform: translateY(0);
}

/* ========================
   Copyright
   ======================== */
.copyright {
  text-align: center;
  margin-bottom: 10px;
  font-size: 12px;
  font-weight: 500;
}

/* ========================
   Responsive - 1300px
   ======================== */
@media (max-width: 1300px) {
  main {
    width: 90%;
  }

  .swiper {
    width: 270px;
  }
}

/* ========================
   Responsive - 1100px
   ======================== */
@media (max-width: 1100px) {
  .content {
    padding: 40px 20px 20px;
  }

  .swiper {
    width: 240px;
  }

  .slider-playlist {
    grid-template-columns: 50% 50%;
  }
}

/* ========================
   Responsive - 900px
   ======================== */
@media (max-width: 900px) {
  .content {
    padding: 30px 40px 20px;
  }

  .slider-playlist {
    grid-template-columns: 100%;
  }

  .swiper {
    margin: 30px auto 50px;
  }

  .player {
    width: 110%;
  }

  #volume-range {
    width: 50px;
  }
}

/* ========================
   Responsive - 580px
   ======================== */
@media (max-width: 580px) {
  .swiper {
    width: 220px;
    margin: 20px auto 35px;
  }

  .playlist-item {
    margin-bottom: 10px;
  }

  .player {
    width: 115%;
  }

  .controls {
    column-gap: 15px;
  }

  .controls i {
    font-size: 1.3rem;
  }

  #playPauseBtn {
    width: 40px;
    font-size: 1.2rem;
  }

  .volume i {
    font-size: 0.9rem;
  }

  #volume-range {
    left: 20px;
    top: 6px;
    width: 40px;
  }
}
