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

body {
  font-family: 'Segoe UI', system-ui, -apple-system, sans-serif;
  background: var(--bg-body);
  color: var(--text-primary);
  min-height: 100vh;
  display: flex;
  flex-direction: column;
}

/* ---- Layout ---- */
.bible-container {
  flex: 1;
  display: flex;
  height: calc(100vh - 56px);
  overflow: hidden;
}

.left-panel {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-right: 1px solid var(--border-default);
  display: flex;
  flex-direction: column;
  overflow-y: auto;
}

.middle-panel {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  min-width: 0;
}

.right-panel {
  width: 300px;
  flex-shrink: 0;
  background: var(--bg-card);
  border-left: 1px solid var(--border-default);
  overflow-y: auto;
}

/* ---- Panels sections ---- */
.panel-section {
  padding: 12px;
  border-bottom: 1px solid var(--border-default);
}

.panel-section h3 {
  font-size: 12px;
  text-transform: uppercase;
  letter-spacing: 0.5px;
  color: var(--text-secondary);
  margin-bottom: 8px;
}

/* ---- Form controls ---- */
.bible-select {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-default);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 14px;
  cursor: pointer;
}

.bible-select.small { font-size: 12px; padding: 4px 8px; }

.bible-input {
  width: 100%;
  padding: 8px 10px;
  border-radius: 6px;
  border: 1px solid var(--border-default);
  background: var(--bg-body);
  color: var(--text-primary);
  font-size: 13px;
  outline: none;
  transition: border-color 0.2s;
}

.bible-input:focus { border-color: var(--accent); }

.bible-btn {
  padding: 8px 16px;
  border-radius: 6px;
  border: 1px solid var(--border-default);
  background: var(--accent);
  color: #1a1a2e;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  transition: opacity 0.2s;
}

.bible-btn:hover { opacity: 0.85; }

.bible-btn.small { padding: 4px 10px; font-size: 11px; }
.bible-btn.hidden { display: none; }

/* ---- Search ---- */
.search-section .bible-input { margin-bottom: 6px; }

.search-options {
  display: flex;
  gap: 12px;
  margin-bottom: 8px;
  font-size: 12px;
  color: var(--text-secondary);
}

.search-options label { cursor: pointer; display: flex; align-items: center; gap: 4px; }

/* ---- Books list ---- */
.scroll-list {
  max-height: 300px;
  overflow-y: auto;
}

.book-item {
  padding: 6px 8px;
  cursor: pointer;
  font-size: 13px;
  border-radius: 4px;
  transition: background 0.15s;
  display: flex;
  align-items: center;
  gap: 8px;
}

.book-item:hover { background: var(--border-default); }
.book-item.active { background: var(--accent); color: #1a1a2e; font-weight: 600; }

.book-item .book-num {
  font-size: 10px;
  color: var(--text-secondary);
  min-width: 20px;
  text-align: right;
}

.book-item.active .book-num { color: inherit; opacity: 0.7; }

/* ---- Chapters grid ---- */
.chapters-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(36px, 1fr));
  gap: 4px;
  max-height: 200px;
}

.chapter-btn {
  padding: 6px 0;
  text-align: center;
  font-size: 12px;
  border-radius: 4px;
  cursor: pointer;
  border: 1px solid var(--border-default);
  background: var(--bg-body);
  color: var(--text-primary);
  transition: all 0.15s;
}

