/* ── Reset ───────────────────────────────────────────────────────────────── */

*, *::before, *::after {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

/* ── Variables ───────────────────────────────────────────────────────────── */

:root {
    --black:      #0a0a0a;
    --dark:       #1a1a1a;
    --mid:        #2a2a2a;
    --pink:       #ff2d78;
    --pink-light: #ff6fa8;
    --white:      #f0f0f0;
    --grey:       #888;
    --error:      #ff4444;
    --success:    #44cc44;
    --font:       'Courier New', Courier, monospace;
}

/* ── Base ────────────────────────────────────────────────────────────────── */

html, body {
    height: 100%;
}

body {
    background-color: var(--black);
    color:            var(--white);
    font-family:      var(--font);
    font-size:        16px;
    line-height:      1.6;
    display:          flex;
    flex-direction:   column;
    min-height:       100vh;
}

a {
    color:           var(--pink);
    text-decoration: none;
}

a:hover {
    color:           var(--pink-light);
    text-decoration: underline;
}

h1 { font-size: 2rem;   margin-bottom: 1rem; color: var(--pink); }
h2 { font-size: 1.4rem; margin-bottom: 0.75rem; color: var(--pink-light); }

/* ── Header ──────────────────────────────────────────────────────────────── */

.site-header {
    background-color: var(--dark);
    border-bottom:    2px solid var(--pink);
    padding:          0.75rem 1.5rem;
    display:          flex;
    align-items:      center;
    justify-content:  space-between;
}

.site-name {
    font-size:   1.25rem;
    font-weight: bold;
    color:       var(--pink);
}

.site-name:hover {
    color:           var(--pink-light);
    text-decoration: none;
}

.site-nav {
    display: flex;
    gap:     1.5rem;
    align-items: center;
}

.nav-user {
    color: var(--grey);
}

/* ── Main ────────────────────────────────────────────────────────────────── */

.site-main {
    flex:    1;
    padding: 2rem 1.5rem;
    max-width: 900px;
    width: 100%;
    margin: 0 auto;
}

/* ── Footer ──────────────────────────────────────────────────────────────── */

.site-footer {
    background-color: var(--dark);
    border-top:       1px solid var(--mid);
    padding:          0.75rem 1.5rem;
    text-align:       center;
    color:            var(--grey);
    font-size:        0.85rem;
}

/* ── Forms ───────────────────────────────────────────────────────────────── */

.form-page {
    max-width: 400px;
}

.form-page h1 {
    margin-bottom: 1.5rem;
}

form {
    display:        flex;
    flex-direction: column;
    gap:            0.75rem;
}

label {
    font-size: 0.9rem;
    color:     var(--pink-light);
}

input[type="text"],
input[type="email"],
input[type="password"] {
    background-color: var(--dark);
    border:           1px solid var(--mid);
    color:            var(--white);
    font-family:      var(--font);
    font-size:        1rem;
    padding:          0.5rem 0.75rem;
    width:            100%;
}

input[type="text"]:focus,
input[type="email"]:focus,
input[type="password"]:focus {
    outline:      none;
    border-color: var(--pink);
}

button, .btn {
    background-color: var(--pink);
    border:           none;
    color:            var(--black);
    cursor:           pointer;
    font-family:      var(--font);
    font-size:        1rem;
    font-weight:      bold;
    padding:          0.5rem 1rem;
}

button:hover, .btn:hover {
    background-color: var(--pink-light);
}

button.btn-danger, .btn-danger {
    background-color: #cc0000;
    color:            var(--white);
}

button.btn-danger:hover, .btn-danger:hover {
    background-color: #ff2222;
}


    background-color: var(--dark);
    border:           1px solid var(--mid);
    color:            var(--white);
    font-family:      var(--font);
    font-size:        0.9rem;
    padding:          0.25rem 0.5rem;
}

/* ── Messages ────────────────────────────────────────────────────────────── */

.error {
    color:         var(--error);
    border-left:   3px solid var(--error);
    padding-left:  0.75rem;
    margin-bottom: 1rem;
}

.success {
    color:         var(--success);
    border-left:   3px solid var(--success);
    padding-left:  0.75rem;
    margin-bottom: 1rem;
}

/* ── Player ──────────────────────────────────────────────────────────────── */

.player {
    display:        flex;
    flex-direction: column;
    gap:            2rem;
}

.now-playing {
    display:   flex;
    gap:       2rem;
    align-items: flex-start;
}

