/* ============================================
   UNIFIED SONG DISPLAY CSS
   Provides consistent styling for:
   - Editor preview panel
   - Song view page (song/view.html.twig)
   - Songs view page (songs/view.html.twig)
   ============================================ */

/* ===== CSS VARIABLES ===== */
:root {
    --usd-primary: #4285f4;
    --usd-primary-hover: #357ae8;
    --usd-secondary: #6c757d;
    --usd-secondary-hover: #5a6268;
    --usd-success: #28a745;
    --usd-warning: #ffc107;
    --usd-danger: #dc3545;
    --usd-text: #212529;
    --usd-text-muted: #6c757d;
    --usd-border: #dee2e6;
    --usd-border-light: #e9ecef;
    --usd-bg: #f8f9fa;
    --usd-bg-white: #ffffff;
    --usd-chord-color: #0066cc;
    --usd-section-color: #ff9900;
    --usd-radius: 6px;
    --usd-radius-sm: 4px;
    --usd-shadow: 0 2px 4px rgba(0,0,0,0.05);
    --usd-shadow-lg: 0 4px 12px rgba(0,0,0,0.1);
}

/* ===== CONTROLS BAR ===== */
.controls,
.song-controls {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    padding: 0;
    background: var(--usd-bg);
    border-bottom: 1px solid var(--usd-border);
    flex-wrap: wrap;
}

/* Transpose Controls */
.transpose-controls {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    background: var(--usd-bg-white);
    padding: 0.25rem;
    border-radius: var(--usd-radius);
    border: 1px solid var(--usd-border);
}

.transpose-controls button {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--usd-border);
    background: var(--usd-bg-white);
    border-radius: var(--usd-radius-sm);
    cursor: pointer;
    font-size: 1.125rem;
    font-weight: 500;
    color: var(--usd-text);
    transition: all 0.2s;
}

.transpose-controls button:hover {
    background: var(--usd-bg);
    border-color: var(--usd-secondary);
}

.transpose-controls button:active {
    transform: scale(0.95);
}

.transpose-value {
    min-width: 2.5rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.9375rem;
    color: var(--usd-text);
}

/* Text Size Controls */
.text-zoom-controls,
.text-size-group {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
}

.text-zoom-btn {
    padding: 0.375rem 0.625rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--usd-border);
    background: var(--usd-bg-white);
    border-radius: var(--usd-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.text-zoom-btn:hover {
    background: var(--usd-bg);
    border-color: var(--usd-secondary);
}

.text-zoom-value {
    min-width: 3rem;
    text-align: center;
    font-weight: 600;
    font-size: 0.875rem;
    color: var(--usd-text-muted);
}

/* Layout Controls */
.layout-controls,
.layout-group {
    display: inline-flex;
    align-items: center;
}

.layout-toggle-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    border: 1px solid var(--usd-border);
    background: var(--usd-bg-white);
    border-radius: var(--usd-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.layout-toggle-btn:hover {
    background: var(--usd-bg);
    border-color: var(--usd-secondary);
}

.layout-toggle-btn[aria-pressed="true"] {
    background: var(--usd-primary);
    color: white;
    border-color: var(--usd-primary);
}

/* Display Controls Group */
.display-controls {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    margin-left: auto;
}

.display-controls .btn {
    padding: 0.375rem 0.625rem;
    font-size: 0.8125rem;
}

/* Capo Controls */
.capo-group {
    display: inline-flex;
    align-items: center;
}

/* Settings Toggle */
.settings-toggle-btn {
    width: 32px;
    height: 32px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    border: 1px solid var(--usd-border);
    background: var(--usd-bg-white);
    border-radius: var(--usd-radius-sm);
    cursor: pointer;
    font-size: 1rem;
    transition: all 0.2s;
}

.settings-toggle-btn:hover {
    background: var(--usd-bg);
    border-color: var(--usd-secondary);
}

/* Reset Button */
.btn-sm,
.reset-btn {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--usd-bg);
    color: var(--usd-text);
    border: 1px solid var(--usd-border);
    border-radius: var(--usd-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.btn-sm:hover,
.reset-btn:hover {
    background: var(--usd-border-light);
    border-color: var(--usd-secondary);
}

.btn-sm.active {
    background: var(--usd-primary);
    color: white;
    border-color: var(--usd-primary);
}

.btn-sm.active:hover {
    background: var(--usd-primary-hover);
    border-color: var(--usd-primary-hover);
}

/* Print Button */
.print-btn,
#print-button {
    padding: 0.375rem 0.75rem;
    font-size: 0.875rem;
    font-weight: 500;
    background: var(--usd-primary);
    color: white;
    border: 1px solid var(--usd-primary);
    border-radius: var(--usd-radius-sm);
    cursor: pointer;
    transition: all 0.2s;
}

.print-btn:hover,
#print-button:hover {
    background: var(--usd-primary-hover);
    border-color: var(--usd-primary-hover);
}

/* ===== SONG CONTENT DISPLAY ===== */
.song-content,
#song-content,
.preview,
.mobile-preview {
    font-size: calc(1rem * var(--editor-text-scale, 1));
    /* Line height can be set directly via inline style or via CSS variable */
    line-height: var(--editor-line-height, 1.8);
    color: var(--usd-text);
    max-width: none; /* No max-width constraint */
    margin: 0; /* No margin - align to left */
    word-wrap: break-word; /* Break long words if needed */
    overflow-wrap: break-word; /* Modern property */
}

/* Preserve spacing in editor and preview */
.preview,
.mobile-preview,
.song-content,
#song-content {
    white-space: pre-wrap;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
}

