/* ============================================================================
   Archivio musicale (ADR-054): la pillola «Musica» nell'intestazione (.music-top), la pagina del socio (.music-head,
   .music-trail, .music-folders, .music-files) e la Gestione (.music-status, .music-tree, .music-rule-edit).
   Solo variabili di app.css: i temi (Sole, scuro) passano da lì.
   ============================================================================ */

/* ---- Intestazione: una pillola come «Aa», con le note nel colore dell'app ----------------------------------------- */
.topbar .user .music-top {
    display: inline-flex; align-items: center; justify-content: center; gap: 6px;
    min-width: var(--tap); min-height: var(--tap); padding: 0 14px 0 12px;
    border: var(--bw) solid var(--border-ctl); border-radius: 999px;
    color: var(--ink-2); background: var(--surface); font-weight: 700; font-size: .9rem; text-decoration: none;
}
.topbar .user .music-top .ico { width: 20px; height: 20px; color: var(--accent-text); }
.topbar .user .music-top:hover, .topbar .user .music-top.on { color: var(--accent-text); border-color: var(--accent-text); }
.topbar .user .music-top.on { background: var(--accent-soft); }
/* Fino a 1100 px solo l'icona: sul telefono accanto ci sono già «Profilo» e «Aa», e sui tablet con l'etichetta
   l'intestazione andrebbe su due righe (la fascia 720-1099 px è già stretta, base.css). */
@media (max-width: 1099.98px) {
    .topbar .user .music-top { padding: 0; }
    .topbar .user .music-top span { position: absolute; width: 1px; height: 1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; }
}

/* ---- Pagina del socio ------------------------------------------------------------------------------------------------ */
.music-head { display: flex; justify-content: space-between; align-items: flex-end; gap: 12px 16px; flex-wrap: wrap; margin-bottom: 8px; }
.music-head h1 { display: flex; align-items: center; gap: 10px; margin-bottom: .15rem; }
.music-head h1 .ico { width: 28px; height: 28px; color: var(--accent-text); }
.music-head .lead { margin-bottom: 0; }
.music-search { display: flex; gap: 8px; flex: 0 1 26rem; min-width: min(100%, 18rem); }
.music-search input {
    flex: 1 1 auto; min-width: 0; min-height: var(--tap); padding: 8px 12px;
    border: var(--bw) solid var(--border-ctl); border-radius: var(--radius-sm); background: var(--surface); color: var(--ink); font: inherit;
}
.music-copy { color: var(--muted); font-size: .875rem; margin: 0 0 12px; }

.music-trail { display: flex; flex-wrap: wrap; align-items: center; gap: 2px 4px; margin: 4px 0 2px; font-size: .9rem; color: var(--muted); }
.music-trail a { color: var(--accent-text); text-decoration: none; padding: 6px 2px; }
.music-trail a:hover { text-decoration: underline; }
.music-trail .sep { width: 14px; height: 14px; color: var(--muted); }
.music-trail [aria-current] { color: var(--ink-2); font-weight: 600; }
.music-folder-title { margin: 2px 0 12px; font-size: 1.35rem; overflow-wrap: anywhere; }

/* Cartelle: tessere in griglia, una colonna sul telefono. */
.music-folders {
    list-style: none; padding: 0; margin: 0 0 16px;
    display: grid; gap: 8px; grid-template-columns: repeat(auto-fill, minmax(min(100%, 16rem), 1fr));
}
.music-folders a {
    display: flex; align-items: center; gap: 10px; min-height: 52px; padding: 10px 12px;
    background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius);
    color: var(--ink); font-weight: 600; text-decoration: none; box-shadow: var(--shadow);
}
.music-folders a:hover { border-color: var(--accent-text); color: var(--accent-text); }
.music-folders .ico { width: 22px; height: 22px; color: var(--accent-text); flex: none; }
.music-folders .name { flex: 1 1 auto; min-width: 0; overflow-wrap: anywhere; }
.music-folders .go { width: 16px; height: 16px; color: var(--muted); }

/* File: righe in una scheda; l'audio sotto il nome, e sul telefono su tutta la larghezza della scheda (stretto fra
   l'icona e «Scarica» lascerebbe alla barra per spostarsi pochi pixel). */
