/* Botón flotante — Chat Alianza */

.chat-bot-button {
  position: fixed;
  bottom: 30px;
  right: 30px;
  width: 110px;
  height: 110px;
  background-color: transparent;
  border-radius: 50%;
  display: flex;
  justify-content: center;
  align-items: center;
  cursor: pointer;
  z-index: 10000;
  border: none;
  padding: 0;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1);
  animation: chatPopIn 1s cubic-bezier(0.68, -0.55, 0.265, 1.55) backwards;
}

@keyframes chatPopIn {
  0% { transform: scale(0) rotate(-180deg); opacity: 0; }
  100% { transform: scale(1) rotate(0deg); opacity: 1; }
}

.chat-bot-button::before,
.chat-bot-button::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid #f5a800;
  opacity: 0;
  z-index: -1;
  animation: chatGoldRipple 2s infinite linear;
}

.chat-bot-button::after {
  animation-delay: 1s;
}

@keyframes chatGoldRipple {
  0% { width: 80%; height: 80%; opacity: 0.8; border-width: 2px; }
  100% { width: 160%; height: 160%; opacity: 0; border-width: 0; }
}

.chat-bot-button:hover {
  transform: scale(1.1) rotate(5deg);
}

.chat-bot-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
  border: 3px solid #3b82f6;
  box-shadow:
    0 0 12px rgba(59, 130, 246, 0.95),
    0 0 28px rgba(37, 99, 235, 0.75),
    0 0 48px rgba(29, 78, 216, 0.45);
  filter: drop-shadow(0 4px 8px rgba(43, 61, 115, 0.4));
  animation: chatFloatImg 3s ease-in-out infinite;
}

@keyframes chatFloatImg {
  0%, 100% { transform: translateY(0); }
  50% { transform: translateY(-6px); }
}

.chat-popup {
  position: fixed;
  bottom: 160px;
  right: 30px;
  width: 320px;
  max-width: calc(100vw - 2rem);
  background-color: #ffffff;
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(43, 61, 115, 0.25);
  padding: 0;
  z-index: 9999;
  overflow: hidden;
  transform-origin: bottom right;
  transform: scale(0);
  opacity: 0;
  transition: all 0.4s cubic-bezier(0.19, 1, 0.22, 1);
  border: 1px solid rgba(245, 168, 0, 0.3);
}

.chat-popup.visible {
  transform: scale(1);
  opacity: 1;
}

.chat-header {
  background: linear-gradient(135deg, #2b3d73 0%, #1a264a 100%);
  color: #ffffff;
  padding: 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  position: relative;
}

.chat-header::after {
  content: '';
  position: absolute;
  bottom: 0;
  left: 0;
  width: 100%;
  height: 4px;
  background: #f5a800;
}

.chat-header h3 {
  margin: 0;
  font-weight: 600;
  font-size: 17px;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 8px;
}

.chat-header__icon {
  width: 24px;
  filter: brightness(0) invert(1);
}

.close-btn {
  background: none;
  border: none;
  color: #ffffff;
  font-size: 24px;
  cursor: pointer;
  line-height: 1;
  padding: 0;
}

.chat-body {
  padding: 25px 20px;
  text-align: center;
  background-color: #ffffff;
  background-image: radial-gradient(#f5a800 0.5px, transparent 0.5px);
  background-size: 15px 15px;
}

.chat-message {
  background-color: #f4f6f9;
  padding: 15px 18px;
  border-radius: 15px;
  border-top-left-radius: 2px;
  text-align: left;
  margin-bottom: 20px;
  font-size: 14px;
  color: #2b3d73;
  box-shadow: 0 2px 5px rgba(0, 0, 0, 0.05);
  border-left: 3px solid #f5a800;
  line-height: 1.5;
  opacity: 0;
}

.start-chat-btn {
  background: linear-gradient(90deg, #f5a800, #ffb72b);
  color: #2b3d73;
  border: none;
  padding: 15px 25px;
  border-radius: 50px;
  font-weight: 700;
  cursor: pointer;
  width: 100%;
  font-size: 16px;
  box-shadow: 0 4px 15px rgba(245, 168, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  text-transform: uppercase;
  transition: all 0.3s;
}

.start-chat-btn:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 20px rgba(245, 168, 0, 0.6);
}

.bank-secure {
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 20px;
  font-size: 13px;
  color: #555;
  opacity: 0;
}

.bank-secure svg {
  width: 16px;
  height: 16px;
  fill: #2b3d73;
  margin-right: 6px;
}

@keyframes chatSlideIn {
  from { opacity: 0; transform: translateY(10px); }
  to { opacity: 1; transform: translateY(0); }
}

@keyframes chatFadeIn {
  to { opacity: 1; }
}

.chat-popup.visible .chat-message {
  animation: chatSlideIn 0.5s ease-out 0.2s forwards;
}

.chat-popup.visible .bank-secure {
  animation: chatFadeIn 0.8s ease forwards 0.6s;
}

@media (max-width: 480px) {
  .chat-bot-button {
    width: 90px;
    height: 90px;
    bottom: 20px;
    right: 20px;
  }

  .chat-popup {
    right: 20px;
    bottom: 130px;
    width: min(320px, calc(100vw - 2.5rem));
  }
}
