/* ===== Base reset for the widget scope ===== */
#ibcai-floating-chat { all: initial; }
#ibcai-floating-chat, #ibcai-floating-chat * { box-sizing: border-box; font-family: system-ui, -apple-system, Segoe UI, Roboto, "Helvetica Neue", Arial; }

/* Floating action button */
.ibcai-fab{
  position:fixed; right:16px; bottom:16px;
  width:60px; height:60px; border-radius:999px;
  background:#111; color:#fff; display:flex; align-items:center; justify-content:center;
  font-weight:700; cursor:pointer; box-shadow:0 10px 28px rgba(0,0,0,.22);
  z-index:2147483000; user-select:none;
}
.ibcai-fab:active{ transform: scale(.98); }

/* Panel (desktop) */
.ibcai-wrap{
  position:fixed; right:24px; bottom:96px;
  width:360px; max-width:92vw;
  background:#fff; border:1px solid #e5e7eb; border-radius:16px;
  box-shadow:0 16px 40px rgba(0,0,0,.18);
  display:none; overflow:hidden; z-index:2147483000;
}
#ibcai-floating-chat.open .ibcai-wrap{ display:block; }

/* Header */
.ibcai-header{
  background:#111; color:#fff; padding:12px 14px;
  font-weight:700; font-size:15px; display:flex; align-items:center; justify-content:space-between;
}
.ibcai-header .title{ letter-spacing:.2px; }
.ibcai-header .lang-toggle{ font-size:13px; opacity:.85; }

/* Body / messages */
.ibcai-body{
  max-height:460px; min-height:260px; overflow:auto; padding:12px; background:#fafafa;
}
.ibcai-msg{ display:flex; margin:8px 0; }
.ibcai-user{ justify-content:flex-end; }
.ibcai-bot{ justify-content:flex-start; }
.ibcai-bubble{
  max-width:84%; padding:10px 12px; border-radius:14px; line-height:1.45; font-size:14px;
  word-break:break-word; white-space:pre-wrap;
}
.ibcai-user .ibcai-bubble{ background:#111; color:#fff; border-bottom-right-radius:6px; }
.ibcai-bot  .ibcai-bubble{ background:#fff; border:1px solid #e5e7eb; border-bottom-left-radius:6px; }
.ibcai-body ul{ margin:8px 0 0 18px; }
.ibcai-body a{ color:#0a58ca; text-decoration:underline; }

/* Input */
.ibcai-input{
  display:flex; gap:8px; padding:12px; border-top:1px solid #eee; background:#fff;
}
.ibcai-input input{
  flex:1; padding:12px 12px; font-size:15px;
  border:1px solid #e5e7eb; border-radius:10px; outline:none;
}
.ibcai-input button{
  padding:12px 14px; border:none; border-radius:10px; background:#111; color:#fff;
  font-weight:700; cursor:pointer;
}

/* Buy button */
.ibcai-buy{
  display:inline-block; margin-top:10px; padding:12px 14px; background:#0a7cff; color:#fff;
  border-radius:10px; cursor:pointer; font-weight:700;
}
.ibcai-buy.loading{ opacity:.7; pointer-events:none; }

/* RTL */
#ibcai-floating-chat.rtl .ibcai-wrap{ right:auto; left:24px; }
#ibcai-floating-chat.rtl .ibcai-body, #ibcai-floating-chat.rtl .ibcai-input{ direction:rtl; text-align:right; }
#ibcai-floating-chat.rtl .ibcai-body ul{ margin:8px 18px 0 0; }

/* ===== Mobile (bottom sheet / fullscreen) ===== */
@media (max-width: 600px){
  .ibcai-fab{ right:16px; bottom:16px; width:64px; height:64px; font-size:14px; }
  .ibcai-wrap{
    right:0; left:0; bottom:0; top:auto;
    width:100vw; height:calc(var(--vh, 1vh) * 100);
    max-width:100vw; border-radius:0; border:none;
  }
  .ibcai-header{ padding:14px 16px; font-size:16px; }
  .ibcai-body{ height:calc(100% - 56px - 66px); max-height:none; min-height:0; padding:14px; }
  .ibcai-input{
    position:absolute; left:0; right:0; bottom:0; padding:12px 16px;
    padding-bottom:calc(12px + env(safe-area-inset-bottom)); background:#fff;
  }
  .ibcai-input input{ font-size:16px; padding:14px; }
  .ibcai-input button{ font-size:15px; padding:14px 16px; }
}

/* Prevent background scroll when open */
body.ibcai-no-scroll { overflow:hidden; touch-action:none; }