* { box-sizing: border-box; }
body { margin: 0; font-family: Georgia, 'Times New Roman', serif; background: #f5f0e8; color: #1a1a1a; }
.header {
  background: #2c3e50;
  color: #fff;
  padding: 0.75rem 1.5rem;
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 1rem;
}
.site-logo { display: flex; align-items: center; margin: 0; text-decoration: none; }
.site-logo:hover { opacity: 0.92; }
.logo-img { height: 40px; width: auto; max-width: 280px; object-fit: contain; vertical-align: middle; display: block; }
.nav-select-wrap { display: flex; align-items: center; gap: 0.5rem; flex-wrap: wrap; }
.nav-select-wrap label { font-size: 0.85rem; color: rgba(255,255,255,0.9); white-space: nowrap; }
.nav-select-wrap select { padding: 0.4rem 0.5rem; min-width: 140px; max-width: 200px; border: none; border-radius: 4px; font-size: 0.9rem; background: #fff; color: #1a1a1a; cursor: pointer; }
.nav-select-wrap select:disabled { opacity: 0.7; cursor: not-allowed; }
.search-wrap { display: flex; gap: 0.5rem; margin-left: auto; flex-wrap: wrap; align-items: center; }
.search-wrap select { padding: 0.4rem 0.5rem; border: 1px solid #ddd; border-radius: 4px; background: #fff; }
.search-wrap input { padding: 0.4rem 0.6rem; min-width: 180px; border: none; border-radius: 4px; }
.search-wrap input#passageInput { min-width: 260px; }
.search-wrap button { padding: 0.4rem 0.8rem; background: #e67e22; color: #fff; border: none; border-radius: 4px; cursor: pointer; }
.search-wrap button:hover { background: #d35400; }
.search-wrap .hidden { display: none !important; }
.user-wrap { display: flex; align-items: center; gap: 0.75rem; margin-left: 0.5rem; }
.header-username { font-size: 0.9rem; color: rgba(255,255,255,0.9); }
.logout-btn { padding: 0.35rem 0.6rem; background: transparent; color: #fff; border: 1px solid rgba(255,255,255,0.6); border-radius: 4px; cursor: pointer; font-size: 0.85rem; }
.logout-btn:hover { background: rgba(255,255,255,0.15); }

.main { display: flex; min-height: calc(100vh - 52px); }
.sidebar {
  display: flex;
  width: 340px;
  min-width: 340px;
  background: #fff;
  border-right: 1px solid #ddd;
  overflow: hidden;
}
.sidebar .panel { flex: 1; min-width: 0; padding: 1rem; overflow-y: auto; border-right: 1px solid #eee; }
.sidebar .panel:last-child { border-right: none; }
.sidebar .panel-books { max-width: 50%; }
.sidebar .panel-chapters { max-width: 50%; }
.panel h2 { font-size: 0.95rem; margin: 0 0 0.5rem; color: #555; text-transform: uppercase; letter-spacing: 0.05em; }
.panel ul { list-style: none; margin: 0; padding: 0; }
.panel li { padding: 0.35rem 0; border-bottom: 1px solid #eee; }
.panel li a { color: #2c3e50; text-decoration: none; }
.panel li a:hover { text-decoration: underline; }

/* Raggruppamento libri: macro gruppi (AT/NT) espandibili, poi sottogruppi espandibili */
.panel .book-testament-block {
  list-style: none;
  margin: 0;
  padding: 0;
  border-bottom: 1px solid #ddd;
}
.panel .book-testament-block:first-child { margin-top: 0; }
.panel .book-testament-heading {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-weight: 700;
  font-size: 0.95rem;
  color: #2c3e50;
  padding: 0.5rem 0;
  cursor: pointer;
  user-select: none;
  list-style: none;
  border: none;
  background: none;
  width: 100%;
  text-align: left;
}
.panel .book-testament-heading:hover { color: #1a252f; }
.panel .book-toggle {
  font-size: 0.7rem;
  color: #7f8c8d;
  flex-shrink: 0;
}
.panel .book-testament-content {
  display: none;
  padding-left: 0.5rem;
  padding-bottom: 0.35rem;
}
.panel .book-testament-block.expanded .book-testament-content { display: block; }

.panel .book-section-wrap {
  margin-top: 0.2rem;
  list-style: none;
}
.panel .book-section-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.8rem;
  font-weight: 600;
  color: #7f8c8d;
  text-transform: uppercase;
  letter-spacing: 0.03em;
  padding: 0.35rem 0 0.15rem;
  cursor: pointer;
  user-select: none;
}
.panel .book-section-title:hover { color: #2c3e50; }
.panel .book-section-title .book-toggle { font-size: 0.6rem; }
.panel .book-section-list {
  display: none;
  list-style: none;
  margin: 0;
  padding: 0 0 0 0.75rem;
  border: none;
}
.panel .book-section-wrap.expanded .book-section-list { display: block; }
.panel .book-section-list li {
  padding: 0.2rem 0;
  border-bottom: none;
}
.panel .book-section-list li a { font-size: 0.9rem; }
.panel .message { font-size: 0.9rem; color: #7f8c8d; margin: 0.5rem 0 0; }
.panel.hidden { display: none; }
.hidden { display: none !important; }

.reader { flex: 1; padding: 1.5rem 2rem; overflow-y: auto; max-width: 1200px; margin: 0 auto; min-width: 0; }
#welcome { color: #666; }
#chapterContent.hidden, #searchResults.hidden { display: none; }
#chapterTitle { margin-top: 0; color: #2c3e50; font-size: 1.4rem; }
#verses p { margin: 0.4rem 0; line-height: 1.6; }
#verses p .verse-num { font-weight: bold; color: #7f8c8d; margin-right: 0.25rem; font-size: 0.9em; }

#searchResultsList { list-style: none; padding: 0; margin: 0; }
#searchResultsList li { padding: 0.6rem 0; border-bottom: 1px solid #eee; }
#searchResultsList li a { color: #2980b9; text-decoration: none; }
#searchResultsList .ref { font-weight: bold; color: #2c3e50; margin-bottom: 0.2rem; }
#searchResultsList .snippet { color: #444; font-size: 0.95rem; }
#passageResults { margin-top: 0.5rem; }
#passageContent .passage-block { margin-bottom: 1.25rem; }
#passageContent .passage-heading { font-weight: bold; color: #2c3e50; margin-bottom: 0.35rem; font-size: 1.05rem; }
#passageContent .passage-verses p { margin: 0.35rem 0; line-height: 1.5; }
#passageContent .passage-verses .verse-num { font-weight: bold; margin-right: 0.25rem; color: #555; }
#passageContent .passage-verses a { color: #2980b9; text-decoration: none; }
#passageContent .passage-verses a:hover { text-decoration: underline; }

.strong-word { color: #2980b9; cursor: pointer; text-decoration: underline; text-underline-offset: 2px; }
.strong-word:hover { color: #1a5276; }

.modal { position: fixed; top: 0; left: 0; right: 0; bottom: 0; background: rgba(0,0,0,0.5); display: flex; align-items: center; justify-content: center; z-index: 1000; padding: 1rem; }
.modal.hidden { display: none; }
.modal-content { background: #fff; max-width: 640px; max-height: 85vh; overflow: hidden; display: flex; flex-direction: column; border-radius: 8px; box-shadow: 0 4px 20px rgba(0,0,0,0.2); }
.modal-header { display: flex; justify-content: space-between; align-items: flex-start; padding: 0.75rem 1rem; border-bottom: 1px solid #eee; }
.modal-title-wrap { min-width: 0; flex: 1; }
.modal-header h3 { margin: 0; font-size: 1.1rem; }
.strong-selected-word { margin: 0.35rem 0 0; font-size: 1rem; font-weight: 600; color: #2c3e50; }
.strong-selected-word:not(.hidden) { display: block; }
.modal-close { background: none; border: none; font-size: 1.5rem; cursor: pointer; color: #666; line-height: 1; padding: 0 0.25rem; }
.modal-close:hover { color: #000; }
.modal-body { padding: 1rem; overflow: auto; }
.modal-body .footer-code { margin: 0.35rem 0; }
.modal-body code { background: #f0f0f0; padding: 0.15rem 0.35rem; border-radius: 3px; }
.btn-link { background: none; border: none; color: #2980b9; cursor: pointer; text-decoration: none; font-size: inherit; padding: 0; }
.btn-link:hover { text-decoration: underline; }
.strong-def { padding: 0.5rem 0; overflow-y: auto; font-size: 0.9rem; line-height: 1.5; white-space: pre-wrap; word-break: break-word; }
.strong-lex-header { padding: 0 1rem 0.75rem; border-bottom: 1px solid #e0e0e0; font-size: 0.9rem; line-height: 1.6; }
.strong-lex-header .lex-word { font-size: 1.6rem; font-weight: bold; margin-bottom: 0.35rem; }
.strong-lex-header dl { margin: 0; display: grid; grid-template-columns: auto 1fr; gap: 0.2rem 1rem; }
.strong-lex-header dt { color: #555; font-weight: 600; }
.strong-lex-header dd { margin: 0; }
.strong-sections { padding: 0 1rem; max-height: 40vh; overflow-y: auto; }
.strong-section { margin-bottom: 1rem; }
.strong-section h4 { margin: 0 0 0.35rem; font-size: 0.85rem; color: #2c3e50; }
.modal-content-strong .strong-usages-wrap { padding: 0 1rem 1rem; border-top: 1px solid #eee; }
.strong-usages-wrap h4 { margin: 0 0 0.5rem; font-size: 0.9rem; color: #555; }
#strongUsages { list-style: none; padding: 0; margin: 0; max-height: 120px; overflow-y: auto; font-size: 0.85rem; column-count: 2; column-gap: 1rem; }
#strongUsages li { padding: 0.15rem 0; }

.view-tabs { display: flex; align-items: center; gap: 0; margin: 0.75rem 0 0.5rem; border-bottom: 2px solid #2c3e50; }
.view-tab { padding: 0.5rem 1rem; background: #e8ecf0; color: #2c3e50; border: 1px solid #bdc3c7; border-bottom: none; border-radius: 6px 6px 0 0; cursor: pointer; font-size: 0.95rem; margin-bottom: -2px; }
.view-tab:hover { background: #d5dce4; }
.view-tab.active { background: #fff; color: #2c3e50; font-weight: 600; border-color: #2c3e50; border-bottom: 2px solid #fff; }
#interlinearLoading { margin-left: 0.5rem; font-size: 0.9rem; color: #7f8c8d; }
.view-panel { margin-top: 0; }
.interlinear-wrap { margin-top: 1.5rem; border-top: 2px solid #2c3e50; padding-top: 1rem; background: #fff; border-radius: 6px; box-shadow: 0 2px 8px rgba(0,0,0,0.08); padding: 1rem; }
.interlinear-table-scroll { overflow-x: auto; max-width: 100%; border: 1px solid #2c3e50; border-radius: 4px; }
.interlinear-table { width: 100%; border-collapse: collapse; font-size: 0.95rem; }
.interlinear-table th, .interlinear-table td { border: 1px solid #2c3e50; padding: 0.55rem 0.65rem; text-align: left; vertical-align: top; }
.interlinear-table th { background: #2c3e50; color: #fff; white-space: nowrap; font-weight: 600; font-size: 0.9rem; }
.interlinear-table td { background: #fff; color: #1a1a1a; }
.interlinear-table td.col-strong { font-weight: bold; background: #ecf0f1; }
.interlinear-table td.col-ref { vertical-align: top; font-weight: bold; white-space: nowrap; background: #e8eef1; }
.interlinear-table td.col-outline,
.interlinear-table td.col-strongs-def { min-width: 220px; max-width: 420px; max-height: 10em; overflow-y: auto; white-space: pre-wrap; word-break: break-word; line-height: 1.45; }
.translation-it { margin-top: 0.4rem; padding-top: 0.35rem; border-top: 1px solid #e0e0e0; font-size: 0.9em; color: #2c3e50; font-style: italic; }
.interlinear-table tbody tr:nth-child(even) { background: #f4f6f7; }
.interlinear-table tbody tr:nth-child(even) td.col-strong { background: #e2e6e8; }
.interlinear-table tbody tr:nth-child(even) td.col-ref { background: #dde4e8; }
.interlinear-table tbody tr:hover td { background: #e8f4fc !important; }

/* Footer: solo titoli visibili, contenuti in schede espandibili */
.site-footer {
  margin-top: 2rem;
  padding: 1.5rem 2rem;
  background: #fff;
  border-top: 1px solid #ddd;
  font-size: 0.95rem;
  color: #444;
  max-width: 1200px;
  margin-left: auto;
  margin-right: auto;
}
.site-footer .footer-cards { margin-bottom: 0.75rem; }
.site-footer .footer-card {
  margin-bottom: 0.5rem;
  border: 1px solid #e0e0e0;
  border-radius: 4px;
  overflow: hidden;
}
.site-footer .footer-card-title {
  display: flex;
  align-items: center;
  gap: 0.35rem;
  font-size: 0.95rem;
  font-weight: 600;
  margin: 0;
  padding: 0.5rem 0.6rem;
  color: #2c3e50;
  cursor: pointer;
  user-select: none;
  background: #f8f9fa;
}
.site-footer .footer-card-title:hover { background: #eef0f2; }
.site-footer .footer-toggle {
  font-size: 0.7rem;
  color: #7f8c8d;
}
.site-footer .footer-card-content {
  display: none;
  padding: 0.6rem 0.75rem 0.75rem;
  border-top: 1px solid #e0e0e0;
  background: #fff;
}
.site-footer .footer-card.expanded .footer-card-content { display: block; }
.site-footer .footer-card-content p { margin: 0.35rem 0; line-height: 1.55; }
.site-footer .footer-card-content p:first-child { margin-top: 0; }
.site-footer .footer-meta {
  font-size: 0.9rem;
  margin: 0;
  color: #555;
}
.site-footer .footer-link {
  color: #2980b9;
  text-decoration: none;
}
.site-footer .footer-link:hover { text-decoration: underline; }
.site-footer .footer-code { margin: 0.25rem 0; font-family: ui-monospace, monospace; font-size: 0.85rem; }
.site-footer .footer-code code { background: #f0f0f0; padding: 0.15rem 0.35rem; border-radius: 3px; }
.site-footer .footer-version {
  font-size: 0.85rem;
  color: #7f8c8d;
}

@media (max-width: 640px) {
  .main { flex-direction: column; }
  .sidebar { width: 100%; max-height: 200px; }
  .reader { padding: 1rem; }
  #strongUsages { column-count: 1; }
  .interlinear-table td.col-outline,
  .interlinear-table td.col-strongs-def { min-width: 140px; max-width: 260px; }
  .interlinear-wrap { padding: 0.75rem; }
  .site-footer { padding: 1rem; }
}
