@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
html {
  background-color: #121212; /* Evita il flash bianco durante lo scroll elastico su iOS */
}

body {
  background-color: #121212;
  margin: 0;
}
/* --- VARIABILI OTTIMIZZATE (Zero Blur) --- */
:root {
  --amethyst: #c82333;
  --amethyst-low: rgba(200, 35, 51, 0.15);
  --amethyst-mid: rgba(200, 35, 51, 0.4);
  --bg-dark: #121212;
  --bg-card: #1e1e1e;
  --bg-sidebar: #0f0f0f;
  --text-main: #e0e0e0;
  --transition: 0.2s cubic-bezier(0.4, 0, 0.2, 1);
}

/* --- BASE --- */
* {
  box-sizing: border-box;
  -webkit-tap-highlight-color: transparent;
}

body, html {
  margin: 0; padding: 0;
  height: 100%;
  background: #121212; /* Colore solido invece di gradienti complessi per lo scroll */
  font-family: 'Poppins', sans-serif;
  color: var(--text-main);
  overflow-x: hidden;
}

.app-container {
  display: flex;
  flex-direction: column;
  padding: 20px 24px 160px;
  max-width: 1400px;
  margin: 0 auto;
}

/* --- HEADER --- */
header {
  display: flex;
  align-items: center;
  gap: 15px;
  margin-bottom: 30px;
}

header h1 {
  margin: 0;
  font-size: 2rem;
  color: var(--amethyst);
  letter-spacing: -1px;
}

header p {
  margin: 0;
  color: #666;
  font-style: italic;
}

/* --- SIDEBAR (Hardware Accelerated) --- */
/* Sidebar che si sovrappone a tutto */
#sidebar {
  position: fixed;
  top: 0;
  left: 0;
  width: 280px;
  height: 100vh;
  background: rgba(15, 15, 15, 0.98); /* Quasi nero solido per performance */
  border-right: 1px solid var(--amethyst);
  z-index: 9999; /* Il valore più alto per stare sopra ricerca e player */
  transform: translateX(-100%);
  transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
  will-change: transform;
}

#sidebar.open {
  transform: translateX(0);
}

/* Overlay scuro con blur sul resto della pagina */
/* Aggiungeremo questo elemento via JS quando apri il menu */
.sidebar-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100vw;
  height: 100vh;
  background: rgba(0, 0, 0, 0.7); /* Oscura lo sfondo */
  backdrop-filter: blur(8px);    /* Effetto blur solo quando il menu è aperto */
  -webkit-backdrop-filter: blur(8px);
  z-index: 9998; /* Appena sotto la sidebar */
  opacity: 0;
  animation: fadeIn 0.3s forwards;
}

@keyframes fadeIn {
  to { opacity: 1; }
}

#sidebar.open { transform: translateX(0); }

.sidebar-content { padding: 30px; }
.sidebar-content h3 { color: var(--amethyst); border-bottom: 1px solid var(--amethyst-low); padding-bottom: 10px; }
.sidebar-content ul { list-style: none; padding: 0; }
.sidebar-content li { margin-bottom: 10px; }
.sidebar-content a {
  color: #fff;
  text-decoration: none;
  padding: 10px 15px;
  border-radius: 8px;
  display: block;
  transition: background var(--transition);
}
.sidebar-content a:hover { background: var(--amethyst-low); color: var(--amethyst); }

#sidebarToggle {
  background: var(--amethyst-low);
  border: 1px solid var(--amethyst);
  color: var(--amethyst);
  font-size: 1.2rem;
  padding: 8px 12px;
  border-radius: 8px;
  cursor: pointer;
}

/* --- GRIDS (Playlist & Artisti) --- */
.app-container h2 { color: var(--amethyst); margin: 20px 0 15px; }

#playlistGrid, #artistGrid, #customPlaylists {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  width: 100%;
}

