/**
 * Mobile Notes Mode Styles
 * ========================
 * Styles for the mobile notes bottom panel and related UI components
 * MOBILE ONLY - All styles scoped to max-width: 1023px
 */

/* ==========================================
   DISABLE TOUCH :ACTIVE HIGHLIGHTING IN NOTES MODE
   This prevents accidental highlighting when holding finger on verse
   ========================================== */

@media (max-width: 1023px) {
    /* CRITICAL: Completely disable ALL touch/active highlighting in notes mode */
    body.notes-mode-active .verse-text,
    body.notes-mode-active .verse-text-wrapper,
    body.notes-mode-active .chapter-content .v,
    body.notes-mode-active #chapter-content .v {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        tap-highlight-color: transparent !important;
    }
    
    /* Override ALL :active states - no highlighting on touch/hold */
    body.notes-mode-active .verse-text:active,
    body.notes-mode-active .verse-text-wrapper:active,
    body.notes-mode-active .chapter-content .v:active,
    body.notes-mode-active #chapter-content .v:active,
    body.notes-mode-active .verse-text:hover,
    body.notes-mode-active .verse-text-wrapper:hover,
    body.notes-mode-active .chapter-content .v:hover,
    body.notes-mode-active #chapter-content .v:hover {
        background: none !important;
        background-color: transparent !important;
        border-color: transparent !important;
        box-shadow: none !important;
        outline: none !important;
    }
    
    /* Selected verses retain their styling */
    body.notes-mode-active .verse-text.selected,
    body.notes-mode-active .verse-text-wrapper.selected,
    body.notes-mode-active .chapter-content .v.selected,
    body.notes-mode-active #chapter-content .v.selected {
        background: var(--user-highlight-selected, rgba(200, 160, 255, 0.2)) !important;
    }
}

/* ==========================================
   MOBILE NOTES PANEL - PROFESSIONAL DESIGN
   ========================================== */

.mobile-notes-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.04);
    transform: translateY(100%);
    transition: transform 0.28s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 9500;
    padding: 0 14px 4px;
    display: none;
    max-height: 140px;
}

@media (max-width: 1023px) {
    .mobile-notes-panel {
        display: block;
    }
}

.mobile-notes-panel.visible {
    transform: translateY(0);
}

/* Dark mode */
[data-theme="dark"] .mobile-notes-panel {
    background: #1e1e1e;
    border-top-color: #2d2d2d;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.2);
}

/* Handle bar - elegant */
.mobile-notes-panel-handle,
.mobile-note-view-handle {
    display: flex;
    justify-content: center;
    padding: 5px 0 3px;
}

.mobile-notes-panel-handle .handle-bar,
.mobile-note-view-handle .handle-bar {
    width: 32px;
    height: 3px;
    background: #d1d5db;
    border-radius: 2px;
}

[data-theme="dark"] .mobile-notes-panel-handle .handle-bar,
[data-theme="dark"] .mobile-note-view-handle .handle-bar {
    background: #4b5563;
}

/* Panel content */
.mobile-notes-panel-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    position: relative;
}

/* Header with reference and clear button */
.mobile-notes-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0;
}

/* Reference text - clean grey like desktop */
.mobile-notes-reference {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    padding: 0;
    flex: 1;
    letter-spacing: normal;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
}

[data-theme="dark"] .mobile-notes-reference {
    color: #9ca3af;
}

/* Clear/close button - minimal icon */
.mobile-notes-clear {
    width: 18px;
    height: 18px;
    border: none;
    background: transparent;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #9ca3af;
    transition: all 0.15s ease;
    flex-shrink: 0;
    opacity: 0.6;
}

.mobile-notes-clear svg {
    width: 10px;
    height: 10px;
}

.mobile-notes-clear:active {
    opacity: 1;
    transform: scale(0.9);
}

[data-theme="dark"] .mobile-notes-clear {
    color: #6b7280;
}

/* Input wrapper - contains color palette and input */
.mobile-notes-input-wrapper {
    position: relative;
}

/* Input container - clean minimal design */
.mobile-notes-input-container {
    display: flex;
    gap: 6px;
    align-items: center;
    background: #f6f8fa;
    border: 1px solid #d0d7de;
    border-radius: 20px;
    padding: 3px 8px;
}

[data-theme="dark"] .mobile-notes-input-container {
    background: #2d2d2d;
    border-color: #424242;
}

/* Color toggle button - clean circle indicator */
.mobile-notes-color-toggle {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: transparent;
    padding: 2px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    flex-shrink: 0;
    transition: all 0.2s ease;
}

.mobile-notes-color-toggle:active {
    transform: scale(0.92);
}

.mobile-notes-color-toggle .color-indicator {
    width: 18px;
    height: 18px;
    border-radius: 50%;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.15);
    transition: all 0.15s ease;
}

[data-theme="dark"] .mobile-notes-color-toggle .color-indicator {
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.3);
}

.mobile-notes-input {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 14px;
    line-height: 1.3;
    resize: none;
    outline: none;
    color: #1f2937;
    font-family: inherit;
    min-height: 18px;
    max-height: 40px;
}

[data-theme="dark"] .mobile-notes-input {
    color: #f3f4f6;
}

.mobile-notes-input::placeholder {
    color: #9ca3af;
    font-size: 13px;
}

/* Tick/Save button - minimalistic */
.mobile-notes-save {
    width: 24px;
    height: 24px;
    border-radius: 50%;
    border: none;
    background: #d0d7de;
    color: #57606a;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.15s ease;
    flex-shrink: 0;
}

.mobile-notes-save svg {
    width: 12px;
    height: 12px;
}

.mobile-notes-save:active {
    transform: scale(0.92);
    background: #d1d5db;
}

[data-theme="dark"] .mobile-notes-save {
    background: #3d3d3d;
    color: #a0a0a0;
}

[data-theme="dark"] .mobile-notes-save:active {
    background: #505050;
}

/* Color palette - integrated above input, not floating */
.mobile-notes-color-palette {
    position: relative;
    bottom: auto;
    left: auto;
    right: auto;
    display: flex;
    gap: 10px;
    padding: 8px 4px;
    background: transparent;
    border: none;
    border-radius: 0;
    box-shadow: none;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    transition: opacity 0.2s ease, max-height 0.2s ease;
    z-index: auto;
    margin-bottom: 6px;
}

