/**
 * RECONSTRUCCIÓN FORENSE DE INTERFAZ ESTILO WHATSAPP WEB
 * Diseñado con base en la captura de referencia forense (media_1794666398023_c2f76fd6.jpg)
 * Cumple con el deber de identificación como copia técnica representativa (Art. 246 CGP)
 */

.wa-container {
  display: flex;
  flex-direction: column;
  height: 100%;
  max-height: 820px;
  background-color: #efeae2;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  border: 1px solid #d1d7db;
  position: relative;
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Marca de Agua / Banner Pericial Superior */
.wa-forensic-disclaimer {
  background: linear-gradient(90deg, #0f2b48 0%, #1e4976 100%);
  color: #f0f6fc;
  font-size: 11px;
  padding: 6px 14px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 500;
  letter-spacing: 0.3px;
  border-bottom: 1px solid rgba(255, 255, 255, 0.15);
  z-index: 10;
}

.wa-forensic-disclaimer .badge {
  background: #f08800;
  color: #111;
  font-size: 9.5px;
  padding: 2px 6px;
  border-radius: 3px;
  font-weight: 700;
  text-transform: uppercase;
}

/* Cabecera idéntica a WhatsApp Web */
.wa-header {
  height: 60px;
  background-color: #f0f2f5;
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 10px 16px;
  border-bottom: 1px solid #d1d7db;
  z-index: 5;
}

.wa-contact-info {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
}

.wa-avatar {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  object-fit: cover;
  background-color: #dfe5e7;
  border: 1px solid #c4c9cc;
}

.wa-contact-meta {
  display: flex;
  flex-direction: column;
}

.wa-contact-name {
  font-size: 16px;
  font-weight: 500;
  color: #111b21;
  display: flex;
  align-items: center;
  gap: 8px;
}

.wa-block-pill {
  font-size: 12px;
  color: #ea0038;
  background: #ffebe8;
  border-radius: 12px;
  padding: 1px 8px;
  font-weight: 500;
}

.wa-contact-status {
  font-size: 12px;
  color: #667781;
}

.wa-header-actions {
  display: flex;
  align-items: center;
  gap: 16px;
  color: #54656f;
}

.wa-icon-btn {
  background: transparent;
  border: none;
  cursor: pointer;
  padding: 6px;
  border-radius: 50%;
  color: #54656f;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: background 0.2s;
}

.wa-icon-btn:hover {
  background: rgba(0, 0, 0, 0.05);
}

/* Área de Conversación con Doodle Wallpaper */
.wa-chat-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 40px;
  background-color: #efeae2;
  background-image: url('../assets/doodle-pattern.svg');
  background-repeat: repeat;
  background-size: 380px;
  display: flex;
  flex-direction: column;
  gap: 6px;
  position: relative;
}

/* Mensajes del Sistema / Cifrado Extremo a Extremo */
.wa-system-message {
  align-self: center;
  background-color: rgba(255, 255, 255, 0.92);
  border-radius: 7.5px;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  padding: 6px 14px;
  font-size: 12px;
  color: #54656f;
  text-align: center;
  max-width: 82%;
  margin: 10px 0;
  line-height: 1.4;
  display: flex;
  align-items: center;
  gap: 6px;
  justify-content: center;
}

.wa-system-message svg {
  flex-shrink: 0;
  fill: #54656f;
}

/* Fila de Mensaje */
.wa-msg-wrapper {
  display: flex;
  width: 100%;
  margin-bottom: 4px;
  align-items: flex-start;
  gap: 8px;
}

.wa-msg-wrapper.outgoing {
  justify-content: flex-end;
}

.wa-msg-wrapper.incoming {
  justify-content: flex-start;
}

/* Selector forense de inclusión en informe */
.wa-msg-selector {
  opacity: 0.4;
  transition: opacity 0.2s;
  cursor: pointer;
  align-self: center;
}

.wa-msg-wrapper:hover .wa-msg-selector,
.wa-msg-selector:checked {
  opacity: 1;
}

/* Burbujas de chat */
.wa-bubble {
  max-width: 65%;
  min-width: 120px;
  padding: 6px 9px 8px 9px;
  border-radius: 7.5px;
  position: relative;
  box-shadow: 0 1px 0.5px rgba(11, 20, 26, 0.13);
  font-size: 14.2px;
  line-height: 19px;
  color: #111b21;
}

/* Burbuja saliente (John Huertas - Verde WhatsApp #d9fdd3) */
.wa-bubble.outgoing {
  background-color: #d9fdd3;
  border-top-right-radius: 0;
}

.wa-bubble.outgoing::before {
  content: "";
  position: absolute;
  top: 0;
  right: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid #d9fdd3;
  border-right: 8px solid transparent;
}

/* Burbuja entrante (Dr. Andrés Guzmán - Blanco puro #ffffff) */
.wa-bubble.incoming {
  background-color: #ffffff;
  border-top-left-radius: 0;
}

.wa-bubble.incoming::before {
  content: "";
  position: absolute;
  top: 0;
  left: -8px;
  width: 0;
  height: 0;
  border-top: 8px solid #ffffff;
  border-left: 8px solid transparent;
}

/* Remitente dentro de la burbuja */
.wa-bubble-sender {
  font-size: 12.8px;
  font-weight: 500;
  margin-bottom: 2px;
}

.wa-bubble-sender.remote {
  color: #128c7e;
}

.wa-bubble-sender.local {
  color: #075e54;
}

/* Indicativo Reenviado */
.wa-forwarded-tag {
  font-size: 12px;
  font-style: italic;
  color: #667781;
  display: flex;
  align-items: center;
  gap: 4px;
  margin-bottom: 4px;
}

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

/* Tarjeta Enriquecida de Enlace (Rich Link Preview) */
.wa-link-preview-card {
  margin-top: 6px;
  background-color: #f0f2f5;
  border-radius: 6px;
  overflow: hidden;
  cursor: pointer;
  border: 1px solid #e2e8f0;
  transition: background 0.2s;
}

.wa-link-preview-card:hover {
  background-color: #e4e6eb;
}

.wa-link-img {
  width: 100%;
  max-height: 220px;
  object-fit: cover;
  display: block;
}

.wa-link-details {
  padding: 8px 10px;
}

.wa-link-title {
  font-size: 13.5px;
  font-weight: 600;
  color: #111b21;
  line-height: 1.25;
  margin-bottom: 3px;
}

.wa-link-desc {
  font-size: 12px;
  color: #667781;
  line-height: 1.3;
  margin-bottom: 4px;
  display: -webkit-box;
  -webkit-line-clamp: 2;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.wa-link-domain {
  font-size: 11px;
  color: #54656f;
  display: flex;
  align-items: center;
  gap: 4px;
}

/* Tarjeta de Audio y Nota de Voz */
.wa-audio-card {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 6px 0;
  min-width: 260px;
}

.wa-audio-play-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: #00a884;
  color: white;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  flex-shrink: 0;
}

.wa-audio-waveform-container {
  flex: 1;
  display: flex;
  flex-direction: column;
  gap: 3px;
}

.wa-audio-waveform-canvas {
  width: 100%;
  height: 28px;
}

.wa-audio-time-row {
  display: flex;
  justify-content: space-between;
  font-size: 11px;
  color: #667781;
}

/* Pie de burbuja (Hora + Doble Check azul) */
.wa-bubble-footer {
  float: right;
  margin-left: 10px;
  margin-top: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  font-size: 11px;
  color: #667781;
  user-select: none;
}

.wa-double-check {
  color: #53bdeb;
  font-size: 13px;
  line-height: 1;
}

/* Acciones Forenses flotantes en hover */
.wa-msg-forensic-tools {
  display: none;
  position: absolute;
  top: -12px;
  right: 10px;
  background: white;
  border-radius: 16px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.18);
  padding: 2px 6px;
  gap: 6px;
  z-index: 10;
}

.wa-bubble:hover .wa-msg-forensic-tools {
  display: flex;
}

.wa-tool-badge {
  font-size: 10px;
  padding: 2px 6px;
  border-radius: 10px;
  background: #eef2f6;
  color: #0f2b48;
  cursor: pointer;
  font-weight: 600;
  border: 1px solid #d0d7de;
}

.wa-tool-badge:hover {
  background: #0f2b48;
  color: white;
}

/* Barra inferior decorativa estilo WhatsApp */
.wa-footer-bar {
  height: 62px;
  background-color: #f0f2f5;
  display: flex;
  align-items: center;
  padding: 5px 16px;
  gap: 12px;
  border-top: 1px solid #d1d7db;
}

.wa-input-mock {
  flex: 1;
  height: 42px;
  background: #ffffff;
  border-radius: 8px;
  border: 1px solid #ffffff;
  padding: 9px 12px;
  font-size: 15px;
  color: #667781;
  display: flex;
  align-items: center;
}
