/* ══════════════════════════════════════════════════════
   ADMEFI Bot Widget
   ══════════════════════════════════════════════════════ */

/* ── BOTÓN FLOTANTE ────────────────────────────────── */
.chat-fab {
  position: fixed; bottom: 6rem; right: 2rem; z-index: 998;
  width: 62px; height: 62px; border-radius: 50%;
  background: linear-gradient(135deg, #0e76b7, #01467f);
  color: white; border: none; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  box-shadow: 0 4px 20px rgba(14,118,183,.5);
  transition: all .3s; animation: chatPulse 3s infinite;
}
.chat-fab:hover { transform: scale(1.1); box-shadow: 0 8px 32px rgba(14,118,183,.6); }
.chat-fab svg { width: 28px; height: 28px; }
.chat-fab .chat-badge {
  position: absolute; top: -4px; right: -4px;
  background: #c9a84c; color: #01467f;
  width: 20px; height: 20px; border-radius: 50%;
  font-size: .7rem; font-weight: 800;
  display: flex; align-items: center; justify-content: center;
  border: 2px solid white;
}
@keyframes chatPulse {
  0%,100% { box-shadow: 0 4px 20px rgba(14,118,183,.5); }
  50%      { box-shadow: 0 4px 40px rgba(14,118,183,.8); }
}

/* ── VENTANA DEL CHAT ──────────────────────────────── */
.chat-window {
  position: fixed; bottom: 10rem; right: 2rem; z-index: 999;
  width: 380px; height: 560px;
  background: white; border-radius: 20px;
  box-shadow: 0 20px 60px rgba(0,0,0,.2);
  display: flex; flex-direction: column;
  overflow: hidden;
  transform: scale(0) translateY(20px);
  transform-origin: bottom right;
  transition: transform .3s cubic-bezier(.34,1.56,.64,1), opacity .3s;
  opacity: 0; pointer-events: none;
}
.chat-window.open {
  transform: scale(1) translateY(0);
  opacity: 1; pointer-events: auto;
}

/* ── HEADER ────────────────────────────────────────── */
.chat-header {
  background: linear-gradient(135deg, #01467f, #0e76b7);
  padding: 1.1rem 1.25rem;
  display: flex; align-items: center; gap: .85rem;
  flex-shrink: 0;
}
.chat-avatar {
  width: 42px; height: 42px; border-radius: 50%;
  background: rgba(255,255,255,.15);
  display: flex; align-items: center; justify-content: center;
  font-size: 1.3rem; flex-shrink: 0;
  border: 2px solid rgba(255,255,255,.3);
}
.chat-header-info { flex: 1; }
.chat-header-name { color: white; font-weight: 700; font-size: .95rem; }
.chat-header-status {
  display: flex; align-items: center; gap: .35rem;
  font-size: .72rem; color: rgba(255,255,255,.75); margin-top: .1rem;
}
.status-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #4ade80; animation: statusBlink 2s infinite;
}
@keyframes statusBlink { 0%,100%{opacity:1} 50%{opacity:.4} }
.chat-close {
  background: rgba(255,255,255,.15); border: none; color: white;
  width: 30px; height: 30px; border-radius: 50%;
  cursor: pointer; font-size: 1rem;
  display: flex; align-items: center; justify-content: center;
  transition: background .2s;
}
.chat-close:hover { background: rgba(255,255,255,.25); }

/* ── MENSAJES ──────────────────────────────────────── */
.chat-messages {
  flex: 1; overflow-y: auto; padding: 1.25rem;
  display: flex; flex-direction: column; gap: .85rem;
  background: #f4f8fc;
}
.chat-messages::-webkit-scrollbar { width: 4px; }
.chat-messages::-webkit-scrollbar-track { background: transparent; }
.chat-messages::-webkit-scrollbar-thumb { background: #d0e4f0; border-radius: 2px; }

.chat-msg { display: flex; gap: .6rem; align-items: flex-end; }
.chat-msg.user { flex-direction: row-reverse; }

.msg-avatar {
  width: 28px; height: 28px; border-radius: 50%;
  display: flex; align-items: center; justify-content: center;
  font-size: .85rem; flex-shrink: 0;
}
.chat-msg.bot .msg-avatar { background: linear-gradient(135deg,#01467f,#0e76b7); color: white; }
.chat-msg.user .msg-avatar { background: #e2e8f0; }

.msg-bubble {
  max-width: 78%; padding: .75rem 1rem;
  border-radius: 16px; font-size: .875rem;
  line-height: 1.55; position: relative;
}
.chat-msg.bot .msg-bubble {
  background: white; color: #0d1b2a;
  border-bottom-left-radius: 4px;
  box-shadow: 0 1px 4px rgba(0,0,0,.08);
}
.chat-msg.user .msg-bubble {
  background: linear-gradient(135deg,#0e76b7,#01467f);
  color: white; border-bottom-right-radius: 4px;
}
.msg-bubble a { color: inherit; text-decoration: underline; }
.msg-bubble p { margin-bottom: .4rem; }
.msg-bubble p:last-child { margin-bottom: 0; }
.msg-time {
  font-size: .65rem; color: rgba(0,0,0,.35);
  margin-top: .35rem; text-align: right;
}
.chat-msg.bot .msg-time { text-align: left; }

/* Typing indicator */
.typing-indicator { display: flex; gap: 4px; align-items: center; padding: .5rem 0; }
.typing-dot {
  width: 7px; height: 7px; border-radius: 50%;
  background: #0e76b7; opacity: .4;
  animation: typingAnim 1.4s infinite;
}
.typing-dot:nth-child(2) { animation-delay: .2s; }
.typing-dot:nth-child(3) { animation-delay: .4s; }
@keyframes typingAnim { 0%,60%,100%{opacity:.4;transform:translateY(0)} 30%{opacity:1;transform:translateY(-4px)} }

/* Chips de sugerencias */
.chat-suggestions {
  display: flex; flex-wrap: wrap; gap: .4rem;
  padding: .75rem 1.25rem; background: #f4f8fc;
  border-top: 1px solid #e2e8f0;
}
.suggestion-chip {
  padding: .35rem .85rem; border-radius: 20px;
  background: white; border: 1.5px solid #d0e4f0;
  font-size: .75rem; font-weight: 600; cursor: pointer;
  color: #0e76b7; transition: all .2s; font-family: 'Montserrat', sans-serif;
}
.suggestion-chip:hover { background: #0e76b7; color: white; border-color: #0e76b7; }

/* ── INPUT ─────────────────────────────────────────── */
.chat-input-area {
  padding: .85rem 1rem; background: white;
  border-top: 1px solid #e2e8f0;
  display: flex; gap: .6rem; align-items: flex-end;
  flex-shrink: 0;
}
.chat-input {
  flex: 1; border: 1.5px solid #d0e4f0;
  border-radius: 24px; padding: .65rem 1rem;
  font-family: 'Montserrat', sans-serif; font-size: .85rem;
  resize: none; outline: none; max-height: 100px;
  line-height: 1.4; transition: border-color .2s;
  background: #f4f8fc;
}
.chat-input:focus { border-color: #0e76b7; background: white; }
.chat-send {
  width: 40px; height: 40px; border-radius: 50%;
  background: linear-gradient(135deg,#0e76b7,#01467f);
  border: none; color: white; cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  flex-shrink: 0; transition: all .2s;
}
.chat-send:hover { transform: scale(1.1); }
.chat-send:disabled { opacity: .5; cursor: not-allowed; transform: none; }
.chat-send svg { width: 16px; height: 16px; }

/* ── RESPONSIVE ────────────────────────────────────── */
@media (max-width: 480px) {
  .chat-window { width: calc(100vw - 2rem); right: 1rem; bottom: 8rem; height: 70vh; }
  .chat-fab { right: 1rem; }
}