/* ═══════════════════════════════════════════════════════════════
   SonicVault — Design System
   Dark theme inspired by Mp3tag layout with modern aesthetics
   ═══════════════════════════════════════════════════════════════ */

@import url('https://fonts.googleapis.com/css2?family=Inter:wght@300;400;500;600;700&family=JetBrains+Mono:wght@400;500&display=swap');

/* ─── CSS Variables ─────────────────────────────────────────── */
:root {
    --bg-primary: #0c0e14;
    --bg-secondary: #12151e;
    --bg-tertiary: #181c28;
    --bg-panel: #151822;
    --bg-input: #1a1e2e;
    --bg-hover: #1e2336;
    --bg-selected: #2a1f4e;
    --bg-selected-strong: #3d2a6e;

    --border-subtle: #1e2336;
    --border-medium: #2a2f42;
    --border-focus: #7c3aed;

    --text-primary: #e8e6f0;
    --text-secondary: #9b97b0;
    --text-muted: #5e5a72;
    --text-accent: #a78bfa;

    --accent: #7c3aed;
    --accent-hover: #8b5cf6;
    --accent-glow: rgba(124, 58, 237, 0.25);
    --accent-soft: rgba(124, 58, 237, 0.1);

    --success: #22c55e;
    --warning: #f59e0b;
    --error: #ef4444;

    --radius-sm: 4px;
    --radius-md: 6px;
    --radius-lg: 10px;

    --shadow-sm: 0 1px 3px rgba(0, 0, 0, 0.3);
    --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.4);
    --shadow-lg: 0 8px 32px rgba(0, 0, 0, 0.5);

    --font-sans: 'Inter', -apple-system, BlinkMacSystemFont, sans-serif;
    --font-mono: 'JetBrains Mono', 'Fira Code', monospace;

    --panel-width: 320px;
    --toolbar-height: 44px;
    --statusbar-height: 32px;
    --player-height: 64px;
}

/* ─── Reset ─────────────────────────────────────────────────── */
*, *::before, *::after {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html, body {
    height: 100%;
    overflow: hidden;
}

body {
    font-family: var(--font-sans);
    font-size: 13px;
    line-height: 1.5;
    color: var(--text-primary);
    background: var(--bg-primary);
    -webkit-font-smoothing: antialiased;
}

/* ─── App Layout ────────────────────────────────────────────── */
#app {
    display: flex;
    flex-direction: column;
    height: 100vh;
}

/* ─── Toolbar ───────────────────────────────────────────────── */
.toolbar {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 0 12px;
    height: var(--toolbar-height);
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
    z-index: 10;
}

.toolbar-brand {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-right: 12px;
    user-select: none;
}

.toolbar-brand svg {
    width: 22px;
    height: 22px;
    color: var(--accent);
}

.toolbar-brand span {
    font-size: 15px;
    font-weight: 700;
    background: linear-gradient(135deg, var(--accent), #a78bfa);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    letter-spacing: -0.3px;
}

.toolbar-divider {
    width: 1px;
    height: 20px;
    background: var(--border-medium);
    margin: 0 4px;
}

.toolbar-btn {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    position: relative;
}

.toolbar-btn:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.toolbar-btn.active {
    background: var(--accent-soft);
    color: var(--accent);
}

.toolbar-btn svg {
    width: 18px;
    height: 18px;
}

.toolbar-btn[data-tooltip]::after {
    content: attr(data-tooltip);
    position: absolute;
    bottom: -30px;
    left: 50%;
    transform: translateX(-50%);
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-sm);
    font-size: 11px;
    color: var(--text-secondary);
    white-space: nowrap;
    opacity: 0;
    pointer-events: none;
    transition: opacity 0.2s;
    z-index: 100;
}

.toolbar-btn[data-tooltip]:hover::after {
    opacity: 1;
}

.toolbar-search {
    margin-left: auto;
    position: relative;
}

.toolbar-search input {
    width: 240px;
    height: 30px;
    padding: 0 12px 0 32px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 12px;
    outline: none;
    transition: all 0.2s ease;
}

.toolbar-search input:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--accent-glow);
    width: 300px;
}

.toolbar-search input::placeholder {
    color: var(--text-muted);
}

.toolbar-search svg {
    position: absolute;
    left: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 14px;
    height: 14px;
    color: var(--text-muted);
    pointer-events: none;
}

/* ─── Main Content ──────────────────────────────────────────── */
.main-content {
    display: flex;
    flex: 1;
    overflow: hidden;
}

