/* ── WP Claude Chatbot — Widget de Chat ──────────────────────── */

#wcc-chat-widget {
  --wcc-accent:   #2563eb;
  --wcc-radius:   16px;
  --wcc-shadow:   0 8px 32px rgba(0,0,0,.18);
  --wcc-font:     -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
  --wcc-bg:       #ffffff;
  --wcc-surface:  #f4f6fb;
  --wcc-bot-bg:   #f0f4ff;
  --wcc-user-bg:  var(--wcc-accent);
  --wcc-text:     #1a1a2e;
  --wcc-muted:    #6b7280;
  --wcc-border:   #e5e7eb;
  position: fixed;
  bottom: 28px;
  right: 28px;
  z-index: 99999;
  font-family: var(--wcc-font);
}

/* ── Botón flotante ─────────────────────────────────────────── */
#wcc-toggle {
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--wcc-accent);
  border: none;
  cursor: pointer;
  box-shadow: var(--wcc-shadow);
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  transition: transform .2s ease, box-shadow .2s ease;
  outline: none;
}

#wcc-toggle:hover {
  transform: scale(1.08);
  box-shadow: 0 12px 40px rgba(37,99,235,.35);
}

#wcc-toggle:focus-visible {
  outline: 3px solid var(--wcc-accent);
  outline-offset: 3px;
}

/* ── Caja de chat ───────────────────────────────────────────── */
#wcc-chat-box {
  position: absolute;
  bottom: 72px;
  right: 0;
  width: 360px;
  max-height: 560px;
  background: var(--wcc-bg);
  border-radius: var(--wcc-radius);
  box-shadow: var(--wcc-shadow);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: wcc-slide-in .25s cubic-bezier(.34,1.56,.64,1);
  border: 1px solid var(--wcc-border);
}

#wcc-chat-box[hidden] {
  display: none;
}

@keyframes wcc-slide-in {
  from { opacity: 0; transform: translateY(16px) scale(.96); }
  to   { opacity: 1; transform: translateY(0)    scale(1);   }
}

/* ── Header ─────────────────────────────────────────────────── */
#wcc-header {
  background: var(--wcc-accent);
  padding: 14px 16px;
  display: flex;
  align-items: center;
  gap: 10px;
  color: #fff;
  flex-shrink: 0;
}

.wcc-avatar {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: rgba(255,255,255,.2);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wcc-header-info {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 2px;
}

.wcc-bot-name {
  font-size: 14px;
  font-weight: 600;
  line-height: 1;
}

.wcc-status {
  font-size: 11px;
  opacity: .85;
  display: flex;
  align-items: center;
  gap: 4px;
}

.wcc-dot {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #4ade80;
  animation: wcc-pulse 2s infinite;
}

@keyframes wcc-pulse {
  0%, 100% { opacity: 1; }
  50%       { opacity: .5; }
}

#wcc-close-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  color: rgba(255,255,255,.8);
  padding: 4px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  transition: color .15s, background .15s;
}

#wcc-close-btn:hover {
  color: #fff;
  background: rgba(255,255,255,.15);
}

/* ── Mensajes ───────────────────────────────────────────────── */
#wcc-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  scroll-behavior: smooth;
}

#wcc-messages::-webkit-scrollbar { width: 4px; }
#wcc-messages::-webkit-scrollbar-track { background: transparent; }
#wcc-messages::-webkit-scrollbar-thumb { background: var(--wcc-border); border-radius: 4px; }

.wcc-msg {
  display: flex;
  flex-direction: column;
  max-width: 85%;
  animation: wcc-msg-in .2s ease;
}

@keyframes wcc-msg-in {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}

.wcc-msg.bot  { align-self: flex-start; }
.wcc-msg.user { align-self: flex-end; }

.wcc-bubble {
  padding: 10px 14px;
  border-radius: 14px;
  font-size: 14px;
  line-height: 1.55;
  word-break: break-word;
}

