/* Store chat bubble (components/client/ChatWidget.js): bottom right, opposite the WhatsApp and call buttons */
.chat-fab { position: fixed; z-index: 26; bottom: calc(18px + env(safe-area-inset-bottom, 0px)); right: calc(18px + env(safe-area-inset-right, 0px)); width: 56px; height: 56px; border: 0; border-radius: 50%; background: var(--navy); color: #fff; display: grid; place-items: center; cursor: pointer; box-shadow: 0 6px 20px rgba(0, 0, 0, .22); }
.chat-fab svg { width: 28px; height: 28px; }
.chat-fab:hover { background: #13325c; }
.chat-fab:focus-visible { outline: 3px solid var(--amber); outline-offset: 3px; }
.chat-badge { position: absolute; top: -4px; left: -4px; min-width: 22px; height: 22px; padding: 0 6px; border-radius: 11px; background: var(--amber); color: var(--ink); font: 700 13px/22px "IBM Plex Mono", monospace; border: 2px solid #fff; }
body:has(.sticky-buy) .chat-fab, body:has(.cmpbar) .chat-fab { bottom: calc(90px + env(safe-area-inset-bottom, 0px)); }

.chat-panel { position: fixed; z-index: 45; right: calc(18px + env(safe-area-inset-right, 0px)); bottom: calc(86px + env(safe-area-inset-bottom, 0px)); width: 370px; height: min(540px, calc(100dvh - 120px)); display: flex; flex-direction: column; background: var(--surface); border: 1px solid var(--line); border-radius: 18px; overflow: hidden; box-shadow: 0 24px 60px rgba(11, 37, 69, .28); }
body:has(.sticky-buy) .chat-panel, body:has(.cmpbar) .chat-panel { bottom: calc(158px + env(safe-area-inset-bottom, 0px)); height: min(540px, calc(100dvh - 190px)); }
.chat-head { display: flex; align-items: center; gap: 10px; padding: 14px 16px; background: var(--navy); color: #fff; }
.chat-head div { display: grid; flex: 1; min-width: 0; }
.chat-head b { font-family: "Readex Pro", sans-serif; font-size: 16px; }
.chat-head span { color: #b9c7dc; font-size: 12.5px; }
.chat-dot { flex: none; width: 10px; height: 10px; border-radius: 50%; background: #34c06f; box-shadow: 0 0 0 4px rgba(52, 192, 111, .22); }
.chat-x { flex: none; width: 36px; height: 36px; display: grid; place-items: center; border: 0; border-radius: 10px; background: rgba(255, 255, 255, .08); color: #fff; cursor: pointer; }
.chat-x svg { width: 18px; height: 18px; }
.chat-x:hover { background: rgba(255, 255, 255, .16); }

.chat-body { flex: 1; overflow-y: auto; overscroll-behavior: contain; display: flex; flex-direction: column; gap: 8px; padding: 16px; background: linear-gradient(180deg, #f7fbff, var(--blue-soft)); }
.chat-msg { max-width: 82%; margin: 0; padding: 9px 12px 6px; border-radius: 14px; font-size: 14.5px; line-height: 1.6; white-space: pre-wrap; overflow-wrap: anywhere; }
.chat-msg time { display: block; margin-top: 2px; font-size: 11px; opacity: .65; }
.chat-msg.customer { align-self: flex-start; background: var(--blue); color: #fff; border-start-start-radius: 4px; }
.chat-msg.admin { align-self: flex-end; background: #fff; color: var(--ink); border: 1px solid var(--line); border-start-end-radius: 4px; }
.chat-note { margin: 4px 0 0; color: var(--muted); font-size: 12.5px; text-align: center; }
.chat-note a { color: var(--blue); font-weight: 600; }

.chat-form { display: grid; gap: 8px; padding: 10px 12px; border-top: 1px solid var(--line); background: var(--surface); }
.chat-who { display: grid; grid-template-columns: 1fr 1fr; gap: 8px; }
.chat-who input, .chat-send textarea { width: 100%; min-width: 0; padding: 9px 12px; border: 1px solid var(--line); border-radius: 12px; background: #fff; color: var(--ink); font: inherit; font-size: 15px; }
.chat-who input:focus, .chat-send textarea:focus { outline: 2px solid var(--blue); outline-offset: -1px; border-color: transparent; }
.chat-send { display: flex; gap: 8px; align-items: flex-end; }
.chat-send textarea { resize: none; max-height: 110px; field-sizing: content; }
.chat-send button { flex: none; width: 44px; height: 42px; display: grid; place-items: center; border: 0; border-radius: 12px; background: var(--blue); color: #fff; cursor: pointer; }
.chat-send button:disabled { background: #b9c7dc; cursor: default; }
.chat-send button svg { width: 20px; height: 20px; }
.chat-err { margin: 0; color: #c0392b; font-size: 13px; }
.chat-hp { position: absolute; width: 1px; height: 1px; opacity: 0; pointer-events: none; }

@media (max-width: 760px) {
  .chat-fab { bottom: calc(78px + env(safe-area-inset-bottom, 0px)); width: 50px; height: 50px; }
  body:has(.sticky-buy) .chat-fab, body:has(.cmpbar) .chat-fab { bottom: calc(146px + env(safe-area-inset-bottom, 0px)); }
  .chat-panel, body:has(.sticky-buy) .chat-panel, body:has(.cmpbar) .chat-panel { z-index: 60; inset: 8px 8px calc(8px + env(safe-area-inset-bottom, 0px)); width: auto; height: auto; }
  .chat-who input, .chat-send textarea { font-size: 16px; }
}
