/* Library table + toolbar styles (loaded after base.css) */

.toolbar {
    display: flex;
    align-items: center;
    flex-wrap: wrap;
    gap: 0.6rem;
    margin: 1rem 0 0.5rem;
}

.search-box {
    flex: 1 1 260px;
    max-width: 420px;
    padding: 0.55rem 0.8rem;
    font-size: 1rem;
}

.archived-toggle {
    display: inline-flex;
    align-items: center;
    gap: 0.4rem;
    font-size: 0.95rem;
    cursor: pointer;
}

.archived-toggle input {
    width: 1.05rem;
    height: 1.05rem;
    accent-color: var(--nub-orange);
}

.toolbar-spacer {
    flex: 1 1 0;
}

.row-count {
    color: var(--nub-purple-light);
    font-size: 0.9rem;
    margin: 0 0 0.6rem;
}

.table-scroll {
    overflow: auto;
    max-height: calc(100vh - 240px);
    min-height: 300px;
    border: 1px solid var(--nub-purple-light);
    border-radius: 10px;
}

.library-table {
    table-layout: fixed;
    width: 100%;
    min-width: 2250px;
    border-collapse: separate;
    border-spacing: 0;
    font-size: 0.88rem;
}

.col-actions { width: 70px; }
.col-f_ref { width: 95px; }
.col-f_title { width: 200px; }
.col-f_composer { width: 140px; }
.col-f_arranger { width: 140px; }
.col-f_notes { width: 240px; }
.col-archived { width: 85px; }
.col-f_source { width: 80px; }
.col-f_genre { width: 160px; }
.col-f_ensemble { width: 110px; }
.col-f_feature { width: 130px; }
.col-f_grade { width: 65px; }
.col-f_length { width: 85px; }
.col-f_folder { width: 75px; }
.col-f_newref { width: 85px; }
.col-f_pub { width: 130px; }
.col-f_pubref { width: 95px; }
.col-f_year { width: 65px; }
.col-f_lastperf { width: 105px; }
.col-f_library { width: 75px; }
.col-f_dodgy { width: 65px; }
.col-f_link { width: 95px; }

.library-table thead th {
    position: sticky;
    top: 0;
    z-index: 2;
    background: #3f2273;
    color: var(--nub-white);
    text-align: left;
    padding: 0.5rem 0.5rem 0.55rem;
    border-bottom: 2px solid var(--nub-orange);
    vertical-align: top;
    white-space: nowrap;
}

.library-table thead th .col-label {
    display: block;
    font-family: var(--font-heading);
    font-weight: 600;
    margin-bottom: 0.25rem;
}

.sort-link {
    color: var(--nub-white);
}

.sort-link:hover {
    color: var(--nub-orange);
    text-decoration: none;
}

.sort-arrow {
    font-size: 0.8em;
    color: var(--nub-orange);
}

.library-table thead input[type="text"],
.library-table thead select {
    width: 100%;
    height: 1.9rem;
    font-size: 0.82rem;
    padding: 0.25rem 0.3rem;
    border-radius: 4px;
    border: 1px solid var(--nub-purple-light);
}

.library-table thead select {
    padding-right: 1.4rem;
    background-position: right 0.2rem center;
    background-size: 0.6rem;
}

.library-table tbody td {
    padding: 0.4rem 0.5rem;
    border-bottom: 1px solid rgba(140, 107, 198, 0.3);
    overflow-wrap: anywhere;
    vertical-align: top;
}

.library-table tbody tr:nth-child(even) td {
    background-color: rgba(255, 255, 255, 0.04);
}

.library-table tbody tr:hover td {
    background-color: rgba(250, 167, 74, 0.12);
}

.cell-title {
    font-weight: 600;
}

.badge-ensemble {
    display: inline-block;
    min-width: 1.4em;
    padding: 0.02em 0.3em;
    margin-left: 0.2em;
    border-radius: 4px;
    background-color: var(--nub-orange);
    color: var(--nub-black);
    font-size: 0.72rem;
    font-weight: 700;
    line-height: 1.35;
    text-align: center;
    text-decoration: none;
    vertical-align: middle;
}

.cell-notes {
    color: rgba(255, 255, 255, 0.85);
}

.cell-links a {
    margin-right: 0.3rem;
    font-weight: 700;
}

