/* =====================================================================
   Assistente virtual (chat) — usa as cores do site (style.css)
   ===================================================================== */
.sr-only { position: absolute; width: 1px; height: 1px; padding: 0; margin: -1px; overflow: hidden; clip: rect(0 0 0 0); white-space: nowrap; border: 0; }

.ai {
  position: fixed; right: 16px; bottom: 16px; z-index: 110;
  width: min(400px, calc(100vw - 32px)); height: min(640px, calc(100vh - 32px));
  display: flex; flex-direction: column; overflow: hidden;
  background: var(--white, #fff); color: var(--text, #1d2233);
  border-radius: 18px; box-shadow: 0 18px 50px rgba(18, 29, 77, .28); border: 1px solid var(--line, #e4e6ee);
  animation: ai-in .18s ease-out;
}
.ai[hidden] { display: none; }
@keyframes ai-in { from { opacity: 0; transform: translateY(12px) scale(.98); } to { opacity: 1; transform: none; } }

.ai__head { display: flex; align-items: center; gap: 10px; padding: 12px 12px 12px 14px; background: var(--navy, #1b2a6b); color: #fff; }
.ai__avatar { width: 44px; height: 44px; border-radius: 50%; object-fit: cover; object-position: top; background: #fff; flex: none; }
.ai__title { flex: 1; min-width: 0; display: flex; flex-direction: column; line-height: 1.25; }
.ai__title strong { font-size: 15px; }
.ai__title small { font-size: 12px; opacity: .8; }
.ai__icon { width: 34px; height: 34px; border-radius: 10px; border: 0; background: rgba(255, 255, 255, .12); color: #fff; font-size: 16px; cursor: pointer; }
.ai__icon:hover, .ai__icon:focus-visible { background: rgba(255, 255, 255, .25); }

.ai__msgs { flex: 1; overflow-y: auto; padding: 14px; display: flex; flex-direction: column; gap: 10px; background: var(--bg, #f5f6f9); overscroll-behavior: contain; }
.ai__msg { max-width: 88%; font-size: 14px; line-height: 1.45; }
.ai__msg--user { align-self: flex-end; background: var(--red, #d7262b); color: #fff; padding: 9px 12px; border-radius: 14px 14px 4px 14px; white-space: pre-wrap; overflow-wrap: anywhere; }
.ai__msg--assistant { align-self: flex-start; display: flex; flex-direction: column; gap: 6px; max-width: 94%; }
.ai__bubble { background: #fff; border: 1px solid var(--line, #e4e6ee); padding: 9px 12px; border-radius: 14px 14px 14px 4px; overflow-wrap: anywhere; }
.ai__plink { color: var(--navy, #1b2a6b); font-weight: 600; text-decoration: underline; text-underline-offset: 2px; }

.ai__cards { display: flex; flex-direction: column; gap: 6px; }
.ai__card { display: flex; gap: 10px; align-items: center; background: #fff; border: 1px solid var(--line, #e4e6ee); border-radius: 12px; padding: 8px; }
.ai__card--hl { border-color: var(--green, #1a9c5b); box-shadow: 0 0 0 2px rgba(26, 156, 91, .15); }
.ai__cimg { width: 54px; height: 54px; flex: none; border-radius: 10px; background: var(--tone, #e8ebf6); display: grid; place-items: center; font-size: 26px; overflow: hidden; text-decoration: none; }
.ai__cimg img { width: 100%; height: 100%; object-fit: contain; }
.ai__cbody { flex: 1; min-width: 0; display: flex; flex-direction: column; gap: 3px; }
.ai__cname { font-size: 13px; font-weight: 600; color: var(--text, #1d2233); text-decoration: none; display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden; }
.ai__cname:hover { text-decoration: underline; }
.ai__cprice { font-size: 13px; color: var(--muted, #6b7185); }
.ai__cprice b { color: var(--red, #d7262b); font-size: 15px; }
.ai__rx { font-style: normal; font-size: 11px; font-weight: 700; color: var(--navy, #1b2a6b); background: var(--navy-soft, #e8ebf6); padding: 1px 6px; border-radius: 999px; }
.ai__add { align-self: flex-start; border: 0; border-radius: 8px; padding: 6px 10px; font: inherit; font-size: 12px; font-weight: 700; cursor: pointer; background: var(--green, #1a9c5b); color: #fff; }
.ai__add:disabled { background: var(--navy-soft, #e8ebf6); color: var(--navy, #1b2a6b); cursor: default; }

.ai__fb { display: flex; align-items: center; gap: 4px; font-size: 12px; color: var(--muted, #6b7185); }
.ai__fb button { border: 0; background: transparent; font-size: 15px; cursor: pointer; padding: 2px 4px; border-radius: 6px; }
.ai__fb button:hover, .ai__fb button:focus-visible { background: var(--line, #e4e6ee); }

.ai__msg--typing .ai__bubble { padding: 12px 14px; align-self: flex-start; }
.ai__typing { font-size: 11px; color: var(--muted, #6b7185); padding-left: 4px; }
.ai__dots { display: inline-flex; gap: 4px; }
.ai__dots i { width: 7px; height: 7px; border-radius: 50%; background: var(--muted, #6b7185); animation: ai-dot 1s infinite ease-in-out; }
.ai__dots i:nth-child(2) { animation-delay: .15s; }
.ai__dots i:nth-child(3) { animation-delay: .3s; }
@keyframes ai-dot { 0%, 80%, 100% { opacity: .3; transform: translateY(0); } 40% { opacity: 1; transform: translateY(-3px); } }

.ai__chips { display: flex; gap: 6px; overflow-x: auto; padding: 8px 12px 0; background: var(--bg, #f5f6f9); scrollbar-width: none; }
.ai__chips[hidden] { display: none; }
.ai__chips button { flex: none; border: 1px solid var(--line, #e4e6ee); background: #fff; color: var(--navy, #1b2a6b); border-radius: 999px; padding: 6px 11px; font: inherit; font-size: 12px; font-weight: 600; cursor: pointer; }
.ai__chips button:hover { border-color: var(--navy, #1b2a6b); }

.ai__form { display: flex; gap: 8px; align-items: flex-end; padding: 10px 12px; background: var(--bg, #f5f6f9); }
.ai__form textarea { flex: 1; resize: none; border: 1px solid var(--line, #e4e6ee); border-radius: 12px; padding: 10px 12px; font: inherit; font-size: 15px; line-height: 1.35; max-height: 120px; background: #fff; color: inherit; }
.ai__form textarea:focus { outline: 2px solid var(--navy, #1b2a6b); outline-offset: -1px; }
.ai__send { width: 42px; height: 42px; flex: none; border: 0; border-radius: 12px; background: var(--red, #d7262b); color: #fff; font-size: 17px; cursor: pointer; }
.ai__send:disabled { opacity: .5; cursor: wait; }
.ai__legal { margin: 0; padding: 0 12px 10px; font-size: 11px; line-height: 1.4; color: var(--muted, #6b7185); background: var(--bg, #f5f6f9); }
.ai__legal a { color: var(--navy, #1b2a6b); font-weight: 600; }

.ai-fab { position: fixed; right: 16px; bottom: 16px; z-index: 70; display: inline-flex; align-items: center; gap: 6px; border: 0; border-radius: 999px; padding: 12px 16px; background: var(--red, #d7262b); color: #fff; font: inherit; font-weight: 700; font-size: 15px; box-shadow: var(--shadow); cursor: pointer; }
.ai-fab[hidden] { display: none; }

body.ai-open .pharma, body.ai-open .ai-fab { visibility: hidden; }

@media (max-width: 760px) {
  .ai { inset: 0; width: 100%; height: 100%; height: 100dvh; border-radius: 0; border: 0; }
  .ai-fab { bottom: 74px; }
  body.ai-open { overflow: hidden; }
}
@media (prefers-reduced-motion: reduce) { .ai, .ai__dots i { animation: none; } }

/* Fundo dos produtos sempre branco */
.ai__cimg { background: #fff; border: 1px solid #e4e6ee; }
