/* ============================================
   MOBILE-FIRST BIBLE READING OPTIMIZATION
   ============================================
   
   Clean, distraction-free mobile Bible reading with:
   - Minimal navigation header that auto-hides
   - NO verse highlighting on scroll or hover
   - Smaller, clean text for mobile readability
   - Touch-optimized interactions (without visual feedback)
   - Reader-friendly typography
*/

/* ============================================
   MOBILE-FIRST BIBLE READING OPTIMIZATION
   ============================================
   
   Clean, distraction-free mobile Bible reading with:
   - Minimal navigation header that auto-hides
   - NO verse highlighting on scroll or hover
   - Smaller, clean text for mobile readability
   - Touch-optimized interactions (without visual feedback)
   - Reader-friendly typography
*/

/* Force hide mobile hero navigation on large desktop devices */
@media (min-width: 1367px), (max-width: 1024px) and (orientation: landscape) and (min-width: 481px) {
  .mobile-hero-navigation {
    display: none !important;
    visibility: hidden !important;
  }
}

/* Default state - hidden by default, only shown on mobile */
.mobile-hero-navigation {
  display: none;
}

/* ============================================
   MOBILE HERO HEADER NAVIGATION
   ============================================ */

/* ============================================================================ */
/* CSS CUSTOM PROPERTIES FOR THEMING - CHATGPT STYLE */
/* ============================================================================ */

/* Use system theme variables instead of custom ones */

/* Mobile hero navigation now uses system theme variables with fallbacks */

/* ============================================================================ */
/* MOBILE HERO NAVIGATION - ULTRA THIN & CLEAN */
/* Default hidden state - only show on mobile devices */
/* ============================================================================ */

/* Default: Hide mobile hero on ALL devices */
.mobile-hero-navigation {
  display: none !important;
  visibility: hidden !important;
}

/* Force hide on large desktop devices only */
@media (min-width: 1367px) {
  .mobile-hero-navigation {
    display: none !important;
    visibility: hidden !important;
  }
}

