/* ===== RESPONSIVE DESIGN STYLES ===== */

/* Animation for the wave effect in playing tracks */
@keyframes wave-slide {
  0% {
    opacity: 0;
    transform: translateX(-100%);
  }

  50% {
    opacity: 0.5;
  }

  100% {
    opacity: 0;
    transform: translateX(100%);
  }
}

/* ===== TABLETS (800px to 501px) ===== */
@media (max-width: 800px) and (min-width: 501px) {
  /* Override variables for tablet */
  :root {
    --music-player-height: 100px;
  }

  /* Layout adjustments */
  body {
    overflow-y: auto;
    height: 100%;
  }

  .sidebar {
    padding: 10px;
  }

  .playlist {
    width: 100%;
    margin: 0 auto;
  }

  /* Music Player grid layout for tablets */
  .player-content {
    display: grid;
    grid-template-columns: 25% 75%;
    grid-template-rows: auto auto;
    column-gap: 15px;
    padding-right: 40px;
    /* Space for volume control */
  }

  /* Track image adjustments */
  .track-image-container {
    grid-column: 1;
    grid-row: 1;
    width: 100%;
    display: flex;
    justify-content: center;
  }

  .track-image-container img {
    width: 80px;
    height: 80px;
  }

  /* Track Info positioning */
  .track-info {
    grid-column: 1;
    grid-row: 2;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 5px;
    flex: 0 0 auto;
    width: 100%;
  }

  .track-info h2 {
    margin-bottom: 3px;
  }

  /* Controls positioning */
  .controls-and-timer {
    grid-column: 2;
    grid-row: 1 / span 2;
    margin: 5px 0;
    width: 100%;
    max-width: calc(100% - 40px);
  }

  .time-info {
    font-size: 11px;
  }

  .volume-control {
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    height: 80%;
  }

  /* Responsive button sizing */
  .buttons-container {
    gap: calc(4% + 6px);
    width: 100%;
    margin: 8px 0;
  }

  .control-btn {
    width: calc(8% + 22px);
    height: calc(8% + 22px);
    font-size: calc(8px + 0.5vw);
  }

  #play-pause-btn {
    width: calc(10% + 28px);
    height: calc(10% + 28px);
    font-size: calc(10px + 0.5vw);
  }

  .music-player {
    min-height: 150px;
  }
}

/* ===== MOBILE (500px and below) ===== */
@media (max-width: 500px) {
  
  /* Override variables for mobile */
  :root {
    --music-player-height: 110px;
    --sidebar-height: 60px;
  }

  /* Main container adjustments */
  .main-container {
    width: 95%;
    max-width: 600px;
    margin-top: var(--sidebar-height);
    /* Match the variable from main CSS */
    margin-bottom: var(--music-player-height);
    /* Match the variable from main CSS */
    min-height: calc(100vh - var(--sidebar-height) - var(--music-player-height));
    /* Use CSS variables */
  }

  .player-content {
    
    flex-direction: column;
  }

  .track-image-container {
    position: absolute;
    top: -15%;
    /* half the image height to pop it out */
    left: 50%;
    transform: translateX(-50%);
    width: 50px;
    height: 50px;
    border-radius: 50%;
    /* border: 4px solid #fff; */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3);
    z-index: 10;
  }

  @keyframes rotating {
    0% {
      transform: rotate(0deg);
    }
    100% {
      transform: rotate(360deg);
    }
  }

  .track-image-container img {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    /* animation: rotating 10s linear infinite; */
  }
  
  .playing .track-image-container img {
    animation: rotating 10s linear infinite;
  }
  
  /* Sidebar adjustments */
  .sidebar {
    padding: 10px 0;
    height: var(--sidebar-height);
    overflow: hidden;
  }

  .playlist-list-container {
    width: 98%;
    overflow-x: auto;
    overflow-y: hidden;
    /* padding: 0 5px; */
  }

  .playlist-list {
    flex-wrap: nowrap;
    justify-content: flex-start;
    gap: 8px;
    width: max-content;
    padding: 0 7px;
  }

  .playlist-item {
    padding: 8px 15px;
    font-size: 12px;
    width: 100px;
    min-width: 100px;
    height: inherit;
  }

  .playlist-title {
    font-size: 12px;
    max-width: 90px;
  }

  /* Volume control positioning */
  .volume-control {
    display: none;
  }

  /* Track info positioning */
  .track-info {
    display: flex;
    flex-direction: row;
    width: 95%;
    justify-content: space-between;
    /* top right bottom left*/
    padding: 2px 2px 7px 0px;
    
  }

  .track-info h2 {
    font-size: 11px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 40%;
  }

  .track-info h3 {
    font-size: 10px;
    margin: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 48%;
    text-align: right;
  }

  .track-title {
    font-size: 14px;
    white-space: nowrap;
    /* ❌ No wrapping */
    overflow: hidden;
    /* 🧼 Hide overflow */
    text-overflow: ellipsis;
  }

  .artist {
    white-space: nowrap;
    /* ❌ No wrapping */
    overflow: hidden;
    /* 🧼 Hide overflow */
    text-overflow: ellipsis;
    font-size: 10px;
  }

  .track-duration {
    font-size: 0.7em;
  }

  /* Control adjustments */
  .controls-and-timer {
    width: 90%;
    margin: 2px;
  }

  .seek-container {
    width: 100%;
    padding: 0;
    display: block;
  }

  .time-info {
    width: 100%;
    display: flex;
    justify-content: space-between;
    padding: 0;
  }


  .seek-bar::-webkit-slider-thumb {
    visibility: visible;
    /* Make thumb visible */
    opacity: 1;
    width: 12px;
    height: 12px;
  }

  /* Button sizing */
  .buttons-container {
    gap: 20px;
    display: flex;
    justify-content: center;
    width: 100%;
  }

  .control-btn {
    width: 25px;
    height: 25px;
    font-size: 12px;
  }

  #play-pause-btn {
    width: 38px;
    height: 38px;
    font-size: 14px;
  }

  .track-details {
    display: flex;
    flex-direction: column;
    justify-content: space-between;
    align-items: flex-start;
    position: relative;
    padding-right: 70px; /* space for duration */
  }

  .track-details .track-main-info {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
    width: 100%;
  }

  .track-details .track-title,
  .track-details .artist {
    display: block;
    width: 100%;
    text-align: left;
    margin: 0;
    padding: 0;
  }

  .track-details .track-duration {
    position: absolute;
    top: 50%;
    right: 10px;
    transform: translateY(-50%);
    text-align: right;
    width: auto;
    /* font-size remains unchanged */
  }
}
