* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Oxygen, Ubuntu, sans-serif;
  background: #f5f5f5;
  height: 100vh;
  height: 100dvh;
  overflow: hidden;
}

#app {
  display: flex;
  flex-direction: column;
  height: 100vh;
  height: 100dvh;
}

/* Navigation */
#main-nav {
  display: flex;
  justify-content: space-between;
  align-items: center;
  background: #1a1a2e;
  color: white;
  padding: 0 20px;
  height: 50px;
  flex-shrink: 0;
}

.nav-left {
  display: flex;
  align-items: center;
  gap: 20px;
}

.nav-title {
  font-size: 18px;
  font-weight: 600;
}

.nav-tab {
  background: none;
  border: none;
  color: #aaa;
  padding: 15px 20px;
  cursor: pointer;
  font-size: 14px;
  border-bottom: 2px solid transparent;
}

.nav-tab:hover {
  color: white;
}

.nav-tab.active {
  color: white;
  border-bottom-color: #1a5fb4;
}

.nav-right {
  display: flex;
  align-items: center;
  gap: 15px;
}

#user-name {
  color: #aaa;
}

#logout-btn {
  background: #333;
  border: none;
  color: white;
  padding: 6px 12px;
  border-radius: 4px;
  cursor: pointer;
}

/* Tab content */
.tab-content {
  display: none;
  flex: 1;
  overflow: hidden;
}

.tab-content.active {
  display: flex;
  flex-direction: column;
}

/* Toolbar */
#toolbar {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 10px 20px;
  background: white;
  border-bottom: 1px solid #ddd;
  flex-wrap: wrap;
}

#toolbar select {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 14px;
}

#search-container {
  display: flex;
  gap: 5px;
  margin-left: auto;
}

#search-input {
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  width: 250px;
}

#search-btn, #search-options-btn {
  padding: 8px 12px;
  background: #1a5fb4;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#search-options-btn {
  background: #666;
}

#mobile-sidebar-toggle,
#mobile-ai-toggle,
#mobile-search-toggle {
  display: none;
}

/* Search options */
#search-options {
  padding: 10px 20px;
  background: #f9f9f9;
  border-bottom: 1px solid #ddd;
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

#search-options.hidden {
  display: none;
}

.option-group {
  display: flex;
  align-items: center;
  gap: 10px;
}

.option-group label {
  display: flex;
  align-items: center;
  gap: 4px;
  font-size: 13px;
}

/* Main content */
#content {
  display: flex;
  flex: 1;
  overflow: hidden;
}

/* Sidebar */
#sidebar {
  width: 180px;
  background: #fff;
  border-right: 1px solid #ddd;
  overflow-y: auto;
  flex-shrink: 0;
}

#book-list {
  padding: 10px 0;
}

.book-item {
  padding: 8px 15px;
  cursor: pointer;
  font-size: 13px;
  color: #333;
}

.book-item:hover {
  background: #f0f0f0;
}

.book-item.active {
  background: #e3f2fd;
  color: #1a5fb4;
  font-weight: 500;
}

/* Bible container */
#bible-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  position: relative;
}

#bible-nav-wrapper {
  display: flex;
  flex: 1;
  overflow: hidden;
}

.nav-arrow {
  width: 40px;
  background: #f5f5f5;
  border: none;
  cursor: pointer;
  font-size: 18px;
  color: #666;
  flex-shrink: 0;
}

.nav-arrow:hover:not(:disabled) {
  background: #e0e0e0;
}

.nav-arrow:disabled {
  color: #ccc;
  cursor: not-allowed;
}

/* Split container */
#split-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#bible-text {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  background: white;
}

#chapter-title {
  margin-bottom: 20px;
  color: #333;
}

#verses {
  line-height: 1.8;
}

.verse {
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  position: relative;
}

.verse:hover {
  background: #f5f5f5;
}

.verse-num {
  font-size: 11px;
  color: #1a5fb4;
  vertical-align: super;
  margin-right: 4px;
  font-weight: 600;
}

