/* ================================================
   app.css — stile principale
   ================================================ */

*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --c-bg:        #ffffff;
    --c-surface:   #f7f7f5;
    --c-border:    #e5e5e2;
    --c-text:      #1a1a1a;
    --c-muted:     #888884;
    --c-accent:    #2c5f2e;
    --c-accent-lt: #e8f0e8;
    --c-danger:    #c0392b;
    --radius:      10px;
    --header-h:    52px;
}

html, body {
    height: 100%;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    background: var(--c-bg);
    color: var(--c-text);
    font-size: 16px;
    -webkit-font-smoothing: antialiased;
    overflow-x: hidden;
}

/* ---- LOGIN ---- */
.login-page {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100vh;
    background: var(--c-surface);
}

.login-box {
    background: var(--c-bg);
    border: 1px solid var(--c-border);
    border-radius: 18px;
    padding: 2.5rem 2rem;
    width: 90%;
    max-width: 360px;
    text-align: center;
}

.login-icon  { font-size: 3rem; margin-bottom: 0.5rem; }
.login-title { font-size: 1.5rem; font-weight: 600; margin-bottom: 0.25rem; }
.login-sub   { font-size: 0.9rem; color: var(--c-muted); margin-bottom: 1.5rem; }

.login-input {
    display: block;
    width: 100%;
    padding: 0.85rem 1rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 1rem;
    margin-bottom: 0.75rem;
    background: var(--c-surface);
    color: var(--c-text);
    outline: none;
}
.login-input:focus { border-color: var(--c-accent); }

.login-btn {
    display: block;
    width: 100%;
    padding: 0.85rem;
    background: var(--c-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    letter-spacing: 0.02em;
}
.login-btn:active { opacity: 0.85; }

.errore-msg {
    background: #fdecea;
    color: var(--c-danger);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
}

/* ---- HEADER ---- */
.header {
    position: sticky;
    top: 0;
    z-index: 100;
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--header-h);
    padding: 0 1rem;
    background: var(--c-bg);
    border-bottom: 1px solid var(--c-border);
}

.app-label { font-weight: 600; font-size: 1rem; }

.header-right { display: flex; gap: 12px; align-items: center; }

.btn-logout, .btn-admin {
    font-size: 1.2rem;
    text-decoration: none;
    color: var(--c-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

.btn-back {
    background: none;
    border: none;
    font-size: 0.95rem;
    color: var(--c-accent);
    cursor: pointer;
    padding: 4px 0;
    font-weight: 500;
}

.header-titolo {
    flex: 1;
    text-align: center;
    font-weight: 600;
    font-size: 1rem;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    padding: 0 0.5rem;
}

.btn-edit { font-size: 1.2rem; text-decoration: none; }

/* ---- RICERCA ---- */
.search-wrap {
    display: flex;
    align-items: center;
    gap: 8px;
    margin: 0.75rem;
    padding: 0 12px;
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 50px;
}

.search-icon { font-size: 1rem; color: var(--c-muted); }

.search-wrap input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1rem;
    padding: 0.7rem 0;
    outline: none;
    color: var(--c-text);
}

.cerca-clear {
    background: none;
    border: none;
    font-size: 0.9rem;
    color: var(--c-muted);
    cursor: pointer;
    padding: 4px;
}

/* ---- LISTA BRANI ---- */
.song-item {
    display: flex;
    align-items: center;
    padding: 0.9rem 1rem;
    border-bottom: 1px solid var(--c-border);
    cursor: pointer;
    -webkit-tap-highlight-color: var(--c-accent-lt);
    transition: background 0.1s;
}
.song-item:active { background: var(--c-surface); }

.song-info   { flex: 1; min-width: 0; }
.song-name   { display: block; font-size: 1rem; font-weight: 500; }
.song-preview {
    display: block;
    font-size: 0.78rem;
    color: var(--c-muted);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.song-arrow { font-size: 1.4rem; color: var(--c-border); margin-left: 8px; }

.msg-vuoto, .msg-errore {
    text-align: center;
    padding: 2rem 1rem;
    color: var(--c-muted);
    font-size: 0.95rem;
}

/* ---- TRASPOSIZIONE ---- */
.transpose-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 0.6rem 1rem;
    background: var(--c-surface);
    border-bottom: 1px solid var(--c-border);
}

.t-btn {
    width: 36px; height: 36px;
    border-radius: 50%;
    border: 1px solid var(--c-border);
    background: var(--c-bg);
    font-size: 1.3rem;
    line-height: 1;
    cursor: pointer;
    color: var(--c-text);
    display: flex; align-items: center; justify-content: center;
}
.t-btn:active { background: var(--c-accent-lt); }

#t-label {
    flex: 1;
    text-align: center;
    font-size: 0.85rem;
    color: var(--c-muted);
    font-weight: 500;
}

