/* ===========================
   CONTENEDOR PRINCIPAL
=========================== */
#rs-chatbot {
  position: fixed;
  right: 20px;
  bottom: 20px;
  z-index: 9999;
  font-family: system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI",
    Roboto, Helvetica, Arial, sans-serif;
}

/* BOTÓN FLOTANTE */
#rs-chat-toggle {
  background: linear-gradient(135deg, #ff0055, #ff7b00);
  color: #fff;
  border: none;
  border-radius: 999px;
  padding: 12px 22px;
  font-size: 14px;
  letter-spacing: 0.08em;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.35);
  text-transform: uppercase;
}

#rs-chat-toggle:hover {
  transform: translateY(-1px);
}

/* ===========================
   VENTANA DEL CHAT
=========================== */
#rs-chat-window {
  width: 360px;
  max-height: 75vh;
  background: #020617;
  border-radius: 16px;
  box-shadow: 0 25px 50px rgba(15, 23, 42, 0.9);
  overflow: hidden;
  display: flex;
  flex-direction: column;
  margin-bottom: 10px;
}

.rscb-hidden {
  display: none;
}

/* ===========================
   HEADER
=========================== */
#rs-chat-header {
  background: linear-gradient(135deg, #ff0055, #ff7b00);
  color: #fff;
  padding: 12px 16px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

#rs-chat-header .rs-logo {
  font-weight: 700;
  font-size: 16px;
}

/* Botones minimizar / cerrar */
.rs-header-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  margin-left: auto;
}

#rs-chat-minimize,
#rs-chat-close {
  background: rgba(0, 0, 0, 0.35);
  backdrop-filter: blur(3px);
  border: 2px solid rgba(255, 255, 255, 0.6);
  color: #fff;
  width: 32px;
  height: 32px;
  font-size: 20px;
  font-weight: bold;
  border-radius: 8px;
  line-height: 28px;
  cursor: pointer;
  transition: all 0.15s ease-in-out;
}

#rs-chat-minimize:hover,
#rs-chat-close:hover {
  background: #ffffff;
  color: #ff4500;
  border-color: #fff;
  transform: scale(1.08);
}

#rs-chat-minimize:active,
#rs-chat-close:active {
  transform: scale(0.94);
}

/* ===========================
   MENÚ RÁPIDO (BOTONES NEGROS)
=========================== */
#rs-quick-menu {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  padding: 8px 10px;
  background: #020617;
  border-bottom: 1px solid rgba(15, 23, 42, 0.9);
}

.rs-quick-btn {
  flex: 1 1 48%;
  font-size: 11px;
  padding: 4px 6px;
  border-radius: 999px;
  border: none;
  cursor: pointer;
  background: rgba(0, 0, 0, 0.35);
  color: #fff;
  text-align: center;
  transition: transform 0.1s ease, background 0.1s ease;
  white-space: nowrap;
}

.rs-quick-btn:hover {
  transform: translateY(-1px);
  background: rgba(255, 255, 255, 0.2);
}

/* ===========================
   ÁREA DE MENSAJES
=========================== */
#rs-chat-messages {
  padding: 16px;
  overflow-y: auto;
  flex: 1;
  background: radial-gradient(circle at top left, #0f172a, #020617);
}

/* Burbujas */
.rs-msg {
  display: flex;
  margin-bottom: 10px;
}

.rs-msg.user {
  justify-content: flex-end;
}

.rs-msg.bot {
  justify-content: flex-start;
}

.rs-bubble {
  max-width: 80%;
  padding: 10px 14px;
  border-radius: 18px;
  font-size: 14px;
  line-height: 1.4;
  animation: fadeIn 0.25s ease-in-out;
}

.rs-msg.user .rs-bubble {
  background: #22c55e;
  color: #052e16;
  border-bottom-right-radius: 4px;
}

.rs-msg.bot .rs-bubble {
  background: #0f172a;
  color: #e5e7eb;
  border-bottom-left-radius: 4px;
  border: 1px solid #111827;
}

/* "Escribiendo..." */
.rs-bubble.typing {
  font-style: italic;
  color: #9ca3af;
}

.rs-bubble.typing span {
  display: inline-block;
  animation: blink 1s infinite;
}

.rs-bubble.typing span:nth-child(2) {
  animation-delay: 0.15s;
}

.rs-bubble.typing span:nth-child(3) {
  animation-delay: 0.3s;
}

/* Links en burbujas */
.rs-bubble a {
  color: #f97316;
  text-decoration: underline;
}

/* ===========================
   FORMULARIO
=========================== */
#rs-chat-form {
  display: flex;
  padding: 10px;
  background: #020617;
  border-top: 1px solid #111827;
}

#rs-chat-input {
  flex: 1;
  border-radius: 999px;
  border: 1px solid #334155;
  padding: 8px 12px;
  font-size: 14px;
  background: #020617;
  color: #e5e7eb;
  outline: none;
}

#rs-chat-input::placeholder {
  color: #6b7280;
}

#rs-chat-form button[type="submit"] {
  margin-left: 8px;
  border-radius: 999px;
  border: none;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 600;
  text-transform: uppercase;
  background: #10b981;
  color: #022c22;
  cursor: pointer;
}

/* ===========================
   ESTADO MINIMIZADO
=========================== */
#rs-chat-window.rs-minimized #rs-quick-menu,
#rs-chat-window.rs-minimized #rs-chat-messages,
#rs-chat-window.rs-minimized #rs-chat-form {
  display: none;
}

#rs-chat-window.rs-minimized {
  height: auto !important;
}

/* ===========================
   ANIMACIONES
=========================== */
@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(4px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes blink {
  0% {
    opacity: 0.2;
  }
  20% {
    opacity: 1;
  }
  100% {
    opacity: 0.2;
  }
}

/* ===========================
   RESPONSIVE
=========================== */
@media (max-width: 480px) {
  #rs-chat-window {
    width: 94vw;
    right: 3vw;
  }
}
