/* ==========================================================================
   Forma Pura — LaunchOS AI
   Executive WhatsApp Chat Widget (UX/UI Experto)
   ========================================================================== */

:root {
  --wa-primary: #25d366;
  --wa-primary-hover: #20bd5a;
  --wa-dark-bg: #0f1311;
  --wa-card-bg: rgba(18, 24, 20, 0.94);
  --wa-header-bg: #141b16;
  --wa-bubble-bg: #1b241e;
  --wa-text-main: #f0f4f1;
  --wa-text-muted: #8e9e92;
  --wa-accent-glow: rgba(37, 211, 102, 0.25);
  --wa-border: rgba(255, 255, 255, 0.08);
}

/* Contenedor principal del widget */
.wa-widget-shell {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 99999;
  font-family: 'DM Sans', -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
  -webkit-font-smoothing: antialiased;
}

/* Botón flotante activador */
.wa-trigger-btn {
  position: relative;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: linear-gradient(135deg, #25d366 0%, #128c7e 100%);
  border: none;
  color: #ffffff;
  cursor: pointer;
  box-shadow: 0 10px 25px rgba(37, 211, 102, 0.35), 0 4px 12px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
  outline: none;
}

.wa-trigger-btn:hover {
  transform: scale(1.08) translateY(-2px);
  box-shadow: 0 14px 32px rgba(37, 211, 102, 0.45), 0 6px 16px rgba(0, 0, 0, 0.5);
}

.wa-trigger-btn:active {
  transform: scale(0.96);
}

/* Anillo de pulso sutil */
.wa-trigger-pulse {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  border-radius: 50%;
  border: 2px solid var(--wa-primary);
  animation: waPulseRing 2.4s infinite cubic-bezier(0.215, 0.61, 0.355, 1);
  pointer-events: none;
}

@keyframes waPulseRing {
  0% {
    transform: scale(0.95);
    opacity: 0.8;
  }
  50% {
    transform: scale(1.35);
    opacity: 0;
  }
  100% {
    transform: scale(1.35);
    opacity: 0;
  }
}

/* Indicador de mensaje no leído */
.wa-unread-badge {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 20px;
  height: 20px;
  background: #ff3b30;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 2px solid #0f1311;
  box-shadow: 0 2px 6px rgba(0,0,0,0.3);
  animation: waBounceBadge 0.6s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes waBounceBadge {
  0% { transform: scale(0); }
  100% { transform: scale(1); }
}

/* Iconos SVG del botón flotante */
.wa-trigger-btn svg {
  position: absolute;
  top: 50%;
  left: 50%;
  width: 32px;
  height: 32px;
  margin-top: -16px;
  margin-left: -16px;
  fill: currentColor;
  transition: transform 0.35s cubic-bezier(0.34, 1.56, 0.64, 1), opacity 0.3s ease;
}

.wa-trigger-btn .wa-icon-chat {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

.wa-trigger-btn .wa-icon-close {
  opacity: 0;
  transform: rotate(-90deg) scale(0.6);
}

.wa-widget-shell.open .wa-trigger-btn .wa-icon-chat {
  opacity: 0;
  transform: rotate(90deg) scale(0.6);
}

.wa-widget-shell.open .wa-trigger-btn .wa-icon-close {
  opacity: 1;
  transform: rotate(0deg) scale(1);
}

/* Popup de Chat Elegante */
.wa-popup-card {
  position: absolute;
  bottom: 76px;
  right: 0;
  width: 360px;
  max-width: calc(100vw - 32px);
  background: var(--wa-card-bg);
  backdrop-filter: blur(20px);
  -webkit-backdrop-filter: blur(20px);
  border: 1px solid var(--wa-border);
  border-radius: 20px;
  box-shadow: 0 20px 50px rgba(0, 0, 0, 0.6), 0 0 40px var(--wa-accent-glow);
  overflow: hidden;
  opacity: 0;
  visibility: hidden;
  transform: translateY(20px) scale(0.95);
  transform-origin: bottom right;
  transition: all 0.35s cubic-bezier(0.16, 1, 0.3, 1);
  display: flex;
  flex-direction: column;
}

.wa-widget-shell.open .wa-popup-card {
  opacity: 1;
  visibility: visible;
  transform: translateY(0) scale(1);
}

/* Encabezado del Popup */
.wa-popup-header {
  background: var(--wa-header-bg);
  padding: 16px 20px;
  display: flex;
  align-items: center;
  justify-content: space-between;
  border-bottom: 1px solid var(--wa-border);
}

.wa-header-profile {
  display: flex;
  align-items: center;
  gap: 12px;
}

.wa-avatar-shell {
  position: relative;
  width: 42px;
  height: 42px;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.05);
  border: 1px solid rgba(255, 255, 255, 0.12);
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 4px;
}

.wa-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: contain;
  border-radius: 50%;
}

.wa-online-dot {
  position: absolute;
  bottom: 0;
  right: 0;
  width: 11px;
  height: 11px;
  background: var(--wa-primary);
  border-radius: 50%;
  border: 2px solid var(--wa-header-bg);
  box-shadow: 0 0 8px var(--wa-primary);
}

.wa-header-info {
  display: flex;
  flex-direction: column;
}

.wa-header-title {
  color: var(--wa-text-main);
  font-size: 15px;
  font-weight: 700;
  line-height: 1.2;
}

.wa-header-subtitle {
  color: var(--wa-text-muted);
  font-size: 12px;
  display: flex;
  align-items: center;
  gap: 5px;
  margin-top: 2px;
}

.wa-header-subtitle::before {
  content: "";
  display: inline-block;
  width: 6px;
  height: 6px;
  background: var(--wa-primary);
  border-radius: 50%;
}

.wa-close-btn {
  background: transparent;
  border: none;
  color: var(--wa-text-muted);
  cursor: pointer;
  font-size: 20px;
  width: 30px;
  height: 30px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
}

.wa-close-btn:hover {
  background: rgba(255, 255, 255, 0.1);
  color: var(--wa-text-main);
}

/* Cuerpo del Chat */
.wa-popup-body {
  padding: 20px;
  max-height: 340px;
  overflow-y: auto;
  display: flex;
  flex-direction: column;
  gap: 14px;
  background: radial-gradient(circle at top right, rgba(37, 211, 102, 0.05), transparent 70%);
}

.wa-chat-timestamp {
  align-self: center;
  font-size: 11px;
  color: var(--wa-text-muted);
  background: rgba(255, 255, 255, 0.04);
  padding: 4px 10px;
  border-radius: 12px;
  border: 1px solid rgba(255, 255, 255, 0.05);
}

/* Burbuja de mensaje recibida */
.wa-msg-bubble {
  background: var(--wa-bubble-bg);
  border: 1px solid var(--wa-border);
  border-radius: 16px 16px 16px 4px;
  padding: 14px 16px;
  color: var(--wa-text-main);
  font-size: 13.5px;
  line-height: 1.5;
  box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
  position: relative;
  animation: waFadeInMsg 0.4s ease-out;
}

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

.wa-msg-bubble strong {
  color: var(--wa-primary);
  font-weight: 600;
}

/* Chips de sugerencia / atajos */
.wa-suggestions-label {
  font-size: 11px;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  color: var(--wa-text-muted);
  margin-top: 4px;
}

.wa-chips-container {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.wa-chip-btn {
  background: rgba(255, 255, 255, 0.04);
  border: 1px solid rgba(255, 255, 255, 0.09);
  border-radius: 12px;
  padding: 10px 14px;
  color: var(--wa-text-main);
  font-size: 12.5px;
  text-align: left;
  cursor: pointer;
  transition: all 0.25s ease;
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.wa-chip-btn:hover {
  background: rgba(37, 211, 102, 0.12);
  border-color: rgba(37, 211, 102, 0.35);
  color: #ffffff;
  transform: translateX(4px);
}

.wa-chip-btn span {
  color: var(--wa-primary);
  font-weight: bold;
  margin-left: 6px;
}

/* Área de entrada y envío */
.wa-popup-footer {
  padding: 14px 16px;
  background: var(--wa-header-bg);
  border-top: 1px solid var(--wa-border);
}

.wa-input-form {
  display: flex;
  align-items: center;
  gap: 10px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 255, 255, 0.1);
  border-radius: 25px;
  padding: 4px 6px 4px 16px;
  transition: border-color 0.25s ease;
}

.wa-input-form:focus-within {
  border-color: var(--wa-primary);
  box-shadow: 0 0 12px rgba(37, 211, 102, 0.2);
}

.wa-input-field {
  flex: 1;
  background: transparent;
  border: none;
  color: var(--wa-text-main);
  font-size: 13.5px;
  outline: none;
  font-family: inherit;
}

.wa-input-field::placeholder {
  color: var(--wa-text-muted);
}

.wa-send-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--wa-primary);
  border: none;
  color: #ffffff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s ease, transform 0.2s ease;
}

.wa-send-btn:hover {
  background: var(--wa-primary-hover);
  transform: scale(1.05);
}

.wa-send-btn svg {
  width: 18px;
  height: 18px;
  fill: currentColor;
  transform: translateX(1px);
}

/* Ajuste Responsivo Móvil */
@media (max-width: 480px) {
  .wa-widget-shell {
    bottom: 16px;
    right: 16px;
  }
  .wa-popup-card {
    bottom: 70px;
    right: 0;
    width: calc(100vw - 32px);
    border-radius: 16px;
  }
}