/* ─── Left Panel (Tag Editor) ───────────────────────────────── */
.tag-panel {
    width: var(--panel-width);
    min-width: var(--panel-width);
    background: var(--bg-panel);
    border-right: 1px solid var(--border-subtle);
    display: flex;
    flex-direction: column;
    overflow: hidden;
    transition: width 0.2s ease;
}

.tag-panel.collapsed {
    width: 0;
    min-width: 0;
    border-right: none;
}

.tag-panel-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 10px 14px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.tag-panel-header h3 {
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    color: var(--text-secondary);
}

.tag-panel-actions {
    display: flex;
    gap: 4px;
}

.tag-panel-actions button {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    border: none;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s ease;
    font-family: var(--font-sans);
}

.btn-save {
    background: var(--accent);
    color: #fff;
}

.btn-save:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 12px var(--accent-glow);
}

.btn-save:disabled {
    opacity: 0.4;
    cursor: default;
    box-shadow: none;
}

.btn-revert {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border-medium) !important;
}

.btn-revert:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.tag-fields {
    flex: 1;
    overflow-y: auto;
    padding: 12px 14px;
}

.tag-fields::-webkit-scrollbar {
    width: 6px;
}

.tag-fields::-webkit-scrollbar-track {
    background: transparent;
}

.tag-fields::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.tag-field {
    margin-bottom: 10px;
}

.tag-field label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 3px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.tag-field input,
.tag-field select {
    width: 100%;
    height: 30px;
    padding: 0 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 12px;
    outline: none;
    transition: all 0.15s ease;
}

.tag-field input:focus,
.tag-field select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.tag-field input::placeholder {
    color: var(--text-muted);
}

.tag-field input.modified {
    border-color: var(--warning);
    background: rgba(245, 158, 11, 0.05);
}

.tag-row {
    display: flex;
    gap: 8px;
}

.tag-row .tag-field {
    flex: 1;
}

/* Cover art section */
.cover-art-section {
    padding: 12px 14px;
    border-top: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.cover-art-container {
    width: 100%;
    aspect-ratio: 1;
    max-height: 200px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    overflow: hidden;
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: border-color 0.2s;
}

.cover-art-container:hover {
    border-color: var(--border-focus);
}

.cover-art-container img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.cover-art-placeholder {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 6px;
    color: var(--text-muted);
}

.cover-art-placeholder svg {
    width: 40px;
    height: 40px;
    opacity: 0.4;
}

.cover-art-placeholder span {
    font-size: 11px;
}

.cover-art-overlay {
    position: absolute;
    inset: 0;
    background: rgba(0, 0, 0, 0.6);
    display: flex;
    align-items: center;
    justify-content: center;
    opacity: 0;
    transition: opacity 0.2s;
}

.cover-art-container:hover .cover-art-overlay {
    opacity: 1;
}

.cover-art-overlay span {
    font-size: 12px;
    font-weight: 500;
    color: #fff;
}

/* ─── File List ─────────────────────────────────────────────── */
.file-list-container {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.file-table-wrapper {
    flex: 1;
    overflow: auto;
}

.file-table-wrapper::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

.file-table-wrapper::-webkit-scrollbar-track {
    background: var(--bg-primary);
}

.file-table-wrapper::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 4px;
}

.file-table {
    width: 100%;
    border-collapse: collapse;
    table-layout: fixed;
}

.file-table th {
    position: sticky;
    top: 0;
    background: var(--bg-secondary);
    border-bottom: 1px solid var(--border-medium);
    padding: 0 12px;
    height: 32px;
    font-size: 11px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.4px;
    color: var(--text-secondary);
    text-align: left;
    white-space: nowrap;
    cursor: pointer;
    user-select: none;
    z-index: 5;
}

.file-table th:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.file-table th.sorted {
    color: var(--text-accent);
}

.file-table th .sort-icon {
    display: inline-block;
    margin-left: 4px;
    font-size: 10px;
    opacity: 0.6;
}

.file-table td {
    padding: 0 12px;
    height: 28px;
    border-bottom: 1px solid var(--border-subtle);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    font-size: 12px;
    color: var(--text-primary);
}

.file-table tr {
    transition: background 0.1s ease;
}

.file-table tbody tr:hover {
    background: var(--bg-hover);
}

.file-table tbody tr.selected {
    background: var(--bg-selected);
}

.file-table tbody tr.selected:hover {
    background: var(--bg-selected-strong);
}

.file-table .col-checkbox {
    width: 36px;
    text-align: center;
}

.file-table .col-id { width: 160px; }
.file-table .col-filename { width: 24%; }
.file-table .col-title { width: 20%; }
.file-table .col-artist { width: 14%; }
.file-table .col-album { width: 12%; }
.file-table .col-genre { width: 8%; }
.file-table .col-year { width: 5%; }
.file-table .col-duration { width: 7%; text-align: right; }

/* Song ID cell */
.song-id-cell {
    display: flex;
    align-items: center;
    gap: 4px;
}

.song-id-text {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-accent);
    background: var(--accent-soft);
    padding: 1px 5px;
    border-radius: 3px;
    letter-spacing: 0.3px;
    user-select: all;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 110px;
    display: inline-block;
    vertical-align: middle;
}

