/* Big Blue support chat widget — shared across thebigblue.app and
   thebigblueapp.com. Self-contained: all tokens are scoped under .bb-chat* so
   nothing here leaks into the host page. Dark theme to match both sites. */

:root {
  --bb-chat-blue: #2f6bff;
  --bb-chat-blue-hi: #4d82ff;
  --bb-chat-bg: #0d1526;
  --bb-chat-panel: #111a2e;
  --bb-chat-line: #23304d;
  --bb-chat-text: #eef2fb;
  --bb-chat-muted: #93a1bd;
  --bb-chat-bubble-in: #1b2740;
}

/* Floating launcher button */
.bb-chat-launcher {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 12px 18px;
  border: none;
  border-radius: 999px;
  background: var(--bb-chat-blue);
  color: #fff;
  font: 600 15px/1 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  cursor: pointer;
  box-shadow: 0 8px 24px rgba(47, 107, 255, 0.4);
  transition: transform 0.15s ease, background 0.15s ease;
}
.bb-chat-launcher:hover { background: var(--bb-chat-blue-hi); transform: translateY(-1px); }
.bb-chat-launcher svg { width: 20px; height: 20px; display: block; }
.bb-chat-launcher[hidden] { display: none; }

/* Chat panel */
.bb-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 2147483000;
  display: flex;
  flex-direction: column;
  width: 360px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 100px);
  background: var(--bb-chat-panel);
  color: var(--bb-chat-text);
  border: 1px solid var(--bb-chat-line);
  border-radius: 16px;
  overflow: hidden;
  box-shadow: 0 20px 60px rgba(0, 0, 0, 0.5);
  font-family: system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
}
.bb-chat-panel[hidden] { display: none; }

.bb-chat-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 14px 16px;
  background: linear-gradient(135deg, var(--bb-chat-blue), #1b4fd8);
  color: #fff;
}
.bb-chat-header h3 { margin: 0; font-size: 15px; font-weight: 700; }
.bb-chat-header p { margin: 2px 0 0; font-size: 12px; opacity: 0.85; }
.bb-chat-close {
  border: none;
  background: transparent;
  color: #fff;
  font-size: 22px;
  line-height: 1;
  cursor: pointer;
  padding: 4px;
  opacity: 0.9;
}
.bb-chat-close:hover { opacity: 1; }

/* Pre-chat intro (name/email), shown only before a ticket exists */
.bb-chat-intro {
  padding: 14px 16px;
  border-bottom: 1px solid var(--bb-chat-line);
  display: grid;
  gap: 8px;
}
.bb-chat-intro label { font-size: 12px; color: var(--bb-chat-muted); }
.bb-chat-intro input {
  width: 100%;
  padding: 9px 11px;
  border-radius: 9px;
  border: 1px solid var(--bb-chat-line);
  background: var(--bb-chat-bg);
  color: var(--bb-chat-text);
  font-size: 14px;
  box-sizing: border-box;
}
.bb-chat-intro input:focus { outline: none; border-color: var(--bb-chat-blue); }
.bb-chat-intro[hidden] { display: none; }