.music-files {
    list-style: none; padding: 0; margin: 0 0 16px;
    background: var(--surface); border: var(--bw) solid var(--line); border-radius: var(--radius); box-shadow: var(--shadow);
}
/* Una griglia: icona, nome, «Scarica»; l'audio in una riga sua sotto il nome (sul telefono sotto tutta la riga). */
.music-file {
    display: grid; grid-template-columns: 36px minmax(0, 1fr) auto; align-items: start; gap: 6px 12px;
    padding: 10px 12px; border-top: var(--bw-line) solid var(--line);
}
.music-file:first-child { border-top: 0; }
.music-file .kind { display: inline-flex; align-items: center; justify-content: center; width: 36px; height: 36px; border-radius: 10px; background: var(--surface-2); }
.music-file .kind .ico { width: 20px; height: 20px; color: var(--ink-2); }
.music-file.score .kind .ico, .music-file.audio .kind .ico { color: var(--accent-text); }
.music-file .body { min-width: 0; display: grid; gap: 2px; }
.music-file .name { font-weight: 600; color: var(--ink); overflow-wrap: anywhere; line-height: 1.3; padding-top: 7px; }
.music-file a.name { color: var(--accent-text); text-decoration: none; }
.music-file a.name:hover { text-decoration: underline; }
.music-file .meta { color: var(--muted); font-size: .8rem; }
.music-file .meta a { color: inherit; }
.music-file audio { grid-column: 2 / -1; width: 100%; max-width: 32rem; height: 40px; }
@media (max-width: 559.98px) {
    .music-file audio { grid-column: 1 / -1; max-width: none; }
}
.music-file .dl {
    display: inline-flex; align-items: center; justify-content: center;
    width: var(--tap); height: var(--tap); border-radius: var(--radius-sm); color: var(--ink-2);
}
.music-file .dl:hover { color: var(--accent-text); background: var(--surface-2); }
.music-file .dl .ico { width: 20px; height: 20px; }
.music-found { margin: 4px 0 12px; color: var(--ink-2); }
.music-found a { color: var(--accent-text); }

/* ---- Gestione -------------------------------------------------------------------------------------------------------- */
.music-status, .music-rules { margin-bottom: 16px; }
.music-facts { display: grid; grid-template-columns: max-content 1fr; gap: 6px 16px; margin: 0; }
.music-facts dt { color: var(--muted); font-size: .875rem; }
.music-facts dd { margin: 0; overflow-wrap: anywhere; }
@media (max-width: 559.98px) {
    .music-facts { grid-template-columns: 1fr; }
    .music-facts dd { margin-bottom: 6px; }
}

.music-tree { list-style: none; padding: 0; margin: 0; }
.music-tree li { border-top: var(--bw-line) solid var(--line); padding: 2px 0 2px calc(var(--depth, 0) * 18px); }
.music-tree li:first-child { border-top: 0; }
.music-tree .row { display: flex; align-items: center; gap: 4px 8px; flex-wrap: wrap; min-height: var(--tap); }
.music-tree .twist {
    flex: none; display: inline-flex; align-items: center; justify-content: center; width: 32px; height: 32px;
    border: 0; background: none; color: var(--muted); border-radius: var(--radius-sm); cursor: pointer; padding: 0;
}
.music-tree button.twist:hover { background: var(--surface-2); color: var(--ink); }
.music-tree .twist .ico { width: 16px; height: 16px; }
.music-tree .folder { width: 18px; height: 18px; color: var(--muted); flex: none; }
.music-tree .own > .row .folder { color: var(--accent-text); }
.music-tree .name { font-weight: 600; overflow-wrap: anywhere; }
.music-tree .rule { color: var(--muted); font-size: .875rem; flex: 1 1 12rem; }
.music-tree .own > .row .rule { color: var(--ink-2); font-weight: 600; }
.music-rule-edit {
    margin: 4px 0 10px 40px; padding: 12px 14px; display: grid; gap: 10px;
    background: var(--surface-2); border-radius: var(--radius);
}
.music-rule-edit fieldset { border: 0; padding: 0; margin: 0; min-width: 0; display: grid; gap: 4px; align-content: start; }
.music-rule-edit legend { font-weight: 700; padding: 0; margin-bottom: 4px; }
.music-rule-edit .radio, .music-rule-edit .check { display: flex; align-items: center; gap: 8px; min-height: 36px; }
.music-picks { display: grid; gap: 12px 24px; grid-template-columns: repeat(auto-fit, minmax(min(100%, 14rem), 1fr)); }
.music-picks legend { color: var(--muted); font-size: .75rem; text-transform: uppercase; letter-spacing: .04em; }
@media (max-width: 559.98px) {
    .music-tree li { padding-left: calc(min(var(--depth, 0), 4) * 12px); }
    .music-rule-edit { margin-left: 0; }
}
.music-gone, .music-blocked { list-style: none; padding: 0; margin: 0; display: grid; gap: 8px; }
.music-gone li { display: flex; flex-wrap: wrap; align-items: center; gap: 4px 12px; }
.music-gone code, .music-blocked code, .music-facts code { overflow-wrap: anywhere; font-size: .85rem; }