.song-content p,
#song-content p,
.preview p,
.mobile-preview p {
    margin-bottom: 0.75em;
}

/* Chord Highlighting - Consistent across all views */
.chord-highlight {
    color: var(--usd-chord-color);
    font-weight: bold;
    font-family: 'Courier New', Courier, monospace;
    display: inline;
}

/* Section Labels - Consistent across all views */
.section-label {
    color: var(--usd-section-color);
    font-weight: 700;
    display: block;
    margin: 5px 0;
    padding: 0;
    font-size: 1.0625rem;
    text-transform: uppercase;
    letter-spacing: 0.025em;
}

/* Two Column Layout - CRITICAL: height must be defined for scrolling to work with column-fill: auto */
body.two-columns .song-content,
body.two-columns #song-content,
body.two-columns .preview,
body.two-columns .mobile-preview,
.song-display.two-columns .song-content,
.song-display.two-columns #song-content,
.preview.two-columns,
.mobile-preview.two-columns,
.song-content.two-columns,
#song-content.two-columns {
    column-count: 2;
    column-gap: 10px;
    column-fill: auto;
    max-width: 100%;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    /* For multi-column scrolling to work, constrain height via flex */
    flex: 1 1 0;
    min-height: 0;
    max-height: 100%;
    /* Prevent horizontal overflow - force text wrapping */
    word-wrap: break-word;
    overflow-wrap: break-word;
    white-space: pre-wrap;
}

/* ===== TRANSLATION BAR ===== */
.translation-bar {
    background: var(--usd-bg);
    border-bottom: 1px solid var(--usd-border);
    padding: 0.75rem 0;
}

.translation-bar-container {
    display: flex;
    justify-content: space-between;
    align-items: center;
    gap: 1rem;
    max-width: 1400px;
    margin: 0 auto;
    padding: 0 1rem;
}

.translation-info {
    display: flex;
    align-items: center;
    gap: 0.75rem;
    flex: 1;
    flex-wrap: wrap;
}