.verse-selected {
  background: #fff3cd !important;
}

.verse-highlighted {
  background: #bbdefb !important;
}

.verse-has-note {
  border-left: 3px solid #4caf50;
}

.verse-note-icon {
  margin-left: 8px;
  cursor: pointer;
  font-size: 16px;
  opacity: 0.7;
  padding: 4px 6px;
  border-radius: 4px;
  transition: all 0.2s;
  display: inline-block;
  vertical-align: middle;
}

.verse-note-icon:hover {
  opacity: 1;
  background: #e8f5e9;
}

/* Split divider */
#split-divider {
  width: 6px;
  background: #e0e0e0;
  cursor: col-resize;
  flex-shrink: 0;
}

#split-divider:hover {
  background: #bbb;
}

/* ==================== AI TAB STYLES ==================== */
#ai-tab {
  display: none;
  flex-direction: column;
  flex: 1;
  overflow: hidden;
}

#ai-tab.active {
  display: flex;
}

#ai-tab-container {
  display: flex;
  flex-direction: column;
  flex: 1;
  max-width: 900px;
  margin: 0 auto;
  width: 100%;
  padding: 20px;
  overflow: hidden;
}

#ai-tab-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding-bottom: 15px;
  border-bottom: 1px solid #ddd;
  margin-bottom: 15px;
  flex-shrink: 0;
}

#ai-tab-header h2 {
  margin: 0;
  font-size: 1.4rem;
  color: #333;
}

#clear-ai-chat-btn {
  padding: 8px 16px;
  background: #dc3545;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

#clear-ai-chat-btn:hover {
  background: #c82333;
}

#ai-tab-messages {
  flex: 1;
  overflow-y: auto;
  padding: 15px;
  background: #f9f9f9;
  border-radius: 8px;
  margin-bottom: 15px;
  min-height: 0;
}

#ai-tab-messages:empty::before {
  content: "Ask a question about the Bible...";
  color: #999;
  font-style: italic;
  display: block;
  text-align: center;
  padding: 40px;
}

#ai-tab-messages .message {
  margin-bottom: 15px;
  padding: 12px 16px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.6;
  max-width: 85%;
}

#ai-tab-messages .message.user {
  background: #1a5fb4;
  color: white;
  margin-left: auto;
}

#ai-tab-messages .message.assistant {
  background: white;
  border: 1px solid #ddd;
  margin-right: auto;
}

#ai-tab-messages .message.assistant p {
  margin-bottom: 10px;
}

#ai-tab-messages .message.assistant p:last-child {
  margin-bottom: 0;
}

#ai-tab-messages .message.assistant ul,
#ai-tab-messages .message.assistant ol {
  margin-left: 20px;
  margin-bottom: 10px;
}

#ai-tab-messages .message.error {
  background: #ffebee;
  color: #c62828;
  border: 1px solid #ef9a9a;
}

#ai-tab-input-container {
  display: flex;
  gap: 10px;
  flex-shrink: 0;
}

#ai-tab-input {
  flex: 1;
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 8px;
  resize: none;
  min-height: 50px;
  max-height: 150px;
  font-family: inherit;
  font-size: 16px;
}

#ai-tab-input:focus {
  outline: none;
  border-color: #1a5fb4;
}

#ai-tab-send {
  padding: 12px 24px;
  background: #1a5fb4;
  color: white;
  border: none;
  border-radius: 8px;
  cursor: pointer;
  font-size: 14px;
  font-weight: 500;
  align-self: flex-end;
}

#ai-tab-send:hover {
  background: #0d47a1;
}

#ai-tab-send:disabled {
  background: #ccc;
  cursor: not-allowed;
}

/* Bible reference links in AI responses */
.bible-ref {
  color: #1a5fb4;
  text-decoration: underline;
  cursor: pointer;
}

.bible-ref:hover {
  color: #0d47a1;
}