.mobile-notes-color-palette::-webkit-scrollbar {
    display: none;
}

[data-theme="dark"] .mobile-notes-color-palette {
    background: transparent;
    border: none;
    box-shadow: none;
}

/* Collapsed state - hidden */
.mobile-notes-color-palette.collapsed {
    opacity: 0;
    max-height: 0;
    padding: 0 4px;
    margin-bottom: 0;
    pointer-events: none;
    overflow: hidden;
}

/* Expanded state - visible */
.mobile-notes-color-palette.expanded {
    opacity: 1;
    max-height: 80px;
    pointer-events: auto;
}

.mobile-notes-color-palette .color-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.mobile-notes-color-palette .color-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
}

.mobile-notes-color-palette .color-btn:active {
    transform: scale(0.92);
}

.mobile-notes-color-palette .color-btn.active {
    border-color: #1f2937;
    transform: scale(1.08);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .mobile-notes-color-palette .color-btn.active {
    border-color: #f3f4f6;
}

.mobile-notes-color-palette .color-label {
    font-size: 9px;
    color: #9ca3af;
    text-align: center;
    max-width: 44px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
    letter-spacing: normal;
}

[data-theme="dark"] .mobile-notes-color-palette .color-label {
    color: #9ca3af;
}

/* ==========================================
   MOBILE NOTE VIEW PANEL (View Existing Note)
   Minimalistic, clean design
   ========================================== */

.mobile-note-view-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #ffffff;
    border-top: 1px solid #e5e7eb;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.04);
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1), opacity 0.2s ease;
    z-index: 9500;
    padding: 0 14px 4px;
    overflow: visible;
}

.mobile-note-view-panel.visible {
    transform: translateY(0);
}

[data-theme="dark"] .mobile-note-view-panel {
    background: #1e1e1e;
    border-top-color: #2d2d2d;
    box-shadow: 0 -1px 6px rgba(0, 0, 0, 0.2);
}

.mobile-note-view-content {
    display: flex;
    flex-direction: column;
    gap: 2px;
    max-height: 20vh;
    overflow-y: auto;
}

/* Handle bar */
.mobile-note-view-handle {
    display: flex;
    justify-content: center;
    padding: 5px 0 3px;
}

.mobile-note-view-handle .handle-bar {
    width: 32px;
    height: 3px;
    background: #d1d5db;
    border-radius: 2px;
}

[data-theme="dark"] .mobile-note-view-handle .handle-bar {
    background: #4b5563;
}

/* Minimal header - just color dot + reference + close */
.mobile-note-view-header-minimal {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.mobile-note-view-left {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
}

/* Pen (highlight more) button */
.mobile-note-highlight-more-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: #8b949e;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s ease;
    flex-shrink: 0;
    padding: 0;
}

.mobile-note-highlight-more-btn:active {
    background: #f6f8fa;
    color: #57606a;
    transform: scale(0.9);
}

[data-theme="dark"] .mobile-note-highlight-more-btn {
    color: #6b7280;
}

[data-theme="dark"] .mobile-note-highlight-more-btn:active {
    background: #2d2d2d;
    color: #a0a0a0;
}

/* Color circle button */
.mobile-note-color-circle-btn {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    border-radius: 50%;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0;
    flex-shrink: 0;
    transition: transform 0.15s ease;
}

.mobile-note-color-circle-btn:active {
    transform: scale(0.85);
}

.mobile-note-color-circle-btn .note-color-dot {
    width: 14px;
    height: 14px;
    border-radius: 50%;
    box-shadow: 0 0 0 1.5px rgba(0,0,0,0.08);
    transition: all 0.15s ease;
}

[data-theme="dark"] .mobile-note-color-circle-btn .note-color-dot {
    box-shadow: 0 0 0 1.5px rgba(255,255,255,0.1);
}

/* Inline color picker - absolute overlay above panel, not pushing content */
.mobile-note-view-color-picker {
    position: absolute;
    bottom: 100%;
    left: 0;
    right: 0;
    display: flex;
    gap: 10px;
    padding: 10px 14px;
    background: #ffffff;
    border-top-left-radius: 14px;
    border-top-right-radius: 14px;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.08);
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: none;
    z-index: 9550;
}

.mobile-note-view-color-picker::-webkit-scrollbar {
    display: none;
}

.mobile-note-view-color-picker.visible {
    opacity: 1;
    transform: translateY(0);
}

[data-theme="dark"] .mobile-note-view-color-picker {
    background: #2d2d2d;
    box-shadow: 0 -4px 16px rgba(0, 0, 0, 0.3);
}

/* Reuse the same .color-btn-wrapper, .color-btn, .color-label styles from create panel */
.mobile-note-view-color-picker .color-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.mobile-note-view-color-picker .color-btn {
    width: 28px;
    height: 28px;
    border-radius: 8px;
    border: none;
    cursor: pointer;
    flex-shrink: 0;
    transition: all 0.15s ease;
    box-shadow: 0 1px 4px rgba(0, 0, 0, 0.1);
    padding: 0;
}

.mobile-note-view-color-picker .color-btn:active {
    transform: scale(0.92);
}

.mobile-note-view-color-picker .color-btn.active {
    border-color: #1f2937;
    transform: scale(1.08);
    box-shadow: 0 3px 10px rgba(0, 0, 0, 0.2);
}

[data-theme="dark"] .mobile-note-view-color-picker .color-btn.active {
    border-color: #f3f4f6;
}

.mobile-note-view-color-picker .color-label {
    font-size: 9px;
    color: #9ca3af;
    text-align: center;
    max-width: 44px;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    font-weight: 400;
    letter-spacing: normal;
}

[data-theme="dark"] .mobile-note-view-color-picker .color-label {
    color: #9ca3af;
}

/* Floating tick button for highlight-more mode */
.mobile-highlight-more-done-btn {
    position: fixed;
    bottom: 24px;
    right: 20px;
    width: 44px;
    height: 44px;
    border-radius: 50%;
    border: none;
    background: #1f2937;
    color: #ffffff;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    z-index: 9600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.mobile-highlight-more-done-btn.visible {
    opacity: 1;
    transform: scale(1);
}

