/* WhatsApp Chat Widget Styles */
.wa-chat-widget {
  position: fixed;
  bottom: 90px;
  right: 20px;
  z-index: 9999;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, Helvetica, Arial, sans-serif;
}

.wa-chat-toggle {
  position: relative;
  width: 60px;
  height: 60px;
  background: #25D366;
  border: none;
  border-radius: 50%;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 16px rgba(37, 211, 102, 0.4);
  transition: all 0.3s ease;
  animation: wa-pulse 2s infinite;
  text-decoration: none;
}

.wa-chat-toggle::before {
  content: "1 mensaje";
  position: absolute;
  right: 70px;
  top: 50%;
  width: max-content;
  max-width: 170px;
  padding: 8px 12px;
  border-radius: 18px;
  background: #fff;
  color: #224a51;
  font-size: 13px;
  font-weight: 700;
  line-height: 1.2;
  box-shadow: 0 8px 24px rgba(34, 74, 81, 0.18);
  transform: translateY(-50%);
}

.wa-chat-toggle::after {
  content: "1";
  position: absolute;
  top: -3px;
  right: -2px;
  min-width: 20px;
  height: 20px;
  padding: 0 5px;
  border: 2px solid #fff;
  border-radius: 999px;
  background: #ef4444;
  color: #fff;
  font-size: 12px;
  font-weight: 800;
  line-height: 16px;
  text-align: center;
  box-shadow: 0 3px 10px rgba(239, 68, 68, 0.35);
}

.wa-chat-widget.wa-chat-open .wa-chat-toggle::before,
.wa-chat-widget.wa-chat-open .wa-chat-toggle::after,
.wa-chat-widget.wa-chat-seen .wa-chat-toggle::before,
.wa-chat-widget.wa-chat-seen .wa-chat-toggle::after {
  display: none;
}

.wa-chat-toggle i {
  font-size: 28px;
  color: #fff;
}

.wa-chat-toggle:hover {
  transform: scale(1.1);
  background: #20BD5A;
}

@keyframes wa-pulse {
  0% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0.5); }
  70% { box-shadow: 0 0 0 15px rgba(37, 211, 102, 0); }
  100% { box-shadow: 0 0 0 0 rgba(37, 211, 102, 0); }
}

.wa-chat-window {
  position: absolute;
  bottom: 70px;
  right: 0;
  z-index: 10000;
  width: 360px;
  max-width: calc(100vw - 40px);
  background: #fff;
  border-radius: 14px;
  box-shadow: 0 18px 45px rgba(0, 0, 0, 0.22);
  overflow: hidden;
  display: none;
  flex-direction: column;
}

.wa-chat-window.active {
  display: flex;
  animation: wa-slide-up 0.3s ease;
}

@keyframes wa-slide-up {
  from { opacity: 0; transform: translateY(20px); }
  to { opacity: 1; transform: translateY(0); }
}

.wa-chat-header {
  background: #075E54;
  padding: 12px 14px;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wa-chat-brand {
  display: flex;
  gap: 10px;
  align-items: center;
  min-width: 0;
}

.wa-chat-avatar {
  position: relative;
  display: grid;
  flex: 0 0 auto;
  width: 40px;
  height: 40px;
  place-items: center;
  border-radius: 50%;
  background: #e7f7ef;
  background-image: url('../img/logo.svg');
  background-size: 24px;
  background-position: center;
  background-repeat: no-repeat;
  color: transparent;
}

.wa-chat-avatar::after {
  content: "";
  position: absolute;
  right: 1px;
  bottom: 1px;
  width: 11px;
  height: 11px;
  border: 2px solid #075E54;
  border-radius: 50%;
  background: #25D366;
}

.wa-chat-header-info {
  display: flex;
  flex-direction: column;
  min-width: 0;
}

.wa-chat-title {
  color: #fff;
  font-size: 16px;
  font-weight: 700;
  line-height: 1.25;
}

.wa-chat-subtitle {
  color: #c8f2dc;
  font-size: 12px;
  line-height: 1.35;
}

.wa-chat-close {
  background: none;
  border: none;
  color: #fff;
  cursor: pointer;
  font-size: 18px;
  padding: 4px;
}

.wa-chat-messages {
  padding: 18px 14px 16px;
  height: 290px;
  overflow-y: auto;
  background:
    radial-gradient(circle at 10px 10px, rgba(255, 255, 255, 0.18) 0 2px, transparent 3px),
    linear-gradient(135deg, #efe7dd 0%, #e3d7cb 100%);
  background-size: 28px 28px, 100% 100%;
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.wa-chat-message {
  position: relative;
  max-width: 88%;
  padding: 9px 12px 7px;
  border-radius: 8px;
  font-size: 14px;
  line-height: 1.45;
  box-shadow: 0 1px 1px rgba(0, 0, 0, 0.08);
}

.wa-message-received {
  background: #fff;
  align-self: flex-start;
  border-bottom-left-radius: 4px;
}

.wa-message-received p {
  margin: 0 0 4px;
  color: #202c33;
}

.wa-message-received span {
  display: block;
  color: #667781;
  font-size: 11px;
  line-height: 1.25;
  text-align: right;
}

.wa-message-sent {
  background: #d9fdd3;
  color: #202c33;
  align-self: flex-end;
  border-bottom-right-radius: 4px;
}

.wa-message-sent p {
  margin: 0;
  color: #202c33;
}

.wa-message-sent span {
  display: block;
  margin-top: 3px;
  color: #667781;
  font-size: 11px;
  line-height: 1.25;
  text-align: right;
}

.wa-chat-input-area {
  padding: 10px;
  background: #f0f2f5;
  display: flex;
  align-items: center;
  gap: 8px;
  border-top: 1px solid rgba(17, 27, 33, 0.08);
}

.wa-chat-input-shell {
  display: flex;
  flex: 1;
  gap: 8px;
  align-items: center;
  min-width: 0;
  padding: 0 12px;
  border-radius: 22px;
  background: #fff;
}

.wa-chat-input-shell i {
  color: #8696a0;
  font-size: 16px;
}

.wa-chat-input {
  flex: 1;
  min-width: 0;
  padding: 11px 0;
  border: 0;
  background: transparent;
  color: #202c33;
  font-size: 14px;
  outline: none;
  font-family: inherit;
}

.wa-chat-input:focus {
  border-color: transparent;
}

.wa-chat-send {
  width: 40px;
  height: 40px;
  background: #25D366;
  border: none;
  border-radius: 50%;
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.wa-chat-send:hover {
  background: #20BD5A;
}

@media (max-width: 480px) {
  .wa-chat-widget {
    bottom: 80px;
    right: 10px;
  }

  .wa-chat-toggle::before {
    right: 66px;
    max-width: 140px;
    font-size: 12px;
  }

  #scrollUp {
    right: 17px;
    bottom: 152px;
  }
  
  .wa-chat-window {
    right: -6px;
    width: min(340px, calc(100vw - 20px));
    max-width: calc(100vw - 20px);
  }

  .wa-chat-messages {
    height: min(330px, calc(100vh - 265px));
    min-height: 250px;
  }
}