/* --- CARDS (Flat Modern Style) --- */
.track-card, .artist-card, .playlist-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 15px;
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition);
  will-change: transform;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
}

.track-card:hover, .artist-card:hover {
  transform: translateY(-5px);
  border-color: var(--amethyst);
}

.track-card.active {
  background: var(--amethyst);
  color: white;
  border-color: #fff;
}

.track-card .card-cover, .artist-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  margin-bottom: 10px;
}

.artist-card { border-radius: 50% 50% 12px 12px; } /* Stile moderno per artisti */
.artist-card img { border-radius: 50%; }

/* --- SEARCH CONTAINER & RESULTS --- */
#searchContainer {
  position: absolute;
  top: 20px;
  right: 24px;
  width: 280px;
  z-index: 2100;
}

#searchInput {
  width: 100%;
  padding: 10px 16px;
  border-radius: 12px;
  border: 1px solid var(--amethyst-mid);
  background: var(--bg-card);
  color: #fff;
  font-family: 'Poppins', sans-serif;
  font-size: 0.9rem;
  outline: none;
  transition: border-color var(--transition);
}

#searchInput:focus {
  border-color: var(--amethyst);
}

#searchResults {
  background: #1a1a1a;
  border: 1px solid var(--amethyst-mid);
  border-radius: 12px;
  margin-top: 8px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
}

/* Stile dei singoli risultati (Brani e Artisti) */
.search-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 8px 12px;
  cursor: pointer;
  transition: background var(--transition);
  border-bottom: 1px solid rgba(255,255,255,0.05);
}

.search-item:last-child {
  border-bottom: none;
}

.search-item:hover {
  background: var(--amethyst-low);
}

.search-item img {
  width: 40px;
  height: 40px;
  border-radius: 6px; /* Coerente con le track-card */
  object-fit: cover;
  flex-shrink: 0;
}

/* Se è un artista, l'immagine è tonda come nelle card artisti */
.search-item.artist-item img {
  border-radius: 50%;
}

.search-item .text {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.search-item .title {
  font-size: 0.85rem;
  font-weight: 600;
  color: var(--text-main);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.search-item .artist, 
.search-item .type {
  font-size: 0.75rem;
  color: #888;
}

/* Scrollbar sottile per i risultati */
#searchResults::-webkit-scrollbar {
  width: 5px;
}
#searchResults::-webkit-scrollbar-thumb {
  background: var(--amethyst-mid);
  border-radius: 10px;
}
 
/* --- BOTTOM BAR (Fixed & Flat) --- */
#bottomBar {
  position: fixed;
  bottom: 0; left: 0; right: 0;
  height: 100px;
  background: #181818;
  border-top: 2px solid var(--amethyst);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  z-index: 3000;
}

#playerContainer {
  width: 400px;
  height: 80px;
  background: #000;
  border-radius: 8px;
  overflow: hidden;
}

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

.control-btn {
  background: var(--amethyst-low);
  border: 1px solid var(--amethyst);
  color: var(--amethyst);
  width: 45px; height: 45px;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1.2rem;
  transition: all var(--transition);
}

.control-btn:hover { background: var(--amethyst); color: #fff; }

/* --- NOW PLAYING --- */
#nowPlaying {
  display: flex;
  align-items: center;
  gap: 12px;
  flex: 1;
}

#nowPlaying img.cover {
  width: 60px; height: 60px;
  border-radius: 6px;
  object-fit: cover;
}

.info .title { color: var(--amethyst); font-weight: 700; display: block; }
.info .artist { font-size: 0.9rem; opacity: 0.7; }

/* --- POPUPS & DIALOGS (Solid) --- */
.artist-popup, .playlist-popup, .add-song-dialog {
  position: fixed;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%);
  background: #1a1a1a;
  border: 2px solid var(--amethyst);
  border-radius: 16px;
  padding: 24px;
  z-index: 4000;
  max-width: 400px;
  width: 90%;
}

