/* =========================================================================
   WHATSAPP CHAT CLONE — Grupo EON
   Widget visual que simula el chat de WhatsApp de GoHighLevel (GHL).
   No requiere edición en este archivo: todos los colores y textos se
   configuran desde whatsapp-chat-clone.js (bloque WGC_CONFIG).
   ========================================================================= */

/* Carga la tipografía Poppins de Google Fonts. Si la landing ya la carga
   por su cuenta (la mayoría de los sitios de Grupo EON lo hace), este
   @import no genera conflicto: el navegador reutiliza la fuente ya
   cacheada. Debe ir antes que cualquier otra regla del archivo. */
@import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;500;600;700&display=swap');

.wgc-widget, .wgc-widget * {
  box-sizing: border-box;
}

.wgc-widget {
  font-family: 'Poppins', system-ui, -apple-system, Segoe UI, Roboto, sans-serif;
}

/* Fuerza Poppins en TODO el widget, incluyendo controles de formulario
   (input, textarea, button), que por defecto del navegador no heredan
   la tipografía del contenedor. */
.wgc-widget * {
  font-family: inherit;
}

/* ---------- Burbuja flotante ---------- */
.wgc-bubble-btn {
  position: fixed;
  bottom: 24px;
  right: 24px;
  width: 60px;
  height: 60px;
  border-radius: 50%;
  background: var(--wgc-bubble-color, #25D366);
  border: none;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 6px 22px rgba(0, 0, 0, 0.28);
  z-index: 999999;
  transition: transform .2s ease, box-shadow .2s ease;
  padding: 0;
}

.wgc-bubble-btn:hover {
  transform: scale(1.06);
  box-shadow: 0 8px 26px rgba(0, 0, 0, 0.32);
}

.wgc-bubble-btn svg {
  width: 30px;
  height: 30px;
  fill: #fff;
}

.wgc-bubble-btn.wgc-hidden {
  opacity: 0;
  pointer-events: none;
  transform: scale(.6);
}

/* ---------- Panel del chat ---------- */
.wgc-panel {
  position: fixed;
  bottom: 100px;
  right: 24px;
  width: 400px;
  max-width: 94vw;
  height: min(760px, 85vh);
  background: #fff;
  border-radius: 18px;
  overflow: hidden;
  display: flex;
  flex-direction: column;
  box-shadow: 0 16px 48px rgba(0, 0, 0, 0.28), 0 2px 10px rgba(0, 0, 0, 0.12);
  z-index: 999998;
  opacity: 0;
  transform: translateY(18px) scale(.97);
  pointer-events: none;
  transition: opacity .22s ease, transform .22s ease;
}

.wgc-panel.wgc-open {
  opacity: 1;
  transform: translateY(0) scale(1);
  pointer-events: auto;
}

/* ---------- Header ---------- */
.wgc-header {
  display: grid;
  grid-template-columns: 44px 1fr 28px;
  align-items: center;
  gap: 12px;
  padding: 16px;
  flex-shrink: 0;
  background: linear-gradient(270deg, var(--chat-widget-header-color, #0040c1) 0%, var(--chat-widget-header-darken-color, #0040c1) 100%);
}

.wgc-avatar {
  width: 44px;
  height: 44px;
  border-radius: 50%;
  border: 2px solid rgba(255, 255, 255, .55);
  object-fit: cover;
  background: #fff;
  display: block;
}

.wgc-name {
  color: #fff;
  font-weight: 600;
  font-size: 1rem;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.wgc-collapse {
  background: none;
  border: none;
  color: #fff;
  opacity: .85;
  cursor: pointer;
  width: 28px;
  height: 28px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}

.wgc-collapse svg {
  width: 18px;
  height: 18px;
}

/* ---------- Body / mensajes ---------- */
.wgc-body {
  flex: 1;
  overflow-y: auto;
  padding: 18px 16px;
  background: #fff;
  display: flex;
  flex-direction: column;
  gap: 14px;
  scrollbar-width: thin;
  scrollbar-color: #d7dade transparent;
}

.wgc-body::-webkit-scrollbar {
  width: 6px;
}

.wgc-body::-webkit-scrollbar-thumb {
  background: #d7dade;
  border-radius: 3px;
}

.wgc-msg {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: wgc-fade-in .25s ease both;
}

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

.wgc-msg-avatar {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  object-fit: cover;
  flex-shrink: 0;
}

.wgc-bubble {
  padding: 12px 14px;
  border-radius: 14px;
  font-size: .88rem;
  line-height: 1.45;
  max-width: 78%;
}

.wgc-bubble--bot {
  background: #EEF0F3;
  color: #1c1c1c;
  border-bottom-left-radius: 4px;
}

.wgc-bubble--user {
  background: var(--wgc-brand-end, #0f8a5f);
  color: #fff;
  border-bottom-right-radius: 4px;
  white-space: pre-line;
}

.wgc-check-row {
  display: flex;
  gap: 8px;
  align-items: flex-start;
  animation: wgc-fade-in .25s ease both;
}

.wgc-check-badge {
  width: 26px;
  height: 26px;
  border-radius: 50%;
  background: var(--wgc-brand-end, #0f8a5f);
  color: #fff;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.wgc-check-badge svg {
  width: 14px;
  height: 14px;
}

.wgc-bubble--thanks strong {
  display: block;
  margin-bottom: 3px;
  font-weight: 600;
}

@keyframes wgc-fade-in {
  from { opacity: 0; transform: translateY(6px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------- Formulario ---------- */
.wgc-form {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-top: 2px;
  padding: 0 22px;
}

.wgc-form input,
.wgc-form textarea {
  width: 100%;
  border: none;
  background: #F2F4F7;
  border-radius: 10px;
  padding: 12px 14px;
  font-size: .85rem;
  font-family: inherit;
  color: #1c1c1c;
  resize: none;
}

.wgc-form textarea {
  min-height: 68px;
}

.wgc-form input:focus,
.wgc-form textarea:focus {
  outline: 2px solid var(--wgc-brand-end, #0f8a5f);
  outline-offset: 1px;
}

.wgc-form input::placeholder,
.wgc-form textarea::placeholder {
  color: #8a8f98;
  font-family: inherit;
}

/* ---------- Campo de teléfono con selector de país ---------- */
.wgc-phone-field {
  position: relative;
  display: flex;
  align-items: center;
  background: #F2F4F7;
  border-radius: 10px;
  padding-left: 8px;
}

.wgc-phone-flag {
  background: none;
  border: none;
  display: flex;
  align-items: center;
  gap: 4px;
  padding: 12px 6px;
  cursor: pointer;
  font-size: 1rem;
  line-height: 1;
  color: #1c1c1c;
  flex-shrink: 0;
}

.wgc-flag-icon {
  display: block;
  width: 18px;
  height: 13px;
  border-radius: 2px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 0 1px rgba(0, 0, 0, .08);
}

.wgc-flag-icon svg {
  display: block;
  width: 100%;
  height: 100%;
}

.wgc-chevron-icon {
  display: flex;
  flex-shrink: 0;
}

.wgc-chevron-icon svg {
  width: 11px;
  height: 11px;
}

.wgc-phone-divider {
  width: 1px;
  height: 22px;
  background: rgba(0, 0, 0, .12);
  flex-shrink: 0;
}

.wgc-phone-field input {
  background: transparent;
  border: none;
  flex: 1;
  min-width: 0;
}

.wgc-phone-dropdown {
  position: absolute;
  top: calc(100% + 6px);
  left: 0;
  background: #fff;
  border-radius: 10px;
  box-shadow: 0 10px 28px rgba(0, 0, 0, .18);
  list-style: none;
  padding: 6px 0;
  margin: 0;
  width: 220px;
  max-height: 200px;
  overflow-y: auto;
  z-index: 5;
}

.wgc-phone-dropdown[hidden] {
  display: none;
}

.wgc-phone-dropdown li {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 14px;
  font-size: .8rem;
  color: #1c1c1c;
  cursor: pointer;
}

.wgc-phone-dropdown li:hover,
.wgc-phone-dropdown li:focus {
  background: #F2F4F7;
}

/* ---------- Checkbox de consentimiento ---------- */
.wgc-consent {
  position: relative;
  display: flex;
  align-items: flex-start;
  gap: 10px;
  cursor: pointer;
  margin-top: 2px;
}

.wgc-consent input {
  position: absolute;
  top: 1px;
  left: 0;
  width: 18px;
  height: 18px;
  margin: 0;
  opacity: 0;
  cursor: pointer;
  z-index: 1;
}

.wgc-consent-box {
  width: 18px;
  height: 18px;
  border-radius: 5px;
  border: 2px solid #c9ccd1;
  flex-shrink: 0;
  margin-top: 1px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background .15s ease, border-color .15s ease;
  pointer-events: none;
}

.wgc-consent-box svg {
  width: 11px;
  height: 11px;
  stroke: #fff;
  opacity: 0;
  transition: opacity .1s ease;
}

.wgc-consent input:checked ~ .wgc-consent-box {
  background: var(--wgc-brand-end, #0f8a5f);
  border-color: var(--wgc-brand-end, #0f8a5f);
}

.wgc-consent input:checked ~ .wgc-consent-box svg {
  opacity: 1;
}

.wgc-consent-text {
  font-size: .72rem;
  color: #8a8f98;
  line-height: 1.4;
}

.wgc-consent-text a {
  color: var(--wgc-brand-end, #0f8a5f);
  text-decoration: underline;
}

.wgc-submit {
  background-color: #039855FF;
  color: #fff;
  border: none;
  border-radius: 8px;
  padding: 12px 16px;
  font-weight: 600;
  font-size: .88rem;
  font-family: inherit;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  transition: filter .15s ease;
}

.wgc-submit svg {
  width: 15px;
  height: 15px;
  fill: #fff;
  flex-shrink: 0;
}

.wgc-submit:hover {
  filter: brightness(1.08);
}

.wgc-submit:disabled {
  opacity: .7;
  cursor: default;
}

/* ---------- Footer ---------- */
.wgc-footer {
  padding: 10px;
  text-align: center;
  font-size: .72rem;
  color: #8a8f98;
  border-top: 1px solid #F0F0F0;
  flex-shrink: 0;
  background: #fff;
}

.wgc-footer a {
  color: var(--wgc-brand-end, #0f8a5f);
  font-weight: 600;
  text-decoration: none;
}

/* ---------- Responsive ---------- */
@media (max-width: 480px) {
  .wgc-panel {
    right: 12px;
    left: 12px;
    width: auto;
    bottom: 92px;
    height: min(78vh, 560px);
  }
  .wgc-bubble-btn {
    right: 16px;
    bottom: 16px;
  }
}
