/* IARP Chatbot — colours follow the site theme (#221d09). Adjust the variables to match styles.css. */
:root {
  --cb-primary: #221d09;
  --cb-primary-2: #3d3412;
  --cb-accent: #c8962e;
  --cb-bg: #f7f6f2;
  --cb-bot: #ffffff;
  --cb-user: #221d09;
  --cb-text: #1d1d1b;
  --cb-muted: #6b6a63;
  --cb-border: #e4e1d6;
  --cb-radius: 16px;
  --cb-bottom: 88px;   /* keeps the launcher above the site's back-to-top button */
  --cb-right: 20px;
}

.cb-launcher {
  position: fixed; right: var(--cb-right); bottom: var(--cb-bottom); z-index: 1060;
  width: 58px; height: 58px; border-radius: 50%; border: 0; cursor: pointer;
  background: var(--cb-primary); color: #fff; box-shadow: 0 8px 24px rgba(34, 29, 9, .35);
  display: flex; align-items: center; justify-content: center; transition: transform .2s ease, background .2s ease;
}
.cb-launcher:hover { transform: translateY(-2px); background: var(--cb-primary-2); }
.cb-launcher:focus-visible { outline: 3px solid var(--cb-accent); outline-offset: 3px; }
.cb-launcher { background: #fff; color: var(--cb-primary); border: 3px solid var(--cb-primary); width: 64px; height: 64px; }
.cb-launcher:hover { background: #fff; }
.cb-launcher.is-open { background: var(--cb-primary); color: #fff; }
.cb-launcher-logo { width: 46px; height: 46px; object-fit: contain; border-radius: 50%; }
.cb-launcher-badge {
  position: absolute; right: -4px; bottom: -2px; width: 24px; height: 24px; border-radius: 50%;
  background: var(--cb-accent); color: #fff; display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
}
.cb-launcher.is-open .cb-launcher-badge { display: none; }
.cb-launcher .cb-ico-close { display: none; }
.cb-launcher.is-open .cb-ico-chat { display: none; }
.cb-launcher.is-open .cb-ico-close { display: block; }
.cb-launcher-tip {
  position: absolute; right: 74px; white-space: nowrap; background: #fff; color: var(--cb-primary);
  font: 600 13px/1 'Inter', sans-serif; padding: 9px 12px; border-radius: 20px; box-shadow: 0 4px 14px rgba(0,0,0,.12);
  pointer-events: none;
}
.cb-launcher.is-open .cb-launcher-tip { display: none; }

.cb-panel {
  position: fixed; right: var(--cb-right); bottom: calc(var(--cb-bottom) + 70px); z-index: 1060;
  width: 380px; max-width: calc(100vw - 32px); height: 580px; max-height: calc(100vh - var(--cb-bottom) - 90px);
  display: flex; flex-direction: column; background: var(--cb-bg); border-radius: var(--cb-radius);
  box-shadow: 0 20px 50px rgba(0, 0, 0, .25); overflow: hidden;
  font-family: 'Inter', system-ui, sans-serif; color: var(--cb-text);
  opacity: 0; visibility: hidden; transform: translateY(14px) scale(.98); transition: all .22s ease;
}
.cb-panel.is-open { opacity: 1; visibility: visible; transform: none; }

.cb-head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 16px; background: var(--cb-primary); color: #fff; }
.cb-logo { width: 42px; height: 42px; object-fit: contain; background: #fff; border-radius: 50%; padding: 3px; flex: none; }
.cb-head-text { flex: 1; min-width: 0; line-height: 1.2; }
.cb-head-text strong { display: block; font-family: 'Plus Jakarta Sans', 'Inter', sans-serif; font-size: 15px; }
.cb-head-text small { font-size: 11.5px; opacity: .8; }
.cb-icon-btn { background: transparent; border: 0; color: #fff; width: 32px; height: 32px; border-radius: 8px; cursor: pointer; opacity: .85; }
.cb-icon-btn:hover { background: rgba(255,255,255,.12); opacity: 1; }

.cb-body { flex: 1; overflow-y: auto; padding: 16px 14px; display: flex; flex-direction: column; gap: 10px; scroll-behavior: smooth; }
.cb-msg { max-width: 88%; padding: 10px 13px; border-radius: 14px; font-size: 14px; line-height: 1.5; word-wrap: break-word; }
.cb-msg.bot { align-self: flex-start; background: var(--cb-bot); border: 1px solid var(--cb-border); border-bottom-left-radius: 4px; }
.cb-msg.user { align-self: flex-end; background: var(--cb-user); color: #fff; border-bottom-right-radius: 4px; }
.cb-msg.err { border-color: #f0c2c2; background: #fff5f5; color: #9b1c1c; }
.cb-msg .cb-title { display: block; font-weight: 700; font-size: 12.5px; color: var(--cb-accent); text-transform: uppercase; letter-spacing: .03em; margin-bottom: 4px; }
.cb-msg ul, .cb-msg ol { margin: 6px 0 6px 18px; padding: 0; }
.cb-msg li { margin-bottom: 4px; }
.cb-msg a { color: #8a5d00; text-decoration: underline; }
.cb-msg p { margin: 0 0 6px; }
.cb-muted { color: var(--cb-muted); font-size: 12.5px; }
.cb-list { list-style: disc; }

.cb-linkbtn {
  display: inline-flex; align-items: center; gap: 6px; margin-top: 8px; padding: 7px 12px; border-radius: 20px;
  background: var(--cb-primary); color: #fff !important; font-size: 13px; font-weight: 600; text-decoration: none !important;
}
.cb-linkbtn:hover { background: var(--cb-primary-2); }

.cb-chips { display: flex; flex-wrap: wrap; gap: 6px; align-self: flex-start; max-width: 100%; }
.cb-chips-label { width: 100%; font-size: 12px; color: var(--cb-muted); margin-top: 2px; }
.cb-chip {
  border: 1px solid var(--cb-primary); background: #fff; color: var(--cb-primary); border-radius: 18px;
  padding: 6px 11px; font-size: 12.5px; cursor: pointer; text-align: left; line-height: 1.3; transition: all .15s;
}
.cb-chip:hover, .cb-chip:focus-visible { background: var(--cb-primary); color: #fff; outline: none; }

.cb-card { background: var(--cb-bg); border: 1px solid var(--cb-border); border-radius: 10px; padding: 8px 10px; margin: 8px 0; }
.cb-row { display: flex; justify-content: space-between; gap: 10px; padding: 5px 0; border-bottom: 1px dashed var(--cb-border); font-size: 13px; }
.cb-row:last-child { border-bottom: 0; }
.cb-row > span:first-child { color: var(--cb-muted); }
.cb-row b { text-align: right; }
.cb-badge { display: inline-block; padding: 2px 9px; border-radius: 12px; font-size: 12px; font-weight: 600; }
.cb-badge-green { background: #e3f4e6; color: #1e6b2d; }
.cb-badge-amber { background: #fdf1d8; color: #8a5d00; }
.cb-badge-red { background: #fde3e3; color: #9b1c1c; }

.cb-vform { display: flex; flex-direction: column; gap: 7px; margin-top: 8px; }
.cb-vform input {
  width: 100%; border: 1px solid var(--cb-border); border-radius: 8px; padding: 8px 10px; font-size: 13.5px; background: #fff;
}
.cb-vform input:focus { outline: none; border-color: var(--cb-accent); box-shadow: 0 0 0 3px rgba(200,150,46,.2); }
.cb-vform .cb-actions { display: flex; flex-wrap: wrap; gap: 6px; }
.cb-vform button {
  border: 0; border-radius: 8px; padding: 8px 12px; font-size: 13px; font-weight: 600; cursor: pointer;
  background: var(--cb-primary); color: #fff;
}
.cb-vform button.cb-alt { background: #fff; color: var(--cb-primary); border: 1px solid var(--cb-primary); }
.cb-vform button:disabled { opacity: .6; cursor: wait; }
.cb-vform .cb-note { font-size: 11.5px; color: var(--cb-muted); }

.cb-typing { align-self: flex-start; display: flex; gap: 4px; padding: 12px 14px; background: #fff; border: 1px solid var(--cb-border); border-radius: 14px; }
.cb-typing span { width: 7px; height: 7px; border-radius: 50%; background: var(--cb-muted); animation: cbBlink 1.2s infinite; }
.cb-typing span:nth-child(2) { animation-delay: .2s; }
.cb-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes cbBlink { 0%, 80%, 100% { opacity: .25; } 40% { opacity: 1; } }

.cb-input { display: flex; gap: 8px; padding: 10px; background: #fff; border-top: 1px solid var(--cb-border); }
.cb-input input { flex: 1; border: 1px solid var(--cb-border); border-radius: 22px; padding: 10px 15px; font-size: 14px; min-width: 0; }
.cb-input input:focus { outline: none; border-color: var(--cb-accent); }
.cb-send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 50%; background: var(--cb-accent); color: #fff; cursor: pointer; }
.cb-send:hover { filter: brightness(.95); }
.cb-foot { text-align: center; font-size: 11px; color: var(--cb-muted); background: #fff; padding: 0 10px 8px; }
.cb-foot a { color: var(--cb-muted); }

@media (max-width: 575.98px) {
  .cb-panel { right: 0; bottom: 0; width: 100vw; max-width: 100vw; height: 100%; max-height: 100%; border-radius: 0; }
  .cb-launcher { right: 16px; bottom: 76px; }
  .cb-launcher.is-open { display: none; }
  .cb-launcher-tip { display: none; }
}
@media (prefers-reduced-motion: reduce) {
  .cb-panel, .cb-launcher { transition: none; }
  .cb-typing span { animation: none; opacity: .6; }
}

/* bot replies with the IARP logo as avatar */
.cb-botrow { display: flex; align-items: flex-end; gap: 7px; align-self: flex-start; max-width: 94%; }
.cb-botrow .cb-msg.bot { max-width: none; }
.cb-avatar { width: 28px; height: 28px; flex: none; border-radius: 50%; background: #fff; border: 1px solid var(--cb-border); object-fit: contain; padding: 2px; }