/* Definition panel */
#definition-panel {
  position: absolute;
  top: 10px;
  right: 10px;
  width: 300px;
  background: white;
  border: 1px solid #ddd;
  border-radius: 8px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.15);
  z-index: 100;
}

#definition-panel.hidden {
  display: none;
}

#definition-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
}

#definition-word {
  font-weight: 600;
  color: #333;
}

#close-definition {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 16px;
  color: #666;
  padding: 5px;
}

#definition-text {
  padding: 15px;
  font-size: 14px;
  line-height: 1.6;
  max-height: 300px;
  overflow-y: auto;
}

/* Search results */
#search-results {
  width: 0;
  overflow: hidden;
  background: white;
  border-left: 1px solid #ddd;
  transition: width 0.2s;
  flex-shrink: 0;
  display: none;
}

#search-results.visible {
  display: block;
  width: 350px;
}

#results-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 15px;
  border-bottom: 1px solid #ddd;
}

#close-results {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 18px;
  padding: 5px;
}

#results-list {
  overflow-y: auto;
  height: calc(100% - 50px);
}

.result-item {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.result-item:hover {
  background: #f5f5f5;
}

.result-ref {
  font-weight: 600;
  color: #1a5fb4;
  font-size: 13px;
  margin-bottom: 4px;
}

.result-text {
  font-size: 13px;
  color: #555;
}

.result-text mark {
  background: #fff59d;
  padding: 0 2px;
}

.results-summary {
  padding: 12px 15px;
  background: #f9f9f9;
  border-bottom: 1px solid #ddd;
}

.summary-total {
  margin-bottom: 8px;
}

.summary-item {
  font-size: 12px;
  color: #666;
  padding: 4px 0;
  cursor: pointer;
}

.summary-item:hover {
  color: #1a5fb4;
}

/* Selection info */
#selection-info {
  display: flex;
  align-items: center;
  gap: 10px;
  margin-left: 20px;
  font-size: 13px;
}

#selection-info button {
  padding: 4px 10px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 12px;
}

#selection-info button:nth-child(3) {
  background: #1a5fb4;
}

#selection-info button:last-child {
  background: #f44336;
}

/* Notes tab */
#notes-container {
  display: flex;
  flex: 1;
  overflow: hidden;
}

#notes-sidebar {
  width: 300px;
  background: white;
  border-right: 1px solid #ddd;
  display: flex;
  flex-direction: column;
  flex-shrink: 0;
}

#notes-toolbar {
  padding: 15px;
  border-bottom: 1px solid #ddd;
}

#new-note-btn {
  width: 100%;
  padding: 10px;
  background: #1a5fb4;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-weight: 500;
  margin-bottom: 10px;
}

#new-note-btn:hover {
  background: #0d47a1;
}

#notes-search {
  width: 100%;
  padding: 8px 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

#notes-list {
  flex: 1;
  overflow-y: auto;
}

.note-item {
  padding: 12px 15px;
  border-bottom: 1px solid #eee;
  cursor: pointer;
}

.note-item:hover {
  background: #f5f5f5;
}

.note-item.active {
  background: #e3f2fd;
}

.note-item-title {
  font-weight: 500;
  margin-bottom: 4px;
  color: #333;
}

.note-item-date {
  font-size: 12px;
  color: #888;
}

.note-item-tags {
  margin-top: 4px;
}

.note-tag {
  display: inline-block;
  background: #e0e0e0;
  padding: 2px 8px;
  border-radius: 10px;
  font-size: 11px;
  margin-right: 4px;
  color: #555;
}

/* Note editor */
#note-editor {
  flex: 1;
  display: flex;
  flex-direction: column;
  background: #fafafa;
  overflow: hidden;
}

#note-editor-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 100%;
  color: #888;
}

#note-editor-content {
  display: flex;
  flex-direction: column;
  height: 100%;
  padding: 20px;
  overflow: hidden;
}

