/* ── Reset ──────────────────────────────────────── */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
html { font-size: 16px; }

/* ── Tokens ─────────────────────────────────────── */
:root {
    --bg:          #0f0f0f;
    --surface:     #1a1a1a;
    --surface2:    #252525;
    --border:      #333;
    --primary:     #e91e63;
    --primary-dk:  #c2185b;
    --success-bg:  #1b3a1f;
    --success-txt: #69f07a;
    --warning-bg:  #3a2e10;
    --warning-txt: #ffd54f;
    --danger-bg:   #3a1212;
    --danger-txt:  #ff6b6b;
    --text:        #f0f0f0;
    --muted:       #888;
    --radius:      10px;
    --radius-sm:   6px;
}

/* ── Base ───────────────────────────────────────── */
body {
    background: var(--bg);
    color: var(--text);
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    line-height: 1.5;
    min-height: 100dvh;
}

/* ── Buttons ────────────────────────────────────── */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: .4rem;
    padding: .65rem 1.2rem;
    border: none;
    border-radius: var(--radius-sm);
    font-size: 1rem;
    font-weight: 600;
    cursor: pointer;
    text-decoration: none;
    transition: background .15s, opacity .15s;
    white-space: nowrap;
    min-height: 44px;
}
.btn:disabled { opacity: .55; cursor: default; }
.btn-full  { width: 100%; }
.btn-lg    { font-size: 1.1rem; padding: .85rem 1.5rem; min-height: 54px; }
.btn-sm    { font-size: .85rem; padding: .4rem .85rem; min-height: 36px; }

