/* Base */
.whmsg {
  position: relative; /* para el badge flotante */
  font-family: system-ui, -apple-system, Segoe UI, Roboto, Arial, sans-serif;
  /* border: 1px solid #e5e7eb; ← ELIMINADO */
  border-radius: 12px;
  padding: 12px;
  background: #fff;
  /* Mantener el ancho con un contenedor invisible */
  min-width: 400px; /* ajusta según necesites */
  max-width: 100%;
}

.whmsg-list {
  /* max-height: 420px;   ← eliminar */
  /* overflow-y: auto;    ← eliminar */
  border: 1px solid #f1f5f9;
  border-radius: 8px;
  background: #f7f7f7; /* gris claro */
  padding: 12px;
}

.whmsg-container {
  background: #ffffff; /* por defecto blanco */
  border: 1px solid #ddd;
  border-radius: 8px;
  overflow: hidden; /* para que los bordes envuelvan todo */
}

.whmsg-item {
  padding: 8px 10px;
  margin-bottom: 8px;
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
}

.whmsg-meta {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

.whmsg-user {
  font-weight: 600;
  color: #374151;
}

.whmsg-time {
  font-size: 12px;
  color: #9ca3af;
  white-space: nowrap;
}

.whmsg-text { white-space: pre-wrap; word-break: break-word; }

.whmsg-media {
  width: 100%;
  max-height: 360px;
  border-radius: 8px;
  background: #000;
}

/* Composer */
.whmsg-composer {
   background: #ffffff;
  padding: 12px;
  border-bottom: 1px solid #ddd; /* separación clara */
  margin-bottom: 16px;     /* separación con la lista */
}

.whmsg-composer textarea {
  width: 100%;
  min-height: 70px;
  resize: vertical;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font: inherit;
}

.whmsg-actions {
  display: flex;
  gap: 8px;
  align-items: center;
  justify-content: space-between;
}

.whmsg-attach {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 6px 10px;
  border: 1px dashed #cbd5e1;
  border-radius: 8px;
  cursor: pointer;
  user-select: none;
  color: #334155;
  background: #f8fafc;
}

.whmsg-attach.is-uploading { opacity: .7; cursor: not-allowed; }

.whmsg-actions button {
  padding: 8px 12px;
  border: none;
  border-radius: 8px;
  background: #111827;
  color: #fff;
  cursor: pointer;
}
.whmsg-actions button:disabled { opacity: .6; cursor: not-allowed; }

/* Barra de progreso + label */
.whmsg-progress {
  position: relative;
  height: 12px;
  background: #f3f4f6;
  border-radius: 999px;
  margin-top: 8px;
  display:none;
}
.whmsg-progress-bar {
  position: absolute;
  left: 0; top: 0; bottom: 0;
  width: 0%;
  background: #2563eb;
  border-radius: 999px;
  transition: width .15s linear;
}
.whmsg-progress-label {
  display: block;
  font-size: 12px;
  margin-top: 6px;
  color: #111827;
  font-weight: 600;
  text-align: right;
}

/* Badge flotante con el % */
.whmsg-progress-badge {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #111827;
  color: #fff;
  padding: 4px 8px;
  border-radius: 999px;
  font-weight: 700;
  font-size: 12px;
  box-shadow: 0 2px 6px rgba(0,0,0,.15);
  display: none;
}

/* Botón "Quitar" del pendiente */
.whmsg-pending .whmsg-pending-remove {
  margin-left: 8px;
  padding: 2px 8px;
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  background: #fff;
  cursor: pointer;
  font-size: 12px;
}

/* Bloque de procesamiento por fases dentro de cada mensaje */
.whmsg-processing { margin: 6px 0 2px; }
.whmsg-proc-bar {
  height: 8px;
  background: #e5e7eb;
  border-radius: 999px;
  overflow: hidden;
}
.whmsg-proc-inner {
  height: 100%;
  width: 10%;
  background: #10b981; /* verde */
  transition: width .25s linear;
}
.whmsg-proc-label {
  margin-top: 6px;
  font-size: 12px;
  color: #374151;
}

/* Campos Nombre/Email */
.whmsg-fields {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 8px;
}
.whmsg-field .whmsg-input,
.whmsg-input {
  width: 100%;
  padding: 8px;
  border: 1px solid #e5e7eb;
  border-radius: 8px;
  font: inherit;
}
.whmsg-input.invalid {
  border-color: #ef4444;
  background: #fef2f2;
}
@media (max-width: 600px) {
  .whmsg-fields { grid-template-columns: 1fr; }
  .whmsg { min-width: unset; } /* En móvil no forzar ancho mínimo */
}

/* Botón Enviar: apariencia normal por defecto */
.whmsg .whmsg-actions button {
  cursor: pointer;
  opacity: 1;
  transition: opacity .15s ease;
}

/* Cuando el JS lo marca como "no listo", no pongas cursor tachado ni gris fuerte */
.whmsg .whmsg-actions button.is-disabled {
  opacity: .95;           /* leve cambio, que no parezca roto */
  cursor: pointer;        /* nada de not-allowed */
}

/* Mic button + badge */
.whmsg .whmsg-actions {
  display: flex;
  align-items: center;
  gap: .5rem;
  flex-wrap: wrap;
}
.whmsg .whmsg-attach,
.whmsg .whmsg-actions button,
.whmsg .whmsg-mic {
  padding: .5rem .8rem;
  border-radius: .5rem;
  border: 1px solid #e5e7eb;
  background: #f9fafb;
}
.whmsg .whmsg-mic { cursor: pointer; }
.whmsg .whmsg-mic.is-off { opacity: .6; cursor: not-allowed; }
.whmsg .whmsg-mic.recording {
  background: #fee2e2;
  border-color: #fecaca;
}
.whmsg .whmsg-rec-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: 12px;
  color: #b91c1c;
  padding: .15rem .4rem;
  border: 1px solid #fecaca;
  border-radius: .4rem;
  background: #fff;
}