.unknown {
    color: var(--nub-purple-light);
}

.flag-dodgy {
    color: var(--nub-orange);
    font-weight: 700;
}

tr.archived-row td {
    opacity: 0.55;
}

.empty-row {
    text-align: center;
    padding: 2rem !important;
    color: var(--nub-purple-light);
    font-style: italic;
}

.chip {
    display: inline-block;
    padding: 0.05rem 0.5rem;
    border-radius: 9999px;
    font-size: 0.75rem;
    font-weight: 700;
}

.chip-hsb {
    background-color: var(--nub-purple-light);
    color: var(--nub-white);
}

.chip-wherry {
    background-color: var(--nub-orange);
    color: var(--nub-black);
}

.chip-nub {
    background-color: #7bdcb5;
    color: var(--nub-black);
}

.chip-archived {
    background-color: rgba(255, 255, 255, 0.25);
    color: var(--nub-white);
}

.icon {
    display: inline-block;
    width: 1rem;
    height: 1rem;
    background-color: currentColor;
    vertical-align: -0.15em;
    -webkit-mask-repeat: no-repeat;
    mask-repeat: no-repeat;
    -webkit-mask-position: center;
    mask-position: center;
    -webkit-mask-size: contain;
    mask-size: contain;
}

.icon-plus {
    -webkit-mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 3v10M3 8h10' fill='none' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E");
    mask-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 16 16'%3E%3Cpath d='M8 3v10M3 8h10' fill='none' stroke='%23000' stroke-width='2'/%3E%3C/svg%3E");
}

.icon-btn {
    display: inline-block;
    padding: 0.25rem 0.35rem;
    border-radius: 6px;
    color: var(--nub-white);
}

.icon-btn:hover {
    background-color: rgba(255, 255, 255, 0.15);
    text-decoration: none;
}

.icon-danger:hover {
    background-color: #b3261e;
}

/* ---------- Mobile mode ---------- */

@media (max-width: 720px) {
    .table-scroll {
        max-height: calc(100vh - 150px);
        border-radius: 8px;
    }

    .library-table {
        min-width: 800px;
        font-size: 0.84rem;
    }

    .col-f_ref { width: 80px; }
    .col-f_title { width: 150px; }
    .col-f_composer { width: 110px; }
    .col-f_arranger { width: 110px; }
    .col-f_notes { width: 160px; }
    .col-archived { width: 60px; }
    .col-f_source { width: 65px; }

    .col-f_genre,
    .col-f_ensemble,
    .col-f_feature,
    .col-f_grade,
    .col-f_length,
    .col-f_folder,
    .col-f_newref,
    .col-f_pub,
    .col-f_pubref,
    .col-f_year,
    .col-f_lastperf,
    .col-f_library,
    .col-f_dodgy,
    .col-f_link {
        display: none;
    }

    .library-table thead th {
        padding: 0.35rem 0.3rem 0.4rem;
    }

    .library-table tbody td {
        padding: 0.35rem 0.3rem;
    }

    .library-table thead input[type="text"],
    .library-table thead select {
        font-size: 0.78rem;
        padding: 0.3rem 0.25rem;
    }

    .icon-btn {
        padding: 0.45rem 0.5rem;
    }

    .toolbar {
        gap: 0.45rem;
        margin: 0.75rem 0 0.4rem;
    }

    .search-box {
        flex: 1 1 100%;
        max-width: none;
    }

    .row-count {
        margin: 0 0 0.4rem;
    }
}

/* ---------- Admin page ---------- */

.admin-cards {
    display: grid;
    grid-template-columns: repeat(auto-fit, minmax(230px, 1fr));
    gap: 1rem;
    margin: 1.25rem 0 1.5rem;
}

.admin-card {
    display: block;
    background-color: rgba(255, 255, 255, 0.06);
    border: 2px solid var(--nub-purple-light);
    border-radius: 12px;
    padding: 1.25rem 1.4rem;
    color: var(--nub-white);
    text-decoration: none;
}

.admin-card:hover {
    border-color: var(--nub-orange);
    text-decoration: none;
}

.admin-card h3 {
    margin-bottom: 0.4rem;
}

.admin-card p {
    margin: 0;
    font-size: 0.9rem;
    color: var(--nub-purple-light);
}
