/* ══════════════════════════════════════════════════════════════════════════
   music.css — Cathedral Music Player v6 — compact
   ══════════════════════════════════════════════════════════════════════════ */

#mp-player,
#mp-artists {
    position: fixed;
    display: none;
    flex-direction: column;
    z-index: 5;
    opacity: 0;
    pointer-events: none;
    box-sizing: border-box;
}

#mp-player.mp-on,
#mp-artists.mp-on {
    display: flex;
}

/* ══ LEFT — Player ══════════════════════════════════════════════════════════ */
.mp-inner {
    display: flex;
    flex-direction: column;
    gap: 6px;
    width: 100%;
    height: 100%;
    overflow: hidden;
    background: var(--bg-panel);
    border: var(--border-main);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-panel);
    padding: 9px 9px 8px;
    box-sizing: border-box;
}

/* Cover */
.mp-cover-wrap {
    width: 100%;
    max-width: 140px;
    align-self: center;
    aspect-ratio: 1 / 1;
    flex-shrink: 0;
    border-radius: var(--radius-msg);
    overflow: hidden;
    border: var(--border-main);
    box-shadow: var(--shadow-msg);
    background: var(--bg-input);
}

.mp-cover {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Meta */
.mp-meta {
    flex-shrink: 0;
    text-align: center;
    display: flex;
    flex-direction: column;
    gap: 1px;
}

.mp-title {
    font-size: 10px;
    font-weight: bold;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    line-height: 1.4;
}

.mp-artist {
    font-size: 9px;
    font-weight: bold;
    color: var(--led-glow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mp-dimrow {
    font-size: 8px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    opacity: 0.8;
}

/* Progress */
.mp-prog-wrap {
    display: grid;
    grid-template-columns: 16px 1fr 16px;
    /* Tighter outer columns give the bar more room */
    align-items: center;
    gap: 4px;
    /* Reduced gap to maximize bar width */
    flex-shrink: 0;
    width: 100%;
    /* Forces the wrapper to take up all available horizontal space */
}

.mp-time {
    font-size: 8px;
    color: var(--text-dim);
    font-variant-numeric: tabular-nums;
    flex-shrink: 0;
}

/* NEW: Pushes the right-side timestamp to the right edge */
.mp-time:last-child {
    text-align: right;
}

.mp-bar {
    width: 100%;
    height: 3px;
    background: var(--bg-input);
    border-radius: 2px;
    position: relative;
    cursor: pointer;
    box-shadow: var(--shadow-input);
}

.mp-fill {
    height: 100%;
    width: 0%;
    background: var(--led-glow);
    border-radius: 2px;
    pointer-events: none;
}

.mp-handle {
    width: 8px;
    height: 8px;
    background: var(--text-main);
    border-radius: 50%;
    position: absolute;
    top: 50%;
    left: 0%;
    transform: translate(-50%, -50%);
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.6);
    pointer-events: none;
    transition: transform 0.1s;
}

.mp-bar:hover .mp-handle {
    transform: translate(-50%, -50%) scale(1.4);
}

/* Controls */
.mp-ctrl {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 3px;
    flex-shrink: 0;
}

.mp-btn {
    background: var(--bg-btn);
    color: var(--text-btn);
    border: var(--border-main);
    box-shadow: var(--shadow-btn);
    border-radius: var(--radius-btn);
    padding: 4px 7px;
    font-family: inherit;
    font-size: 11px;
    cursor: pointer;
    line-height: 1;
    outline: none;
    white-space: nowrap;
    transition: background 0.1s;
}

.mp-btn:hover {
    background: var(--bg-btn-hover);
}

.mp-btn:active {
    background: var(--bg-input);
    box-shadow: var(--shadow-input);
}

.mp-btn.mp-active {
    background: var(--bg-input) !important;
    box-shadow: var(--shadow-input) !important;
    color: var(--led-glow) !important;
}

.mp-play-btn {
    padding: 5px 10px;
    font-size: 12px;
}

.mp-sm {
    padding: 3px 5px;
    font-size: 9px;
}

/* Volume */
.mp-vol-row {
    display: grid;
    grid-template-columns: 16px 1fr 16px;
    /* Exact same grid as the progress bar */
    align-items: center;
    gap: 4px;
    /* Exact same gap */
    flex-shrink: 0;
    width: 100%;
}

.mp-vol-icon {
    font-size: 10px;
    flex-shrink: 0;
    user-select: none;
}

.mp-vol {
    width: 100%;
    -webkit-appearance: none;
    appearance: none;
    height: 2px;
    background: var(--bg-input);
    border-radius: 2px;
    outline: none;
    cursor: pointer;
}

.mp-vol::-webkit-slider-thumb {
    -webkit-appearance: none;
    width: 9px;
    height: 9px;
    border-radius: var(--radius-btn);
    background: var(--text-main);
    box-shadow: none;
    cursor: pointer;
}

.mp-vol:focus::-webkit-slider-thumb {
    box-shadow: none;
    outline: none;
}

.mp-vol::-webkit-slider-thumb:active {
    box-shadow: none;
}

.mp-vol:focus {
    outline: none;
    box-shadow: none;
}

.mp-vol::-moz-range-thumb {
    width: 9px;
    height: 9px;
    border-radius: var(--radius-btn);
    background: var(--text-main);
    border: none;
    box-shadow: none;
    cursor: pointer;
}

/* Section (grid + tracklist share this space) */
.mp-section {
    display: flex;
    flex-direction: column;
    flex: 1;
    min-height: 0;
    gap: 4px;
}

.mp-grid-label {
    font-size: 8px;
    font-weight: bold;
    color: var(--led-glow);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

#mp-grid-wrap {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* Album grid */
.mp-grid {
    flex: 1;
    min-height: 0;
    overflow-y: auto;
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(72px, 1fr));
    gap: 4px;
    align-content: start;
}

.mp-grid::-webkit-scrollbar {
    width: 3px;
}

.mp-grid::-webkit-scrollbar-track {
    background: transparent;
}

.mp-grid::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.2);
    border-radius: 2px;
}

