/* ============================================================
   widgets.css — banner de cookies e assistente D3
   Classes preservadas: js/cookies.js e js/chatbot.js dependem delas.
   ============================================================ */

/* ── COOKIES ────────────────────────────────────────────── */
#cookie-consent-banner {
  position: fixed;
  z-index: 90;
  right: 0;
  bottom: 0;
  left: 0;
  display: none;
  align-items: center;
  justify-content: space-between;
  gap: 18px 32px;
  padding: 18px var(--gutter);
  border-top: 1px solid rgba(255, 255, 255, .14);
  background: var(--ink);
  color: #E7ECF4;
  animation: cookie-in .35s cubic-bezier(.22, 1, .36, 1);
}
@keyframes cookie-in { from { transform: translateY(100%); } to { transform: none; } }
.cookie-content { flex: 1; }
.cookie-content p { margin: 0; max-width: 78ch; color: #AEB9C9; font-size: 13px; line-height: 1.6; }
.cookie-content a { color: #fff; border-bottom: 1px solid rgba(255, 255, 255, .35); }
.cookie-content a:hover { border-color: #fff; }
.cookie-buttons { display: flex; gap: 10px; flex: none; }
.cookie-btn {
  min-height: 40px;
  padding: 10px 18px;
  border: 1px solid rgba(255, 255, 255, .2);
  border-radius: var(--r);
  background: transparent;
  color: #E7ECF4;
  font-size: 11.5px;
  font-weight: 800;
  white-space: nowrap;
  transition: background .25s ease, color .25s ease, border-color .25s ease;
}
#cookie-reject-btn:hover { background: rgba(255, 255, 255, .1); }
#cookie-accept-btn { background: #fff; border-color: #fff; color: #0A101C; }
#cookie-accept-btn:hover { background: #DCE6F7; }

@media (max-width: 720px) {
  #cookie-consent-banner { flex-direction: column; align-items: stretch; gap: 14px; }
  .cookie-buttons .cookie-btn { flex: 1; }
}

/* ── ASSISTENTE ─────────────────────────────────────────── */
#cb-toggle {
  position: fixed;
  z-index: 60;
  right: 22px;
  bottom: 22px;
  display: grid;
  width: 54px;
  height: 54px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  box-shadow: 0 12px 30px color-mix(in srgb, var(--blue) 38%, transparent);
  place-items: center;
  transition: transform .3s var(--ease), box-shadow .3s ease;
}
#cb-toggle .icon { width: 21px; height: 21px; }
#cb-toggle:hover { transform: scale(1.07); }
#cb-toggle:active { transform: scale(.95); }
.cb-toggle__dot {
  position: absolute;
  top: 3px;
  right: 3px;
  width: 12px;
  height: 12px;
  border: 2.5px solid var(--bg);
  border-radius: 50%;
  background: #22C55E;
  pointer-events: none;
}

#cb-window {
  position: fixed;
  z-index: 61;
  right: 22px;
  bottom: 88px;
  display: flex;
  width: 374px;
  height: min(584px, calc(100dvh - 130px));
  overflow: hidden;
  border: 1px solid var(--line);
  border-radius: var(--r-lg);
  background: var(--bg);
  box-shadow: var(--shadow-3);
  flex-direction: column;
  opacity: 0;
  transform: scale(.94) translateY(14px);
  transform-origin: bottom right;
  pointer-events: none;
  transition: opacity .28s ease, transform .28s var(--ease);
}
#cb-window.cb-open { opacity: 1; transform: none; pointer-events: auto; }

#cb-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  border-bottom: 1px solid var(--line);
  background: var(--ink);
  color: #F3F6FB;
  flex-shrink: 0;
}
.cb-hdr__left { display: flex; align-items: center; gap: 11px; }
.cb-hdr__avatar {
  display: grid;
  width: 36px;
  height: 36px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--r);
  place-items: center;
  flex: none;
}
.cb-hdr__avatar .icon { width: 17px; height: 17px; }
.cb-hdr__info strong { display: block; font-size: 13.5px; font-weight: 700; letter-spacing: -.02em; }
.cb-hdr__info span {
  display: flex;
  align-items: center;
  gap: 6px;
  color: #9DAABC;
  font-family: var(--font-mono);
  font-size: 8.5px;
  letter-spacing: 1px;
  text-transform: uppercase;
}
.cb-hdr__dot { width: 6px; height: 6px; border-radius: 50%; background: #4ADE80; }
#cb-close {
  display: grid;
  width: 30px;
  height: 30px;
  border: 1px solid rgba(255, 255, 255, .18);
  border-radius: var(--r);
  color: #C8D2E0;
  place-items: center;
  transition: background .22s ease, color .22s ease;
}
#cb-close .icon { width: 15px; height: 15px; }
#cb-close:hover { background: rgba(255, 255, 255, .12); color: #fff; }

#cb-body {
  display: flex;
  overflow-y: auto;
  gap: 7px;
  padding: 16px;
  background: var(--bg-soft);
  flex: 1;
  flex-direction: column;
}
#cb-body::-webkit-scrollbar { width: 4px; }
#cb-body::-webkit-scrollbar-thumb { background: var(--line); border-radius: 3px; }

#cb-footer {
  display: flex;
  align-items: center;
  gap: 9px;
  padding: 12px 14px;
  border-top: 1px solid var(--line);
  background: var(--bg);
  flex-shrink: 0;
}
#cb-input {
  flex: 1;
  padding: 11px 14px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg-soft);
  font-size: 14px;
  outline: 0;
  transition: border-color .2s ease, box-shadow .2s ease;
}
#cb-input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent); }
#cb-send {
  display: grid;
  width: 38px;
  height: 38px;
  border-radius: var(--r);
  background: var(--blue);
  color: #fff;
  place-items: center;
  flex: none;
  transition: background .22s ease;
}
#cb-send .icon { width: 16px; height: 16px; }
#cb-send:hover { background: var(--blue-bright); }