.track-item {
  padding: 10px;
  border-bottom: 1px solid rgba(255,255,255,0.05);
  cursor: pointer;
}
.track-item:hover { background: var(--amethyst-low); }

/* --- FIX MOBILE: Tasti affiancati e Menu posizionato correttamente --- */
@media (max-width: 768px) {

        #sidebarToggle {
          position: static !important;
          display: block !important;
          margin-left: 0 !important;   /* Lo spinge a sinistra */
          margin-right: auto !important; /* Assicura che non ci sia spazio a sinistra */
          margin-top: 0px;            /* Distanza dalla barra di ricerca fissa */
          width: fit-content;          /* Impedisce al tasto di allargarsi a tutto schermo */
          background: var(--bg-panel);
          border: 1px solid var(--amethyst);
          padding: 8px 12px;
          border-radius: 8px;
          z-index: 1;
        }
        /* Stile tasto */
        background: var(--bg-panel);
        border: 1px solid var(--amethyst);
        padding: 8px 12px;
        border-radius: 8px;
        width: auto;
        display: block;
      }

  /* 2. Barra di ricerca fissa a tutto schermo */
  #searchContainer {
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%;
    padding: 10px;
    background: var(--bg-dark);
    border-bottom: 1px solid var(--amethyst-mid);
    z-index: 3000;
  }

  /* 3. Forza i tasti del Player ad essere affiancati */
  #bottomBar {
    display: flex !important;
    flex-direction: row !important; /* Forza l'allineamento orizzontale */
    flex-wrap: wrap;               /* Permette al player di andare sotto se non c'è spazio */
    justify-content: center;
    align-items: center;
    gap: 10px;
    padding: 10px;
    height: auto;
  }

  /* Raggruppa i pulsanti di controllo */
  .control-btn {
    display: flex !important;
    width: 45px  !important; /* Impedisce che prendano tutta la larghezza */
    height: 45px;
    border-radius: 12px; /* Stesso raggio delle card brani */
    margin: 0 !important;
    padding: 0 ; /* Non permette ai tasti di espandersi */
      justify-content: center;
      align-items: center;
  }

  /* 4. Player e Info */
  #playerContainer {
    width: 100% !important; /* Il player sta su una riga tutta sua sotto i tasti */
    order: 3;
    height: 70px;
  }

  #nowPlaying {
    width: 100%;
    order: 1;
    justify-content: center;
    margin-bottom: 5px;
  }

  /* Nascondi tasto ingrandimento su mobile */
  #toggleNowPlayingBtn {
    display: none !important;
  }

  /* 5. Header centrato (sotto la barra di ricerca) */
  header {
    margin-top: 80px; 
    text-align: center;
    flex-direction: column;
  }

/* All'interno di @media (max-width: 768px) */

#searchResults {
  max-height: 300px;
}

/* Se i risultati della ricerca usano la classe .track-card o simili */
#searchResults .track-card, 
#searchResults .track-item {
  flex-direction: row; /* Disposizione orizzontale per risparmiare spazio */
  text-align: left;
  padding: 8px;
  gap: 10px;
}

#searchResults .card-cover, 
#searchResults img {
  width: 40px !important;  /* Copertina piccola tipo lista */
  height: 40px !important;
  margin-bottom: 0;       /* Rimuove il margine inferiore delle card standard */
}

#searchResults .info {
  font-size: 0.8rem;
}

  header h1 { font-size: 2.2rem; }

  /* Playlist e Brani più piccoli */
  #playlistGrid {
    grid-template-columns: repeat(auto-fill, minmax(120px, 1fr)) !important;
  }
  .track-card { padding: 6px; font-size: 0.8rem; }
}

/* --- GRIDS (Playlist & Artisti) --- */
/* Uniformate le dimensioni delle grid per coerenza */
#playlistGrid, #artistGrid, #customPlaylists {
  display: grid;
  gap: 16px;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  width: 100%;
}

