/* hide Strong's numbers when needed */

blockquote, dd, dl, figure, h1, h2, h3, h4, h5, h6, hr, p, pre {
    margin: 0;
    color: #ffffff;
}

.text-sm{
    color: #ffffff;
}

.strong-hidden .strong-num {
    display: none;
}

/* Bible verse styling */
#versesContainerLocal p {
    margin-bottom: 0.75rem;
    line-height: 1.6;
}

#versesContainerLocal .verse-num {
    font-weight: bold;
    min-width: 1.5rem;
    display: inline-block;
    color: #575fcf;
}

/* Add border style for title field */
#id_title {
    border: 2px solid #d1d5db;
    border-radius: 0.375rem;
    padding: 0.5rem;
    width: 100%;
}

.strong-num {
    font-size: 0.75rem;
    color: #575fcf;
    vertical-align: super;
    cursor: pointer;
    padding: 0 2px;
    border-radius: 3px;
    background-color: rgba(79, 70, 229, 0.1);
    transition: background-color 0.2s;
}

.strong-num:hover {
    background-color: rgba(79, 70, 229, 0.2);
    text-decoration: underline;
}

/* Bible container scrollbar styling */
#versesContainerLocal::-webkit-scrollbar { width: 6px; }
#versesContainerLocal::-webkit-scrollbar-track { background: #f1f5f9; border-radius: 4px; }
#versesContainerLocal::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* Navigation buttons styling */
#navPrev, #navNext { transition: transform 0.2s, background-color 0.2s; }
#navPrev:hover, #navNext:hover { background-color: #211e1f; transform: translateY(-50%) scale(1.1); }
#navPrev:active, #navNext:active { transform: translateY(-50%) scale(0.95); }

@media (max-width: 640px) {
    #navPrev { transform: translateY(-50%) translateX(-2px); }
    #navNext { transform: translateY(-50%) translateX(2px); }
    #navPrev:hover { transform: translateY(-50%) translateX(-2px) scale(1.1); }
    #navNext:hover { transform: translateY(-50%) translateX(2px) scale(1.1); }
}

/* Chat typing indicator */
.typing-dot { display: inline-block; width: 6px; height: 6px; border-radius: 50%; background-color: #575fcf; margin: 0 2px; animation: typing-dot 1.4s infinite ease-in-out both; }
.typing-dot:nth-child(1) { animation-delay: -0.32s; }
.typing-dot:nth-child(2) { animation-delay: -0.16s; }
@keyframes typing-dot { 0%, 80%, 100% { transform: scale(0); } 40% { transform: scale(1); } }

/* ChatGPT-like typing animation for responses */
.typing-animation {
    overflow: hidden;
    border-right: 2px solid #575fcf;
    white-space: nowrap;
    animation: typing 0.05s steps(1, end), blink-caret 1s step-end infinite;
    max-width: 100%;
    word-break: break-word;
}

@keyframes typing {
    from { width: 0; }
    to { width: 100%; }
}

@keyframes blink-caret {
    from, to { border-color: transparent; }
    50% { border-color: #575fcf; }
}

/* Mobile chat improvements */
@media (max-width: 768px) {
    /* Ensure chat messages start from top after user sends message */
    .chat-container {
        display: flex;
        flex-direction: column;
    }
    
    #chatScroll {
        flex: 1;
        overflow-y: auto;
        scroll-behavior: smooth;
        -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
    }
    
    /* New message appears at top on mobile */
    .new-message-top {
        transform: translateY(-20px);
        opacity: 0;
        animation: slideInFromTop 0.3s ease-out forwards;
    }
    
    @keyframes slideInFromTop {
        to {
            transform: translateY(0);
            opacity: 1;
        }
    }
    
    /* Smooth message appearance */
    .message-appear {
        opacity: 0;
        transform: translateY(10px);
        animation: messageAppear 0.4s ease-out forwards;
    }
    
    @keyframes messageAppear {
        to {
            opacity: 1;
            transform: translateY(0);
        }
    }
    
    /* Mobile-specific input styling */
    #chatInput {
        font-size: 16px !important; /* Prevents zoom on iOS */
        border-radius: 20px !important;
        padding: 12px 16px !important;
        min-height: 44px; /* iOS recommended touch target */
        -webkit-appearance: none; /* Remove iOS styling */
    }
    
    /* Mobile touch targets */
    .mobile-tab-button,
    button[type="submit"],
    #chatMicButton {
        min-height: 44px;
        min-width: 44px;
        -webkit-tap-highlight-color: transparent; /* Remove tap highlight */
    }
    
    /* Prevent text selection on buttons */
    button, .mobile-tab-button {
        -webkit-user-select: none;
        -moz-user-select: none;
        -ms-user-select: none;
        user-select: none;
        -webkit-touch-callout: none; /* Disable callout on iOS */
    }
    
    /* Fixed keyboard handling */
    .chat-input-wrapper {
        position: sticky;
        bottom: 0;
      
        border-top: 1px solid #e5e7eb;
        z-index: 10;
        padding: 8px 0; /* Add some padding for easier touch */
    }
    
    /* Better visual feedback for touch */
    button:active {
        transform: scale(0.95);
        transition: transform 0.1s ease;
    }
    
    /* Optimize chat messages for mobile viewing */
    #chatMessages {
        padding: 16px 4px; /* Reduced horizontal padding since no avatars */
        gap: 8px; /* Reduced spacing between messages */
    }
    
    #chatMessages article {
        margin-bottom: 8px; /* Reduced margin between messages */
    }
    
    /* Improve message bubble appearance on mobile and ensure no overflow */
    .message-content {
        border-radius: 18px !important;
        box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
        max-width: 100% !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
        hyphens: auto !important;
    }
    
    /* Mobile typing animation improvements */
    .typing-animation {
        white-space: normal !important; /* Allow wrapping on mobile */
        max-width: 100% !important;
        overflow-wrap: break-word !important;
        word-break: break-word !important;
    }
    
    /* Ensure message containers don't overflow */
    .max-w-prose {
        max-width: 100% !important;
        overflow: hidden;
    }
    
    /* Better spacing for assistant controls on mobile */
    .assistant-message-controls {
        flex-wrap: wrap;
        gap: 8px;
    }
}

/* Enhanced message styling for mobile - better use of space without avatars */
@media (max-width: 768px) {
    .message-content {
        font-size: 16px !important;
        line-height: 1.5 !important;
        padding: 14px 18px !important; /* Slightly larger padding for better readability */
    }
    
    .assistant-message-controls button {
        font-size: 14px !important;
        padding: 8px 12px !important;
        min-height: 36px;
    }
}

/* Better message layout without avatars - desktop */
@media (min-width: 769px) {
    #chatMessages {
        padding: 24px 12px; /* Reduced horizontal padding since no avatars */
        gap: 8px; /* Reduced spacing between messages */
    }
    
    #chatMessages article {
        margin-bottom: 8px; /* Reduced margin between messages */
    }
    
    .message-content {
        max-width: 85%; /* Allow messages to take more space */
    }
    
    /* User messages aligned to the right */
    article:has(.bg-indigo-50) .max-w-prose {
        margin-left: auto;
    }
}

/* Remove space-x-3 spacing since no avatars */
.greeting-message, 
.research-status-message,
#typingIndicator,
#chatMessages article {
    gap: 0 !important;
}

/* Minimize space between consecutive messages */
#chatMessages article + article {
    margin-top: -4px; /* Pull messages closer together */
}