.mobile-highlight-more-done-btn:active {
    transform: scale(0.9);
    background: #374151;
}

[data-theme="dark"] .mobile-highlight-more-done-btn {
    background: #f3f4f6;
    color: #1f2937;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

[data-theme="dark"] .mobile-highlight-more-done-btn:active {
    background: #d1d5db;
}

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-highlight-more-done-btn {
        bottom: calc(24px + env(safe-area-inset-bottom));
    }
    .mobile-highlight-more-tracker {
        bottom: calc(24px + env(safe-area-inset-bottom));
    }
}

/* Verse tracker label during highlight-more mode */
.mobile-highlight-more-tracker {
    position: fixed;
    bottom: 24px;
    left: 20px;
    max-width: calc(100vw - 100px);
    padding: 8px 14px;
    border-radius: 20px;
    background: #1f2937;
    color: #ffffff;
    font-size: 13px;
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    z-index: 9600;
    box-shadow: 0 2px 8px rgba(0,0,0,0.15);
    opacity: 0;
    transform: scale(0.7);
    transition: all 0.2s cubic-bezier(0.34, 1.56, 0.64, 1);
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.mobile-highlight-more-tracker.visible {
    opacity: 1;
    transform: scale(1);
}

[data-theme="dark"] .mobile-highlight-more-tracker {
    background: #f3f4f6;
    color: #1f2937;
    box-shadow: 0 2px 8px rgba(0,0,0,0.3);
}

.mobile-note-view-badge-minimal {
    width: 8px;
    height: 8px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mobile-note-view-ref-minimal {
    font-size: 11px;
    font-weight: 500;
    color: #6b7280;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .mobile-note-view-ref-minimal {
    color: #9ca3af;
}

.mobile-note-view-actions-header {
    display: flex;
    align-items: center;
    gap: 4px;
    flex-shrink: 0;
}

.mobile-note-view-close-minimal {
    width: 22px;
    height: 22px;
    border: none;
    background: transparent;
    border-radius: 50%;
    color: #9ca3af;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: background 0.15s ease;
}

.mobile-note-view-close-minimal:active {
    background: rgba(0, 0, 0, 0.05);
}

[data-theme="dark"] .mobile-note-view-close-minimal {
    color: #6b7280;
}

[data-theme="dark"] .mobile-note-view-close-minimal:active {
    background: rgba(255, 255, 255, 0.05);
}

/* Multi-passage navigation - clean text button in header */
.mobile-passage-dropdown-btn {
    display: flex;
    align-items: center;
    gap: 3px;
    font-size: 10px;
    font-weight: 500;
    color: #2563eb;
    background: transparent;
    border: none;
    padding: 0;
    cursor: pointer;
    white-space: nowrap;
    transition: all 0.15s ease;
    max-width: 170px;
    overflow: hidden;
}

.mobile-passage-dropdown-btn:active {
    opacity: 0.6;
}

.mobile-passage-dropdown-label {
    overflow: hidden;
    text-overflow: ellipsis;
}

[data-theme="dark"] .mobile-passage-dropdown-btn {
    color: #60a5fa;
}

/* Passage drop-up menu (absolute overlay above panel) */
.mobile-passage-dropup {
    position: absolute;
    bottom: 100%;
    left: 14px;
    right: 14px;
    background: #ffffff;
    border-radius: 12px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.12), 0 0 0 1px rgba(0, 0, 0, 0.05);
    padding: 6px;
    display: flex;
    flex-direction: column;
    gap: 2px;
    z-index: 9600;
    opacity: 0;
    transform: translateY(8px);
    transition: opacity 0.15s ease, transform 0.15s ease;
    pointer-events: none;
}

.mobile-passage-dropup.visible {
    opacity: 1;
    transform: translateY(0);
    pointer-events: auto;
}

[data-theme="dark"] .mobile-passage-dropup {
    background: #2d2d2d;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.3), 0 0 0 1px rgba(255, 255, 255, 0.08);
}

.mobile-passage-dropup-item {
    font-size: 13px;
    font-weight: 500;
    color: #374151;
    background: transparent;
    border: none;
    padding: 8px 12px;
    border-radius: 8px;
    text-align: left;
    cursor: pointer;
    transition: background 0.12s ease;
}

.mobile-passage-dropup-item:active {
    background: #f3f4f6;
}

.mobile-passage-dropup-item.active {
    color: #2563eb;
    font-weight: 600;
    background: rgba(37, 99, 235, 0.06);
}

[data-theme="dark"] .mobile-passage-dropup-item {
    color: #d1d5db;
}

[data-theme="dark"] .mobile-passage-dropup-item:active {
    background: #374151;
}

[data-theme="dark"] .mobile-passage-dropup-item.active {
    color: #60a5fa;
    background: rgba(96, 165, 250, 0.1);
}

/* Legacy passage nav styles - hidden */
.mobile-note-passage-refs-row,
.mobile-note-passage-nav-minimal {
    display: none;
}

/* Note position badge in header */
.note-position-badge {
    font-size: 11px;
    font-weight: 500;
    color: #9ca3af;
    background: #f3f4f6;
    padding: 2px 8px;
    border-radius: 8px;
    margin-left: 8px;
}

[data-theme="dark"] .note-position-badge {
    color: #9ca3af;
    background: #374151;
}

/* Note body - minimal and clean with inline editing */
.mobile-note-view-body-minimal {
    padding: 0;
    margin: 0;
    position: relative;
}

/* Footer row: Add reference (left) + Bible ref (right) */
.mobile-note-view-footer-row {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 3px 2px 0;
}

.mobile-note-view-footer-row .mobile-add-reference-btn {
    border: none;
    padding: 0;
    height: auto;
    font-size: 10px;
    font-weight: 500;
    color: #8b949e;
    border-radius: 0;
    gap: 0;
}

.mobile-note-view-footer-row .mobile-add-reference-btn:active {
    background: transparent;
    opacity: 0.6;
}

[data-theme="dark"] .mobile-note-view-footer-row .mobile-add-reference-btn {
    color: #6b7280;
    border-color: transparent;
}

/* Reference label at bottom-right of note body */
.mobile-note-view-ref-bottom {
    display: flex;
    align-items: center;
    gap: 5px;
    justify-content: flex-end;
    padding: 2px 2px 0;
}

.mobile-note-view-ref-bottom .ref-dot {
    width: 7px;
    height: 7px;
    border-radius: 50%;
    flex-shrink: 0;
}

.mobile-note-view-ref-bottom .ref-text {
    font-size: 10px;
    font-weight: 500;
    color: #8b949e;
    letter-spacing: 0.1px;
}

[data-theme="dark"] .mobile-note-view-ref-bottom .ref-text {
    color: #8b949e;
}

/* Only the active/current passage ref is blue */
.mobile-note-view-ref-bottom .ref-text .ref-passage-active {
    color: #2563eb;
    font-weight: 600;
}

[data-theme="dark"] .mobile-note-view-ref-bottom .ref-text .ref-passage-active {
    color: #60a5fa;
}

/* (+n more) count for multi-passage notes */
.mobile-note-view-ref-bottom .ref-text .ref-more-count {
    color: #9ca3af;
    font-weight: 400;
    font-size: 9px;
    font-style: italic;
}

.mobile-note-inline-edit {
    width: 100%;
    min-height: 24px;
    max-height: 60px;
    padding: 5px 8px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    background: #f6f8fa;
    font-size: 14px;
    line-height: 1.3;
    color: #1f2937;
    resize: none;
    outline: none;
    font-family: inherit;
    transition: background 0.15s ease, box-shadow 0.15s ease;
}

.mobile-note-inline-edit:focus {
    background: #ffffff;
    border-color: #0969da;
    box-shadow: 0 0 0 3px rgba(9, 105, 218, 0.12);
}

.mobile-note-inline-edit::placeholder {
    color: #9ca3af;
}

[data-theme="dark"] .mobile-note-inline-edit {
    background: #2d2d2d;
    border-color: #424242;
    color: #e5e7eb;
}

[data-theme="dark"] .mobile-note-inline-edit:focus {
    background: #2d2d2d;
    border-color: #58a6ff;
    box-shadow: 0 0 0 3px rgba(88, 166, 255, 0.15);
}

[data-theme="dark"] .mobile-note-inline-edit::placeholder {
    color: #6b7280;
}

.mobile-note-view-text-minimal {
    font-size: 14px;
    line-height: 1.4;
    color: #1f2937;
    white-space: pre-wrap;
    margin: 0;
}

[data-theme="dark"] .mobile-note-view-text-minimal {
    color: #e5e7eb;
}

/* Delete button in header */
.mobile-note-delete-btn-minimal {
    width: 22px;
    height: 22px;
    border-radius: 50%;
    background: transparent;
    border: none;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #d1d5db;
    transition: all 0.15s ease;
}

.mobile-note-delete-btn-minimal:active {
    color: #ef4444;
    background: rgba(239, 68, 68, 0.1);
    transform: scale(0.95);
}

[data-theme="dark"] .mobile-note-delete-btn-minimal {
    color: #4b5563;
}

[data-theme="dark"] .mobile-note-delete-btn-minimal:active {
    color: #f87171;
    background: rgba(248, 113, 113, 0.1);
}

/* LEGACY: Keep old classes for backward compatibility */
.mobile-note-view-header,
.mobile-note-view-badge,
.mobile-note-view-ref,
.mobile-note-view-close,
.mobile-note-view-body,
.mobile-note-view-body.tappable-to-edit,
.tap-to-edit-hint,
.mobile-note-view-text,
.mobile-note-delete-btn,
.mobile-note-view-swipe-hint,
.mobile-note-view-footer,
.mobile-note-passage-nav,
.passage-nav-btn,
.passage-indicator {
    /* Legacy styles preserved for any existing usage */
}

/* ==========================================
   MOBILE NOTE EDIT PANEL
   ========================================== */

.mobile-note-edit-panel {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--mobile-panel-bg, #ffffff);
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
    transform: translateY(100%);
    transition: transform 0.3s ease-out;
    z-index: 9600;
    padding: 8px 16px 20px;
}

.mobile-note-edit-panel.visible {
    transform: translateY(0);
}

[data-theme="dark"] .mobile-note-edit-panel {
    background: var(--mobile-panel-bg-dark, #1f2937);
}

.mobile-note-edit-content {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.mobile-note-edit-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 4px 0;
}

.mobile-note-edit-cancel,
.mobile-note-edit-save {
    padding: 8px 16px;
    border: none;
    background: none;
    font-size: 15px;
    font-weight: 500;
    cursor: pointer;
}

.mobile-note-edit-cancel {
    color: #6b7280;
}

.mobile-note-edit-save {
    color: #7C3AED;
}

[data-theme="dark"] .mobile-note-edit-cancel {
    color: #9ca3af;
}

[data-theme="dark"] .mobile-note-edit-save {
    color: #A78BFA;
}

.mobile-note-edit-title {
    font-size: 16px;
    font-weight: 600;
    color: #111827;
}

[data-theme="dark"] .mobile-note-edit-title {
    color: #f3f4f6;
}

/* ==========================================
   HIDE MODE INDICATOR
   ========================================== */

.mobile-mode-indicator {
    display: none !important;
}

/* ==========================================
   TOAST NOTIFICATIONS
   ========================================== */

.mobile-notes-toast {
    position: fixed;
    bottom: 100px;
    left: 50%;
    transform: translateX(-50%) translateY(20px);
    background: rgba(0, 0, 0, 0.85);
    color: white;
    padding: 12px 24px;
    border-radius: 24px;
    font-size: 14px;
    font-weight: 500;
    z-index: 11000;
    opacity: 0;
    transition: all 0.3s ease;
    pointer-events: none;
}

.mobile-notes-toast.visible {
    opacity: 1;
    transform: translateX(-50%) translateY(0);
}

/* ==========================================
   VERSE WITH NOTE HIGHLIGHTING (Mobile)
   ========================================== */

/* MOBILE ONLY - Wrap all verse selection styles in media query */
@media (max-width: 1023px) {
    /* Faint highlight for verses with notes - smooth transitions */
    .verse-with-note {
        position: relative;
        border-radius: 4px;
        padding: 2px 4px;
        margin: -2px -4px;
        cursor: pointer;
        transition: background-color 0.25s ease, box-shadow 0.25s ease;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Note emphasis - when viewing a note, uses inline styles for color */
    .note-emphasis {
        transition: background-color 0.25s ease, box-shadow 0.25s ease;
        font-weight: 500;
    }
    
    /* ==========================================
       MOBILE VERSE SELECTION FOR NOTES MODE
       Clean, minimal highlighting with subtle animation
       Reduced glass effect for cleaner look
       ========================================== */
    
    /* Pop animation for verse selection - dopamine effect */
    @keyframes mobileVerseSelectPop {
        0% { transform: scale(0.85); opacity: 0.5; }
        50% { transform: scale(1.08); }
        100% { transform: scale(1); opacity: 1; }
    }
    
    /* PRIMARY: Verse number selection - clean, minimal highlight */
    body.notes-mode-active #chapter-content .v.selected,
    body.notes-mode-active .chapter-content .v.selected,
    .notes-mode-active #chapter-content .v.selected,
    .notes-mode-active .chapter-content .v.selected {
        background: rgba(124, 58, 237, 0.22) !important;
        border: 2px solid rgba(124, 58, 237, 0.45) !important;
        border-radius: 5px !important;
        color: #7C3AED !important;
        font-weight: inherit !important;
        padding: 2px 5px !important;
        margin: 0 2px !important;
        display: inline !important;
        animation: none !important;
        transform: none !important;
    }
    
    /* SECONDARY: Verse text selection - subtle left border highlight */
    body.notes-mode-active #chapter-content .verse-text.selected,
    body.notes-mode-active #chapter-content .verse-text-wrapper.selected,
    body.notes-mode-active .chapter-content .verse-text.selected,
    body.notes-mode-active .chapter-content .verse-text-wrapper.selected,
    .notes-mode-active #chapter-content .verse-text.selected,
    .notes-mode-active #chapter-content .verse-text-wrapper.selected,
    .notes-mode-active .chapter-content .verse-text.selected,
    .notes-mode-active .chapter-content .verse-text-wrapper.selected {
        background: rgba(124, 58, 237, 0.12) !important;
        border-left: 3px solid rgba(124, 58, 237, 0.5) !important;
        border-radius: 0 4px 4px 0 !important;
        padding: 3px 6px 3px 8px !important;
        margin: 2px 0 !important;
        display: inline !important;
    }
    
    /* Dark mode - clean, minimal highlight */
    [data-theme="dark"] body.notes-mode-active #chapter-content .v.selected,
    [data-theme="dark"] body.notes-mode-active .chapter-content .v.selected,
    [data-theme="dark"] .notes-mode-active #chapter-content .v.selected,
    [data-theme="dark"] .notes-mode-active .chapter-content .v.selected,
    body.notes-mode-active[data-theme="dark"] #chapter-content .v.selected,
    body.notes-mode-active[data-theme="dark"] .chapter-content .v.selected {
        background: rgba(167, 139, 250, 0.28) !important;
        border: 2px solid rgba(167, 139, 250, 0.5) !important;
        color: #A78BFA !important;
        font-weight: inherit !important;
        animation: none !important;
        transform: none !important;
    }
    
    [data-theme="dark"] body.notes-mode-active #chapter-content .verse-text.selected,
    [data-theme="dark"] body.notes-mode-active #chapter-content .verse-text-wrapper.selected,
    [data-theme="dark"] body.notes-mode-active .chapter-content .verse-text.selected,
    [data-theme="dark"] body.notes-mode-active .chapter-content .verse-text-wrapper.selected,
    [data-theme="dark"] .notes-mode-active #chapter-content .verse-text.selected,
    [data-theme="dark"] .notes-mode-active #chapter-content .verse-text-wrapper.selected,
    [data-theme="dark"] .notes-mode-active .chapter-content .verse-text.selected,
    [data-theme="dark"] .notes-mode-active .chapter-content .verse-text-wrapper.selected,
    body.notes-mode-active[data-theme="dark"] #chapter-content .verse-text.selected,
    body.notes-mode-active[data-theme="dark"] #chapter-content .verse-text-wrapper.selected,
    body.notes-mode-active[data-theme="dark"] .chapter-content .verse-text.selected,
    body.notes-mode-active[data-theme="dark"] .chapter-content .verse-text-wrapper.selected {
        background: rgba(167, 139, 250, 0.15) !important;
        border-left: 3px solid rgba(167, 139, 250, 0.5) !important;
        color: #f9fafb !important;
    }
    
    /* Mobile selected verse styling - fallback class */
    .mobile-selected,
    .mobile-verse-highlight {
        background-color: rgba(124, 58, 237, 0.2) !important;
        border-radius: 4px !important;
        padding: 2px 4px !important;
        animation: mobileVerseSelectPop 0.25s cubic-bezier(0.34, 1.56, 0.64, 1) !important;
    }
    
    /* Highlighted for note creation - clean visual feedback */
    body.notes-mode-active .verse-highlighted-for-note,
    body.mobile-create-mode-active .verse-highlighted-for-note {
        background: rgba(124, 58, 237, 0.12) !important;
        border-left: 3px solid rgba(124, 58, 237, 0.5) !important;
        border-radius: 0 4px 4px 0 !important;
        padding: 3px 6px 3px 8px !important;
        margin: 2px 0 !important;
    }
    
    [data-theme="dark"] body.notes-mode-active .verse-highlighted-for-note,
    [data-theme="dark"] body.mobile-create-mode-active .verse-highlighted-for-note {
        background: rgba(167, 139, 250, 0.25) !important;
        border-left: 4px solid rgba(167, 139, 250, 0.7) !important;
    }
    
    /* Ensure touch targets are large enough on mobile */
    body.notes-mode-active .chapter-content .v,
    body.notes-mode-active .verse-text,
    body.notes-mode-active .verse-text-wrapper {
        cursor: pointer !important;
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        touch-action: manipulation !important;
        min-height: 28px !important;
        display: inline !important;
    }
    
    /* Disable hover effects on touch devices in notes mode */
    @media (hover: none) and (pointer: coarse) {
        body.notes-mode-active .chapter-content .v:hover,
        body.notes-mode-active .verse-text:hover,
        body.notes-mode-active .verse-text-wrapper:hover {
            background: transparent !important;
            border: none !important;
            box-shadow: none !important;
        }
    }
    
    /* Active/pressed state for verses in notes mode */
    body.notes-mode-active .chapter-content .v:active:not(.selected),
    body.notes-mode-active .verse-text:active:not(.selected),
    body.notes-mode-active .verse-text-wrapper:active:not(.selected) {
        background: var(--user-highlight-bg-10, rgba(124, 58, 237, 0.1)) !important;
        border-radius: 4px !important;
        transition: background 0.1s ease !important;
    }
}

/* ==========================================
   HIDE DESKTOP ELEMENTS ON MOBILE
   ========================================== */

@media (max-width: 1023px) {
    /* Hide desktop notes panel */
    .notes-panel {
        display: none !important;
    }
    
    /* Hide desktop create note button */
    .create-note-btn,
    .mode-toggle-btn-standalone {
        display: none !important;
    }
    
    /* Adjust for notes mode on mobile */
    body.notes-mode-active .main-wrapper {
        margin-left: 0 !important;
        margin-right: 0 !important;
    }
    
    /* Hide mode indicators completely */
    .mobile-mode-indicator {
        display: none !important;
    }
}

/* ==========================================
   SAFE AREA INSETS (iPhone notch)
   ========================================== */

@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-notes-panel {
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
    
    .mobile-note-view-panel {
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
    
    .mobile-note-edit-panel {
        padding-bottom: calc(6px + env(safe-area-inset-bottom));
    }
}

/* ==========================================
   MOBILE ADD REFERENCE BUTTON & MULTI-PASSAGE
   ========================================== */

.mobile-notes-reference-row {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 0;
}

.mobile-add-reference-btn {
    display: inline-flex;
    align-items: center;
    gap: 2px;
    padding: 1px 6px;
    border: 1px solid #d0d7de;
    background: transparent;
    border-radius: 8px;
    font-size: 9px;
    font-weight: 500;
    color: #57606a;
    cursor: pointer;
    transition: all 0.15s ease;
    white-space: nowrap;
    flex-shrink: 0;
    line-height: 1.2;
    height: 18px;
    box-sizing: border-box;
}

.mobile-add-reference-btn:active {
    transform: scale(0.95);
    background: #f6f8fa;
}

.mobile-add-reference-btn svg {
    width: 8px;
    height: 8px;
}

[data-theme="dark"] .mobile-add-reference-btn {
    border-color: #424242;
    background: transparent;
    color: #8b949e;
}

[data-theme="dark"] .mobile-add-reference-btn:active {
    background: #2d2d2d;
}

/* Multi-passage indicator */
/* ==========================================
   MOBILE REFERENCE PICKER MODAL - REDESIGNED
   ========================================== */
.mobile-reference-picker {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    top: auto;
    max-height: 88vh;
    background: #ffffff;
    z-index: 10000;
    display: flex;
    flex-direction: column;
    transform: translateY(100%);
    transition: transform 0.35s cubic-bezier(0.32, 0.72, 0, 1);
    border-radius: 16px 16px 0 0;
    box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.12);
}

.mobile-reference-picker.visible {
    transform: translateY(0);
}

/* Scrim/backdrop behind bottom sheet */
.mobile-reference-picker-scrim {
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 9999;
    opacity: 0;
    transition: opacity 0.3s ease;
    pointer-events: none;
}

.mobile-reference-picker-scrim.visible {
    opacity: 1;
    pointer-events: auto;
}

[data-theme="dark"] .mobile-reference-picker {
    background: #161b22;
    box-shadow: 0 -4px 40px rgba(0, 0, 0, 0.4);
}

/* Drag handle at top of bottom sheet */
.mobile-reference-picker-drag-handle {
    display: flex;
    justify-content: center;
    padding: 10px 0 4px;
    flex-shrink: 0;
}

.mobile-reference-picker-drag-handle .drag-bar {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #d1d5db;
}

[data-theme="dark"] .mobile-reference-picker-drag-handle .drag-bar {
    background: #4b5563;
}

/* Picker Header - Clean minimal look */
.mobile-reference-picker-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 8px 16px 12px;
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
    gap: 12px;
}

[data-theme="dark"] .mobile-reference-picker-header {
    background: transparent;
    border-color: #21262d;
}

.mobile-reference-picker-back {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    color: #6b7280;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    border-radius: 8px;
    transition: background 0.15s;
}

.mobile-reference-picker-back:active {
    background: #f3f4f6;
}

[data-theme="dark"] .mobile-reference-picker-back {
    color: #9ca3af;
}

[data-theme="dark"] .mobile-reference-picker-back:active {
    background: #21262d;
}

.mobile-reference-picker-back.hidden {
    visibility: hidden;
}

.mobile-reference-picker-close {
    width: 32px;
    height: 32px;
    border: none;
    background: transparent;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    color: #6b7280;
    flex-shrink: 0;
    transition: background 0.15s;
}

.mobile-reference-picker-close:active {
    background: #f3f4f6;
}

[data-theme="dark"] .mobile-reference-picker-close {
    background: transparent;
    color: #9ca3af;
}

[data-theme="dark"] .mobile-reference-picker-close:active {
    background: #21262d;
}

.mobile-reference-picker-title {
    flex: 1;
    font-size: 16px;
    font-weight: 600;
    color: #1f2937;
    margin: 0;
    text-align: center;
    letter-spacing: -0.2px;
}

[data-theme="dark"] .mobile-reference-picker-title {
    color: #e6edf3;
}

.mobile-reference-picker-done {
    padding: 7px 16px;
    border: none;
    background: #E8DEF8;
    color: #5B21B6;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.mobile-reference-picker-done:active {
    opacity: 0.8;
}

[data-theme="dark"] .mobile-reference-picker-done {
    background: #3B2667;
    color: #D0BCFE;
}

/* Manual Entry Section - Clean and subtle */
.mobile-reference-entry {
    display: flex;
    gap: 8px;
    padding: 12px 16px;
    background: transparent;
    border-bottom: 1px solid #f0f0f0;
    flex-shrink: 0;
}

[data-theme="dark"] .mobile-reference-entry {
    background: transparent;
    border-color: #21262d;
}

.mobile-reference-entry-input {
    flex: 1;
    padding: 10px 14px;
    border: 1px solid #d0d7de;
    border-radius: 8px;
    font-size: 14px;
    background: #ffffff;
    color: #1f2937;
    transition: border-color 0.2s, box-shadow 0.2s;
}

.mobile-reference-entry-input:focus {
    outline: none;
    border-color: #7C3AED;
    box-shadow: 0 0 0 3px rgba(124, 58, 237, 0.08);
    background: white;
}

.mobile-reference-entry-input::placeholder {
    color: #8b949e;
}

[data-theme="dark"] .mobile-reference-entry-input {
    background: #0d1117;
    border-color: #30363d;
    color: #e6edf3;
}

[data-theme="dark"] .mobile-reference-entry-input:focus {
    border-color: #8B5CF6;
    box-shadow: 0 0 0 3px rgba(139, 92, 246, 0.15);
    background: #0d1117;
}

.mobile-reference-entry-add {
    width: 40px;
    height: 40px;
    border: none;
    background: #E8DEF8;
    color: #5B21B6;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    flex-shrink: 0;
    transition: opacity 0.15s;
}

.mobile-reference-entry-add:active {
    opacity: 0.8;
}

[data-theme="dark"] .mobile-reference-entry-add {
    background: #3B2667;
    color: #D0BCFE;
}

/* Content Area */
.mobile-reference-picker-content {
    flex: 1;
    overflow: hidden;
    display: flex;
    flex-direction: column;
    min-height: 0;
}

/* Step containers */
.mobile-reference-step {
    flex: 1;
    display: flex;
    flex-direction: column;
    overflow: hidden;
}

.mobile-reference-step.hidden {
    display: none;
}

.mobile-reference-step-header {
    padding: 10px 16px;
    font-size: 12px;
    font-weight: 600;
    color: #656d76;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    background: #f6f8fa;
    flex-shrink: 0;
    border-bottom: 1px solid #f0f0f0;
}

[data-theme="dark"] .mobile-reference-step-header {
    background: #0d1117;
    color: #8b949e;
    border-color: #21262d;
}

/* Books List - Full width scrollable */
.mobile-reference-books-list {
    flex: 1;
    overflow-y: auto;
    padding: 8px 16px 16px;
    -webkit-overflow-scrolling: touch;
}

.mobile-reference-book-group {
    margin-bottom: 20px;
}

.mobile-reference-group-header {
    padding: 6px 0 10px;
    font-size: 11px;
    font-weight: 600;
    color: #6D28D9;
    text-transform: uppercase;
    letter-spacing: 0.8px;
}

[data-theme="dark"] .mobile-reference-group-header {
    color: #D0BCFE;
}

/* Books as a scrollable list (mobile-friendly) */
.mobile-reference-book-list {
    display: flex;
    flex-direction: column;
    gap: 4px;
}

.mobile-reference-book-btn {
    display: block;
    width: 100%;
    padding: 14px 16px;
    border: 1px solid #e5e7eb;
    background: #ffffff;
    text-align: left;
    font-size: 15px;
    font-weight: 500;
    color: #1f2937;
    cursor: pointer;
    border-radius: 10px;
    transition: all 0.15s;
}

.mobile-reference-book-btn:active,
.mobile-reference-book-btn.active {
    background: #E8DEF8;
    border-color: #D0BCFE;
    color: #5B21B6;
}

[data-theme="dark"] .mobile-reference-book-btn {
    background: #161b22;
    border-color: #30363d;
    color: #e6edf3;
}

[data-theme="dark"] .mobile-reference-book-btn:active,
[data-theme="dark"] .mobile-reference-book-btn.active {
    background: #3B2667;
    border-color: #3B2667;
    color: #D0BCFE;
}

/* Chapters Grid */
.mobile-reference-chapters-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 8px;
    align-content: start;
    -webkit-overflow-scrolling: touch;
}

.mobile-reference-chapter-btn {
    aspect-ratio: 1;
    border: 1px solid #d0d7de;
    background: #ffffff;
    border-radius: 10px;
    font-size: 16px;
    font-weight: 500;
    color: #1f2937;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.mobile-reference-chapter-btn:active,
.mobile-reference-chapter-btn.active {
    background: #E8DEF8;
    border-color: #D0BCFE;
    color: #5B21B6;
}

[data-theme="dark"] .mobile-reference-chapter-btn {
    background: #161b22;
    border-color: #30363d;
    color: #e6edf3;
}

[data-theme="dark"] .mobile-reference-chapter-btn:active,
[data-theme="dark"] .mobile-reference-chapter-btn.active {
    background: #3B2667;
    border-color: #3B2667;
    color: #D0BCFE;
}

/* Verses Grid */
.mobile-reference-verses-grid {
    flex: 1;
    overflow-y: auto;
    padding: 12px 16px;
    display: grid;
    grid-template-columns: repeat(6, 1fr);
    gap: 8px;
    align-content: start;
    -webkit-overflow-scrolling: touch;
}

.mobile-reference-verse-btn {
    aspect-ratio: 1;
    border: 1px solid #d0d7de;
    background: #ffffff;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    color: #1f2937;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.15s;
}

.mobile-reference-verse-btn:active {
    transform: scale(0.95);
}

.mobile-reference-verse-btn.active {
    background: #E8DEF8;
    border-color: #D0BCFE;
    color: #5B21B6;
}

[data-theme="dark"] .mobile-reference-verse-btn {
    background: #161b22;
    border-color: #30363d;
    color: #e6edf3;
}

[data-theme="dark"] .mobile-reference-verse-btn.active {
    background: #3B2667;
    border-color: #3B2667;
    color: #D0BCFE;
}

/* Add Passage Button Area */
.mobile-reference-add-action {
    padding: 12px 16px;
    background: transparent;
    border-top: 1px solid #f0f0f0;
    flex-shrink: 0;
}

[data-theme="dark"] .mobile-reference-add-action {
    background: transparent;
    border-color: #21262d;
}

.mobile-reference-add-passage {
    width: 100%;
    padding: 12px;
    border: none;
    background: #E8DEF8;
    color: #5B21B6;
    border-radius: 8px;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    transition: opacity 0.15s;
}

.mobile-reference-add-passage:disabled {
    opacity: 0.3;
    cursor: not-allowed;
}

.mobile-reference-add-passage:not(:disabled):active {
    opacity: 0.8;
}

[data-theme="dark"] .mobile-reference-add-passage {
    background: #3B2667;
    color: #D0BCFE;
}

/* Pending Passages List */
/* Safe area for reference picker */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-reference-add-action {
        padding-bottom: calc(12px + env(safe-area-inset-bottom));
    }
}

/* ==========================================
   MOBILE COLOR PALETTE MANAGEMENT
   ========================================== */

/* Add color button in palette */
.color-btn-wrapper.color-add-btn-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
}

