/* --- GLOBAL, LAYOUT, & TEMPLATE98 BASE --- */
* { box-sizing: border-box; }
html, body { margin: 0; padding: 0; height: 100%; font-family: "Pixelated MS Sans Serif", Arial, sans-serif; font-size: 11px; }
body { background-color: #008080; display: flex; align-items: center; justify-content: center; }

.main-window { width: 85vw; height: 85vh; display: flex; flex-direction: column; }
.main-window .window-body { flex-grow: 1; display: flex; flex-direction: column; overflow: hidden; }
.title-bar-text { display: flex; align-items: center; gap: 4px; }
button { max-width: 15%; }

/* --- TWO-PANE CONTENT LAYOUT --- */
.window-content-layout { flex-grow: 1; display: flex; overflow: hidden; }
.left-pane { width: 280px; background: var(--surface); padding: 10px; flex-shrink: 0; overflow-y: auto; border-right: 1px solid #848584; }
.main-content { margin: 10px; flex-grow: 1; background: #fff; overflow-y: auto; }

/* --- PLAYER-SPECIFIC STYLES --- */
#album-art-container { width: 100%; height: auto; padding-bottom: 100%; position: relative; margin-bottom: 10px; background: #808080; cursor: pointer; }
#album-art { position: absolute; top: 0; left: 0; width: 100%; height: 100%; object-fit: cover; }
#track-info p { margin: 0 0 5px 0; word-break: break-all; } /* Added word-break */
#progress-container { cursor: pointer; }
.time-info { display: flex; justify-content: space-between; font-size: 11px; padding: 2px; }

.player-top-row { display: flex; justify-content: space-between; align-items: flex-start; gap: 10px; }
#track-info { flex-grow: 1; }
/* ISSUE 2 FIX: Ensure perfect vertical alignment for volume controls */
.volume-control { display: flex; align-items: center; gap: 5px; }
#volume-slider { margin: 0; } /* Remove default margins for better alignment */
#volume-icon { cursor: pointer; width: 16px; height: 16px; }


.all-controls { display: flex; flex-wrap: wrap; justify-content: center; gap: 5px; margin-top: 10px; }
.all-controls button { width: 32px; height: 32px; padding: 0; display: flex; align-items: center; justify-content: center; position: relative; }
.all-controls button img { height: 16px; width: 16px; pointer-events: none; }
#stop-btn { background: #c00; color: white; text-shadow: 1px 1px #800000; }
#stop-btn:active { background: #a00; }

#repeat-btn::after { content: ''; position: absolute; top: 2px; right: 3px; font-size: 9px; font-weight: bold; color: #000; }
#repeat-btn.repeat-one::after { content: '1'; }
#repeat-btn.repeat-all::after { content: 'A'; }

/* --- PLAYLIST-SPECIFIC STYLES --- */
#playlist-table { width: 100%; border-collapse: collapse; table-layout: fixed; }
#playlist-table th { cursor: pointer; user-select: none; }
#playlist-table th, #playlist-table td { padding: 3px 5px; text-align: left; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } 
#playlist-table thead { background-color: #c0c0c0; position: sticky; top: 0; }
#playlist-table tbody tr { cursor: pointer; }
#playlist-table tbody tr.highlighted td { background-color: var(--dialog-blue); color: #fff; }

/* --- MODAL STYLES --- */
/* ISSUE 3 FIX: Improved modal styling for mobile and content */
.modal { display: none; position: fixed; top: 50%; left: 50%; transform: translate(-50%, -50%); z-index: 2000; width: 350px; max-width: 90vw; }
#album-art-modal { width: auto; max-width: 500px; }
#album-art-modal-img { display: block; max-width: 100%; height: auto; image-rendering: pixelated; image-rendering: -moz-crisp-edges; image-rendering: crisp-edges; margin-bottom: 10px; }
#album-art-modal-info { text-align: center; }

/* --- STATUS BAR --- */
.status-bar { display: flex; justify-content: space-between; }
.status-bar-field { padding: 1px 3px; margin: 1px; border: 1px solid #848584; box-shadow: inset 1px 1px #dfdfdf, inset -1px -1px #fff; }
.status-bar-field:first-child { flex-grow: 1; width: 75%; }

/* --- MOBILE FULLSCREEN APP EXPERIENCE --- */
@media (max-width: 768px) {
    body { background: var(--surface); display: block; }
    .main-window { width: 100vw; height: 100vh; margin: 0; border: none; box-shadow: none; }
    .window-content-layout { flex-direction: column; }
    .left-pane { width: auto; border-right: none; border-bottom: 1px solid #848584; }
    .main-content { flex-grow: 1; }
    
    .mobile-player-layout { display: flex; gap: 10px; }
    #album-art-container { width: 100px; height: 100px; padding-bottom: 0; position: static; flex-shrink: 0; }
    #album-art { position: static; }
    .player-column-mobile { flex-grow: 1; }
    .all-controls { justify-content: space-around; }
    .all-controls button { min-width: 15%; }

    #playlist-table th:nth-child(1), #playlist-table td:nth-child(1),
    /* #playlist-table th:nth-child(4), #playlist-table td:nth-child(4), */
    #playlist-table th:nth-child(5), #playlist-table td:nth-child(5) {
        display: none;
    }
}