/* Message list */
.bb-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 14px 16px;
  display: flex;
  flex-direction: column;
  gap: 10px;
}
.bb-chat-empty {
  margin: auto;
  text-align: center;
  color: var(--bb-chat-muted);
  font-size: 13px;
  line-height: 1.5;
  padding: 0 12px;
}
.bb-chat-msg {
  max-width: 82%;
  padding: 9px 12px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.45;
  white-space: pre-wrap;
  word-wrap: break-word;
}
.bb-chat-msg.customer {
  align-self: flex-end;
  background: var(--bb-chat-blue);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.bb-chat-msg.team {
  align-self: flex-start;
  background: var(--bb-chat-bubble-in);
  color: var(--bb-chat-text);
  border-bottom-left-radius: 4px;
}
.bb-chat-msg .bb-chat-meta {
  display: block;
  margin-top: 4px;
  font-size: 10px;
  opacity: 0.6;
}

/* Composer */
.bb-chat-composer {
  display: flex;
  gap: 8px;
  padding: 12px;
  border-top: 1px solid var(--bb-chat-line);
  background: var(--bb-chat-bg);
}
.bb-chat-composer textarea {
  flex: 1;
  resize: none;
  height: 40px;
  max-height: 96px;
  padding: 9px 12px;
  border-radius: 10px;
  border: 1px solid var(--bb-chat-line);
  background: var(--bb-chat-panel);
  color: var(--bb-chat-text);
  font: 14px/1.4 system-ui, -apple-system, "Segoe UI", Roboto, sans-serif;
  box-sizing: border-box;
}
.bb-chat-composer textarea:focus { outline: none; border-color: var(--bb-chat-blue); }
.bb-chat-send {
  border: none;
  border-radius: 10px;
  background: var(--bb-chat-blue);
  color: #fff;
  padding: 0 16px;
  font-weight: 600;
  font-size: 14px;
  cursor: pointer;
}
.bb-chat-send:hover { background: var(--bb-chat-blue-hi); }
.bb-chat-send:disabled { opacity: 0.5; cursor: default; }

.bb-chat-status {
  padding: 6px 16px;
  font-size: 11px;
  color: var(--bb-chat-muted);
  border-top: 1px solid var(--bb-chat-line);
  background: var(--bb-chat-bg);
}
.bb-chat-status[hidden] { display: none; }

/* Attach button — sits between the textarea and Send */
.bb-chat-attach {
  border: 1px solid var(--bb-chat-line);
  border-radius: 10px;
  background: var(--bb-chat-panel);
  color: var(--bb-chat-muted);
  width: 40px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
}
.bb-chat-attach:hover { color: var(--bb-chat-text); border-color: var(--bb-chat-blue); }
.bb-chat-attach:disabled { opacity: 0.5; cursor: default; }
.bb-chat-attach svg { width: 18px; height: 18px; display: block; }

/* Selected-file chip shown above the composer until sent */
.bb-chat-filechip {
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 0 12px 8px;
  padding: 7px 10px;
  border: 1px solid var(--bb-chat-line);
  border-radius: 10px;
  background: var(--bb-chat-bg);
  font-size: 12.5px;
  color: var(--bb-chat-text);
}
.bb-chat-filechip[hidden] { display: none; }
.bb-chat-filechip-name { flex: 1; min-width: 0; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.bb-chat-filechip-size { color: var(--bb-chat-muted); flex-shrink: 0; }
.bb-chat-filechip-x {
  border: none;
  background: transparent;
  color: var(--bb-chat-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  padding: 0 2px;
  flex-shrink: 0;
}
.bb-chat-filechip-x:hover { color: var(--bb-chat-text); }

/* Attachments inside message bubbles */
.bb-chat-att-img {
  display: block;
  max-width: 100%;
  max-height: 160px;
  border-radius: 10px;
  margin-bottom: 4px;
}
.bb-chat-att-file {
  display: inline-block;
  margin-bottom: 4px;
  color: inherit;
  text-decoration: underline;
  word-break: break-all;
  font-size: 13.5px;
}

/* Unread badge on the launcher bubble */
.bb-chat-badge {
  position: absolute;
  top: -6px;
  right: -6px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border-radius: 999px;
  background: #ff4d5e;
  color: #fff;
  font-size: 11px;
  font-weight: 700;
  line-height: 20px;
  text-align: center;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.4);
}
.bb-chat-badge[hidden] { display: none; }
.bb-chat-launcher { position: fixed; } /* anchor for the badge */

@media (max-width: 480px) {
  .bb-chat-panel { right: 8px; bottom: 8px; height: calc(100vh - 80px); }
  .bb-chat-launcher { right: 12px; bottom: 12px; }
}
