/* Esconder FAB duplicado nas páginas de conta com botão Maia próprio */
.sl-page--maia-chat .chat-fab {
  display: none !important;
}

/* Fundo escurecido — “Criar com a Maia” (Favoritos / listas) */
.chat-shopping-backdrop {
  position: fixed;
  inset: 0;
  z-index: 8998;
  background: rgba(38, 42, 46, 0.48);
  opacity: 0;
  visibility: hidden;
  transition: opacity 0.22s ease, visibility 0.22s ease;
}
.chat-shopping-backdrop--visible {
  opacity: 1;
  visibility: visible;
}

/* Janela grande centrada — estilo Knuspr “Maia Beta” */
.chat-popup.chat-popup--shopping-list {
  left: 50%;
  right: auto;
  bottom: auto;
  top: 50%;
  transform: translate(-50%, -50%);
  width: min(560px, calc(100vw - 1.25rem));
  max-height: min(620px, calc(100vh - 1.5rem));
  max-width: calc(100vw - 1.25rem);
  z-index: 9001;
  box-shadow: 0 24px 64px rgba(0, 0, 0, 0.22);
  animation: chat-spotlight-in 0.28s ease;
}
@keyframes chat-spotlight-in {
  from {
    opacity: 0;
    transform: translate(-50%, -46%);
  }
  to {
    opacity: 1;
    transform: translate(-50%, -50%);
  }
}

.chat-popup--shopping-list .chat-messages {
  min-height: 260px;
  max-height: min(400px, 52vh);
  background: #fafafa;
}

.chat-popup--shopping-list .chat-popup__header {
  background: #fff;
  color: #1a1a1a;
  border-bottom: 1px solid #ececec;
}
.chat-popup--shopping-list .chat-popup__header-title {
  font-size: 0.95rem;
  font-weight: 800;
  letter-spacing: -0.02em;
}
.chat-popup--shopping-list .chat-popup__header-sub {
  color: #6b7280;
  font-size: 0.72rem;
}
.chat-popup--shopping-list .chat-popup__header-dot {
  background: #ff7c00;
}
.chat-popup--shopping-list .chat-popup__header-btn {
  color: #5c6360;
}
.chat-popup--shopping-list .chat-popup__header-btn:hover {
  background: #f3f4f6;
  color: #1a1a1a;
}

.chat-popup__header-btn--menu {
  display: none;
}
.chat-popup--shopping-list .chat-popup__header-btn--menu {
  display: grid;
}

.chat-msg--maia-cta {
  background: #fff8f0 !important;
  border: 1px solid #ffd9bf !important;
  max-width: 92% !important;
}
.chat-msg--maia-cta strong {
  color: #c2410c;
}

.chat-send-text {
  display: none;
}
.chat-popup--shopping-list .chat-send-text {
  display: inline;
  font-size: 0.78rem;
  font-weight: 700;
}
.chat-popup--shopping-list .chat-send-ico {
  display: none;
}
.chat-popup--shopping-list .chat-input-area__btn--send {
  width: auto;
  min-width: 4.75rem;
  padding: 0 0.75rem;
  border-radius: 8px;
  background: #e8e8e8;
  color: #333;
}
.chat-popup--shopping-list .chat-input-area__btn--send:hover {
  background: #ddd;
  color: #111;
}

.chat-popup__powered {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 0.35rem;
  padding: 0.35rem 0.65rem 0.55rem;
}
.chat-popup__powered-line {
  font-size: 0.6rem;
  color: #bbb;
}
.chat-popup__legal {
  font-size: 0.62rem;
  color: #8a9099;
  line-height: 1.45;
  margin: 0;
  text-align: center;
  max-width: 42ch;
}
.chat-popup__legal a {
  color: #ff7c00;
  text-decoration: underline;
}
.chat-popup__legal a:hover {
  color: #e56f00;
}

.chat-popup--shopping-list .maia-sl-pill {
  font-size: 0.68rem;
  padding: 0.42rem 0.6rem;
  line-height: 1.25;
}

@media (max-width: 480px) {
  .chat-popup.chat-popup--shopping-list {
    width: calc(100vw - 1rem);
    max-height: calc(100vh - 1rem);
  }
  .chat-popup--shopping-list .chat-messages {
    max-height: min(360px, 48vh);
  }
}

/* Live chat widget — Knuspr / Daktela style */
.chat-fab {
  position: fixed;
  bottom: 1.25rem;
  left: 1.25rem;
  z-index: 9000;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: .5rem;
}