.album-art-wrap {
    flex-shrink: 0;
    width:       220px;
    height:      220px;
    position:    relative;
}

.album-art {
    width:      220px;
    height:     220px;
    object-fit: cover;
    display:    block;
    border:     2px solid var(--pink);
}

.album-art-placeholder {
    width:            220px;
    height:           220px;
    background-color: var(--dark);
    border:           2px solid var(--mid);
    display:          flex;
    align-items:      center;
    justify-content:  center;
    font-size:        5rem;
    color:            var(--mid);
}

.album-art-error {
    position:         absolute;
    bottom:           4px;
    right:            4px;
    width:            18px;
    height:           18px;
    background-color: var(--dark);
    border:           1px solid var(--mid);
    border-radius:    50%;
    font-size:        11px;
    line-height:      18px;
    text-align:       center;
    color:            var(--mid);
    cursor:           help;
}

.album-art-error::after {
    content: '?';
}

.now-playing-info {
    flex: 1;
    padding-top: 0.5rem;
}

.now-playing-label {
    font-size:      0.85rem;
    color:          var(--grey);
    text-transform: uppercase;
    letter-spacing: 0.1em;
    margin-bottom:  0.5rem;
}

.track-title {
    font-size:     2rem;
    color:         var(--pink);
    margin-bottom: 0.25rem;
}

.track-artist {
    font-size:     1.2rem;
    color:         var(--white);
    margin-bottom: 0.25rem;
}

.track-album {
    color: var(--grey);
}

/* ── Tables ──────────────────────────────────────────────────────────────── */

.data-table {
    width:           100%;
    border-collapse: collapse;
    margin-bottom:   1.5rem;
    font-size:       0.95rem;
}

.data-table th,
.data-table td {
    text-align: left;
    padding:    0.5rem 0.75rem;
    border-bottom: 1px solid var(--mid);
}

.data-table th {
    color:            var(--pink-light);
    border-bottom:    2px solid var(--pink);
}

.data-table tr:hover td {
    background-color: var(--dark);
}

.queue-current td {
    background-color: var(--mid);
    color:            var(--pink);
}

code {
    background-color: var(--dark);
    color:            var(--pink-light);
    padding:          0.1rem 0.4rem;
    font-family:      var(--font);
    font-size:        0.85rem;
    word-break:       break-all;
}

/* ── Admin ───────────────────────────────────────────────────────────────── */

.admin-nav {
    display:       flex;
    gap:           1rem;
    margin-bottom: 2rem;
    border-bottom: 1px solid var(--mid);
    padding-bottom: 1rem;
}

.playback-controls {
    display:       flex;
    gap:           0.5rem;
    margin-bottom: 1.5rem;
    flex-wrap:     wrap;
    align-items:   center;
}

.control-btn {
    font-size: 1.1rem;
    padding:   0.4rem 0.8rem;
}

.now-playing-admin {
    background-color: var(--dark);
    border-left:      3px solid var(--pink);
    padding:          0.75rem 1rem;
    margin-bottom:    1.5rem;
}

.inline-form {
    flex-direction: row;
    align-items:    center;
    gap:            0.5rem;
    margin-bottom:  1.5rem;
}

.inline-form input {
    width: auto;
    flex:  1;
}

/* ── Error pages ─────────────────────────────────────────────────────────── */

.error-page h1 {
    font-size:     5rem;
    margin-bottom: 0.5rem;
}

.error-page p {
    color:         var(--grey);
    margin-bottom: 1rem;
}

/* ── Custom player bar ───────────────────────────────────────────────────── */

.player-bar {
    background-color: var(--dark);
    border-top:       2px solid var(--pink);
    display:          flex;
    align-items:      center;
    gap:              1.5rem;
    padding:          0.75rem 1.5rem;
    z-index:          100;
}

/* Fixed version — listener page, always visible at bottom of viewport */
.player-bar:not(.player-bar--sticky) {
    position: fixed;
    bottom:   0;
    left:     0;
    right:    0;
}

/* Sticky version — admin queue page, sticks to top of scroll area */
.player-bar--sticky {
    position:  sticky;
    top:       0;
    margin-bottom: 1.5rem;
}

.player-bar-left {
    flex-shrink: 0;
}

.player-bar-center {
    flex:        1;
    overflow:    hidden;
    white-space: nowrap;
    text-overflow: ellipsis;
}

.player-bar-title {
    color:       var(--pink);
    font-weight: bold;
    margin-right: 0.5rem;
}

.player-bar-artist {
    color:     var(--grey);
    font-size: 0.9rem;
}

