/* =================================================================
   player-bar.css — Bottom playback bar.
   Now-playing block, transport controls, progress bar, volume
   controls.
   ================================================================= */

.player-bar {
    background: var(--bg-sidebar);
    border-top: 1px solid var(--border-subtle);
    padding: 0 30px;
    display: flex;
    align-items: center;
    justify-content: space-between;
    grid-column: 2 / 3;           /* main column only — don't cover the sidebar */
    position: fixed;
    bottom: 0;
    left: 240px;                   /* sidebar width; keeps sidebar fully clickable */
    right: 0;
    height: var(--player-height);
    z-index: 200;
}

.now-playing {
    display: flex;
    align-items: center;
    gap: 15px;
    width: 280px;
    min-width: 0;       /* allow flex child .np-info to shrink & truncate */
}

.np-cover {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    background: linear-gradient(135deg, var(--accent-cyan), var(--accent-purple));
    flex: 0 0 auto;
}

/* The info column needs explicit overflow + min-width for text-overflow:
   ellipsis to kick in inside a flex row. Without min-width: 0 the column
   grows to its content's intrinsic size and nothing gets truncated. */
.np-info {
    flex: 1 1 auto;
    min-width: 0;
    overflow: hidden;
}

.np-info h4,
.np-info p {
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.np-info h4 {
    font-size: 14px;
    margin-bottom: 3px;
}

.np-info p {
    font-size: 12px;
    color: var(--text-secondary);
}

.np-like {
    font-size: 20px;
    cursor: pointer;
    color: var(--text-secondary);
    transition: color 0.2s;
}

.np-like:hover {
    color: var(--accent-primary);
}

.player-controls {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    flex: 1;
    max-width: 600px;
}

.control-buttons {
    display: flex;
    align-items: center;
    gap: 20px;
}

.ctrl-btn {
    background: none;
    border: none;
    color: var(--text-primary);
    font-size: 18px;
    cursor: pointer;
    opacity: 0.7;
    transition: all 0.2s;
}

.ctrl-btn:hover {
    opacity: 1;
}

.ctrl-btn.play-pause {
    width: 45px;
    height: 45px;
    background: var(--text-primary);
    color: var(--bg-dark);
    border-radius: 50%;
    font-size: 16px;
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 1;
}

/* The selected track is being opened / converted: a ring turns around the
   button. The icon underneath still shows what will happen (pause = it will
   start by itself, play = it will wait), and the button stays clickable. */
.ctrl-btn.play-pause.is-preparing,
.qh-play-pause.is-preparing {
    position: relative;
}

.ctrl-btn.play-pause.is-preparing::after,
.qh-play-pause.is-preparing::after {
    content: '';
    position: absolute;
    inset: -4px;
    border-radius: 50%;
    border: 2px solid transparent;
    border-top-color: var(--accent-cyan, var(--text-primary));
    border-right-color: var(--accent-cyan, var(--text-primary));
    animation: auditura-preparing-spin 0.9s linear infinite;
    pointer-events: none;
}

@keyframes auditura-preparing-spin {
    to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
    .ctrl-btn.play-pause.is-preparing::after,
    .qh-play-pause.is-preparing::after {
        animation: none;
        border-color: var(--accent-cyan, var(--text-primary));
        opacity: 0.6;
    }
}

.progress-bar {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 100%;
}

.time-current, .time-total {
    font-size: 12px;
    color: var(--text-secondary);
    width: 40px;
}

.progress-track {
    flex: 1;
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.progress-fill {
    width: 0%;
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
}

.volume-controls {
    display: flex;
    align-items: center;
    gap: 10px;
    width: 150px;
    justify-content: flex-end;
}

.vol-icon {
    font-size: 16px;
    cursor: pointer;
}

.volume-slider {
    width: 100px;
    height: 4px;
    background: var(--bg-card);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.volume-fill {
    width: 70%;
    height: 100%;
    background: var(--accent-primary);
    border-radius: 2px;
}

.volume-percent {
    min-width: 42px;
    text-align: right;
    font-size: 12px;
    color: var(--text-secondary);
    font-variant-numeric: tabular-nums;
    cursor: text;
    user-select: none;
    padding: 2px 4px;
    border-radius: 4px;
}

.volume-percent:hover {
    color: var(--text-primary);
    background: var(--overlay-hover);
}

.volume-percent-input {
    width: 44px;
    background: var(--bg-dark);
    border: 1px solid var(--accent-primary);
    border-radius: 4px;
    color: var(--text-primary);
    font-size: 12px;
    padding: 2px 4px;
    font-variant-numeric: tabular-nums;
    text-align: right;
    outline: none;
    -moz-appearance: textfield;
}

.volume-percent-input::-webkit-outer-spin-button,
.volume-percent-input::-webkit-inner-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

.player-bar .now-playing,
.player-bar .player-controls,
.player-bar .volume-controls {
    position: relative;
    z-index: 1;
}

.player-bar {
    right: 0;
}

.np-cover {
    width: 70px;
    height: 70px;
    border-radius: 8px;
    background: var(--bg-card);
    background-size: cover;
    background-position: center;
    cursor: pointer;
    transition: transform 0.15s, box-shadow 0.15s;
    flex: 0 0 auto;
}

.np-cover:hover {
    transform: scale(1.04);
    box-shadow: 0 4px 12px rgba(var(--accent-primary-rgb), 0.3);
}

/* =========================================================================
   Player-bar takeover for backgrounded import / tag-save (playerBarProgress.js)

   When `.player-bar` carries `.is-progress-takeover`, the three normal
   sections (.now-playing, .player-controls, .volume-controls) hide and a
   single .player-bar-progress hero appears in their place. We re-use the
   .import-now* class skeleton already styled in importer.css, plus a few
   bar-specific layout overrides below to fit the shorter player-bar height.

   Music playback is untouched — only the chrome is hidden. Keyboard
   shortcuts on document keep working.
   ========================================================================= */
.player-bar.is-progress-takeover .now-playing,
.player-bar.is-progress-takeover .player-controls,
.player-bar.is-progress-takeover .volume-controls {
    display: none;
}

.player-bar-progress {
    display: none;       /* shown only while the takeover class is on */
    flex: 1 1 auto;
    align-items: center;
    gap: 16px;
    min-width: 0;        /* allow flex children to truncate */
    width: 100%;
    height: 100%;
    cursor: pointer;     /* the bar itself is click-to-restore */
}
.player-bar.is-progress-takeover .player-bar-progress {
    display: flex;
}

/* Override the .import-now layout so it sits in a single horizontal row
   inside the short player-bar (the modal version is column-stacked). */
.player-bar-progress .import-now {
    display: flex;
    flex-direction: row;
    flex: 1 1 auto;
    align-items: center;
    gap: 16px;
    min-width: 0;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    box-shadow: none;
}
.player-bar-progress .import-now-stage {
    flex-direction: row;
    align-items: center;
    gap: 12px;
    margin: 0;
    width: auto;
    min-width: 0;
    flex: 0 0 auto;
}
.player-bar-progress .import-now-cover {
    width: 56px;
    height: 56px;
    min-width: 56px;
    border-radius: 8px;
    flex: 0 0 auto;
    background-size: cover;
    background-position: center;
    background-color: var(--bg-card);
    /* Center the fallback music glyph if no cover URL is set yet. */
    display: flex;
    align-items: center;
    justify-content: center;
    color: var(--text-muted);
}
.player-bar-progress .import-now-info {
    flex: 1 1 auto;
    min-width: 0;
    text-align: left;
    width: 280px;
    display: flex;
    flex-direction: column;
    gap: 2px;
}
.player-bar-progress .import-now-meta {
    font-size: 10px;
    font-weight: 600;
    letter-spacing: 0.05em;
    color: var(--text-muted);
    text-transform: uppercase;
    margin: 0 0 1px;
    padding: 0;
    align-self: flex-start;
}
.player-bar-progress .import-now-phase {
    font-size: 10.5px;
    font-weight: 700;
    letter-spacing: 0.04em;
    color: var(--accent-primary);
    text-transform: uppercase;
    margin: 0;
    padding: 0;
    background: transparent;
    border: none;
    align-self: flex-start;
}
.player-bar-progress .import-now-title {
    font-size: 13.5px;
    font-weight: 600;
    line-height: 1.3;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-bar-progress .import-now-subtitle {
    font-size: 11.5px;
    line-height: 1.25;
    color: var(--text-muted);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-bar-progress .import-now-counter {
    font-size: 11px;
    color: var(--text-muted);
    margin-top: 2px;
}
.player-bar-progress .import-now-bar {
    height: 4px;
    border-radius: 2px;
    flex: 1 1 auto;
    margin: 0 16px;
    background: var(--border-subtle);
    overflow: hidden;
}
.player-bar-progress .import-now-fill {
    height: 100%;
    background: var(--accent-primary);
    transition: width 0.18s ease-out;
}

.player-bar-progress-cancel {
    flex: 0 0 auto;
    height: 32px;
    padding: 0 14px;
    background: transparent;
    border: 1px solid var(--border-subtle);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12.5px;
    font-weight: 500;
    cursor: pointer;
    transition: background 0.15s, color 0.15s, border-color 0.15s;
}
.player-bar-progress-cancel:hover:not(:disabled) {
    background: var(--bg-hover);
    color: var(--text-primary);
}
.player-bar-progress-cancel:disabled {
    opacity: 0.55;
    cursor: not-allowed;
}

/* Completion states — phase pill recolours, then the whole bar fades
   out before hide() removes .is-progress-takeover. */
.player-bar-progress.player-bar-progress-ok .import-now-phase {
    color: var(--state-success, #4ade80);
}
.player-bar-progress.player-bar-progress-err .import-now-phase {
    color: var(--state-danger, #f87171);
}
.player-bar-progress.player-bar-progress-fading {
    opacity: 0;
    transition: opacity 0.3s ease-out;
}
