
/* =========================
   AISLAMIENTO SEGURO
   NO rompe el resto del sitio
   ========================= */

/* El chat puede usar altura completa */
#bctm-chat {
  height: 100%;
	
}

/* SOLO cuando el chat está abierto */
@media (max-width: 480px) {
  html.bctm-chat-open,
  html.bctm-chat-open body {
    height: 100%;
    overflow: hidden;
  }
}
/* =========================
   BOTÓN FLOTANTE
   ========================= */
#bctm-chat-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 56px;
  height: 56px;
  background: #29275C;
  color: #fff;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 22px;
  cursor: pointer;
  box-shadow: 0 10px 30px rgba(0,0,0,.25);
  z-index: 9999;
}

/* =========================
   CHAT DEFAULT (DESKTOP + IPAD)
   ========================= */
#bctm-chat {
  position: fixed;
  bottom: 90px;
  right: 24px;
  width: 320px;
  height: 420px;
  background: #fff;
  border-radius: 18px;
  box-shadow: 0 20px 60px rgba(0,0,0,.25);
  display: none;
  flex-direction: column;
  font-family: system-ui, -apple-system, BlinkMacSystemFont;
  z-index: 9999;
  overflow: hidden;
}

/* HEADER */
.bctm-header {
  background: #29275C;
  color: #fff;
  padding: 14px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.bctm-close {
  cursor: pointer;
  font-size: 20px;
}

/* MENSAJES */
#bctm-messages {
  flex: 1;
  padding: 14px;
  overflow-y: auto;
  background: #fff;
}

.msg {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 14px;
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.4;
}

.msg.bot {
  background: #e9ebf1;
  color: #000;
  border-bottom-left-radius: 4px;
}

.msg.user {
  background: #29275C;
  color: #fff;
  margin-left: auto;
  border-bottom-right-radius: 4px;
}

/* INPUT */
.bctm-input-wrap {
  border-top: 1px solid #eee;
  padding: 10px;
}

#bctm-input {
  width: 100%;
  border: none;
  outline: none;
  font-size: 14px;
}

/* FOOTER */
.bctm-footer {
  text-align: center;
  font-size: 11px;
  color: #999;
  padding: 6px 0;
  background: #fff;
}

/* ==========================================
   SOLO iPhone: FULL SCREEN (Safari incluido)
   - Usamos la variable --bctm-vh (JS)
   - iPad queda como escritorio
   ========================================== */
@media (max-width: 480px) {

  html.bctm-chat-open #bctm-chat {
    position: fixed;

    top: var(--bctm-offset, 0px);
    left: 0;
    right: 0;

    width: 100vw;
    height: var(--bctm-vh, 100vh);

    border-radius: 0;
    box-shadow: none;

    display: flex;
    flex-direction: column;
  }

  /* Input SIEMPRE visible sobre el teclado */
  .bctm-input-wrap {
    position: sticky;
    bottom: 0;
    background: #fff;
  }

  /* Evita zoom iOS */
  #bctm-input {
    font-size: 16px;
  }
}

/* =========================
   TYPING INDICATOR (WhatsApp style)
   ========================= */

.msg.typing {
  background: #e9ebf1;
  color: #000;
  border-bottom-left-radius: 4px;
  width: 60px;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.msg.typing span {
  width: 6px;
  height: 6px;
  background: #999;
  border-radius: 50%;
  display: inline-block;
  animation: bctmTyping 1.4s infinite ease-in-out both;
}

.msg.typing span:nth-child(1) {
  animation-delay: 0s;
}

.msg.typing span:nth-child(2) {
  animation-delay: 0.2s;
}

.msg.typing span:nth-child(3) {
  animation-delay: 0.4s;
}

@keyframes bctmTyping {
  0% {
    opacity: 0.2;
    transform: translateY(0);
  }
  20% {
    opacity: 1;
    transform: translateY(-3px);
  }
  40% {
    opacity: 0.2;
    transform: translateY(0);
  }
  100% {
    opacity: 0.2;
  }
}