/* Specifically target user message followed by assistant message */
#chatMessages article:has(.bg-indigo-50) + article:has(.bg-white) {
    margin-top: -6px; /* Even closer spacing between user and assistant */
}

/* And assistant message followed by user message */
#chatMessages article:has(.bg-white) + article:has(.bg-indigo-50) {
    margin-top: -6px; /* Even closer spacing between assistant and user */
}

/* Make text labels clickable alongside icons */
#libraryModeTextLabel,
#researchModeTextLabel,
#generalStudyTextLabel,
#challengeModeTextLabel,
#exploreTextLabel {
    cursor: pointer;
    transition: color 0.2s ease, transform 0.1s ease;
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
}

#libraryModeTextLabel:hover,
#researchModeTextLabel:hover,
#generalStudyTextLabel:hover,
#challengeModeTextLabel:hover,
#exploreTextLabel:hover {
    color: #4f46e5;
    transform: translateY(-1px);
}

#libraryModeTextLabel:active,
#researchModeTextLabel:active,
#generalStudyTextLabel:active,
#challengeModeTextLabel:active,
#exploreTextLabel:active {
    transform: translateY(0);
    color: #3730a3;
}

/* Chat session styling */
.session-group { margin-bottom: 0.5rem; }
.session-group-header { display: flex; align-items: center; padding: 0.25rem 0.5rem; font-size: 0.75rem; font-weight: 600; color: #4b5563; cursor: pointer; }
.session-group-header:hover { background-color: #f1f5f9; border-radius: 0.375rem; }
.session-group-content { margin-left: 0.5rem; margin-top: 0.25rem; }
.session-item { display: flex; align-items: center; padding: 0.375rem 0.5rem; border-radius: 0.375rem; cursor: pointer; transition: background-color 0.2s; }
.session-item:hover { background-color: #f1f5f9; }
.session-item.active { background-color: #e0e7ff; }
.session-icon { flex-shrink: 0; width: 1.5rem; height: 1.5rem; margin-right: 0.5rem; border-radius: 0.25rem; display: flex; align-items: center; justify-content: center; background-color: #575fcf; color: white; font-size: 0.625rem; }
.session-title { font-size: 0.875rem; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; }

/* Strongs tooltip */
.strongs-tooltip { position: fixed; max-width: 300px; padding: 10px; background: white; border: 1px solid #ddd; border-radius: 4px; box-shadow: 0 2px 8px rgba(0,0,0,0.15); z-index: 1000; font-size: 0.875rem; visibility: hidden; opacity: 0; transition: opacity 0.3s; }
.strongs-tooltip.visible { visibility: visible; opacity: 1; }
.strongs-tooltip h4 { margin: 0 0 5px 0; font-size: 1rem; color: #575fcf; }
.strongs-tooltip p { margin: 5px 0; }
.strongs-tooltip .close-btn { position: absolute; top: 5px; right: 5px; cursor: pointer; color: #666; font-size: 0.875rem; }

/* Add CKEditor specific styles */

/* Notes Modal CKEditor Styling */
#notesModal .ck-editor {
  border-radius: 8px !important;
  border: 2px solid #e5e7eb !important;
  transition: border-color 0.2s ease !important;
}

#notesModal .ck-editor:focus-within {
  border-color: #001831 !important;
  box-shadow: 0 0 0 3px rgba(0, 24, 49, 0.1) !important;
}

#notesModal .ck-editor__main {
  min-height: 300px !important;
}

#notesModal .ck-content {
  min-height: 280px !important;
  padding: 16px !important;
  font-size: 14px !important;
  line-height: 1.6 !important;
}

#notesModal .ck-toolbar {
  border-bottom: 1px solid #e5e7eb !important;
  background: #f9fafb !important;
  border-top-left-radius: 8px !important;
  border-top-right-radius: 8px !important;
  padding: 8px 12px !important;
}

#notesModal .ck-button {
  border-radius: 4px !important;
  margin: 2px !important;
}

#notesModal .ck-button:hover {
  background: #e5e7eb !important;
}

#notesModal .ck-button.ck-on {
  background: #001831 !important;
  color: white !important;
}

/* Modal backdrop blur effect */
#notesModal, #viewNotesModal {
  backdrop-filter: blur(4px);
}

/* Modal animation */
#notesModal:not(.hidden), #viewNotesModal:not(.hidden) {
  animation: modalFadeIn 0.2s ease-out;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
    transform: scale(0.95);
  }
  to {
    opacity: 1;
    transform: scale(1);
  }
}

/* View Notes Modal specific styling */
#viewNotesModal .note-item {
  transition: transform 0.2s ease, box-shadow 0.2s ease !important;
}

#viewNotesModal .note-item:hover {
  transform: translateY(-2px) !important;
  box-shadow: 0 8px 25px rgba(0, 0, 0, 0.15) !important;
}

#viewNotesModal .actions-area button {
  transition: all 0.2s ease !important;
}

#viewNotesModal .actions-area button:hover {
  transform: translateY(-1px) !important;
}

/* Search bar styling in view notes modal */
#viewNotesModal #notesSearchInput {
  border: 2px solid #e5e7eb !important;
  transition: border-color 0.2s ease !important;
  color: #000000 !important;
}

#viewNotesModal #notesSearchInput:focus {
  border-color: #001831 !important;
  box-shadow: 0 0 0 3px rgba(0, 24, 49, 0.1) !important;
}
.ck-editor__editable { min-height: 200px; max-height: 400px; border-radius: 0.5rem !important; }
.ck-toolbar { border-radius: 0.5rem !important; flex-wrap: wrap !important; display: flex !important; }
.ck-toolbar__items { flex-wrap: wrap !important; width: 100% !important; }
.ck.ck-toolbar > .ck-toolbar__items > * { margin-bottom: 4px !important; margin-right: 4px !important; }
.ck.ck-button { min-width: 30px !important; }

