/* WP Claw Connector — Widget Styles */

:root {
  --wpclaw-primary: #1a1a2e;
  --wpclaw-accent:  #e94560;
  --wpclaw-bg:      #ffffff;
  --wpclaw-text:    #2d3748;
  --wpclaw-muted:   #718096;
  --wpclaw-border:  #e2e8f0;
  --wpclaw-user-bg: var(--wpclaw-accent);
  --wpclaw-bot-bg:  #f7fafc;
  --wpclaw-radius:  14px;
  --wpclaw-shadow:  0 20px 60px rgba(0,0,0,0.18), 0 4px 16px rgba(0,0,0,0.10);
}

/* ─── Bubble Button ─────────────────────────────────────────────────────── */
#wpclaw-bubble-root {
  position: fixed;
  z-index: 99999;
}

.wpclaw-fab {
  position: fixed;
  bottom: 24px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--wpclaw-primary);
  color: #fff;
  border: none;
  cursor: pointer;
  box-shadow: 0 4px 20px rgba(0,0,0,0.25);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 26px;
  transition: transform .2s ease, box-shadow .2s ease;
  outline: none;
}
.wpclaw-fab:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 28px rgba(0,0,0,0.32);
}
.wpclaw-fab.position-bottom-right { right: 24px; }
.wpclaw-fab.position-bottom-left  { left:  24px; }

.wpclaw-fab .wpclaw-fab-badge {
  position: absolute;
  top: 0; right: 0;
  width: 14px; height: 14px;
  background: var(--wpclaw-accent);
  border-radius: 50%;
  border: 2px solid #fff;
  animation: wpclaw-pulse 2s infinite;
}

@keyframes wpclaw-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.3); }
}

/* ─── Chat Window ───────────────────────────────────────────────────────── */
.wpclaw-window {
  position: fixed;
  bottom: 96px;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--wpclaw-bg);
  border-radius: var(--wpclaw-radius);
  box-shadow: var(--wpclaw-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  border: 1px solid var(--wpclaw-border);
  z-index: 99998;
  transform: translateY(16px) scale(0.97);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s ease;
}
.wpclaw-window.open {
  transform: translateY(0) scale(1);
  opacity: 1;
  pointer-events: all;
}
.wpclaw-window.position-bottom-right { right: 24px; }
.wpclaw-window.position-bottom-left  { left:  24px; }

/* Inline mode */
.wpclaw-inline > .wpclaw-window {
  position: relative;
  bottom: auto; right: auto; left: auto;
  width: 100%;
  opacity: 1;
  pointer-events: all;
  transform: none;
  box-shadow: 0 4px 24px rgba(0,0,0,0.10);
}

