/* Catena-style cross-reference sidebar injected into showChapter@2.php.
   Slides in from the left. Does not interfere with existing layout. */

#xref-sidebar {
  position: fixed;
  top: 0;
  left: 0;
  bottom: 0;
  width: min(380px, 92vw);
  background: #ffffff;
  border-right: 1px solid #d5dae0;
  box-shadow: 4px 0 20px rgba(0, 0, 0, 0.08);
  z-index: 9997;
  transform: translateX(-100%);
  transition: transform 0.25s ease-out;
  display: flex;
  flex-direction: column;
  font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
  direction: rtl;
}
#xref-sidebar[data-lang="en"] { direction: ltr; }
#xref-sidebar.open { transform: translateX(0); }

#xref-sidebar-toggle {
  position: fixed;
  top: 50%;
  left: 0;
  transform: translateY(-50%);
  background: #c9a84c;
  color: #18120a;
  padding: 14px 10px;
  font-size: 18px;
  cursor: pointer;
  z-index: 9996;
  border-radius: 0 8px 8px 0;
  box-shadow: 2px 2px 8px rgba(0, 0, 0, 0.15);
  user-select: none;
  transition: background 0.15s;
}
#xref-sidebar-toggle:hover { background: #ddc069; }
#xref-sidebar.open ~ #xref-sidebar-toggle { display: none; }

.xref-head {
  padding: 14px 16px 10px;
  border-bottom: 1px solid #e4e7eb;
  background: #f7f5ef;
  display: flex;
  align-items: center;
  gap: 10px;
}
.xref-head .xref-title {
  font-size: 1.05rem;
  font-weight: 700;
  color: #6b551d;
  flex: 1;
  line-height: 1.3;
}
.xref-head .xref-title .xref-verse-id {
  color: #333;
  font-size: 0.85rem;
  display: block;
  margin-top: 2px;
  font-weight: 500;
}
.xref-head .xref-close {
  background: transparent;
  border: 1px solid #d5dae0;
  border-radius: 6px;
  padding: 4px 10px;
  font-size: 16px;
  cursor: pointer;
  color: #666;
  font-family: inherit;
}
.xref-head .xref-close:hover { background: #ebe8de; color: #000; }

.xref-meta {
  font-size: 0.78rem;
  color: #667085;
  padding: 8px 16px;
  background: #fbfaf6;
  border-bottom: 1px solid #efedea;
}
.xref-meta strong { color: #6b551d; }

.xref-body {
  flex: 1;
  overflow-y: auto;
  padding: 10px 12px 20px;
}

.xref-empty {
  padding: 40px 20px;
  text-align: center;
  color: #8a94a2;
  font-size: 0.9rem;
  line-height: 1.6;
}

.xref-list {
  list-style: none;
  padding: 0;
  margin: 0;
  display: flex;
  flex-direction: column;
  gap: 4px;
}
.xref-item {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 10px;
  border-radius: 6px;
  text-decoration: none;
  color: #2a3545;
  font-size: 0.92rem;
  transition: background 0.12s, border-color 0.12s;
  border: 1px solid transparent;
  cursor: pointer;
}
.xref-item:hover {
  background: #f7f5ef;
  border-color: #e7dfbf;
  color: #000;
}
.xref-item .xref-ref {
  flex: 1;
  font-weight: 600;
  direction: rtl;
}
#xref-sidebar[data-lang="en"] .xref-item .xref-ref { direction: ltr; }
.xref-item .xref-votes {
  background: #f0ecd9;
  color: #6b551d;
  font-size: 0.72rem;
  padding: 2px 8px;
  border-radius: 10px;
  min-width: 30px;
  text-align: center;
  font-variant-numeric: tabular-nums;
  direction: ltr;
}

.xref-footer {
  padding: 10px 14px;
  border-top: 1px solid #e4e7eb;
  background: #fbfaf6;
  font-size: 0.74rem;
  color: #8a94a2;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
  flex-wrap: wrap;
}
.xref-footer .xref-lang-toggle {
  border: 1px solid #d5dae0;
  background: #fff;
  padding: 3px 10px;
  border-radius: 4px;
  font-size: 0.74rem;
  cursor: pointer;
  color: #6b551d;
  font-family: inherit;
}
.xref-footer .xref-lang-toggle:hover { background: #f0ecd9; }
.xref-footer .xref-credit a { color: #8a94a2; text-decoration: underline; }

/* Highlight the verse the user has picked so they keep context */
.xref-picked-verse {
  background: rgba(201, 168, 76, 0.18) !important;
  border-radius: 4px;
  box-shadow: 0 0 0 2px rgba(201, 168, 76, 0.35);
}

@media (max-width: 600px) {
  #xref-sidebar { width: 100vw; }
}
