/* =================================================================
   PEVLO — AI shopping assistant (chat panel)
================================================================= */
.chat-menu-item.chat-ai {
  border: 0;
  padding: 0;
  cursor: pointer;
  color: #fff;
  background: linear-gradient(135deg, #7c3aed, #3b6cff 60%, #06acfa);
  box-shadow: 0 6px 16px rgba(91, 76, 255, .45);
  animation: pvAiGlow 2.4s ease-in-out infinite;
}

@keyframes pvAiGlow {
  0%, 100% { box-shadow: 0 6px 16px rgba(91, 76, 255, .4); }
  50% { box-shadow: 0 6px 22px rgba(6, 172, 250, .7); }
}

.pvai {
  position: fixed;
  right: 18px;
  bottom: 18px;
  z-index: 260;
  width: min(380px, calc(100vw - 24px));
  height: min(580px, calc(100dvh - 90px));
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 20px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  box-shadow: 0 30px 80px rgba(15, 23, 42, .3);
  font-family: 'Noto Sans Bengali', 'Hind Siliguri', var(--font-main, sans-serif);
  opacity: 0;
  pointer-events: none;
  transform: translateY(16px) scale(.98);
  transform-origin: bottom right;
  transition: opacity .2s ease, transform .2s ease;
}

.pvai.is-open {
  opacity: 1;
  pointer-events: auto;
  transform: none;
}

html[data-theme="dark"] .pvai {
  background: #0c1330;
  border-color: rgba(120, 150, 255, .18);
  box-shadow: 0 30px 80px rgba(0, 0, 0, .6);
}

body:has(.pvai.is-open) .floating-chat-container {
  opacity: 0;
  visibility: hidden;
  pointer-events: none;
}

/* Header */
.pvai__head {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 12px 12px 12px 14px;
  color: #fff;
  background: linear-gradient(135deg, #1e3a8a, #3b6cff 60%, #06acfa);
}

.pvai__avatar {
  flex: none;
  width: 38px;
  height: 38px;
  border-radius: 12px;
  display: grid;
  place-items: center;
  background: rgba(255, 255, 255, .18);
}

.pvai__title {
  flex: 1;
  min-width: 0;
  line-height: 1.25;
}

.pvai__title b {
  display: block;
  font-size: .95rem;
}

.pvai__title span {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  font-size: .72rem;
  opacity: .9;
}

.pvai__title span::before {
  content: "";
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 3px rgba(74, 222, 128, .25);
}

.pvai__hbtn {
  width: 32px;
  height: 32px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 10px;
  color: #fff;
  background: rgba(255, 255, 255, .14);
  cursor: pointer;
  text-decoration: none;
  transition: background .15s;
}

.pvai__hbtn:hover {
  background: rgba(255, 255, 255, .26);
  color: #fff;
}

/* Messages */
.pvai__body {
  flex: 1;
  min-height: 0;
  overflow-y: auto;
  padding: 14px 12px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scroll-behavior: smooth;
  background: var(--bg-body);
}

html[data-theme="dark"] .pvai__body {
  background: #0a1029;
}

.pvai__msg {
  max-width: 86%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: .86rem;
  line-height: 1.55;
  white-space: pre-line;
  word-wrap: break-word;
  animation: pvAiIn .2s ease;
}

@keyframes pvAiIn {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: none; }
}

.pvai__msg--bot {
  align-self: flex-start;
  color: var(--text-main);
  background: var(--bg-card);
  border: 1px solid var(--border);
  border-bottom-left-radius: 4px;
}

html[data-theme="dark"] .pvai__msg--bot {
  background: #121b3f;
  border-color: rgba(120, 150, 255, .14);
  color: #e8edff;
}

.pvai__msg--me {
  align-self: flex-end;
  color: #fff;
  background: linear-gradient(135deg, #3b6cff, #06acfa);
  border-bottom-right-radius: 4px;
}

.pvai__msg a {
  color: var(--secondary);
  font-weight: 700;
  word-break: break-all;
}

.pvai__typing {
  display: inline-flex;
  gap: 4px;
  padding: 12px 14px;
}

.pvai__typing i {
  width: 6px;
  height: 6px;
  border-radius: 50%;
  background: var(--text-muted);
  animation: pvAiDot 1s infinite ease-in-out;
}

.pvai__typing i:nth-child(2) { animation-delay: .15s; }
.pvai__typing i:nth-child(3) { animation-delay: .3s; }

@keyframes pvAiDot {
  0%, 80%, 100% { opacity: .3; transform: translateY(0); }
  40% { opacity: 1; transform: translateY(-3px); }
}

/* Product cards inside the chat */
.pvai__cards {
  align-self: stretch;
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 2px 2px 6px;
  scrollbar-width: none;
}

.pvai__cards::-webkit-scrollbar {
  display: none;
}

.pvai__card {
  flex: none;
  width: 132px;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  text-decoration: none;
  transition: transform .15s, border-color .15s;
}

html[data-theme="dark"] .pvai__card {
  background: #121b3f;
  border-color: rgba(120, 150, 255, .16);
}

.pvai__card:hover {
  transform: translateY(-2px);
  border-color: var(--primary);
  color: var(--text-main);
}

.pvai__card-img {
  position: relative;
  aspect-ratio: 1 / 1;
  background: #f3f5f9;
}

.pvai__card-img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.pvai__card-img em {
  position: absolute;
  top: 5px;
  left: 5px;
  padding: 1px 6px;
  border-radius: 6px;
  font-style: normal;
  font-size: .64rem;
  font-weight: 800;
  color: #fff;
  background: #ef4444;
}

.pvai__card-body {
  padding: 6px 8px 8px;
  display: grid;
  gap: 2px;
}

.pvai__card-name {
  font-size: .74rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pvai__card-price {
  font-size: .82rem;
  font-weight: 900;
  color: var(--secondary);
}

.pvai__card-price s {
  margin-left: 4px;
  font-size: .66rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pvai__card-cta {
  margin-top: 4px;
  padding: 5px 0;
  border-radius: 8px;
  text-align: center;
  font-size: .7rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
}

/* Quick questions */
.pvai__chips {
  display: flex;
  gap: 6px;
  overflow-x: auto;
  padding: 8px 12px 0;
  scrollbar-width: none;
  background: var(--bg-card);
}

html[data-theme="dark"] .pvai__chips {
  background: #0c1330;
}

.pvai__chips::-webkit-scrollbar {
  display: none;
}

.pvai__chip {
  flex: none;
  padding: 6px 10px;
  border-radius: 999px;
  border: 1px solid var(--border);
  background: transparent;
  color: var(--text-main);
  font: inherit;
  font-size: .74rem;
  font-weight: 600;
  white-space: nowrap;
  cursor: pointer;
  transition: border-color .15s, color .15s;
}

.pvai__chip:hover {
  border-color: var(--primary);
  color: var(--primary);
}

html[data-theme="dark"] .pvai__chip {
  color: #cdd6f8;
  border-color: rgba(120, 150, 255, .22);
}

/* Input */
.pvai__form {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 10px 12px 12px;
  background: var(--bg-card);
}

html[data-theme="dark"] .pvai__form {
  background: #0c1330;
}

.pvai__input {
  flex: 1;
  min-width: 0;
  height: 42px;
  padding: 0 14px;
  border-radius: 12px;
  border: 1.5px solid var(--border);
  background: var(--bg-body);
  color: var(--text-main);
  font: inherit;
  font-size: .88rem;
  outline: none;
}

html[data-theme="dark"] .pvai__input {
  background: #0a1029;
  border-color: rgba(120, 150, 255, .22);
  color: #e8edff;
}

.pvai__input:focus {
  border-color: var(--primary);
}

.pvai__send {
  flex: none;
  width: 42px;
  height: 42px;
  display: grid;
  place-items: center;
  padding: 0;
  border: 0;
  border-radius: 12px;
  color: #fff;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
  cursor: pointer;
}

.pvai__send:disabled {
  opacity: .5;
  cursor: wait;
}

.pvai__foot {
  padding: 0 12px 8px;
  text-align: center;
  font-size: .64rem;
  color: var(--text-muted);
  background: var(--bg-card);
}

html[data-theme="dark"] .pvai__foot {
  background: #0c1330;
}

@media (max-width: 520px) {
  .pvai {
    right: 0;
    bottom: 0;
    width: 100vw;
    height: min(88dvh, 640px);
    border-radius: 20px 20px 0 0;
  }
}

/* messages and card rows must never be squeezed by the scrolling column */
.pvai__body > * {
  flex-shrink: 0;
}

.pvai__card-img,
.pvai__card-body,
.pvai__card-name,
.pvai__card-price,
.pvai__card-cta {
  display: block;
}

.pvai__card-body {
  display: grid;
}

.pvai__old {
  font-size: .78em;
  color: var(--text-muted);
}

.pvai__msg--bot .pvai__link {
  display: inline-block;
  margin-top: 4px;
  padding: 4px 10px;
  border-radius: 8px;
  font-size: .78rem;
  color: #fff !important;
  text-decoration: none;
  word-break: normal;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
}

/* Floating chat menu: readable tooltips in light & dark */
.floating-chat-menu .chat-menu-item::after {
  padding: 6px 11px !important;
  border-radius: 10px !important;
  background: #0f172a !important;
  color: #fff !important;
  font-family: 'Noto Sans Bengali', 'Hind Siliguri', var(--font-main, sans-serif);
  font-size: .76rem !important;
  font-weight: 600 !important;
  letter-spacing: 0 !important;
  line-height: 1.3;
  text-shadow: none !important;
  box-shadow: 0 8px 22px rgba(0, 0, 0, .3) !important;
}

html[data-theme="dark"] .floating-chat-menu .chat-menu-item::after {
  background: #fff !important;
  color: #0f172a !important;
}

/* show the label of the AI button by default when the menu opens (it's the new feature) */
.floating-chat-menu.open .chat-menu-item.chat-ai::after {
  opacity: 1;
  visibility: visible;
  transform: translateY(-50%) scale(1);
}

/* touch screens: no hover, so keep every label visible while the menu is open */
@media (hover: none) {
  .floating-chat-menu.open .chat-menu-item::after {
    opacity: 1;
    visibility: visible;
    transform: translateY(-50%) scale(1);
  }
}

/* the back-to-top arrow used to sit on top of the phone button */
body:has(.floating-chat-menu.open) #backToTop {
  opacity: 0 !important;
  visibility: hidden !important;
  pointer-events: none !important;
}

/* Compact product suggestions (inside answers and while typing) */
.pvai__plist {
  align-self: stretch;
  display: grid;
  gap: 6px;
}

.pvai__pitem {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 8px 6px 6px;
  border-radius: 12px;
  border: 1px solid var(--border);
  background: var(--bg-card);
  color: var(--text-main);
  text-decoration: none;
  transition: border-color .15s, transform .15s;
}

html[data-theme="dark"] .pvai__pitem {
  background: #121b3f;
  border-color: rgba(120, 150, 255, .16);
  color: #e8edff;
}

.pvai__pitem:hover {
  border-color: var(--primary);
  transform: translateX(2px);
  color: inherit;
}

.pvai__pitem img {
  flex: none;
  width: 44px;
  height: 44px;
  border-radius: 9px;
  object-fit: cover;
  background: #f3f5f9;
}

.pvai__pinfo {
  flex: 1;
  min-width: 0;
  display: grid;
  gap: 1px;
}

.pvai__pname {
  font-size: .8rem;
  font-weight: 700;
  line-height: 1.3;
  display: -webkit-box;
  -webkit-line-clamp: 1;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.pvai__pprice {
  font-size: .78rem;
  font-weight: 800;
  color: var(--secondary);
}

.pvai__pprice s {
  font-size: .7rem;
  font-weight: 500;
  color: var(--text-muted);
}

.pvai__pprice em {
  margin-left: 2px;
  padding: 0 5px;
  border-radius: 5px;
  font-style: normal;
  font-size: .64rem;
  color: #fff;
  background: #ef4444;
}

.pvai__pprice i {
  font-style: normal;
  font-size: .66rem;
  color: #ef4444;
}

.pvai__pgo {
  flex: none;
  width: 26px;
  height: 26px;
  display: grid;
  place-items: center;
  border-radius: 8px;
  font-size: 1.1rem;
  font-weight: 700;
  color: #fff;
  background: linear-gradient(135deg, var(--secondary), var(--primary));
}

/* live suggestions above the input */
.pvai__plist--live {
  max-height: 210px;
  overflow-y: auto;
  padding: 8px 12px 0;
  background: var(--bg-card);
  border-top: 1px solid var(--border);
}

html[data-theme="dark"] .pvai__plist--live {
  background: #0c1330;
  border-top-color: rgba(120, 150, 255, .14);
}

.pvai__live-head {
  font-size: .68rem;
  font-weight: 700;
  color: var(--text-muted);
}

/* while typing, the live product list replaces the quick-question chips */
.pvai:has(.pvai__plist--live) .pvai__chips {
  display: none;
}