.current-language {
    display: inline-flex;
    align-items: center;
    gap: 0.375rem;
    padding: 0.375rem 0.75rem;
    background: linear-gradient(135deg, #FFD700, #FFC107);
    color: #333;
    font-weight: 600;
    font-size: 0.875rem;
    border-radius: 20px;
    border: 1px solid rgba(255, 193, 7, 0.3);
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    white-space: nowrap;
}

.language-icon {
    font-size: 1rem;
}

.translation-separator {
    color: var(--usd-text-muted);
}

.translation-label {
    color: var(--usd-text-muted);
    font-size: 0.875rem;
    white-space: nowrap;
}

.translation-links-wrapper {
    display: flex;
    align-items: center;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.translation-links {
    display: flex;
    gap: 0.5rem;
    flex-wrap: wrap;
}

.translation-toggle { display: none; }
.translation-drawer { display: none; }

.translation-link {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.375rem 0.75rem;
    background: var(--usd-bg-white);
    border: 1px solid var(--usd-border);
    border-radius: 20px;
    text-decoration: none;
    color: var(--usd-text);
    font-size: 0.875rem;
    transition: all 0.2s;
    white-space: nowrap;
}

.translation-link:hover {
    background: #e3f2fd;
    border-color: #90caf9;
    color: #1976d2;
    transform: translateY(-1px);
    box-shadow: var(--usd-shadow);
}

.translation-actions {
    display: flex;
    align-items: center;
}

.btn-manage-translations {
    display: inline-flex;
    align-items: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: white;
    border: none;
    border-radius: 25px;
    font-size: 0.875rem;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(102, 126, 234, 0.3);
    white-space: nowrap;
}

.btn-manage-translations:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 25px rgba(102, 126, 234, 0.4);
}

/* ===== DISPLAY SETTINGS PANEL ===== */
.display-settings-panel {
    position: fixed;
    top: 50%;
    right: 1rem;
    transform: translateY(-50%);
    background: var(--usd-bg-white);
    border-radius: var(--usd-radius);
    box-shadow: var(--usd-shadow-lg);
    border: 1px solid var(--usd-border);
    z-index: 100;
    width: 260px;
    max-height: 52vh; /* Reduced from 80vh by 35% */
    overflow-y: auto;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.2s, visibility 0.2s;
    display: none;
}

.display-settings-panel[aria-hidden="false"] {
    opacity: 1;
    visibility: visible;
    display: flex;
    flex-direction: column;
}

/* Fullscreen mobile mode */
.display-settings-panel.fullscreen-mobile {
    position: fixed;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
    width: 100% !important;
    height: 100vh !important;
    max-height: 100vh !important;
    transform: none !important;
    border-radius: 0;
    z-index: 1000;
    display: flex;
    flex-direction: column;
}

.settings-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.5rem 0.75rem; /* Reduced from 1rem */
    border-bottom: 1px solid var(--usd-border);
    position: relative;
    flex-shrink: 0;
}

.settings-header h4 {
    margin: 0;
    font-size: 0.875rem; /* Reduced from 1rem */
    font-weight: 600;
    flex: 1;
}

.settings-header .fullscreen-btn {
    width: 28px; /* Reduced from 32px */
    height: 28px;
    display: none;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: 1px solid var(--usd-border);
    border-radius: var(--usd-radius-sm);
    font-size: 1rem; /* Reduced from 1.125rem */
    color: var(--usd-text-muted);
    cursor: pointer;
    transition: all 0.2s;
    margin-right: 0.5rem;
}

.settings-header .fullscreen-btn:hover {
    background: var(--usd-bg);
    border-color: var(--usd-primary);
    color: var(--usd-primary);
}

/* Red X for fullscreen close */
.display-settings-panel.fullscreen-mobile .close-btn {
    background: #dc3545;
    color: white;
    width: 36px;
    height: 36px;
    font-size: 1.5rem;
    border-radius: 50%;
}

.display-settings-panel.fullscreen-mobile .close-btn:hover {
    background: #c82333;
}

.settings-header .close-btn {
    width: 24px; /* Reduced from 28px */
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background: transparent;
    border: none;
    border-radius: var(--usd-radius-sm);
    font-size: 1.125rem; /* Reduced from 1.25rem */
    color: var(--usd-text-muted);
    cursor: pointer;
    transition: all 0.2s;
}

.settings-header .close-btn:hover {
    background: var(--usd-bg);
    color: var(--usd-text);
}

.settings-body {
    padding: 0.5rem 0.75rem; /* Reduced from 1rem */
    display: block;
    flex: 1;
    overflow-y: auto;
}

/* Show fullscreen content with proper column layout */
.display-settings-panel.fullscreen-mobile .settings-body {
    padding: 1rem;
    overflow-y: auto;
}