/* Botón Enviar "desactivado visual" (pero clickable) */
.whmsg .whmsg-actions button.is-disabled {
  opacity: .95;
  cursor: pointer;
}

/* Asegura que el texto de botones sea visible (algunos temas lo ocultan) */
.whmsg .whmsg-actions button,
.whmsg .whmsg-attach,
.whmsg .whmsg-mic {
  color: #111827 !important;
  text-indent: 0 !important;
  font-size: 14px !important;
  line-height: 1.2;
  white-space: nowrap;
}

/* Botón Enviar marcado como "no listo" pero visible */
.whmsg .whmsg-actions button.is-disabled {
  opacity: .95;
  cursor: pointer;
  color: #111827 !important;
}

/* Micrófono y badge REC */
.whmsg .whmsg-mic { cursor: pointer; }
.whmsg .whmsg-mic.is-off { opacity: .6; cursor: not-allowed; }
.whmsg .whmsg-mic.recording {
  background: #fee2e2;
  border-color: #fecaca;
}
.whmsg .whmsg-rec-badge {
  display: inline-flex;
  align-items: center;
  gap: .4rem;
  font-size: 12px;
  color: #b91c1c;
  padding: .15rem .4rem;
  border: 1px solid #fecaca;
  border-radius: .4rem;
  background: #fff;
}

/* Más aire entre los campos nombre/email */
.whmsg .whmsg-fields {
  display: flex;
  gap: 12px;            /* ← separa los inputs */
  margin-bottom: 10px;  /* ← separa inputs del textarea */
  flex-wrap: wrap;      /* ← que se apilen en móvil */
}
.whmsg .whmsg-field {
  flex: 1 1 240px;      /* ← que cada uno ocupe ~la mitad y crezca */
}
.whmsg .whmsg-field .whmsg-input {
  width: 100%;
}

/* Separación entre formulario y la zona de estados (pending/progreso) */
.whmsg .whmsg-pending,
.whmsg .whmsg-progress,
.whmsg .whmsg-send-hint,
.whmsg .whmsg-mux-warn {
  margin-top: 8px;
  margin-bottom: 12px; /* clave para que no "pegue" con la lista */
}


/* Estilos para mensajes intercalados - Añadir al archivo CSS del widget */

.whmsg-item {
  padding: 12px 16px;
  margin-bottom: 2px;
  border-radius: 8px;
  transition: background-color 0.2s ease;
}

/* Mensajes pares - tono muy claro gris/azul */
.whmsg-item:nth-child(even) {
  background-color: #E0FFED;
  border-left: 3px solid #e2e8f0;
}

/* Mensajes impares - tono muy claro beige/crema */
.whmsg-item:nth-child(odd) {
  background-color: #fefefe;
  border-left: 3px solid #f1f5f9;
}

/* Efecto hover sutil */
.whmsg-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
}

/* Mensajes pares hover */
.whmsg-item:nth-child(even):hover {
  background-color: #f1f5f9;
  border-left-color: #cbd5e1;
}

/* Mensajes impares hover */
.whmsg-item:nth-child(odd):hover {
  background-color: #f8fafc;
  border-left-color: #e2e8f0;
}

/* Mejorar el espaciado de la meta información */
.whmsg-meta {
  margin-bottom: 8px;
  padding-bottom: 4px;
  border-bottom: 1px solid rgba(0, 0, 0, 0.06);
}

/* Estilo para el contenido del texto */
.whmsg-text {
  line-height: 1.5;
  color: #374151;
  margin-top: 4px;
}

/* Mejorar el estilo de los videos/audios */
.whmsg-media {
  margin-top: 8px;
  border-radius: 6px;
  max-width: 100%;
}

/* Estilo para mensajes en procesamiento */
.whmsg-processing {
  background-color: #fef3cd;
  border-left-color: #fbbf24 !important;
  position: relative;
}

.whmsg-processing::before {
  content: "⏳";
  position: absolute;
  top: 8px;
  right: 12px;
  font-size: 14px;
  opacity: 0.7;
}