/* ── WC Order Chatbot ─────────────────────────────────────────── */

@import url('https://fonts.googleapis.com/css2?family=DM+Sans:wght@400;500;600&display=swap');

:root {
  --wcocb-accent:   #1a1a2e;
  --wcocb-accent2:  #e94560;
  --wcocb-bg:       #ffffff;
  --wcocb-surface:  #f7f8fc;
  --wcocb-border:   #e5e7ef;
  --wcocb-text:     #1a1a2e;
  --wcocb-muted:    #7b7f9e;
  --wcocb-radius:   18px;
  --wcocb-shadow:   0 20px 60px rgba(26,26,46,.18), 0 4px 16px rgba(26,26,46,.10);
  --wcocb-font:     'DM Sans', sans-serif;
  --wcocb-w:        360px;
  --wcocb-h:        500px;
}

/* ── Wrapper ─────────────────── */
#wcocb-wrapper {
  position: fixed;
  bottom: 103px;
  right: 23px;
  z-index: 99999;
  font-family: var(--wcocb-font);
}

/* ── Launcher bubble ─────────── */
#wcocb-launcher {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: linear-gradient(135deg, var(--wcocb-accent) 0%, #16213e 100%);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 8px 28px rgba(26,26,46,.35);
  transition: transform .25s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  margin-left: auto;
  position: relative;
}
#wcocb-launcher:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 36px rgba(26,26,46,.4);
}
#wcocb-launcher svg {
  width: 24px; height: 24px;
  color: #fff;
}
.wcocb-icon-chat,
.wcocb-icon-close {
  position: absolute;
  top: 50%; left: 50%;
  transform: translate(-50%, -50%) scale(1);
  display: flex; align-items: center; justify-content: center;
  transition: opacity .2s, transform .2s;
}
.wcocb-icon-chat  { opacity: 1; }
.wcocb-icon-close { opacity: 0; transform: translate(-50%, -50%) scale(.5); }

#wcocb-wrapper.open .wcocb-icon-chat  { opacity: 0; transform: translate(-50%, -50%) scale(.5); }
#wcocb-wrapper.open .wcocb-icon-close { opacity: 1; transform: translate(-50%, -50%) scale(1);  }

/* pulse ring on launcher when closed */
#wcocb-launcher::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid rgba(233,69,96,.5);
  animation: wcocb-pulse 2.4s ease-out infinite;
}
#wcocb-wrapper.open #wcocb-launcher::after { display: none; }

@keyframes wcocb-pulse {
  0%   { transform: scale(1);   opacity: .8; }
  70%  { transform: scale(1.5); opacity: 0;  }
  100% { transform: scale(1);   opacity: 0;  }
}

/* ── Chat window ─────────────── */
#wcocb-window {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: var(--wcocb-w);
  height: var(--wcocb-h);
  background: var(--wcocb-bg);
  border-radius: var(--wcocb-radius);
  box-shadow: var(--wcocb-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.95);
  pointer-events: none;
  transition: opacity .28s cubic-bezier(.4,0,.2,1),
              transform .28s cubic-bezier(.34,1.4,.64,1);
}
#wcocb-wrapper.open #wcocb-window {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* ── Header ──────────────────── */
#wcocb-header {
  background: linear-gradient(135deg, var(--wcocb-accent) 0%, #16213e 100%);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  font-weight: 600;
  font-size: 15px;
  letter-spacing: .02em;
  flex-shrink: 0;
}
.wcocb-header-dot {
  width: 9px; height: 9px;
  border-radius: 50%;
  background: #4ade80;
  box-shadow: 0 0 0 2px rgba(74,222,128,.3);
  animation: wcocb-blink 2s ease-in-out infinite;
}
@keyframes wcocb-blink {
  0%,100% { opacity: 1; }
  50%      { opacity: .4; }
}

/* ── Message list ────────────── */
#wcocb-messages {
  flex: 1;
  overflow-y: auto;
  padding: 20px 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
  background: var(--wcocb-surface);
}
#wcocb-messages::-webkit-scrollbar { width: 4px; }
#wcocb-messages::-webkit-scrollbar-track { background: transparent; }
#wcocb-messages::-webkit-scrollbar-thumb { background: var(--wcocb-border); border-radius: 4px; }

/* ── Bubbles ─────────────────── */
.wcocb-bubble {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  animation: wcocb-pop .22s cubic-bezier(.34,1.56,.64,1) both;
}
@keyframes wcocb-pop {
  from { opacity: 0; transform: scale(.88) translateY(6px); }
  to   { opacity: 1; transform: scale(1)   translateY(0);   }
}

