/* ═══════════════════════════════════════════════════════════════════════════
   Chat history — shared by the three chat pages. Pairs with chat-history.js.
   ═══════════════════════════════════════════════════════════════════════════ */

/* The button sits above the hero, right-aligned, so it never competes with
   the question the page is asking people to answer. */
.ch-open {
  display: inline-flex;
  align-items: center;
  gap: 7px;
  margin: 0 0 -6px auto;
  padding: 7px 14px;
  border: 1px solid rgba(0, 14, 51, 0.12);
  border-radius: 999px;
  background: #fff;
  color: #4a4f6b;
  font: inherit;
  font-size: 0.82rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.15s ease;
}
.ch-open:hover {
  border-color: #4b5bd5;
  color: #4b5bd5;
  background: rgba(0, 102, 255, 0.05);
}
.ch-open i { font-size: 0.8rem; }
.ch-open[hidden] { display: none; }

.ch-panel { position: fixed; inset: 0; z-index: 2400; }
.ch-panel[hidden] { display: none; }

.ch-scrim {
  position: absolute;
  inset: 0;
  background: rgba(10, 14, 39, 0.45);
  backdrop-filter: blur(2px);
  animation: chFade 0.18s ease;
}

.ch-drawer {
  position: absolute;
  top: 0;
  right: 0;
  bottom: 0;
  width: min(380px, 100%);
  display: flex;
  flex-direction: column;
  background: #fff;
  box-shadow: -18px 0 52px -14px rgba(17, 26, 77, 0.3);
  animation: chSlide 0.24s cubic-bezier(0.22, 1, 0.36, 1);
}

@keyframes chFade { from { opacity: 0; } to { opacity: 1; } }
@keyframes chSlide { from { transform: translateX(16px); opacity: 0; } to { transform: none; opacity: 1; } }

.ch-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 18px 18px 14px;
  border-bottom: 1px solid #ecedf3;
  flex: none;
}
.ch-head h2 {
  margin: 0;
  font-size: 1.05rem;
  font-weight: 700;
  letter-spacing: -0.01em;
  color: #000e33;
}
.ch-close {
  border: none;
  background: #f3f4f8;
  color: #4a4f6b;
  cursor: pointer;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  flex: none;
}
.ch-close:hover { background: #e8eaf0; }

.ch-new {
  margin: 14px 18px 4px;
  padding: 11px 14px;
  border: 1px dashed rgba(0, 14, 51, 0.18);
  border-radius: 12px;
  background: transparent;
  color: #4b5bd5;
  font: inherit;
  font-size: 0.88rem;
  font-weight: 650;
  cursor: pointer;
  flex: none;
  text-align: left;
}
.ch-new:hover { border-color: #4b5bd5; background: rgba(0, 102, 255, 0.04); }
.ch-new i { margin-right: 6px; font-size: 0.78rem; }

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

.ch-item {
  display: flex;
  align-items: stretch;
  gap: 2px;
  border-radius: 12px;
}
.ch-item:hover { background: #f6f7fb; }
/* The conversation currently on screen, so reopening the panel mid-chat
   shows you where you are rather than an undifferentiated list. */
.ch-item.is-current { background: rgba(0, 102, 255, 0.07); }
.ch-item.is-current .ch-item-title { color: #2f3bb3; }

.ch-item-open {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 3px;
  padding: 11px 10px;
  border: none;
  background: transparent;
  font: inherit;
  text-align: left;
  cursor: pointer;
}
.ch-item-title {
  font-size: 0.89rem;
  font-weight: 600;
  color: #16224d;
  line-height: 1.35;
  /* Two lines then ellipsis: enough to tell two similar questions apart. */
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}
.ch-item-when { font-size: 0.74rem; color: rgba(17, 24, 39, 0.5); }

.ch-item-del {
  flex: none;
  width: 30px;
  border: none;
  background: transparent;
  color: rgba(17, 24, 39, 0.3);
  cursor: pointer;
  border-radius: 10px;
  opacity: 0;
  transition: opacity 0.15s ease, color 0.15s ease;
}
.ch-item:hover .ch-item-del { opacity: 1; }
.ch-item-del:hover { color: #c0392b; background: rgba(192, 57, 43, 0.08); }
/* Touch has no hover, so the control would be unreachable if it stayed hidden. */
@media (hover: none) { .ch-item-del { opacity: 1; } }

.ch-empty {
  padding: 26px 14px;
  text-align: center;
  font-size: 0.86rem;
  line-height: 1.5;
  color: rgba(17, 24, 39, 0.55);
}

@media (max-width: 560px) {
  .ch-drawer { width: 100%; }
  .ch-open { margin-right: 0; }
}

@media (prefers-reduced-motion: reduce) {
  .ch-scrim, .ch-drawer { animation: none; }
}
