/* RESET & BASE */
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }

:root {
    --bg: #0e0e0f;
    --bg2: #161618;
    --bg3: #1e1e21;
    --border: #2a2a2e;
    --border2: #3a3a3f;
    --text: #e8e8ea;
    --text2: #9090a0;
    --text3: #5a5a6a;
    --accent: #c8f04a;
    --accent2: #a0c838;
    --danger: #f04a4a;
    --warning: #f0a84a;
    --info: #4ab8f0;
    --radius: 4px;
    --mono: 'IBM Plex Mono', monospace;
    --sans: 'IBM Plex Sans', sans-serif;
}

html, body {
    height: 100%;
    background: var(--bg);
    color: var(--text);
    font-family: var(--sans);
    font-size: 14px;
    line-height: 1.6;
    -webkit-font-smoothing: antialiased;
}

.hidden { display: none !important; }

/* LOGIN */
.login-screen {
    min-height: 100vh;
    display: flex;
    align-items: center;
    justify-content: center;
    background:
        repeating-linear-gradient(0deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px),
        repeating-linear-gradient(90deg, transparent, transparent 39px, var(--border) 39px, var(--border) 40px),
        var(--bg);
}

.login-card {
    background: var(--bg2);
    border: 1px solid var(--border2);
    padding: 48px 40px;
    width: 360px;
    position: relative;
}

.login-card::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent);
}

.login-logo {
    font-family: var(--mono);
    font-size: 28px;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--accent);
    margin-bottom: 4px;
}

.login-sub {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    letter-spacing: 0.15em;
    margin-bottom: 36px;
}

.reset-info {
    color: var(--text2);
    font-size: 13px;
    margin-bottom: 24px;
    line-height: 1.6;
}

.login-reset {
    margin-top: 16px;
    text-align: center;
}

/* FIELDS */
.field {
    margin-bottom: 20px;
}

.field label {
    display: block;
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.15em;
    color: var(--text3);
    margin-bottom: 6px;
}

input[type="text"],
input[type="password"],
input[type="email"],
select {
    width: 100%;
    background: var(--bg3);
    border: 1px solid var(--border2);
    color: var(--text);
    font-family: var(--mono);
    font-size: 13px;
    padding: 10px 12px;
    border-radius: var(--radius);
    outline: none;
    transition: border-color 0.15s;
}

input:focus, select:focus {
    border-color: var(--accent);
}

select option { background: var(--bg3); }

.search-input {
    width: 280px;
}

/* BUTTONS */
.btn-primary {
    width: 100%;
    background: var(--accent);
    color: #0e0e0f;
    border: none;
    font-family: var(--mono);
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.12em;
    padding: 12px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.15s, transform 0.1s;
}
.btn-primary:hover { background: var(--accent2); }
.btn-primary:active { transform: scale(0.98); }

.btn-secondary {
    background: transparent;
    border: 1px solid var(--accent);
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    letter-spacing: 0.1em;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: background 0.15s;
    white-space: nowrap;
}
.btn-secondary:hover { background: rgba(200, 240, 74, 0.08); }

.btn-ghost {
    background: transparent;
    border: 1px solid var(--border2);
    color: var(--text2);
    font-family: var(--mono);
    font-size: 11px;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: border-color 0.15s, color 0.15s;
}
.btn-ghost:hover { border-color: var(--border2); color: var(--text); }

.btn-danger {
    background: var(--danger);
    color: #fff;
    border: none;
    font-family: var(--mono);
    font-size: 11px;
    font-weight: 600;
    padding: 8px 16px;
    cursor: pointer;
    border-radius: var(--radius);
    transition: opacity 0.15s;
}
.btn-danger:hover { opacity: 0.85; }

.btn-link {
    background: none;
    border: none;
    color: var(--text3);
    font-family: var(--sans);
    font-size: 13px;
    cursor: pointer;
    padding: 0;
    transition: color 0.15s;
}
.btn-link:hover { color: var(--text); }

.btn-icon {
    background: none;
    border: none;
    cursor: pointer;
    padding: 6px 8px;
    border-radius: var(--radius);
    font-size: 14px;
    transition: background 0.15s;
    line-height: 1;
}
.btn-icon:hover { background: var(--bg3); }
.btn-icon.play  { color: var(--accent); }
.btn-icon.del   { color: var(--danger); }