.wcc-msg.bot  .wcc-bubble {
  background: var(--wcc-bot-bg);
  color: var(--wcc-text);
  border-bottom-left-radius: 4px;
}

.wcc-msg.user .wcc-bubble {
  background: var(--wcc-user-bg);
  color: #fff;
  border-bottom-right-radius: 4px;
}

.wcc-bubble a {
  color: inherit;
  opacity: .85;
  text-decoration: underline;
}

.wcc-time {
  font-size: 10px;
  color: var(--wcc-muted);
  margin-top: 4px;
  padding: 0 4px;
}

.wcc-msg.user .wcc-time { text-align: right; }

/* ── Typing indicator ───────────────────────────────────────── */
#wcc-typing {
  padding: 8px 16px 4px;
  display: flex;
  gap: 4px;
  align-items: center;
  flex-shrink: 0;
}

#wcc-typing[hidden] { display: none; }

#wcc-typing span {
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: var(--wcc-muted);
  display: inline-block;
  animation: wcc-bounce .9s infinite;
}

#wcc-typing span:nth-child(2) { animation-delay: .15s; }
#wcc-typing span:nth-child(3) { animation-delay: .30s; }

@keyframes wcc-bounce {
  0%, 80%, 100% { transform: translateY(0); }
  40%           { transform: translateY(-6px); }
}

/* ── Formulario ─────────────────────────────────────────────── */
#wcc-form {
  display: flex;
  align-items: center;
  flex-wrap: nowrap;
  gap: 8px;
  padding: 12px 14px;
  border-top: 1px solid var(--wcc-border);
  background: var(--wcc-bg);
  flex-shrink: 0;
  box-sizing: border-box;
}

#wcc-form * {
  box-sizing: border-box;
}

#wcc-input {
  flex: 1;
  border: 1.5px solid var(--wcc-border);
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 14px;
  font-family: var(--wcc-font);
  color: var(--wcc-text);
  background: var(--wcc-surface);
  outline: none;
  transition: border-color .15s;
}

#wcc-input:focus {
  border-color: var(--wcc-accent);
  background: #fff;
}

#wcc-input::placeholder { color: var(--wcc-muted); }

#wcc-send {
  width: 44px !important;
  height: 44px !important;
  min-width: 44px !important;
  min-height: 44px !important;
  padding: 0 !important;
  margin: 0 !important;
  box-sizing: border-box !important;
  border-radius: 50% !important;
  background: var(--wcc-accent) !important;
  border: none !important;
  cursor: pointer;
  color: #fff !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  transition: transform .15s, background .15s;
  flex-shrink: 0;
  line-height: 1 !important;
  text-indent: 0 !important;
  box-shadow: none !important;
}

#wcc-send:hover   { transform: scale(1.08) !important; }
#wcc-send:active  { transform: scale(.96) !important; }
#wcc-send:disabled {
  background: var(--wcc-border) !important;
  cursor: not-allowed;
  transform: none !important;
}

#wcc-send svg {
  display: block;
  flex-shrink: 0;
}

/* ── Responsive ─────────────────────────────────────────────── */
@media (max-width: 480px) {
  #wcc-chat-widget {
    bottom: 16px;
    right: 16px;
  }
  #wcc-chat-box {
    width: calc(100vw - 32px);
    max-height: 72vh;
    bottom: 76px;
  }
  #wcc-form {
    padding: 10px 12px;
    gap: 10px;
  }
  #wcc-input {
    padding: 12px 16px;
    font-size: 16px; /* evita zoom automático en iOS */
  }
  #wcc-send {
    width: 50px !important;
    height: 50px !important;
    min-width: 50px !important;
    min-height: 50px !important;
  }
  #wcc-send svg {
    width: 22px;
    height: 22px;
  }
  #wcc-toggle {
    width: 56px;
    height: 56px;
  }
}