.cb-msg { display: flex; max-width: 86%; flex-direction: column; animation: cb-in .26s ease-out; }
@keyframes cb-in { from { opacity: 0; transform: translateY(6px); } to { opacity: 1; transform: none; } }
.cb-msg--bot { align-self: flex-start; }
.cb-msg--user { align-self: flex-end; }
.cb-msg__bubble {
  padding: 10px 13px;
  border-radius: var(--r-md);
  font-size: 13.8px;
  line-height: 1.55;
  word-break: break-word;
}
.cb-msg--bot .cb-msg__bubble {
  border: 1px solid var(--line);
  border-bottom-left-radius: 3px;
  background: var(--bg);
  color: var(--tx-2);
}
.cb-msg--bot .cb-msg__bubble strong { color: var(--tx); font-weight: 700; }
.cb-msg--user .cb-msg__bubble { border-bottom-right-radius: 3px; background: var(--btn); color: #fff; }

.cb-typing .cb-msg__bubble { padding: 12px 14px; }
.cb-dots { display: flex; align-items: center; gap: 4px; }
.cb-dots span { width: 6px; height: 6px; border-radius: 50%; background: var(--tx-3); animation: cb-dot .9s ease-in-out infinite; }
.cb-dots span:nth-child(2) { animation-delay: .16s; }
.cb-dots span:nth-child(3) { animation-delay: .32s; }
@keyframes cb-dot { 0%, 80%, 100% { opacity: .4; transform: scale(.8); } 40% { opacity: 1; transform: scale(1.1); } }

.cb-chips { display: flex; flex-wrap: wrap; gap: 7px; margin-top: 5px; animation: cb-in .26s .08s ease-out both; }
.cb-chip {
  padding: 7px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--blue);
  font-size: 12px;
  font-weight: 700;
  white-space: nowrap;
  transition: background .2s ease, border-color .2s ease, color .2s ease;
}
.cb-chip:hover { background: var(--btn); border-color: var(--btn); color: #fff; }
.cb-chip:disabled { opacity: .45; pointer-events: none; }

.cb-btns { display: flex; width: 100%; flex-direction: column; gap: 6px; margin-top: 5px; animation: cb-in .26s .08s ease-out both; }
.cb-btn {
  display: flex;
  align-items: center;
  width: 100%;
  padding: 11px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--tx);
  font-size: 13.5px;
  font-weight: 600;
  text-align: left;
  transition: border-color .22s ease, background .22s ease, transform .22s var(--ease);
}
.cb-btn:hover { border-color: var(--blue); background: var(--blue-soft); transform: translateX(3px); }
.cb-btn:disabled { opacity: .42; pointer-events: none; }

.cb-features-grid { display: flex; width: 100%; flex-direction: column; gap: 5px; margin-top: 5px; }
.cb-feature-btn {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 9px;
  width: 100%;
  padding: 10px 12px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  color: var(--tx-2);
  font-size: 13px;
  transition: border-color .2s ease, background .2s ease;
}
.cb-feature-btn:hover { border-color: var(--tx-3); }
.cb-feature-btn.selected { border-color: var(--blue); background: var(--blue-soft); }
.cb-feature-btn .feat-name { flex: 1; text-align: left; font-weight: 600; }
.cb-feature-btn .feat-price { color: var(--blue); font-family: var(--font-mono); font-size: 11px; white-space: nowrap; }
.cb-feature-btn .feat-check {
  display: none;
  width: 17px;
  height: 17px;
  border-radius: 50%;
  background: var(--blue);
  color: #fff;
  font-size: 9px;
  font-weight: 800;
  align-items: center;
  justify-content: center;
  flex: none;
}
.cb-feature-btn.selected .feat-check { display: flex; }

.cb-form { display: flex; width: 100%; flex-direction: column; gap: 8px; margin-top: 5px; animation: cb-in .26s ease-out both; }
.cb-form input {
  padding: 10px 13px;
  border: 1px solid var(--line);
  border-radius: var(--r);
  background: var(--bg);
  font-size: 14px;
  outline: 0;
  transition: border-color .2s ease, box-shadow .2s ease;
}
.cb-form input:focus { border-color: var(--blue); box-shadow: 0 0 0 3px color-mix(in srgb, var(--blue) 12%, transparent); }
.cb-form-error {
  display: none;
  padding: 8px 11px;
  border: 1px solid rgba(220, 38, 38, .3);
  border-radius: var(--r);
  color: #DC2626;
  font-size: 12.5px;
}
.cb-form-error.show { display: block; }
.cb-form-submit {
  padding: 12px;
  border-radius: var(--r);
  background: var(--btn);
  color: #fff;
  font-size: 12.5px;
  font-weight: 800;
  transition: background .22s ease;
}
.cb-form-submit:hover { background: var(--btn-hover); }

@media (max-width: 860px) {
  /* Não colidir com o CTA fixo do rodapé no celular. */
  #cb-toggle { right: 16px; bottom: 76px; width: 48px; height: 48px; }
  #cb-toggle .icon { width: 19px; height: 19px; }
}
@media (max-width: 560px) {
  #cb-window {
    right: 0;
    bottom: 0;
    left: 0;
    width: 100%;
    height: 92dvh;
    max-height: 640px;
    border-radius: var(--r-lg) var(--r-lg) 0 0;
    transform-origin: bottom center;
  }
}