/* Fullscreen song wrapper */
.fullscreen-song-wrapper {
    margin-top: 1.5rem;
    padding-top: 1.5rem;
    border-top: 2px solid var(--usd-border);
}

.fullscreen-song-wrapper .song-content,
.fullscreen-song-wrapper #fullscreen-song-content {
    width: 100%;
    max-width: none;
    padding: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif !important;
    white-space: pre-wrap;
    line-height: 1.6;
}

/* Two column layout in fullscreen wrapper */
.fullscreen-song-wrapper.two-columns .song-content,
.fullscreen-song-wrapper.two-columns #fullscreen-song-content {
    column-count: 2;
    column-gap: 10px;
    column-rule: 1px solid var(--usd-border-light);
}

.settings-row {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 0.4rem 0; /* Reduced from 0.75rem */
    border-bottom: 1px solid var(--usd-border-light);
}

.settings-row:last-child {
    border-bottom: none;
}

.settings-row span {
    font-size: 0.8125rem; /* Slightly reduced */
    color: var(--usd-text);
}

.settings-actions {
    display: flex;
    gap: 0.375rem; /* Reduced from 0.5rem */
    align-items: center;
}

.settings-actions .btn {
    padding: 0.25rem 0.4rem; /* Reduced padding */
    font-size: 0.75rem; /* Reduced font size */
}

.settings-actions .text-zoom-value,
.settings-actions .line-spacing-value {
    min-width: 2.5rem; /* Reduced from 3rem */
    text-align: center;
    font-weight: 600;
    font-size: 0.8125rem; /* Slightly reduced */
    color: var(--usd-text-muted);
}

/* ===== CAPO MODAL ===== */
#capo-modal .modal-body {
    text-align: center;
}

#capo-modal label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 500;
}

#capo-modal input[type="range"] {
    width: 100%;
    margin-bottom: 0.5rem;
}

.capo-value {
    font-size: 1.25rem;
    font-weight: 600;
    color: var(--usd-primary);
}

/* ===== MODALS ===== */
.modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

.modal.show {
    display: flex;
}

.modal-content {
    background: var(--usd-bg-white);
    border-radius: var(--usd-radius);
    box-shadow: var(--usd-shadow-lg);
    max-width: 500px;
    width: 90%;
    max-height: 90vh;
    overflow-y: auto;
    animation: modalSlideIn 0.2s ease;
}

.modal-content.modal-lg {
    max-width: 700px;
}

@keyframes modalSlideIn {
    from {
        transform: translateY(-20px);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}

.modal-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 1.25rem 1.5rem;
    border-bottom: 1px solid var(--usd-border);
}

.modal-header h2,
.modal-header h3 {
    margin: 0;
    font-size: 1.25rem;
    font-weight: 600;
}

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

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

.modal-body {
    padding: 1.5rem;
}

.modal-actions {
    display: flex;
    gap: 0.75rem;
    justify-content: flex-end;
    padding: 1.25rem 1.5rem;
    border-top: 1px solid var(--usd-border);
}

/* ===== BUTTONS ===== */
.btn {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 0.5rem;
    padding: 0.5rem 1rem;
    font-size: 0.9375rem;
    font-weight: 500;
    border: none;
    border-radius: var(--usd-radius);
    cursor: pointer;
    text-decoration: none;
    transition: all 0.2s;
}

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

.btn-primary:hover {
    background: var(--usd-primary-hover);
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(66, 133, 244, 0.3);
}

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

.btn-secondary:hover {
    background: var(--usd-secondary-hover);
    transform: translateY(-1px);
}

.btn:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none;
}

/* ===== TOAST NOTIFICATIONS ===== */
.toast {
    position: fixed;
    bottom: 2rem;
    right: 2rem;
    padding: 1rem 1.5rem;
    border-radius: var(--usd-radius);
    box-shadow: var(--usd-shadow-lg);
    color: white;
    font-size: 0.9375rem;
    z-index: 2000;
    opacity: 0;
    visibility: hidden;
    transform: translateY(20px);
    transition: all 0.3s ease;
}

