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

* {
    scroll-behavior: smooth;
    margin: 0;
    padding: 0;
    box-sizing: border-box;
    text-decoration: none;
    font-optical-sizing: auto;
    -moz-box-sizing: border-box;
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
}

/* Remove tap highlight on touch devices */
* {
    -webkit-tap-highlight-color: transparent;
}

/* ======================= BASE STYLES ======================= */
body {
    font-family: var(--font-sans);
    background-color: var(--background);
    color: var(--text-primary);
    line-height: 1.6;
    overflow: hidden;
    height: 100vh;
    height: 100dvh;
    /* Older WebKit: allow touch events to reach scrollable children */
    -webkit-overflow-scrolling: touch;
}

/* ======================= SCROLLBAR ======================= */
::-webkit-scrollbar {
    width: 8px;
    height: 8px;
}

::-webkit-scrollbar-track {
    background: transparent;
}

::-webkit-scrollbar-thumb {
    background: var(--border);
    border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
    background: var(--text-tertiary);
}

/* ======================= MAIN CONTAINER ======================= */
.main-container {
    display: flex;
    height: calc(100vh - var(--nav-height));
    height: calc(100dvh - var(--nav-height));
    overflow: hidden;
    -webkit-overflow-scrolling: touch;
}

/* ======================= LEFT SMALL SIDEBAR ======================= */
.left-small-sidebar {
    width: var(--small-sidebar-width);
    background: var(--surface);
    border-right: 1px solid var(--border);
    box-shadow: none;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 12px 0;
    padding-top: 10px;
    gap: 8px;
    overflow-y: auto;
    overflow-x: hidden;
    scrollbar-width: none;
    /* Hide scrollbar Firefox */
    -ms-overflow-style: none;
    /* Hide scrollbar IE/Edge */
}

/* Pushes Help / Support / Settings / Access to the bottom on desktop */
.left-sidebar-spacer {
    flex: 1 1 auto;
    min-height: 8px;
    width: 100%;
    pointer-events: none;
}

/* .tab-options { display:flex } otherwise wins over the [hidden] attribute */
.tab-options[hidden] {
    display: none !important;
}

.tab-options {
    width: 44px;
    height: 44px;
    border: none;
    background: transparent;
    color: var(--text-secondary);
    border-radius: 8px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.2s ease;
    font-size: 18px;
    flex-direction: column;
    gap: 3px;
}

.tab-options:hover {
    background: var(--surface-hover);
    color: var(--text-primary);
}

.tab-options.active {
    background: color-mix(in srgb, var(--accent) 10%, transparent);
    color: var(--accent);
}

