:root {
    --bg: #0f0f14;
    --bg-card: #1a1a24;
    --bg-sidebar: #12121a;
    --text: #f0f0f5;
    --text-muted: #9898a8;
    --primary: #7c5cfc;
    --primary-hover: #6a4ae8;
    --success: #22c55e;
    --success-hover: #16a34a;
    --danger: #ef4444;
    --danger-hover: #dc2626;
    --border: #2a2a38;
    --radius: 12px;
    --font: 'Segoe UI', system-ui, -apple-system, sans-serif;
}

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

body {
    font-family: var(--font);
    background: var(--bg);
    color: var(--text);
    min-height: 100vh;
    line-height: 1.5;
}

/* User page */
.page-user {
    background: radial-gradient(ellipse at top, #1a1030 0%, var(--bg) 60%);
}

.container {
    max-width: 480px;
    margin: 0 auto;
    padding: 2rem 1rem 3rem;
}

.header {
    text-align: center;
    margin-bottom: 2rem;
}

.logo {
    font-size: 3rem;
    margin-bottom: 0.5rem;
}

.header h1 {
    font-size: 2rem;
    font-weight: 700;
    letter-spacing: -0.02em;
}

.subtitle {
    color: var(--text-muted);
    margin-top: 0.25rem;
}

/* Cards */
.card {
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 1.5rem;
    margin-bottom: 1.5rem;
}

.card-narrow {
    max-width: 480px;
}

/* Forms */
.form-group,
form > div {
    margin-bottom: 1rem;
}

label {
    display: block;
    font-size: 0.875rem;
    font-weight: 500;
    margin-bottom: 0.375rem;
    color: var(--text-muted);
}

input[type="text"],
input[type="email"],
input[type="password"],
select,
textarea {
    width: 100%;
    padding: 0.75rem 1rem;
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: 8px;
    color: var(--text);
    font-size: 1rem;
    font-family: inherit;
    transition: border-color 0.2s;
}

input:focus,
select:focus,
textarea:focus {
    outline: none;
    border-color: var(--primary);
}

.form-error,
.invalid-feedback,
ul.form-errors li {
    color: var(--danger);
    font-size: 0.8125rem;
    margin-top: 0.25rem;
    list-style: none;
}

.form-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    margin-top: 1.5rem;
}

/* Buttons */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0.625rem 1.25rem;
    border: none;
    border-radius: 8px;
    font-size: 0.9375rem;
    font-weight: 600;
    font-family: inherit;
    cursor: pointer;
    text-decoration: none;
    transition: background 0.2s, transform 0.1s;
}

.btn:active {
    transform: scale(0.98);
}

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

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

.btn-secondary {
    background: var(--border);
    color: var(--text);
}

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

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

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

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

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

.btn-block {
    width: 100%;
}

.btn-sm {
    padding: 0.375rem 0.75rem;
    font-size: 0.8125rem;
}

/* Flash messages */
.flash {
    padding: 0.875rem 1rem;
    border-radius: 8px;
    margin-bottom: 1rem;
    font-size: 0.9375rem;
}

.flash-success {
    background: rgba(34, 197, 94, 0.15);
    border: 1px solid rgba(34, 197, 94, 0.3);
    color: #86efac;
}

.flash-error {
    background: rgba(239, 68, 68, 0.15);
    border: 1px solid rgba(239, 68, 68, 0.3);
    color: #fca5a5;
}

/* Queue preview (user) */
.queue-preview h2 {
    font-size: 1rem;
    color: var(--text-muted);
    margin-bottom: 1rem;
    text-transform: uppercase;
    letter-spacing: 0.05em;
}

.queue-list {
    list-style: none;
    counter-reset: queue;
}

.queue-list li {
    counter-increment: queue;
    padding: 0.75rem 0;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-wrap: wrap;
    gap: 0.25rem;
}

.queue-list li:last-child {
    border-bottom: none;
}

.queue-list li::before {
    content: counter(queue) ".";
    color: var(--primary);
    font-weight: 700;
    margin-right: 0.5rem;
}

.queue-requester {
    color: var(--text-muted);
}

/* Admin layout */
.admin-layout {
    display: flex;
    min-height: 100vh;
}