.song-id-none {
    color: var(--text-muted);
    font-size: 11px;
}

.btn-copy-id {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 20px;
    height: 20px;
    padding: 0;
    border: none;
    background: transparent;
    color: var(--text-muted);
    border-radius: 3px;
    cursor: pointer;
    transition: all 0.15s ease;
    opacity: 0;
    flex-shrink: 0;
}

.btn-copy-id svg {
    width: 12px;
    height: 12px;
}

.file-table tbody tr:hover .btn-copy-id {
    opacity: 1;
}

.btn-copy-id:hover {
    background: var(--bg-hover);
    color: var(--accent);
}

.btn-copy-id.copied {
    opacity: 1;
    color: var(--success);
}

.file-table th.col-id {
    cursor: default;
}

.file-table td.col-duration {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-secondary);
    text-align: right;
}

/* Custom checkbox */
.sv-checkbox {
    appearance: none;
    width: 15px;
    height: 15px;
    border: 1.5px solid var(--border-medium);
    border-radius: 3px;
    background: var(--bg-input);
    cursor: pointer;
    position: relative;
    transition: all 0.15s ease;
    vertical-align: middle;
}

.sv-checkbox:checked {
    background: var(--accent);
    border-color: var(--accent);
}

.sv-checkbox:checked::after {
    content: '✓';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    font-size: 10px;
    color: #fff;
    font-weight: 700;
}

.sv-checkbox:hover {
    border-color: var(--accent);
}

/* ─── Status Bar ────────────────────────────────────────────── */
.status-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    height: var(--statusbar-height);
    padding: 0 14px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-subtle);
    font-size: 11px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.status-bar-left {
    display: flex;
    gap: 16px;
}

.status-bar-right {
    display: flex;
    gap: 16px;
}

.status-item {
    display: flex;
    align-items: center;
    gap: 4px;
}

.status-item .dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--success);
}

/* ─── Audio Player Bar ──────────────────────────────────────── */
.player-bar {
    display: flex;
    align-items: center;
    gap: 12px;
    height: var(--player-height);
    padding: 0 16px;
    background: var(--bg-secondary);
    border-top: 1px solid var(--border-medium);
    flex-shrink: 0;
    display: none;
}

.player-bar.visible {
    display: flex;
}

.player-cover {
    width: 42px;
    height: 42px;
    border-radius: var(--radius-sm);
    background: var(--bg-tertiary);
    overflow: hidden;
    flex-shrink: 0;
}

.player-cover img {
    width: 100%;
    height: 100%;
    object-fit: cover;
}

.player-info {
    min-width: 0;
    flex-shrink: 0;
    width: 180px;
}

