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

:root {
  --ic-bg:       #0e0e0e;
  --ic-surface:  #1a1a1a;
  --ic-border:   #2e2e2e;
  --ic-accent:   #e8650a;
  --ic-accent2:  #ff7a20;
  --ic-text:     #f0f0f0;
  --ic-muted:    #888;
  --ic-bubble-r: #2a2a2a;
  --ic-bubble-s: #e8650a;
  --ic-radius:   18px;
  --ic-font:     'DM Sans', sans-serif;
  --ic-z:        99999;
}

/* ── Burbuja flotante ── */
#ic-chat-bubble {
  position: fixed;
  bottom: 28px;
  right: 28px;
  width: 58px;
  height: 58px;
  border-radius: 50%;
  background: var(--ic-accent);
  border: none;
  cursor: pointer;
  z-index: var(--ic-z);
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 24px rgba(232,101,10,.45);
  transition: transform .2s ease, box-shadow .2s ease;
}
#ic-chat-bubble:hover {
  transform: scale(1.08);
  box-shadow: 0 6px 32px rgba(232,101,10,.6);
}
#ic-chat-bubble svg {
  width: 26px;
  height: 26px;
  fill: #fff;
  transition: opacity .2s;
}
#ic-chat-bubble .ic-close-icon { display: none; }

#ic-chat-bubble.open .ic-chat-icon { display: none; }
#ic-chat-bubble.open .ic-close-icon { display: block; }

/* Pulso de atención */
#ic-chat-bubble::after {
  content: '';
  position: absolute;
  top: -4px; right: -4px;
  width: 14px; height: 14px;
  border-radius: 50%;
  background: #ff3b30;
  border: 2px solid #fff;
  animation: ic-pulse 2.5s infinite;
}
@keyframes ic-pulse {
  0%, 100% { transform: scale(1); opacity: 1; }
  50%       { transform: scale(1.3); opacity: .7; }
}
#ic-chat-bubble.seen::after { display: none; }

/* ── Ventana del chat ── */
#ic-chat-window {
  position: fixed;
  bottom: 100px;
  right: 28px;
  width: 360px;
  max-height: 540px;
  background: var(--ic-bg);
  border: 1px solid var(--ic-border);
  border-radius: var(--ic-radius);
  display: flex;
  flex-direction: column;
  z-index: var(--ic-z);
  font-family: var(--ic-font);
  overflow: hidden;
  opacity: 0;
  transform: translateY(16px) scale(.97);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
  box-shadow: 0 16px 56px rgba(0,0,0,.7);
}
#ic-chat-window.open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: all;
}

/* Header */
#ic-chat-header {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 14px 16px;
  background: var(--ic-surface);
  border-bottom: 1px solid var(--ic-border);
  flex-shrink: 0;
}
.ic-avatar {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ic-accent);
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 18px;
  flex-shrink: 0;
}
.ic-header-info { flex: 1; min-width: 0; }
.ic-header-info strong {
  display: block;
  font-size: 14px;
  font-weight: 600;
  color: var(--ic-text);
  line-height: 1.2;
}
.ic-header-info span {
  font-size: 11.5px;
  color: #4caf50;
  display: flex;
  align-items: center;
  gap: 4px;
}
.ic-header-info span::before {
  content: '';
  width: 6px; height: 6px;
  border-radius: 50%;
  background: #4caf50;
  display: inline-block;
}
.ic-header-badge {
  font-size: 10px;
  background: var(--ic-accent);
  color: #fff;
  padding: 3px 8px;
  border-radius: 20px;
  font-weight: 600;
  white-space: nowrap;
}

/* Mensajes */
#ic-chat-messages {
  flex: 1;
  overflow-y: auto;
  padding: 16px 14px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  scrollbar-width: thin;
  scrollbar-color: var(--ic-border) transparent;
}
.ic-msg {
  max-width: 82%;
  padding: 10px 14px;
  border-radius: 16px;
  font-size: 13.5px;
  line-height: 1.5;
  animation: ic-fadein .2s ease;
}
@keyframes ic-fadein {
  from { opacity: 0; transform: translateY(6px); }
  to   { opacity: 1; transform: translateY(0); }
}
.ic-msg.bot {
  background: var(--ic-bubble-r);
  color: var(--ic-text);
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}
.ic-msg.user {
  background: var(--ic-accent);
  color: #fff;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}
.ic-msg.typing {
  background: var(--ic-bubble-r);
  align-self: flex-start;
  padding: 14px 18px;
}
.ic-typing-dots {
  display: flex;
  gap: 5px;
  align-items: center;
}
.ic-typing-dots span {
  width: 7px; height: 7px;
  border-radius: 50%;
  background: var(--ic-muted);
  animation: ic-dot .9s infinite;
}
.ic-typing-dots span:nth-child(2) { animation-delay: .15s; }
.ic-typing-dots span:nth-child(3) { animation-delay: .3s; }
@keyframes ic-dot {
  0%, 80%, 100% { transform: scale(1); opacity: .4; }
  40%           { transform: scale(1.3); opacity: 1; }
}

/* CTA WhatsApp */
.ic-cta-wa {
  display: flex;
  align-items: center;
  gap: 8px;
  background: #075e54;
  color: #fff;
  border: none;
  border-radius: 12px;
  padding: 10px 14px;
  font-size: 13px;
  font-weight: 600;
  cursor: pointer;
  width: 100%;
  margin-top: 6px;
  font-family: var(--ic-font);
  transition: background .18s;
  text-decoration: none;
}
.ic-cta-wa:hover { background: #128c7e; }
.ic-cta-wa svg { width: 18px; height: 18px; fill: #fff; flex-shrink: 0; }

/* Input area */
#ic-chat-footer {
  padding: 10px 12px;
  border-top: 1px solid var(--ic-border);
  display: flex;
  gap: 8px;
  align-items: center;
  background: var(--ic-surface);
  flex-shrink: 0;
}
#ic-chat-input {
  flex: 1;
  background: var(--ic-border);
  border: none;
  border-radius: 24px;
  padding: 10px 16px;
  font-size: 13.5px;
  color: var(--ic-text);
  font-family: var(--ic-font);
  outline: none;
  resize: none;
  max-height: 90px;
  line-height: 1.4;
}
#ic-chat-input::placeholder { color: var(--ic-muted); }

#ic-chat-send {
  width: 38px;
  height: 38px;
  border-radius: 50%;
  background: var(--ic-accent);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: background .18s, transform .15s;
}
#ic-chat-send:hover  { background: var(--ic-accent2); }
#ic-chat-send:active { transform: scale(.93); }
#ic-chat-send svg { width: 17px; height: 17px; fill: #fff; }
#ic-chat-send:disabled { opacity: .4; cursor: not-allowed; }

/* Powered by */
.ic-powered {
  text-align: center;
  font-size: 10.5px;
  color: var(--ic-muted);
  padding: 6px 0 2px;
  background: var(--ic-surface);
  flex-shrink: 0;
}
.ic-powered a { color: var(--ic-accent); text-decoration: none; }

/* Mobile */
@media (max-width: 480px) {
  #ic-chat-window {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 90px;
  }
  #ic-chat-bubble { right: 16px; bottom: 20px; }
}