.chapter-btn:hover { border-color: var(--accent); }
.chapter-btn.active { background: var(--accent); color: #1a1a2e; border-color: var(--accent); font-weight: 600; }

/* ---- Toolbar ---- */
.toolbar {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 20px;
  border-bottom: 1px solid var(--border-default);
  flex-shrink: 0;
}

.chapter-title { font-size: 18px; font-weight: 700; }

/* ---- Pane container (compare mode) ---- */
.pane-container {
  flex: 1;
  display: flex;
  min-height: 0;
}

.pane {
  flex: 1;
  overflow-y: auto;
  padding: 20px;
  position: relative;
}

.pane-a { border-right: 1px solid var(--border-default); }

.pane-b { display: none; }

.compare-mode .right-panel { display: none; }
.compare-mode .pane-b { display: block; }

.pane-version-bar {
  position: absolute;
  top: 4px;
  right: 20px;
  left: 20px;
  display: flex;
  justify-content: flex-end;
  z-index: 1;
}

.pane-version-bar select { max-width: 160px; }

/* ---- Chapter content (verses) ---- */
.chapter-content {
  padding-top: 8px;
}

.chapter-content.search-results { padding-top: 0; }

.verse-line {
  padding: 3px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  line-height: 1.7;
  font-size: 15px;
}

.verse-line:hover { background: var(--border-default); }
.verse-line.selected { background: rgba(var(--accent-rgb), 0.15); }

.verse-num {
  font-size: 11px;
  font-weight: 700;
  color: var(--accent);
  margin-right: 6px;
  user-select: none;
  vertical-align: super;
}

.verse-text { vertical-align: baseline; }

/* ---- Search results ---- */
.search-result-item {
  padding: 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-default);
}

.search-result-item:hover { background: var(--border-default); }

.search-result-ref {
  font-size: 12px;
  font-weight: 600;
  color: var(--accent);
  margin-bottom: 2px;
}

.search-result-text {
  font-size: 14px;
  color: var(--text-primary);
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

/* ---- Right panel: Progress ---- */
.progress-toggle {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 13px;
  cursor: pointer;
}

.progress-toggle input[type="checkbox"] { cursor: pointer; width: 16px; height: 16px; }

/* ---- Notes ---- */
.notes-list { margin-bottom: 8px; }

.note-item {
  padding: 8px;
  background: var(--bg-body);
  border-radius: 6px;
  margin-bottom: 6px;
  font-size: 13px;
  line-height: 1.5;
  position: relative;
}

.note-item .note-verse-badge {
  display: inline-block;
  font-size: 10px;
  font-weight: 700;
  color: var(--accent);
  background: rgba(var(--accent-rgb), 0.12);
  padding: 1px 5px;
  border-radius: 3px;
  margin-right: 4px;
}

.note-item .note-text { word-break: break-word; }

.note-item .note-meta {
  font-size: 10px;
  color: var(--text-secondary);
  margin-top: 4px;
  display: flex;
  justify-content: space-between;
}

.note-delete-btn {
  background: none;
  border: none;
  color: var(--text-secondary);
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  padding: 0 2px;
}

.note-delete-btn:hover { color: var(--accent-red); }

.note-form { border-top: 1px solid var(--border-default); padding-top: 8px; }

.note-form-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: 4px;
}

.verse-attach-label {
  font-size: 11px;
  color: var(--text-secondary);
  display: flex;
  align-items: center;
  gap: 4px;
  cursor: pointer;
}

.verse-attach-label input { width: 14px; height: 14px; cursor: pointer; }

/* ---- Tags ---- */
.tags-list {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  margin-bottom: 8px;
}

.tag-pill {
  display: inline-flex;
  align-items: center;
  gap: 4px;
  padding: 3px 8px;
  border-radius: 12px;
  font-size: 11px;
  font-weight: 600;
  background: rgba(var(--accent-rgb), 0.12);
  color: var(--accent);
}

.tag-remove-btn {
  background: none;
  border: none;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  color: inherit;
  opacity: 0.5;
  padding: 0;
}

.tag-remove-btn:hover { opacity: 1; }

.tag-form { display: flex; gap: 4px; }
.tag-form .bible-input { flex: 1; }

/* ---- Cross-references ---- */
.crossrefs-list { font-size: 13px; }

.crossrefs-list .hint {
  color: var(--text-secondary);
  font-style: italic;
  font-size: 12px;
}

.crossref-item {
  padding: 6px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
  border-bottom: 1px solid var(--border-default);
}

.crossref-item:hover { background: var(--border-default); }

.crossref-ref {
  font-weight: 600;
  color: var(--accent);
  font-size: 12px;
}

.crossref-votes {
  font-size: 10px;
  color: var(--text-secondary);
  margin-left: 4px;
}

/* ---- Count badge ---- */
.count-badge {
  font-size: 11px;
  color: var(--text-secondary);
  font-weight: 400;
}

/* ---- Responsive ---- */
@media (max-width: 900px) {
  .right-panel { display: none; }
  .left-panel { width: 180px; }
}
