/* ==========================================================================
   QuantaBiz shared widgets — cookie consent, scroll-to-top, scripted assistant
   Mobile-first: base styles target small screens, min-width queries enhance.
   ========================================================================== */

/* Prevent any horizontal scrollbar site-wide. */
html, body { overflow-x: hidden; max-width: 100%; }

/* --------------------------------------------------------------------------
   Cookie consent
   -------------------------------------------------------------------------- */
.qb-cookie {
  position: fixed; z-index: 9990; left: 1rem; right: 1rem; bottom: 1rem;
  max-width: 820px; margin: 0 auto; background: #fff; border: 1px solid #e4ebe4;
  box-shadow: 0 24px 70px -30px rgba(10,28,14,0.35); padding: 1.2rem 1.2rem;
  display: none; gap: .9rem; align-items: center; justify-content: space-between;
  flex-direction: column; border-top: 3px solid #239023;
}
@media (min-width: 768px) {
  .qb-cookie { padding: 1rem 1.2rem; flex-direction: row; gap: 1.2rem; left: 1.5rem; right: 1.5rem; }
}
.qb-cookie.visible { display: flex; animation: qbCookieIn .35s ease; }
@keyframes qbCookieIn { from { opacity: 0; transform: translateY(14px); } to { opacity: 1; transform: translateY(0); } }
.qb-cookie-icon { width: 42px; height: 42px; background: #eaf6ea; color: #239023; border-radius: 10px; display: inline-flex; align-items: center; justify-content: center; font-size: 1.2rem; flex: 0 0 auto; }
.qb-cookie-text { flex: 1 1 auto; }
.qb-cookie-text h6 { font-family: 'Barlow Condensed', sans-serif; font-size: 1.05rem; font-weight: 700; color: #0a0f0a; margin: 0 0 .15rem; text-transform: uppercase; }
.qb-cookie-text p { font-family: 'Barlow', sans-serif; font-size: .92rem; color: #3b463b; margin: 0; line-height: 1.55; }
.qb-cookie-text a { color: #239023; text-decoration: underline; }
.qb-cookie-actions { display: flex; flex-wrap: wrap; gap: .5rem; width: 100%; justify-content: flex-end; }
@media (min-width: 768px) { .qb-cookie-actions { width: auto; } }
.qb-cookie-actions button { font-family: 'Barlow Condensed', sans-serif; font-size: .8rem; font-weight: 700; letter-spacing: 0.16em; text-transform: uppercase; padding: .55rem 1.15rem; border-radius: 4px; cursor: pointer; transition: background .22s, color .22s, transform .22s; border: 1px solid transparent; }
.qb-cookie-actions .qb-cookie-reject { background: #fff; color: #239023; border-color: #239023; }
.qb-cookie-actions .qb-cookie-accept { background: #239023; color: #fff; border-color: #239023; }
.qb-cookie-actions .qb-cookie-reject:hover { background: #eaf6ea; }
.qb-cookie-actions .qb-cookie-accept:hover { background: #32cd32; border-color: #32cd32; transform: translateY(-2px); }

/* --------------------------------------------------------------------------
   Floating stack — scroll-to-top chevron + assistant launcher
   -------------------------------------------------------------------------- */
.qb-float-stack {
  position: fixed; z-index: 9980; right: 1rem; bottom: 1rem;
  display: flex; flex-direction: column; align-items: flex-end; gap: .6rem;
  transition: bottom .3s ease;
}
@media (min-width: 768px) { .qb-float-stack { right: 1.5rem; bottom: 1.5rem; gap: .75rem; } }

/* Keep floats clear of the cookie banner on narrow screens */
body.qb-cookie-visible .qb-float-stack { bottom: calc(1rem + var(--qb-cookie-h, 0px) + .6rem); }
@media (min-width: 1200px) { body.qb-cookie-visible .qb-float-stack { bottom: 1.5rem; } }

.qb-top-btn {
  width: 44px; height: 44px; border-radius: 50%; border: 1px solid #e4ebe4;
  background: #fff; color: #239023; display: inline-flex; align-items: center; justify-content: center;
  font-size: 1rem; cursor: pointer; padding: 0;
  box-shadow: 0 14px 34px -14px rgba(10,28,14,0.4);
  opacity: 0; visibility: hidden; transform: translateY(10px) scale(.92);
  transition: opacity .28s ease, transform .28s ease, visibility .28s, background .22s, color .22s;
}
.qb-top-btn.visible { opacity: 1; visibility: visible; transform: translateY(0) scale(1); }
.qb-top-btn:hover { background: #239023; color: #fff; border-color: #239023; }
.qb-top-btn svg { width: 18px; height: 18px; display: block; }

.qb-bot-btn {
  position: relative; width: 56px; height: 56px; border-radius: 50%; border: 0;
  background: #239023; color: #fff; display: inline-flex; align-items: center; justify-content: center;
  cursor: pointer; padding: 0; box-shadow: 0 18px 40px -16px rgba(35,144,35,0.65);
  transition: background .22s, transform .22s;
}
.qb-bot-btn:hover { background: #32cd32; transform: translateY(-2px); }
.qb-bot-btn svg { width: 27px; height: 27px; display: block; }
.qb-bot-btn::after {
  content: ""; position: absolute; inset: 0; border-radius: 50%;
  border: 2px solid #32cd32; opacity: .8; animation: qbBotPulse 2.4s ease-out infinite;
  pointer-events: none;
}
@keyframes qbBotPulse {
  0% { transform: scale(1); opacity: .8; }
  70% { transform: scale(1.45); opacity: 0; }
  100% { transform: scale(1.45); opacity: 0; }
}
.qb-bot-dot {
  position: absolute; top: 3px; right: 3px; width: 12px; height: 12px; border-radius: 50%;
  background: #32cd32; border: 2px solid #fff;
}

/* --------------------------------------------------------------------------
   Assistant panel — mobile bottom sheet, right-anchored card on >=768px
   -------------------------------------------------------------------------- */
.qb-bot-panel {
  position: fixed; z-index: 9995;
  left: 0; right: 0; bottom: 0; max-height: 82vh;
  background: #fff; border: 1px solid #e4ebe4; border-bottom: 0;
  border-radius: 16px 16px 0 0;
  box-shadow: 0 -24px 70px -30px rgba(10,28,14,0.45);
  display: none; flex-direction: column; overflow: hidden;
}
.qb-bot-panel.visible { display: flex; animation: qbBotSheetIn .32s ease; }
@keyframes qbBotSheetIn { from { opacity: 0; transform: translateY(22px); } to { opacity: 1; transform: translateY(0); } }
@media (min-width: 768px) {
  .qb-bot-panel {
    left: auto; right: 1.5rem; bottom: 5.75rem; width: 372px; max-height: 560px;
    border: 1px solid #e4ebe4; border-radius: 14px;
    box-shadow: 0 30px 80px -30px rgba(10,28,14,0.5);
  }
  .qb-bot-panel.visible { animation: qbBotCardIn .28s ease; }
  @keyframes qbBotCardIn { from { opacity: 0; transform: translateY(14px) scale(.98); } to { opacity: 1; transform: translateY(0) scale(1); } }
}

.qb-bot-head {
  display: flex; align-items: center; gap: .7rem; padding: .85rem 1rem;
  background: #0a1f3a; color: #fff; flex: 0 0 auto;
}
.qb-bot-avatar {
  width: 38px; height: 38px; border-radius: 50%; background: #239023; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; flex: 0 0 auto;
}
.qb-bot-avatar svg { width: 20px; height: 20px; display: block; }
.qb-bot-head-text { flex: 1 1 auto; min-width: 0; }
.qb-bot-head-text strong { display: block; font-family: 'Barlow Condensed', sans-serif; font-size: 1.02rem; font-weight: 700; letter-spacing: .04em; text-transform: uppercase; line-height: 1.2; }
.qb-bot-status { display: inline-flex; align-items: center; gap: .35rem; font-family: 'Barlow', sans-serif; font-size: .76rem; color: rgba(255,255,255,0.72); }
.qb-bot-status i { width: 7px; height: 7px; border-radius: 50%; background: #32cd32; display: inline-block; }
.qb-bot-close {
  background: transparent; border: 1px solid rgba(255,255,255,0.28); color: #fff;
  width: 32px; height: 32px; border-radius: 8px; cursor: pointer; flex: 0 0 auto;
  display: inline-flex; align-items: center; justify-content: center; padding: 0;
  transition: background .22s, border-color .22s;
}
.qb-bot-close:hover { background: rgba(255,255,255,0.12); border-color: rgba(255,255,255,0.5); }
.qb-bot-close svg { width: 14px; height: 14px; display: block; }

.qb-bot-body {
  flex: 1 1 auto; overflow-y: auto; padding: 1rem; background: #f4faf4;
  display: flex; flex-direction: column; gap: .7rem; -webkit-overflow-scrolling: touch;
}
.qb-msg { max-width: 88%; padding: .65rem .85rem; border-radius: 12px; font-family: 'Barlow', sans-serif; font-size: .92rem; line-height: 1.55; }
.qb-msg p { margin: 0 0 .5rem; }
.qb-msg p:last-child { margin-bottom: 0; }
.qb-msg ul { margin: .4rem 0 0; padding-left: 1.1rem; }
.qb-msg li { margin-bottom: .25rem; }
.qb-msg a { color: #239023; text-decoration: underline; }
.qb-msg-bot { align-self: flex-start; background: #fff; border: 1px solid #e4ebe4; color: #0a2a14; border-bottom-left-radius: 4px; }
.qb-msg-user { align-self: flex-end; background: #239023; color: #fff; border-bottom-right-radius: 4px; }
.qb-msg-user a { color: #fff; }

.qb-bot-typing { align-self: flex-start; background: #fff; border: 1px solid #e4ebe4; border-radius: 12px; border-bottom-left-radius: 4px; padding: .7rem .9rem; display: inline-flex; gap: .3rem; }
.qb-bot-typing span { width: 7px; height: 7px; border-radius: 50%; background: #239023; opacity: .4; animation: qbTyping 1.1s infinite ease-in-out; }
.qb-bot-typing span:nth-child(2) { animation-delay: .16s; }
.qb-bot-typing span:nth-child(3) { animation-delay: .32s; }
@keyframes qbTyping { 0%, 80%, 100% { transform: translateY(0); opacity: .4; } 40% { transform: translateY(-4px); opacity: 1; } }

.qb-bot-chips { display: flex; flex-wrap: wrap; gap: .4rem; padding: 0 1rem .7rem; background: #f4faf4; flex: 0 0 auto; }
.qb-chip {
  font-family: 'Barlow Condensed', sans-serif; font-size: .78rem; font-weight: 700; letter-spacing: .08em;
  text-transform: uppercase; color: #239023; background: #fff; border: 1px solid #239023;
  border-radius: 999px; padding: .38rem .8rem; cursor: pointer;
  transition: background .2s, color .2s, transform .2s;
}
.qb-chip:hover { background: #239023; color: #fff; transform: translateY(-1px); }

.qb-bot-foot { flex: 0 0 auto; border-top: 1px solid #e4ebe4; background: #fff; padding: .7rem .8rem calc(.7rem + env(safe-area-inset-bottom, 0px)); }
.qb-bot-form { display: flex; gap: .5rem; align-items: center; }
.qb-bot-input {
  flex: 1 1 auto; min-width: 0; font-family: 'Barlow', sans-serif; font-size: .95rem; color: #0a2a14;
  border: 1px solid #dfe7df; border-radius: 999px; padding: .6rem .95rem; background: #fff;
}
.qb-bot-input:focus { outline: none; border-color: #239023; box-shadow: 0 0 0 3px rgba(35,144,35,0.14); }
.qb-bot-send {
  width: 42px; height: 42px; border-radius: 50%; border: 0; background: #239023; color: #fff;
  display: inline-flex; align-items: center; justify-content: center; cursor: pointer; flex: 0 0 auto;
  transition: background .22s, transform .22s;
}
.qb-bot-send:hover { background: #32cd32; transform: translateY(-1px); }
.qb-bot-send svg { width: 17px; height: 17px; display: block; }
.qb-bot-note { font-family: 'Barlow', sans-serif; font-size: .72rem; color: #7b857b; text-align: center; margin: .5rem 0 0; }

body.qb-bot-open { overflow: hidden; }
@media (min-width: 768px) { body.qb-bot-open { overflow: auto; } }

@media (prefers-reduced-motion: reduce) {
  .qb-cookie.visible, .qb-bot-panel.visible { animation: none; }
  .qb-bot-btn::after { animation: none; opacity: 0; }
  .qb-bot-typing span { animation: none; opacity: .7; }
  .qb-top-btn, .qb-bot-btn, .qb-chip { transition: none; }
}