/* --- CARDS (Stile Uniforme) --- */
.track-card, .artist-card, .playlist-card {
  background: var(--bg-card);
  border: 1px solid rgba(255,255,255,0.05);
  border-radius: 12px;
  padding: 12px; /* Leggermente più compatto */
  cursor: pointer;
  transition: transform var(--transition), border-color var(--transition), box-shadow var(--transition);
  will-change: transform;
  display: flex;
  flex-direction: column;
  align-items: center;
  text-align: center;
  height: 100%; /* Assicura altezza uniforme */
}

.artist-card { 
  border-radius: 12px; /* Rimosso il cerchio per coerenza con le canzoni */
}

.track-card:hover, .artist-card:hover {
  transform: translateY(-5px);
  border-color: var(--amethyst);
  box-shadow: 0 8px 20px rgba(200, 35, 51, 0.2);
}

.track-card .card-cover, .artist-card img {
  width: 100%;
  aspect-ratio: 1;
  border-radius: 8px;
  object-fit: cover;
  margin-bottom: 10px;
}

.artist-card .name {
  font-weight: 600;
  font-size: 0.95rem;
  color: var(--text-main);
}

/* --- ARTIST POPUP (Modernizzato) --- */
.artist-popup {
  position: fixed;
  top: 50%; 
  left: 50%;
  transform: translate(-50%, -50%);
  background: #1a1a1a;
  border: 1px solid var(--amethyst);
  border-radius: 20px;
  padding: 0; /* Gestito dalle sezioni interne */
  z-index: 5000;
  width: 90%;
  max-width: 350px;
  box-shadow: 0 20px 50px rgba(0,0,0,0.8);
  overflow: hidden;
  animation: popupFade 0.3s ease-out;
}

@keyframes popupFade {
  from { opacity: 0; transform: translate(-50%, -45%); }
  to { opacity: 1; transform: translate(-50%, -50%); }
}

.artist-popup h3 {
  background: var(--amethyst);
  color: white;
  margin: 0;
  padding: 15px;
  text-align: center;
  font-size: 1.2rem;
}

.artist-popup .popup-content {
  max-height: 400px;
  overflow-y: auto;
  padding: 10px;
}

.artist-popup .track-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 12px;
  border-radius: 10px;
  margin-bottom: 5px;
  border-bottom: none; /* Rimosso bordo brutto */
  transition: background 0.2s;
}

.artist-popup .track-item:hover {
  background: var(--amethyst-low);
}

.artist-popup .track-item::before {
  content: '▶';
  color: var(--amethyst);
  font-size: 0.8rem;
}

@media (max-width: 768px) {
  /* Barra di ricerca fissa in alto */
  #searchContainer {
    position: fixed;
    top: 0; left: 0; right: 0;
    width: 100%;
    padding: 10px;
    background: rgba(18, 18, 18, 0.8);
    backdrop-filter: blur(15px);
    -webkit-backdrop-filter: blur(15px);
    border-bottom: 1px solid var(--amethyst-low);
    z-index: 3000;
  }

  /* IL PLAYER: Effetto fluttuante, blur e bordi staccati */
  #bottomBar {
    position: fixed;
    bottom: 15px; /* Staccato dal bordo inferiore */
    left: 10px;   /* Staccato dal bordo sinistro */
    right: 10px;  /* Staccato dal bordo destro */
    height: auto !important;
    min-height: 60px;
    background: rgba(30, 30, 30, 0.75) !important; /* Trasparente per il blur */
    backdrop-filter: blur(20px) !important;
    -webkit-backdrop-filter: blur(20px) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    border-radius: 20px !important; /* Forma arrotondata come le card */
    display: flex !important;
    padding: 10px !important;
    gap: 8px !important;
    box-shadow: 0 10px 30px rgba(0,0,0,0.5);
    z-index: 4000;
  }

  /* L'iframe di Drive (necessario ma discreto) */
  #playerContainer {
    width: 100% !important;
    height: 40px !important; /* Altezza minima per i controlli */
    border-radius: 12px;
    overflow: hidden;
    order: 1;
  }


  #nowPlaying {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 8px;
    min-width: 0; /* Permette il troncamento del testo */
  }

  #nowPlaying img.cover {
    width: 38px !important;
    height: 38px !important;
    border-radius: 8px !important;
  }

  #nowPlaying .info {
    display: flex;
    flex-direction: column;
    min-width: 0;
  }

  #nowPlaying .info .title {
    font-size: 0.8rem !important;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
  }

  #nowPlaying .info .artist {
    font-size: 0.7rem !important;
    opacity: 0.6;
  }

  .control-btn {
    width: 36px !important;
    height: 36px !important;
    font-size: 0.8rem !important;
    background: rgba(200, 35, 51, 0.2) !important;
    border: none !important; /* Tasti tondi per contrasto con la barra */
  }

  /* Spazio extra per evitare che l'ultima card sia coperta dal player */
  .app-container {
    padding-bottom: 160px !important;
  }
}


