/* Chatbot de Rockko — burbuja flotante.
 *
 * Todo va prefijado con .rk-chat para no chocar con Bootstrap ni con los
 * estilos del resto del sitio.
 */

:root {
  --rk-chat-azul: #0d6efd;
  --rk-chat-oscuro: #10131a;
}

/* ── Burbuja ─────────────────────────────────────────────────────── */
.rk-chat-boton {
  position: fixed;
  right: 20px;
  bottom: 20px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  border: none;
  background: var(--rk-chat-oscuro);
  box-shadow: 0 6px 20px rgba(0, 0, 0, .35);
  cursor: pointer;
  z-index: 1055;              /* por encima del contenido, bajo los modales */
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform .18s ease, box-shadow .18s ease;
}
.rk-chat-boton:hover { transform: scale(1.07); box-shadow: 0 8px 26px rgba(0,0,0,.45); }
.rk-chat-boton img { width: 38px; height: 38px; border-radius: 50%; }

/* Punto rojo de "tienes algo nuevo" */
.rk-chat-boton::after {
  content: '';
  position: absolute;
  top: 4px; right: 4px;
  width: 12px; height: 12px;
  border-radius: 50%;
  background: #dc3545;
  border: 2px solid #fff;
  opacity: 0;
  transition: opacity .3s;
}
.rk-chat-boton.rk-nuevo::after { opacity: 1; }

/* ── Globo que invita ────────────────────────────────────────────── */
.rk-chat-globo {
  position: fixed;
  right: 92px;
  bottom: 30px;
  max-width: 260px;
  background: #fff;
  color: #212529;
  border-radius: 14px;
  padding: 12px 36px 12px 14px;
  box-shadow: 0 6px 24px rgba(0, 0, 0, .22);
  font-size: .9rem;
  line-height: 1.35;
  z-index: 1055;
  cursor: pointer;
  animation: rk-entrar .35s ease;
}
.rk-chat-globo b { color: var(--rk-chat-azul); }
.rk-chat-globo .rk-cerrar {
  position: absolute; top: 6px; right: 10px;
  background: none; border: none; font-size: 1.1rem;
  color: #adb5bd; cursor: pointer; line-height: 1;
}

/* ── Ventana ─────────────────────────────────────────────────────── */
.rk-chat-panel {
  position: fixed;
  right: 20px;
  bottom: 92px;
  width: 370px;
  max-width: calc(100vw - 32px);
  height: 520px;
  max-height: calc(100vh - 140px);
  background: #fff;
  border-radius: 16px;
  box-shadow: 0 12px 40px rgba(0, 0, 0, .3);
  display: flex;
  flex-direction: column;
  overflow: hidden;
  z-index: 1056;
  animation: rk-entrar .22s ease;
}
@keyframes rk-entrar {
  from { opacity: 0; transform: translateY(12px); }
  to   { opacity: 1; transform: translateY(0); }
}

.rk-chat-cabecera {
  background: var(--rk-chat-oscuro);
  color: #fff;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}
.rk-chat-cabecera img { width: 32px; height: 32px; border-radius: 50%; }
.rk-chat-cabecera .rk-titulo { font-weight: 600; font-size: .95rem; }
.rk-chat-cabecera .rk-estado { font-size: .75rem; color: #8fd19e; }
.rk-chat-cabecera button {
  margin-left: auto; background: none; border: none;
  color: #fff; font-size: 1.3rem; cursor: pointer; line-height: 1;
}

.rk-chat-mensajes {
  flex: 1;
  overflow-y: auto;
  padding: 14px;
  background: #f6f7f9;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.rk-msg { max-width: 84%; padding: 9px 13px; border-radius: 14px;
          font-size: .9rem; line-height: 1.4; white-space: pre-wrap;
          word-break: break-word; }
.rk-msg-bot { background: #fff; align-self: flex-start;
              border-bottom-left-radius: 4px;
              box-shadow: 0 1px 3px rgba(0,0,0,.08); }
.rk-msg-yo  { background: var(--rk-chat-azul); color: #fff;
              align-self: flex-end; border-bottom-right-radius: 4px; }

/* Puntos de "escribiendo" */
.rk-escribiendo { display: flex; gap: 4px; padding: 12px 14px; }
.rk-escribiendo span {
  width: 7px; height: 7px; border-radius: 50%; background: #adb5bd;
  animation: rk-latir 1.2s infinite;
}
.rk-escribiendo span:nth-child(2) { animation-delay: .2s; }
.rk-escribiendo span:nth-child(3) { animation-delay: .4s; }
@keyframes rk-latir { 0%,60%,100% { opacity:.3 } 30% { opacity:1 } }

/* Botones de pregunta rapida */
.rk-chat-rapidas { display: flex; flex-wrap: wrap; gap: 6px; padding: 0 14px 10px; }
.rk-chat-rapidas button {
  background: #fff; border: 1px solid var(--rk-chat-azul);
  color: var(--rk-chat-azul); border-radius: 16px;
  padding: 6px 12px; font-size: .8rem; cursor: pointer;
}
.rk-chat-rapidas button:hover { background: var(--rk-chat-azul); color: #fff; }

.rk-chat-pie {
  display: flex; gap: 8px; padding: 10px;
  border-top: 1px solid #e9ecef; background: #fff; flex-shrink: 0;
}
.rk-chat-pie input {
  flex: 1; border: 1px solid #dee2e6; border-radius: 20px;
  padding: 9px 14px; font-size: .9rem; outline: none;
}
.rk-chat-pie input:focus { border-color: var(--rk-chat-azul); }
.rk-chat-pie button {
  background: var(--rk-chat-azul); color: #fff; border: none;
  border-radius: 50%; width: 38px; height: 38px; cursor: pointer;
  font-size: 1rem; flex-shrink: 0;
}
.rk-chat-pie button:disabled { opacity: .5; cursor: default; }

/* Formulario de contacto dentro del chat */
.rk-chat-contacto {
  background: #fff; border-radius: 12px; padding: 12px;
  box-shadow: 0 1px 3px rgba(0,0,0,.08); align-self: stretch;
}
.rk-chat-contacto p { font-size: .85rem; margin: 0 0 8px; }
.rk-chat-contacto input {
  width: 100%; border: 1px solid #dee2e6; border-radius: 8px;
  padding: 7px 10px; font-size: .85rem; margin-bottom: 6px;
}
.rk-chat-contacto button {
  width: 100%; background: #198754; color: #fff; border: none;
  border-radius: 8px; padding: 8px; font-size: .85rem; cursor: pointer;
}

/* En moviles la ventana ocupa casi toda la pantalla */
@media (max-width: 480px) {
  .rk-chat-panel {
    right: 8px; left: 8px; bottom: 84px;
    width: auto; height: calc(100vh - 110px);
  }
  .rk-chat-globo { max-width: 200px; right: 88px; }
}