.player-info .player-title {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-info .player-artist {
    font-size: 11px;
    color: var(--text-secondary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.player-controls {
    display: flex;
    align-items: center;
    gap: 8px;
}

.player-controls button {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 50%;
    cursor: pointer;
    transition: all 0.15s;
}

.player-controls button:hover {
    color: var(--text-primary);
    background: var(--bg-hover);
}

.player-controls .play-btn {
    width: 36px;
    height: 36px;
    background: var(--accent);
    color: #fff;
}

.player-controls .play-btn:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 16px var(--accent-glow);
}

.player-controls .play-btn svg {
    width: 18px;
    height: 18px;
}

.player-progress {
    flex: 1;
    display: flex;
    align-items: center;
    gap: 10px;
}

.player-progress .time {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    min-width: 40px;
    text-align: center;
}

.progress-bar {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.progress-bar:hover {
    height: 6px;
}

.progress-fill {
    height: 100%;
    background: linear-gradient(90deg, var(--accent), #a78bfa);
    border-radius: 2px;
    width: 0%;
    transition: width 0.1s linear;
}

.player-volume {
    display: flex;
    align-items: center;
    gap: 6px;
    width: 120px;
}

.player-volume svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.volume-slider {
    flex: 1;
    height: 4px;
    background: var(--bg-tertiary);
    border-radius: 2px;
    cursor: pointer;
    position: relative;
}

.volume-fill {
    height: 100%;
    background: var(--accent);
    border-radius: 2px;
    width: 80%;
}

/* ─── Toast Notifications ───────────────────────────────────── */
.toast-container {
    position: fixed;
    top: 60px;
    right: 16px;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.toast {
    padding: 10px 16px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-lg);
    font-size: 12px;
    color: var(--text-primary);
    display: flex;
    align-items: center;
    gap: 8px;
    animation: slideIn 0.25s ease;
    max-width: 360px;
}

.toast.success { border-left: 3px solid var(--success); }
.toast.error { border-left: 3px solid var(--error); }
.toast.warning { border-left: 3px solid var(--warning); }

@keyframes slideIn {
    from { opacity: 0; transform: translateX(20px); }
    to { opacity: 1; transform: translateX(0); }
}

@keyframes slideOut {
    from { opacity: 1; transform: translateX(0); }
    to { opacity: 0; transform: translateX(20px); }
}

/* ─── Loading / Empty States ────────────────────────────────── */
.loading-overlay {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 12px;
}

.spinner {
    width: 28px;
    height: 28px;
    border: 2.5px solid var(--border-subtle);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.7s linear infinite;
}

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

.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 60px 20px;
    color: var(--text-muted);
    gap: 8px;
}

.empty-state svg {
    width: 48px;
    height: 48px;
    opacity: 0.3;
    margin-bottom: 8px;
}

.empty-state h4 {
    font-size: 14px;
    font-weight: 500;
    color: var(--text-secondary);
}

.empty-state p {
    font-size: 12px;
}

/* ─── Resize Handle ─────────────────────────────────────────── */
.resize-handle {
    width: 4px;
    cursor: col-resize;
    background: transparent;
    transition: background 0.2s;
    flex-shrink: 0;
}

.resize-handle:hover,
.resize-handle.active {
    background: var(--accent);
}

/* ─── No-select mode during batch ───────────────────────────── */
.batch-mode .file-table tbody tr {
    cursor: pointer;
}

/* ─── Responsive ────────────────────────────────────────────── */
@media (max-width: 768px) {
    .tag-panel {
        position: absolute;
        left: 0;
        top: var(--toolbar-height);
        bottom: calc(var(--statusbar-height));
        z-index: 20;
        box-shadow: var(--shadow-lg);
    }

    .tag-panel.collapsed {
        transform: translateX(-100%);
    }

    .toolbar-search input {
        width: 160px;
    }

    .toolbar-search input:focus {
        width: 200px;
    }
}

/* ─── Upload Modal ──────────────────────────────────────────── */
.modal-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.7);
    backdrop-filter: blur(4px);
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 100;
}

.modal-overlay.visible {
    display: flex;
}

.modal-dialog {
    width: 520px;
    max-height: 80vh;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-lg);
    display: flex;
    flex-direction: column;
    animation: modalIn 0.2s ease;
}

@keyframes modalIn {
    from { opacity: 0; transform: scale(0.95) translateY(-10px); }
    to { opacity: 1; transform: scale(1) translateY(0); }
}

.modal-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 16px 20px;
    border-bottom: 1px solid var(--border-subtle);
}

.modal-header h3 {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
}

.modal-close {
    width: 28px;
    height: 28px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 20px;
    cursor: pointer;
    border-radius: var(--radius-sm);
    transition: all 0.15s;
}

.modal-close:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-body {
    padding: 20px;
    overflow-y: auto;
}

.modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 8px;
    padding: 14px 20px;
    border-top: 1px solid var(--border-subtle);
}

.modal-footer .btn-cancel {
    padding: 6px 16px;
    font-size: 12px;
    font-weight: 500;
    font-family: var(--font-sans);
    border: 1px solid var(--border-medium);
    background: transparent;
    color: var(--text-secondary);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.modal-footer .btn-cancel:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.modal-footer .btn-upload {
    padding: 6px 20px;
    font-size: 12px;
    font-weight: 600;
    font-family: var(--font-sans);
    border: none;
    background: var(--accent);
    color: #fff;
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.modal-footer .btn-upload:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 16px var(--accent-glow);
}

.modal-footer .btn-upload:disabled {
    opacity: 0.4;
    cursor: default;
    box-shadow: none;
}

/* Dropzone */
.upload-dropzone {
    border: 2px dashed var(--border-medium);
    border-radius: var(--radius-md);
    padding: 40px 20px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    cursor: pointer;
    transition: all 0.2s;
    text-align: center;
}

.upload-dropzone:hover,
.upload-dropzone.dragover {
    border-color: var(--accent);
    background: var(--accent-soft);
}

.upload-dropzone svg {
    width: 36px;
    height: 36px;
    color: var(--text-muted);
    transition: color 0.2s;
}

.upload-dropzone:hover svg,
.upload-dropzone.dragover svg {
    color: var(--accent);
}

.dropzone-text {
    font-size: 13px;
    font-weight: 500;
    color: var(--text-secondary);
}

.dropzone-hint {
    font-size: 11px;
    color: var(--text-muted);
}

/* Folder selector */
.upload-folder {
    margin-top: 14px;
}

.upload-folder label {
    display: block;
    font-size: 11px;
    font-weight: 500;
    color: var(--text-secondary);
    margin-bottom: 4px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
}

.upload-folder select {
    width: 100%;
    height: 32px;
    padding: 0 8px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 12px;
    outline: none;
    cursor: pointer;
}

.upload-folder select:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

/* File queue */
.upload-queue {
    margin-top: 16px;
}

.upload-queue-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
}