/* 1. BLOCCO INFO (Sinistra) */
#nowPlaying {
  display: flex;
  align-items: center;
  gap: 12px;
  justify-self: start;
}

#nowPlaying img.cover {
  width: 55px; 
  height: 55px;
  border-radius: 6px;
  object-fit: cover;
  flex-shrink: 0;
}

#nowPlaying .info {
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#nowPlaying .info .title {
  color: var(--amethyst);
  font-weight: 700;
  font-size: 0.95rem;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

#nowPlaying .info .artist {
  font-size: 0.8rem;
  opacity: 0.7;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* 2. BLOCCO CONTROLLI (Centro) */
.controls-group {
  display: flex;
  align-items: center;
  gap: 15px;
  justify-self: center;
}

/* Rimuovi il tasto freccia che ora non serve più per l'espansione */
#toggleNowPlayingBtn {
  display: none;
}

/* --- FIX MOBILE --- */
@media (max-width: 768px) {
  #bottomBar {
    grid-template-columns: 1fr; /* Stack verticale su mobile */
    height: auto;
    padding: 10px;
    gap: 10px;
  }
  
  .controls-group {
    order: 2;
  }
  
  #nowPlaying {
    order: 1;
    justify-self: center;
  }
  
  #playerContainer {
    order: 3;
    justify-self: center;
    max-width: 100%;
  }
}

/* Container del Player (la cornice esterna) */
#playerContainer {
  width: 400px;
  height: 80px;
  background: var(--bg-card); /* Usa lo stesso colore delle card */
  border: 1px solid var(--amethyst-mid); /* Bordo coerente con il tema */
  border-radius: 12px; /* Arrotondamento identico alle track-card */
  overflow: hidden; /* Fondamentale per "tagliare" gli angoli dell'iframe */
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3); /* Leggera ombra per profondità */
  display: flex;
  align-items: center;
  justify-content: center;
}

/* L'iframe dentro il container */
#playerContainer iframe {
  width: 100%;
  height: 100%;
  border: none;
  border-radius: 12px; /* Forza l'arrotondamento anche sull'elemento interno */
}

@media (max-width: 768px) {
  #playerContainer {
    width: 97% !important; /* Occupa tutta la larghezza disponibile */
    height: 40px !important; /* Leggermente più basso su mobile */
    margin: 5px 0;
  }
}
/* Forza la griglia degli artisti ad avere le stesse dimensioni di quella dei brani */
#artistGrid {
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr)) !important;
  gap: 16px !important;
}

/* Allinea le dimensioni fisiche della card artista alla track-card */
.artist-card {
  padding: 15px !important; /* Stesso padding di .track-card */
  border-radius: 12px !important; /* Stesso raggio di .track-card */
  height: 100% !important;
  min-height: 215px; /* Altezza media stimata per pareggiare le canzoni */
}