.color-add-btn {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    border: 1.5px dashed #9ca3af;
    background: transparent;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    padding: 0;
    transition: all 0.15s ease;
}

.color-add-btn svg {
    width: 14px;
    height: 14px;
    color: #9ca3af;
}

.color-add-btn:active {
    border-color: #6b7280;
    transform: scale(0.92);
}

[data-theme="dark"] .color-add-btn {
    border-color: #6b7280;
}

[data-theme="dark"] .color-add-btn svg {
    color: #6b7280;
}

/* Color edit/add bottom sheet */
.mobile-color-sheet-overlay {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.4);
    z-index: 100010;
    opacity: 0;
    transition: opacity 0.2s ease;
    pointer-events: none;
}

.mobile-color-sheet-overlay.visible {
    opacity: 1;
    pointer-events: auto;
}

.mobile-color-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-radius: 16px 16px 0 0;
    z-index: 100011;
    transform: translateY(100%);
    transition: transform 0.25s cubic-bezier(0.4, 0, 0.2, 1);
    padding: 0 20px 24px;
    max-height: 60vh;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15);
}

.mobile-color-sheet.visible {
    transform: translateY(0);
}

[data-theme="dark"] .mobile-color-sheet {
    background: #1e1e1e;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.4);
}

.mobile-color-sheet-handle {
    width: 36px;
    height: 4px;
    border-radius: 2px;
    background: #d1d5db;
    margin: 10px auto 16px;
}