/* ERROR / MSG */
.error-msg {
    color: var(--danger);
    font-family: var(--mono);
    font-size: 11px;
    margin-bottom: 16px;
    padding: 8px 12px;
    border: 1px solid var(--danger);
    border-radius: var(--radius);
    background: rgba(240, 74, 74, 0.06);
}

.success-msg {
    color: var(--accent);
    font-family: var(--mono);
    font-size: 11px;
    margin-bottom: 16px;
    padding: 8px 12px;
    border: 1px solid var(--accent);
    border-radius: var(--radius);
    background: rgba(200, 240, 74, 0.06);
}

/* APP SHELL */
.app {
    display: grid;
    grid-template-columns: 200px 1fr;
    min-height: 100vh;
}

/* SIDEBAR */
.sidebar {
    background: var(--bg2);
    border-right: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    padding: 0;
    position: sticky;
    top: 0;
    height: 100vh;
}

.sidebar-logo {
    font-family: var(--mono);
    font-size: 18px;
    font-weight: 600;
    letter-spacing: 0.2em;
    color: var(--accent);
    padding: 28px 24px 20px;
    border-bottom: 1px solid var(--border);
}

.nav-list {
    list-style: none;
    padding: 16px 0;
    flex: 1;
}

.nav-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 24px;
    cursor: pointer;
    color: var(--text2);
    font-size: 13px;
    font-family: var(--mono);
    letter-spacing: 0.05em;
    transition: color 0.15s, background 0.15s;
    position: relative;
}

.nav-item:hover { color: var(--text); background: var(--bg3); }
.nav-item.active { color: var(--accent); }
.nav-item.active::before {
    content: '';
    position: absolute;
    left: 0; top: 0; bottom: 0;
    width: 2px;
    background: var(--accent);
}

.nav-icon { font-size: 12px; opacity: 0.7; }

.badge {
    background: var(--warning);
    color: #0e0e0f;
    font-family: var(--mono);
    font-size: 10px;
    font-weight: 600;
    padding: 1px 6px;
    border-radius: 10px;
    margin-left: auto;
}

.sidebar-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 6px;
}

#nav-username {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    letter-spacing: 0.08em;
}

/* CONTENT */
.content {
    padding: 40px 48px;
    overflow-y: auto;
    max-height: 100vh;
}

.section { display: none; }
.section.active { display: block; }

.section-title {
    font-family: var(--mono);
    font-size: 22px;
    font-weight: 600;
    letter-spacing: 0.08em;
    color: var(--text);
    margin-bottom: 32px;
}

.subsection-title {
    font-family: var(--mono);
    font-size: 13px;
    letter-spacing: 0.1em;
    color: var(--text3);
    text-transform: uppercase;
    margin: 28px 0 14px;
}

.section-header {
    display: flex;
    align-items: center;
    gap: 16px;
    margin-bottom: 32px;
    flex-wrap: wrap;
}

.section-header .section-title { margin-bottom: 0; }
.header-actions { display: flex; gap: 12px; align-items: center; margin-left: auto; flex-wrap: wrap; }

/* STATS */
.stat-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(180px, 1fr));
    gap: 16px;
}

.stat-card {
    background: var(--bg2);
    border: 1px solid var(--border);
    padding: 24px;
    border-radius: var(--radius);
    position: relative;
    overflow: hidden;
}

.stat-card::after {
    content: '';
    position: absolute;
    bottom: 0; left: 0; right: 0;
    height: 1px;
    background: var(--accent);
    opacity: 0.3;
}

.stat-value {
    font-family: var(--mono);
    font-size: 36px;
    font-weight: 600;
    color: var(--accent);
    line-height: 1;
    margin-bottom: 8px;
}

.stat-label {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.12em;
    color: var(--text3);
    text-transform: uppercase;
}

/* SONG LIST */
.song-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 20px;
}

.song-row {
    display: grid;
    grid-template-columns: 1fr 160px 80px 80px;
    align-items: center;
    gap: 16px;
    padding: 10px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    transition: border-color 0.15s;
}

.song-row:hover { border-color: var(--border2); }

.song-row-info { min-width: 0; }

.song-title {
    font-size: 13px;
    font-weight: 500;
    color: var(--text);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-meta {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.song-id {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    text-align: right;
}

.song-identified {
    font-family: var(--mono);
    font-size: 10px;
    text-align: center;
}
.song-identified.yes { color: var(--accent); }
.song-identified.no  { color: var(--text3); }

.song-actions {
    display: flex;
    gap: 4px;
    justify-content: flex-end;
}

/* PAGINATION */
.pagination {
    display: flex;
    align-items: center;
    gap: 16px;
    justify-content: center;
    padding: 16px 0;
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text3);
}

/* USERS LIST */
.users-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
    margin-bottom: 24px;
}