/* Markdown content styling */
.markdown-content { line-height: 1.6; }
.markdown-content p { margin-bottom: 1em; }
.markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4, .markdown-content h5, .markdown-content h6 { margin-top: 1.5em; margin-bottom: 0.5em; font-weight: 600; }
.markdown-content h1 { font-size: 1.5em; } .markdown-content h2 { font-size: 1.3em; } .markdown-content h3 { font-size: 1.2em; } .markdown-content h4 { font-size: 1.1em; } .markdown-content h5, .markdown-content h6 { font-size: 1em; }
.markdown-content ul, .markdown-content ol { margin-bottom: 1em; padding-left: 2em; }
.markdown-content ul { list-style-type: disc; color: #ffffff !important; } .markdown-content ol { list-style-type: decimal; }
.markdown-content li { margin-bottom: 0.5em; color: #ffffff !important; }
.markdown-content blockquote { margin-left: 0; padding-left: 1em; border-left: 3px solid #cbd5e1; color: #64748b; }
.markdown-content code { font-family: monospace; background-color: #f1f5f9; padding: 0.2em 0.4em; border-radius: 4px; font-size: 0.9em; }
.markdown-content pre { background-color: #f1f5f9; padding: 1em; border-radius: 4px; overflow-x: auto; margin-bottom: 1em; }
.markdown-content pre code { background-color: transparent; padding: 0; }
.markdown-content a {
    color: #3b82f6;
    text-decoration: underline;
    transition: color 0.2s ease;
    position: relative;
    padding-right: 1.2em;
}

.markdown-content a:hover {
    color: #2563eb;
}

.markdown-content a:visited {
    color: #7c3aed;
}

.markdown-content a::after {
    content: '↗';
    position: absolute;
    font-size: 0.8em;
    margin-left: 0.2em;
    top: 0;
}

/* Make source links stand out more */
.markdown-content a[href^="http"] { position: relative; padding-right: 1.2em; }
.markdown-content a[href^="http"]::after { content: '↗'; position: absolute; font-size: 0.8em; margin-left: 0.2em; top: 0; }
.markdown-content table { border-collapse: collapse; width: 100%; margin-bottom: 1em; }
.markdown-content table th, .markdown-content table td { border: 1px solid #e2e8f0; padding: 0.5em; color: white !important;}
.markdown-content table th { background-color: #001831; }
.markdown-content img { max-width: 100%; height: auto; }

/* CSS Styling */
:root { --primary-color: #575fcf; --secondary-color: #f59e0b; --text-color: #1f2937; --light-bg: #f9fafb; --border-color: #e5e7eb; }
html, body { height: 100dvh; overflow-y: hidden; font-family: 'Inter var', ui-sans-serif, system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif; color: var(--text-color); line-height: 1.5; background-color: #202329; }
.app-wrapper { display: flex; height: 100dvh; width: 100dvw; overflow: hidden; }
.sidebar { background-color: #001831; width: 280px; height: 100%; display: flex; flex-direction: column; border-right: 1px solid var(--border-color); font-size: 0.875rem; color: #ffffff; }
.sidebar-header { padding: 1rem; border-bottom: 1px solid var(--border-color); display: flex; align-items: center; justify-content: space-between; }
.sidebar-title { font-weight: 600; font-size: 0.875rem; color: #ffffff; }
.toggle-btn { font-size: 0.75rem; padding: 0.25rem 0.5rem; background-color: rgba(255, 255, 255, 0.1); border: 1px solid rgba(255, 255, 255, 0.2); border-radius: 0.25rem; cursor: pointer; transition: background-color 0.2s; color: #ffffff; }
.toggle-btn:hover { background-color: rgba(255, 255, 255, 0.2); }
.session-item { display: flex; align-items: center; padding: 0.75rem 1rem; cursor: pointer; transition: background-color 0.2s; }
.session-item:hover { background-color: rgba(255, 255, 255, 0.1); } .session-item.active { background-color: rgba(255, 255, 255, 0.15); }
.session-icon { width: 1.5rem; height: 1.5rem; background-color: rgba(255, 255, 255, 0.2); border-radius: 0.25rem; display: flex; align-items: center; justify-content: center; margin-right: 0.75rem; color: #ffffff; }
.session-title { font-size: 0.875rem; color: #ffffff; white-space: nowrap; overflow: hidden; text-overflow: ellipsis; } .session-title span { font-weight: 400; font-size: 0.75rem; color: rgba(255, 255, 255, 0.8); }
.flex-1 { flex: 1; }
#challengeSessionModalContainer { animation: fadeIn 0.2s ease-in-out; } @keyframes fadeIn { from { opacity: 0; } to { opacity: 1; } }
.chat-container { flex: 1; display: flex; flex-direction: column; height: 100%; overflow: hidden; }

/* Main chat panel styling */
#mainChatPanel {
    background-color: #202329;
}

/* Pipecat Challenge Modal styling */
.modal { /* display: flex; */ justify-content: center; align-items: center; z-index: 1001; }
.modal.hidden { display: none; }
.audio-ball { transition: transform 0.1s ease-out, opacity 0.1s ease-out; box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); }
.audio-ball.pulsing { animation: pulse-ball 2s infinite ease-in-out; }
@keyframes pulse-ball { 0% { transform: scale(1); box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); } 50% { transform: scale(1.05); box-shadow: 0 0 30px rgba(59, 130, 246, 0.7); } 100% { transform: scale(1); box-shadow: 0 0 20px rgba(59, 130, 246, 0.5); } }
.challenge-btn { transition: transform 0.3s ease, box-shadow 0.3s ease; } .challenge-btn:hover { transform: translateY(-2px); box-shadow: 0 5px 15px rgba(79, 70, 229, 0.4); } .challenge-btn:disabled { opacity: 0.7; cursor: not-allowed; transform: none; box-shadow: none; }
#challengeMessageDisplay { scroll-behavior: smooth; } #challengeMessageDisplay p { margin-bottom: 0.5rem; color: #000000; }
#pipecatVolumeSlider { -webkit-appearance: none; height: 4px; border-radius: 2px; background: #ddd; outline: none; }
#pipecatVolumeSlider::-webkit-slider-thumb { -webkit-appearance: none; width: 16px; height: 16px; border-radius: 50%; background: #575fcf; cursor: pointer; }
#pipecatVolumeSlider::-moz-range-thumb { width: 16px; height: 16px; border-radius: 50%; background: #575fcf; cursor: pointer; }
.backdrop-blur-sm { backdrop-filter: blur(4px); -webkit-backdrop-filter: blur(4px); }

/* Challenge Modal responsive styles */
@media (max-width: 768px) {
    #pipecatChallengeModal .modal-content {
        color: #000;
        width: 100%;
        height: 100%;
        max-width: 100%;
        margin: 0;
        border-radius: 0;
        display: flex;
        flex-direction: column;
        padding: 16px;
        overflow-y: auto;
    }
    
    /* Fix modal layout for Bible viewing */
    #pipecatChallengeModal {
        align-items: flex-start !important;
    }
    
    #pipecatChallengeModal .modal-content {
        position: relative;
        height: auto;
        min-height: 100%;
    }
    
    #challengeContentArea {
        position: relative;
        min-height: 350px !important;
        flex: 0 0 auto !important;
        margin: 20px 0;
        order: 2;
    }
    
    #challengeMessageDisplay {
        flex-grow: 0;
        height: auto;
        min-height: 100px;
        max-height: 120px;
        margin-top: 12px;
        margin-bottom: 0;
        background-color: #f8f9fa;
        border: 1px solid #e2e8f0;
        order: 4;
    }
    
    .status-info {
        order: 3;
    }
    
    .audio-visualization {
        height: 100px;
    }
    
    /* Bible viewer mobile improvements */
    #challengeBibleContainer {
        height: 400px !important; /* Larger view on mobile */
        min-height: 350px !important;
        max-height: none !important;
        position: absolute !important;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        margin: 0 !important;
        border: 2px solid #4f46e5 !important;
        box-shadow: 0 4px 12px rgba(0,0,0,0.2) !important;
    }
    
    #challengeBibleContainer .flex {
        flex-wrap: wrap;
        gap: 4px;
    }
    
    #challengeBibleBook, #challengeBibleChapter, #challengeBibleVersion {
        height: 40px; /* Larger touch target */
        padding: 0 8px;
        font-size: 16px;
        min-width: 100px;
    }
    
    #challengeBibleChapter {
        min-width: 70px;
    }
    
    #closeChallengeBible {
        font-size: 14px;
        padding: 6px 12px;
        margin-left: auto;
        background-color: #4f46e5;
        font-weight: bold;
    }
    
    #challengeBibleContent {
        font-size: 16px !important; /* Larger text for readability */
        padding: 16px !important;
        line-height: 1.6;
    }
    
    #challengeBibleContent .verse-num {
        min-width: 30px;
        color: #4f46e5;
        font-weight: bold;
    }
    
    /* Strong's number styling for mobile */
    .strong-num {
        padding: 2px 4px;
        margin: 0 2px;
        font-size: 12px;
    }
    
    /* Strong's tooltip on mobile */
    .strongs-tooltip {
        max-width: 90vw;
        width: 90vw;
        font-size: 14px;
        z-index: 1200;
    }
    
    .strongs-tooltip .close-btn {
        padding: 8px; /* Larger touch target */
        top: 2px;
        right: 2px;
        font-size: 18px;
    }
    
    /* Better touch targets for buttons */
    #openChallengeBible, #muteMicBtn, #challengeConnectBtn {
        padding: 12px 20px;
        font-size: 16px;
        border-radius: 12px;
        margin-top: 8px;
        width: 100%;
        font-weight: bold;
        box-shadow: 0 4px 6px rgba(0,0,0,0.1);
    }
}