/* Mobile-only thin hero header for navigation - ONLY on actual mobile devices */
@media (max-width: 1366px) and (orientation: portrait), (max-width: 1366px) {
  /* Mobile hero header container - ChatGPT inspired clean design */
  .mobile-hero-navigation {
    position: relative !important; /* Changed from fixed - scrolls with content */
    top: auto;
    left: auto;
    right: auto;
    background: var(--theme-bg-card);
    border-bottom: 1px solid var(--theme-border-gentle);
    color: var(--theme-text-primary);
    z-index: 100;
    padding: 10px 16px;
    min-height: 44px;
    max-height: 44px;
    display: flex !important;
    align-items: center;
    justify-content: space-between;
    visibility: visible !important;
    box-shadow: var(--theme-shadow-soft);
    -webkit-backdrop-filter: blur(8px);
    backdrop-filter: blur(8px);
    margin: 0 auto;
    width: 100%;
  }
  
  /* Book selection section in hero - clean and minimal */
  .mobile-hero-book-section {
    display: flex;
    align-items: center;
    gap: 6px;
    flex: 1;
    min-width: 0;
  }
  
  .mobile-hero-book-btn {
    background: transparent;
    border: 1px solid var(--theme-border-light);
    border-radius: 8px;
    padding: 10px 14px; /* Reduced visual padding while maintaining touch area */
    color: var(--theme-text-primary);
    font-size: 12px; /* Slightly smaller font */
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: all 0.15s ease;
    display: flex;
    align-items: center;
    gap: 6px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 160px; /* Slightly reduced max width */
    min-height: 36px; /* Smaller visual size */
    cursor: pointer;
    letter-spacing: -0.01em;
    /* Ensure the entire button area is clickable */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Force the button to be fully clickable */
    box-sizing: border-box;
  }
  
  .mobile-hero-book-btn:hover {
    background: var(--theme-bg-tertiary);
    border-color: var(--theme-border-gentle);
    transform: translateY(-0.5px);
    box-shadow: var(--theme-shadow-soft);
  }
  
  .mobile-hero-book-btn:active {
    transform: translateY(0);
    box-shadow: var(--theme-shadow-soft);
  }
  
  /* Chapter navigation in hero - ChatGPT button style */
  .mobile-hero-chapter-section {
    display: flex;
    align-items: center;
    gap: 8px;
  }
  
  .mobile-hero-chapter-btn {
    background: transparent;
    border: 1px solid var(--theme-border-light);
    border-radius: 6px;
    padding: 10px 12px; /* Reduced visual padding while maintaining touch area */
    color: var(--theme-text-primary);
    font-size: 14px; /* Slightly smaller font */
    font-weight: 500;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    transition: all 0.1s ease; /* Faster transition for better responsiveness */
    min-width: 36px; /* Smaller visual size */
    min-height: 36px; /* Smaller visual size */
    text-align: center;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
    line-height: 1;
    position: relative;
    /* Ensure the entire button area is clickable */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    /* Force the button to be fully clickable */
    box-sizing: border-box;
    /* Keep large touch area with pseudo-element */
  }
  
  .mobile-hero-chapter-btn:hover:not(:disabled) {
    background: var(--theme-bg-tertiary);
    border-color: var(--theme-text-chapter);
    transform: translateY(-0.5px);
    box-shadow: 0 2px 4px var(--shadow-light);
  }
  
  .mobile-hero-chapter-btn:active:not(:disabled) {
    transform: translateY(0) scale(0.98);
    box-shadow: 0 1px 2px var(--shadow-light);
    transition: all 0.05s ease; /* Even faster for active state */
  }
  
  .mobile-hero-chapter-btn:disabled {
    opacity: 0.4;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: none !important;
  }
  
  /* Enhanced loading state for chapter buttons */
  .mobile-hero-chapter-btn.loading {
    opacity: 0.7;
    pointer-events: none;
    animation: pulse 1s infinite;
  }
  
  .mobile-hero-chapter-btn.loading::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    width: 14px;
    height: 14px;
    border: 2px solid var(--border-color);
    border-top: 2px solid var(--accent-color);
    border-radius: 50%;
    animation: spin 0.8s linear infinite;
    z-index: 10; /* Ensure it appears above other elements */
  }
  
  @keyframes pulse {
    0%, 100% { opacity: 0.7; }
    50% { opacity: 0.9; }
  }
  
  @keyframes spin {
    0% { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
  }
  
  /* Current chapter display - clean chip design */
  .mobile-hero-current-chapter {
    background: var(--accent-bg);
    color: var(--accent-color);
    font-weight: 600;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, sans-serif;
    padding: 6px 10px;
    border-radius: 6px;
    font-size: 13px;
    min-width: 28px;
    text-align: center;
    border: 1px solid var(--accent-color);
    letter-spacing: -0.01em;
    -webkit-user-select: none;
    -moz-user-select: none;
    user-select: none;
  }
  
  /* Dropdown arrow for book button */
  .mobile-hero-book-btn span:last-child {
    font-size: 10px;
    color: var(--text-secondary);
    transition: transform 0.15s ease;
  }
  
  .mobile-hero-book-btn:hover span:last-child {
    color: var(--text-color);
    transform: translateY(-1px);
  }

  /* Simple but effective touch optimization */
  .mobile-hero-chapter-btn,
  .mobile-hero-book-btn {
    /* Ensure buttons are fully interactive */
    pointer-events: auto !important;
    position: relative;
    z-index: 10;
    /* Remove any potential interference */
    overflow: visible;
    transform: translateZ(0); /* Force hardware acceleration */
  }

  /* Add invisible larger touch areas while keeping buttons visually smaller */
  .mobile-hero-chapter-btn::after,
  .mobile-hero-book-btn::after {
    content: '';
    position: absolute;
    top: -8px;
    left: -8px;
    right: -8px;
    bottom: -8px;
    background: transparent;
    z-index: -1;
    border-radius: inherit;
    /* This creates a larger invisible clickable area */
  }

  /* Disable touch area extension when loading to avoid conflicts */
  .mobile-hero-chapter-btn.loading::after,
  .mobile-hero-book-btn.loading::after {
    display: none;
  }
  
  /* Adjust main content to account for thinner fixed header */
  .bible-book-content {
    margin-top: 45px;
  }
  
  /* Hide original navigation on mobile */
  .bible-navigation-header {
    display: none;
  }
  
  /* Hide the mobile Bible navigator (top-left widget) - except on 1024px devices */
  .mobile-bible-navigator {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Force hide on all mobile devices - except 1024px */
  body.has-bible-content .mobile-bible-navigator {
    display: none !important;
    visibility: hidden !important;
  }
  
  /* Additional smooth interactions */
  .mobile-hero-navigation * {
    -webkit-tap-highlight-color: transparent;
  }
  
  /* Focus states for accessibility */
  .mobile-hero-book-btn:focus,
  .mobile-hero-chapter-btn:focus {
    outline: 2px solid var(--accent-color);
    outline-offset: 2px;
  }
}

/* Global mobile touch behavior - disable all selection highlights */
@media (max-width: 1024px) {
    /* Disable text selection and touch highlighting globally for Bible content */
    .bible-content,
    .chapter-content,
    .bible-content *,
    .chapter-content * {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        user-select: none !important;
        /* Disable any focus outlines */
        outline: none !important;
        /* Disable any background changes */
        background-attachment: scroll !important;
    }
    
    /* Disable hover and focus states on all interactive elements */
    .bible-content *:hover,
    .chapter-content *:hover,
    .bible-content *:active,
    .chapter-content *:active,
    .bible-content *:focus,
    .chapter-content *:focus {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        outline: none !important;
        transform: none !important;
        opacity: 1 !important;
    }
}

/* ============================================
   CORE MOBILE LAYOUT (Portrait & Landscape)
   ============================================ */

@media (max-width: 1024px) {
    
    /* ==========================================
       MINIMAL STICKY NAVIGATION HEADER
       ========================================== */
    .bible-header {
        position: sticky;
        top: 0;
        z-index: 100;
        background: var(--bg-color, #ffffff);
        padding: 12px 16px 8px 16px;
        box-shadow: 0 1px 3px rgba(0,0,0,0.06);
        border-bottom: 1px solid rgba(0,0,0,0.04);
        -webkit-backdrop-filter: blur(10px);
        backdrop-filter: blur(10px);
    }
    
    /* Compact book/chapter navigation */
    .bible-navigation {
        display: flex;
        align-items: center;
        gap: 12px;
        margin-bottom: 8px;
    }
    
    /* Book title - prominent but compact */
    .current-book-title {
        font-size: 1.1rem;
        font-weight: 600;
        color: var(--text-primary, #1a202c);
        flex: 1;
        text-align: left;
        margin: 0;
    }
    
    /* Chapter selector - touch optimized */
    .bible-navigation select {
        min-width: 120px;
        padding: 8px 32px 8px 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        border: 1px solid rgba(0,0,0,0.12);
        border-radius: 8px;
        background: var(--bg-secondary, #f7fafc);
        color: var(--text-primary, #1a202c);
        font-weight: 500;
    }
    
    /* ==========================================
       PREMIUM BIBLE READING TYPOGRAPHY - CLEAN & COMPACT
       ========================================== */
    .bible-content,
    .chapter-content {
        padding: 16px 14px 36px 14px; /* Reduced padding for more content */
        max-width: 100%;
        line-height: 1.55; /* Tighter line height for compactness */
        font-size: 14px; /* Further reduced for cleaner mobile reading */
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', 'Segoe UI', 'Roboto', system-ui, sans-serif;
        color: var(--text-primary, #1a202c);
        background: transparent;
        text-rendering: optimizeLegibility;
        -webkit-font-smoothing: antialiased;
        -moz-osx-font-smoothing: grayscale;
        border: none;
        box-shadow: none;
        border-radius: 0;
        /* Disable all touch highlighting and user selection feedback */
        -webkit-tap-highlight-color: transparent;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        /* Clean typography adjustments */
        letter-spacing: 0.01em;
        word-spacing: 0.02em;
    }
    
    /* ==========================================
       MOBILE SPREAD-OUT TEXT - LIGHT THEME STYLE
       ========================================== */
    
    /* Remove container constraints for mobile - let text spread out naturally */
    .bible-main-content {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: none !important;
    }
    
    .bible-content-wrapper {
        padding: 0 !important;
        margin: 0 !important;
        width: 100% !important;
        max-width: none !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
    }
    
    /* Let bible text spread to full width like light theme */
    .bible-content,
    .chapter-content {
        padding: 45px 20px 36px 20px !important; /* Side padding for comfortable reading */
        margin: 0 !important;
        width: 100% !important;
        max-width: none !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        border-radius: 0 !important;
        /* Enhanced readability for spread-out text with more spacing */
        line-height: 1.85 !important; /* Increased line spacing for better readability */
        font-size: 15px !important; /* Slightly larger for better readability when spread */
        /* Optimize text flow for full-width spread - prevent word breaks */
        text-align: left !important;
        -webkit-hyphens: none !important; /* Safari support */
        -moz-hyphens: none !important; /* Firefox support */
        -ms-hyphens: none !important; /* IE/Edge support */
        hyphens: none !important; /* Disable hyphenation completely */
        word-break: normal !important;
        overflow-wrap: break-word !important;
        word-wrap: break-word !important; /* Additional browser support */
    }
    
    /* Ensure paragraphs spread nicely with better spacing */
    .bible-content p,
    .chapter-content p {
        margin: 0 0 1.4em 0 !important; /* Increased paragraph spacing */
        padding: 0 !important;
        text-indent: 0 !important;
        width: 100% !important;
        max-width: none !important;
        /* Enhanced line spacing within paragraphs */
        line-height: 1.85 !important;
        /* Prevent word breaks and hyphenation with cross-browser support */
        -webkit-hyphens: none !important;
        -moz-hyphens: none !important;
        -ms-hyphens: none !important;
        hyphens: none !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
    }
    
    /* Optimize verse numbers for spread layout */
    .v {
        margin-right: 6px !important;
        margin-left: 0 !important;
    }
    
    /* Remove any container styling that might create boundaries */
    .bible-content *,
    .chapter-content * {
        border: none;
        box-shadow: none;
    }
    
    /* Paragraph spacing for readability - clean and compact with better spacing */
    .bible-content p,
    .chapter-content p {
        margin-bottom: 1.3em !important; /* Increased for better readability */
        text-align: left;
        background: transparent;
        border: none;
        padding: 0;
        /* Improved text flow with enhanced spacing */
        text-indent: 0;
        margin-top: 0;
        line-height: 1.85 !important; /* Consistent line spacing */
        /* Prevent hyphenation with cross-browser support */
        -webkit-hyphens: none !important;
        -moz-hyphens: none !important;
        -ms-hyphens: none !important;
        hyphens: none !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
    }
    
    /* ==========================================
       ENHANCED VERSE INTERACTION SYSTEM - NO HOVER/TOUCH FEEDBACK
       ========================================== */
    
    /* Verse text - completely disable hover and touch effects */
    .verse-text,
    .verse-text-wrapper {
        display: inline;
        -webkit-tap-highlight-color: transparent !important;
        touch-action: manipulation;
        cursor: default; /* Changed from pointer to default */
        padding: 2px 1px;
        border-radius: 3px;
        transition: background-color 0.25s ease;
        /* Disable user selection and touch feedback */
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
    }
    
    /* Allow background for verse-with-note class */
    .verse-text-wrapper.verse-with-note,
    .verse-text-wrapper.note-emphasis,
    .verse-text-wrapper.selected {
        background: inherit;
    }
    
    /* Remove hover effects on mobile - but allow note highlights */
    .verse-text:hover,
    .verse-text-wrapper:hover,
    .verse-text:focus,
    .verse-text-wrapper:focus {
        outline: none !important;
        transform: none !important;
    }
    
    /* Verse numbers - clean, minimal design for mobile */
    .v {
        font-size: 0.6em; /* Even smaller for mobile cleanliness */
        color: var(--muted-color, #8a8a8a); /* Slightly more muted */
        vertical-align: super;
        margin-right: 4px; /* Reduced margin for compactness */
        font-weight: 500; /* Slightly lighter weight */
        padding: 0px 2px; /* Minimal padding */
        border-radius: 2px;
        min-width: 14px; /* Smaller minimum width */
        display: inline-block;
        text-align: center;
        cursor: default;
        transition: background-color 0.25s ease, box-shadow 0.25s ease;
        /* Disable user selection and touch feedback */
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none;
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        /* Clean typography */
        letter-spacing: 0;
        line-height: 1.2;
    }
    
    /* Remove ALL hover effects on verse numbers */
    .v:hover,
    .v:active,
    .v:focus {
        background: transparent !important;
        color: var(--muted-color, #718096) !important;
        transform: none !important;
        border: none !important;
        box-shadow: none !important;
        outline: none !important;
    }
    
    /* Completely disable active state for tap feedback */
    .v:active {
        transform: none !important;
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
    }
    
    /* ==========================================
       ENHANCED SMOOTH VERSE HIGHLIGHTING SYSTEM - MOBILE OPTIMIZED
       ========================================== */
    
    /* Enhanced touch targets for easier mobile interaction */
    @media (max-width: 1024px) {
        /* Make verse numbers easier to tap */
        .v {
            position: relative;
            min-width: 28px;
            min-height: 28px;
            padding: 4px 6px;
            margin: 2px 4px 2px 0;
            border-radius: 6px;
            display: inline-flex;
            align-items: center;
            justify-content: center;
            cursor: pointer;
            transition: all 0.15s cubic-bezier(0.4, 0, 0.2, 1);
            font-weight: 600;
            user-select: none;
            -webkit-user-select: none;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
        }
        
        /* Enhanced touch area using pseudo-element */
        .v::before {
            content: '';
            position: absolute;
            top: -8px;
            left: -8px;
            right: -8px;
            bottom: -8px;
            border-radius: 8px;
            background: transparent;
            z-index: -1;
        }
        
        /* Smooth hover/active states for better feedback */
        .v:active {
            transform: scale(0.95);
            background-color: var(--user-highlight-bg-10);
        }
        
        /* Make verse text areas easier to tap */
        .verse-text,
        .verse-text-wrapper {
            position: relative;
            padding: 8px 4px;
            margin: 2px 0;
            cursor: pointer;
            transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
            user-select: none;
            -webkit-user-select: none;
            -webkit-tap-highlight-color: transparent;
            touch-action: manipulation;
            line-height: 1.6;
        }
        
        /* Enhanced touch feedback for verse text */
        .verse-text:active,
        .verse-text-wrapper:active,
        .verse-text.touching,
        .verse-text-wrapper.touching {
            background-color: var(--user-highlight-bg-05);
            transform: translateX(2px);
        }
        
        /* Active touch state for verse numbers */
        .v:active,
        .v.touching {
            transform: scale(0.95);
            background-color: var(--user-highlight-bg-15);
        }
    }
    
    /* Base verse highlighting - clean background only */
    .verse-selected,
    .v.selected {
        background-color: var(--user-highlight-bg-20);
        border-radius: 4px;
        padding: 1px 3px;
    }
    
    /* Smooth selection animation */
    @keyframes verseSelectBounce {
        0% { 
            transform: scale(1) translateY(0);
            opacity: 0.8;
        }
        50% { 
            transform: scale(1.05) translateY(-2px);
            opacity: 1;
        }
        100% { 
            transform: scale(1) translateY(-1px);
            opacity: 1;
        }
    }
    
    /* Mobile-specific highlighting - optimized for touch and readability */
    @media (max-width: 1024px) {
        /* Light mode verse number highlighting - clean style */
        .verse-selected,
        .v.selected {
            background-color: var(--user-highlight-bg-25);
            border-radius: 4px;
            padding: 1px 3px;
        }
        
        /* Verse text highlighting - instant, no animation */
        .verse-text.selected,
        .verse-text-wrapper.selected {
            background: var(--user-highlight-selected);
            border-radius: 4px;
        }
        
        /* Smooth slide-in animation for selected verse text */
        @keyframes verseTextSlideIn {
            0% { 
                opacity: 0;
                transform: translateX(-8px) scale(0.98);
                background: var(--user-highlight-bg-10);
            }
            50% {
                opacity: 0.8;
                transform: translateX(6px) scale(1.01);
            }
            100% { 
                opacity: 1;
                transform: translateX(4px) scale(1);
                background: var(--user-highlight-selected);
            }
        }
        
        /* Remove hover effects but keep selected state clean */
        .verse-text.selected:hover,
        .verse-text-wrapper.selected:hover,
        .v.selected:hover {
            background: var(--user-highlight-selected) !important;
            border-left: 4px solid var(--user-highlight-border) !important;
            transform: translateX(4px) scale(1) !important;
        }
        
        /* Enhanced dark mode - uses user's preferred color with better contrast */
        [data-theme="dark"] .verse-selected,
        [data-theme="dark"] .v.selected {
            background-color: var(--user-highlight-bg-35);
            box-shadow: 
                0 2px 12px var(--user-highlight-bg-20),
                0 0 0 2px var(--user-highlight-border);
            border: 1px solid var(--user-highlight-border);
        }
        
        [data-theme="dark"] .verse-text.selected,
        [data-theme="dark"] .verse-text-wrapper.selected {
            background: var(--user-highlight-selected);
            border-left: 4px solid var(--user-highlight-border);
            box-shadow: 
                0 2px 16px var(--user-highlight-bg-25),
                0 4px 32px var(--user-highlight-bg-10);
            color: #000000 !important;
            text-shadow: none !important;
        }
        
        /* Ensure all nested elements in dark mode have proper text color */
        [data-theme="dark"] .verse-text.selected *,
        [data-theme="dark"] .verse-text-wrapper.selected * {
            color: #000000 !important;
            text-shadow: none !important;
        }
        
        /* Enhanced selection state transitions */
        .v,
        .verse-text,
        .verse-text-wrapper {
            will-change: transform, background-color, box-shadow;
        }
        
        /* Smooth deselection animation */
        .v.deselecting,
        .verse-text.deselecting,
        .verse-text-wrapper.deselecting {
            animation: verseDeselect 0.25s cubic-bezier(0.4, 0, 0.2, 1) forwards;
        }
        
        @keyframes verseDeselect {
            0% { 
                transform: translateX(4px) scale(1);
                opacity: 1;
            }
            100% { 
                transform: translateX(0) scale(1);
                opacity: 1;
                background: transparent;
                box-shadow: none;
                border-left: none;
            }
        }
    }
    
    /* Enhanced highlighting for selected verse text - clean style */
    .verse-text.selected,
    .verse-text-wrapper.selected {
        background: var(--user-highlight-selected);
        border-radius: 4px;
    }
    
    /* Optimized performance for smooth interactions */
    .v,
    .verse-text,
    .verse-text-wrapper {
        backface-visibility: hidden;
        perspective: 1000px;
        transform-style: preserve-3d;
    }
    
    /* ==========================================
       HIDE EXISTING AI CHAT ON MOBILE
       ========================================== */
    
    /* Hide the original AI chat panel on mobile devices */
    #ai-chat-panel,
    .ai-chat-panel,
    .ai-panel {
        display: none !important;
    }
    
    /* Hide any floating AI buttons */
    .ai-chat-fab,
    .ai-fab,
    .floating-ai,
    .ai-floating-button {
        display: none !important;
    }
    
    /* Hide study prompts section on mobile */
    #study-prompts-section,
    .study-prompts-section {
        display: none !important;
    }
    
    /* Hide regenerate prompts section on mobile */
    #regenerate-prompts-section,
    .regenerate-prompts-section {
        display: none !important;
    }
    
    /* Hide any AI-related modals or overlays on mobile */
    .ai-modal,
    .ai-overlay,
    .ai-popup {
        display: none !important;
    }
    
    /* ==========================================
       MOBILE VERSE SELECTION AI INTERFACE
       ========================================== */
    
    /* Clean ChatGPT-style verse selection interface */
    .mobile-verse-ai {
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: var(--bg-color, white);
        border-radius: 16px 16px 0 0;
        transform: translateY(100%);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        z-index: 2000;
        box-shadow: 
            0 -2px 16px rgba(26, 54, 93, 0.08),
            0 -4px 32px rgba(26, 54, 93, 0.04);
        border: 1px solid rgba(26, 54, 93, 0.06);
        border-bottom: none;
        max-height: 200px;
        overflow: hidden;
    }
    
    .mobile-verse-ai.active {
        transform: translateY(0);
    }
    
    /* Drag handle - BibliaTech theme */
    .mobile-verse-ai::before {
        content: '';
        position: absolute;
        top: 6px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 3px;
        background: rgba(26, 54, 93, 0.15);
        border-radius: 2px;
    }
    
    /* Main container */
    .mobile-verse-ai-content {
        padding: 16px 16px 20px 16px;
        display: flex;
        flex-direction: column;
        gap: 12px;
    }
    
    /* Action buttons row */
    .mobile-verse-actions {
        display: flex;
        gap: 8px;
        margin-bottom: 4px;
    }
    
    /* Small action buttons */
    .mobile-verse-action-btn {
        flex: 1;
        padding: 8px 12px;
        background: var(--spirit-whisper, #f8f8f8);
        border: 1px solid rgba(26, 54, 93, 0.08);
        border-radius: 8px;
        font-size: 13px;
        font-weight: 500;
        color: var(--text-secondary, #6b7280);
        cursor: pointer;
        transition: all 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 4px;
        min-height: 36px;
    }
    
    .mobile-verse-action-btn:hover {
        background: var(--spirit-mist, #f5f5f5);
        border-color: rgba(26, 54, 93, 0.12);
    }
    
    .mobile-verse-action-btn:active {
        transform: scale(0.98);
    }
    
    /* Clear button - subtle BibliaTech red */
    .mobile-verse-action-btn.clear {
        color: #c53030;
        border-color: rgba(197, 48, 48, 0.1);
        background: rgba(197, 48, 48, 0.02);
    }
    
    .mobile-verse-action-btn.clear:hover {
        background: rgba(197, 48, 48, 0.05);
        border-color: rgba(197, 48, 48, 0.15);
    }
    
    /* Study button - BibliaTech theme blue */
    .mobile-verse-action-btn.generate {
        color: #1a365d;
        border-color: rgba(26, 54, 93, 0.15);
        background: rgba(26, 54, 93, 0.02);
    }
    
    .mobile-verse-action-btn.generate:hover {
        background: rgba(26, 54, 93, 0.05);
        border-color: rgba(26, 54, 93, 0.2);
    }
    
    /* Input container */
    .mobile-verse-input-container {
        position: relative;
        display: flex;
        align-items: flex-end;
        gap: 8px;
    }
    
    /* AI input field - BibliaTech style */
    .mobile-verse-input {
        flex: 1;
        min-height: 44px;
        max-height: 120px;
        padding: 12px 16px;
        border: 1px solid rgba(26, 54, 93, 0.12);
        border-radius: 12px;
        font-size: 16px; /* Prevents zoom on iOS */
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
        color: var(--text-primary, #1a202c);
        background: var(--bg-color, white);
        resize: none;
        outline: none;
        transition: border-color 0.2s ease;
        line-height: 1.4;
    }
    
    .mobile-verse-input:focus {
        border-color: rgba(26, 54, 93, 0.3);
        box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.08);
    }
    
    .mobile-verse-input::placeholder {
        color: var(--text-muted, #9ca3af);
    }
    
    /* Send button - BibliaTech theme */
    .mobile-verse-send {
        width: 44px;
        height: 44px;
        border: none;
        border-radius: 12px;
        background: #1a365d;
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 18px;
        transition: all 0.2s ease;
        flex-shrink: 0;
    }
    
    .mobile-verse-send:hover {
        background: #2c5282;
        transform: translateY(-1px);
    }
    
    .mobile-verse-send:active {
        transform: translateY(0);
    }
    
    .mobile-verse-send:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
    }
    
    /* ==========================================
       FULL-SCREEN BIBLIA AI CHAT INTERFACE
       ========================================== */
    
    /* Main full-screen chat container - with slide-down capability */
    .mobile-ai-chat-expanded {
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: #f7f7f8;
        z-index: 3000;
        display: flex;
        flex-direction: column;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
        overflow: hidden;
    }
    
    .mobile-ai-chat-expanded.active {
        transform: translateY(0);
    }
    
    /* Remove the collapsed header-only state - we'll minimize to bottom sheet instead */
    
    /* Header section - enhanced for swipe-down functionality */
    .mobile-ai-header {
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding: 16px;
        background: white;
        color: #1a1a1a;
        min-height: 56px;
        border-bottom: 1px solid #e5e5e7;
        box-shadow: 0 1px 3px rgba(0, 0, 0, 0.1);
        position: relative;
    }
    
    /* Back button - updated styling */
    .mobile-ai-back {
        width: 32px;
        height: 32px;
        border: none;
        background: transparent;
        color: #1a1a1a;
        cursor: pointer;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        transition: all 0.2s ease;
    }
    
    .mobile-ai-back:hover {
        background: #f1f1f3;
    }
    
    .mobile-ai-back:active {
        transform: scale(0.95);
    }
    
    /* Title - updated styling */
    .mobile-ai-title {
        font-size: 16px;
        font-weight: 600;
        color: #1a1a1a;
        flex: 1;
        text-align: center;
        margin: 0 12px;
        letter-spacing: -0.2px;
    }
    
    /* Generate more prompts button - updated styling */
    .mobile-ai-generate-more {
        width: 32px;
        height: 32px;
        border: none;
        background: transparent;
        color: #1a1a1a;
        cursor: pointer;
        border-radius: 6px;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 14px;
        transition: all 0.2s ease;
    }
    
    .mobile-ai-generate-more:hover {
        background: #f1f1f3;
    }
    
    .mobile-ai-generate-more:active {
        transform: scale(0.95);
    }
    
    /* Verse context display - updated to match reference */
    .mobile-ai-verse-context {
        padding: 32px 20px 24px 20px;
        background: white;
        text-align: center;
        min-height: 100px;
        display: flex;
        flex-direction: column;
        justify-content: center;
        align-items: center;
        border-bottom: 1px solid #e5e5e7;
    }
    
    .mobile-ai-verse-title {
        font-size: 24px;
        font-weight: 600;
        color: #1a1a1a;
        margin-bottom: 6px;
        letter-spacing: -0.5px;
        line-height: 1.2;
    }
    
    .mobile-ai-verse-reference {
        font-size: 14px;
        color: #6b6b6b;
        font-weight: 400;
    }
    
    /* Study prompts container - updated design */
    .mobile-ai-prompts-section {
        padding: 16px 0 20px 0;
        background: white;
        border-bottom: 1px solid #e5e5e7;
    }
    
    .mobile-ai-prompts-title {
        font-size: 16px;
        font-weight: 600;
        color: #1a1a1a;
        margin-bottom: 12px;
        padding: 0 16px;
        letter-spacing: -0.2px;
    }
    
    /* Horizontal scrollable prompts - updated */
    .mobile-ai-prompts-scroll {
        display: flex;
        gap: 8px;
        padding: 0 16px;
        overflow-x: auto;
        scroll-behavior: smooth;
        scrollbar-width: none;
        -ms-overflow-style: none;
        padding-bottom: 4px;
    }
    
    .mobile-ai-prompts-scroll::-webkit-scrollbar {
        display: none;
    }
    
    /* Prompt cards with colored backgrounds */
    .mobile-ai-prompt-card {
        min-width: 240px;
        max-width: 280px;
        padding: 12px 16px;
        border-radius: 12px;
        cursor: pointer;
        transition: all 0.2s ease;
        flex-shrink: 0;
        position: relative;
        overflow: hidden;
        border: none;
    }
    
    /* Different colored prompt cards */
    .mobile-ai-prompt-card:nth-child(1) {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: white;
    }
    
    .mobile-ai-prompt-card:nth-child(2) {
        background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
        color: white;
    }
    
    .mobile-ai-prompt-card:nth-child(3) {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        color: white;
    }
    
    .mobile-ai-prompt-card:nth-child(4) {
        background: linear-gradient(135deg, #f59e0b 0%, #d97706 100%);
        color: white;
    }
    
    .mobile-ai-prompt-card:nth-child(5) {
        background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
        color: white;
    }
    
    .mobile-ai-prompt-card:nth-child(6) {
        background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
        color: white;
    }
    
    .mobile-ai-prompt-card:nth-child(7) {
        background: linear-gradient(135deg, #06b6d4 0%, #0891b2 100%);
        color: white;
    }
    
    .mobile-ai-prompt-card:nth-child(8) {
        background: linear-gradient(135deg, #10b981 0%, #059669 100%);
        color: white;
    }
    
    .mobile-ai-prompt-card:hover {
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    }
    
    .mobile-ai-prompt-card:active {
        transform: translateY(0);
    }
    
    .mobile-ai-prompt-text {
        font-size: 14px;
        line-height: 1.4;
        font-weight: 500;
        letter-spacing: -0.1px;
    }
    
    /* Add category tags */
    .mobile-ai-prompt-card::before {
        content: attr(data-category);
        position: absolute;
        top: 8px;
        right: 8px;
        background: rgba(255, 255, 255, 0.2);
        color: rgba(255, 255, 255, 0.8);
        padding: 2px 6px;
        border-radius: 4px;
        font-size: 10px;
        font-weight: 600;
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }
    
    /* Chat messages area - enhanced */
    .mobile-ai-chat-messages {
        flex: 1;
        overflow-y: auto;
        padding: 20px;
        background: #fafbfc;
        scroll-behavior: smooth;
        position: relative;
    }
    
    /* Empty state styling */
    .mobile-ai-chat-messages:empty::before {
        content: 'Start asking questions about your selected verses...';
        position: absolute;
        top: 50%;
        left: 50%;
        transform: translate(-50%, -50%);
        color: #94a3b8;
        font-size: 16px;
        font-weight: 500;
        text-align: center;
        opacity: 0.7;
    }
    
    /* Message bubbles - enhanced */
    .mobile-ai-message {
        margin-bottom: 20px;
        animation: messageSlideIn 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    @keyframes messageSlideIn {
        0% {
            opacity: 0;
            transform: translateY(12px);
        }
        100% {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* User messages - ChatGPT style */
    .mobile-ai-message.user {
        display: flex;
        justify-content: flex-end;
        margin-bottom: 16px;
    }
    
    .mobile-ai-message.user .message-content {
        background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
        color: white;
        padding: 14px 18px;
        border-radius: 18px 18px 6px 18px;
        max-width: 85%;
        font-size: 15px;
        line-height: 1.4;
        font-weight: 500;
        box-shadow: 0 2px 8px rgba(26, 54, 93, 0.25);
        position: relative;
    }
    
    /* AI assistant messages - refined */
    .mobile-ai-message.assistant {
        display: flex;
        justify-content: flex-start;
        margin-bottom: 20px;
    }
    
    .mobile-ai-message.assistant .message-content {
        background: white;
        color: #374151;
        padding: 16px 20px;
        border-radius: 18px 18px 18px 6px;
        max-width: 88%;
        font-size: 15px;
        line-height: 1.5;
        border: 1px solid rgba(226, 232, 240, 0.8);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        position: relative;
    }
    
    /* Assistant label - refined */
    .mobile-ai-assistant-label {
        font-size: 12px;
        color: #64748b;
        font-weight: 600;
        margin-bottom: 6px;
        margin-left: 4px;
        letter-spacing: 0.5px;
        text-transform: uppercase;
    }
    
    /* Chat input area - ChatGPT style */
    .mobile-ai-input-area {
        padding: 16px 20px 20px 20px;
        background: white;
        border-top: 1px solid rgba(226, 232, 240, 0.8);
        box-shadow: 0 -2px 8px rgba(0, 0, 0, 0.04);
    }
    
    .mobile-ai-input-container-expanded {
        display: flex;
        align-items: flex-end;
        gap: 12px;
        background: #f8fafc;
        border: 2px solid rgba(226, 232, 240, 0.6);
        border-radius: 16px;
        padding: 8px 12px;
        transition: all 0.2s ease;
        position: relative;
    }
    
    .mobile-ai-input-container-expanded:focus-within {
        border-color: #1a365d;
        background: white;
        box-shadow: 0 0 0 3px rgba(26, 54, 93, 0.1);
    }
    
    .mobile-ai-input-expanded {
        flex: 1;
        min-height: 20px;
        max-height: 120px;
        padding: 8px 4px;
        border: none;
        background: transparent;
        font-size: 16px;
        font-family: -apple-system, BlinkMacSystemFont, 'SF Pro Text', system-ui, sans-serif;
        color: #374151;
        resize: none;
        outline: none;
        line-height: 1.4;
        font-weight: 500;
    }
    
    .mobile-ai-input-expanded::placeholder {
        color: #9ca3af;
        font-weight: 400;
    }
    
    .mobile-ai-send-expanded {
        width: 40px;
        height: 40px;
        border: none;
        border-radius: 12px;
        background: linear-gradient(135deg, #1a365d 0%, #2c5282 100%);
        color: white;
        cursor: pointer;
        display: flex;
        align-items: center;
        justify-content: center;
        font-size: 16px;
        transition: all 0.2s ease;
        flex-shrink: 0;
        box-shadow: 0 2px 6px rgba(26, 54, 93, 0.25);
    }
    
    .mobile-ai-send-expanded:hover {
        background: linear-gradient(135deg, #2c5282 0%, #3c6382 100%);
        transform: translateY(-1px);
        box-shadow: 0 4px 12px rgba(26, 54, 93, 0.3);
    }
    
    .mobile-ai-send-expanded:active {
        transform: translateY(0);
    }
    
    .mobile-ai-send-expanded:disabled {
        opacity: 0.5;
        cursor: not-allowed;
        transform: none;
        box-shadow: 0 2px 6px rgba(26, 54, 93, 0.15);
    }
    
    /* Loading indicator - enhanced */
    .mobile-ai-typing {
        display: flex;
        align-items: center;
        gap: 8px;
        padding: 16px 20px;
        color: #64748b;
        font-size: 14px;
        font-style: italic;
        background: white;
        border-radius: 18px 18px 18px 6px;
        max-width: 88%;
        border: 1px solid rgba(226, 232, 240, 0.8);
        box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
        margin-bottom: 20px;
    }
    
    .mobile-ai-typing-dots {
        display: inline-flex;
        gap: 3px;
    }
    
    .mobile-ai-typing-dot {
        width: 6px;
        height: 6px;
        background: #64748b;
        border-radius: 50%;
        animation: typingDot 1.4s infinite ease-in-out;
    }
    
    .mobile-ai-typing-dot:nth-child(2) {
        animation-delay: 0.2s;
    }
    
    .mobile-ai-typing-dot:nth-child(3) {
        animation-delay: 0.4s;
    }
    
    @keyframes typingDot {
        0%, 80%, 100% {
            opacity: 0.3;
            transform: scale(0.8);
        }
        40% {
            opacity: 1;
            transform: scale(1.1);
        }
    }
    
    /* ==========================================
       CONTEXTUAL VERSE SELECTION HINTS
       ========================================== */
    
    /* Selection hint tooltip */
    .verse-selection-hint {
        position: fixed;
        top: 80px;
        left: 50%;
        transform: translateX(-50%);
        background: var(--text-primary, #1a202c);
        color: white;
        padding: 8px 16px;
        border-radius: 8px;
        font-size: 14px;
        font-weight: 500;
        z-index: 1001;
        opacity: 0;
        animation: hintSlideDown 0.3s ease forwards;
        pointer-events: none;
    }
    
    @keyframes hintSlideDown {
        0% { 
            opacity: 0; 
            transform: translateX(-50%) translateY(-10px); 
        }
        100% { 
            opacity: 1; 
            transform: translateX(-50%) translateY(0); 
        }
    }
    
    /* Auto-hide hint after delay */
    .verse-selection-hint.fade-out {
        animation: hintFadeOut 0.3s ease forwards;
    }
    
    @keyframes hintFadeOut {
        0% { opacity: 1; }
        100% { opacity: 0; }
    }
}

/* ============================================
   LANDSCAPE MOBILE OPTIMIZATIONS
   ============================================ */

@media (max-width: 1024px) and (orientation: landscape) {
    
    /* Reduce header padding in landscape */
    .bible-header {
        padding: 8px 16px 6px 16px;
    }
    
    /* Compact content padding */
    .bible-content,
    .chapter-content {
        padding: 16px 20px 32px 20px;
        font-size: 17px;
        line-height: 1.65;
    }
    
    /* Reduce mobile verse AI height in landscape */
    .mobile-verse-ai {
        max-height: 180px;
    }
}

/* ============================================
   DARK MODE OPTIMIZATIONS
   ============================================ */

@media (max-width: 1024px) {
    
    [data-theme="dark"] .bible-header {
        background: var(--bg-color, #1a202c);
        border-bottom-color: rgba(255, 255, 255, 0.1);
    }
    
    [data-theme="dark"] .bible-navigation select {
        background: var(--bg-secondary, #2d3748);
        border-color: rgba(255, 255, 255, 0.1);
        color: var(--text-primary, #f7fafc);
    }
    
    [data-theme="dark"] .bible-content,
    [data-theme="dark"] .chapter-content {
        color: var(--text-primary, #f7fafc);
    }
    
    /* Dark mode verse highlighting - uses user's preferred color */
    [data-theme="dark"] .verse-text.selected,
    [data-theme="dark"] .verse-text-wrapper.selected {
        background: var(--user-highlight-selected); /* User's preferred color */
        border-left-color: var(--user-highlight-border);
        color: #000000 !important; /* Force black text for visibility */
        text-shadow: none !important; /* Remove any conflicting shadows */
    }
    
    [data-theme="dark"] .verse-selected,
    [data-theme="dark"] .v.selected {
        background-color: var(--user-highlight-bg-30); /* Enhanced opacity for dark mode */
        box-shadow: 0 0 0 1px var(--user-highlight-border);
        color: var(--user-highlight-text); /* User's color contrast text */
    }
    
    /* Remove hover effects in dark mode too - uses user's preferred color */
    [data-theme="dark"] .verse-text.selected:hover,
    [data-theme="dark"] .verse-text-wrapper.selected:hover,
    [data-theme="dark"] .v.selected:hover {
        background: var(--user-highlight-selected) !important; /* User's preferred color */
        border-left-color: var(--user-highlight-border) !important;
        color: #000000 !important; /* Force black text */
    }
    
    /* Ensure all nested elements in dark mode have proper text color */
    [data-theme="dark"] .verse-text.selected *,
    [data-theme="dark"] .verse-text-wrapper.selected *,
    [data-theme="dark"] .verse-text.selected:hover *,
    [data-theme="dark"] .verse-text-wrapper.selected:hover * {
        color: #000000 !important; /* Force black text for all nested elements */
        text-shadow: none !important;
    }
    
    [data-theme="dark"] .mobile-verse-ai {
        background: var(--bg-color, #1a202c);
        border-color: rgba(255, 255, 255, 0.1);
        box-shadow: 
            0 -2px 16px rgba(0, 0, 0, 0.3),
            0 -4px 32px rgba(0, 0, 0, 0.2);
    }
    
    [data-theme="dark"] .mobile-verse-ai::before {
        background: rgba(255, 255, 255, 0.2);
    }
    
    [data-theme="dark"] .mobile-verse-action-btn {
        background: var(--bg-secondary, #2d3748);
        border-color: rgba(255, 255, 255, 0.1);
        color: var(--text-secondary, #cbd5e0);
    }
    
    [data-theme="dark"] .mobile-verse-action-btn:hover {
        background: var(--bg-tertiary, #374151);
        border-color: rgba(255, 255, 255, 0.15);
    }
    
    [data-theme="dark"] .mobile-verse-action-btn.clear {
        color: #fc8181;
        border-color: rgba(252, 129, 129, 0.15);
        background: rgba(252, 129, 129, 0.05);
    }
    
    [data-theme="dark"] .mobile-verse-action-btn.clear:hover {
        background: rgba(252, 129, 129, 0.1);
        border-color: rgba(252, 129, 129, 0.2);
    }
    
    [data-theme="dark"] .mobile-verse-action-btn.generate {
        color: #63b3ed;
        border-color: rgba(99, 179, 237, 0.15);
        background: rgba(99, 179, 237, 0.05);
    }
    
    [data-theme="dark"] .mobile-verse-action-btn.generate:hover {
        background: rgba(99, 179, 237, 0.1);
        border-color: rgba(99, 179, 237, 0.2);
    }
    
    [data-theme="dark"] .mobile-verse-input {
        background: var(--bg-color, #1a202c);
        border-color: rgba(255, 255, 255, 0.1);
        color: var(--text-primary, #f7fafc);
    }
    
    [data-theme="dark"] .mobile-verse-input:focus {
        border-color: rgba(99, 179, 237, 0.4);
        box-shadow: 0 0 0 3px rgba(99, 179, 237, 0.12);
    }
    
    [data-theme="dark"] .mobile-verse-send {
        background: #63b3ed;
        color: var(--bg-color, #1a202c);
    }
    
    [data-theme="dark"] .mobile-verse-send:hover {
        background: #90cdf4;
    }
    
    /* Mobile AI Loading Styles */
    .mobile-ai-loading {
        width: 12px;
        height: 12px;
        border: 2px solid rgba(255, 255, 255, 0.3);
        border-top: 2px solid currentColor;
        border-radius: 50%;
        animation: mobile-ai-spin 1s linear infinite;
        display: inline-block;
    }
    
    @keyframes mobile-ai-spin {
        from { transform: rotate(0deg); }
        to { transform: rotate(360deg); }
    }
    
    /* Disabled state for generate button */
    .mobile-verse-action-btn:disabled {
        opacity: 0.6;
        cursor: not-allowed;
        pointer-events: none;
    }
    
    /* FINAL MOBILE BIBLE TEXT OVERRIDES - Enhanced spacing and no hyphenation */
    
    /* Ensure clean, compact text on mobile with better spacing - highest specificity */
    .bible-content,
    .chapter-content,
    .bible-content p,
    .chapter-content p {
        font-size: 15px !important; /* Slightly larger for better readability */
        line-height: 1.85 !important; /* Increased line spacing for better readability */
        letter-spacing: 0.01em !important;
        word-spacing: 0.02em !important;
        /* Prevent hyphenation completely with cross-browser support */
        -webkit-hyphens: none !important;
        -moz-hyphens: none !important;
        -ms-hyphens: none !important;
        hyphens: none !important;
        word-break: normal !important;
        overflow-wrap: break-word !important;
        word-wrap: break-word !important;
    }
    
    /* Clean verse numbers with highest specificity */
    .v {
        font-size: 0.6em !important;
        color: #8a8a8a !important;
        margin-right: 4px !important;
        font-weight: 500 !important;
        padding: 0px 2px !important;
        min-width: 14px !important;
    }
    
    /* Completely disable all hover, active, and focus effects on Bible text */
    .bible-content *,
    .chapter-content *,
    .verse-text,
    .verse-text-wrapper,
    .v {
        -webkit-tap-highlight-color: transparent !important;
        -webkit-touch-callout: none !important;
        -webkit-user-select: none !important;
        -moz-user-select: none !important;
        -ms-user-select: none !important;
        user-select: none !important;
        cursor: default !important;
    }
    
    /* Override any remaining hover effects with highest specificity */
    .bible-content *:hover,
    .chapter-content *:hover,
    .bible-content *:active,
    .chapter-content *:active,
    .bible-content *:focus,
    .chapter-content *:focus,
    .verse-text:hover,
    .verse-text-wrapper:hover,
    .verse-text:active,
    .verse-text-wrapper:active,
    .verse-text:focus,
    .verse-text-wrapper:focus,
    .v:hover,
    .v:active,
    .v:focus {
        background: transparent !important;
        border: none !important;
        box-shadow: none !important;
        outline: none !important;
        transform: none !important;
        opacity: 1 !important;
        color: inherit !important;
    }
}

/* ============================================
   MOBILE BOOK SELECTION WIDGET
   ============================================ */

/* Mobile-only book selection widget - works in both orientations */
@media (max-width: 1024px) {
  
  #mobile-book-widget {
    /* Use theme variables with fallbacks */
    background: var(--theme-bg-card) !important;
    color: var(--theme-text-primary) !important;
    border: 1px solid var(--theme-border-gentle) !important;
    border-radius: 0 0 12px 0 !important;
    
    /* Widget appearance - smaller sidebar from top-left */
    position: fixed !important;
    top: 44px !important;
    left: 0 !important;
    width: 280px !important;
    max-width: 75vw !important;
    max-height: 70vh !important;
    overflow-y: auto !important;
    padding: 16px !important;
    box-shadow: var(--theme-shadow-elevated) !important;
    z-index: 1000 !important;
    
    /* Ensure visibility */
    display: block !important;
    visibility: visible !important;
    opacity: 1 !important;
    
    /* Smooth animation - slide from left */
    animation: slideFromLeft 0.2s ease-out;
  }
  
  /* Book tile styling within widget - optimized for sidebar */
  #mobile-book-widget .book-tile {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-light) !important;
    color: var(--theme-text-primary) !important;
    
    /* Tile appearance - full width in sidebar */
    border-radius: 8px !important;
    padding: 16px 18px !important;
    text-align: left !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.2s ease !important;
    touch-action: manipulation !important;
    min-height: 52px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: flex-start !important;
    /* Ensure text is visible */
    line-height: 1.2 !important;
    word-wrap: break-word !important;
    overflow: hidden !important;
    /* Enhanced touch area */
    position: relative !important;
  }
  
  /* Book tile hover/active states using theme variables */
  #mobile-book-widget .book-tile:hover {
    background: var(--theme-bg-tertiary) !important;
    border-color: var(--theme-text-chapter) !important;
    color: var(--theme-text-chapter) !important;
    transform: translateY(-1px) !important;
    box-shadow: var(--theme-shadow-soft) !important;
  }
  
  #mobile-book-widget .book-tile:active {
    transform: scale(0.98) !important;
    transition: transform 0.1s ease !important;
  }
  
  /* Chapter tile styling - enhanced for touch */
  #mobile-book-widget .chapter-tile {
    background: var(--theme-bg-secondary) !important;
    border: 1px solid var(--theme-border-light) !important;
    color: var(--theme-text-primary) !important;
    
    /* Chapter tile appearance - larger touch targets */
    border-radius: 8px !important;
    padding: 12px 8px !important;
    text-align: center !important;
    cursor: pointer !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    transition: all 0.3s ease !important;
    touch-action: manipulation !important;
    min-height: 48px !important;
    min-width: 48px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    /* Ensure text is visible */
    line-height: 1 !important;
    overflow: hidden !important;
    position: relative !important;
  }
  
  /* Chapter tile interactions using theme variables */
  #mobile-book-widget .chapter-tile:hover {
    background: var(--theme-gradient-wisdom) !important;
    color: var(--theme-bg-primary) !important;
    border-color: var(--theme-text-chapter) !important;
    transform: scale(1.05) !important;
    box-shadow: var(--theme-shadow-soft) !important;
  }
  
  #mobile-book-widget .chapter-tile:active {
    transform: scale(0.95) !important;
    transition: transform 0.1s ease !important;
  }
  
  /* Enhanced touch handling for mobile devices */
  @media (hover: none) and (pointer: coarse) {
    #mobile-book-widget .chapter-tile {
      min-height: 50px !important;
      min-width: 50px !important;
      font-size: 15px !important;
    }
    
    #mobile-book-widget .book-tile {
      min-height: 56px !important;
      padding: 18px 20px !important;
    }
    
    /* Remove hover effects on touch devices */
    #mobile-book-widget .chapter-tile:hover,
    #mobile-book-widget .book-tile:hover {
      transform: none !important;
    }
    
    /* Enhanced active states for touch */
    #mobile-book-widget .chapter-tile:active {
      background: var(--theme-gradient-wisdom) !important;
      color: var(--theme-bg-primary) !important;
      transform: scale(0.98) !important;
    }
    
    #mobile-book-widget .book-tile:active {
      background: var(--theme-bg-tertiary) !important;
      color: var(--theme-text-chapter) !important;
      transform: scale(0.98) !important;
    }
  }
  
  /* Widget header styling - smaller */
  #mobile-book-widget .widget-header {
    padding-bottom: 8px !important;
    margin-bottom: 12px !important;
    border-bottom: 1px solid var(--border-color, #e5e7eb) !important;
  }
  
  /* Dark mode header */
  [data-theme="dark"] #mobile-book-widget .widget-header {
    border-bottom-color: var(--dark-border-color, #374151) !important;
  }
  
  /* Back button styling */
  #mobile-book-widget .back-button {
    background: none !important;
    border: none !important;
    color: var(--primary-color, #6366f1) !important;
    font-size: 14px !important;
    font-weight: 500 !important;
    cursor: pointer !important;
    padding: 4px 0 !important;
    touch-action: manipulation !important;
  }
  
  /* Dark mode back button */
  [data-theme="dark"] #mobile-book-widget .back-button {
    color: var(--dark-primary-color, #818cf8) !important;
  }
  
  /* Book/chapter title in widget */
  #mobile-book-widget .widget-title {
    margin: 0 0 0 12px !important;
    font-size: 16px !important;
    font-weight: 600 !important;
    color: var(--text-color, #374151) !important;
  }
  
  /* Dark mode title */
  [data-theme="dark"] #mobile-book-widget .widget-title {
    color: var(--dark-text-color, #f9fafb) !important;
  }
  
  /* Slide from left animation for sidebar appearance */
  @keyframes slideFromLeft {
    from {
      opacity: 0;
      transform: translateX(-20px);
    }
    to {
      opacity: 1;
      transform: translateX(0);
    }
  }
  
  /* Grid layouts within widget - optimized for sidebar */
  #mobile-book-widget .books-grid {
    display: grid !important;
    grid-template-columns: 1fr !important;
    gap: 8px !important;
    padding: 0 !important;
  }
  
  #mobile-book-widget .chapters-grid {
    display: grid !important;
    grid-template-columns: repeat(5, 1fr) !important;
    gap: 6px !important;
    padding: 0 !important;
  }
  
  /* Responsive adjustments for very small screens */
  @media (max-width: 360px) {
    #mobile-book-widget {
      width: 260px !important;
      max-width: 80vw !important;
    }
    
    #mobile-book-widget .chapters-grid {
      grid-template-columns: repeat(4, 1fr) !important;
    }
    
    #mobile-book-widget .book-tile {
      font-size: 12px !important;
      padding: 8px 4px !important;
    }
  }
  
  /* Better dark mode detection and override */
  .dark #mobile-book-widget,
  html[data-theme="dark"] #mobile-book-widget {
    background: #1f2937 !important;
    color: #f9fafb !important;
    border-bottom-color: #374151 !important;
  }
  
  .dark #mobile-book-widget .book-tile,
  html[data-theme="dark"] #mobile-book-widget .book-tile,
  .dark #mobile-book-widget .chapter-tile,
  html[data-theme="dark"] #mobile-book-widget .chapter-tile {
    background: #374151 !important;
    border-color: #4b5563 !important;
    color: #f9fafb !important;
  }
  
  .dark #mobile-book-widget .widget-title,
  html[data-theme="dark"] #mobile-book-widget .widget-title {
    color: #f9fafb !important;
  }
  
  .dark #mobile-book-widget .back-button,
  html[data-theme="dark"] #mobile-book-widget .back-button {
    color: #818cf8 !important;
  }
}