.upload-queue-header span {
    font-size: 12px;
    font-weight: 500;
    color: var(--text-secondary);
}

.btn-clear-queue {
    padding: 2px 8px;
    font-size: 11px;
    font-family: var(--font-sans);
    border: 1px solid var(--border-medium);
    background: transparent;
    color: var(--text-muted);
    border-radius: var(--radius-sm);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-clear-queue:hover {
    background: var(--bg-hover);
    color: var(--text-primary);
}

.upload-queue-list {
    max-height: 200px;
    overflow-y: auto;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.upload-queue-list::-webkit-scrollbar {
    width: 6px;
}

.upload-queue-list::-webkit-scrollbar-thumb {
    background: var(--border-medium);
    border-radius: 3px;
}

.upload-queue-item {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 6px 10px;
    background: var(--bg-tertiary);
    border-radius: var(--radius-sm);
    font-size: 12px;
}

.upload-queue-item .file-name {
    flex: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    color: var(--text-primary);
}

.upload-queue-item .file-size {
    font-family: var(--font-mono);
    font-size: 11px;
    color: var(--text-muted);
    flex-shrink: 0;
}

.upload-queue-item .file-status {
    font-size: 11px;
    flex-shrink: 0;
    width: 20px;
    text-align: center;
}

.upload-queue-item .file-status.pending { color: var(--text-muted); }
.upload-queue-item .file-status.uploading { color: var(--accent); }
.upload-queue-item .file-status.done { color: var(--success); }
.upload-queue-item .file-status.error { color: var(--error); }

.upload-queue-item.uploading {
    border-left: 2px solid var(--accent);
}

.upload-queue-item.done {
    opacity: 0.7;
    border-left: 2px solid var(--success);
}

.upload-queue-item.error {
    border-left: 2px solid var(--error);
}

.btn-remove-file {
    width: 18px;
    height: 18px;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    background: transparent;
    color: var(--text-muted);
    font-size: 14px;
    cursor: pointer;
    border-radius: 50%;
    transition: all 0.15s;
    flex-shrink: 0;
}

.btn-remove-file:hover {
    background: rgba(239, 68, 68, 0.15);
    color: var(--error);
}

.upload-dropzone.uploading {
    border-color: var(--accent);
    pointer-events: none;
}

/* ─── Panel Tabs ────────────────────────────────────────────── */
.panel-tabs {
    display: flex;
    gap: 0;
}

.panel-tab {
    background: none;
    border: none;
    padding: 6px 14px;
    font-family: var(--font-sans);
    font-size: 12px;
    font-weight: 600;
    color: var(--text-muted);
    cursor: pointer;
    border-bottom: 2px solid transparent;
    transition: all 0.15s;
}

.panel-tab:hover {
    color: var(--text-secondary);
}

.panel-tab.active {
    color: var(--accent);
    border-bottom-color: var(--accent);
}

.panel-tab-content {
    display: none;
    flex-direction: column;
    overflow-y: auto;
    flex: 1;
}

.panel-tab-content.active {
    display: flex;
}

/* ─── Lyrics Editor ─────────────────────────────────────────── */
.lyrics-toolbar {
    display: flex;
    align-items: center;
    gap: 4px;
    padding: 8px 12px;
    border-bottom: 1px solid var(--border-subtle);
    flex-shrink: 0;
}

.lyrics-btn {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    padding: 4px 8px;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-secondary);
    font-family: var(--font-sans);
    font-size: 11px;
    cursor: pointer;
    transition: all 0.15s;
    white-space: nowrap;
}

.lyrics-btn:hover {
    background: var(--bg-hover);
    border-color: var(--border-medium);
    color: var(--text-primary);
}

.lyrics-btn.active {
    background: rgba(239, 68, 68, 0.15);
    border-color: rgba(239, 68, 68, 0.4);
    color: var(--error);
}

.lyrics-btn-save {
    color: var(--success);
}

.lyrics-btn-odoo {
    color: var(--accent);
}

.lyrics-btn-fetch {
    color: #f59e0b;
}

.lyrics-toolbar-spacer {
    flex: 1;
}

.lyrics-source {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    border-bottom: 1px solid var(--border-subtle);
    font-size: 11px;
    color: var(--text-muted);
}

.lyrics-source select {
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-sm);
    color: var(--text-primary);
    font-family: var(--font-sans);
    font-size: 11px;
    padding: 2px 6px;
    outline: none;
}