.toast.show {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.toast.success {
    background: var(--usd-success);
}

.toast.error {
    background: var(--usd-danger);
}

.toast.info {
    background: var(--usd-primary);
}

/* ===== FORM ELEMENTS ===== */
.form-group {
    margin-bottom: 1.25rem;
}

.form-group label {
    display: block;
    margin-bottom: 0.5rem;
    font-weight: 500;
    color: var(--usd-text);
}

.form-control {
    width: 100%;
    padding: 0.625rem 0.875rem;
    font-size: 1rem;
    border: 1px solid var(--usd-border);
    border-radius: var(--usd-radius-sm);
    transition: border-color 0.2s, box-shadow 0.2s;
}

.form-control:focus {
    outline: none;
    border-color: var(--usd-primary);
    box-shadow: 0 0 0 3px rgba(66, 133, 244, 0.1);
}

.form-control:disabled {
    background: var(--usd-bg);
    cursor: not-allowed;
}

.form-text {
    display: block;
    margin-top: 0.375rem;
    font-size: 0.8125rem;
    color: var(--usd-text-muted);
}

.help-text {
    color: var(--usd-text-muted);
    font-size: 0.9375rem;
    margin-bottom: 1.25rem;
    line-height: 1.5;
}

/* ===== SEARCH RESULTS ===== */
.search-results {
    max-height: 250px;
    overflow-y: auto;
    border: 1px solid var(--usd-border);
    border-radius: var(--usd-radius-sm);
    margin-bottom: 1.25rem;
    background: var(--usd-bg-white);
}

.search-results:empty {
    display: none;
}

.search-result-item {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid var(--usd-border-light);
    cursor: pointer;
    transition: background 0.2s;
}

.search-result-item:last-child {
    border-bottom: none;
}

.search-result-item:hover {
    background: var(--usd-bg);
}

.search-result-item.selected {
    background: #e3f2fd;
    border-left: 3px solid var(--usd-primary);
    padding-left: calc(1rem - 3px);
}

.search-result-title {
    font-weight: 500;
    color: var(--usd-text);
    margin-bottom: 0.25rem;
}

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

/* ===== FLAG ICONS ===== */
.flag-icon {
    width: 20px;
    height: 15px;
    border-radius: 2px;
    object-fit: cover;
    box-shadow: 0 0 1px rgba(0,0,0,0.2);
}

/* ===== PRIVACY BADGE ===== */
.privacy-badge {
    display: inline-flex;
    align-items: center;
    gap: 0.25rem;
    padding: 0.25rem 0.75rem;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 500;
}

.privacy-badge.public {
    background: #d4edda;
    color: #155724;
}

.privacy-badge.private {
    background: #f8d7da;
    color: #721c24;
}

/* Helper classes */
.mobile-only {
    display: none;
}

/* Content fullscreen button */
.content-fullscreen-btn {
    position: absolute !important;
    top: 0.5rem !important;
    right: 0.5rem !important;
    width: 32px !important;
    height: 32px !important;
    background: rgba(255,255,255,0.95) !important;
    border: 1px solid var(--usd-border) !important;
    border-radius: var(--usd-radius-sm) !important;
    cursor: pointer !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    font-size: 1rem !important;
    z-index: 10 !important;
    transition: all 0.2s !important;
    color: var(--usd-text) !important;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1) !important;
}

.content-fullscreen-btn:hover {
    background: var(--usd-bg) !important;
    border-color: var(--usd-primary) !important;
    color: var(--usd-primary) !important;
    transform: scale(1.05) !important;
}

/* Fullscreen mode styles */
#song-content:fullscreen,
.song-content:fullscreen {
    padding: 2rem;
    background: white;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    box-sizing: border-box;
}

#song-content:fullscreen .content-fullscreen-btn,
.song-content:fullscreen .content-fullscreen-btn {
    top: 1rem !important;
    right: 1rem !important;
    position: fixed !important;
}