/* After base .tab-options so desktop keeps the same highlight as mobile */
.tab-options.tab-options--access {
    color: #c2410c;
    background: color-mix(in srgb, #f59e0b 16%, transparent);
}

.tab-options.tab-options--access:hover {
    color: #9a3412;
    background: color-mix(in srgb, #f59e0b 24%, transparent);
}

.tab-options.tab-options--access.is-pending {
    color: var(--text-secondary);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.tab-options.tab-options--access .nav-label {
    font-weight: 700;
}

/* Labels hidden on desktop (icon-only sidebar) */
.nav-label {
    display: none;
    font-size: 10px;
    font-weight: 600;
    font-family: var(--font-sans);
    letter-spacing: 0.02em;
    line-height: 1;
}


/* ======================= BUTTONS ======================= */
.btn {
    padding: 10px 20px;
    border: none;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.pdf-action-buttons,
.settings-panel-footer {
    display: flex;
    justify-content: space-evenly;
    align-items: center;
    gap: 12px;
}

.settings-checkbox {
    width: 18px;
    height: 18px;
    margin: 0;
    cursor: pointer;
    accent-color: var(--accent);
}



/* ======================= PANEL OVERLAY ======================= */
.panel-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.panel-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ======================= SIDE PANELS ======================= */
.side-panel {
    position: fixed;
    top: 0;
    right: 0;
    width: 420px;
    height: 100dvh;
    background: var(--surface-elevated);
    box-shadow: none;
    z-index: 999;
    display: flex;
    flex-direction: column;
    transform: translateX(100%);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

.side-panel.active {
    transform: translateX(0);
    box-shadow: -4px 0 16px rgba(0, 0, 0, 0.12);
}

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

.panel-header h2 {
    font-size: 20px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.panel-close {
    margin-left: auto;
}

.panel-content {
    flex: 1;
    overflow-y: auto;
    padding: 24px;
}

.panel-footer {
    padding: 20px 24px;
    border-top: 1px solid var(--border);
    display: flex;
    gap: 12px;
    flex-shrink: 0;
}

.panel-footer-split {
    justify-content: space-between;
}

.panel-footer .btn {
    flex: 1;
}

/* Panel Sections */
.panel-section {
    margin-bottom: 32px;
}

.panel-section:last-child {
    margin-bottom: 0;
}


.panel-section-title {
    display: flex;
    align-items: center;
    gap: 10px;
    font-size: 12px;
    font-weight: 600;
    text-transform: uppercase;
    letter-spacing: 0.08em;
    color: var(--text-tertiary);
    margin: 0 0 14px 0;
    white-space: nowrap;
}

.panel-section-title::before,
.panel-section-title::after {
    content: '';
    flex: 1;
    height: 1px;
    background: var(--border-light);
}



/* Panel Inputs */
.panel-label {
    display: block;
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    margin-bottom: 8px;
}

.panel-input {
    width: 100%;
    padding: 10px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    color: var(--text-primary);
    background: var(--surface);
    transition: all 0.2s ease;
}

.panel-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

.panel-hint {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 6px;
}

#add-to-collection-list .panel-section-title:not(:first-child) {
    margin-top: 10px;
}

.add-to-col-new-btn {
    display: flex;
    align-items: center;
    gap: 6px;
    background: none;
    border: none;
    color: var(--text-tertiary);
    font-size: 12px;
    cursor: pointer;
    padding: 6px 2px;
    transition: color 0.15s;
}

.add-to-col-new-btn:hover {
    color: var(--accent);
}

.add-to-col-new-form {
    display: flex;
    align-items: center;
    gap: 6px;
    padding: 4px 0;
}

.add-to-col-new-input {
    flex: 1;
    font-size: 13px;
    padding: 5px 8px;
    border-radius: 6px;
    border: 1.5px solid var(--border);
    background: var(--surface);
    color: var(--text-primary);
    outline: none;
    min-width: 0;
}

.add-to-col-new-input:focus {
    border-color: var(--accent);
}

.add-to-col-new-confirm,
.add-to-col-new-cancel {
    width: 26px;
    height: 26px;
    border-radius: 6px;
    border: none;
    cursor: pointer;
    font-size: 11px;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.15s;
}

.add-to-col-new-confirm {
    background: var(--accent);
    color: white;
}

.add-to-col-new-confirm:hover {
    background: var(--accent-dark);
}

.add-to-col-new-cancel {
    background: var(--surface-hover);
    color: var(--text-secondary);
}

.add-to-col-new-cancel:hover {
    background: var(--border);
}

.add-to-col-song-header {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 12px;
    margin-bottom: 16px;
    background: var(--surface-hover);
    border-radius: 10px;
    border: 1px solid var(--border-light);
    min-width: 0;
}

.add-to-col-song-icon {
    font-size: 13px;
    color: var(--text-tertiary);
    flex-shrink: 0;
}

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

.add-to-col-song-name {
    font-size: 14px;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.add-to-col-song-version {
    font-size: 12px;
    color: var(--text-tertiary);
    margin-top: 1px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.panel-error {
    display: block;
    font-size: 12px;
    color: #dc3545;
    margin-top: 6px;
    min-height: 18px;
}

/* ======================= YOUTUBE MULTI-URL WIDGET ======================= */
.youtube-url-row {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.youtube-url-row:last-child {
    margin-bottom: 0;
}

.youtube-url-row .panel-input {
    flex: 1;
    margin-bottom: 0;
}

.youtube-url-remove {
    flex-shrink: 0;
    width: 32px;
    height: 32px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-tertiary);
    cursor: pointer;
    transition: background 0.15s, border-color 0.15s, color 0.15s;
    padding: 0;
    font-size: 12px;
}

.youtube-url-remove:hover {
    background: color-mix(in srgb, #dc3545 12%, transparent);
    border-color: #dc3545;
    color: #dc3545;
}

.btn-add-youtube-url {
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    width: 100%;
    margin-top: 8px;
    padding: 7px 12px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 13px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
}

.btn-add-youtube-url:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}

.btn-add-youtube-url i {
    font-size: 11px;
}

/* ===== SONG VERSIONS ===== */

.versions-section-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 6px;
}

.versions-section-header .panel-label {
    margin-bottom: 0;
}

.btn-add-version {
    display: flex;
    align-items: center;
    gap: 5px;
    padding: 5px 10px;
    background: transparent;
    border: 1px dashed var(--border);
    border-radius: 6px;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: border-color 0.15s, color 0.15s, background 0.15s;
    white-space: nowrap;
}

.btn-add-version:hover {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 6%, transparent);
}

/* Pending version entries (create panels) */
.pending-version-entry {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 12px;
    margin-bottom: 10px;
    background: var(--surface-elevated);
}

.pending-version-header {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-bottom: 8px;
}

.pending-version-header .panel-input {
    flex: 1;
    margin-bottom: 0;
}

.pending-version-header .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 13px;
    flex-shrink: 0;
}

.version-content-textarea {
    min-height: 100px;
}

/* Existing version rows (edit panel) */
.existing-version-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 10px;
    border: 1px solid var(--border-light);
    border-radius: 7px;
    margin-bottom: 6px;
    background: var(--surface-elevated);
}

.version-row-name {
    font-size: 14px;
    color: var(--text-primary);
    font-weight: 500;
    flex: 1;
    min-width: 0;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.version-rename-input {
    flex: 1;
    margin-right: 8px;
    min-width: 0;
}

.version-row-actions {
    display: flex;
    gap: 2px;
    flex-shrink: 0;
}

.version-row-actions .icon-btn {
    width: 30px;
    height: 30px;
    font-size: 13px;
}

/* Add version form (edit panel) */
.add-version-form {
    border: 1px solid var(--border-light);
    border-radius: 8px;
    padding: 14px;
    margin-top: 10px;
    background: var(--surface-elevated);
}

.add-version-form .panel-input {
    margin-bottom: 10px;
}

.version-format-tabs {
    display: flex;
    gap: 6px;
    margin-bottom: 10px;
}

.version-tab {
    flex: 1;
    padding: 6px 8px;
    border: 1px solid var(--border);
    border-radius: 6px;
    background: transparent;
    color: var(--text-secondary);
    font-size: 12px;
    font-family: var(--font-sans);
    cursor: pointer;
    transition: all 0.15s;
}

.version-tab.active {
    border-color: var(--accent);
    color: var(--accent);
    background: color-mix(in srgb, var(--accent) 8%, transparent);
    font-weight: 600;
}

.add-version-form-actions {
    display: flex;
    gap: 8px;
    justify-content: flex-end;
    margin-top: 10px;
}

.btn-sm {
    padding: 6px 14px !important;
    font-size: 13px !important;
}

.btn-copy-from-main {
    background: none;
    border: none;
    color: var(--accent);
    font-size: 12px;
    cursor: pointer;
    padding: 2px 0 8px;
    text-decoration: underline;
    text-underline-offset: 2px;
    display: block;
    font-family: var(--font-sans);
}

.btn-copy-from-main:hover {
    color: var(--accent-light);
}

/*  ==== for uploading songs=== */
.panel-textarea {
    width: 100%;
    min-height: 300px;
    padding: 12px 14px;
    border: 1px solid var(--border);
    border-radius: 8px;
    font-family: var(--font-mono);
    font-size: 13px;
    color: var(--text-primary);
    background: var(--surface);
    transition: all 0.2s ease;
    resize: vertical;
    line-height: 1.5;
}

.panel-textarea:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 10%, transparent);
}

/* File Upload Box */
.file-upload-box {
    width: 100%;
    padding: 40px 20px;
    border: 2px dashed var(--border);
    border-radius: 8px;
    background: var(--surface-hover);
    text-align: center;
    cursor: pointer;
    transition: all 0.2s ease;
}

.file-upload-box:hover {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 5%, transparent);
}

.file-upload-box.has-file {
    border-color: var(--accent);
    background: color-mix(in srgb, var(--accent) 10%, transparent);
}

.file-upload-box i {
    font-size: 32px;
    color: var(--text-tertiary);
    margin-bottom: 12px;
    display: block;
}

.file-upload-box.has-file i {
    color: var(--accent);
}

.file-upload-text {
    font-size: 14px;
    color: var(--text-secondary);
    margin: 0;
}

.file-name-display {
    font-size: 13px;
    color: var(--accent);
    font-weight: 600;
    margin-top: 8px;
    display: none;
}

.file-upload-box.has-file .file-name-display {
    display: block;
}

.file-upload-box.has-file .file-upload-text {
    display: none;
}

/* Color Grid */
.color-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 12px;
    margin: 0 45px;
}