/* Rendi l'immagine dell'artista grande esattamente quanto la copertina di una canzone */
.artist-card img {
  width: 100% !important;
  aspect-ratio: 1 / 1 !important; /* Forza il box quadrato */
  border-radius: 8px !important; /* Rimuove il cerchio, mette l'angolo della canzone */
  margin-bottom: 10px !important;
  object-fit: cover !important;
}

/* Pareggia il font del nome al testo delle canzoni */
.artist-card .name {
  font-size: 1rem !important;
  font-weight: 400 !important;
  margin-top: 0 !important;
}
/* Nasconde l'intero contenitore della sezione artisti */
#artistWrapper {
  display: none !important;
}

/* Nasconde il tasto per aprire il menu (hamburger icon) */
#sidebarToggle {
  display: none !important;
}


/* Container della ricerca: stessa forma del player e staccato dai bordi */
#searchContainer {
  display: flex;
  align-items: center;
  
  /* Margini per staccarlo dai bordi e centrarlo o spostarlo */
  margin: 15px auto; 
  padding: 10px 20px;
  
  /* Larghezza flessibile ma non totale */
  width: 90%; 
  max-width: 500px; 
  
  /* Design identico al player */
  background: var(--bg-card);
  border: 1px solid var(--amethyst-mid);
  border-radius: 12px;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.3);
  
  transition: border-color var(--transition);
}

/* Rende l'input invisibile dentro il riquadro */
#searchInput {
  width: 100%;
  background: transparent !important;
  border: none !important;
  color: var(--text-main);
  outline: none;
  font-size: 1rem;
}

/* Effetto al click (opzionale, per richiamare il tema) */
#searchContainer:focus-within {
  border-color: var(--amethyst);
}

/* Container della ricerca: sottile, elegante e staccato */
#searchContainer {
  display: flex;
  align-items: center;
  
  /* Margini: 20px sopra/sotto per staccarlo, auto per centrarlo */
  margin: 20px auto; 
  padding: 0 15px; /* Spazio interno laterale */
  
  /* Altezza ridotta per non sembrare un testone */
  height: 45px; 
  
  /* Larghezza flessibile */
  width: 90%; 
  max-width: 450px; 
  /* Design identico al player */
  background: var(--bg-card);
  border: 1px solid var(--amethyst-mid);
  border-radius: 12px;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.2);
  
}

/* Input interno: pulito e allineato */
#searchInput {
  width: 100%;
  height: 100%; /* Prende tutta l'altezza del nuovo container sottile */
  background: transparent !important;
  border: none !important;
  color: var(--text-main);
  outline: none;
  font-size: 0.95rem;
}

/* Trova il blocco #searchResults e modificalo così */
#searchResults {
  position: absolute; /* <--- AGGIUNGI QUESTO: si stacca dal flusso della barra */
  top: calc(100% + 8px); /* <--- Lo mette esattamente sotto la barra (100% altezza + 8px di spazio) */
  left: 0;
  width: 100%; /* <--- Diventa largo esattamente come la barra di ricerca */
  background: #1a1a1a;
  border: none;
  border-radius: 12px;
  max-height: 300px;
  overflow-y: auto;
  box-shadow: 0 10px 25px rgba(0,0,0,0.5);
  z-index: 5000; /* Sopra a tutto */
} 
 /* Sopra a tutto */

/* Overlay che copre il contenuto del player per 5s */
#bottomBar::after {
  content: "SINCRONIZZAZIONE...";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--bg-card);
  color: var(--amethyst);
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  letter-spacing: 2px;
  z-index: 99;
  animation: hideLoader 0.1s forwards 5s;
}

/* Linea rossa che scorre sul bordo superiore */
#bottomBar::before {
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  background: var(--amethyst);
  box-shadow: 0 0 10px var(--amethyst);
  z-index: 100;
  animation: loadLine 5s linear forwards;
}

@keyframes loadLine {
  0% { width: 0%; opacity: 1; }
  95% { width: 100%; opacity: 1; }
  100% { width: 100%; opacity: 0; }
}

