/* ===== HomeFreshBD AI Chat Widget ===== */
#gb-chat-widget{position:fixed;right:20px;bottom:20px;z-index:9999;font-family:inherit}

/* Launcher button */
#gb-chat-btn{width:60px;height:60px;border-radius:50%;border:none;cursor:pointer;background:linear-gradient(135deg,#0f6b5c,#0a4f43);color:#fff;font-size:24px;box-shadow:0 10px 28px rgba(15,107,92,.4);position:relative;transition:transform .2s,box-shadow .2s;display:flex;align-items:center;justify-content:center}
#gb-chat-btn:hover{transform:scale(1.07);box-shadow:0 12px 32px rgba(15,107,92,.5)}
#gb-chat-btn::after{content:"";position:absolute;inset:-4px;border-radius:50%;border:2px solid rgba(15,107,92,.35);animation:gb-chat-pulse 2.4s ease-out infinite;pointer-events:none}
@keyframes gb-chat-pulse{0%{transform:scale(.9);opacity:1}70%{transform:scale(1.25);opacity:0}100%{opacity:0}}
.gb-chat-badge{position:absolute;top:-2px;right:-2px;background:#ffb627;color:#1a1a1a;font-weight:700;font-size:11px;min-width:19px;height:19px;border-radius:10px;display:flex;align-items:center;justify-content:center;padding:0 5px;border:2px solid #fff;box-shadow:0 2px 6px rgba(0,0,0,.18)}

/* Panel */
#gb-chat-panel{position:absolute;right:0;bottom:78px;width:370px;max-width:calc(100vw - 32px);height:540px;max-height:calc(100vh - 120px);background:#fff;border-radius:18px;box-shadow:0 24px 64px rgba(10,79,67,.28),0 2px 8px rgba(0,0,0,.08);display:flex;flex-direction:column;overflow:hidden;transition:opacity .22s ease,transform .22s ease;transform-origin:bottom right}
.gb-chat-hidden{opacity:0;transform:scale(.92) translateY(10px);pointer-events:none}
@media (max-width:480px){#gb-chat-panel{width:calc(100vw - 24px);height:calc(100vh - 110px);right:-8px}}

/* Header */
.gb-chat-header{background:linear-gradient(135deg,#0f6b5c,#0a4f43);color:#fff;padding:14px 16px;display:flex;align-items:center;gap:11px}
.gb-chat-avatar{width:40px;height:40px;border-radius:50%;background:rgba(255,255,255,.18);border:1px solid rgba(255,255,255,.3);display:flex;align-items:center;justify-content:center;font-size:19px;position:relative;flex-shrink:0}
.gb-chat-avatar::after{content:"";position:absolute;right:0;bottom:1px;width:10px;height:10px;border-radius:50%;background:#4ade80;border:2px solid #0a4f43}
.gb-chat-title{font-weight:700;font-size:15px;line-height:1.15}
.gb-chat-sub{font-size:11.5px;opacity:.85;margin-top:2px}
#gb-chat-close{margin-left:auto;background:rgba(255,255,255,.12);border:none;color:#fff;width:30px;height:30px;border-radius:50%;font-size:14px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:background .15s;flex-shrink:0}
#gb-chat-close:hover{background:rgba(255,255,255,.25)}

/* Messages */
#gb-chat-messages{flex:1;overflow-y:auto;padding:16px 14px;display:flex;flex-direction:column;gap:10px;background:#f6faf9;scrollbar-width:thin}
#gb-chat-messages::-webkit-scrollbar{width:5px}
#gb-chat-messages::-webkit-scrollbar-thumb{background:#c8ded8;border-radius:4px}
.gb-chat-msg{display:flex;animation:gb-chat-in .18s ease-out}
@keyframes gb-chat-in{from{opacity:0;transform:translateY(6px)}to{opacity:1;transform:none}}
.gb-chat-msg.bot{justify-content:flex-start}
.gb-chat-msg.user{justify-content:flex-end}
.gb-chat-bubble{max-width:82%;padding:10px 13px;border-radius:16px;font-size:13.5px;line-height:1.5;white-space:pre-wrap;word-wrap:break-word}
.gb-chat-msg.bot .gb-chat-bubble{background:#fff;border:1px solid #e2eeea;color:#27423a;border-bottom-left-radius:5px;box-shadow:0 1px 3px rgba(15,107,92,.06)}
.gb-chat-msg.user .gb-chat-bubble{background:linear-gradient(135deg,#0f6b5c,#0c5a4e);color:#fff;border-bottom-right-radius:5px;box-shadow:0 2px 6px rgba(15,107,92,.25)}
.gb-chat-typing .gb-chat-bubble{font-style:italic;color:#6b8279}

/* Quick chips */
.gb-chat-quick{display:flex;flex-wrap:wrap;gap:7px;padding:11px 14px;border-top:1px solid #e7f0ed;background:#fff}
.gb-chat-chip{background:#e6f1ef;color:#0f6b5c;border:1px solid #cbe0da;border-radius:20px;padding:6px 13px;font-size:12.5px;font-weight:500;cursor:pointer;transition:background .15s,transform .1s}
.gb-chat-chip:hover{background:#d3e7e2;transform:translateY(-1px)}

/* Input form */
#gb-chat-form{display:flex;align-items:center;gap:8px;padding:11px 14px;border-top:1px solid #e7f0ed;background:#fff}
#gb-chat-text{flex:1;border:1px solid #d5e4df;border-radius:22px;padding:9px 15px;font-size:13.5px;outline:none;transition:border-color .15s,box-shadow .15s;background:#f8fbfa}
#gb-chat-text:focus{border-color:#0f6b5c;box-shadow:0 0 0 3px rgba(15,107,92,.1);background:#fff}
#gb-chat-form button{background:linear-gradient(135deg,#0f6b5c,#0a4f43);border:none;border-radius:50%;width:38px;height:38px;color:#fff;font-size:15px;cursor:pointer;display:flex;align-items:center;justify-content:center;transition:transform .15s;flex-shrink:0}
#gb-chat-form button:hover{transform:scale(1.07)}

/* Contact / handoff form */
#gb-chat-contact{padding:15px;border-top:1px solid #e7f0ed;background:#fbfdfc}
.gb-chat-contact-head{font-size:13px;color:#27423a;font-weight:600;margin-bottom:10px}
.gb-chat-contact-form{display:flex;flex-direction:column;gap:8px}
.gb-chat-contact-form input,.gb-chat-contact-form textarea{border:1px solid #d5e4df;border-radius:10px;padding:9px 12px;font-size:13px;outline:none;font-family:inherit;background:#fff;transition:border-color .15s}
.gb-chat-contact-form input:focus,.gb-chat-contact-form textarea:focus{border-color:#0f6b5c}
.gb-chat-contact-form textarea{resize:none;min-height:64px}
.gb-chat-contact-form button{background:linear-gradient(135deg,#0f6b5c,#0a4f43);border:none;border-radius:10px;padding:10px;color:#fff;font-weight:600;font-size:13.5px;cursor:pointer;transition:opacity .15s}
.gb-chat-contact-form button:hover{opacity:.92}
.gb-chat-contact-back{text-align:right;margin-top:9px}
.gb-chat-contact-back a{font-size:12px;color:#0f6b5c;text-decoration:none;font-weight:500}
.gb-chat-contact-back a:hover{text-decoration:underline}

/* The hidden contact form must leave the flex flow — opacity:0 alone leaves a
   ~300px invisible block that crushes the message list to ~160px. */
#gb-chat-contact.gb-chat-hidden{display:none}

/* Phone layout: the 67px bottom nav owns the last row, so the launcher sits
   clear above it and the panel opens into the space that is left. */
@media (max-width:767.98px){#gb-chat-widget{right:12px;bottom:calc(74px + env(safe-area-inset-bottom,0px))}#gb-chat-btn{width:46px;height:46px;font-size:19px}#gb-chat-panel{right:-4px;bottom:56px;height:calc(100vh - 160px);max-height:calc(100vh - 160px)}}