.chat-fab__btn {
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #4caf50;
  border: none;
  cursor: pointer;
  display: grid;
  place-items: center;
  box-shadow: 0 4px 16px rgba(0,0,0,.18);
  transition: transform .18s ease, box-shadow .18s ease;
  position: relative;
}
.chat-fab__btn:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 24px rgba(0,0,0,.22);
}
.chat-fab__btn svg { color: #fff; }

.chat-fab__pulse {
  position: absolute;
  top: 0; left: 0;
  width: 10px; height: 10px;
  background: #4caf50;
  border-radius: 50%;
  border: 2px solid #fff;
}

.chat-fab__label {
  display: none;
}
@media (min-width: 600px) {
  .chat-fab__label {
    display: flex;
    align-items: center;
    gap: .4rem;
    padding: .45rem .85rem;
    background: #4caf50;
    color: #fff;
    border-radius: 999px;
    font-size: .8rem;
    font-weight: 600;
    font-family: inherit;
    box-shadow: 0 2px 10px rgba(0,0,0,.12);
    white-space: nowrap;
    border: none;
    cursor: pointer;
    transition: background .18s ease;
  }
  .chat-fab__label:hover { background: #43a047; }
  .chat-fab__label .dot {
    width: 8px; height: 8px;
    background: #a5d6a7;
    border-radius: 50%;
    animation: chat-pulse 2s ease-in-out infinite;
  }
}

@keyframes chat-pulse {
  0%, 100% { opacity: 1; }
  50% { opacity: .4; }
}

/* ═══════ CHAT POPUP ═══════ */
.chat-popup {
  position: fixed;
  bottom: 5rem;
  left: 1.25rem;
  z-index: 9001;
  width: 370px;
  max-width: calc(100vw - 2.5rem);
  max-height: calc(100vh - 7rem);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 48px rgba(0,0,0,.18);
  overflow: hidden;
  display: none;
  flex-direction: column;
  animation: chat-slide-up .25s ease;
}
.chat-popup.open { display: flex; }

@keyframes chat-slide-up {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: translateY(0); }
}

/* Header */
.chat-popup__header {
  background: #4caf50;
  color: #fff;
  padding: .65rem 1rem;
  display: flex;
  align-items: center;
  justify-content: space-between;
  flex-shrink: 0;
}

.chat-popup__header-left {
  display: flex;
  align-items: center;
  gap: .5rem;
}

.chat-popup__header-dot {
  width: 8px; height: 8px;
  background: #a5d6a7;
  border-radius: 50%;
}

.chat-popup__header-title {
  font-size: .85rem;
  font-weight: 700;
}

.chat-popup__header-sub {
  font-size: .7rem;
  opacity: .85;
}

.chat-popup__header-actions {
  display: flex; align-items: center; gap: .15rem;
}
.chat-popup__header-btn {
  background: none; border: none; color: #fff;
  cursor: pointer; padding: .2rem; border-radius: 4px;
  display: grid; place-items: center;
  opacity: .8; transition: opacity .15s;
}
.chat-popup__header-btn:hover { opacity: 1; }

/* Messages area */
.chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: .85rem 1rem;
  display: flex;
  flex-direction: column;
  gap: .6rem;
  min-height: 200px;
  max-height: 340px;
  background: #f9f9f9;
}

.chat-msg {
  max-width: 85%;
  padding: .55rem .85rem;
  border-radius: 12px;
  font-size: .82rem;
  line-height: 1.45;
  word-break: break-word;
}

.chat-msg--system {
  align-self: center;
  background: none;
  color: #999;
  font-size: .72rem;
  text-align: center;
  padding: .25rem;
}

.chat-msg--bot {
  align-self: flex-start;
  background: #fff;
  color: #333;
  border: 1px solid #e8e8e8;
  border-bottom-left-radius: 4px;
}

.chat-msg--user {
  align-self: flex-end;
  background: #ff6b00;
  color: #fff;
  border-bottom-right-radius: 4px;
}

.chat-msg__time {
  display: block;
  font-size: .6rem;
  opacity: .6;
  margin-top: .2rem;
}

.chat-typing {
  align-self: flex-start;
  display: flex; gap: .2rem;
  padding: .5rem .7rem;
}
.chat-typing span {
  width: 6px; height: 6px;
  background: #bbb;
  border-radius: 50%;
  animation: typing-bounce .6s infinite alternate;
}
.chat-typing span:nth-child(2) { animation-delay: .15s; }
.chat-typing span:nth-child(3) { animation-delay: .3s; }
@keyframes typing-bounce {
  from { opacity: .3; transform: translateY(0); }
  to { opacity: 1; transform: translateY(-4px); }
}

/* Input area */
.chat-input-area {
  border-top: 1px solid #eee;
  padding: .5rem .75rem;
  display: flex;
  align-items: flex-end;
  gap: .35rem;
  flex-shrink: 0;
  background: #fff;
}

