/* ─── InboChat Widget — Diseño Pro ────────────────────────────────────────── */

:root {
  --ic-primary:  #2563eb;
  --ic-bubble:   #2563eb;
  --ic-text:     #ffffff;
  --ic-radius:   20px;
  --ic-shadow:   0 20px 60px rgba(0,0,0,.18), 0 4px 16px rgba(0,0,0,.1);
  --ic-font:     -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  --ic-z:        999999;
}

/* ─── Botón flotante ──────────────────────────────────────────────────────── */
#inbochat-toggle {
  position:   fixed;
  bottom:     28px;
  right:      28px;
  width:      60px;
  height:     60px;
  border-radius: 50%;
  background: var(--ic-primary);
  color:      #fff;
  border:     none;
  cursor:     pointer;
  z-index:    var(--ic-z);
  box-shadow: 0 8px 32px rgba(37,99,235,.45);
  display:    flex;
  align-items: center;
  justify-content: center;
  transition: transform .22s cubic-bezier(.34,1.56,.64,1), box-shadow .2s;
  outline:    none;
  overflow:   hidden;
}
#inbochat-toggle::before {
  content: '';
  position: absolute;
  inset: 0;
  background: radial-gradient(circle at 35% 35%, rgba(255,255,255,.25), transparent 65%);
  border-radius: 50%;
  pointer-events: none;
}
#inbochat-toggle:hover {
  transform:  scale(1.1);
  box-shadow: 0 12px 40px rgba(37,99,235,.55);
}
#inbochat-toggle:active { transform: scale(.96); }

#inbochat-toggle svg {
  width:  26px;
  height: 26px;
  position: relative;
  z-index: 1;
  transition: transform .28s cubic-bezier(.34,1.56,.64,1), opacity .2s;
}
#inbochat-toggle .ic-icon-close {
  position: absolute;
  opacity: 0;
  transform: rotate(-80deg) scale(.6);
}
#inbochat-toggle.ic-open .ic-icon-chat {
  opacity: 0;
  transform: rotate(80deg) scale(.6);
}
#inbochat-toggle.ic-open .ic-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}
#inbochat-toggle:not(.ic-open)::after {
  content: '';
  position: absolute;
  inset: -4px;
  border-radius: 50%;
  border: 2px solid var(--ic-primary);
  opacity: 0;
  animation: icPulse 2.8s ease-out infinite;
}
@keyframes icPulse {
  0%   { transform: scale(.9); opacity: .6; }
  70%  { transform: scale(1.35); opacity: 0; }
  100% { opacity: 0; }
}

/* ─── Ventana del chat ────────────────────────────────────────────────────── */
#inbochat-window {
  position:      fixed;
  bottom:        104px;
  right:         28px;
  width:         380px;
  max-width:     calc(100vw - 32px);
  height:        560px;
  max-height:    calc(100vh - 120px);
  background:    #ffffff;
  border-radius: var(--ic-radius);
  box-shadow:    var(--ic-shadow);
  z-index:       var(--ic-z);
  display:       flex;
  flex-direction: column;
  overflow:      hidden;
  font-family:   var(--ic-font);
  font-size:     14px;
  border:        1px solid rgba(37,99,235,.1);
  opacity:       0;
  transform:     translateY(20px) scale(.95);
  pointer-events: none;
  transition:    opacity .26s cubic-bezier(.34,1.2,.64,1),
                 transform .26s cubic-bezier(.34,1.2,.64,1);
  transform-origin: bottom right;
}
#inbochat-window.ic-visible {
  opacity:       1;
  transform:     translateY(0) scale(1);
  pointer-events: all;
}

