/**
 * Library — Songs page styles
 * Covers: /library/songs
 */

.library-page {
    max-width: var(--screen-xl);
    margin: 0 auto;
    padding: 1.5rem 1rem;
}

.library-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 1rem;
    flex-wrap: wrap;
    gap: 0.75rem;

    & .page-title {
        margin: 0;
    }
}

.library-header-actions {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.songs-action-spin {
    animation: songs-action-spin 0.8s linear infinite;
}

@keyframes songs-action-spin {
    to { transform: rotate(360deg); }
}

/* ── Search bar ──────────────────────────────────────────────────────────── */

.songs-search-bar {
    margin-bottom: 1.5rem;
}

.search-input-wrapper {
    position: relative;
    max-width: 480px;

    & .search-icon {
        position: absolute;
        left: 0.75rem;
        top: 50%;
        transform: translateY(-50%);
        color: var(--text-muted);
        pointer-events: none;
        font-size: 1.25rem;
    }

    & input[type="search"] {
        width: 100%;
        padding-left: 2.75rem;
        box-sizing: border-box;
    }
}

/* ── Search results ──────────────────────────────────────────────────────── */

.search-section {
    margin-bottom: 2rem;
}

.search-section-title {
    font-size: 1rem;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0 0 0.75rem;
    padding-bottom: 0.5rem;
    border-bottom: 1px solid var(--border);
}

/* ── Infinite scroll sentinel ────────────────────────────────────────────── */

.songs-list-sentinel {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 1.5rem 0;
    min-height: 3rem;
    color: var(--text-muted);
    font-size: 0.85rem;

    &.is-loading::after {
        content: "";
        display: block;
        width: 1.25rem;
        height: 1.25rem;
        border: 2px solid var(--border);
        border-top-color: var(--primary);
        border-radius: 50%;
        animation: songs-spin 0.7s linear infinite;
    }
}

.songs-sentinel-error {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    color: var(--text-secondary);
    font-size: 0.85rem;
}

@keyframes songs-spin {
    to { transform: rotate(360deg); }
}

/* ── Artist mini-cards (search results) ──────────────────────────────────── */

.artist-mini-list {
    display: flex;
    flex-wrap: wrap;
    gap: 0.75rem;
}

.artist-mini-card {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 0.75rem;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 2rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: box-shadow 0.2s;

    &:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }
}

/* ── Album mini-cards ────────────────────────────────────────────────────── */

.album-mini-list {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 0.75rem;
}

.album-mini-card {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem;
    background: var(--surface-1);
    border: 1px solid var(--border);
    border-radius: 0.5rem;
    text-decoration: none;
    color: var(--text-primary);
    transition: box-shadow 0.2s;

    &:hover {
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
    }
}

.album-mini-art {
    width: 48px;
    height: 48px;
    border-radius: 0.25rem;
    overflow: hidden;
    flex-shrink: 0;
    background: var(--surface-2);

    & img {
        width: 100%;
        height: 100%;
        object-fit: cover;
        display: block;
    }
}

.album-mini-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.album-mini-name {
    font-size: 0.85rem;
    font-weight: 600;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.album-mini-artist {
    font-size: 0.75rem;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