.chat-input-area__text {
  flex: 1;
  border: 1px solid #e0e0e0;
  border-radius: 18px;
  padding: .5rem .85rem;
  font: inherit;
  font-size: .82rem;
  color: #333;
  resize: none;
  min-height: 36px;
  max-height: 80px;
  background: #fafafa;
  transition: border-color .15s;
  outline: none;
}
.chat-input-area__text:focus { border-color: #4caf50; background: #fff; }
.chat-input-area__text::placeholder { color: #aaa; }

.chat-input-area__btn {
  width: 32px; height: 32px;
  border: none; background: none;
  cursor: pointer; display: grid;
  place-items: center;
  border-radius: 50%;
  color: #888;
  transition: color .15s, background .15s;
  flex-shrink: 0;
}
.chat-input-area__btn:hover { color: #4caf50; background: #f0f0f0; }
.chat-input-area__btn--send { color: #4caf50; }
.chat-input-area__btn--send:hover { color: #fff; background: #4caf50; }

/* Emoji picker */
.chat-emoji-picker {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  background: #fff;
  border: 1px solid #e0e0e0;
  border-radius: 12px;
  box-shadow: 0 4px 16px rgba(0,0,0,.12);
  padding: .5rem;
  width: 260px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 10;
}
.chat-emoji-picker.open { display: block; }

.chat-emoji-picker__search {
  width: 100%;
  padding: .35rem .6rem;
  border: 1px solid #e0e0e0;
  border-radius: 8px;
  font-size: .75rem;
  margin-bottom: .4rem;
  outline: none;
}
.chat-emoji-picker__search:focus { border-color: #4caf50; }

.chat-emoji-picker__label {
  font-size: .65rem;
  font-weight: 600;
  color: #999;
  padding: .2rem .1rem;
}

.chat-emoji-picker__grid {
  display: flex;
  flex-wrap: wrap;
  gap: 2px;
}
.chat-emoji-picker__grid button {
  width: 30px; height: 30px;
  border: none; background: none;
  cursor: pointer; font-size: 1.15rem;
  border-radius: 4px;
  transition: background .1s;
}
.chat-emoji-picker__grid button:hover { background: #f0f0f0; }

/* Close confirm */
.chat-confirm {
  display: none;
  padding: 1.5rem 1.25rem;
  text-align: center;
  flex-direction: column;
  gap: .75rem;
}
.chat-confirm.visible { display: flex; }
.chat-confirm__title {
  font-size: .9rem;
  font-weight: 700;
  color: #333;
}
.chat-confirm__btn {
  width: 100%;
  padding: .7rem;
  border: none;
  border-radius: 8px;
  font: inherit;
  font-size: .9rem;
  font-weight: 700;
  cursor: pointer;
  transition: background .15s;
}
.chat-confirm__btn--yes { background: #ff6b00; color: #fff; }
.chat-confirm__btn--yes:hover { background: #e65c00; }
.chat-confirm__btn--no { background: #ff6b00; color: #fff; }
.chat-confirm__btn--no:hover { background: #e65c00; }

/* Powered */
.chat-popup__powered {
  text-align: center;
  padding: .4rem 1rem .6rem;
  font-size: .6rem;
  color: #bbb;
  flex-shrink: 0;
}

/* Maia — entrada “Criar com a Maia” (listas de compras, estilo Knuspr) */
.maia-sl-onboard {
  flex-shrink: 0;
  padding: 0 0 .35rem;
  font-size: .78rem;
  line-height: 1.45;
  color: #333;
  border-bottom: 1px solid #eee;
  margin-bottom: .5rem;
}
.maia-sl-greet {
  margin: 0 0 .5rem;
  font-size: .85rem;
}
.maia-sl-intro {
  margin: 0 0 .65rem;
  color: #555;
}
.maia-sl-features {
  margin: 0 0 .65rem;
  padding: 0 0 0 1.15rem;
  color: #444;
}
.maia-sl-features li {
  margin-bottom: .35rem;
  list-style: disc;
}
.maia-sl-ic {
  margin-right: .25rem;
}
.maia-sl-disclaimer {
  margin: 0 0 .65rem;
  font-size: .72rem;
  color: #888;
  line-height: 1.4;
}
.maia-sl-hint-label {
  margin: 0 0 .4rem;
  font-size: .72rem;
  font-weight: 700;
  color: #666;
  text-transform: uppercase;
  letter-spacing: .04em;
}
.maia-sl-pills {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  margin-bottom: .65rem;
}
.maia-sl-pill {
  padding: .45rem .65rem;
  font-size: .72rem;
  font-weight: 600;
  font-family: inherit;
  color: #fff;
  background: #ff7c00;
  border: none;
  border-radius: 999px;
  cursor: pointer;
  text-align: left;
  line-height: 1.3;
  transition: background .15s ease, transform .1s ease;
}
.maia-sl-pill:hover {
  background: #e56f00;
  transform: translateY(-1px);
}
.maia-sl-prompt-hint {
  margin: 0;
  font-size: .75rem;
  color: #666;
  padding: .5rem .65rem;
  background: #fff8f0;
  border-radius: 10px;
  border: 1px solid #ffe4cc;
}