.btn-primary { background: var(--primary); color: #fff; }
.btn-primary:hover:not(:disabled) { background: var(--primary-dk); }

.btn-ghost { background: transparent; color: var(--muted); border: 1px solid var(--border); }
.btn-ghost:hover { background: var(--surface2); color: var(--text); }

.btn-danger { background: #5c1a1a; color: var(--danger-txt); }
.btn-danger:hover:not(:disabled) { background: #7a2020; }

.btn-added  { background: var(--success-bg); color: var(--success-txt); }

/* ── Alerts ─────────────────────────────────────── */
.alert {
    padding: .75rem 1rem;
    border-radius: var(--radius-sm);
    margin: .75rem 0;
    font-size: .95rem;
}
.alert.error   { background: var(--danger-bg);  color: var(--danger-txt); }
.alert.success { background: var(--success-bg); color: var(--success-txt); }
.alert.warning { background: var(--warning-bg); color: var(--warning-txt); }

/* ── Forms ──────────────────────────────────────── */
.form-group { margin-bottom: 1rem; }
.form-group label {
    display: block;
    font-size: .85rem;
    font-weight: 600;
    color: var(--muted);
    margin-bottom: .35rem;
    text-transform: uppercase;
    letter-spacing: .04em;
}
input[type="text"],
input[type="tel"],
input[type="search"] {
    width: 100%;
    background: var(--surface2);
    border: 1px solid var(--border);
    border-radius: var(--radius-sm);
    color: var(--text);
    font-size: 1rem;
    padding: .7rem 1rem;
    min-height: 48px;
    outline: none;
    transition: border-color .15s;
}
input:focus { border-color: var(--primary); }
input::placeholder { color: var(--muted); }
/* hide native clear button on search inputs */
input[type="search"]::-webkit-search-cancel-button { display: none; }

/* ── HTMX indicator ─────────────────────────────── */
.spinner {
    display: none;
    font-size: .85rem;
    color: var(--muted);
    padding: .25rem 0;
}
.htmx-request .spinner,
.htmx-request.spinner { display: inline; }

/* ── Login page ─────────────────────────────────── */
.login-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    min-height: 100dvh;
    padding: 1.5rem;
}
.login-card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 2rem 1.75rem;
    width: 100%;
    max-width: 420px;
}
.login-header { text-align: center; margin-bottom: 1.75rem; }
.login-header h1 { font-size: 1.75rem; color: var(--primary); }
.login-header p  { color: var(--muted); margin-top: .3rem; }
.login-note { color: var(--muted); font-size: .8rem; margin-top: 1rem; text-align: center; }

/* ── App layout ─────────────────────────────────── */
.app-wrapper { display: flex; flex-direction: column; min-height: 100dvh; }

.app-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: .75rem 1rem;
    background: var(--surface);
    border-bottom: 1px solid var(--border);
    position: sticky;
    top: 0;
    z-index: 10;
    gap: .75rem;
}
.header-brand { display: flex; align-items: center; gap: .6rem; flex-wrap: wrap; }
.header-logo { height: 36px; width: auto; display: block; }
.room-badge {
    background: var(--primary);
    color: #fff;
    font-size: .7rem;
    font-weight: 700;
    padding: .2rem .55rem;
    border-radius: 99px;
    text-transform: uppercase;
    letter-spacing: .05em;
}
.header-user { display: flex; align-items: center; gap: .6rem; flex-shrink: 0; }
.user-name { color: var(--muted); font-size: .9rem; max-width: 120px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.app-main { padding: 1rem; max-width: 700px; margin: 0 auto; width: 100%; }

/* ── Guest hint ─────────────────────────────────── */
.guest-hint {
    font-size: .8rem;
    font-weight: 300;
    color: var(--muted);
    margin-bottom: 1.25rem;
    line-height: 1.5;
}
.guest-hint a { color: var(--muted); text-decoration: underline; }

/* ── Sections ───────────────────────────────────── */
.queue-section   { margin-bottom: 1.5rem; }
.search-section  { margin-bottom: 1.5rem; }
.list-section    { margin-bottom: 2rem; }

.section-title {
    font-size: 1rem;
    font-weight: 700;
    color: var(--muted);
    text-transform: uppercase;
    letter-spacing: .06em;
    margin-bottom: .6rem;
}

.search-input { margin-bottom: .25rem; }

/* ── Song items ─────────────────────────────────── */
.song-items { list-style: none; }
.song-item {
    display: grid;
    grid-template-columns: 5fr 4fr auto;
    align-items: center;
    gap: .5rem;
    padding: .65rem 0;
    border-bottom: 1px solid var(--border);
}
.song-item:last-child { border-bottom: none; }
.song-item--header { border-bottom: 1px solid var(--border); padding-bottom: .4rem; margin-bottom: .1rem; }
.song-item--header span { font-size: .75rem; font-weight: 700; color: var(--muted); text-transform: uppercase; letter-spacing: .05em; }

.col-name   { font-weight: 600; font-size: .95rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-artist { font-size: .88rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.col-action { display: flex; justify-content: flex-end; }

/* My song list keeps the old stacked layout */
.song-info { display: flex; flex-direction: column; gap: .1rem; min-width: 0; flex: 1; }
.song-name   { font-weight: 600; font-size: .95rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }
.song-artist { font-size: .82rem; color: var(--muted); white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* ── Meta text ──────────────────────────────────── */
.results-meta { font-size: .8rem; color: var(--muted); margin-bottom: .5rem; }
.no-results   { color: var(--muted); font-size: .95rem; padding: .5rem 0; }
.muted        { color: var(--muted); font-size: .9rem; }

/* ── Search row ─────────────────────────────────── */
.search-row { display: flex; gap: .5rem; align-items: center; margin-bottom: .25rem; }
.search-row .search-input { flex: 1; margin-bottom: 0; }
.btn-icon-only { width: 48px; padding: 0; flex-shrink: 0; }

/* ── List button badge ──────────────────────────── */
#fab-badge:not(:empty)::before { content: '('; }
#fab-badge:not(:empty)::after  { content: ')'; }

/* ── Modal ──────────────────────────────────────── */
.modal-overlay {
    display: none;
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,.65);
    z-index: 200;
    align-items: flex-end;
    justify-content: center;
    padding: 0;
}
.modal-overlay.open { display: flex; }

.modal {
    background: var(--surface);
    border-radius: var(--radius) var(--radius) 0 0;
    width: 100%;
    max-width: 680px;
    max-height: 80dvh;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}
.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 1rem 1.25rem;
    border-bottom: 1px solid var(--border);
    flex-shrink: 0;
}
.modal-header h3 { font-size: 1.05rem; font-weight: 700; }
.modal-close {
    background: none;
    border: none;
    color: var(--muted);
    font-size: 1.2rem;
    cursor: pointer;
    padding: .25rem .5rem;
    border-radius: var(--radius-sm);
    line-height: 1;
}
.modal-close:hover { color: var(--text); background: var(--surface2); }
.modal-body { overflow-y: auto; padding: 1rem 1.25rem; flex: 1; }

/* ── Staff result ───────────────────────────────── */
.staff-result-card { margin-top: .5rem; }
.staff-customer-name { font-size: 1.3rem; font-weight: 700; margin-bottom: .25rem; }
.staff-song-list { margin-top: .5rem; }
select.search-input { cursor: pointer; }

/* ── Song list (modal) ──────────────────────────── */
.sortable-list { list-style: none; }
.list-item {
    display: grid;
    grid-template-columns: auto 5fr 4fr auto;
    align-items: center;
    gap: .5rem;
    padding: .6rem 0;
    border-bottom: 1px solid var(--border);
}
.list-item:last-child { border-bottom: none; }
.list-item.sortable-ghost { opacity: .35; }
.list-item.sortable-chosen { background: var(--surface2); border-radius: var(--radius-sm); }

.drag-handle {
    color: var(--border);
    font-size: 1.1rem;
    cursor: grab;
    padding: 0 .2rem;
    user-select: none;
    line-height: 1;
    transition: color .15s;
}
.drag-handle:hover { color: var(--muted); }
.drag-handle:active { cursor: grabbing; }

.list-col-name   { font-weight: 600; font-size: .92rem; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.list-col-artist { font-size: .85rem; color: var(--muted); overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }

.btn-icon {
    width: 30px;
    height: 30px;
    border-radius: 50%;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 1.2rem;
    line-height: 1;
    flex-shrink: 0;
    transition: background .15s;
}
.btn-remove { background: var(--danger-bg); color: var(--danger-txt); }
.btn-remove:hover { background: #7a2020; }