#note-editor-content.hidden {
  display: none;
}

#note-header {
  display: flex;
  gap: 10px;
  margin-bottom: 15px;
  flex-wrap: wrap;
}

#note-title {
  flex: 1;
  min-width: 200px;
  padding: 12px;
  font-size: 18px;
  font-weight: 500;
  border: 1px solid #ddd;
  border-radius: 4px;
}

#save-note-btn {
  padding: 10px 20px;
  background: #4caf50;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#delete-note-btn {
  padding: 10px 20px;
  background: #f44336;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#note-meta {
  display: flex;
  gap: 30px;
  margin-bottom: 15px;
  padding: 15px;
  background: white;
  border-radius: 4px;
  border: 1px solid #ddd;
  flex-wrap: wrap;
}

#note-meta label {
  font-size: 12px;
  color: #666;
  margin-bottom: 6px;
  display: block;
}

#note-verses-container, #note-tags-container {
  flex: 1;
  min-width: 200px;
}

#note-verses, #note-tags {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.verse-tag, .tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  background: #e3f2fd;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 12px;
  color: #1a5fb4;
}

.tag-pill {
  background: #f3e5f5;
  color: #7b1fa2;
}

.verse-tag button, .tag-pill button {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  color: inherit;
  opacity: 0.6;
  padding: 0;
  margin-left: 2px;
}

.verse-tag button:hover, .tag-pill button:hover {
  opacity: 1;
}

#add-verse-btn {
  background: none;
  border: 1px dashed #1a5fb4;
  color: #1a5fb4;
  padding: 4px 10px;
  border-radius: 15px;
  font-size: 12px;
  cursor: pointer;
}

#add-tag-input {
  padding: 4px 10px;
  border: 1px solid #ddd;
  border-radius: 15px;
  font-size: 12px;
  width: 120px;
}

#note-content {
  flex: 1;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  resize: none;
  font-family: inherit;
  font-size: 16px;
  line-height: 1.6;
}

#note-preview {
  flex: 1;
  padding: 15px;
  border: 1px solid #ddd;
  border-radius: 4px;
  background: white;
  overflow-y: auto;
  font-size: 16px;
  line-height: 1.6;
}

#note-preview p {
  margin-bottom: 12px;
}

#note-preview ul, #note-preview ol {
  margin-left: 20px;
  margin-bottom: 12px;
}

#note-preview .bible-ref {
  color: #1a5fb4;
  text-decoration: underline;
  cursor: pointer;
}

#note-preview .bible-ref:hover {
  color: #0d47a1;
}

#preview-note-btn {
  padding: 10px 15px;
  background: #666;
  color: white;
  border: none;
  border-radius: 4px;
  cursor: pointer;
}

#preview-note-btn:hover {
  background: #555;
}

.verse-tag-link {
  color: #1a5fb4;
  text-decoration: none;
  cursor: pointer;
}

.verse-tag-link:hover {
  text-decoration: underline;
}

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

.modal.hidden {
  display: none;
}

.modal-content {
  background: white;
  border-radius: 8px;
  width: 100%;
  max-width: 400px;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
}

.modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 15px 20px;
  border-bottom: 1px solid #eee;
}

.modal-header h3 {
  font-size: 16px;
}

.modal-close {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #666;
  padding: 5px;
}

.modal-body {
  padding: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.modal-body select, .modal-body input {
  padding: 12px;
  border: 1px solid #ddd;
  border-radius: 4px;
  font-size: 16px;
}

.modal-footer {
  padding: 15px 20px;
  border-top: 1px solid #eee;
  display: flex;
  justify-content: flex-end;
  gap: 10px;
}

.modal-footer button {
  padding: 10px 20px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  font-size: 14px;
}

#modal-add-verse {
  background: #1a5fb4;
  color: white;
}

.modal-cancel {
  background: #e0e0e0;
}