.sidebar {
    width: 240px;
    background: var(--bg-sidebar);
    border-right: 1px solid var(--border);
    padding: 1.5rem 1rem;
    display: flex;
    flex-direction: column;
    flex-shrink: 0;
}

.sidebar-brand {
    font-size: 1.25rem;
    font-weight: 700;
    padding: 0 0.5rem 1.5rem;
    border-bottom: 1px solid var(--border);
    margin-bottom: 1rem;
}

.sidebar nav {
    display: flex;
    flex-direction: column;
    gap: 0.25rem;
    flex: 1;
}

.nav-link {
    display: block;
    padding: 0.625rem 0.75rem;
    border-radius: 8px;
    color: var(--text-muted);
    text-decoration: none;
    font-size: 0.9375rem;
    transition: background 0.2s, color 0.2s;
}

.nav-link:hover,
.nav-link.active {
    background: rgba(124, 92, 252, 0.15);
    color: var(--text);
}

.nav-link.logout {
    margin-top: auto;
    color: var(--danger);
}

.admin-content {
    flex: 1;
    padding: 2rem;
    overflow-y: auto;
}

.admin-content h1 {
    font-size: 1.75rem;
    margin-bottom: 0.25rem;
}

.page-desc {
    color: var(--text-muted);
    margin-bottom: 2rem;
}

.page-header {
    display: flex;
    justify-content: space-between;
    align-items: flex-start;
    margin-bottom: 2rem;
}

.page-header h1 {
    margin-bottom: 0.25rem;
}

.page-header .page-desc {
    margin-bottom: 0;
}

/* Queue table (admin) */
.queue-item,
.song-item {
    display: flex;
    align-items: center;
    gap: 1rem;
    padding: 1rem 1.25rem;
    background: var(--bg-card);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    margin-bottom: 0.75rem;
}

.queue-position {
    font-size: 1.25rem;
    font-weight: 700;
    color: var(--primary);
    min-width: 2.5rem;
}

.queue-info,
.song-info {
    flex: 1;
}

.queue-info strong,
.song-info strong {
    display: block;
    font-size: 1rem;
}

.meta {
    font-size: 0.8125rem;
    color: var(--text-muted);
}

.queue-actions,
.song-actions {
    display: flex;
    gap: 0.5rem;
    flex-shrink: 0;
}

.song-item.inactive {
    opacity: 0.5;
}

.badge {
    display: inline-block;
    padding: 0.125rem 0.5rem;
    border-radius: 4px;
    font-size: 0.75rem;
    font-weight: 600;
    margin-left: 0.5rem;
}

.badge-muted {
    background: var(--border);
    color: var(--text-muted);
}

.empty-state {
    text-align: center;
    padding: 3rem;
    color: var(--text-muted);
}

.empty-state .btn {
    margin-top: 1rem;
}

/* QR Code */
.qrcode-card {
    text-align: center;
    max-width: 400px;
}

.qrcode-image {
    width: 280px;
    height: 280px;
    border-radius: 8px;
    margin-bottom: 1rem;
}

.qrcode-url {
    font-size: 0.8125rem;
    color: var(--text-muted);
    word-break: break-all;
    margin-bottom: 1rem;
}

/* Login */
.page-login {
    display: flex;
    align-items: center;
    justify-content: center;
    background: radial-gradient(ellipse at center, #1a1030 0%, var(--bg) 70%);
}

.login-container {
    width: 100%;
    max-width: 400px;
    padding: 1rem;
}

.login-container .logo {
    text-align: center;
    font-size: 2.5rem;
}

.login-container h1 {
    text-align: center;
    margin-bottom: 1.5rem;
}

@media (max-width: 768px) {
    .admin-layout {
        flex-direction: column;
    }

    .sidebar {
        width: 100%;
        flex-direction: row;
        flex-wrap: wrap;
        align-items: center;
        padding: 1rem;
    }

    .sidebar-brand {
        border-bottom: none;
        margin-bottom: 0;
        padding-bottom: 0;
    }

    .sidebar nav {
        flex-direction: row;
        flex-wrap: wrap;
    }

    .nav-link.logout {
        margin-top: 0;
    }

    .queue-item,
    .song-item {
        flex-wrap: wrap;
    }

    .queue-actions,
    .song-actions {
        width: 100%;
        justify-content: flex-end;
    }
}