@media (max-width: 480px) {
    #pipecatChallengeModal {
        padding: 0;
    }
    #pipecatChallengeModal .modal-content {
        padding: 1rem;
    }
    .audio-ball {
        width: 5rem;
        height: 5rem;
    }
    #pipecatChallengeModal h2 {
    font-size: 1.5rem;
    color: #000000 !important;
}
#pipecatChallengeModal .status-info {
    margin-bottom: 1rem;
    color: #000000 !important;
}

/* Fix all challenge modal text to be black */
#pipecatChallengeModal * {
    color: #000000 !important;
}
    
    /* Increase spacing in settings */
    #pipecatChallengeModal .space-y-4 {
        margin-top: 1rem;
    }
    
    /* Single column layout for personality selection on very small screens */
    #pipecatChallengeModal .grid-cols-3 {
        grid-template-columns: 1fr;
    }
    
    /* Stack the bottom buttons on very small screens */
    #pipecatChallengeModal .flex.justify-center.space-x-3 {
        flex-direction: column;
        align-items: center;
        gap: 8px;
    }
    #pipecatChallengeModal .flex.justify-center.space-x-3 button {
        width: 100%;
        margin-left: 0 !important; /* Override space-x-3 */
        margin-right: 0 !important;
    }
}

/* Mobile Tab Navigation */
@media (max-width: 1023px) {
    .app-wrapper {
        flex-direction: column; /* Stack content vertically */
        height: 100dvh; /* Ensure full viewport height */
    }
    
    /* Hide the mobile tab bar completely */
    .mobile-tab-bar {
        display: none !important;
    }
    
    /* Mobile header modifications */
    #mainChatPanel > header {
        justify-content: space-between;
        position: relative;
    }
    
    /* Hamburger menu button in header */
    #mobileHamburgerBtn {
        display: flex;
        align-items: center;
        justify-content: center;
        width: 40px;
        height: 40px;
        border-radius: 8px;
        background-color: rgba(255, 255, 255, 0.1);
        color: white;
        cursor: pointer;
        transition: background-color 0.2s;
    }
    
    #mobileHamburgerBtn:hover {
        background-color: rgba(255, 255, 255, 0.2);
    }
    
    /* Center the YourWord title */
    #mainChatPanel > header h1 {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        margin: 0;
        font-size: 1.25rem;
        font-weight: 600;
    }
    
    /* Sidebar overlay for mobile */
    #sidebar {
        position: fixed;
        top: 0;
        left: -100%;
        width: 280px;
        height: 100dvh;
     
        z-index: 1000;
        transition: left 0.3s ease-in-out;
        display: flex;
        flex-direction: column;
        overflow-y: auto;
    }
    
    #sidebar.mobile-open {
        left: 0;
    }
    
    /* Make sure sidebar content is visible when open */
    #sidebar.mobile-open .sidebar-header,
    #sidebar.mobile-open nav,
    #sidebar.mobile-open .session-item,
    #sidebar.mobile-open .session-group,
    #sidebar.mobile-open #sessionsList,
    #sidebar.mobile-open .session-date-group {
        display: block !important;
        visibility: visible !important;
        opacity: 1 !important;
        color: white !important;
    }
    
    /* Ensure sidebar text is white on mobile */
    #sidebar.mobile-open * {
        color: white !important;
    }
    
    /* Special handling for session links */
    #sidebar.mobile-open .session-item button,
    #sidebar.mobile-open .session-item a {
        color: white !important;
        background-color: rgba(255, 255, 255, 0.1) !important;
    }
    
    #sidebar.mobile-open .session-item button:hover,
    #sidebar.mobile-open .session-item a:hover {
        background-color: rgba(255, 255, 255, 0.2) !important;
    }
    
    /* Sidebar backdrop */
    .sidebar-backdrop {
        display: none;
        position: fixed;
        top: 0;
        left: 0;
        width: 100vw;
        height: 100dvh;
        background-color: rgba(0, 0, 0, 0.5);
        z-index: 999;
        backdrop-filter: blur(2px);
    }
    
    .sidebar-backdrop.active {
        display: block;
    }

    /* Hide desktop sidebar toggles and header buttons on mobile */
    #collapseSidebar, #closeSidebar, #openSidebar {
        display: none;
    }

    /* Main chat panel adjustments */
    #mainChatPanel {
        position: static;
        width: 100%;
        height: 100dvh;
        overflow: hidden;
        display: flex;
        flex-direction: column;
        padding-bottom: 0;
    }

    /* Chat scroll area - remove bottom padding for tab bar */
    #chatScroll {
        padding-bottom: 2rem; /* Reduced from previous value */
        overflow-y: auto;
        flex: 1;
    }

    /* ChatGPT-style input area with more vertical space */
    #chatForm {
        position: static;
        bottom: auto;
        left: auto;
        right: auto;
        width: auto;
        margin: 12px;
        border-radius: 16px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
        border: 1px solid #e5e7eb;
        z-index: 10;
        padding-bottom: env(safe-area-inset-bottom);
        background: white;
    }
    
    /* More spacious chat input wrapper with vertical layout */
    .chat-input-wrapper {
        position: static;
        height: auto;
        min-height: auto;
        width: auto;
        padding: 0;
    }
    
    /* Vertical layout for chat input - text area full width on top */
    .chat-input-wrapper .bg-white {
        border-radius: 16px;
    }
    
    /* Text input area styling */
    .chat-input-wrapper textarea {
        padding: 14px 16px;
        min-height: 44px;
        font-size: 16px; /* Prevent zoom on iOS */
        line-height: 1.4;
        resize: none;
        max-height: 120px;
        overflow-y: auto;
        width: 100%;
    }
    
    /* Tools row styling - optimized for mobile */
    .chat-input-wrapper .flex.items-center.justify-between {
        padding: 8px 12px 12px 12px;
        border-top: 1px solid #f3f4f6;
        flex-wrap: nowrap;
        gap: 4px;
    }
    
    /* Left side tools container - more compact */
    .chat-input-wrapper .flex.items-center.space-x-2 {
        flex: 0 0 auto;
        min-width: 0;
        gap: 4px;
    }
    
    /* Right side buttons container - allow more space */
    .chat-input-wrapper .flex.items-center.space-x-2:last-child {
        flex: 1;
        justify-content: flex-end;
        gap: 6px;
    }
    
    /* Button adjustments for better mobile touch */
    #uploadBookBtn {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
        border-radius: 8px;
        flex-shrink: 0;
    }
    
    /* Modes button - more compact on mobile */
    #modesBtn {
        min-width: 44px;
        min-height: 40px;
        padding: 8px 6px;
        border-radius: 8px;
        flex-shrink: 0;
        position: relative;
    }
    
    /* Active mode indicator dot for mobile */
    #modesBtn::after {
        content: '';
        position: absolute;
        top: 6px;
        right: 6px;
        width: 6px;
        height: 6px;
        background-color: #16a34a;
        border-radius: 50%;
        opacity: 0;
        transition: opacity 0.2s ease;
    }
    
    /* Show indicator dot when modes are active */
    #modesBtn.has-active-modes::after {
        opacity: 1;
    }
    
    /* Voice mode button - compact mobile style */
    #voice-mode-button {
        min-width: 40px;
        min-height: 40px;
        padding: 8px !important;
        border-radius: 8px;
        flex-shrink: 0;
    }
    
    /* Microphone and send buttons */
    #chatMicButton, button[type="submit"] {
        min-width: 40px;
        min-height: 40px;
        padding: 8px;
        border-radius: 8px;
        flex-shrink: 0;
    }
    
    /* Better spacing for mode controls */
    #modesBtn {
        margin: 0;
        flex-shrink: 0;
    }
    
    /* Ensure buttons don't get too cramped */
    .chat-input-wrapper button {
        min-width: 40px;
        min-height: 40px;
    }
    
    /* Modes dropdown positioning for mobile */
    #modesDropdown {
        position: fixed !important;
        bottom: 110px !important;
        left: 12px !important;
        right: 12px !important;
        width: auto !important;
        max-width: none !important;
        margin: 0 !important;
        max-height: 60vh;
        overflow-y: auto;
    }
    
    /* Remove scroll to bottom button repositioning */
    #scrollToBottomBtn {
        bottom: 90px;
        right: 16px;
        z-index: 20;
    }

    /* Community Panel Mobile Adjustments */
    #communityPanel, #explorePanel {
        display: none;
    }
    
    /* Show only main chat panel by default */
    .mobile-tab-content {
        display: none;
    }
    
    .mobile-tab-content.active {
        display: flex;
    }
    
    #mainChatPanel {
        display: flex !important;
    }

    /* Make sure modals are still usable */
    .modal {
        z-index: 1001;
    }
    .modal-backdrop {
        z-index: 1000;
    }

    /* Enhanced close button styling for mobile sidebar */
    #closeSidebar {
        background-color: rgba(75, 85, 99, 0.8) !important;
        backdrop-filter: blur(4px);
        border: 1px solid rgba(255, 255, 255, 0.1);
        min-width: 32px !important;
        min-height: 32px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        flex-shrink: 0 !important;
    }
    
    #closeSidebar:hover {
        background-color: rgba(55, 65, 81, 0.9) !important;
        transform: scale(1.05);
    }
    
    #closeSidebar:active {
        transform: scale(0.95);
        background-color: rgba(31, 41, 55, 0.9) !important;
    }
    
    #closeSidebar svg {
        color: white !important;
        stroke: currentColor !important;
    }
    
    /* Make sidebar header more prominent on mobile */
    #sidebar.mobile-open #sidebarHeader {
        background-color: rgba(30, 31, 33, 0.95) !important;
        backdrop-filter: blur(8px) !important;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
    }
    
    /* Ensure sidebar title is visible */
    #sidebar.mobile-open .sidebar-title {
        color: white !important;
        font-weight: 600 !important;
    }
}

