:root {
    --bg: #f5f6f8;
    --panel: #ffffff;
    --border: #dfe2e6;
    --text: #1f2430;
    --muted: #6b7280;
    --accent: #2f6fed;
    --accent-dark: #1f4fb8;
    --danger: #d64545;
    --danger-dark: #b03434;
    --dup: #f59e0b;
}

* {
    box-sizing: border-box;
}

body {
    margin: 0;
    font-family: "Segoe UI", system-ui, -apple-system, sans-serif;
    background: var(--bg);
    color: var(--text);
}

.topbar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 24px;
    background: var(--panel);
    border-bottom: 1px solid var(--border);
}

    .topbar h1 {
        font-size: 18px;
        margin: 0;
    }

.stats-badge {
    background: #eef2ff;
    color: var(--accent-dark);
    padding: 6px 12px;
    border-radius: 999px;
    font-size: 13px;
    font-weight: 600;
}

.import-panel {
    margin: 16px 24px;
    padding: 16px 20px;
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
}

    .import-panel h2 {
        margin-top: 0;
        font-size: 15px;
    }

.hint {
    color: var(--muted);
    font-size: 13px;
    line-height: 1.5;
}

    .hint code {
        background: #f0f1f3;
        padding: 1px 5px;
        border-radius: 4px;
    }

.file-row {
    display: flex;
    gap: 24px;
    flex-wrap: wrap;
    margin: 10px 0;
}

    .file-row label {
        display: flex;
        flex-direction: column;
        gap: 6px;
        font-size: 13px;
        font-weight: 600;
    }

.checkbox-row {
    display: flex;
    align-items: center;
    gap: 8px;
    font-size: 14px;
    font-weight: 400;
    margin: 8px 0;
}

    .checkbox-row.small {
        font-size: 13px;
        margin: 0;
    }

button {
    cursor: pointer;
    border: 1px solid var(--border);
    background: #fff;
    padding: 8px 14px;
    border-radius: 6px;
    font-size: 13px;
    font-weight: 600;
    color: var(--text);
}

    button:hover:not(:disabled) {
        border-color: var(--accent);
        color: var(--accent-dark);
    }

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

    button.primary {
        background: var(--accent);
        border-color: var(--accent);
        color: #fff;
    }

        button.primary:hover {
            background: var(--accent-dark);
        }

    button.danger {
        color: var(--danger);
        border-color: var(--danger);
        background: #fff;
    }

        button.danger:hover {
            background: var(--danger);
            color: #fff;
        }

    button.small {
        padding: 6px 10px;
        font-size: 12px;
    }

#importForm {
    display: flex;
    flex-direction: column;
    align-items: flex-start;
}

.status {
    margin-left: 12px;
    font-size: 13px;
    color: var(--muted);
}

.warnings {
    margin-top: 8px;
    font-size: 12px;
    color: #92620a;
    max-height: 80px;
    overflow-y: auto;
}

/* WORKSPACE LAYOUT ADJUSTMENTS */
.workspace {
    display: grid;
    grid-template-columns: 380px 1fr;
    gap: 18px;
    margin: 0 24px 24px;
    align-items: start; /* Keeps items from stretching so sticky works */
}

.list-pane {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    display: flex;
    flex-direction: column;
    overflow: hidden;
    /* Keep the list pane from growing the whole page; allow internal scrolling */
    max-height: calc(100vh - 140px);
}

.toolbar {
    padding: 12px;
    border-bottom: 1px solid var(--border);
    display: flex;
    flex-direction: column;
    gap: 8px;
    flex-shrink: 0;
}

    .toolbar input[type="text"] {
        padding: 8px 10px;
        border: 1px solid var(--border);
        border-radius: 6px;
        font-size: 13px;
    }

.bulk-toolbar {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    border-bottom: 1px solid var(--border);
    flex-wrap: wrap;
    font-size: 12px;
    flex-shrink: 0;
}

.muted {
    color: var(--muted);
    font-size: 12px;
}

.song-list {
    list-style: none;
    margin: 0;
    padding: 0;
    /* Let the list take remaining space inside .list-pane and scroll independently */
    flex: 1 1 auto;
    overflow-y: auto;
}

    .song-list li {
        display: flex;
        gap: 10px;
        align-items: flex-start;
        padding: 10px 12px;
        border-bottom: 1px solid #f0f1f3;
        cursor: pointer;
    }

        .song-list li:hover {
            background: #f8f9fb;
        }

        .song-list li.active {
            background: #eef2ff;
        }

.song-title {
    font-weight: 600;
    font-size: 13px;
}

.song-author {
    font-size: 12px;
    color: var(--muted);
}

.song-snippet {
    font-size: 11px;
    color: #9aa0aa;
    margin-top: 2px;
}

.dup-badge {
    display: inline-block;
    margin-left: 6px;
    font-size: 10px;
    font-weight: 700;
    color: #92620a;
    background: #fef3c7;
    padding: 1px 6px;
    border-radius: 999px;
    vertical-align: middle;
}

.song-info {
    flex: 1;
    min-width: 0;
}

.song-delete {
    border: none;
    background: transparent;
    color: var(--danger);
    font-size: 16px;
    line-height: 1;
    padding: 2px 6px;
}

    .song-delete:hover {
        background: #fdecec;
        border-radius: 4px;
    }

/* STICKY EDITOR PANE */
.editor-pane {
    background: var(--panel);
    border: 1px solid var(--border);
    border-radius: 10px;
    padding: 18px 20px;
    position: sticky;
    top: 16px; /* Locks 16px from top of screen */
    max-height: calc(100vh - 32px); /* Prevents overflow past bottom */
    overflow-y: auto; /* Adds inner scrollbar if lyrics are very long */
}

.editor-empty {
    color: var(--muted);
    font-size: 14px;
    margin-top: 40px;
    text-align: center;
}

.editor-form.hidden {
    display: none;
}

.editor-form {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

    .editor-form label {
        display: flex;
        flex-direction: column;
        gap: 6px;
        font-size: 13px;
        font-weight: 600;
    }

    .editor-form input, .editor-form textarea {
        padding: 8px 10px;
        border: 1px solid var(--border);
        border-radius: 6px;
        font-size: 13px;
        font-family: inherit;
    }

    .editor-form textarea {
        font-family: "Consolas", "Courier New", monospace;
        font-size: 13px;
        line-height: 1.5;
        resize: vertical;
    }

.two-col {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 12px;
}

.editor-actions {
    display: flex;
    gap: 8px;
    flex-wrap: wrap;
    align-items: center;
}

@media (max-width: 900px) {
    .workspace {
        grid-template-columns: 1fr;
    }

    .editor-pane {
        position: static;
        max-height: none;
    }
}