/* Mobile preview fullscreen styles */
.mobile-preview:fullscreen,
.preview:fullscreen {
    padding: 2rem;
    background: white;
    overflow-y: auto !important;
    overflow-x: hidden !important;
    width: 100vw;
    height: 100vh;
    max-width: 100vw;
    box-sizing: border-box;
}

.mobile-preview:fullscreen .content-fullscreen-btn,
.preview:fullscreen .content-fullscreen-btn {
    top: 1rem !important;
    right: 1rem !important;
    position: fixed !important;
}

/* Two column layout in fullscreen - allow scrolling */
#song-content:fullscreen.two-columns,
.song-content:fullscreen.two-columns,
.mobile-preview:fullscreen.two-columns,
.preview:fullscreen.two-columns {
    column-count: 2;
    column-gap: 10px;
    column-fill: auto;
    /* CRITICAL: Use fixed height to enable scrolling in multi-column */
    height: 100vh !important;
    max-height: 100vh !important;
    overflow-y: auto !important;
    overflow-x: hidden !important;
}

@media (max-width: 768px) {
    .mobile-only {
        display: initial;
    }
}

/* ===== MOBILE RESPONSIVE ===== */
@media (max-width: 768px) {
    .controls,
    .song-controls {
        padding: 0.5rem 0.75rem;
        gap: 0.5rem;
    }

    .transpose-controls {
        padding: 0.125rem;
    }

    .transpose-controls button {
        width: 28px;
        height: 28px;
        font-size: 1rem;
    }

    .transpose-value {
        min-width: 2rem;
        font-size: 0.875rem;
    }

    .display-controls {
        width: 100%;
        justify-content: flex-end;
        margin-top: 0.5rem;
        margin-left: 0;
    }

    .display-controls .btn {
        padding: 0.25rem 0.5rem;
        font-size: 0.75rem;
    }

    .text-zoom-controls,
    .layout-controls,
    .capo-group {
        display: none;
    }

    .settings-toggle-btn {
        display: inline-flex;
    }
    
    /* Show fullscreen button on mobile */
    .settings-header .fullscreen-btn.mobile-only {
        display: flex;
    }
    
    /* Mobile fullscreen adjustments */
    .display-settings-panel.fullscreen-mobile {
        padding-top: env(safe-area-inset-top);
    }

    .translation-bar-container {
        flex-direction: column;
        align-items: stretch;
        gap: 0.75rem;
    }

    /* Mobile: whole translation-info scrolls as one row */
    .translation-info {
        width: 100%;
        flex-wrap: nowrap;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
        scrollbar-width: none;
        -ms-overflow-style: none;
    }
    .translation-info::-webkit-scrollbar { display: none; }

    .translation-links-wrapper {
        width: auto;
        flex-shrink: 0;
    }

    .translation-links {
        flex-wrap: nowrap;
        overflow: visible;
    }

    .scroll-arrow-right { display: none; }

    .translation-link { flex-shrink: 0; }

    /* Mobile toggle button */
    .translation-toggle {
        display: flex;
        align-items: center;
        gap: 4px;
        background: #f0f4ff;
        border: 1px solid #c8d8ff;
        border-radius: 16px;
        padding: 0.25rem 0.6rem;
        font-size: 0.75rem;
        color: #1976d2;
        cursor: pointer;
        white-space: nowrap;
        flex-shrink: 0;
        user-select: none;
        -webkit-tap-highlight-color: transparent;
    }
    .translation-toggle:active { background: #dce8ff; }
    .translation-toggle .toggle-arrow {
        font-size: 0.6rem;
        transition: transform 0.2s;
        display: inline-block;
    }
    .translation-toggle.open .toggle-arrow { transform: rotate(180deg); }

    /* Collapsible drawer */
    .translation-drawer {
        display: none;
        flex-wrap: wrap;
        gap: 0.5rem;
        padding: 0.6rem 1rem 0.75rem;
        background: #f8f9ff;
        border-top: 1px solid #e0e6f0;
    }
    .translation-drawer.open { display: flex; }
    .translation-drawer .translation-link {
        font-size: 0.8rem;
        padding: 0.3rem 0.65rem;
    }

    /* Hide inline pills when drawer is open */
    .translation-info.drawer-open .translation-links-wrapper { display: none; }
    .translation-info.drawer-open .translation-separator,
    .translation-info.drawer-open .translation-label { display: none; }

    .translation-actions {
        width: 100%;
        flex-shrink: 0;
    }

    .btn-manage-translations {
        width: 100%;
        justify-content: center;
    }

    .display-settings-panel {
        right: 0;
        left: 0;
        top: auto;
        bottom: 0;
        transform: none;
        width: 100%;
        max-height: 60vh;
        border-radius: var(--usd-radius) var(--usd-radius) 0 0;
    }

    .toast {
        left: 1rem;
        right: 1rem;
        bottom: 1rem;
        max-width: calc(100% - 2rem);
    }

    .modal-content {
        width: 95%;
        margin: 1rem;
    }

    .modal-actions {
        flex-direction: column;
    }

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

    .song-content,
    #song-content {
        padding: 1rem;
        font-size: 0.9375rem;
        line-height: 1.7;
    }

    .two-columns .song-content,
    .two-columns #song-content {
        column-count: 1;
    }

    .section-label {
        font-size: 1rem;
        margin: 5px 0;
        padding: 0;
    }

    .chord-highlight {
        font-size: 0.875rem;
    }
}