/* Tablet and up adjustments */
@media (min-width: 1024px) {
    /* Restore normal layout for tablets and up */
    .chat-input-wrapper .flex.items-center.justify-between {
        gap: 8px;
    }
    
    /* Left side tools - normal spacing */
    .chat-input-wrapper .flex.items-center.space-x-2 {
        flex: 1;
        gap: 8px;
    }
    
    /* Right side buttons - normal spacing */
    .chat-input-wrapper .flex.items-center.space-x-2:last-child {
        flex: 0 0 auto;
        gap: 8px;
    }
    
    /* Modes button - full size with text */
    #modesBtn {
        min-width: auto;
        padding: 8px 12px;
    }
    
    /* Ensure Talk to Wordy text has proper spacing */
    #voice-mode-button span {
        margin-left: 4px;
        margin-right: 4px;
    }
    
    /* Voice mode button - normal size */
    #voice-mode-button {
        padding: 8px 12px !important;
    }
    
    /* Modes dropdown back to normal positioning */
    #modesDropdown {
        position: absolute !important;
        bottom: 100% !important;
        left: 0 !important;
        right: auto !important;
        width: 320px !important;
        max-width: 320px !important;
        margin-bottom: 8px !important;
        max-height: none;
        overflow-y: visible;
    }
}

/* Ensure robot icon is visible on mobile and tablet */
@media (max-width: 1023px) {
    #voice-mode-button svg {
        display: block !important;
        color: #6b7280 !important;
        stroke: currentColor !important;
        width: 20px !important;
        height: 20px !important;
    }
    
    #voice-mode-button span {
        display: none !important;
    }
    
    /* Make sure the button is visible and properly sized */
    #voice-mode-button {
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
        min-width: 40px !important;
        min-height: 40px !important;
        background-color: transparent !important;
        border: none !important;
        border-radius: 8px !important;
        padding: 8px !important;
        flex-shrink: 0 !important;
    }
    
    /* Hover state for better visibility */
    #voice-mode-button:hover {
        background-color: #f3f4f6 !important;
    }
    
    /* Add slight border to make it more visible */
    #voice-mode-button {
        border: 1px solid #e5e7eb !important;
    }
    
    /* Ensure proper spacing in button row */
    .chat-input-wrapper .flex.items-center.space-x-2:last-child {
        gap: 6px !important;
    }
    
    /* Make all right-side buttons consistent */
    .chat-input-wrapper .flex.items-center.space-x-2:last-child button {
        min-width: 40px !important;
        min-height: 40px !important;
        display: flex !important;
        align-items: center !important;
        justify-content: center !important;
    }
}

/* Microphone button recording state */
#chatMicButton.recording {
    background-color: #ef4444;
    color: white;
    animation: pulse 1.5s infinite;
}
#chatMicButton.recording:hover {
    background-color: #dc2626;
}
/* Paused microphone button state */
#chatMicButton.paused {
    background-color: #f59e0b; /* Amber color */
    color: white;
    transition: background-color 0.3s;
}
#chatMicButton.paused:hover {
    background-color: #d97706;
}
@keyframes pulse {
    0% {
      box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.7);
    }
    70% {
      box-shadow: 0 0 0 10px rgba(239, 68, 68, 0);
    }
    100% {
      box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
    }
}

/* Mobile microphone improvements */
@media (max-width: 768px) {
    #chatMicButton {
      min-width: 80px; /* Wider touch target */
      padding: 8px 12px; /* Larger padding */
    }
    #chatMicButton.recording {
      /* Make the animation more noticeable on mobile */
      animation: pulse-mobile 1.5s infinite;
    }
    @keyframes pulse-mobile {
      0% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0.8);
        transform: scale(1);
      }
      50% {
        box-shadow: 0 0 0 15px rgba(239, 68, 68, 0);
        transform: scale(1.05);
      }
      100% {
        box-shadow: 0 0 0 0 rgba(239, 68, 68, 0);
        transform: scale(1);
      }
    }
    /* VAD status indicator styling */
    #audio-mode-indicator {
      transition: all 0.3s ease;
    }
    
    #audio-mode-indicator.listening {
      background: linear-gradient(45deg, #10b981, #34d399);
      animation: pulse-glow 2s infinite;
    }
    
    #audio-mode-indicator.recording {
      background: linear-gradient(45deg, #ef4444, #f87171);
      animation: pulse-recording 1s infinite;
    }
    
    #audio-mode-indicator.processing {
      background: linear-gradient(45deg, #f59e0b, #fbbf24);
    }
    
    #audio-mode-indicator.interrupted {
      background: linear-gradient(45deg, #dc2626, #ef4444);
      animation: interrupted-flash 0.5s ease-out;
    }
    
    @keyframes interrupted-flash {
      0% { transform: scale(1); }
      50% { transform: scale(1.1); box-shadow: 0 0 40px rgba(220, 38, 38, 0.8); }
      100% { transform: scale(1); }
    }
    
    @keyframes pulse-glow {
      0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.5); }
      50% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.8); }
    }
    
    @keyframes pulse-recording {
      0%, 100% { transform: scale(1); box-shadow: 0 0 20px rgba(239, 68, 68, 0.5); }
      50% { transform: scale(1.05); box-shadow: 0 0 30px rgba(239, 68, 68, 0.8); }
    }

    /* Add speech recognition status indicator */
    .speech-status {
      position: fixed;
      bottom: 130px;
      left: 50%;
      transform: translateX(-50%);
      background-color: rgba(0, 0, 0, 0.7);
      color: white;
      padding: 6px 12px;
      border-radius: 20px;
      font-size: 0.8rem;
      z-index: 50;
      opacity: 0;
      transition: opacity 0.3s;
    }
    .speech-status.visible {
      opacity: 1;
    }
}