/* Mobile bottom nav */
#mobile-bottom-nav {
  display: none;
  background: #1a1a2e;
  border-top: 1px solid #333;
  flex-shrink: 0;
}

.mobile-nav-btn {
  flex: 1;
  background: none;
  border: none;
  color: #aaa;
  padding: 10px 5px;
  font-size: 11px;
  cursor: pointer;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
}

.mobile-nav-btn.active {
  color: white;
}

.mobile-nav-btn span:first-child {
  font-size: 20px;
}

/* Mobile chapter nav */
#mobile-chapter-nav {
  display: none;
}

/* Overlay backdrop */
#overlay-backdrop {
  display: none;
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 90;
}

#overlay-backdrop.visible {
  display: block;
}

/* Utility */
.hidden {
  display: none !important;
}

/* ==================== MOBILE STYLES ==================== */
@media (max-width: 768px) {
  /* Hide desktop nav elements */
  .nav-tab {
    display: none;
  }
  
  .nav-right #user-name {
    display: none;
  }
  
  .nav-title {
    font-size: 16px;
  }
  
  #main-nav {
    padding: 0 10px;
  }
  
  /* Show mobile bottom nav */
  #mobile-bottom-nav {
    display: flex;
  }
  
  /* Toolbar adjustments */
  #toolbar {
    padding: 8px 10px;
    gap: 6px;
  }
  
  #toolbar select {
    padding: 10px 8px;
    font-size: 14px;
    flex: 1;
    min-width: 0;
  }
  
  #search-container {
    display: none;
    position: fixed;
    top: 50px;
    left: 0;
    right: 0;
    background: white;
    padding: 10px;
    z-index: 50;
    border-bottom: 1px solid #ddd;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
  }
  
  #search-container.visible {
    display: flex;
  }
  
  #search-input {
    flex: 1;
    width: auto;
    font-size: 16px;
    padding: 12px;
  }
  
  #mobile-sidebar-toggle,
  #mobile-ai-toggle,
  #mobile-search-toggle {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 44px;
    height: 44px;
    background: #f0f0f0;
    border: none;
    border-radius: 4px;
    font-size: 18px;
    cursor: pointer;
    flex-shrink: 0;
  }
  
  #result-count {
    display: none;
  }
  
  #selection-info {
    position: fixed;
    bottom: 70px;
    left: 10px;
    right: 10px;
    background: white;
    padding: 12px;
    border-radius: 8px;
    box-shadow: 0 2px 10px rgba(0,0,0,0.2);
    margin: 0;
    justify-content: center;
    z-index: 50;
  }
  
  /* Sidebar as overlay */
  #sidebar {
    position: fixed;
    top: 50px;
    left: 0;
    bottom: 56px;
    width: 280px;
    z-index: 100;
    transform: translateX(-100%);
    transition: transform 0.3s ease;
    box-shadow: 2px 0 10px rgba(0,0,0,0.2);
  }
  
  #sidebar.visible {
    transform: translateX(0);
  }
  
  .book-item {
    padding: 12px 15px;
    font-size: 15px;
  }
  
  /* Main content area */
  #content {
    flex-direction: column;
  }
  
  #bible-container {
    flex: 1;
  }
  
  #bible-nav-wrapper {
    flex-direction: column;
  }
  
  .nav-arrow {
    display: none;
  }
  
  #split-container {
    flex-direction: column;
    flex: 1;
  }
  
  #split-divider {
    display: none;
  }
  
  #bible-text {
    padding: 15px;
    flex: 1;
  }
  
  #chapter-title {
    font-size: 20px;
    text-align: center;
  }
  
  .verse {
    padding: 10px 6px;
    font-size: 16px;
    line-height: 1.7;
  }
  
  .verse-note-icon {
    font-size: 18px;
    padding: 8px 10px;
    margin-left: 4px;
    min-width: 44px;
    min-height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
  }
  
  /* Mobile chapter nav */
  #mobile-chapter-nav {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 8px 15px;
    background: white;
    border-top: 1px solid #ddd;
  }
  
  #mobile-chapter-nav button {
    padding: 10px 15px;
    background: #f0f0f0;
    border: none;
    border-radius: 4px;
    font-size: 16px;
    cursor: pointer;
    min-width: 50px;
  }
  
  #mobile-chapter-nav button:disabled {
    opacity: 0.4;
  }
  
  #mobile-chapter-nav span {
    font-weight: 600;
    font-size: 14px;
  }
  
  /* AI Tab mobile adjustments */
  #ai-tab-container {
    padding: 10px;
  }
  
  #ai-tab-header {
    padding-bottom: 10px;
    margin-bottom: 10px;
  }
  
  #ai-tab-header h2 {
    font-size: 1.1rem;
  }
  
  #clear-ai-chat-btn {
    padding: 6px 12px;
    font-size: 12px;
  }
  
  #ai-tab-messages {
    padding: 10px;
  }
  
  #ai-tab-messages .message {
    max-width: 90%;
    padding: 10px 12px;
  }
  
  #ai-tab-input-container {
    flex-direction: column;
    gap: 8px;
  }
  
  #ai-tab-input {
    min-height: 60px;
  }
  
  #ai-tab-send {
    width: 100%;
    padding: 14px;
  }
  
  /* Search results as overlay */
  #search-results {
    position: fixed;
    top: 110px;
    left: 10px;
    right: 10px;
    bottom: 66px;
    width: auto;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 100;
  }
  
  #search-results.visible {
    display: block;
    width: auto;
  }
  
  .result-item {
    padding: 15px;
  }
  
  .result-ref {
    font-size: 14px;
  }
  
  .result-text {
    font-size: 14px;
  }
  
  /* Definition panel mobile */
  #definition-panel {
    position: fixed;
    top: auto;
    bottom: 66px;
    left: 10px;
    right: 10px;
    width: auto;
    max-height: 50vh;
  }
  
  #definition-text {
    max-height: 200px;
  }
  
  /* Search options mobile */
  #search-options {
    flex-direction: column;
    gap: 10px;
    padding: 15px;
  }
  
  .option-group {
    flex-wrap: wrap;
  }
  
  /* Notes tab mobile */
  #notes-container {
    flex-direction: column;
  }
  
  #notes-sidebar {
    width: 100%;
    height: 45%;
    max-height: none;
    border-right: none;
    border-bottom: 1px solid #ddd;
    flex-shrink: 0;
  }
  
  #notes-toolbar {
    display: flex;
    gap: 10px;
    align-items: center;
    padding: 10px;
  }
  
  #new-note-btn {
    width: auto;
    margin-bottom: 0;
    white-space: nowrap;
  }
  
  #notes-search {
    flex: 1;
  }
  
  #note-editor {
    flex: 1;
    min-height: 0;
  }
  
  #note-editor-content {
    padding: 15px;
  }
  
  #note-header {
    flex-direction: column;
    gap: 10px;
  }
  
  #note-title {
    min-width: 0;
  }
  
  .note-buttons {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
  }
  
  #save-note-btn, #delete-note-btn, #preview-note-btn {
    flex: 1;
    min-width: 70px;
  }
  
  #note-meta {
    flex-direction: column;
    gap: 15px;
    padding: 12px;
  }
  
  #note-verses-container, #note-tags-container {
    min-width: 0;
  }
  
  #note-content {
    min-height: 150px;
  }
  
  /* Overlay backdrop */
  #overlay-backdrop {
    top: 50px;
    bottom: 56px;
  }
}

/* Extra small phones */
@media (max-width: 380px) {
  .mobile-nav-btn {
    padding: 8px 2px;
    font-size: 10px;
  }
  
  .mobile-nav-btn span:first-child {
    font-size: 18px;
  }
  
  #toolbar select {
    font-size: 13px;
    padding: 8px 5px;
  }
  
  #ai-tab-header h2 {
    font-size: 1rem;
  }
}