/* ==========================================================================
   LAN Jukebox — shared dark theme
   Used by index.html, mobile.html and login.html
   ========================================================================== */

:root {
    --bg:            #0b0b0f;
    --bg-elev:       #14141b;
    --surface:       rgba(255, 255, 255, 0.045);
    --surface-2:     rgba(255, 255, 255, 0.075);
    --border:        rgba(255, 255, 255, 0.09);
    --border-strong: rgba(255, 255, 255, 0.18);

    --text:          #f2f2f5;
    --muted:         #9a9aa8;
    --faint:         #6b6b7a;

    --accent:        #ff2d6f;
    --accent-2:      #ff8a3d;
    --accent-soft:   rgba(255, 45, 111, 0.14);
    --ok:            #2ecc71;
    --danger:        #ff4d5e;

    --radius:        14px;
    --radius-sm:     10px;
    --shadow:        0 10px 30px rgba(0, 0, 0, 0.45);

    --font: 'Outfit', -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto,
            Helvetica, Arial, sans-serif;
}

* { box-sizing: border-box; }

html, body { height: 100%; }

body {
    margin: 0;
    font-family: var(--font);
    color: var(--text);
    background: var(--bg);
    /* Soft nightclub glow, fixed so it doesn't scroll away */
    background-image:
        radial-gradient(60rem 40rem at 12% -10%, rgba(255, 45, 111, 0.16), transparent 60%),
        radial-gradient(50rem 35rem at 95% 0%,  rgba(255, 138, 61, 0.11), transparent 55%),
        radial-gradient(45rem 45rem at 50% 115%, rgba(124, 92, 255, 0.12), transparent 60%);
    background-attachment: fixed;
    -webkit-font-smoothing: antialiased;
}

/* --- Brand ------------------------------------------------------------- */

.brand {
    display: flex;
    align-items: center;
    gap: 12px;
    min-width: 0;
}

.brand img {
    height: 26px;
    width: auto;
    display: block;
    flex-shrink: 0;
}

.brand .sep {
    width: 1px;
    height: 20px;
    background: var(--border-strong);
    flex-shrink: 0;
}

.brand .tag {
    font-size: 0.78rem;
    letter-spacing: 0.16em;
    text-transform: uppercase;
    color: var(--muted);
    font-weight: 500;
    white-space: nowrap;
}

/* --- Surfaces ---------------------------------------------------------- */

.card {
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 18px;
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
}

.card + .card { margin-top: 16px; }

.card-title {
    margin: 0 0 14px 0;
    font-size: 0.78rem;
    font-weight: 600;
    letter-spacing: 0.14em;
    text-transform: uppercase;
    color: var(--muted);
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 10px;
}

/* --- Pills ------------------------------------------------------------- */

.pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    padding: 5px 11px;
    border-radius: 999px;
    font-size: 0.75rem;
    font-weight: 600;
    letter-spacing: 0.03em;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--muted);
    white-space: nowrap;
}

.pill.host {
    color: #ffd9e4;
    border-color: rgba(255, 45, 111, 0.45);
    background: var(--accent-soft);
}

.pill.count {
    font-variant-numeric: tabular-nums;
}

/* --- Buttons ----------------------------------------------------------- */

button {
    font-family: inherit;
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text);
    background: var(--surface-2);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 11px 16px;
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease,
                transform 0.08s ease, opacity 0.15s ease;
}

button:hover:not(:disabled) {
    background: rgba(255, 255, 255, 0.12);
    border-color: rgba(255, 255, 255, 0.28);
}

button:active:not(:disabled) { transform: translateY(1px); }

button:disabled { opacity: 0.45; cursor: not-allowed; }

button:focus-visible,
input:focus-visible {
    outline: 2px solid var(--accent);
    outline-offset: 2px;
}

.btn-primary {
    background: linear-gradient(135deg, var(--accent) 0%, var(--accent-2) 100%);
    border-color: transparent;
    color: #fff;
}