.lyrics-editor {
    flex: 1;
    min-height: 120px;
    max-height: 40%;
    display: flex;
}

#lyricsText {
    width: 100%;
    height: 100%;
    resize: none;
    background: var(--bg-primary);
    border: none;
    border-bottom: 1px solid var(--border-subtle);
    padding: 10px 12px;
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 12px;
    line-height: 1.7;
    outline: none;
    box-sizing: border-box;
}

#lyricsText::placeholder {
    color: var(--text-muted);
    font-family: var(--font-sans);
    font-style: italic;
}

/* ─── LRC Preview (Karaoke) ─────────────────────────────────── */
.lrc-preview {
    flex: 1;
    overflow-y: auto;
    padding: 8px 0;
    min-height: 80px;
}

.lrc-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
    color: var(--text-muted);
    font-size: 12px;
    font-style: italic;
}

.lrc-line {
    display: flex;
    align-items: baseline;
    gap: 8px;
    padding: 3px 12px;
    cursor: pointer;
    transition: all 0.15s;
    border-left: 2px solid transparent;
}

.lrc-line:hover {
    background: var(--bg-hover);
}

.lrc-line.active {
    background: rgba(124, 58, 237, 0.1);
    border-left-color: var(--accent);
}

.lrc-line.active .lrc-text {
    color: var(--text-primary);
    font-weight: 500;
}

.lrc-line.next {
    background: rgba(124, 58, 237, 0.05);
}

.lrc-time {
    font-family: var(--font-mono);
    font-size: 10px;
    color: var(--text-muted);
    min-width: 48px;
    flex-shrink: 0;
    opacity: 0.7;
}

.lrc-line.active .lrc-time {
    color: var(--accent);
    opacity: 1;
}

.lrc-text {
    font-size: 12px;
    color: var(--text-secondary);
    line-height: 1.5;
}

.lrc-line-num {
    font-family: var(--font-mono);
    font-size: 9px;
    color: var(--text-muted);
    opacity: 0.4;
    min-width: 18px;
    text-align: right;
    flex-shrink: 0;
}

/* ─── Timing Mode ───────────────────────────────────────────── */
.timing-indicator {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 12px;
    background: rgba(239, 68, 68, 0.1);
    border-top: 1px solid rgba(239, 68, 68, 0.3);
    font-size: 11px;
    color: var(--error);
    animation: fadeIn 0.2s ease;
}

.timing-dot {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    background: var(--error);
    animation: pulse-dot 0.8s ease infinite;
}

.timing-indicator kbd {
    display: inline-block;
    padding: 1px 5px;
    border: 1px solid rgba(239, 68, 68, 0.4);
    border-radius: 3px;
    font-family: var(--font-mono);
    font-size: 10px;
    background: rgba(239, 68, 68, 0.1);
}

@keyframes fadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}

/* ─── Login Overlay ─────────────────────────────────────────── */
.login-overlay {
    position: fixed;
    inset: 0;
    background: rgba(12, 14, 20, 0.95);
    backdrop-filter: blur(8px);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 200;
}

.login-overlay.hidden {
    display: none;
}

.login-dialog {
    width: 340px;
    background: var(--bg-secondary);
    border: 1px solid var(--border-medium);
    border-radius: var(--radius-lg);
    box-shadow: 0 0 60px rgba(124, 58, 237, 0.15);
    padding: 40px 32px;
    text-align: center;
    animation: modalIn 0.3s ease;
}

.login-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto 16px;
    color: var(--accent);
}

.login-icon svg {
    width: 100%;
    height: 100%;
}

.login-dialog h2 {
    font-size: 20px;
    font-weight: 700;
    color: var(--text-primary);
    margin: 0 0 4px;
    letter-spacing: -0.3px;
}

.login-dialog p {
    font-size: 12px;
    color: var(--text-muted);
    margin: 0 0 24px;
}

#loginForm {
    display: flex;
    flex-direction: column;
    gap: 10px;
}

#loginToken {
    width: 100%;
    height: 40px;
    padding: 0 14px;
    background: var(--bg-input);
    border: 1px solid var(--border-subtle);
    border-radius: var(--radius-md);
    color: var(--text-primary);
    font-family: var(--font-mono);
    font-size: 13px;
    outline: none;
    transition: border-color 0.15s;
    box-sizing: border-box;
}