/* ─── Header ──────────────────────────────────────────────────────────────── */
#inbochat-header {
  background:  var(--ic-primary);
  padding:     16px 18px 14px;
  display:     flex;
  align-items: center;
  gap:         12px;
  flex-shrink: 0;
  position:    relative;
  overflow:    hidden;
}
#inbochat-header::before {
  content: '';
  position: absolute;
  top: -40px; right: -40px;
  width: 120px; height: 120px;
  background: radial-gradient(circle, rgba(255,255,255,.12), transparent 70%);
  pointer-events: none;
}
#inbochat-header::after {
  content: '';
  position: absolute;
  bottom: -30px; left: 20px;
  width: 80px; height: 80px;
  background: radial-gradient(circle, rgba(255,255,255,.06), transparent 70%);
  pointer-events: none;
}
.ic-avatar {
  width:         44px;
  height:        44px;
  border-radius: 14px;
  background:    rgba(255,255,255,.18);
  display:       flex;
  align-items:   center;
  justify-content: center;
  flex-shrink:   0;
  border:        1.5px solid rgba(255,255,255,.25);
  position:      relative;
  z-index:       1;
}
.ic-avatar svg { width: 22px; height: 22px; color: #fff; }

.ic-header-text {
  flex: 1;
  min-width: 0;
  position: relative;
  z-index: 1;
}
.ic-header-name {
  font-weight:   700;
  font-size:     15px;
  color:         #fff;
  white-space:   nowrap;
  overflow:      hidden;
  text-overflow: ellipsis;
  letter-spacing: -.01em;
}
.ic-header-status {
  font-size:  12px;
  color:      rgba(255,255,255,.8);
  display:    flex;
  align-items: center;
  gap:        5px;
  margin-top: 2px;
}
.ic-status-dot {
  width:  7px;
  height: 7px;
  background: #4ade80;
  border-radius: 50%;
  box-shadow: 0 0 6px rgba(74,222,128,.8);
  display: inline-block;
  animation: icStatusPulse 2s ease infinite;
}
@keyframes icStatusPulse {
  0%,100% { box-shadow: 0 0 4px rgba(74,222,128,.6); }
  50%      { box-shadow: 0 0 10px rgba(74,222,128,.95); }
}
.ic-ai-badge {
  position: relative; z-index: 1;
  display: inline-flex; align-items: center; gap: 4px;
  background: rgba(255,255,255,.15);
  border: 1px solid rgba(255,255,255,.2);
  border-radius: 20px;
  padding: 3px 8px;
  font-size: 10px;
  font-weight: 600;
  color: rgba(255,255,255,.9);
  flex-shrink: 0;
  letter-spacing: .03em;
}
.ic-ai-badge::before {
  content: '';
  width: 6px; height: 6px;
  background: #a78bfa;
  border-radius: 50%;
  box-shadow: 0 0 6px #a78bfa;
}

/* ─── Mensajes ────────────────────────────────────────────────────────────── */
#inbochat-messages {
  flex:       1;
  overflow-y: auto;
  padding:    16px 16px 8px;
  display:    flex;
  flex-direction: column;
  gap:        10px;
  background: #f8fafc;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e1 transparent;
}
#inbochat-messages::-webkit-scrollbar { width: 4px; }
#inbochat-messages::-webkit-scrollbar-thumb { background: #cbd5e1; border-radius: 4px; }