.color-option {
    width: 100%;
    aspect-ratio: 1;
    border: 3px solid transparent;
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    position: relative;
}

.color-option:hover {
    transform: scale(1.06);
    box-shadow: var(--shadow-md);
}

.color-option.active {
    border-color: var(--accent-dark);
}

.color-option.active::after {
    content: '\f00c';
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    color: white;
    font-size: 16px;
    text-shadow: 0 1px 3px rgba(0, 0, 0, 0.3);
}

/* Dark mode toggle row — mirrors .color-grid indent on desktop, collapses on mobile */
.settings-dark-mode-row {
    margin: 0 45px 20px;
}

/* Guide button in settings Help section */
.settings-guide-btn {
    display: flex;
    align-items: center;
    gap: 9px;
    width: 100%;
    padding: 10px 16px;
    background: var(--surface-hover);
    border: 1px solid var(--border);
    border-radius: 10px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    cursor: pointer;
    transition: background 0.15s ease, border-color 0.15s ease;
    text-align: left;
    margin-bottom: 10px;
}

.settings-guide-btn:hover {
    background: var(--surface-elevated);
    border-color: var(--accent);
    color: var(--accent);
}

.settings-guide-btn i {
    font-size: 15px;
    color: var(--accent);
    flex-shrink: 0;
}