.player-bar-right {
    display:     flex;
    align-items: center;
    gap:         0.75rem;
    flex-shrink: 0;
}

.player-btn {
    background:  none;
    border:      2px solid var(--pink);
    color:       var(--pink);
    cursor:      pointer;
    font-size:   1.1rem;
    padding:     0.3rem 0.6rem;
    line-height: 1;
    font-family: var(--font);
}

.player-btn:hover {
    background-color: var(--pink);
    color:            var(--black);
}

.volume-slider {
    -webkit-appearance: none;
    appearance:         none;
    width:              100px;
    height:             4px;
    background:         var(--mid);
    outline:            none;
    cursor:             pointer;
}

.volume-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance:         none;
    width:              14px;
    height:             14px;
    background:         var(--pink);
    cursor:             pointer;
    border-radius:      0;
}

.volume-slider::-moz-range-thumb {
    width:        14px;
    height:       14px;
    background:   var(--pink);
    cursor:       pointer;
    border:       none;
    border-radius: 0;
}

/* Push listener page content above the fixed bar */
body:has(.player-bar:not(.player-bar--sticky)) .site-main {
    padding-bottom: 5rem;
}

/* ── Library browser ─────────────────────────────────────────────────────── */

.library-heading {
    margin-top:    2.5rem;
    padding-top:   1.5rem;
    border-top:    1px solid var(--mid);
}

.library-search {
    margin-bottom: 1rem;
}

.library-tabs {
    display:       flex;
    gap:           0;
    margin-bottom: 1.5rem;
    border-bottom: 2px solid var(--pink);
}

.library-tabs a {
    padding:          0.4rem 1rem;
    color:            var(--grey);
    text-decoration:  none;
    border:           1px solid var(--mid);
    border-bottom:    none;
    margin-right:     4px;
}

.library-tabs a:hover {
    color: var(--pink-light);
}

.library-tabs a.active {
    color:            var(--pink);
    background-color: var(--dark);
    border-color:     var(--pink);
}

.library-meta {
    color:         var(--grey);
    font-size:     0.9rem;
    margin-bottom: 1rem;
}

/* ── Dashboard status ────────────────────────────────────────────────────── */

.dashboard-status {
    margin-top: 1.5rem;
}

/* ── Small button variant ────────────────────────────────────────────────── */

.btn-sm {
    font-size: 0.8rem;
    padding:   0.25rem 0.6rem;
}

/* ── Secondary button ────────────────────────────────────────────────────── */

.btn-secondary {
    background-color: var(--mid);
    color:            var(--white);
}

.btn-secondary:hover {
    background-color: #3a3a3a;
}

/* ── Table cell with multiple inline actions ─────────────────────────────── */

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

/* ── Inline form (fits inside table cells) ───────────────────────────────── */

.form-inline {
    display:        flex;
    flex-direction: row;
    gap:            0;
    margin:         0;
}

/* ── Add-all bar above library song list ─────────────────────────────────── */

.add-all-bar {
    display:       flex;
    align-items:   center;
    gap:           1rem;
    margin-bottom: 1rem;
}

/* ── Text colour helpers ─────────────────────────────────────────────────── */

.text-grey {
    color: var(--grey);
}

/* ── Schedule: drag-and-drop calendar layout ─────────────────────────────── */

.sched-layout {
    display:     flex;
    gap:         1.5rem;
    align-items: flex-start;
}

/* ── Sidebar ─────────────────────────────────────────────────────────────── */

.sched-sidebar {
    width:      200px;
    flex-shrink: 0;
}

.sched-sidebar h2 {
    margin-bottom: 0.75rem;
}

.playlist-drag-item {
    background-color: var(--dark);
    border:           1px solid var(--mid);
    border-left:      3px solid var(--pink);
    padding:          0.6rem 0.75rem;
    margin-bottom:    0.6rem;
    cursor:           grab;
    user-select:      none;
}

.playlist-drag-item:active,
.playlist-drag-item.dragging {
    cursor:  grabbing;
    opacity: 0.5;
}

.playlist-drag-item-name {
    font-size:     0.9rem;
    font-weight:   bold;
    margin-bottom: 0.15rem;
    white-space:   nowrap;
    overflow:      hidden;
    text-overflow: ellipsis;
}

.playlist-drag-item-meta {
    font-size: 0.75rem;
    color:     var(--grey);
}