#loginToken:focus {
    border-color: var(--border-focus);
    box-shadow: 0 0 0 2px var(--accent-glow);
}

.btn-login {
    width: 100%;
    height: 40px;
    border: none;
    background: var(--accent);
    color: #fff;
    font-family: var(--font-sans);
    font-size: 13px;
    font-weight: 600;
    border-radius: var(--radius-md);
    cursor: pointer;
    transition: all 0.15s;
}

.btn-login:hover {
    background: var(--accent-hover);
    box-shadow: 0 0 20px var(--accent-glow);
}

.login-error {
    margin-top: 10px;
    font-size: 12px;
    color: var(--error);
    animation: shake 0.4s ease;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    25% { transform: translateX(-6px); }
    75% { transform: translateX(6px); }
}

/* ─── Sync Button States ────────────────────────────────────── */
.toolbar-btn.syncing svg {
    animation: spin 1s linear infinite;
}

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

.toolbar-btn.odoo-connected {
    color: var(--success);
}

.toolbar-btn.odoo-error {
    color: var(--error);
}

/* ─── Odoo Status Badge ─────────────────────────────────────── */
.status-badge {
    display: inline-flex;
    align-items: center;
    gap: 5px;
    padding: 1px 8px;
    border-radius: 10px;
    font-size: 11px;
    font-weight: 500;
    background: var(--bg-tertiary);
    border: 1px solid var(--border-subtle);
    color: var(--text-muted);
    transition: all 0.3s;
}

.status-badge-dot {
    width: 6px;
    height: 6px;
    border-radius: 50%;
    background: var(--text-muted);
    transition: background 0.3s;
}

.status-badge.connected {
    border-color: rgba(34, 197, 94, 0.3);
    color: var(--success);
}

.status-badge.connected .status-badge-dot {
    background: var(--success);
    box-shadow: 0 0 6px rgba(34, 197, 94, 0.5);
}

.status-badge.error {
    border-color: rgba(239, 68, 68, 0.3);
    color: var(--error);
}

.status-badge.error .status-badge-dot {
    background: var(--error);
}

.status-badge.syncing {
    border-color: rgba(124, 58, 237, 0.3);
    color: var(--accent);
}

.status-badge.syncing .status-badge-dot {
    background: var(--accent);
    animation: pulse-dot 1s ease infinite;
}

@keyframes pulse-dot {
    0%, 100% { opacity: 1; transform: scale(1); }
    50% { opacity: 0.5; transform: scale(1.5); }
}

/* ═══ Link Dialog ═══ */
.link-dialog {
    max-width: 560px;
    max-height: 80vh;
    display: flex;
    flex-direction: column;
}

.link-dialog .modal-body {
    display: flex;
    flex-direction: column;
    gap: 12px;
    overflow: hidden;
    flex: 1;
    min-height: 0;
}

.link-file-info {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
}

