/* Website chatbot (includes/footer.php + assets/js/chatbot.js) */
.cb-launch {
  position: fixed; left: 1.5rem; bottom: 1.5rem; z-index: 405;
  display: inline-flex; align-items: center; gap: .55rem;
  height: 52px; padding: 0 1.15rem 0 .9rem; border: 0; border-radius: 50px;
  background: var(--dark, #2E1E0F); color: #fff; font: 600 .9rem/1 inherit; cursor: pointer;
  box-shadow: 0 6px 22px rgba(46,30,15,.28); transition: transform .2s ease, box-shadow .2s ease;
}
.cb-launch:hover { transform: translateY(-2px); box-shadow: 0 10px 28px rgba(46,30,15,.32); }
.cb-launch:focus-visible { outline: 3px solid var(--accent, #B8892E); outline-offset: 3px; }
.cb-launch svg { flex-shrink: 0; }
.cb-launch__dot { width: 8px; height: 8px; border-radius: 50%; background: #3ecf72; box-shadow: 0 0 0 3px rgba(62,207,114,.25); }
.cb-open .cb-launch { opacity: 0; pointer-events: none; transform: scale(.9); }

.cb-panel {
  position: fixed; left: 1.5rem; bottom: 1.5rem; z-index: 410;
  width: 380px; height: min(600px, calc(100vh - 3rem));
  display: flex; flex-direction: column; overflow: hidden;
  background: #fff; border-radius: 18px; box-shadow: 0 18px 60px rgba(46,30,15,.28);
  opacity: 0; transform: translateY(16px) scale(.98); pointer-events: none; visibility: hidden;
  transition: opacity .2s ease, transform .2s ease, visibility 0s .2s;
}
.cb-open .cb-panel { opacity: 1; transform: none; pointer-events: auto; visibility: visible; transition: opacity .2s ease, transform .2s ease; }

.cb-head { display: flex; align-items: center; gap: .7rem; padding: .9rem 1rem; background: var(--dark, #2E1E0F); color: #fff; border-bottom: 3px solid var(--accent, #B8892E); }
.cb-head__mark { width: 36px; height: 36px; border-radius: 50%; background: var(--accent, #B8892E); display: flex; align-items: center; justify-content: center; font-family: var(--font-serif, Georgia, serif); font-size: 1.1rem; flex-shrink: 0; }
.cb-head__t { flex: 1; min-width: 0; }
.cb-head__t b { display: block; font-family: var(--font-serif, Georgia, serif); font-weight: 400; font-size: 1.02rem; }
.cb-head__t small { font-size: .72rem; color: rgba(255,255,255,.7); }
.cb-head button { background: transparent; border: 0; color: rgba(255,255,255,.8); width: 34px; height: 34px; border-radius: 50%; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cb-head button:hover { background: rgba(255,255,255,.1); color: #fff; }
.cb-head button:focus-visible { outline: 2px solid var(--accent, #B8892E); }

.cb-log { flex: 1; overflow-y: auto; padding: 1rem; display: flex; flex-direction: column; gap: .65rem; background: var(--light-bg, #FAFAF7); overscroll-behavior: contain; }
.cb-msg { max-width: 86%; padding: .6rem .85rem; border-radius: 14px; font-size: .9rem; line-height: 1.55; overflow-wrap: anywhere; }
.cb-msg--bot { align-self: flex-start; background: #fff; border: 1px solid var(--border, #E8E0D4); border-bottom-left-radius: 4px; color: var(--text, #3A2E24); }
.cb-msg--user { align-self: flex-end; background: var(--primary, #4A3220); color: #fff; border-bottom-right-radius: 4px; white-space: pre-wrap; }
.cb-msg--err { border-color: #f1c0c0; background: #fff7f7; }
.cb-msg p { margin: 0 0 .5rem; } .cb-msg p:last-child { margin-bottom: 0; }
.cb-msg ul { margin: .3rem 0 .5rem; padding-left: 1.1rem; } .cb-msg li { margin: .15rem 0; }
.cb-msg a { color: var(--primary, #4A3220); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }
.cb-act { align-self: flex-start; display: inline-flex; align-items: center; gap: .45rem; padding: .55rem 1rem; border-radius: 50px; background: #25d366; color: #fff !important; font-size: .85rem; font-weight: 600; text-decoration: none !important; }
.cb-act:hover { background: #1fb457; }
.cb-note { align-self: flex-start; font-size: .75rem; color: #1e7a3a; background: #e7f5ec; border-radius: 50px; padding: .25rem .7rem; }
.cb-typing { align-self: flex-start; display: flex; gap: 4px; padding: .75rem .9rem; background: #fff; border: 1px solid var(--border, #E8E0D4); border-radius: 14px; border-bottom-left-radius: 4px; }
.cb-typing i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted, #8C7B6B); animation: cb-b 1.2s infinite ease-in-out; }
.cb-typing i:nth-child(2) { animation-delay: .15s; } .cb-typing i:nth-child(3) { animation-delay: .3s; }
@keyframes cb-b { 0%, 60%, 100% { opacity: .3; transform: translateY(0); } 30% { opacity: 1; transform: translateY(-3px); } }

.cb-chips { display: flex; flex-wrap: wrap; gap: .4rem; }
.cb-chips button { font-size: .8rem; padding: .4rem .75rem; border-radius: 50px; border: 1.5px solid var(--border, #E8E0D4); background: #fff; color: var(--text, #3A2E24); cursor: pointer; }
.cb-chips button:hover { border-color: var(--primary, #4A3220); }

.cb-form { display: flex; align-items: flex-end; gap: .5rem; padding: .7rem .75rem; border-top: 1px solid var(--border, #E8E0D4); background: #fff; }
.cb-form textarea { flex: 1; resize: none; min-height: 42px; max-height: 120px; padding: .6rem .8rem; border: 1.5px solid var(--border, #E8E0D4); border-radius: 12px; font: inherit; font-size: .9rem; line-height: 1.4; color: var(--text, #3A2E24); }
.cb-form textarea:focus { outline: none; border-color: var(--accent, #B8892E); }
.cb-form button { width: 42px; height: 42px; flex-shrink: 0; border: 0; border-radius: 50%; background: var(--primary, #4A3220); color: #fff; cursor: pointer; display: flex; align-items: center; justify-content: center; }
.cb-form button:disabled { opacity: .45; cursor: default; }
.cb-form button:focus-visible { outline: 3px solid var(--accent, #B8892E); outline-offset: 2px; }
.cb-foot { padding: 0 .9rem .6rem; background: #fff; font-size: .68rem; color: var(--muted, #8C7B6B); text-align: center; }
.cb-foot a { color: var(--muted, #8C7B6B); text-decoration: underline; }
.cb-foot button { background: none; border: 0; padding: 0; font: inherit; color: inherit; text-decoration: underline; cursor: pointer; }

@media (max-width: 767px) {
  .cb-launch { left: .85rem; bottom: calc(var(--bottom-h, 64px) + var(--safe-b, 0px) + .85rem); height: 48px; padding: 0 .95rem 0 .8rem; font-size: .85rem; }
  .cb-panel { left: 0; right: 0; bottom: 0; top: 0; width: auto; height: auto; border-radius: 0; z-index: 1000; }
  .cb-head { padding-top: calc(.9rem + env(safe-area-inset-top, 0px)); }
  .cb-foot { padding-bottom: calc(.6rem + env(safe-area-inset-bottom, 0px)); }
  .cb-form textarea { font-size: 16px; } /* stops iOS zooming in */
}
@media (prefers-reduced-motion: reduce) { .cb-launch, .cb-panel { transition: none; } .cb-typing i { animation: none; } }
@media print { .cb-launch, .cb-panel { display: none !important; } }
