.wasa-widget-root {
  --wasa-bg: #ffffff;
  --wasa-text: #162033;
  --wasa-muted: #6f7c90;
  --wasa-line: #e8edf4;
  --wasa-accent: #111827;
  --wasa-soft: #f5f7fb;
  position: fixed;
  right: 22px;
  bottom: 22px;
  z-index: 999999;
  font-family: Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  color: var(--wasa-text);
}

.wasa-widget-root * { box-sizing: border-box; }

.wasa-launcher {
  display: flex;
  align-items: center;
  gap: 10px;
  border: 0;
  border-radius: 999px;
  padding: 14px 18px;
  background: var(--wasa-accent);
  color: #fff;
  box-shadow: 0 16px 45px rgba(15, 23, 42, .24);
  cursor: pointer;
  font-weight: 700;
  font-size: 14px;
}

.wasa-launcher-icon { font-size: 18px; }
.wasa-unread { min-width: 20px; height: 20px; padding: 0 6px; border-radius: 999px; background: #ef4444; color: #fff; font-size: 11px; line-height: 20px; }

.wasa-chat-panel {
  position: absolute;
  right: 0;
  bottom: 64px;
  width: min(390px, calc(100vw - 28px));
  height: min(650px, calc(100vh - 110px));
  background: var(--wasa-bg);
  border: 1px solid rgba(226,232,240,.85);
  border-radius: 22px;
  box-shadow: 0 28px 80px rgba(15,23,42,.24);
  overflow: hidden;
}

.wasa-chat-header {
  height: 78px;
  padding: 16px 18px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  background: linear-gradient(135deg, #111827, #273449);
  color: #fff;
}

.wasa-chat-title { font-weight: 800; font-size: 17px; }
.wasa-chat-status { display: flex; gap: 7px; align-items: center; margin-top: 5px; font-size: 12px; color: rgba(255,255,255,.78); }
.wasa-status-dot { width: 8px; height: 8px; border-radius: 50%; background: #4ade80; box-shadow: 0 0 0 3px rgba(74,222,128,.16); }
.wasa-close { width: 34px; height: 34px; border: 0; border-radius: 50%; background: rgba(255,255,255,.1); color: #fff; font-size: 24px; line-height: 30px; cursor: pointer; }

.wasa-context-card {
  margin: 12px 14px 0;
  padding: 11px 13px;
  border-radius: 14px;
  background: #f8fafc;
  border: 1px solid #edf1f6;
}
.wasa-context-label { display: block; color: var(--wasa-muted); font-size: 11px; margin-bottom: 3px; }
.wasa-context-card strong { display: block; font-size: 13px; line-height: 1.35; }

.wasa-messages {
  height: calc(100% - 78px - 54px - 64px - 28px);
  min-height: 220px;
  overflow-y: auto;
  padding: 16px 14px;
  background: #fff;
}

.wasa-message { display: flex; margin-bottom: 10px; }
.wasa-message-visitor { justify-content: flex-end; }
.wasa-message-system, .wasa-message-operator { justify-content: flex-start; }

.wasa-bubble {
  max-width: 82%;
  padding: 10px 12px;
  border-radius: 14px;
  background: var(--wasa-soft);
  line-height: 1.45;
  font-size: 14px;
  white-space: pre-wrap;
}
.wasa-message-visitor .wasa-bubble { background: #111827; color: #fff; border-bottom-right-radius: 5px; }
.wasa-message-operator .wasa-bubble { background: #eef6ff; border-bottom-left-radius: 5px; }
.wasa-message-system .wasa-bubble { color: #4b5563; font-size: 13px; }
.wasa-bubble-error { background: #fff1f2 !important; color: #be123c !important; }

.wasa-quick-actions {
  display: flex;
  gap: 7px;
  overflow-x: auto;
  padding: 8px 12px 6px;
  border-top: 1px solid var(--wasa-line);
  background: #fff;
}
.wasa-quick-actions button { flex: 0 0 auto; border: 1px solid var(--wasa-line); border-radius: 999px; background: #fff; padding: 8px 10px; font-size: 12px; cursor: pointer; color: #334155; }

.wasa-composer { display: flex; gap: 9px; align-items: flex-end; padding: 9px 12px; border-top: 1px solid var(--wasa-line); background: #fff; }
.wasa-composer textarea { flex: 1; resize: none; min-height: 42px; max-height: 110px; border: 1px solid #dde4ee; border-radius: 14px; padding: 11px 12px; outline: none; font: inherit; font-size: 14px; }
.wasa-composer textarea:focus { border-color: #a7b0bf; box-shadow: 0 0 0 3px rgba(15,23,42,.05); }
.wasa-send { width: 42px; height: 42px; border: 0; border-radius: 13px; background: #111827; color: #fff; font-size: 17px; cursor: pointer; }
.wasa-footer-note { padding: 0 12px 10px; text-align: center; color: #94a3b8; font-size: 10px; background: #fff; }

@media (max-width: 600px) {
  .wasa-widget-root { right: 12px; bottom: 12px; }
  .wasa-launcher-text { display: none; }
  .wasa-launcher { width: 54px; height: 54px; justify-content: center; padding: 0; }
  .wasa-chat-panel { position: fixed; left: 8px; right: 8px; bottom: 8px; width: auto; height: calc(100vh - 16px); max-height: none; border-radius: 18px; }
  .wasa-widget-root.is-open .wasa-launcher { display: none; }
  .wasa-messages { height: calc(100% - 78px - 54px - 64px - 28px); }
}
.wasa-send:disabled,
.wasa-composer textarea:disabled,
.wasa-quick-actions button:disabled { opacity:.55; cursor:not-allowed; }

/* Keep storefront theme button styles from bleeding into the assistant widget. */
#wasa-widget-root .wasa-quick-actions {
  scrollbar-width:none;
}
#wasa-widget-root .wasa-quick-actions::-webkit-scrollbar { display:none; }
#wasa-widget-root .wasa-quick-actions button {
  appearance:none !important;
  -webkit-appearance:none !important;
  background:#fff !important;
  color:#334155 !important;
  border:1px solid #e8edf4 !important;
  border-radius:999px !important;
  padding:8px 11px !important;
  min-height:34px !important;
  font:600 12px/1.2 Inter, ui-sans-serif, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif !important;
  text-transform:none !important;
  letter-spacing:normal !important;
  box-shadow:none !important;
}
#wasa-widget-root .wasa-quick-actions button:hover {
  background:#f8fafc !important;
  border-color:#d8e0ea !important;
}
#wasa-widget-root .wasa-send {
  appearance:none !important;
  -webkit-appearance:none !important;
  background:#111827 !important;
  color:#fff !important;
  border:0 !important;
  padding:0 !important;
  text-transform:none !important;
  letter-spacing:normal !important;
  box-shadow:none !important;
}

/* v0.1.4 realtime connection state */
#wasa-widget-root .wasa-footer-note {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
}
#wasa-widget-root .wasa-live-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #22c55e;
  flex: 0 0 auto;
}
#wasa-widget-root.wasa-connection-warn .wasa-live-dot { background: #f59e0b; }
#wasa-widget-root.wasa-connection-error .wasa-live-dot { background: #ef4444; }