/* Settings Sliders */
.settings-group {
    margin-bottom: 24px;
}

.settings-group:last-child {
    margin-bottom: 0;
}


/* Hide instructions panel in settings for larger devices */
.instructions-button-panel {
    display: none;
}

.settings-label {
    display: flex;
    justify-content: space-between;
    align-items: center;
    font-size: 14px;
    font-weight: 500;
    color: var(--text-primary);
    margin-bottom: 10px;
}

.settings-value {
    font-weight: 700;
    color: var(--accent);
    font-family: var(--font-mono);
}

.settings-slider {
    width: 100%;
    height: 6px;
    border-radius: 3px;
    background: var(--border-light);
    outline: none;
    -webkit-appearance: none;
    appearance: none;
}

.settings-slider::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    transition: all 0.2s ease;
}

.settings-slider::-webkit-slider-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 15%, transparent);
}

.settings-slider::-moz-range-thumb {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    background: var(--accent);
    cursor: pointer;
    border: none;
    transition: all 0.2s ease;
}

.settings-slider::-moz-range-thumb:hover {
    transform: scale(1.2);
    box-shadow: 0 0 0 6px color-mix(in srgb, var(--accent) 15%, transparent);
}

/* Button Variants */
.btn-primary {
    background: var(--accent);
    color: white;
}

.btn-primary:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

.btn-secondary {
    background: var(--surface);
    color: var(--text-primary);
    border: 1px solid var(--border);
}

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

.btn-danger {
    background: #e64555;
    color: white;
}

.btn-danger:hover {
    background: #db3142;
    transform: translateY(-1px);
    box-shadow: var(--shadow-md);
}

/* ── Account Section (Settings Panel) ── */
.account-user-info {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 10px 14px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 10px;
}

.account-user-icon {
    font-size: 1.3rem;
    color: var(--accent);
    flex-shrink: 0;
}