@keyframes hideLoader {
  to { visibility: hidden; opacity: 0; pointer-events: none; }
}

/* --- BOTTOM BAR UNITARIA E CENTRATA --- */
#bottomBar {
  position: fixed;
  bottom: 15px;      /* Distanza dal fondo */
  left: 50%;         /* Inizia a metà schermo */
  transform: translateX(-50%); /* Torna indietro della sua metà per centrarsi */
  width: 95%;        /* Spazio vitale ai lati */
  max-width: 1200px; 
  height: 100px;
  background: #181818;
  border: 1px solid var(--amethyst-mid); /* Bordo sottile invece che solo sopra */
  border-radius: 15px; /* Arrotondato */
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  z-index: 3000;
  overflow: hidden; /* Necessario per l'animazione */
  box-sizing: border-box;
}

/* --- SPLASH SCREEN --- */
#splashScreen {
  position: fixed;
  top: 0; left: 0;
  width: 100vw; height: 100vh;
  background: #121212;
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 10000; /* Sopra a tutto */
  transition: opacity 0.5s ease, visibility 0.5s;
}

.splash-content {
  text-align: center;
}

.splash-content img {
  width: 50px; /* Regola la grandezza come preferisci */
  height: 50px;
  /* border-radius: 22% è molto simile all'effetto iOS per le icone quadrate */
  border-radius: 22%; 
  object-fit: cover; /* Assicura che l'immagine non si deformi */
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.3); /* Opzionale: leggera ombra */
}

.splash-content h1 {
  margin: 0;
  font-size: 2rem;
  color: var(--amethyst);
  letter-spacing: -1px;
}

.spinner {
  width: 40px;
  height: 40px;
  border: 4px solid rgba(200, 35, 51, 0.1);
  border-left-color: var(--amethyst);
  border-radius: 50%;
  margin: 20px auto;
  animation: spin 1s linear infinite;
}

@keyframes spin { to { transform: rotate(360deg); } }

/* --- MODIFICA LOADER PLAYER --- */
/* Rimuoviamo l'animazione automatica e la attiviamo con una classe */
#bottomBar::before, #bottomBar::after {
  display: none; /* Nascosti di default */
}

#bottomBar.loading::before {
  display: block;
  content: "";
  position: absolute;
  top: 0; left: 0;
  height: 3px;
  background: var(--amethyst);
  box-shadow: 0 0 10px var(--amethyst);
  z-index: 100;
  animation: loadLine 5s linear forwards;
}

#bottomBar.loading::after {
  display: flex;
  content: "SINCRONIZZAZIONE...";
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  background: var(--bg-card);
  color: var(--amethyst);
  align-items: center;
  justify-content: center;
  font-weight: 700;
  font-size: 0.75rem;
  z-index: 99;
  animation: hideLoader 0.1s forwards 5s;
}

/* --- FORZA IL LOOK MOBILE SU TUTTI I DISPOSITIVI --- */

#bottomBar {
  /* Manteniamo la barra flessibile ma centrata e compatta */
  flex-direction: row; 
  justify-content: space-between;
  padding: 10px 15px;
  width: 95%; /* Non farla diventare larga 100% su PC */
  max-width: 500px; /* Limita la larghezza massima per non sformarla */
  left: 50%;
  transform: translateX(-50%);
  border-radius: 20px; /* Bordi arrotondati come su mobile */
}

#nowPlaying {
  /* Forza la struttura orizzontale compatta */
  width: auto;
  flex: 1;
  justify-content: flex-start;
}

#nowPlaying img.cover {
  width: 45px;
  height: 45px;
  display: block; /* Assicurati che non sparisca */
}

/* Nascondi i controlli extra che su PC potrebbero apparire diversamente */


/* Mantieni i pulsanti piccoli e vicini */
.control-btn {
  font-size: 1.2rem;
  padding: 8px;
}