[data-theme="dark"] .mobile-color-sheet-handle {
    background: #4b5563;
}

.mobile-color-sheet-title {
    font-size: 15px;
    font-weight: 600;
    color: #111827;
    margin-bottom: 18px;
    text-align: center;
}

[data-theme="dark"] .mobile-color-sheet-title {
    color: #f3f4f6;
}

/* Color preview + picker row */
.mobile-color-sheet-preview-row {
    display: flex;
    align-items: center;
    gap: 14px;
    margin-bottom: 16px;
}

.mobile-color-sheet-swatch {
    width: 44px;
    height: 44px;
    border-radius: 12px;
    border: 2px solid rgba(0, 0, 0, 0.08);
    flex-shrink: 0;
    cursor: pointer;
    position: relative;
    overflow: hidden;
}

.mobile-color-sheet-swatch input[type="color"] {
    position: absolute;
    inset: 0;
    width: 100%;
    height: 100%;
    opacity: 0;
    cursor: pointer;
    border: none;
    padding: 0;
}

[data-theme="dark"] .mobile-color-sheet-swatch {
    border-color: rgba(255, 255, 255, 0.1);
}

.mobile-color-sheet-hex {
    flex: 1;
    font-size: 14px;
    font-weight: 500;
    color: #6b7280;
    font-family: monospace;
    padding: 8px 12px;
    background: #f3f4f6;
    border-radius: 8px;
    border: 1px solid #e5e7eb;
}