.user-row {
    display: grid;
    grid-template-columns: 1fr 80px 120px auto;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.user-name {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text);
}

.user-role {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
    text-align: center;
}
.user-role.admin { color: var(--accent); border: 1px solid var(--accent); }
.user-role.user  { color: var(--text3); border: 1px solid var(--border2); }

.user-created {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
}

.user-actions { display: flex; gap: 6px; }

/* PANEL */
.panel {
    background: var(--bg2);
    border: 1px solid var(--border2);
    padding: 28px;
    margin-top: 20px;
    border-radius: var(--radius);
    max-width: 400px;
    position: relative;
}

.panel::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--accent);
}

.panel h2 {
    font-family: var(--mono);
    font-size: 14px;
    letter-spacing: 0.08em;
    margin-bottom: 20px;
    color: var(--text);
}

.panel p {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 16px;
}

.panel-actions {
    display: flex;
    gap: 10px;
    margin-top: 8px;
}

.panel-actions .btn-primary { width: auto; padding: 10px 24px; }

/* REQUESTS */
.requests-list {
    display: flex;
    flex-direction: column;
    gap: 2px;
}

.request-row {
    display: grid;
    grid-template-columns: 1fr 140px auto;
    align-items: center;
    gap: 16px;
    padding: 12px 16px;
    background: var(--bg2);
    border: 1px solid var(--border);
    border-radius: var(--radius);
}

.request-info { min-width: 0; }
.request-user {
    font-family: var(--mono);
    font-size: 13px;
    color: var(--text);
}
.request-date {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
}
.request-detail {
    font-size: 12px;
    color: var(--text2);
    margin-top: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: wrap;
}

.request-status {
    font-family: var(--mono);
    font-size: 10px;
    letter-spacing: 0.1em;
    text-transform: uppercase;
    padding: 2px 8px;
    border-radius: 10px;
    text-align: center;
    white-space: nowrap;
}
.request-status.pending  { color: var(--warning); border: 1px solid var(--warning); }
.request-status.approved { color: var(--accent);  border: 1px solid var(--accent); }
.request-status.denied   { color: var(--danger);  border: 1px solid var(--danger); }
.request-status.completed{ color: var(--info);    border: 1px solid var(--info); }

.request-actions { display: flex; gap: 6px; }

.empty-state {
    font-family: var(--mono);
    font-size: 12px;
    color: var(--text3);
    padding: 20px 16px;
    text-align: center;
    border: 1px dashed var(--border);
    border-radius: var(--radius);
}

/* SCAN OUTPUT */
.scan-output {
    background: var(--bg);
    border: 1px solid var(--border);
    border-radius: var(--radius);
    padding: 16px;
    font-family: var(--mono);
    font-size: 11px;
    color: var(--accent);
    max-height: 260px;
    overflow-y: auto;
    white-space: pre-wrap;
    word-break: break-all;
    margin-bottom: 20px;
}

/* PLAYER BAR */
.player-bar {
    position: fixed;
    bottom: 0; left: 200px; right: 0;
    background: var(--bg2);
    border-top: 1px solid var(--border2);
    padding: 12px 24px;
    display: flex;
    align-items: center;
    gap: 24px;
    z-index: 100;
}

.player-bar::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 1px;
    background: var(--accent);
}

.player-info { min-width: 0; flex: 0 0 220px; }
.player-title {
    font-size: 13px;
    font-weight: 500;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}
.player-artist {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 16px;
    flex: 1;
}

.player-btn {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 18px;
    cursor: pointer;
    padding: 4px;
    line-height: 1;
    transition: opacity 0.15s;
}
.player-btn:hover { opacity: 0.7; }

.player-seek {
    flex: 1;
    height: 3px;
    accent-color: var(--accent);
    cursor: pointer;
}

.player-time {
    font-family: var(--mono);
    font-size: 11px;
    color: var(--text3);
    white-space: nowrap;
}

.player-close {
    color: var(--text3);
    font-size: 14px;
    margin-left: auto;
}

/* MODAL */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0,0,0,0.7);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
    backdrop-filter: blur(2px);
}