.account-username-text {
    font-size: 0.95rem;
    font-weight: 600;
    color: var(--text-primary);
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.account-change-item {
    border: 1px solid var(--border);
    border-radius: 8px;
    margin-bottom: 8px;
    overflow: hidden;
}

.account-change-trigger {
    width: 100%;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 11px 14px;
    background: var(--surface);
    border: none;
    cursor: pointer;
    font-size: 0.875rem;
    font-family: var(--font-sans);
    color: var(--text-primary);
    transition: background 0.15s ease;
}

.account-change-trigger:hover {
    background: var(--surface-hover);
}

.account-change-trigger > span {
    display: flex;
    align-items: center;
    gap: 8px;
}

.account-trigger-chevron {
    font-size: 0.7rem;
    color: var(--text-tertiary);
    transition: transform 0.2s ease;
}

.account-change-item.open .account-trigger-chevron {
    transform: rotate(180deg);
}

.account-change-form {
    display: none;
    padding: 12px 14px 14px;
    background: var(--background);
    border-top: 1px solid var(--border);
}

.account-change-item.open .account-change-form {
    display: block;
}

.account-input {
    width: 100%;
    padding: 9px 12px;
    margin-bottom: 8px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
    color: var(--text-primary);
    font-size: 0.875rem;
    font-family: var(--font-sans);
    box-sizing: border-box;
    transition: border-color 0.15s ease, box-shadow 0.15s ease;
}

.account-input:focus {
    outline: none;
    border-color: var(--accent);
    box-shadow: 0 0 0 3px color-mix(in srgb, var(--accent) 18%, transparent);
}

.account-input::placeholder {
    color: var(--text-tertiary);
}

.account-form-actions {
    display: flex;
    gap: 8px;
    margin-top: 2px;
}

.account-form-actions .btn {
    flex: 1;
}

.account-actions {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 10px;
}

.account-google-status {
    font-size: 0.8rem;
    color: var(--text-secondary);
    margin-bottom: 8px;
    padding: 6px 10px;
    background: var(--surface);
    border: 1px solid var(--border);
    border-radius: 6px;
}

.account-actions .btn {
    width: 100%;
}

/* Edit Panel Specific Fixes */
.edit-dropdown {
    width: 100%;
    margin-left: 0;
    height: 42px;
    position: relative;
    z-index: 10;
}

.edit-dropdown .menu {
    width: 100%;
    left: 0;
    right: auto;
    z-index: 1001;
    max-height: 38vh;
}

.panel-footer .btn {
    flex: 1;
    min-width: 0;
}

.panel-footer .btn-secondary {
    flex: 1.2;
}

.panel-footer .btn-danger {
    flex: 1;
}

.panel-footer .btn-primary {
    flex: 1.2;
}

/* ======================= DOWNLOAD DIALOG ======================= */
@keyframes dialog-pop {
    from { opacity: 0; transform: scale(0.95) translateY(8px); }
    to   { opacity: 1; transform: scale(1)    translateY(0);   }
}

.dialog-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.45);
    display: flex;
    align-items: center;
    justify-content: center;
    z-index: 1000;
    opacity: 0;
    visibility: hidden;
    pointer-events: none;
    transition: opacity 0.2s ease, visibility 0.2s ease;
}

.dialog-overlay.active {
    opacity: 1;
    visibility: visible;
    pointer-events: auto;
}

