/* Floating chat widget — Bible Q&A and Parish Help assistants */

.cc-chat-launcher {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 100;
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 14px 20px;
  border: none;
  border-radius: 999px;
  background: var(--ink, #0c1b2a);
  color: var(--parchment, #f6f1e6);
  font-family: "Source Sans 3", sans-serif;
  font-size: 15px;
  font-weight: 600;
  letter-spacing: 0.02em;
  cursor: pointer;
  box-shadow: 0 12px 30px var(--shadow, rgba(10, 20, 30, 0.25));
  transition: transform 0.15s ease, box-shadow 0.15s ease;
}
.cc-chat-launcher:hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(10, 20, 30, 0.3);
}
.cc-chat-launcher .cc-cross {
  color: var(--gold, #c9a227);
  font-size: 18px;
  line-height: 1;
}

.cc-chat-panel {
  position: fixed;
  right: 24px;
  bottom: 24px;
  z-index: 101;
  width: min(400px, calc(100vw - 32px));
  height: min(600px, calc(100vh - 48px));
  display: none;
  flex-direction: column;
  background: #fcfaf6;
  border: 1px solid var(--stone, #e6dfd0);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 24px 60px rgba(10, 20, 30, 0.3);
  font-family: "Source Sans 3", sans-serif;
}
.cc-chat-panel.open {
  display: flex;
}

/* Expanded floating widget */
.cc-chat-panel.expanded {
  width: min(760px, calc(100vw - 32px));
  height: min(85vh, calc(100vh - 48px));
}

/* Inline (full-page) mode — panel fills its host container */
.cc-chat-inline,
.cc-chat-inline.open {
  position: relative;
  right: auto;
  bottom: auto;
  width: 100%;
  height: 100%;
  box-shadow: 0 14px 40px rgba(10, 20, 30, 0.18);
}
.cc-chat-inline .cc-chat-tabs,
.cc-chat-inline .cc-chat-close,
.cc-chat-inline .cc-chat-expand {
  display: none;
}

/* Translucent jump-to-latest arrow */
.cc-scroll-down {
  position: absolute;
  left: 50%;
  bottom: 110px;
  transform: translateX(-50%);
  width: 36px;
  height: 36px;
  display: none;
  align-items: center;
  justify-content: center;
  border: none;
  border-radius: 50%;
  background: rgba(12, 27, 42, 0.45);
  color: #fff;
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(10, 20, 30, 0.25);
  transition: background 0.15s ease;
}
.cc-scroll-down.visible {
  display: flex;
}
.cc-scroll-down:hover {
  background: rgba(12, 27, 42, 0.7);
}

.cc-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px 10px;
  background: var(--ink, #0c1b2a);
  color: var(--parchment, #f6f1e6);
}
.cc-chat-header h3 {
  margin: 0;
  font-family: "Cinzel", serif;
  font-size: 15px;
  font-weight: 500;
  letter-spacing: 0.04em;
}
.cc-chat-header-actions {
  display: flex;
  align-items: center;
  gap: 10px;
}
.cc-chat-new {
  border: 1px solid rgba(246, 241, 230, 0.4);
  border-radius: 999px;
  background: none;
  color: var(--parchment, #f6f1e6);
  font-family: "Source Sans 3", sans-serif;
  font-size: 12px;
  font-weight: 600;
  padding: 4px 10px;
  cursor: pointer;
  opacity: 0.85;
}
.cc-chat-new:hover { opacity: 1; background: rgba(246, 241, 230, 0.12); }
.cc-chat-close {
  border: none;
  background: none;
  color: var(--parchment, #f6f1e6);
  font-size: 20px;
  line-height: 1;
  cursor: pointer;
  opacity: 0.8;
}
.cc-chat-close:hover { opacity: 1; }

.cc-chat-tabs {
  display: flex;
  background: var(--ink, #0c1b2a);
  padding: 0 12px;
  gap: 6px;
}
.cc-chat-tab {
  flex: 1;
  border: none;
  border-radius: 8px 8px 0 0;
  padding: 9px 10px;
  background: rgba(246, 241, 230, 0.12);
  color: var(--parchment, #f6f1e6);
  font-family: "Source Sans 3", sans-serif;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
}
.cc-chat-tab.active {
  background: #fcfaf6;
  color: var(--ink, #0c1b2a);
}

.cc-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cc-msg {
  max-width: 88%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.5;
  white-space: pre-wrap;
  overflow-wrap: break-word;
}
.cc-msg.user {
  align-self: flex-end;
  background: var(--accent, #2a5c7c);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.cc-msg.assistant {
  align-self: flex-start;
  background: var(--stone, #e6dfd0);
  color: var(--ink, #0c1b2a);
  border-bottom-left-radius: 4px;
  white-space: normal; /* markdown markup supplies the structure */
}

/* Rendered markdown inside assistant bubbles */
.cc-msg.assistant p { margin: 0 0 8px; }
.cc-msg.assistant p:last-child { margin-bottom: 0; }
.cc-msg.assistant ul,
.cc-msg.assistant ol { margin: 0 0 8px; padding-left: 20px; }
.cc-msg.assistant li { margin: 2px 0; }
.cc-msg.assistant .cc-md-h {
  font-weight: 700;
  margin: 10px 0 6px;
}
.cc-msg.assistant .cc-md-h:first-child { margin-top: 0; }
.cc-msg.assistant code {
  background: rgba(12, 27, 42, 0.08);
  border-radius: 4px;
  padding: 1px 5px;
  font-family: ui-monospace, "SF Mono", Menlo, Consolas, monospace;
  font-size: 12.5px;
}
.cc-msg.assistant pre {
  background: rgba(12, 27, 42, 0.08);
  border-radius: 8px;
  padding: 10px;
  margin: 0 0 8px;
  overflow-x: auto;
}
.cc-msg.assistant pre code {
  background: none;
  padding: 0;
}
.cc-msg.assistant a {
  color: var(--accent, #2a5c7c);
  text-decoration: underline;
}
.cc-msg.assistant hr {
  border: none;
  border-top: 1px solid rgba(12, 27, 42, 0.15);
  margin: 8px 0;
}
.cc-msg.assistant table {
  border-collapse: collapse;
  margin: 0 0 8px;
  width: 100%;
  font-size: 13px;
}
.cc-msg.assistant th,
.cc-msg.assistant td {
  border: 1px solid rgba(12, 27, 42, 0.18);
  padding: 5px 8px;
  text-align: left;
  vertical-align: top;
}
.cc-msg.assistant th {
  background: rgba(12, 27, 42, 0.07);
  font-weight: 700;
}
.cc-msg.assistant.thinking::after {
  content: "…";
  animation: cc-blink 1s infinite;
}
.cc-msg.error {
  align-self: center;
  background: #fbe9e7;
  color: var(--crimson, #7f1d1d);
  font-size: 13px;
}
@keyframes cc-blink {
  50% { opacity: 0.3; }
}

.cc-chat-intro {
  font-size: 13px;
  color: var(--ink-soft, #1b2f45);
  background: rgba(201, 162, 39, 0.12);
  border: 1px solid rgba(201, 162, 39, 0.35);
  border-radius: 10px;
  padding: 10px 12px;
}

.cc-chat-form {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--stone, #e6dfd0);
  background: #fff;
}
.cc-chat-input {
  flex: 1;
  resize: none;
  border: 1px solid var(--stone, #e6dfd0);
  border-radius: 10px;
  padding: 10px 12px;
  font-family: inherit;
  font-size: 14px;
  line-height: 1.4;
  max-height: 110px;
}
/* Keep long example placeholders on one line — a wrapped second line gets
   clipped by the single-row textarea. */
.cc-chat-input::placeholder {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.cc-chat-input:focus {
  outline: 2px solid var(--accent, #2a5c7c);
  outline-offset: -1px;
}
.cc-chat-send {
  border: none;
  border-radius: 10px;
  padding: 0 16px;
  background: var(--ink, #0c1b2a);
  color: var(--parchment, #f6f1e6);
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.cc-chat-send:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.cc-chat-disclaimer {
  padding: 6px 12px 10px;
  background: #fff;
  font-size: 11px;
  color: var(--sage, #8b9a8f);
  text-align: center;
}

/* ---------- Dedicated assistant pages (/bible, /parish) ---------- */

.cc-page-main {
  max-width: 880px;
  margin: 0 auto;
  padding: 36px 24px 56px;
}
.cc-page-intro {
  text-align: center;
  margin-bottom: 24px;
}
.cc-page-intro h1 {
  font-family: "Cinzel", serif;
  font-size: clamp(26px, 4vw, 38px);
  font-weight: 700;
  color: var(--ink, #0c1b2a);
  margin: 14px 0 10px;
}
.cc-page-intro p {
  max-width: 640px;
  margin: 0 auto;
  color: var(--ink-soft, #1b2f45);
  font-size: 16px;
  line-height: 1.6;
}
.cc-page-chat {
  height: min(68vh, 680px);
  min-height: 440px;
}
.cc-page-switch {
  text-align: center;
  margin-top: 18px;
  font-size: 14px;
  color: var(--ink-soft, #1b2f45);
}
.cc-page-switch a {
  color: var(--accent, #2a5c7c);
  text-decoration: underline;
}
