/* ═══════════════════════════════════════
   WooCommerce Live Chat – Widget Styles
═══════════════════════════════════════ */
#wlc-widget {
  --wlc-brand: #2563eb;
  --wlc-radius: 16px;
  --wlc-shadow: 0 8px 32px rgba(0,0,0,.18);
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
}

/* ── Bubble ───────────────────────────── */
#wlc-bubble {
  width: 48px; height: 48px;
  border-radius: 50%;
  background: var(--wlc-brand);
  border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: var(--wlc-shadow);
  position: relative;
  transition: transform .2s, box-shadow .2s;
  color: #fff;
}
#wlc-bubble:hover { transform: scale(1.1); box-shadow: 0 12px 40px rgba(0,0,0,.25); }
#wlc-bubble svg { width: 20px; height: 20px; }

.wlc-badge {
  position: fixed; top: -4px; right: -4px;
  background: #ef4444;
  color: #fff; font-size: 11px; font-weight: 700;
  width: 20px; height: 20px;
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid #fff;
  animation: wlc-pulse 1.4s infinite;
}
@keyframes wlc-pulse {
  0%,100% { transform: scale(1); }
  50%      { transform: scale(1.2); }
}

/* ── Window ───────────────────────────── */
#wlc-window {
  position: fixed;
  bottom: 85px; right: 16px; z-index: 99998;
  width: 360px;
  background: #fff;
  border-radius: var(--wlc-radius);
  box-shadow: var(--wlc-shadow);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: scale(.9) translateY(10px);
  opacity: 0;
  pointer-events: none;
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), opacity .2s;
  max-height: 520px;
}
#wlc-window.wlc-open {
  transform: scale(1) translateY(0);
  opacity: 1;
  pointer-events: all;
}

/* ── Header ───────────────────────────── */
#wlc-header {
  background: var(--wlc-brand);
  color: #fff;
  padding: 14px 16px;
  display: flex; align-items: center; justify-content: space-between;
}
.wlc-header-info { display: flex; align-items: center; gap: 10px; }
.wlc-avatar {
  width: 38px; height: 38px;
  background: rgba(255,255,255,.2);
  border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: 18px;
}
#wlc-header strong { display: block; font-size: 15px; }
.wlc-status { font-size: 12px; opacity: .85; display: flex; align-items: center; gap: 4px; }
.wlc-dot {
  width: 7px; height: 7px;
  background: #4ade80;
  border-radius: 50%;
  display: inline-block;
  animation: wlc-blink 2s infinite;
}
@keyframes wlc-blink { 0%,100%{opacity:1} 50%{opacity:.4} }
#wlc-close-btn {
  background: none; border: none; color: #fff;
  font-size: 18px; cursor: pointer; opacity: .8; line-height:1;
  padding: 4px;
}
#wlc-close-btn:hover { opacity: 1; }

/* ── Messages ─────────────────────────── */
#wlc-messages {
  flex: 1; overflow-y: auto;
  padding: 14px 14px 6px;
  display: flex; flex-direction: column; gap: 8px;
  scroll-behavior: smooth;
}
.wlc-msg { display: flex; }
.wlc-msg--visitor { justify-content: flex-end; }
.wlc-msg--admin   { justify-content: flex-start; }
.wlc-bubble {
  max-width: 76%;
  padding: 9px 13px;
  border-radius: 14px;
  font-size: 14px; line-height: 1.5;
  word-break: break-word;
}
.wlc-msg--visitor .wlc-bubble {
  background: var(--wlc-brand);
  color: #fff;
  border-bottom-right-radius: 4px;
}
.wlc-msg--admin .wlc-bubble {
  background: #f1f5f9;
  color: #1e293b;
  border-bottom-left-radius: 4px;
}
.wlc-time { font-size: 10px; opacity: .5; margin-top: 3px; text-align: right; }

/* ── Input area ───────────────────────── */
#wlc-input-area {
  border-top: 1px solid #e2e8f0;
  padding: 10px;
  background: #fafafa;
}
.wlc-name-row { margin-bottom: 6px; }
#wlc-visitor-name {
  width: 100%; box-sizing: border-box;
  border: 1px solid #e2e8f0; border-radius: 8px;
  padding: 7px 10px; font-size: 13px;
  outline: none;
}
#wlc-visitor-name:focus { border-color: var(--wlc-brand); }

.wlc-input-row { display: flex; gap: 8px; align-items: flex-end; }
#wlc-input {
  flex: 1; resize: none;
  border: 1px solid #e2e8f0; border-radius: 10px;
  padding: 9px 12px; font-size: 14px; font-family: inherit;
  outline: none; max-height: 100px; overflow-y: auto;
  transition: border-color .15s;
}
#wlc-input:focus { border-color: var(--wlc-brand); }
#wlc-send-btn {
  width: 40px; height: 40px; flex-shrink: 0;
  background: var(--wlc-brand);
  border: none; border-radius: 10px;
  color: #fff; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .15s;
}
#wlc-send-btn:hover { opacity: .85; }
#wlc-send-btn svg { width: 18px; height: 18px; }

/* ── Typing indicator ─────────────────── */
.wlc-typing .wlc-bubble { padding: 12px 14px; }
.wlc-typing-dots span {
  display: inline-block;
  width: 6px; height: 6px;
  background: #94a3b8;
  border-radius: 50%;
  animation: wlc-dot-bounce .9s infinite ease-in-out;
}
.wlc-typing-dots span:nth-child(2) { animation-delay: .15s; }
.wlc-typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes wlc-dot-bounce {
  0%,100% { transform: translateY(0); }
  40%     { transform: translateY(-5px); }
}

/* ── Scrollbar ────────────────────────── */
#wlc-messages::-webkit-scrollbar { width: 4px; }
#wlc-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

/* ── Mobile ───────────────────────────── */
@media (max-width: 420px) {
  #wlc-window { width: calc(100vw - 32px); right: 0; }
  #wlc-widget { bottom: 16px; right: 16px; }
}

/* ── System / error messages ──────────────────────────────── */
.wlc-msg--system { justify-content: center; }
.wlc-bubble--system {
  background: #fee2e2;
  color: #991b1b;
  font-size: 12px;
  border-radius: 8px;
  padding: 6px 12px;
  max-width: 90%;
  text-align: center;
}

/* ── External nav integration ─────────────────────────────── */
/* Hide default bubble when .webantam-nav exists on the page   */
.webantam-nav ~ * #wlc-bubble,
body.has-webantam-nav #wlc-bubble {
  display: none !important;
}




/* External nav badge counter */
#wlc-ext-badge {
  position: fixed;
  top: -4px; right: -4px;
  background: #ef4444;
  color: #fff;
  font-size: 10px; font-weight: 700;
  width: 18px; height: 18px;
  border-radius: 50%;
  display: none;
  align-items: center; justify-content: center;
  border: 2px solid #fff;
  animation: wlc-pulse 1.4s infinite;
  pointer-events: none;
}

/* ── Mobile window (fixed, full-width, above nav bar) ─────── */
@media (max-width: 600px) {
  #wlc-window {
    left: 8px;
    right: 8px;
    width: auto;
    bottom: 78px;
    max-height: calc(100dvh - 100px);
  }
}