.modal {
    background: var(--bg2);
    border: 1px solid var(--border2);
    padding: 32px;
    width: 360px;
    border-radius: var(--radius);
    position: relative;
}

.modal::before {
    content: '';
    position: absolute;
    top: 0; left: 0; right: 0;
    height: 2px;
    background: var(--danger);
}

.modal-title {
    font-family: var(--mono);
    font-size: 15px;
    font-weight: 600;
    margin-bottom: 12px;
}

.modal-body {
    font-size: 13px;
    color: var(--text2);
    margin-bottom: 24px;
    line-height: 1.6;
}

.modal-actions { display: flex; gap: 10px; }

@media (max-width: 768px) {
    .app {
        grid-template-columns: 1fr;
        grid-template-rows: 0fr;
    }

    .sidebar {
        height: 96px;
        position: sticky;
        top: 0;
        z-index: 1000;
        border-right: none;
        border-bottom: 1px solid var(--border);
        overflow: hidden;
    }

    .sidebar-logo {
        padding: 0 20px;
        height: 48px;
        display: flex;
        align-items: center;
        justify-content: space-between;
        flex-shrink: 0;
    }

    .sidebar-footer {
        display: none;
    }

    .nav-list {
        display: flex;
        padding: 0;
        overflow-x: auto;
        border-bottom: 1px solid var(--border);
        scrollbar-width: none;
        height: 48px;
        align-items: center;
        flex-shrink: 0;
    }

    .nav-list::-webkit-scrollbar { display: none; }

    .nav-item {
        display: flex;
        align-items: center;
        padding: 0 16px;
        white-space: nowrap;
        height: 100%;
        font-size: 12px;
        gap: 6px;
        position: relative;
        flex-shrink: 0;
    }

    .nav-item.active::before {
        content: '';
        position: absolute;
        bottom: 0;
        left: 0;
        right: 0;
        top: auto;
        width: 100%;
        height: 2px;
        background: var(--accent);
    }

    .badge {
        position: absolute;
        top: 6px;
        right: 4px;
        margin-left: 0;
    }

    .content {
        padding: 20px 16px;
        max-height: none;
        padding-bottom: 130px;
    }

    .section-title { font-size: 18px; margin-bottom: 20px; }

    .section-header {
        flex-direction: column;
        align-items: flex-start;
        gap: 12px;
        margin-bottom: 20px;
    }

    .header-actions { width: 100%; margin-left: 0; }
    .search-input { width: 100%; }

    .stat-grid { grid-template-columns: 1fr 1fr; gap: 12px; }
    .stat-card { padding: 16px; }
    .stat-value { font-size: 28px; }

    .song-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 4px 8px;
        padding: 10px 12px;
    }
    .song-row .song-row-info { grid-column: 1; grid-row: 1; }
    .song-row .song-actions  { grid-column: 2; grid-row: 1 / 3; align-self: center; }
    .song-row .song-meta:not(:first-of-type) { grid-column: 1; grid-row: 2; font-size: 10px; }
    .song-id, .song-identified { display: none; }

    .user-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 4px 8px;
        padding: 10px 12px;
    }
    .user-row .user-name    { grid-column: 1; grid-row: 1; }
    .user-row .user-actions { grid-column: 2; grid-row: 1 / 3; align-self: center; }
    .user-row .user-role    { grid-column: 1; grid-row: 2; justify-self: start; }
    .user-created { display: none; }

    .request-row {
        grid-template-columns: 1fr auto;
        grid-template-rows: auto auto;
        gap: 6px 8px;
        padding: 10px 12px;
        align-items: start;
    }
    .request-row .request-info    { grid-column: 1; grid-row: 1; }
    .request-row .request-actions { grid-column: 2; grid-row: 1 / 3; align-self: center; flex-direction: column; }
    .request-row .request-status  { grid-column: 1; grid-row: 2; justify-self: start; }
    .request-detail { white-space: normal; font-size: 11px; }
    .request-actions { gap: 4px; }
    .btn-secondary, .btn-ghost { font-size: 10px; padding: 6px 10px; }

    .player-bar {
        left: 0;
        padding: 10px 14px;
        gap: 10px;
    }
    .player-info {
        flex: 1 1 100%;
        margin-bottom: -6px;
    }
    .player-controls { width: 100%; }
    .player-time { display: none; }

    .panel { max-width: 100%; }

    .modal { width: calc(100vw - 32px); padding: 24px 20px; }
}