[data-theme="dark"] .mobile-color-sheet-hex {
    background: #2a2a2a;
    border-color: #3a3a3a;
    color: #9ca3af;
}

/* Theme name input */
.mobile-color-sheet-theme-label {
    font-size: 11px;
    font-weight: 600;
    color: #9ca3af;
    text-transform: uppercase;
    letter-spacing: 0.5px;
    margin-bottom: 6px;
}

.mobile-color-sheet-theme-input {
    width: 100%;
    padding: 10px 12px;
    font-size: 14px;
    border: 1px solid #e5e7eb;
    border-radius: 8px;
    background: #f9fafb;
    color: #111827;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.15s;
}

.mobile-color-sheet-theme-input:focus {
    border-color: #2563eb;
}

[data-theme="dark"] .mobile-color-sheet-theme-input {
    background: #2a2a2a;
    border-color: #3a3a3a;
    color: #f3f4f6;
}

[data-theme="dark"] .mobile-color-sheet-theme-input:focus {
    border-color: #60a5fa;
}

/* Sheet action buttons */
.mobile-color-sheet-actions {
    display: flex;
    gap: 10px;
    margin-top: 18px;
}

.mobile-color-sheet-save {
    flex: 1;
    padding: 10px;
    border-radius: 10px;
    border: none;
    background: #2563eb;
    color: #fff;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.mobile-color-sheet-save:active {
    background: #1d4ed8;
    transform: scale(0.97);
}