.btn-primary:hover:not(:disabled) {
    background: linear-gradient(135deg, #ff4780 0%, #ff9b57 100%);
    border-color: transparent;
}

.btn-ghost {
    background: transparent;
    border-color: var(--border);
    color: var(--muted);
    font-weight: 500;
}

.btn-ghost:hover:not(:disabled) { color: var(--text); }

.btn-sm { padding: 7px 12px; font-size: 0.85rem; }

.btn-icon {
    padding: 8px 10px;
    line-height: 1;
    color: var(--muted);
}

.btn-icon:hover:not(:disabled) { color: var(--danger); border-color: var(--danger); }

/* --- Inputs ------------------------------------------------------------ */

input[type="text"],
input[type="search"],
input[type="password"] {
    font-family: inherit;
    font-size: 1rem;
    color: var(--text);
    background: rgba(0, 0, 0, 0.35);
    border: 1px solid var(--border-strong);
    border-radius: var(--radius-sm);
    padding: 12px 14px;
    width: 100%;
    transition: border-color 0.15s ease, background 0.15s ease;
}

input::placeholder { color: var(--faint); }

input:focus {
    border-color: var(--accent);
    background: rgba(0, 0, 0, 0.5);
}

/* --- Media rows (search results + queue) -------------------------------- */

.media-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.media-row {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 8px;
    border-radius: var(--radius-sm);
    border: 1px solid transparent;
    background: rgba(255, 255, 255, 0.03);
    transition: background 0.15s ease;
}

.media-row:hover { background: rgba(255, 255, 255, 0.06); }

.media-row.playing {
    border-color: rgba(255, 45, 111, 0.5);
    background: var(--accent-soft);
}

.thumb {
    width: 88px;
    height: 50px;
    flex-shrink: 0;
    border-radius: 7px;
    object-fit: cover;
    background: #000;
    border: 1px solid var(--border);
}

.media-body { flex: 1; min-width: 0; }

.media-title {
    font-size: 0.92rem;
    font-weight: 500;
    line-height: 1.35;
    /* Clamp to two lines so long titles never blow out the row */
    display: -webkit-box;
    -webkit-line-clamp: 2;
    -webkit-box-orient: vertical;
    overflow: hidden;
    word-break: break-word;
}

.media-meta {
    font-size: 0.78rem;
    color: var(--muted);
    margin-top: 3px;
    display: flex;
    align-items: center;
    gap: 7px;
    flex-wrap: wrap;
}

.media-meta .dot { color: var(--faint); }

.idx {
    width: 22px;
    flex-shrink: 0;
    text-align: center;
    font-size: 0.8rem;
    font-variant-numeric: tabular-nums;
    color: var(--faint);
    font-weight: 600;
}

/* --- Equaliser bars (now-playing indicator) ----------------------------- */

.eq {
    display: inline-flex;
    align-items: flex-end;
    gap: 2px;
    height: 12px;
    flex-shrink: 0;
}

.eq span {
    width: 3px;
    background: var(--accent);
    border-radius: 1px;
    animation: eq 0.9s ease-in-out infinite;
}

.eq span:nth-child(1) { height: 60%; animation-delay: -0.5s; }
.eq span:nth-child(2) { height: 100%; animation-delay: -0.2s; }
.eq span:nth-child(3) { height: 40%;  animation-delay: -0.7s; }

@keyframes eq {
    0%, 100% { transform: scaleY(0.4); }
    50%      { transform: scaleY(1); }
}

/* --- States ------------------------------------------------------------ */

.empty {
    text-align: center;
    color: var(--faint);
    font-size: 0.9rem;
    padding: 26px 10px;
}

.notice {
    padding: 11px 14px;
    border-radius: var(--radius-sm);
    font-size: 0.88rem;
    border: 1px solid var(--border-strong);
    background: var(--surface-2);
    color: var(--muted);
}

.notice.error {
    color: #ffd0d5;
    border-color: rgba(255, 77, 94, 0.5);
    background: rgba(255, 77, 94, 0.12);
}

.spinner {
    width: 15px;
    height: 15px;
    border: 2px solid var(--border-strong);
    border-top-color: var(--accent);
    border-radius: 50%;
    display: inline-block;
    animation: spin 0.7s linear infinite;
    vertical-align: -2px;
}

@keyframes spin { to { transform: rotate(360deg); } }

.hidden { display: none !important; }

.sr-only {
    position: absolute;
    width: 1px; height: 1px;
    padding: 0; margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* --- Scrollbars -------------------------------------------------------- */

.scroll-y { overflow-y: auto; }

.scroll-y::-webkit-scrollbar { width: 8px; }
.scroll-y::-webkit-scrollbar-track { background: transparent; }
.scroll-y::-webkit-scrollbar-thumb {
    background: var(--border-strong);
    border-radius: 4px;
}
.scroll-y::-webkit-scrollbar-thumb:hover { background: rgba(255, 255, 255, 0.3); }

/* --- Motion preferences ------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}
