body { min-height: 100vh; display: flex; flex-direction: column; }

.lib-wrap {
    flex: 1;
    width: 100%;
    max-width: 100%;
    margin: 0;
    padding: 1.25rem 1.5rem 3rem;
}

/* ── Panels ── */
.lib-layout { align-items: flex-start; }

/* ── Sidebar ── */
.lib-sidebar { display: flex; }
.lib-sidebar .card {
    width: 100%;
    border-radius: .75rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(6px);
}
.lib-section-title {
    font-size: .75rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: .05em;
    color: #6c757d;
    padding: .5rem .75rem .25rem;
}
.lib-col-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .45rem .75rem;
    cursor: pointer;
    border-radius: .35rem;
    transition: background .15s;
    font-size: .9rem;
}
.lib-col-item:hover { background: rgba(37,99,235,.06); }
.lib-col-item.active {
    background: rgba(37,99,235,.12);
    font-weight: 600;
    color: #2563eb;
}
.lib-col-item .col-actions { opacity: 0; transition: opacity .15s; }
.lib-col-item:hover .col-actions { opacity: 1; }
.lib-col-item .col-actions .btn { padding: .1rem .3rem; font-size: .75rem; }

.lib-col-badge {
    font-size: .65rem;
    padding: .15em .45em;
    vertical-align: middle;
}

/* ── Main panel ── */
.lib-songs { display: flex; }
.lib-songs .card {
    border-radius: .75rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(6px);
    width: 100%;
}
.lib-songs .card-header {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-bottom: none;
    border-radius: .75rem .75rem 0 0 !important;
    font-weight: 700;
    color: #1e40af;
}
.song-item {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .6rem .75rem;
    transition: background .15s;
    cursor: pointer;
}
.song-item:hover { background: #f0f7ff; }
.song-item.active { background: #dbeafe; }
.song-item .song-info { flex: 1; min-width: 0; overflow: hidden; }
.song-item .song-info .fw-semibold {
    white-space: nowrap; overflow: hidden; text-overflow: ellipsis;
}
.song-item .song-actions { display: flex; gap: .3rem; flex-shrink: 0; }
.song-item .song-actions .btn { padding: .2rem .4rem; font-size: .78rem; }

/* ── Auth gate ── */
.lib-auth-gate {
    text-align: center;
    padding: 4rem 1rem;
}
.lib-auth-gate .fa-lock { font-size: 3rem; color: #94a3b8; margin-bottom: 1rem; }

/* ── Score preview panel ── */
.lib-preview { min-width: 0; overflow: hidden; }
.lib-preview .card {
    border-radius: .75rem;
    box-shadow: 0 2px 12px rgba(0,0,0,.08);
    background: rgba(255,255,255,.75);
    backdrop-filter: blur(6px);
    position: sticky;
    top: 72px;
    max-width: 100%;
}
.lib-preview .card-header {
    background: linear-gradient(135deg, #dbeafe, #bfdbfe);
    border-bottom: none;
    border-radius: .75rem .75rem 0 0 !important;
    font-weight: 700;
    color: #1e40af;
    font-size: .9rem;
}
.lib-preview-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}
.lib-preview-empty i { font-size: 2rem; margin-bottom: .5rem; display: block; }
.lib-preview-empty span { font-size: .85rem; }
.lib-preview-scroll {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 70vh;
    max-width: 100%;
}
.lib-preview-scroll svg { display: block; }

/* ── Empty state ── */
.lib-empty {
    text-align: center;
    padding: 3rem 1rem;
    color: #94a3b8;
}
.lib-empty i { font-size: 2.5rem; margin-bottom: .75rem; display: block; }

/* ── Search boxes over the collections and the songs ───────────────────── */
.lib-search { position: relative; }
.lib-search > i {
    position: absolute;
    left: .6rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: .75rem;
    color: #94a3b8;
    pointer-events: none;
}
.lib-search .form-control { padding-left: 1.8rem; border-radius: 50px; }
.lib-search-songs { padding: .5rem .75rem; border-bottom: 1px solid rgba(0, 0, 0, .06); }
.lib-search-songs > i { left: 1.35rem; }

/* Sort beside the song search */
.lib-search-songs { display: flex; align-items: center; gap: .5rem; }
.lib-search-songs .form-control { flex: 1; min-width: 0; }
.lib-sort { width: auto; max-width: 45%; border-radius: 50px; font-size: .78rem; }

/* Key, time, clef and bars under a song title */
.song-item .song-detail {
    display: block;
    color: #475569;
    font-size: .74rem;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.song-item .song-date { font-size: .7rem; }
.song-item .dropdown-menu { font-size: .85rem; }

.lib-notice { margin: .5rem .75rem 0; padding: .35rem .7rem; font-size: .82rem; }
#libClassOptions .lib-section-title { padding-top: .6rem; }