.link-file-name {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.link-file-meta {
    display: flex;
    gap: 12px;
    margin-top: 4px;
    font-size: 11px;
    color: var(--text-secondary);
}

.link-nd-id {
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 10px;
    opacity: 0.7;
}

.link-current.linked {
    color: var(--success);
    font-weight: 500;
}

/* Search */
.link-search {
    position: relative;
    display: flex;
    align-items: center;
    gap: 8px;
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 0 12px;
    transition: border-color 0.2s;
}

.link-search:focus-within {
    border-color: var(--accent);
    box-shadow: 0 0 0 2px rgba(124, 58, 237, 0.15);
}

.link-search svg {
    width: 16px;
    height: 16px;
    color: var(--text-secondary);
    flex-shrink: 0;
}

.link-search input {
    flex: 1;
    background: none;
    border: none;
    outline: none;
    color: var(--text-primary);
    font-size: 13px;
    padding: 10px 0;
}

.link-search-spinner {
    width: 16px;
    height: 16px;
    border: 2px solid var(--border);
    border-top-color: var(--accent);
    border-radius: 50%;
    animation: spin 0.6s linear infinite;
    flex-shrink: 0;
}

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

/* Results */
.link-results {
    flex: 1;
    overflow-y: auto;
    min-height: 120px;
    max-height: 400px;
    display: flex;
    flex-direction: column;
    gap: 8px;
}

.link-empty {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100px;
    color: var(--text-secondary);
    font-size: 13px;
    font-style: italic;
}

.link-empty.link-error {
    color: var(--error);
    font-style: normal;
}

/* Song Card */
.link-song-card {
    background: var(--bg-secondary);
    border: 1px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    transition: border-color 0.2s;
}

.link-song-card:hover {
    border-color: var(--accent);
}

.link-song-header {
    display: flex;
    align-items: flex-start;
    justify-content: space-between;
    gap: 8px;
}

.link-song-title {
    font-weight: 600;
    font-size: 13px;
    color: var(--text-primary);
    flex: 1;
    min-width: 0;
}

.link-book {
    display: inline-block;
    background: var(--accent);
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    padding: 2px 6px;
    border-radius: 4px;
    margin-right: 6px;
    vertical-align: middle;
}

.link-song-credits {
    font-size: 11px;
    color: var(--text-secondary);
    margin-top: 2px;
    margin-bottom: 4px;
}

/* Media List */
.link-media-list {
    margin-top: 8px;
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.link-media-empty {
    font-size: 11px;
    color: var(--text-secondary);
    font-style: italic;
    padding: 4px 0;
}

.link-media-item {
    display: flex;
    align-items: center;
    gap: 8px;
    padding: 6px 10px;
    background: var(--bg-primary);
    border-radius: 6px;
    border: 1px solid transparent;
    transition: all 0.2s;
}

.link-media-item.linked {
    border-color: rgba(16, 185, 129, 0.3);
    background: rgba(16, 185, 129, 0.08);
}

.link-media-item.has-nd {
    opacity: 0.5;
}

.link-media-name {
    flex: 1;
    font-size: 12px;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
}

.link-media-type {
    font-size: 10px;
    color: var(--text-secondary);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    flex-shrink: 0;
}

/* Badges & Buttons */
.link-badge {
    font-size: 10px;
    padding: 2px 8px;
    border-radius: 10px;
    font-weight: 600;
    flex-shrink: 0;
}

.link-badge.linked {
    background: rgba(16, 185, 129, 0.15);
    color: var(--success);
}

.link-badge.has-nd {
    background: rgba(251, 191, 36, 0.15);
    color: #f59e0b;
    font-family: 'SF Mono', 'Fira Code', monospace;
    font-size: 9px;
}

.link-btn-attach {
    padding: 3px 10px;
    font-size: 11px;
    font-weight: 600;
    background: var(--accent);
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.link-btn-attach:hover {
    background: var(--accent-hover);
    transform: scale(1.05);
}

.link-btn-create {
    padding: 4px 10px;
    font-size: 11px;
    font-weight: 500;
    background: transparent;
    color: var(--accent);
    border: 1px solid var(--accent);
    border-radius: 6px;
    cursor: pointer;
    transition: all 0.2s;
    flex-shrink: 0;
    white-space: nowrap;
}

.link-btn-create:hover {
    background: var(--accent);
    color: #fff;
}

/* ─── Scripture (Audio Bible) tab ─────────────────────────── */
.scripture-pickers {
    display: flex;
    gap: 6px;
    padding: 8px 10px 0 10px;
    align-items: center;
}
.scripture-pickers select {
    flex: 1;
    min-width: 0;
    background: var(--bg-input, #1c1c22);
    color: var(--text, #e0e0e0);
    border: 1px solid var(--border, #33333c);
    border-radius: 4px;
    padding: 5px 6px;
    font-size: 12px;
}
.scripture-pickers input[type="number"] {
    width: 56px;
    background: var(--bg-input, #1c1c22);
    color: var(--text, #e0e0e0);
    border: 1px solid var(--border, #33333c);
    border-radius: 4px;
    padding: 5px 6px;
    font-size: 12px;
}
.scripture-expected {
    width: 54px;
    background: var(--bg-input, #1c1c22);
    color: var(--text, #e0e0e0);
    border: 1px solid var(--border, #33333c);
    border-radius: 4px;
    padding: 5px 6px;
    font-size: 12px;
}
.scripture-status {
    padding: 6px 12px;
    font-size: 11px;
    color: var(--text-dim, #9a9aa5);
    border-top: 1px solid var(--border, #33333c);
    white-space: pre-wrap;
}
.scripture-status.error {
    color: #ff7676;
}
.scripture-production-bar {
    border-top: 1px solid var(--border, #33333c);
}

/* ─── Per-user login ──────────────────────────────────────── */
.user-badge {
    font-size: 12px;
    color: var(--text-dim, #9a9aa5);
    padding: 0 8px;
    max-width: 160px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}
.login-mode-toggle {
    display: inline-block;
    margin-top: 10px;
    font-size: 11px;
    color: var(--text-dim, #9a9aa5);
    text-decoration: none;
}
.login-mode-toggle:hover { text-decoration: underline; }
#loginOdooFields input { margin-bottom: 8px; }