.dialog-overlay.active .dialog-box,
.dialog-overlay.active .download-format-dialog {
    animation: dialog-pop 0.22s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.dialog-box {
    background: var(--surface-elevated);
    border-radius: 12px;
    box-shadow: var(--shadow-lg);
    width: 90%;
    max-width: 460px;
    overflow: hidden;
}

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

.dialog-header h3 {
    font-size: 18px;
    font-weight: 600;
    color: var(--text-primary);
    margin: 0;
}

.dialog-close {
    width: 32px;
    height: 32px;
}

.dialog-content {
    padding: 24px;
}

.dialog-message {
    font-size: 14px;
    color: var(--text-secondary);
    margin-bottom: 20px;
}

.download-options {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.download-option-btn {
    display: flex;
    align-items: center;
    gap: 16px;
    padding: 18px 20px;
    background: var(--surface);
    border: 2px solid var(--border);
    border-radius: 10px;
    cursor: pointer;
    transition: all 0.2s ease;
    font-family: var(--font-sans);
    font-size: 15px;
    font-weight: 500;
    color: var(--text-primary);
}

.download-option-btn:hover {
    background: var(--surface-hover);
    border-color: var(--accent);
    transform: translateY(-2px);
    box-shadow: var(--shadow-md);
}

.download-option-btn i {
    font-size: 24px;
    color: var(--accent);
}

.download-option-btn span {
    flex: 1;
    text-align: left;
}


/* ======================= DOWNLOAD FORMAT DIALOG ======================= */

.download-format-dialog {
    background: var(--surface);
    border-radius: 16px;
    box-shadow: var(--shadow-lg);
    width: 100%;
    max-width: 420px;
    overflow: hidden;
}


/* Buttons */
.btn-content-save {
    background: var(--accent);
    color: white;
    border: none;
    padding: 10px 24px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    display: flex;
    align-items: center;
    gap: 8px;
}

.btn-content-save:hover {
    background: var(--accent-dark);
    transform: translateY(-1px);
}

.btn-content-save:active {
    transform: translateY(0);
}

.btn-content-save:disabled {
    background: var(--text-tertiary);
    cursor: not-allowed;
    transform: none;
}

.btn-content-cancel {
    background: transparent;
    color: var(--text-secondary);
    border: 1px solid var(--border);
    padding: 10px 24px;
    border-radius: 8px;
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
}

.btn-content-cancel:hover {
    background: var(--surface-hover);
    border-color: var(--text-secondary);
}



input[type="range"],
input[type="checkbox"],
select {
    user-select: auto;
}



/* ======================= COLLECTION AUTO-DELETE TOGGLE ROW ======================= */
.collection-autodelete-toggle-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 16px;
}

.collection-autodelete-toggle-info {
    display: flex;
    flex-direction: column;
    gap: 4px;
    flex: 1;
}

/* ======================= TOGGLE SWITCH ======================= */
.toggle-switch {
    position: relative;
    display: inline-block;
    width: 44px;
    height: 24px;
    flex-shrink: 0;
}

.toggle-switch input {
    opacity: 0;
    width: 0;
    height: 0;
}

.toggle-slider {
    position: absolute;
    cursor: pointer;
    inset: 0;
    background: var(--border);
    border-radius: 24px;
    transition: 0.2s;
}

.toggle-slider:before {
    content: '';
    position: absolute;
    width: 18px;
    height: 18px;
    left: 3px;
    bottom: 3px;
    background: white;
    border-radius: 50%;
    transition: 0.2s;
}

.toggle-switch input:checked+.toggle-slider {
    background: var(--accent);
}

.toggle-switch input:checked+.toggle-slider:before {
    transform: translateX(20px);
}

/* ======================= DATETIME INPUT ======================= */
/* Fix calendar icon being invisible in dark mode */
.autodelete-datetime {
    color-scheme: light;
}

body.dark-mode .autodelete-datetime {
    color-scheme: dark;
    /* Override panel-input colors so text stays readable */
    color: var(--text-primary);
    background: var(--surface-elevated);
}

/* ======================= AUTO-DELETE BADGE IN COLLECTION LIST ======================= */
.collection-autodelete-badge {
    font-size: 11px;
    color: var(--text-tertiary);
    margin-left: 6px;
    white-space: nowrap;
}

.collection-autodelete-badge.soon {
    color: #e67e22;
}


/* ======================= FONT PICKER ======================= */
.font-picker {
    display: flex;
    flex-direction: column;
    gap: 8px;
    margin-top: 6px;
}

.font-option {
    background: var(--surface-hover);
    border: 2px solid var(--border);
    border-radius: 8px;
    padding: 10px 14px;
    font-size: 14px;
    color: var(--text-primary);
    cursor: pointer;
    text-align: left;
    transition: border-color 0.15s, background 0.15s;
}

.font-option:hover {
    border-color: var(--accent);
    background: var(--surface);
}

.font-option.active {
    border-color: var(--accent);
    background: var(--surface);
    color: var(--accent);
}


/* ======================= SETTINGS SELECT ======================= */
.settings-select {
    width: 100%;
    margin-top: 6px;
    padding: 9px 12px;
    background: var(--surface-hover);
    border: 2px solid var(--border);
    border-radius: 8px;
    font-size: 14px;
    font-family: var(--font-sans);
    color: var(--text-primary);
    cursor: pointer;
    appearance: none;
    -webkit-appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2380868b' d='M6 8L1 3h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    transition: border-color 0.15s;
}

.settings-select:hover,
.settings-select:focus {
    border-color: var(--accent);
    outline: none;
}

/* Make dropdown options readable in dark mode */
.settings-select option {
    background: var(--surface);
    color: var(--text-primary);
}

/* Two-column inner grid for PDF settings */
.pdf-settings-inner-grid {
    display: grid;
    grid-template-columns: 1fr 1fr;
    gap: 0 20px;
    margin-bottom: 16px;
}

/* ======================= EMPTY STATE ======================= */
.empty-state {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 36px 20px;
    gap: 0;
    text-align: center;
    pointer-events: none;
    user-select: none;
    width: 100%;
    box-sizing: border-box;
}

/* When the lyrics display shows an empty state, override its max-content
   width so the empty state stretches to fill the full panel. */
#lyrics-display:has(.empty-state) {
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.empty-state-icon {
    width: 48px;
    height: 48px;
    border-radius: 12px;
    background: color-mix(in srgb, var(--text-tertiary) 9%, transparent);
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    color: var(--text-tertiary);
    margin-bottom: 14px;
    flex-shrink: 0;
}

.empty-state-title {
    font-family: var(--font-sans);
    font-size: 14px;
    font-weight: 600;
    color: var(--text-secondary);
    margin: 0 0 5px;
    line-height: 1.4;
    text-align: center;
}

.empty-state-sub {
    font-family: var(--font-sans);
    font-size: 12px;
    color: var(--text-tertiary);
    margin: 0;
    line-height: 1.5;
    max-width: 220px;
    text-align: center;
}
/* Simplify chords hidden from UI — functionality preserved */
#simplify-chords, #overflow-simplify { display: none !important; }