/* Additional Reader Styles */
.error {
    animation: shake 0.5s ease-in-out;
    border-color: #ef4444 !important;
    background-color: rgba(239, 68, 68, 0.1) !important;
}

@keyframes shake {
    0%, 100% { transform: translateX(0); }
    20%, 60% { transform: translateX(-5px); }
    40%, 80% { transform: translateX(5px); }
}

.bookmark-success {
    animation: pulse 0.8s ease-in-out;
}

@keyframes pulse {
    0% { transform: scale(1); }
    50% { transform: scale(1.05); }
    100% { transform: scale(1); }
}

/* Quick page navigation inputs */
#quickPageInput {
    font-size: 14px;
    border: none;
    width: 3rem;
}

#quickPageInput:focus {
    outline: none;
}

/* Hide input arrows in number inputs */
input[type=number]::-webkit-inner-spin-button, 
input[type=number]::-webkit-outer-spin-button { 
    -webkit-appearance: none; 
    margin: 0; 
}

input[type=number] {
    -moz-appearance: textfield;
}

/* Make sticky navigation elements more visible */
#stickyNavigation {
    position: fixed;
    bottom: 4rem;
    left: 0;
    right: 0;
    z-index: 20;
    padding: 0 1rem;
    pointer-events: none;
}

@media (max-width: 768px) {
    #stickyNavigation {
        bottom: 1.5rem; /* Higher position on mobile */
    }
}

/* Session action buttons styling */
.session-item {
    position: relative;
}

.session-actions {
    position: absolute;
    right: 8px;
    top: 50%;
    transform: translateY(-50%);
    background-color: #001831;
    border-radius: 4px;
    padding: 2px 4px;
    display: flex;
    align-items: center;
    z-index: 10;
    opacity: 0;
    transition: opacity 0.2s ease;
}

.session-item:hover .session-actions {
    opacity: 1;
}

.session-actions button {
    margin: 0 2px;
}

.session-item.active .session-actions {
    background-color: rgba(224, 231, 255, 0.95);
}

/* Session inline editing */
.session-edit-input {
    background: transparent;
    border: none;
    border-bottom: 1px solid #4f46e5;
    outline: none;
    font-size: 0.875rem;
    width: 100%;
    padding: 0;
    color: #1f2937;
}

/* Ensure buttons are visible on mobile even without hover */
@media (max-width: 768px) {
          .session-actions {
          opacity: 0.7;
          
          padding: 3px 5px;
      }

      /* Mode icons styling to match theme */
      .navy-icon {
          color: #001831;
      }
      
      .navy-icon:hover {
          color: #002a4a;
      }
    
    .session-actions button {
        padding: 3px;
    }
}

.library-sticky-nav {
    bottom: 4rem;
}

@media (max-width: 768px) {
    .library-sticky-nav {
        bottom: 6.5rem;
    }
}

/* Markdown content styling */
.markdown-content { line-height: 1.6; }
.markdown-content p { margin-bottom: 1em; }
.markdown-content h1, .markdown-content h2, .markdown-content h3, .markdown-content h4, .markdown-content h5, .markdown-content h6 { margin-top: 1.5em; margin-bottom: 0.5em; font-weight: 600; }
.markdown-content h1 { font-size: 1.5em; } .markdown-content h2 { font-size: 1.3em; } .markdown-content h3 { font-size: 1.2em; } .markdown-content h4 { font-size: 1.1em; } .markdown-content h5, .markdown-content h6 { font-size: 1em; }
.markdown-content ul, .markdown-content ol { margin-bottom: 1em; padding-left: 2em; }
.markdown-content ul { list-style-type: disc; color: #ffffff !important; }
.markdown-content ol { list-style-type: decimal; }
.markdown-content li { margin-bottom: 0.5em; color: #ffffff !important; }

/* Mobile-responsive markdown content */
@media (max-width: 768px) {
    .markdown-content {
        width: 100%;
        overflow-x: auto;
    }
    .markdown-content pre, .markdown-content code {
        max-width: 100%;
        overflow-x: auto;
        white-space: pre-wrap;
        word-wrap: break-word;
    }
    .markdown-content table {
        display: block;
        width: 100%;
        overflow-x: auto;
        -webkit-overflow-scrolling: touch;
    }
    .markdown-content img {
        max-width: 100%;
        height: auto;
    }
    .message-content {
        max-width: 100%;
        overflow-wrap: break-word;
        word-wrap: break-word;
        hyphens: auto;
    }
}

.markdown-content a[href^="http"]::after { content: '↗'; position: absolute; font-size: 0.8em; margin-left: 0.2em; top: 0; }
.markdown-content table { border-collapse: collapse; width: 100%; margin-bottom: 1em; }
.markdown-content table th, .markdown-content table td { border: 1px solid #e2e8f0; padding: 0.5em; }
.markdown-content table th {}
.markdown-content img { max-width: 100%; height: auto; }

.challenge-bible-highlight {
    animation: bible-highlight 1s ease;
}

@keyframes bible-highlight {
    0% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0.6); }
    70% { box-shadow: 0 0 0 20px rgba(79, 70, 229, 0); }
    100% { box-shadow: 0 0 0 0 rgba(79, 70, 229, 0); }
}

/* Make Bible content stand out */
#openChallengeBible {
    position: relative;
    overflow: hidden;
    z-index: 1;
    font-weight: bold;
    background: #001831 !important;
    border-color: #001831 !important;
    color: #ffffff !important;
}

#openChallengeBible:hover {
    background: #000c18 !important;
    border-color: #000c18 !important;
}

/* Library Auto Button Styling - Navy Theme */
#autoSearchToggle {
    background: #001831 !important;
    border-color: #001831 !important;
    color: #ffffff !important;
}

#autoSearchToggle:hover {
    background: #000c18 !important;
    border-color: #000c18 !important;
}

/* Manual mode styling for auto button */
#autoSearchToggle.bg-gray-600 {
    background: #4b5563 !important;
    border-color: #4b5563 !important;
}

#autoSearchToggle.bg-gray-600:hover {
    background: #374151 !important;
    border-color: #374151 !important;
}

/* Library Open Books Button - Navy Theme */
.libraryBtn {
    background: #001831 !important;
    border-color: #001831 !important;
    color: #ffffff !important;
}

