/* ═══════════════════════════════════════════════════════════════════════════
   🎵 Tanguedia Music — tema scuro, rosso del logo come accento.
   Struttura: barra in alto · lato a sinistra · vista al centro · coda a destra
   · player in basso. Sotto i 900px il lato diventa un cassetto e il player si
   stringe; il tocco sul brano apre «Ora in riproduzione» a schermo intero.
   ═══════════════════════════════════════════════════════════════════════════ */
:root {
  --bg: #0b0b0b;
  --pannello: #141414;
  --pannello-2: #1c1c1c;
  --sopra: #262626;
  --bordo: #2a2a2a;
  --testo: #f2f2f2;
  --tenue: #9a9a9a;
  --accento: #e3302f;
  --accento-2: #ff4a48;
  --barra-h: 64px;
  --player-h: 84px;
  --lato-w: 240px;
  --coda-w: 340px;
  color-scheme: dark;
}
* { box-sizing: border-box; }
html, body { margin: 0; height: 100%; }
body {
  background: var(--bg); color: var(--testo);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif; font-size: 14px;
  -webkit-font-smoothing: antialiased; overflow: hidden;
}
[hidden] { display: none !important; }
a { color: inherit; text-decoration: none; }
button { font: inherit; color: inherit; cursor: pointer; }
input, select, textarea { font: inherit; color: var(--testo); }
::-webkit-scrollbar { width: 10px; height: 10px; }
::-webkit-scrollbar-thumb { background: #333; border-radius: 5px; border: 2px solid var(--bg); }

/* ── Marchio: logo + «Music» ────────────────────────────────────────────── */
.marchio { display: flex; align-items: center; gap: 10px; flex-shrink: 0; }
.marchio img { height: 22px; width: auto; display: block; }
.marchio span { font-weight: 300; font-size: 22px; letter-spacing: .04em; line-height: 1; }
.marchio-grande img { height: 34px; }
.marchio-grande span { font-size: 32px; }

/* ── Bottoni ────────────────────────────────────────────────────────────── */
.btn {
  background: var(--sopra); border: 1px solid #333; border-radius: 999px;
  padding: 8px 16px; font-weight: 600; font-size: 13px; white-space: nowrap;
}
.btn:hover { background: #313131; }
.btn-primario { background: var(--accento); border-color: var(--accento); color: #fff; }
.btn-primario:hover { background: var(--accento-2); }
.btn-piccolo { padding: 5px 12px; font-size: 12px; }
.btn-pericolo { color: #ff8a88; }
.icona-btn {
  background: none; border: 0; width: 36px; height: 36px; border-radius: 50%;
  display: inline-flex; align-items: center; justify-content: center; font-size: 17px; opacity: .85; flex-shrink: 0;
}
.icona-btn:hover { background: var(--sopra); opacity: 1; }
.icona-btn.attivo { color: var(--accento); opacity: 1; text-shadow: 0 0 8px rgba(227,48,47,.6); }
.play-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 0; background: var(--testo); color: #000;
  font-size: 18px; display: inline-flex; align-items: center; justify-content: center;
}
.play-btn:hover { transform: scale(1.05); }
.grande { width: 56px; height: 56px; font-size: 24px; }
.play-btn.grande { width: 72px; height: 72px; font-size: 28px; }

/* ── Login ──────────────────────────────────────────────────────────────── */
.login { position: fixed; inset: 0; display: flex; align-items: center; justify-content: center; padding: 16px;
  background: radial-gradient(ellipse at top, #2a0e0e 0%, var(--bg) 60%); }
.login-box { width: 100%; max-width: 360px; display: flex; flex-direction: column; gap: 12px; align-items: stretch; }
.login-box .marchio { justify-content: center; margin-bottom: 4px; }
.login-sotto { text-align: center; color: var(--tenue); margin: 0 0 8px; }
.login-box input { background: var(--pannello-2); border: 1px solid var(--bordo); border-radius: 10px; padding: 12px 14px; }
.login-box input:focus { outline: none; border-color: var(--accento); }
.login-box .btn { padding: 12px; font-size: 15px; }
.login-errore { color: #ff8a88; text-align: center; min-height: 20px; }

/* ── Griglia generale ───────────────────────────────────────────────────── */
.app {
  display: grid; height: 100vh; height: 100dvh;
  grid-template-columns: var(--lato-w) 1fr auto;
  grid-template-rows: var(--barra-h) 1fr var(--player-h);
  grid-template-areas: "barra barra barra" "lato vista coda" "player player player";
}
.barra { grid-area: barra; display: flex; align-items: center; gap: 16px; padding: 0 16px;
  background: var(--bg); border-bottom: 1px solid var(--bordo); }
.cerca { flex: 1; max-width: 640px; margin: 0 auto; position: relative; }
.cerca input { width: 100%; background: var(--pannello-2); border: 1px solid var(--bordo); border-radius: 8px;
  padding: 10px 12px 10px 38px; }
.cerca input:focus { outline: none; border-color: #444; background: var(--sopra); }
.cerca-icona { position: absolute; left: 12px; top: 50%; transform: translateY(-50%); opacity: .6; font-size: 14px; }
.avatar { width: 34px; height: 34px; border-radius: 50%; border: 0; background: var(--accento); color: #fff; font-weight: 700; }

.lato { grid-area: lato; overflow-y: auto; padding: 12px 8px; background: var(--bg); border-right: 1px solid var(--bordo);
  display: flex; flex-direction: column; }
.nav a { display: flex; align-items: center; gap: 14px; padding: 9px 14px; border-radius: 8px; color: #d6d6d6;
  white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.nav a span { width: 20px; text-align: center; flex-shrink: 0; }
.nav a:hover { background: var(--pannello-2); }
.nav a.attivo { background: var(--sopra); color: #fff; font-weight: 600; }
.nav a.drop { outline: 2px dashed var(--accento); background: #2a1414; }
.lato-titolo { display: flex; align-items: center; justify-content: space-between; padding: 18px 8px 6px 14px;
  color: var(--tenue); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; border-top: 1px solid var(--bordo); margin-top: 10px; }
.nav-playlist a { font-size: 13px; padding: 7px 14px; }
.nav-playlist .pl-cond { margin-left: auto; opacity: .5; font-size: 11px; }
.nav-fondo { margin-top: auto; padding-top: 10px; border-top: 1px solid var(--bordo); }

.vista { grid-area: vista; overflow-y: auto; padding: 24px 32px 40px; position: relative; }
.coda { grid-area: coda; width: var(--coda-w); background: var(--pannello); border-left: 1px solid var(--bordo);
  display: flex; flex-direction: column; min-height: 0; }

/* ── Titoli e intestazioni ──────────────────────────────────────────────── */
h1 { font-size: 28px; margin: 0 0 4px; font-weight: 700; }
h2 { font-size: 20px; margin: 28px 0 14px; font-weight: 700; }
.sotto { color: var(--tenue); margin: 0 0 18px; }
.testa { display: flex; gap: 28px; align-items: flex-end; margin-bottom: 24px; }
.testa .cop { width: 200px; height: 200px; flex-shrink: 0; border-radius: 8px; box-shadow: 0 10px 30px rgba(0,0,0,.6); font-size: 64px; }
.testa-testi { min-width: 0; }
.testa-tipo { font-size: 12px; text-transform: uppercase; letter-spacing: .1em; color: var(--tenue); }
.testa h1 { font-size: 40px; line-height: 1.1; margin: 6px 0 8px; word-break: break-word; }
.testa-dati { color: var(--tenue); }
.testa-descr { color: #c8c8c8; margin: 6px 0; white-space: pre-wrap; }
.azioni { display: flex; gap: 10px; flex-wrap: wrap; align-items: center; margin-top: 16px; }
.azioni .play-btn { background: var(--accento); color: #fff; width: 52px; height: 52px; font-size: 20px; }

/* ── Copertine ──────────────────────────────────────────────────────────── */
.cop { background: linear-gradient(135deg, #3a1515, #151515); background-size: cover; background-position: center;
  display: flex; align-items: center; justify-content: center; color: rgba(255,255,255,.35); overflow: hidden; }
.cop-piccola { width: 48px; height: 48px; border-radius: 4px; flex-shrink: 0; font-size: 18px; }
.cop-mosaico { display: grid; grid-template-columns: 1fr 1fr; }
.cop-mosaico div { background-size: cover; background-position: center; }

/* ── Griglia di card (album, orchestre, playlist) ───────────────────────── */
.griglia { display: grid; grid-template-columns: repeat(auto-fill, minmax(170px, 1fr)); gap: 22px 18px; }
.card { min-width: 0; cursor: pointer; }
.card .cop { width: 100%; aspect-ratio: 1; border-radius: 6px; font-size: 42px; position: relative; transition: filter .15s; }
.card:hover .cop { filter: brightness(.75); }
.card .card-play { position: absolute; right: 10px; bottom: 10px; opacity: 0; transition: opacity .15s; width: 44px; height: 44px;
  background: var(--accento); color: #fff; border: 0; border-radius: 50%; font-size: 16px; box-shadow: 0 4px 12px rgba(0,0,0,.5); }
.card:hover .card-play { opacity: 1; }
.card-titolo { margin-top: 10px; font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.card-sotto { color: var(--tenue); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; margin-top: 2px; }
.card.tonda .cop { border-radius: 50%; }
.card.tonda { text-align: center; }
.riga-card { display: grid; grid-auto-flow: column; grid-auto-columns: 170px; gap: 18px; overflow-x: auto; padding-bottom: 8px; }

/* ── Pastiglie (filtri) ─────────────────────────────────────────────────── */
.pastiglie { display: flex; gap: 8px; flex-wrap: wrap; margin-bottom: 16px; }
.pastiglia { background: var(--pannello-2); border: 1px solid var(--bordo); border-radius: 999px; padding: 6px 14px;
  font-size: 13px; white-space: nowrap; }
.pastiglia:hover { background: var(--sopra); }
.pastiglia.attiva { background: var(--testo); color: #000; border-color: var(--testo); font-weight: 600; }
.generi-tile { display: grid; grid-template-columns: repeat(auto-fill, minmax(200px, 1fr)); gap: 14px; }
.tile { border-radius: 8px; padding: 18px; min-height: 96px; display: flex; flex-direction: column; justify-content: space-between;
  background: linear-gradient(135deg, var(--c1, #3a1515), var(--c2, #1a1a1a)); cursor: pointer; font-weight: 700; font-size: 17px; }
.tile:hover { filter: brightness(1.15); }
.tile small { font-weight: 400; color: rgba(255,255,255,.7); font-size: 12px; }

/* ── Tabella dei brani ──────────────────────────────────────────────────── */
.brani { width: 100%; }
.brani-testa, .brano { display: grid; align-items: center; gap: 12px;
  grid-template-columns: 34px minmax(180px, 3fr) minmax(120px, 2fr) minmax(120px, 2fr) 120px 52px 56px 36px; }
.brani-testa { color: var(--tenue); font-size: 12px; text-transform: uppercase; letter-spacing: .06em; padding: 0 8px 8px;
  border-bottom: 1px solid var(--bordo); margin-bottom: 4px; position: sticky; top: -24px; background: var(--bg); z-index: 2; padding-top: 8px; }
.brani-testa [data-ord] { cursor: pointer; }
.brani-testa [data-ord]:hover { color: var(--testo); }
.brano { padding: 6px 8px; border-radius: 6px; min-height: 56px; user-select: none; }
.brano:hover { background: var(--pannello-2); }
.brano.sel { background: #2d1a1a; }
.brano.in-ascolto .b-titolo { color: var(--accento-2); }
.brano.assente { opacity: .4; }
.brano.trascina-sopra { box-shadow: inset 0 2px 0 var(--accento); }
.brano > div { min-width: 0; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.b-num { color: var(--tenue); text-align: center; position: relative; }
.b-num .b-play { display: none; background: none; border: 0; font-size: 14px; padding: 0; }
.brano:hover .b-num .n { display: none; }
.brano:hover .b-num .b-play { display: inline; }
.in-ascolto .b-num .n { color: var(--accento-2); }
.b-tit { display: flex; align-items: center; gap: 12px; }
.b-tit .cop { width: 40px; height: 40px; border-radius: 4px; font-size: 14px; }
.b-titolo { font-weight: 500; overflow: hidden; text-overflow: ellipsis; }
.b-sub { color: var(--tenue); font-size: 12px; overflow: hidden; text-overflow: ellipsis; display: none; }
.b-tit > div { min-width: 0; }
.b-link { color: #c8c8c8; }
.b-link:hover { text-decoration: underline; color: #fff; }
.b-genere { font-size: 12px; color: #c8c8c8; }
.b-anno, .b-durata { color: var(--tenue); text-align: right; font-variant-numeric: tabular-nums; }
.b-menu { opacity: 0; }
.brano:hover .b-menu, .brano.sel .b-menu { opacity: 1; }
.maniglia { cursor: grab; color: var(--tenue); }
.altri { text-align: center; color: var(--tenue); padding: 18px; }
.vuoto { color: var(--tenue); padding: 40px 0; text-align: center; }
.vuoto big { display: block; font-size: 40px; margin-bottom: 10px; }

/* ── Barra di selezione ─────────────────────────────────────────────────── */
.selezione { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--player-h) + 14px); z-index: 30;
  background: var(--sopra); border: 1px solid #3a3a3a; border-radius: 999px; padding: 6px 8px 6px 18px;
  display: flex; gap: 6px; align-items: center; box-shadow: 0 8px 30px rgba(0,0,0,.6); max-width: calc(100vw - 32px); overflow-x: auto; }
.selezione #sel-conta { font-weight: 700; margin-right: 6px; white-space: nowrap; }

/* ── Player ─────────────────────────────────────────────────────────────── */
.player { grid-area: player; position: relative; display: grid; grid-template-columns: 1fr auto 1fr; align-items: center;
  padding: 0 16px; background: var(--pannello); border-top: 1px solid var(--bordo); gap: 12px; }
.player-avanz { position: absolute; left: 0; right: 0; top: -6px; height: 12px; cursor: pointer; z-index: 3; }
.player-avanz::before { content: ""; position: absolute; left: 0; right: 0; top: 5px; height: 3px; background: #333; }
#avanz-pieno { position: absolute; left: 0; top: 5px; height: 3px; background: var(--accento); width: 0; }
#avanz-pallino { position: absolute; top: 1px; width: 11px; height: 11px; border-radius: 50%; background: var(--accento);
  margin-left: -5px; left: 0; opacity: 0; transition: opacity .15s; }
.player-avanz:hover #avanz-pallino { opacity: 1; }
.player-avanz:hover::before, .player-avanz:hover #avanz-pieno { height: 5px; top: 4px; }
.player-info { display: flex; align-items: center; gap: 12px; min-width: 0; cursor: pointer; }
.player-testi { min-width: 0; }
.player-titolo { font-weight: 600; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-artista { color: var(--tenue); font-size: 13px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.player-comandi { display: flex; align-items: center; gap: 8px; }
.player-destra { display: flex; align-items: center; justify-content: flex-end; gap: 6px; }
.player-tempo { color: var(--tenue); font-size: 12px; font-variant-numeric: tabular-nums; margin-right: 8px; }
#p-volume { width: 100px; accent-color: var(--accento); }

/* ── Coda ───────────────────────────────────────────────────────────────── */
.coda-testa { display: flex; align-items: center; justify-content: space-between; padding: 12px 12px 12px 18px; border-bottom: 1px solid var(--bordo); }
.coda-testa h3 { margin: 0; font-size: 16px; }
.coda-testa > div { display: flex; gap: 6px; align-items: center; }
.coda-lista { overflow-y: auto; flex: 1; padding: 6px; }
.coda-voce { display: flex; align-items: center; gap: 10px; padding: 6px 8px; border-radius: 6px; cursor: pointer; }
.coda-voce:hover { background: var(--pannello-2); }
.coda-voce.ora { background: #2d1a1a; }
.coda-voce.ora .cv-titolo { color: var(--accento-2); }
.coda-voce.passata { opacity: .5; }
.coda-voce .cop { width: 40px; height: 40px; border-radius: 4px; font-size: 14px; }
.coda-voce .cv-testi { min-width: 0; flex: 1; }
.cv-titolo { white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.cv-sub { color: var(--tenue); font-size: 12px; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.coda-voce .icona-btn { width: 28px; height: 28px; font-size: 13px; opacity: 0; }
.coda-voce:hover .icona-btn { opacity: .8; }
.coda-voce.trascina-sopra { box-shadow: inset 0 2px 0 var(--accento); }
.coda-sep { color: var(--tenue); font-size: 12px; text-transform: uppercase; letter-spacing: .08em; padding: 12px 8px 4px; }

/* ── Menu contestuale, dialoghi, avvisi ─────────────────────────────────── */
.menu { position: fixed; z-index: 60; background: var(--sopra); border: 1px solid #3a3a3a; border-radius: 8px; padding: 6px 0;
  min-width: 220px; max-height: 70vh; overflow-y: auto; box-shadow: 0 10px 30px rgba(0,0,0,.6); }
.menu button { display: flex; align-items: center; gap: 10px; width: 100%; background: none; border: 0; text-align: left; padding: 9px 16px; }
.menu button:hover { background: #333; }
.menu hr { border: 0; border-top: 1px solid #3a3a3a; margin: 6px 0; }
.menu .menu-titolo { padding: 6px 16px; color: var(--tenue); font-size: 12px; }
.dialogo-fondo { position: fixed; inset: 0; background: rgba(0,0,0,.7); z-index: 70; display: flex; align-items: center; justify-content: center; padding: 16px; }
.dialogo { background: var(--pannello-2); border: 1px solid #333; border-radius: 12px; padding: 22px; width: 100%; max-width: 440px;
  max-height: 85vh; overflow-y: auto; }
.dialogo h3 { margin: 0 0 14px; font-size: 18px; }
.dialogo label { display: block; color: var(--tenue); font-size: 12px; margin: 12px 0 4px; }
.dialogo input[type=text], .dialogo textarea { width: 100%; background: var(--bg); border: 1px solid var(--bordo); border-radius: 8px; padding: 10px 12px; }
.dialogo textarea { min-height: 80px; resize: vertical; }
.dialogo input:focus, .dialogo textarea:focus { outline: none; border-color: var(--accento); }
.dialogo-azioni { display: flex; justify-content: flex-end; gap: 10px; margin-top: 20px; }
.dialogo .scelta { display: flex; align-items: center; gap: 12px; width: 100%; background: none; border: 0; border-radius: 8px; padding: 8px; text-align: left; }
.dialogo .scelta:hover { background: var(--sopra); }
.dialogo .scelta .cop { width: 44px; height: 44px; border-radius: 4px; font-size: 16px; }
.avviso { position: fixed; left: 50%; transform: translateX(-50%); bottom: calc(var(--player-h) + 70px); z-index: 80;
  background: var(--testo); color: #000; padding: 10px 18px; border-radius: 8px; font-weight: 600; box-shadow: 0 6px 20px rgba(0,0,0,.5); }

/* ── Impostazioni ───────────────────────────────────────────────────────── */
.riquadro { background: var(--pannello); border: 1px solid var(--bordo); border-radius: 12px; padding: 20px; margin-bottom: 20px; max-width: 820px; }
.riquadro h2 { margin-top: 0; }
.numeri { display: flex; gap: 28px; flex-wrap: wrap; margin-bottom: 16px; }
.numeri div b { display: block; font-size: 24px; }
.numeri div span { color: var(--tenue); font-size: 12px; }
.logo-anteprima { background: #000; border: 1px solid var(--bordo); border-radius: 8px; padding: 18px; display: inline-flex; margin-bottom: 14px; }
.tab-utenti { width: 100%; border-collapse: collapse; }
.tab-utenti td { padding: 8px 6px; border-bottom: 1px solid var(--bordo); }
.tab-utenti select { background: var(--bg); border: 1px solid var(--bordo); border-radius: 6px; padding: 5px 8px; }
.errori { color: #ff8a88; font-size: 12px; white-space: pre-wrap; max-height: 160px; overflow: auto; }

/* ── Ora in riproduzione (schermo intero) ───────────────────────────────── */
.ora { position: fixed; inset: 0; z-index: 50; background: linear-gradient(180deg, #2a0e0e, var(--bg) 70%);
  display: flex; flex-direction: column; align-items: center; padding: 24px 24px calc(24px + env(safe-area-inset-bottom)); gap: 10px; overflow-y: auto; }
.ora-chiudi { align-self: flex-start; font-size: 26px; }
.cop-ora { width: min(80vw, 420px); aspect-ratio: 1; border-radius: 10px; box-shadow: 0 20px 50px rgba(0,0,0,.7); font-size: 80px; margin: 10px 0 18px; }
.ora-titolo { font-size: 22px; font-weight: 700; text-align: center; }
.ora-artista { color: var(--tenue); text-align: center; margin-bottom: 10px; }
#ora-avanz { width: min(90vw, 480px); accent-color: var(--accento); }
.ora-tempi { width: min(90vw, 480px); display: flex; justify-content: space-between; color: var(--tenue); font-size: 12px; }
.ora-comandi { display: flex; align-items: center; gap: 14px; margin: 10px 0 18px; }

.solo-mobile { display: none; }
.velo { display: none; }

/* ── Telefono e finestre strette ────────────────────────────────────────── */
@media (max-width: 1100px) {
  .brani-testa, .brano { grid-template-columns: 34px minmax(160px, 3fr) minmax(110px, 2fr) 110px 56px 36px; }
  .b-album { display: none !important; }
  .b-anno { display: none !important; }
}
@media (max-width: 900px) {
  :root { --barra-h: 56px; --player-h: 68px; --coda-w: 100vw; }
  .app { grid-template-columns: 1fr; grid-template-areas: "barra" "vista" "player"; }
  .solo-mobile { display: inline-flex; }
  .senza-mobile { display: none !important; }
  .barra { gap: 8px; padding: 0 8px; }
  .marchio img { height: 16px; }
  .marchio span { font-size: 17px; }
  .cerca input { padding: 8px 10px 8px 32px; }
  .lato { position: fixed; z-index: 40; top: 0; bottom: 0; left: 0; width: 280px; transform: translateX(-100%); transition: transform .2s; }
  .lato.aperto { transform: none; }
  .velo.aperto { display: block; position: fixed; inset: 0; background: rgba(0,0,0,.6); z-index: 39; }
  .coda { position: fixed; z-index: 45; inset: 0 0 var(--player-h) 0; width: 100%; }
  .vista { padding: 16px 16px 40px; }
  .testa { flex-direction: column; align-items: flex-start; gap: 16px; }
  .testa .cop { width: 160px; height: 160px; }
  .testa h1 { font-size: 28px; }
  .griglia { grid-template-columns: repeat(auto-fill, minmax(140px, 1fr)); gap: 16px 12px; }
  .riga-card { grid-auto-columns: 140px; }
  .brani-testa { display: none; }
  .brano, .brani-testa { grid-template-columns: minmax(0, 1fr) 36px; }
  .brano > .b-num, .brano > .b-art, .brano > .b-album, .brano > .b-genere, .brano > .b-anno, .brano > .b-durata, .brano > .maniglia { display: none !important; }
  .b-sub { display: block; }
  .b-menu { opacity: 1; }
  .player { grid-template-columns: 1fr auto; padding: 0 8px; }
  .player-avanz { top: -2px; height: 4px; pointer-events: none; }
  .player-avanz::before, #avanz-pieno { top: 0; height: 2px; }
  .player-comandi { gap: 2px; }
  .player-comandi .play-btn { width: 40px; height: 40px; }
  .selezione { bottom: calc(var(--player-h) + 10px); }
}