.ic-date-sep {
  display: flex; align-items: center; gap: 8px; margin: 4px 0;
}
.ic-date-sep::before, .ic-date-sep::after {
  content: ''; flex: 1; height: 1px; background: #e2e8f0;
}
.ic-date-sep span { font-size: 11px; color: #94a3b8; padding: 0 4px; }

.ic-msg {
  display:        flex;
  flex-direction: column;
  max-width:      82%;
  animation:      icSlideUp .2s ease;
}
@keyframes icSlideUp {
  from { opacity:0; transform: translateY(8px); }
  to   { opacity:1; transform: translateY(0); }
}
.ic-msg.ic-bot  { align-self: flex-start; }
.ic-msg.ic-user { align-self: flex-end; }

.ic-bubble {
  padding:    10px 14px;
  line-height: 1.55;
  word-break: break-word;
  white-space: pre-wrap;
  font-size:  14px;
}
.ic-bot .ic-bubble {
  background:    var(--ic-bubble);
  color:         var(--ic-text);
  border-radius: 16px 16px 16px 4px;
  box-shadow:    0 2px 8px rgba(37,99,235,.2);
}
.ic-user .ic-bubble {
  background:    #fff;
  color:         #1e293b;
  border-radius: 16px 16px 4px 16px;
  border:        1px solid #e2e8f0;
  box-shadow:    0 1px 4px rgba(0,0,0,.06);
}
.ic-time {
  font-size:  10px;
  color:      #94a3b8;
  margin-top: 4px;
  padding:    0 4px;
}
.ic-bot .ic-time  { text-align: left; }
.ic-user .ic-time { text-align: right; }

/* ─── Typing indicator ────────────────────────────────────────────────────── */
.ic-typing .ic-bubble { padding: 12px 16px; }
.ic-dots { display: flex; gap: 5px; align-items: center; height: 18px; }
.ic-dots span {
  width: 8px; height: 8px;
  background: rgba(255,255,255,.6);
  border-radius: 50%;
  animation: icBounce 1.3s infinite ease-in-out;
}
.ic-dots span:nth-child(2) { animation-delay: .18s; }
.ic-dots span:nth-child(3) { animation-delay: .36s; }
@keyframes icBounce {
  0%,60%,100% { transform: translateY(0); }
  30%          { transform: translateY(-7px); }
}

/* ─── Links derivación ────────────────────────────────────────────────────── */
.ic-cta-links {
  display: flex; gap: 7px; flex-wrap: wrap;
  margin-top: 7px; padding: 0 2px;
}
.ic-cta-btn {
  display:       inline-flex;
  align-items:   center;
  gap:           6px;
  padding:       7px 13px;
  border-radius: 22px;
  font-size:     12px;
  font-weight:   600;
  text-decoration: none;
  transition:    opacity .15s, transform .15s;
  border:        none;
  cursor:        pointer;
}
.ic-cta-btn:hover { opacity: .88; transform: translateY(-1px); }
.ic-cta-wa {
  background: #25d366; color: #fff;
  box-shadow: 0 2px 8px rgba(37,211,102,.3);
}
.ic-cta-email { background: #fff; color: #475569; border: 1px solid #e2e8f0; }

/* Confirmación de alerta enviada */
.ic-alert-sent {
  display:    flex; align-items: center; gap: 6px;
  background: #f0fdf4; border: 1px solid #bbf7d0;
  border-radius: 10px; padding: 8px 12px;
  font-size:  12px; color: #15803d;
  margin-top: 6px;
  animation:  icSlideUp .2s ease;
}
.ic-alert-sent svg { width: 14px; height: 14px; flex-shrink: 0; }

/* ─── Input area ──────────────────────────────────────────────────────────── */
#inbochat-input-area {
  display:     flex;
  align-items: flex-end;
  gap:         8px;
  padding:     12px 14px 14px;
  background:  #fff;
  border-top:  1px solid #f1f5f9;
  flex-shrink: 0;
}
#inbochat-input {
  flex:          1;
  border:        1.5px solid #e2e8f0;
  border-radius: 16px;
  padding:       10px 14px;
  font-size:     14px;
  font-family:   var(--ic-font);
  outline:       none;
  resize:        none;
  max-height:    100px;
  overflow-y:    auto;
  line-height:   1.45;
  color:         #1e293b;
  background:    #f8fafc;
  transition:    border-color .15s, background .15s, box-shadow .15s;
  scrollbar-width: none;
}
#inbochat-input::-webkit-scrollbar { display: none; }
#inbochat-input:focus {
  border-color: var(--ic-primary);
  background:   #fff;
  box-shadow:   0 0 0 3px rgba(37,99,235,.1);
}
#inbochat-input::placeholder { color: #94a3b8; }

#inbochat-send {
  width:         40px;
  height:        40px;
  border-radius: 12px;
  background:    var(--ic-primary);
  border:        none;
  cursor:        pointer;
  display:       flex;
  align-items:   center;
  justify-content: center;
  flex-shrink:   0;
  transition:    background .15s, transform .15s, box-shadow .15s;
  color:         #fff;
  box-shadow:    0 2px 8px rgba(37,99,235,.3);
}
#inbochat-send:hover {
  background: #1d4ed8;
  transform:  translateY(-1px);
  box-shadow: 0 4px 12px rgba(37,99,235,.4);
}
#inbochat-send:active  { transform: scale(.94); }
#inbochat-send:disabled { opacity: .4; cursor: default; transform: none; box-shadow: none; }
#inbochat-send svg { width: 17px; height: 17px; }

