/* ══════════════════════════════════════════
   VARKA AI CHAT WIDGET — estilos
   ══════════════════════════════════════════ */
/* ── Chat bubble ── */
.ai-bubble {
  position: fixed; bottom: 1.5rem; right: 1.5rem;
  width: 56px; height: 56px; border-radius: 50%;
  background: var(--verde-marca); border: none;
  cursor: pointer; display: flex; align-items: center; justify-content: center;
  z-index: 200; box-shadow: 0 4px 24px rgba(29,158,117,.45);
  transition: background .25s, transform .25s, box-shadow .25s;
}
.ai-bubble:hover { background: #16835f; transform: scale(1.08); box-shadow: 0 6px 32px rgba(29,158,117,.55); }
.ai-bubble.open { background: var(--texto-oscuro); box-shadow: 0 4px 20px rgba(0,0,0,.3); }
.ai-bubble-icon, .ai-bubble-close { position: absolute; transition: opacity .25s, transform .25s; }
.ai-bubble-close { opacity: 0; transform: scale(.5) rotate(-90deg); }
.ai-bubble.open .ai-bubble-icon { opacity: 0; transform: scale(.5); }
.ai-bubble.open .ai-bubble-close { opacity: 1; transform: scale(1) rotate(0); }
.ai-badge {
  position: absolute; top: -3px; right: -3px;
  width: 19px; height: 19px; border-radius: 50%;
  background: #e05c5c; border: 2.5px solid var(--blanco);
  font-size: .65rem; font-weight: 700; color: #fff;
  display: flex; align-items: center; justify-content: center;
  transition: opacity .25s, transform .25s;
}
.ai-badge.hidden { opacity: 0; transform: scale(0); pointer-events: none; }

/* ── Panel ── */
.ai-panel {
  position: fixed; bottom: 5.5rem; right: 1.5rem;
  width: 370px; display: flex; flex-direction: column;
  background: var(--blanco); border-radius: 20px;
  box-shadow: 0 24px 80px rgba(0,0,0,.2), 0 4px 16px rgba(0,0,0,.07);
  border: 1px solid rgba(15,42,30,.08);
  z-index: 199; max-height: min(560px, calc(100vh - 7rem));
  opacity: 0; transform: translateY(14px) scale(.97); pointer-events: none;
  transition: opacity .3s cubic-bezier(.34,1.56,.64,1), transform .3s cubic-bezier(.34,1.56,.64,1);
}
.ai-panel.open { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }

.ai-panel-hdr {
  background: var(--verde-noche); border-radius: 20px 20px 0 0;
  padding: 1rem 1.25rem; display: flex; align-items: center; gap: 12px; flex-shrink: 0;
}
.ai-panel-avatar {
  width: 38px; height: 38px; border-radius: 50%; flex-shrink: 0;
  background: linear-gradient(135deg, var(--verde-marca), var(--verde-claro));
  display: flex; align-items: center; justify-content: center;
}
.ai-panel-name { font-size: .9375rem; font-weight: 500; color: var(--menta); }
.ai-panel-status { font-size: .75rem; color: var(--verde-claro); display: flex; align-items: center; gap: 5px; margin-top: 2px; }
.status-dot { width: 6px; height: 6px; border-radius: 50%; background: var(--verde-claro); display: inline-block; }

.ai-msgs {
  flex: 1; overflow-y: auto; padding: 1.25rem; display: flex; flex-direction: column; gap: 10px;
  min-height: 0; scroll-behavior: smooth;
}
.ai-msgs::-webkit-scrollbar { width: 4px; }
.ai-msgs::-webkit-scrollbar-thumb { background: rgba(15,42,30,.12); border-radius: 4px; }

.ai-msg { max-width: 86%; padding: .625rem .9rem; font-size: .875rem; line-height: 1.6; animation: fadeUp .25s ease; }
.ai-msg-user { background: var(--verde-noche); color: var(--menta); align-self: flex-end; border-radius: 14px 14px 3px 14px; }
.ai-msg-bot  { background: var(--menta); color: var(--texto-oscuro); align-self: flex-start; border-radius: 14px 14px 14px 3px; }
.ai-calendly-btn {
  display: inline-block; margin-top: .6rem;
  background: var(--verde-marca); color: #fff; font-size: .8rem; font-weight: 500;
  padding: .5rem 1.1rem; border-radius: 100px; text-decoration: none;
  transition: background .2s;
}
.ai-calendly-btn:hover { background: #22b887; }

.ai-typing {
  display: flex; gap: 4px; padding: .625rem .875rem;
  background: var(--menta); border-radius: 14px 14px 14px 3px;
  align-self: flex-start; animation: fadeUp .25s ease;
}
.ai-typing span { width: 6px; height: 6px; border-radius: 50%; background: var(--verde-marca); animation: bounce 1.2s infinite; }
.ai-typing span:nth-child(2) { animation-delay: .2s; }
.ai-typing span:nth-child(3) { animation-delay: .4s; }

.ai-input-row {
  padding: .875rem 1.25rem; border-top: 1px solid rgba(15,42,30,.06);
  display: flex; gap: 8px; align-items: flex-end; flex-shrink: 0;
}
.ai-input {
  flex: 1; background: var(--arena); border: 1px solid rgba(15,42,30,.1); border-radius: 10px;
  padding: .5rem .75rem; font-size: .875rem; color: var(--texto-oscuro);
  font-family: inherit; outline: none; resize: none; min-height: 36px; max-height: 80px; line-height: 1.5;
  transition: border-color .2s;
}
.ai-input:focus { border-color: var(--verde-marca); }
.ai-input::placeholder { color: rgba(10,31,22,.35); }
.ai-send {
  width: 36px; height: 36px; border-radius: 9px; background: var(--verde-marca);
  border: none; cursor: pointer; display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: background .2s, transform .1s;
}
.ai-send:hover { background: #16835f; }
.ai-send:active { transform: scale(.92); }
.ai-send:disabled { background: rgba(15,42,30,.2); cursor: not-allowed; }
.ai-note { text-align: center; font-size: .68rem; color: rgba(10,31,22,.28); padding: .3rem 0 .5rem; flex-shrink: 0; }

@media (max-width: 480px) {
  .ai-panel { width: calc(100vw - 2rem); right: 1rem; bottom: 4.75rem; }
  .ai-bubble { right: 1rem; }
}

/* PROACTIVE TOOLTIP */
.ai-tooltip {
  position: fixed; bottom: 5.5rem; right: 1.5rem;
  background: white; color: var(--texto-oscuro);
  padding: .75rem 1rem; border-radius: 12px 12px 0 12px;
  box-shadow: 0 4px 20px rgba(0,0,0,.15);
  font-size: .875rem; line-height: 1.4; max-width: 220px;
  cursor: pointer; z-index: 99;
  opacity: 0; transform: translateY(8px) scale(.95);
  transition: opacity .35s ease, transform .35s ease;
  pointer-events: none;
}
.ai-tooltip.show { opacity: 1; transform: translateY(0) scale(1); pointer-events: auto; }
.ai-tooltip::after {
  content: '';
  position: absolute; bottom: -8px; right: 0;
  border-left: 8px solid white; border-bottom: 8px solid transparent;
}
.ai-tooltip-close {
  position: absolute; top: 4px; right: 6px;
  background: none; border: none; cursor: pointer;
  color: var(--texto-medio); font-size: 14px; line-height: 1; padding: 2px 4px;
}

@keyframes bounce { 0%,60%,100% { transform: translateY(0); } 30% { transform: translateY(-5px); } }