.mobile-color-sheet-delete {
    padding: 10px 16px;
    border-radius: 10px;
    border: none;
    background: #fee2e2;
    color: #ef4444;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.15s;
}

.mobile-color-sheet-delete:active {
    background: #fecaca;
    transform: scale(0.97);
}

[data-theme="dark"] .mobile-color-sheet-delete {
    background: rgba(239, 68, 68, 0.15);
}

.mobile-color-sheet-cancel {
    padding: 10px 16px;
    border-radius: 10px;
    border: 1px solid #e5e7eb;
    background: transparent;
    color: #6b7280;
    font-size: 14px;
    font-weight: 500;
    cursor: pointer;
    transition: all 0.15s;
}

.mobile-color-sheet-cancel:active {
    background: #f3f4f6;
}

[data-theme="dark"] .mobile-color-sheet-cancel {
    border-color: #3a3a3a;
    color: #9ca3af;
}

[data-theme="dark"] .mobile-color-sheet-cancel:active {
    background: #2a2a2a;
}

/* Long-press visual hint: subtle pulse on color buttons */
.color-btn.long-press-active {
    transform: scale(1.15);
    box-shadow: 0 0 0 2px rgba(37, 99, 235, 0.4);
    transition: transform 0.2s ease, box-shadow 0.2s ease;
}