.libraryBtn:hover {
    background: #000c18 !important;
    border-color: #000c18 !important;
}

#openChallengeBible::after {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(255,255,255,0.2);
    transform: translateX(-100%);
    z-index: -1;
}

#openChallengeBible:focus::after {
    animation: button-shine 1s forwards;
}

@keyframes button-shine {
    100% {
        transform: translateX(100%);
    }
}

/* Small device improvements */
@media (max-width: 480px) {
    #challengeBibleContent {
        border-radius: 8px;
        box-shadow: inset 0 0 8px rgba(0,0,0,0.05);
        background: #fafafa;
    }
    
    #challengeBibleBook {
        flex: 2;
    }
    
    #challengeBibleChapter {
        flex: 1;
    }
    
    #challengeBibleVersion {
        flex: 1.5;
    }
    
    /* Add some nice animations */
    #challengeBibleContainer.hidden {
        display: none;
    }
    
    #challengeBibleContainer:not(.hidden) {
        animation: fade-in 0.3s ease;
    }
    
    @keyframes fade-in {
        from { opacity: 0; transform: translateY(10px); }
        to { opacity: 1; transform: translateY(0); }
    }
}

/* Educational mode styling */
.educational-mode .challenge-btn.primary-btn {
    background: linear-gradient(to right, #10b981, #0d9488);
}
.educational-mode #audioBall {
    background-color: #10b981;
}
.educational-mode #timerDisplay {
    color: #10b981;
}
.educational-mode #challengeContentArea {
    border: 1px dashed #10b981;
    border-radius: 8px;
    padding: 8px;
}
.educational-mode #challengeMessageDisplay {
    border-color: #10b981;
}

/* Change button text based on selected personality */
#aiPersonalityInputs input[type="radio"]:checked ~ .display-text .educational-show {
    display: inline;
}
#aiPersonalityInputs input[type="radio"]:checked ~ .display-text .challenge-show {
    display: none;
}
#aiPersonalityInputs input[type="radio"][value="dr_chen"]:checked ~ .display-text .challenge-show {
    display: none;
}
#aiPersonalityInputs input[type="radio"][value="dr_chen"]:checked ~ .display-text .educational-show {
    display: inline;
}
#aiPersonalityInputs input[type="radio"][value="dr_chen"]:checked ~ .display-text .button-text-challenge {
    display: none;
}
#aiPersonalityInputs input[type="radio"][value="dr_chen"]:checked ~ .display-text .button-text-educational {
    display: inline;
}

/* Voice Mode Container in Header */
.voice-mode-container {
    position: relative;
}

.voice-mode-container.hidden {
    display: none;
}

/* New Voice Mode Popup Styles - Top positioned with unique design */
.voice-popup {
    position: fixed;
    top: 20px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9999;
    pointer-events: auto;
    animation: slideDown 0.3s ease-out;
}

.voice-popup.hidden {
    display: none;
}

@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-20px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

.voice-popup-card {
    background: linear-gradient(135deg, #001831 0%, #001429 100%);
    border-radius: 20px;
    padding: 16px 20px;
    box-shadow: 
        0 20px 25px -5px rgba(0, 0, 0, 0.1),
        0 10px 10px -5px rgba(0, 0, 0, 0.04),
        0 0 0 1px rgba(255, 255, 255, 0.1);
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.2);
    min-width: 280px;
    max-width: 320px;
}

.voice-popup-content {
    display: flex;
    align-items: center;
    gap: 12px;
    color: white;
}

.voice-status-indicator {
    position: relative;
    width: 50px;
    height: 50px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 2px solid rgba(255, 255, 255, 0.3);
    transition: all 0.3s ease;
}

.voice-status-indicator.listening {
    border-color: #10b981;
    box-shadow: 0 0 20px rgba(16, 185, 129, 0.4);
    animation: pulse-green 2s infinite;
}

.voice-status-indicator.processing {
    border-color: #f59e0b;
    box-shadow: 0 0 20px rgba(245, 158, 11, 0.4);
    animation: pulse-amber 2s infinite;
}

.voice-status-indicator.speaking {
    border-color: #3b82f6;
    box-shadow: 0 0 20px rgba(59, 130, 246, 0.4);
    animation: pulse-blue 2s infinite;
}

.voice-status-indicator.error {
    border-color: #ef4444;
    box-shadow: 0 0 20px rgba(239, 68, 68, 0.4);
    animation: pulse-red 2s infinite;
}

@keyframes pulse-green {
    0%, 100% { box-shadow: 0 0 20px rgba(16, 185, 129, 0.4); }
    50% { box-shadow: 0 0 30px rgba(16, 185, 129, 0.8); }
}

@keyframes pulse-amber {
    0%, 100% { box-shadow: 0 0 20px rgba(245, 158, 11, 0.4); }
    50% { box-shadow: 0 0 30px rgba(245, 158, 11, 0.8); }
}

@keyframes pulse-blue {
    0%, 100% { box-shadow: 0 0 20px rgba(59, 130, 246, 0.4); }
    50% { box-shadow: 0 0 30px rgba(59, 130, 246, 0.8); }
}

@keyframes pulse-red {
    0%, 100% { box-shadow: 0 0 20px rgba(239, 68, 68, 0.4); }
    50% { box-shadow: 0 0 30px rgba(239, 68, 68, 0.8); }
}

.voice-status-icon {
    font-size: 20px;
    transition: transform 0.3s ease;
}

.voice-status-indicator.listening .voice-status-icon {
    transform: scale(1.1);
}

.voice-status-indicator.processing .voice-status-icon {
    animation: spin 1s linear infinite;
}

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

.voice-text-content {
    flex: 1;
    min-width: 0;
}

.voice-popup-title {
    font-size: 16px;
    font-weight: 700;
    margin: 0 0 4px 0;
    color: white;
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.voice-popup-subtitle {
    font-size: 13px;
    font-weight: 500;
    margin: 0;
    color: rgba(255, 255, 255, 0.85);
    text-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

.voice-end-button {
    width: 36px;
    height: 36px;
    border-radius: 50%;
    background: rgba(255, 255, 255, 0.15);
    border: 1px solid rgba(255, 255, 255, 0.3);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.2s ease;
    backdrop-filter: blur(10px);
}

.voice-end-button:hover {
    background: rgba(255, 255, 255, 0.25);
    border-color: rgba(255, 255, 255, 0.5);
    transform: scale(1.05);
}

.voice-end-button:active {
    transform: scale(0.95);
}

/* Mobile adjustments */
@media (max-width: 768px) {
    .voice-popup {
        top: 15px;
        left: 50%;
        right: auto;
        width: calc(100vw - 40px);
        max-width: 300px;
    }
    
    .voice-popup-card {
        min-width: auto;
        padding: 14px 16px;
    }
    
    .voice-status-indicator {
        width: 44px;
        height: 44px;
    }
    
    .voice-status-icon {
        font-size: 18px;
    }
    
    .voice-popup-title {
        font-size: 15px;
    }
    
    .voice-popup-subtitle {
        font-size: 12px;
    }
    
    /* Fix header overlap on mobile - keep centered but make smaller */
    #voice-mode-button {
        padding: 4px 8px !important; /* Smaller padding */
        font-size: 12px !important; /* Smaller text */
        white-space: nowrap;
    }
    
    /* Ensure right section has enough margin to prevent overlap */
    header .ml-auto.flex-shrink-0 {
        margin-left: auto !important;
        min-width: fit-content;
    }
}

/* Additional adjustments for very small screens (iPhone) */
@media (max-width: 480px) {
    #voice-mode-button {
        padding: 3px 6px !important; /* Even smaller padding */
        font-size: 11px !important; /* Smaller text */
    }
    
    /* Make user button more compact on very small screens */
    #userDropdownButton {
        padding: 4px 8px !important;
        font-size: 10px !important;
    }
    
    #userDropdownButton .text-xs {
        font-size: 10px !important;
    }
}

