/**
 * Persistent player bar styles.
 *
 * The player bar is fixed at the bottom of the viewport.
 * It is hidden by default and shown once a song is loaded.
 */

.player-bar {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--secondary-dark);
    border-top: 1px solid var(--gray-700);
    z-index: 100;
    color: var(--white);

    /* Two rows: main controls row + seek row */
    display: flex;
    flex-direction: column;

    &.player-bar--hidden {
        display: none;
    }
}

/* ── Main row: art / info / controls / volume / expand ───────────────────── */

.player-bar-main {
    display: grid;
    grid-template-columns: 48px 1fr auto auto auto auto;
    align-items: center;
    gap: 0.75rem;
    padding: 0.5rem 1rem 0.25rem;
    height: 60px;
    box-sizing: border-box;
}

/* ── Seek row ────────────────────────────────────────────────────────────── */

.player-bar-seek-row {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0 1rem 0.5rem;
}

/* ── Cover art ───────────────────────────────────────────────────────────── */

.player-bar-art {
    width: 40px;
    height: 40px;
    border-radius: 4px;
    overflow: hidden;
    flex-shrink: 0;
    position: relative;
    background: var(--gray-700);

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

    &.hidden {
        display: none;
    }
    }
}

.player-cover-placeholder {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--gray-500);

    &.hidden {
        display: none;
    }
}

/* ── Track info ──────────────────────────────────────────────────────────── */

.player-bar-info {
    display: flex;
    flex-direction: column;
    min-width: 0;
}

.player-track-title {
    font-size: 0.875rem;
    font-weight: 600;
    color: var(--white);
    text-decoration: none;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;

    &:hover {
        text-decoration: underline;
    }
}

.player-track-artist {
    font-size: 0.75rem;
    color: var(--gray-400);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

/* ── Playback controls ───────────────────────────────────────────────────── */

.player-bar-controls {
    display: flex;
    align-items: center;
    gap: 0.25rem;
}

.player-ctrl {
    color: var(--white);
    padding: 0.35rem;

    & .material-icons {
        font-size: 1.5rem;
    }

    &:hover {
        background-color: rgba(255, 255, 255, 0.1);
    }
}

.player-ctrl-main .material-icons {
    font-size: 2rem;
}

/* ── Seek / progress bar ─────────────────────────────────────────────────── */

.player-time {
    font-size: 0.72rem;
    color: var(--gray-400);
    font-variant-numeric: tabular-nums;
    white-space: nowrap;
}

.player-seek,
.player-volume {
    -webkit-appearance: none;
    appearance: none;
    height: 4px;
    border-radius: 2px;
    background: var(--gray-600);
    outline: none;
    cursor: pointer;
    transition: background 0.2s;

    &::-webkit-slider-thumb {
        -webkit-appearance: none;
        appearance: none;
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: var(--white);
        cursor: pointer;
    }

    &::-moz-range-thumb {
        width: 14px;
        height: 14px;
        border-radius: 50%;
        background: var(--white);
        cursor: pointer;
        border: none;
    }

    &:hover {
        background: var(--gray-500);
    }
}

.player-seek {
    flex: 1;
    min-width: 0;
}

/* ── Volume ──────────────────────────────────────────────────────────────── */

.player-bar-volume {
    display: flex;
    align-items: center;
    gap: 0.4rem;
    color: var(--gray-400);

    & .material-icons {
        font-size: 1.2rem;
    }
}

.player-volume {
    width: 80px;
}

/* ── Expand button ───────────────────────────────────────────────────────── */

.player-expand-btn {
    color: var(--gray-400);
    padding: 0.35rem;

    & .material-icons {
        font-size: 1.2rem;
    }

    &:hover {
        color: var(--white);
    }
}

/* ── Body padding so content isn't hidden behind player bar ──────────────── */

body.player-active main#main-content {
    padding-bottom: 88px;
}

/* ── Mobile: stack seek bar below controls, hide volume/expand ───────────── */

@media (max-width: 640px) {
    .player-bar-main {
        grid-template-columns: 40px 1fr auto auto;
        padding: 0.5rem 0.75rem 0.25rem;
        height: 52px;
    }

    .player-bar-volume {
        display: none;
    }

    .player-expand-btn {
        display: none;
    }

    body.player-active main#main-content {
        padding-bottom: 80px;
    }
}
