/* RESET */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

/* ----------- DESKTOP (min-width: 769px) ----------- */
@media (min-width: 769px) {
  .grid-container {
    display: grid;
    grid-template-rows: 12vh 68vh 15vh;
    height: calc(100vh - 5vh); /* Footer fisso occupa 5vh */
    background-color: #121212;
    color: #e0e0e0;
    overflow: hidden;
  }
  
  header {
    grid-row: 1;
    background-color: #fff;
    color: #000;
    padding: 15px 30px;
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 1.5em;
  }
  header a {
    text-decoration: none;
    color: #007BFF;
    font-weight: bold;
  }
  
 
  .main-content {
    grid-row: 2;
    display: grid;
    grid-template-columns: 3fr 1fr;
  }
  
  .left-column {
    position: relative;
    overflow: hidden;
  }
  .album-cover {
    width: 100%;
    height: 100%;
    background: url('cover.jpg') no-repeat center center;
    background-size: cover;
    position: relative;
  }
  .album-overlay {
    position: absolute;
    top: 0;
    left: 0;
    padding: 20px;
    background: rgba(0, 0, 0, 0.7);
    width: 100%;
    height: 100%;
    display: flex;
    flex-direction: column;
    justify-content: flex-start;
    align-items: flex-start;
  }
  .album-overlay h1 { font-size: 32px; margin-bottom: 10px; }
  .album-overlay h2 { font-size: 24px; margin-bottom: 10px; }
  .album-overlay p  { font-size: 16px; line-height: 1.4; max-width: 600px; }
  
  .right-column {
    display: flex;
    flex-direction: column;
    height: 100%;
    min-height: 0;
  }
  .tracks-section {
    flex: 0 0 60%;
    background-color: #1e1e1e;
    padding: 15px;
    overflow-y: auto;
    min-height: 0;
  }
  .tracks-section h3 { margin-bottom: 10px; color: #007BFF; }
  #trackList { list-style: none; }
  #trackList li {
    padding: 10px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background-color 0.3s;
    color: #e0e0e0;
  }
  #trackList li:hover, #trackList li.active {
    background-color: #007BFF;
    color: #fff;
  }
  .lyrics-section {
    flex: 0 0 40%;
    background-color: #1e1e1e;
    padding: 15px;
    display: flex;
    flex-direction: column;
    min-height: 0;
    overflow: hidden;
  }
  .lyrics-section h3 { margin-bottom: 10px; color: #007BFF; flex: 0 0 auto; }
  .lyrics-frame {
    flex: 1 1 auto;
    font-size: 14px;
    color: #e0e0e0;
    white-space: pre-wrap;
    overflow-y: auto;
    padding-right: 5px;
  }


  /* Scrollbar personalizzate */
  .tracks-section::-webkit-scrollbar,
  .lyrics-frame::-webkit-scrollbar { width: 6px; }
  .tracks-section::-webkit-scrollbar-track,
  .lyrics-frame::-webkit-scrollbar-track { background: #1e1e1e; border-radius: 3px; }
  .tracks-section::-webkit-scrollbar-thumb,
  .lyrics-frame::-webkit-scrollbar-thumb { background: #007BFF; border-radius: 3px; }
  .tracks-section, .lyrics-frame { scrollbar-width: thin; scrollbar-color: #007BFF #1e1e1e; }
  
  .player-container {
    grid-row: 3;
    background-color: #181818;
    width: 100%;
    display: flex;
    flex-direction: column;
    position: relative;
    margin-bottom: 0;
  }
  .slider-row {
    width: 100%;
    margin-top: -5px;
  }
  .slider-row input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: #555;
    border-radius: 4px;
    outline: none;
    transition: background 0.1s ease;
  }
  .slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    margin-top: -3px;
    transition: all 0.1s ease;
  }
  .slider-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    transition: all 0.1s ease;
  }
  
  .timer-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 20px;
    font-size: 14px;
    color: #e0e0e0;
  }
  
  .controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
  }
  .controls-row button {
    background: none;
    border: none;
    font-size: 36px;
    cursor: pointer;
    color: #e0e0e0;
    font-family: monospace;
  }
  .controls-row input[type="range"] { width: 100px; }
  
  footer {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 5vh;
    background-color: #000;
    color: #fff;
    text-align: center;
    padding: 5px 20px;
    font-size: 0.9em;
  }
}

/* ----------- MOBILE (max-width: 768px) ----------- */
@media (max-width: 768px) {
  .grid-container {
    display: block;
    height: auto;
    background-color: #121212;
    color: #e0e0e0;
    overflow: visible;
  }
  header {
    background-color: #fff;
    color: #000;
    padding: 20px;
    font-size: 1.2em;
    display: flex;
    flex-direction: row;
    justify-content: space-between;
    align-items: center;
  }
  .main-content {
    display: block;
  }
  /* Imposta l'altezza per l'immagine e l'overlay */
  .left-column, .album-cover, .album-overlay {
    height: 50vh;
  }
  
  /* Assicurati che l'immagine di copertina abbia lo sfondo */
  .album-cover {
    display: block;
    background: url('cover.jpg') no-repeat center center;
    background-size: cover;
  }
  /* Per mobile, riduco l'opacità dell'overlay in modo da vedere l'immagine */
  .album-overlay {
    background: rgba(0, 0, 0, 0.6);
	padding:10px;
  }
  /* Sidebar: mostra solo la playlist */
  .right-column {
    padding: 10px;
  }
  .lyrics-section {
    display: none;
  }
  .tracks-section {
    overflow-y: auto;
  }
  #trackList li {
    padding: 10px;
    border-bottom: 1px solid #333;
    cursor: pointer;
    transition: background-color 0.3s;
    color: #e0e0e0;
    font-size: 1em;
  }
  #trackList li:hover, #trackList li.active {
    background-color: #007BFF;
    color: #fff;
  }
  /* Il player fluisce naturalmente dopo il main */
  .player-container {
    margin-top: 20px;
    display: block;
    background-color: #181818;
    padding: 10px 0;
  }
  .slider-row {
    width: 100%;
    margin-top: -3px;
  }
  .slider-row input[type="range"] {
    width: 100%;
    height: 8px;
    -webkit-appearance: none;
    background: #555;
    border-radius: 4px;
    outline: none;
  }
  .slider-row input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
    margin-top: -3px;
  }
  .slider-row input[type="range"]::-moz-range-thumb {
    width: 16px;
    height: 16px;
    border-radius: 50%;
    background: #fff;
    cursor: pointer;
  }
  .timer-row {
    display: flex;
    justify-content: space-between;
    padding: 5px 15px;
    font-size: 14px;
  }
  .controls-row {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 10px 0;
  }
  .controls-row button {
    font-size: 40px;
    font-family: monospace;
    background: none;
    border: none;
    color: #e0e0e0;
  }
  /* Il footer in mobile segue il flusso, posizionato subito dopo il player */
  footer {
    position: static;
    background-color: #000;
    color: #fff;
    padding: 10px 20px;
    text-align: center;
    font-size: 1em;
  }
}