.playlist-drag-item-loop {
    display:     flex;
    align-items: center;
    gap:         0.35rem;
    font-size:   0.75rem;
    color:       var(--pink-light);
    margin-top:  0.4rem;
    cursor:      pointer;
}

/* ── Calendar outer wrapper ──────────────────────────────────────────────── */

.sched-calendar-outer {
    flex:       1;
    overflow-x: auto;
    min-width:  0;
}

.sched-calendar-scroll {
    max-height: 600px;
    overflow-y: auto;
    overflow-x: hidden;
}

/* ── Calendar grid ───────────────────────────────────────────────────────── */

.sched-calendar {
    display:    flex;
    min-width:  560px;
}

/* Time gutter */
.time-gutter {
    width:       44px;
    flex-shrink: 0;
}

.time-gutter-body {
    height:   1440px;
    position: relative;
}

.time-label {
    position:   absolute;
    right:      4px;
    font-size:  0.65rem;
    color:      var(--grey);
    transform:  translateY(-0.55em);
    white-space: nowrap;
    pointer-events: none;
}

/* Day columns */
.cal-col {
    flex:        1;
    min-width:   70px;
    border-left: 1px solid var(--mid);
}

.cal-col-header {
    height:          28px;
    display:         flex;
    align-items:     center;
    justify-content: center;
    font-size:       0.78rem;
    font-weight:     bold;
    color:           var(--pink-light);
    background-color: var(--dark);
    border-bottom:   2px solid var(--pink);
    position:        sticky;
    top:             0;
    z-index:         20;
}

.cal-col-header--today {
    color:            var(--pink);
    background-color: rgba(255, 45, 120, 0.08);
}

/* The droppable body of each column */
.cal-col-body {
    height:   1440px;
    position: relative;
    cursor:   crosshair;
    transition: background-color 0.1s;
}

.cal-col-body.drag-over {
    background-color: rgba(255, 45, 120, 0.06);
}

/* Horizontal hour lines */
.hour-line {
    position:   absolute;
    left:       0;
    right:      0;
    height:     1px;
    background: var(--mid);
    pointer-events: none;
}

/* Stronger line every 6 hours */
.hour-line:nth-child(6n+1) {
    background: #3a3a3a;
}

/* ── Drop preview ghost ──────────────────────────────────────────────────── */

.drop-preview {
    position:        absolute;
    left:            2px;
    right:           2px;
    background-color: rgba(255, 45, 120, 0.2);
    border:          2px dashed var(--pink);
    border-radius:   2px;
    pointer-events:  none;
    z-index:         5;
    display:         none;
}

/* ── Schedule blocks ─────────────────────────────────────────────────────── */

.sched-block {
    position:         absolute;
    left:             2px;
    right:            2px;
    background-color: var(--pink);
    color:            var(--black);
    padding:          3px 5px;
    font-size:        0.72rem;
    overflow:         hidden;
    cursor:           grab;
    border-radius:    2px;
    z-index:          10;
    box-sizing:       border-box;
}

.sched-block:active {
    cursor: grabbing;
}

/* Loop-all-day blocks get a diagonal stripe pattern */
.sched-block--loop {
    background: repeating-linear-gradient(
        45deg,
        var(--pink),
        var(--pink)  8px,
        #c01a5a      8px,
        #c01a5a     16px
    );
}

.sched-block--inactive {
    opacity: 0.4;
}

.sched-block-name {
    font-weight:   bold;
    white-space:   nowrap;
    overflow:      hidden;
    text-overflow: ellipsis;
    padding-right: 32px; /* leave room for buttons */
}

.sched-block-dur {
    font-size: 0.65rem;
    opacity:   0.85;
}

/* Action buttons overlaid top-right of block */
.sched-block-btns {
    position: absolute;
    top:      2px;
    right:    2px;
    display:  flex;
    gap:      2px;
}

.sched-block-btns button {
    background:  rgba(0, 0, 0, 0.35);
    border:      none;
    color:       white;
    cursor:      pointer;
    padding:     1px 4px;
    font-size:   0.65rem;
    font-family: var(--font);
    line-height: 1.5;
}

.sched-block-btns button:hover {
    background: rgba(0, 0, 0, 0.6);
}

.sched-row-inactive td {
    opacity: 0.6;
}

/* ── Status badges ───────────────────────────────────────────────────────── */

.status-active {
    color: var(--success);
}

.status-inactive {
    color: var(--grey);
}

/* ── Playlist header ─────────────────────────────────────────────────────── */

.playlist-header h2 {
    margin-bottom: 0.5rem;
}