/* ─── Header ────────────────────────────────────────────────────────────── */
.wpclaw-header {
  background: var(--wpclaw-primary);
  color: #fff;
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.wpclaw-header-avatar {
  width: 36px; height: 36px;
  background: var(--wpclaw-accent);
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.wpclaw-header-info { flex: 1; min-width: 0; }
.wpclaw-header-title {
  font-weight: 700;
  font-size: 14px;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.wpclaw-header-status {
  font-size: 11px;
  color: rgba(255,255,255,.65);
  display: flex;
  align-items: center;
  gap: 4px;
}
.wpclaw-status-dot {
  width: 6px; height: 6px;
  background: #48bb78;
  border-radius: 50%;
  display: inline-block;
}
.wpclaw-close-btn {
  background: none;
  border: none;
  color: rgba(255,255,255,.7);
  cursor: pointer;
  font-size: 20px;
  line-height: 1;
  padding: 0 2px;
  transition: color .15s;
  flex-shrink: 0;
}
.wpclaw-close-btn:hover { color: #fff; }

/* ─── Messages ──────────────────────────────────────────────────────────── */
.wpclaw-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  min-height: 260px;
  max-height: 340px;
  scroll-behavior: smooth;
}
.wpclaw-inline > .wpclaw-window .wpclaw-messages {
  max-height: var(--wpclaw-inline-height, 340px);
}

.wpclaw-messages::-webkit-scrollbar { width: 4px; }
.wpclaw-messages::-webkit-scrollbar-thumb { background: var(--wpclaw-border); border-radius: 4px; }

.wpclaw-msg {
  display: flex;
  gap: 8px;
  max-width: 88%;
  animation: wpclaw-msg-in .2s ease;
}
@keyframes wpclaw-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wpclaw-msg.user  { margin-left: auto; flex-direction: row-reverse; }
.wpclaw-msg.bot   { margin-right: auto; }

.wpclaw-msg-avatar {
  width: 28px; height: 28px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 14px;
  flex-shrink: 0;
  background: var(--wpclaw-primary);
  color: #fff;
  margin-top: 2px;
}
.wpclaw-msg.user .wpclaw-msg-avatar { background: var(--wpclaw-accent); }

.wpclaw-msg-bubble {
  padding: 9px 13px;
  border-radius: 12px;
  font-size: 13.5px;
  line-height: 1.5;
  color: var(--wpclaw-text);
  background: var(--wpclaw-bot-bg);
  border: 1px solid var(--wpclaw-border);
  word-break: break-word;
}
.wpclaw-msg.user .wpclaw-msg-bubble {
  background: var(--wpclaw-accent);
  color: #fff;
  border-color: var(--wpclaw-accent);
}

/* Typing indicator */
.wpclaw-typing .wpclaw-msg-bubble {
  display: flex;
  gap: 4px;
  align-items: center;
  padding: 12px 14px;
}
.wpclaw-dot {
  width: 6px; height: 6px;
  border-radius: 50%;
  background: var(--wpclaw-muted);
  animation: wpclaw-bounce .9s infinite;
}
.wpclaw-dot:nth-child(2) { animation-delay: .15s; }
.wpclaw-dot:nth-child(3) { animation-delay: .30s; }
@keyframes wpclaw-bounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-5px); }
}

/* ─── Input ─────────────────────────────────────────────────────────────── */
.wpclaw-input-area {
  display: flex;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--wpclaw-border);
  background: #fafafa;
  flex-shrink: 0;
}

.wpclaw-input {
  flex: 1;
  border: 1px solid var(--wpclaw-border);
  border-radius: 22px;
  padding: 9px 16px;
  font-size: 13.5px;
  outline: none;
  resize: none;
  font-family: inherit;
  line-height: 1.4;
  background: #fff;
  color: var(--wpclaw-text);
  transition: border-color .15s;
  max-height: 96px;
  overflow-y: auto;
}
.wpclaw-input:focus { border-color: var(--wpclaw-primary); }

.wpclaw-send-btn {
  width: 38px; height: 38px;
  border-radius: 50%;
  background: var(--wpclaw-accent);
  color: #fff;
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .15s, transform .1s;
  align-self: flex-end;
}
.wpclaw-send-btn:hover   { background: var(--wpclaw-primary); }
.wpclaw-send-btn:active  { transform: scale(.93); }
.wpclaw-send-btn:disabled { opacity: .45; cursor: not-allowed; }

/* ─── Footer branding ───────────────────────────────────────────────────── */
.wpclaw-footer {
  text-align: center;
  padding: 6px 0 8px;
  font-size: 10.5px;
  color: var(--wpclaw-muted);
  background: #fafafa;
  border-top: 1px solid var(--wpclaw-border);
}
.wpclaw-footer a { color: var(--wpclaw-accent); text-decoration: none; }

/* ─── Responsive ────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  .wpclaw-window {
    width: calc(100vw - 16px);
    bottom: 84px;
    right: 8px !important;
    left: 8px !important;
  }
  .wpclaw-fab.position-bottom-right { right: 16px; }
  .wpclaw-fab.position-bottom-left  { left:  16px; }
}