/* ─── Footer ──────────────────────────────────────────────────────────────── */
#inbochat-footer {
  padding:    7px 14px 10px;
  background: #fff;
  text-align: center;
  border-top: 1px solid #f8fafc;
}
#inbochat-footer span { font-size: 10px; color: #cbd5e1; }
#inbochat-footer a { color: #93c5fd; text-decoration: none; font-weight: 600; }
#inbochat-footer a:hover { color: var(--ic-primary); }

/* ─── Responsive ──────────────────────────────────────────────────────────── */
@media (max-width: 480px) {
  #inbochat-window {
    bottom: 0; right: 0; left: 0;
    width: 100%; max-width: 100%;
    height: 100%; max-height: 100%;
    border-radius: 0; border: none;
    transform-origin: bottom center;
  }
  #inbochat-toggle { bottom: 20px; right: 20px; }
}

/* ─── Formulario de captura de lead (v1.3.0) ─────────────────────────────── */
#inbochat-body {
  flex: 1;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

#inbochat-lead-form {
  flex: 1;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 20px 16px;
  background: #f8fafc;
  overflow-y: auto;
}

.ic-lead-inner {
  width: 100%;
  max-width: 320px;
  text-align: center;
}

.ic-lead-icon {
  width: 56px;
  height: 56px;
  border-radius: 16px;
  background: var(--ic-primary);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto 14px;
  box-shadow: 0 4px 16px rgba(37,99,235,.3);
}
.ic-lead-icon svg {
  width: 26px; height: 26px;
  color: #fff;
}

.ic-lead-title {
  font-size: 17px;
  font-weight: 700;
  color: #0f172a;
  margin: 0 0 6px;
  letter-spacing: -.01em;
}

.ic-lead-subtitle {
  font-size: 13px;
  color: #64748b;
  margin: 0 0 20px;
  line-height: 1.5;
}

.ic-lead-fields {
  display: flex;
  flex-direction: column;
  gap: 10px;
  text-align: left;
}

.ic-lead-field input {
  width: 100%;
  border: 1.5px solid #e2e8f0;
  border-radius: 10px;
  padding: 10px 14px;
  font-size: 14px;
  font-family: var(--ic-font);
  color: #1e293b;
  background: #fff;
  outline: none;
  transition: border-color .15s, box-shadow .15s;
  box-sizing: border-box;
}
.ic-lead-field input:focus {
  border-color: var(--ic-primary);
  box-shadow: 0 0 0 3px rgba(37,99,235,.1);
}
.ic-lead-field input::placeholder { color: #94a3b8; }

.ic-lead-error {
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 8px;
  padding: 8px 12px;
  font-size: 12px;
  color: #dc2626;
}

.ic-lead-btn {
  width: 100%;
  background: var(--ic-primary);
  color: #fff;
  border: none;
  border-radius: 10px;
  padding: 12px 16px;
  font-size: 14px;
  font-weight: 600;
  font-family: var(--ic-font);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: background .15s, transform .15s, box-shadow .15s;
  box-shadow: 0 2px 10px rgba(37,99,235,.3);
  margin-top: 2px;
}
.ic-lead-btn svg { width: 16px; height: 16px; }
.ic-lead-btn:hover {
  background: #1d4ed8;
  transform: translateY(-1px);
  box-shadow: 0 4px 14px rgba(37,99,235,.4);
}
.ic-lead-btn:active { transform: scale(.97); }
.ic-lead-btn:disabled { opacity: .6; cursor: default; transform: none; box-shadow: none; }

.ic-lead-privacy {
  font-size: 11px;
  color: #94a3b8;
  margin: 12px 0 0;
  line-height: 1.5;
}

/* ─── Ajuste mensajes dentro del body ─────────────────────────────────────── */
#inbochat-messages {
  flex: 1;
}