/* ---- TABS ---- */
.tabs {
    display: flex;
    border-bottom: 1px solid var(--c-border);
}
.tab {
    flex: 1;
    padding: 0.65rem;
    font-size: 0.9rem;
    border: none;
    background: none;
    cursor: pointer;
    color: var(--c-muted);
    border-bottom: 2px solid transparent;
    font-weight: 500;
}
.tab.active {
    color: var(--c-accent);
    border-bottom-color: var(--c-accent);
}

/* ---- PANNELLI CONTENUTO ---- */
.panel { display: none; padding: 1rem; }
.panel.active { display: block; }

.accordi-block {
    font-size: 2rem;
    font-weight: 600;
    line-height: 2;
    white-space: pre-wrap;
    letter-spacing: 0.03em;
    color: var(--c-text);
}

.testo-block {
    font-size: 1rem;
    line-height: 2;
    white-space: pre-wrap;
    color: var(--c-text);
}

/* ---- ADMIN AREA ---- */
.admin-header {
    background: var(--c-accent);
    color: #fff;
}
.admin-header a, .admin-header button {
    color: rgba(255,255,255,0.85);
}
.admin-header .app-label { color: #fff; }

.admin-section {
    padding: 1rem;
}

.form-group {
    margin-bottom: 1rem;
}
.form-group label {
    display: block;
    font-size: 0.85rem;
    font-weight: 500;
    color: var(--c-muted);
    margin-bottom: 0.4rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}
.form-group input,
.form-group textarea {
    display: block;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--c-bg);
    color: var(--c-text);
    outline: none;
    resize: vertical;
}
.form-group input:focus,
.form-group textarea:focus { border-color: var(--c-accent); }

.form-group textarea { min-height: 120px; }

.btn-salva {
    display: block;
    width: 100%;
    padding: 0.9rem;
    background: var(--c-accent);
    color: #fff;
    border: none;
    border-radius: var(--radius);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    margin-bottom: 0.75rem;
}
.btn-salva:active { opacity: 0.85; }