/* ChatGPT-style consolidated chatbox styles */
.chat-input-wrapper {
    position: sticky;
    bottom: 0;

    backdrop-filter: blur(10px);
    border-top: 1px solid rgba(0, 24, 49, 0.2);
    padding: 16px;
}

/* Main input container */
.chat-input-wrapper .flex.items-center.bg-white {
    background: #ffffff !important;
    border: 2px solid rgba(0, 24, 49, 0.2);
    transition: all 0.2s ease;
}

.chat-input-wrapper .flex.items-center.bg-white:hover {
    border-color: rgba(0, 24, 49, 0.4);
    box-shadow: 0 4px 12px rgba(0, 24, 49, 0.1);
}

.chat-input-wrapper .flex.items-center.bg-white:focus-within {
    border-color: #001831 !important;
    box-shadow: 0 4px 16px rgba(0, 24, 49, 0.2);
}

/* Upload book button */
#uploadBookBtn {
    color: #001831;
    transition: all 0.2s ease;
}

#uploadBookBtn:hover {
    background-color: rgba(0, 24, 49, 0.1) !important;
    color: #001831;
}

/* Modes button and dropdown */
#modesBtn {
    color: #001831 !important;
    background: transparent;
    border: 1px solid rgba(0, 24, 49, 0.2);
    border-radius: 8px;
    font-weight: 500;
    transition: all 0.2s ease;
}

#modesBtn:hover {
    background-color: rgba(0, 24, 49, 0.05) !important;
    border-color: rgba(0, 24, 49, 0.3);
}

/* Active mode indicator */
#activeModeIndicator {
    background-color: rgba(0, 24, 49, 0.1) !important;
    color: #001831 !important;
    font-weight: 600;
}

/* Modes dropdown */
#modesDropdown {
    background: #ffffff;
    border: 2px solid rgba(0, 24, 49, 0.1);
    box-shadow: 0 10px 40px rgba(0, 24, 49, 0.15);
    backdrop-filter: blur(10px);
}

#modesDropdown h3 {
    color: #001831;
    font-weight: 600;
}

/* Individual mode items */
#modesDropdown .flex.items-center.justify-between {
    transition: all 0.2s ease;
}

#modesDropdown .flex.items-center.justify-between:hover {
    background-color: rgba(0, 24, 49, 0.05) !important;
}

#modesDropdown .text-sm.font-medium.text-gray-700 {
    color: #001831 !important;
}

/* Status indicators */
.text-xs.px-2.py-1.bg-green-100.text-green-800 {
    background-color: rgba(0, 24, 49, 0.1) !important;
    color: #001831 !important;
    font-weight: 600;
}

.text-xs.px-2.py-1.bg-gray-100.text-gray-600 {
    background-color: rgba(0, 24, 49, 0.05) !important;
    color: rgba(255, 255, 255, 0.6) !important;
}

/* Text input */
#chatInput {
    color: #001831 !important;
    font-size: 16px;
    line-height: 1.5;
}

#chatInput::placeholder {
    color: rgba(0, 24, 49, 0.5) !important;
}

#chatInput:focus {
    outline: none !important;
    border: none !important;
}

/* Talk to Wordy button */
#voice-mode-button {
    background: #001831;
    color: #ffffff !important;
    border: 1px solid rgba(0, 24, 49, 0.2);
    font-weight: 500;
    transition: all 0.2s ease;
}

#voice-mode-button:hover {
    background: rgba(0, 24, 49, 0.1) !important;
    border-color: rgba(0, 24, 49, 0.3);
    transform: translateY(-1px);
}

/* Microphone button */
#chatMicButton {
    color: rgba(0, 24, 49, 0.7);
    transition: all 0.2s ease;
}

#chatMicButton:hover {
    background-color: rgba(0, 24, 49, 0.1) !important;
    color: #001831;
    transform: translateY(-1px);
}

/* Send button */
button[type="submit"] {
    background: #001831 !important;
    color: #ffffff !important;
    transition: all 0.2s ease;
    height: auto;
    min-height: 44px; /* standard touch target */
    line-height: 1.2;
}

button[type="submit"]:hover {
    background: rgba(0, 24, 49, 0.9) !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 12px rgba(0, 24, 49, 0.3);
}

/* Controls sections in dropdown */
#libraryModeControlsContainer,
#researchModeControlsContainer {
    border-color: rgba(0, 24, 49, 0.1) !important;
}

#researchModeHelp {
    color: rgba(0, 24, 49, 0.6) !important;
}

/* Checkbox styling */
.form-checkbox {
    accent-color: #001831;
}

/* Labels in research options */
#researchOptions label {
    color: #001831 !important;
}

#researchOptions .text-green-600 {
    color: #001831 !important;
}

/* Community credits display */
.community-credit-display {
    color: #001831 !important;
    font-weight: 600;
}

/* Responsive adjustments */
@media (max-width: 768px) {
    .chat-input-wrapper {
        padding: 12px;
    }
    
    #modesDropdown {
        width: calc(100vw - 2rem);
        left: -1rem;
    }
    
    #voice-mode-button {
        display: none; /* Hide on mobile to save space */
    }
}

/* Animation for dropdown */
#modesDropdown {
    animation: slideUp 0.2s ease-out;
}

@keyframes slideUp {
    from {
        opacity: 0;
        transform: translateY(10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

/* Focus ring for accessibility */
button:focus-visible {
    outline: 2px solid #001831;
    outline-offset: 2px;
}

/* Improved contrast for better readability */
#modesDropdown .text-xs {
    color: rgba(0, 24, 49, 0.8) !important;
}
#modesDropdown .text-xs.text-white {
    color: rgba(255, 255, 255, 0.8) !important;
}

/* Ensure optimal spacing for all mobile buttons */
@media (max-width: 480px) {
    /* Extra small mobile adjustments */
    .chat-input-wrapper .flex.items-center.justify-between {
        padding: 6px 8px 10px 8px;
        gap: 3px;
    }
    
    /* Tighter spacing for small screens */
    .chat-input-wrapper .flex.items-center.space-x-2:last-child {
        gap: 4px;
    }
    
    /* Slightly smaller buttons on very small screens */
    #uploadBookBtn, #modesBtn, #voice-mode-button, 
    #chatMicButton, button[type="submit"] {
        min-width: 36px;
        min-height: 36px;
        padding: 6px;
    }
    
    /* Adjust modes button for very small screens */
    #modesBtn {
        min-width: 40px;
        padding: 6px 4px;
    }
    
    /* Adjust indicator dot position for smaller button */
    #modesBtn::after {
        top: 4px;
        right: 4px;
        width: 5px;
        height: 5px;
    }
}

.leading-relaxed {color: #000000 !important;}

#chatScroll li {
    color: white;
}

/* Auto-expanding textarea styles */
#chatInput {
    transition: height 0.2s ease-out;
    resize: none;
    overflow: hidden;
    min-height: 44px; /* Ensure minimum touch target size */
    max-height: 220px; /* 5 times base height (44px * 5) */
    line-height: 1.5;
}

/* Smooth scrolling when max height is reached */
#chatInput:focus {
    transition: height 0.15s ease-out;
}