/* ===== PRINT STYLES ===== */
@media print {
    .controls,
    .song-controls,
    .translation-bar,
    .display-settings-panel,
    .toast,
    .modal,
    .btn,
    .settings-toggle-btn {
        display: none !important;
    }

    .song-content,
    #song-content {
        padding: 0;
    }

    .chord-highlight {
        color: #0066cc !important;
    }

    .section-label {
        color: black !important;
        margin: 5px 0 !important;
        padding: 0 !important;
    }
}

/* ===== CAPO MODAL STYLES ===== */
#capo-modal {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    align-items: center;
    justify-content: center;
}

#capo-modal .modal-content {
    background: var(--usd-bg-white, #ffffff);
    border-radius: var(--usd-radius, 6px);
    box-shadow: var(--usd-shadow-lg, 0 4px 12px rgba(0,0,0,0.1));
    max-width: 400px;
    width: 90%;
    animation: modalSlideIn 0.2s ease;
}

#capo-modal .modal-body {
    padding: 1.5rem;
    text-align: center;
}

#capo-modal .modal-body label {
    display: block;
    margin-bottom: 1rem;
    font-weight: 500;
    color: var(--usd-text, #212529);
}

#capo-modal input[type="range"] {
    width: 100%;
    margin-bottom: 1rem;
    -webkit-appearance: none;
    appearance: none;
    height: 8px;
    background: var(--usd-border, #dee2e6);
    border-radius: 4px;
    outline: none;
}

#capo-modal input[type="range"]::-webkit-slider-thumb {
    -webkit-appearance: none;
    appearance: none;
    width: 20px;
    height: 20px;
    background: var(--usd-primary, #4285f4);
    border-radius: 50%;
    cursor: pointer;
    transition: background 0.2s;
}

#capo-modal input[type="range"]::-webkit-slider-thumb:hover {
    background: var(--usd-primary-hover, #357ae8);
}

#capo-modal input[type="range"]::-moz-range-thumb {
    width: 20px;
    height: 20px;
    background: var(--usd-primary, #4285f4);
    border-radius: 50%;
    cursor: pointer;
    border: none;
}

#capo-modal .capo-value {
    font-size: 1.5rem;
    font-weight: 600;
    color: var(--usd-primary, #4285f4);
    margin-top: 0.5rem;
}

/* ===== CAPO BUTTON IN CONTROLS - Grey background to match other buttons ===== */
.controls .btn.btn-secondary.btn-sm,
.controls button.btn.btn-secondary.btn-sm {
    background: var(--usd-bg, #f8f9fa);
    color: var(--usd-text, #212529);
    border: 1px solid var(--usd-border, #dee2e6);
}

.controls .btn.btn-secondary.btn-sm:hover,
.controls button.btn.btn-secondary.btn-sm:hover {
    background: var(--usd-border-light, #e9ecef);
    border-color: var(--usd-secondary, #6c757d);
}