.btn-elimina {
    display: block;
    width: 100%;
    padding: 0.75rem;
    background: #fdecea;
    color: var(--c-danger);
    border: 1px solid #f5c6c2;
    border-radius: var(--radius);
    font-size: 0.95rem;
    font-weight: 500;
    cursor: pointer;
    text-align: center;
    text-decoration: none;
}
.btn-elimina:active { background: #fad4d1; }

.msg-ok {
    background: var(--c-accent-lt);
    color: var(--c-accent);
    border-radius: var(--radius);
    padding: 0.6rem 1rem;
    font-size: 0.9rem;
    margin-bottom: 1rem;
    text-align: center;
}

.admin-lista .song-item { text-decoration: none; color: inherit; display: flex; }

.btn-nuovo {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    margin: 0.75rem;
    padding: 0.85rem;
    background: var(--c-accent);
    color: #fff;
    border-radius: var(--radius);
    text-decoration: none;
    font-weight: 600;
    font-size: 1rem;
}

/* Dark mode base */
@media (prefers-color-scheme: dark) {
    :root {
        --c-bg:      #1a1a1a;
        --c-surface: #242424;
        --c-border:  #333;
        --c-text:    #f0f0f0;
        --c-muted:   #888;
        --c-accent-lt: #1a2e1a;
    }
    .login-page { background: var(--c-surface); }
    .login-box  { background: var(--c-bg); }
    .errore-msg { background: #3a1a1a; }
}

/* ---- BADGE RUOLI ---- */
.badge-ruolo {
    display: inline-block;
    font-size: 0.72rem;
    font-weight: 600;
    padding: 2px 8px;
    border-radius: 20px;
    text-transform: uppercase;
    letter-spacing: 0.04em;
}
.ruolo-admin     { background: #fdecea; color: #c0392b; }
.ruolo-musicista { background: #e8f0e8; color: #2c5f2e; }
.ruolo-amico     { background: #e8f0f8; color: #1a5276; }

.badge-tu {
    display: inline-block;
    font-size: 0.7rem;
    background: var(--c-surface);
    color: var(--c-muted);
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: 6px;
    vertical-align: middle;
}

/* ---- LISTA UTENTI ---- */
.utente-item {
    display: flex;
    align-items: center;
    padding: 0.85rem 1rem;
    border-bottom: 1px solid var(--c-border);
    gap: 8px;
}
.utente-disattivo { opacity: 0.5; }
.utente-info { flex: 1; min-width: 0; }
.utente-azioni { display: flex; gap: 6px; }

.btn-azione {
    background: var(--c-surface);
    border: 1px solid var(--c-border);
    border-radius: 8px;
    width: 36px; height: 36px;
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    font-size: 1rem;
    text-decoration: none;
}
.btn-azione:active { opacity: 0.7; }

/* ---- ADMIN MENU ---- */
.admin-menu { padding: 0.5rem 0; }
.admin-menu-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 1rem;
    border-bottom: 1px solid var(--c-border);
    text-decoration: none;
    color: var(--c-text);
    font-size: 1rem;
    font-weight: 500;
}
.admin-menu-item:active { background: var(--c-surface); }
.admin-menu-icon { font-size: 1.4rem; }

/* ---- PROFILO ---- */
.profilo-ruolo {
    font-size: 0.9rem;
    color: var(--c-muted);
    margin-bottom: 1.25rem;
}

/* ---- ICONE HEADER ---- */
.btn-icon {
    font-size: 1.2rem;
    text-decoration: none;
    color: var(--c-muted);
    background: none;
    border: none;
    cursor: pointer;
    padding: 4px;
}

/* ---- CAPO ---- */
.capo-banner {
    background: #fff8e1;
    color: #7c5500;
    font-size: 0.9rem;
    font-weight: 600;
    padding: 0.5rem 1rem;
    text-align: center;
    border-bottom: 1px solid #ffe082;
    letter-spacing: 0.03em;
}

.badge-capo {
    display: inline-block;
    font-size: 0.7rem;
    font-weight: 600;
    background: #fff3cd;
    color: #7c5500;
    border: 1px solid #ffe082;
    border-radius: 20px;
    padding: 1px 7px;
    margin-left: 7px;
    vertical-align: middle;
    letter-spacing: 0.03em;
}

.t-reset {
    font-size: 1rem;
    width: 30px;
    height: 30px;
    color: var(--c-muted);
}

/* ---- SELECT ADMIN ---- */
.capo-select {
    display: block;
    width: 100%;
    padding: 0.75rem;
    border: 1px solid var(--c-border);
    border-radius: var(--radius);
    font-size: 1rem;
    font-family: inherit;
    background: var(--c-bg);
    color: var(--c-text);
    outline: none;
}
.capo-select:focus { border-color: var(--c-accent); }

@media (prefers-color-scheme: dark) {
    .capo-banner { background: #3a2e00; color: #ffd54f; border-color: #5a4500; }
    .badge-capo  { background: #3a2e00; color: #ffd54f; border-color: #5a4500; }
}
