/* Bazarkore AI Support — floating alignment patch */
#bkai-launch {
  position: fixed !important;
  right: max(20px, env(safe-area-inset-right)) !important;
  bottom: max(20px, env(safe-area-inset-bottom)) !important;
  z-index: 2147483644 !important;
  display: inline-flex !important;
  align-items: center !important;
  justify-content: center !important;
  min-height: 46px !important;
  padding: 0 18px !important;
  border: 0 !important;
  border-radius: 999px !important;
  background: #126b45 !important;
  color: #fff !important;
  font: 700 14px/1.2 "Noto Sans Bengali", "Segoe UI", Arial, sans-serif !important;
  box-shadow: 0 8px 24px rgba(0,0,0,.22) !important;
  cursor: pointer !important;
}
#bkai-launch:hover { transform: translateY(-2px); }
#bkai-panel {
  position: fixed !important;
  right: max(20px, env(safe-area-inset-right)) !important;
  bottom: calc(82px + env(safe-area-inset-bottom)) !important;
  left: auto !important;
  top: auto !important;
  width: min(380px, calc(100vw - 32px)) !important;
  height: min(560px, calc(100dvh - 116px - env(safe-area-inset-bottom))) !important;
  max-height: calc(100dvh - 116px - env(safe-area-inset-bottom)) !important;
  z-index: 2147483646 !important;
  display: none;
  flex-direction: column;
  overflow: hidden !important;
  box-sizing: border-box !important;
  border: 1px solid #dce5df !important;
  border-radius: 18px !important;
  background: #fff !important;
  color: #17211c !important;
  box-shadow: 0 14px 42px rgba(0,0,0,.22) !important;
  font-family: "Noto Sans Bengali", "Segoe UI", Arial, sans-serif !important;
}
#bkai-panel.bkai-open { display: flex !important; }
#bkai-head {
  flex: 0 0 auto;
  min-height: 68px;
  box-sizing: border-box;
  background: #126b45 !important;
  color: #fff !important;
  padding: 14px 16px !important;
  display: flex !important;
  justify-content: space-between !important;
  align-items: center !important;
  gap: 12px;
}
#bkai-head strong { display:block; font-size:16px; line-height:1.35; }
#bkai-head small { display:block; font-size:12px; opacity:.88; margin-top:4px; }
#bkai-close {
  flex: 0 0 34px;
  width:34px; height:34px;
  display:inline-flex; align-items:center; justify-content:center;
  border:0; border-radius:50%;
  background:rgba(255,255,255,.14) !important;
  color:#fff !important; font-size:24px; line-height:1; cursor:pointer;
}
#bkai-messages {
  flex: 1 1 auto;
  min-height: 0;
  overflow-y: auto !important;
  overscroll-behavior: contain;
  padding: 14px !important;
  background: #f6f8f6 !important;
  display:flex; flex-direction:column; gap:10px;
}
.bkai-msg {
  max-width:88%;
  box-sizing:border-box;
  padding:10px 12px;
  border-radius:13px;
  white-space:pre-wrap;
  overflow-wrap:anywhere;
  font-size:14px;
  line-height:1.55;
}
.bkai-user { align-self:flex-end; background:#d8f3e2; }
.bkai-assistant { align-self:flex-start; background:#fff; border:1px solid #e3e8e4; }
#bkai-form {
  flex: 0 0 auto;
  display:flex !important;
  align-items:center !important;
  gap:8px !important;
  box-sizing:border-box;
  width:100%;
  padding:10px !important;
  padding-bottom:calc(10px + env(safe-area-inset-bottom)) !important;
  border-top:1px solid #e5e5e5 !important;
  background:#fff !important;
}
#bkai-input {
  flex:1 1 auto;
  min-width:0 !important;
  width:100%;
  box-sizing:border-box;
  border:1px solid #ccd5ce !important;
  border-radius:10px !important;
  padding:11px !important;
  font:14px "Noto Sans Bengali", "Segoe UI", Arial, sans-serif !important;
  outline-offset:2px;
}
#bkai-send {
  flex:0 0 auto;
  min-height:42px;
  background:#126b45 !important;
  color:#fff !important;
  border:0 !important;
  border-radius:10px !important;
  padding:0 15px !important;
  font-weight:700;
  white-space:nowrap;
  cursor:pointer;
}
#bkai-send:disabled { opacity:.55; cursor:wait; }
/* Strong selectors are intentional: the homepage has later/high-specificity !important rules. */
html body.storefront-refresh.bkai-chat-open .floating-contact-rail,
html body.storefront-refresh.bkai-chat-open .sticky-whatsapp-order,
html body.storefront-refresh.bkai-chat-open #floating-whatsapp,
html body.storefront-refresh.bkai-chat-open .floating-whatsapp-order,
html body.storefront-refresh.bkai-chat-open .floating-pdf {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
html body.bkai-chat-open #bkai-launch {
  display: none !important;
  visibility: hidden !important;
  opacity: 0 !important;
  pointer-events: none !important;
}
/* Keep the chat above all storefront fixed controls and overlays. */
html body #bkai-panel {
  z-index: 2147483646 !important;
}
@media (max-width:600px) {
  #bkai-launch {
    right:max(14px, env(safe-area-inset-right)) !important;
    bottom:max(14px, env(safe-area-inset-bottom)) !important;
    min-height:44px !important;
    padding:0 16px !important;
    font-size:13px !important;
  }
  #bkai-panel {
    right:max(8px, env(safe-area-inset-right)) !important;
    bottom:calc(68px + env(safe-area-inset-bottom)) !important;
    width:calc(100vw - 16px) !important;
    height:min(72dvh, 600px) !important;
    max-height:calc(100dvh - 88px - env(safe-area-inset-bottom)) !important;
    border-radius:16px !important;
  }
}
@media (max-height:560px) {
  #bkai-panel {
    height:calc(100dvh - 92px - env(safe-area-inset-bottom)) !important;
    max-height:calc(100dvh - 92px - env(safe-area-inset-bottom)) !important;
  }
}