.wcocb-bubble.bot {
  background: #fff;
  color: var(--wcocb-text);
  border: 1px solid var(--wcocb-border);
  border-bottom-left-radius: 4px;
  align-self: flex-start;
  box-shadow: 0 1px 4px rgba(0,0,0,.06);
}
.wcocb-bubble.user {
  background: linear-gradient(135deg, var(--wcocb-accent) 0%, #16213e 100%);
  color: #fff;
  border-bottom-right-radius: 4px;
  align-self: flex-end;
}

/* ── Order card inside bubble ── */
.wcocb-order-card {
  background: #fff;
  border: 1px solid var(--wcocb-border);
  border-radius: 12px;
  padding: 14px 16px;
  font-size: 13.5px;
  align-self: flex-start;
  max-width: 88%;
  box-shadow: 0 2px 8px rgba(0,0,0,.07);
  animation: wcocb-pop .22s cubic-bezier(.34,1.56,.64,1) both;
}
.wcocb-order-card .wcocb-order-title {
  font-weight: 600;
  font-size: 14.5px;
  margin-bottom: 10px;
  color: var(--wcocb-text);
}
.wcocb-order-card .wcocb-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 5px 0;
  border-bottom: 1px solid var(--wcocb-border);
  color: var(--wcocb-text);
  gap: 12px;
}
.wcocb-order-card .wcocb-row:last-child { border-bottom: none; }
.wcocb-row .wcocb-label {
  color: var(--wcocb-muted);
  font-size: 12.5px;
  white-space: nowrap;
}
.wcocb-row .wcocb-value { font-weight: 500; text-align: right; }

/* Status badge */
.wcocb-badge {
  display: inline-block;
  padding: 3px 10px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
  letter-spacing: .02em;
}
.wcocb-badge.green  { background: #dcfce7; color: #15803d; }
.wcocb-badge.blue   { background: #dbeafe; color: #1d4ed8; }
.wcocb-badge.orange { background: #ffedd5; color: #c2410c; }
.wcocb-badge.red    { background: #fee2e2; color: #b91c1c; }
.wcocb-badge.yellow { background: #fef9c3; color: #854d0e; }
.wcocb-badge.purple { background: #f3e8ff; color: #7e22ce; }
.wcocb-badge.grey   { background: #f3f4f6; color: #374151; }

/* ── Typing indicator ────────── */
.wcocb-typing {
  align-self: flex-start;
  display: flex;
  align-items: center;
  gap: 5px;
  padding: 10px 14px;
  background: #fff;
  border: 1px solid var(--wcocb-border);
  border-radius: 14px;
  border-bottom-left-radius: 4px;
  animation: wcocb-pop .2s both;
}
.wcocb-typing span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--wcocb-muted);
  animation: wcocb-dot 1.2s ease-in-out infinite;
}
.wcocb-typing span:nth-child(2) { animation-delay: .2s; }
.wcocb-typing span:nth-child(3) { animation-delay: .4s; }
@keyframes wcocb-dot {
  0%,60%,100% { transform: translateY(0);  opacity: .4; }
  30%          { transform: translateY(-4px); opacity: 1;  }
}

/* ── Input area ──────────────── */
#wcocb-input-area {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--wcocb-border);
  background: var(--wcocb-bg);
  flex-shrink: 0;
}
#wcocb-input {
  flex: 1;
  border: 1.5px solid var(--wcocb-border);
  border-radius: 10px;
  padding: 9px 13px;
  font-family: var(--wcocb-font);
  font-size: 14px;
  color: var(--wcocb-text);
  background: var(--wcocb-surface);
  outline: none;
  transition: border-color .18s, box-shadow .18s;
}
#wcocb-input:focus {
  border-color: var(--wcocb-accent);
  box-shadow: 0 0 0 3px rgba(26,26,46,.08);
}
#wcocb-input::placeholder { color: var(--wcocb-muted); }

#wcocb-send {
  width: 40px; height: 40px;
  border-radius: 10px;
  border: none;
  background: linear-gradient(135deg, var(--wcocb-accent) 0%, #16213e 100%);
  color: #fff;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0;
  transition: transform .18s, opacity .18s;
}
#wcocb-send svg { width: 17px; height: 17px; }
#wcocb-send:hover  { transform: scale(1.07); }
#wcocb-send:active { transform: scale(.95);  }
#wcocb-send:disabled { opacity: .45; cursor: not-allowed; transform: none; }

/* ── Another query prompt ─────── */
.wcocb-another {
  margin-top: 8px;
}
.wcocb-another button {
  background: none;
  border: 1.5px solid var(--wcocb-border);
  border-radius: 8px;
  padding: 6px 13px;
  font-family: var(--wcocb-font);
  font-size: 13px;
  color: var(--wcocb-muted);
  cursor: pointer;
  transition: border-color .15s, color .15s;
}
.wcocb-another button:hover {
  border-color: var(--wcocb-accent);
  color: var(--wcocb-accent);
}

/* ── Mobile ──────────────────── */
@media (max-width: 420px) {
  #wcocb-wrapper { bottom: 16px; right: 16px; }
  #wcocb-window  {
    width: calc(100vw - 32px);
    right: calc(-28px + 16px);
    bottom: 68px;
  }
}