.mp-alb-cell {
    display: flex;
    flex-direction: column;
    gap: 2px;
    cursor: pointer;
    border-radius: var(--radius-btn);
    padding: 3px;
    border: 1px solid transparent;
    transition: background 0.12s, border-color 0.12s;
}

.mp-alb-cell:hover {
    background: rgba(128, 128, 128, 0.08);
}

.mp-alb-cell.mp-alb-active {
    border-color: var(--led-glow);
}

.mp-alb-img {
    width: 100%;
    aspect-ratio: 1 / 1;
    object-fit: cover;
    border-radius: calc(var(--radius-btn) - 2px);
    display: block;
    border: var(--border-main);
    background: var(--bg-input);
}

.mp-alb-lbl {
    font-size: 7px;
    color: var(--text-dim);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    text-align: center;
    line-height: 1.3;
}

.mp-alb-meta {
    font-size: 6px;
    color: var(--text-dim);
    opacity: 0.5;
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
}

.mp-alb-cell.mp-alb-active .mp-alb-lbl {
    color: var(--led-glow);
}

/* Inline tracklist */
.mp-tracklist {
    flex: 1;
    min-height: 0;
    flex-direction: column;
    overflow: hidden;
}

.mp-tl-back {
    background: none;
    color: var(--text-dim);
    border: none;
    box-shadow: none;
    padding: 3px 6px 4px;
    font-family: inherit;
    font-size: 9px;
    font-weight: bold;
    letter-spacing: 0.3px;
    cursor: pointer;
    outline: none;
    flex-shrink: 0;
    margin-bottom: 4px;
    width: 100%;
    text-align: left;
    transition: color 0.15s, border-color 0.15s;
    animation: mp-back-pulse 3s ease-in-out infinite;
}

.mp-tl-back:hover {
    color: var(--text-main);
    animation: none;
}

.mp-tl-back-arrow {
    opacity: 0.35;
    transition: opacity 0.15s, transform 0.15s;
    display: inline-block;
}

.mp-tl-back:hover .mp-tl-back-arrow {
    opacity: 1;
    transform: translateX(-2px);
}

@keyframes mp-back-pulse {

    0%,
    100% {
        color: var(--text-dim);
    }

    50% {
        color: var(--text-main);
    }
}

.mp-tl-album {
    font-size: 8px;
    font-weight: bold;
    color: var(--led-glow);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex-shrink: 0;
    margin-bottom: 3px;
}

.mp-tl-list {
    flex: 1;
    overflow-y: auto;
    min-height: 0;
}

.mp-tl-list::-webkit-scrollbar {
    width: 3px;
}

.mp-tl-list::-webkit-scrollbar-track {
    background: transparent;
}

.mp-tl-list::-webkit-scrollbar-thumb {
    background: rgba(128, 128, 128, 0.2);
    border-radius: 2px;
}

.mp-tl-row {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 4px 2px;
    cursor: pointer;
    border-radius: 3px;
    transition: background 0.1s;
}

.mp-tl-row:hover {
    background: rgba(128, 128, 128, 0.08);
}

.mp-tl-row.mp-tl-active {
    background: rgba(128, 128, 128, 0.05);
}

.mp-tl-num {
    font-size: 8px;
    color: var(--text-dim);
    width: 14px;
    text-align: right;
    flex-shrink: 0;
    font-variant-numeric: tabular-nums;
}

.mp-tl-name {
    font-size: 9px;
    color: var(--text-main);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    flex: 1;
}

.mp-tl-row.mp-tl-active .mp-tl-num,
.mp-tl-row.mp-tl-active .mp-tl-name {
    color: var(--led-glow);
    text-shadow: 0 0 4px var(--led-glow);
}

/* ══ RIGHT — Artist panel ═══════════════════════════════════════════════════ */
#mp-artists {
    background: var(--bg-sidebar);
    border: var(--border-main);
    border-radius: var(--radius-panel);
    box-shadow: var(--shadow-panel);
    overflow-y: auto;
    padding: 6px 0;
    width: auto;
}

#mp-artists::-webkit-scrollbar {
    width: 0px;
}

#mp-artists::-webkit-scrollbar-track {
    background: transparent;
}

#mp-artists::-webkit-scrollbar-thumb {
    background: transparent;
}

.mp-ap-label {
    font-size: 8px;
    font-weight: bold;
    color: var(--text-dim);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    padding: 0 8px 5px;
    white-space: nowrap;
}

.mp-ap-item {
    padding: 5px 10px;
    font-size: 10px;
    font-weight: bold;
    color: var(--text-main);
    cursor: pointer;
    white-space: nowrap;
    transition: background 0.1s, color 0.1s;
}

.mp-ap-item:hover {
    background: rgba(128, 128, 128, 0.09);
}

.mp-ap-item.mp-ap-active {
    color: var(--led-glow);
    background: rgba(128, 128, 128, 0.06);
    text-shadow: 0 0 4px var(--led-glow);
}

/* Desktop only */
@media (max-width: 640px) {

    #mp-player,
    #mp-artists {
        display: none !important;
    }
}