/* === ESTILO ORIGINAL ANTIGUO ===*/
/* === style.css  === */
/* NO ELIMINAR - Este archivo controla estructura general, header, footer, modales y más */

:root {
  --input-nick-ancho: 80%;
  --color-header-fondo: linear-gradient(135deg, #128C7E, #075E54);
  --color-header-texto: white;
  --fuente-chat: 'Segoe UI', Helvetica, Arial, sans-serif;
  --safe-area-bottom: env(safe-area-inset-bottom, 0px);
  --vh: 1vh;
}
/* NO ELIMINAR - Variables CSS globales usadas en layout y responsive */

* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
  font-family: var(--fuente-chat);
  -webkit-font-smoothing: antialiased;
  -moz-osx-font-smoothing: grayscale;
}
/* NO ELIMINAR - Reset global y fuente base. Puede afectar tipografía de burbujas nuevas */

body, html {
  width: 100%;
  height: 100%;
  margin: 0;
  padding: 0;
  overflow: hidden;
  background-color: #ddd;
}
/* NO ELIMINAR - Fondo general del chat. No afecta burbujas, pero sí contenedor */

.chat-container {
  position: fixed;
  top: 0;
  left: 50%;
  transform: translateX(-50%);
  width: 100%;
  /*max-width: 400px;*/
  height: calc(100 * var(--vh) - var(--safe-area-bottom));
  height: 100dvh;
  border: 0px solid #ddd;
  background: white;
  display: flex;
  flex-direction: column;
  box-shadow: 0 10px rgba(0,0,0,0.1);
  z-index: 1;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
  overflow: hidden;
}
/* NO ELIMINAR - Contenedor principal del chat. Define altura, posición y layout general */

.chat-header {
  background: var(--color-header-fondo);
  color: var(--color-header-texto);
  padding: 12px 16px;
  display: flex;
  align-items: center;
  gap: 12px;
  flex-shrink: 0;
  z-index: 10;
  border-top-left-radius: 0;
  border-top-right-radius: 0;
}
/* NO ELIMINAR - Header del chat. No afecta burbujas, pero es parte esencial de la UI */

.header-icon {
  width: 45px;
  height: 45px;
  border-radius: 50%;
  overflow: hidden;
  display: flex;
  background-color: #075E54;
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}
/* NO ELIMINAR - Estilo del ícono/avatar en header */

.header-avatar-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
}
/* NO ELIMINAR - Imagen dentro del ícono de header */

.header-info h4 {
  font-size: 18px;
  font-weight: 500;
  color: var(--color-header-texto);
  margin: 0;
}
/* NO ELIMINAR - Título en header */

.header-info p {
  font-size: 12px;
  color: rgba(255, 255, 255, 0.8);
  margin: 4px 0 0 0;
  font-weight: 400;
}
/* NO ELIMINAR - Subtítulo en header */

.chat-body {
  flex: 1;
  display: flex;
  flex-direction: column-reverse;
  overflow-y: auto;
  padding: 5px;
  gap: 0px;  /* espacio entre hijos del cmtenedor*/
  background-color: #e5ddd5;
  background-image: url("data:image/svg+xml,%3Csvg width='100' height='100' viewBox='0 0 100 100' xmlns='http://www.w3.org/2000/svg'%3E%3Cpath d='M11 18c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm48 25c3.866 0 7-3.134 7-7s-3.134-7-7-7-7 3.134-7 7 3.134 7 7 7zm-43-7c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm63 31c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM34 90c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zm56-76c1.657 0 3-1.343 3-3s-1.343-3-3-3-3 1.343-3 3 1.343 3 3 3zM12 86c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm28-65c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm23-11c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-6 60c2.21 0 4-1.79 4-4s-1.79-4-4-4-4 1.79-4 4 1.79 4 4 4zm29 22c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zM32 63c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm57-13c2.76 0 5-2.24 5-5s-2.24-5-5-5-5 2.24-5 5 2.24 5 5 5zm-9-21c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM60 91c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM35 41c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2zM12 60c1.105 0 2-.895 2-2s-.895-2-2-2-2 .895-2 2 .895 2 2 2z' fill='%23d4f7ec' fill-opacity='0.9' fill-rule='evenodd'/%3E%3C/svg%3E");
  background-repeat: repeat;
  background-position: center;
  background-size: 100px 100px;
  background-attachment: local;
}
/* NO ELIMINAR - Fondo y layout del cuerpo del chat. 
   ⚠️ flex-direction: column-reverse puede afectar orden de mensajes si usas appendChild en vez de insertBefore. */

.chat-footer {
  padding: 8px 8px calc(8px + var(--safe-area-bottom)) 8px;
  background-color: #f0f2f5;
  border-top: 1px solid #ddd;
  flex-shrink: 0;
}
/* NO ELIMINAR - Footer del chat (input, botones) */

.chat-input-container {
  display: flex;
  align-items: center;
  background-color: white;
  border: 1px solid #ddd;
  border-radius: 20px;
  padding: 4px 8px;
  gap: 8px;
  position: relative;
}
/* NO ELIMINAR - Contenedor del input de texto */

.chat-input-container input {
  flex: 1;
  padding: 10px 8px;
  border: none;
  outline: none;
  font-size: 15px;
  background: transparent;
  color: #000;
}
/* NO ELIMINAR - Estilo del input de texto */

.chat-input-container input::placeholder {
  color: #999;
}
/* NO ELIMINAR - Estilo del placeholder */

.chat-input-container button {
  background: none;
  border: none;
  font-size: 18px;
  cursor: pointer;
  color: #919191;
  display: flex;
  align-items: center;
  justify-content: center;
  width: 36px;
  height: 36px;
  border-radius: 50%;
  transition: background-color 0.2s;
}
/* NO ELIMINAR - Botones en input (adjuntar, emoji, enviar) */

.chat-input-container button:hover {
  background-color: #e0e0e0;
}
/* NO ELIMINAR - Hover en botones */

.btn-send {
  background-color: #128C7E !important;
  color: white !important;
}
/* NO ELIMINAR - Botón de enviar */

.btn-send i {
  color: white;
}
/* NO ELIMINAR - Ícono en botón enviar */

.btn-attach i,
.btn-emoji i {
  font-size: 22px;
}
/* NO ELIMINAR - Íconos de adjuntar y emoji */

/* MODALES */
.modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  background-color: rgba(0, 0, 0, 0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 2000;
  visibility: hidden;
  opacity: 0;
  transition: all 0.3s ease;
  padding: 20px;
  box-sizing: border-box;
}
/* NO ELIMINAR - Overlay de modales */

.modal-overlay.active {
  visibility: visible;
  opacity: 1;
}
/* NO ELIMINAR - Clase activa para mostrar modal */

.modal {
  background: white;
  border-radius: 10px;
  width: 100%;
  max-width: 340px;
  text-align: center;
  box-shadow: 0 4px 20px rgba(0,0,0,0.2);
  overflow: hidden;
}
/* NO ELIMINAR - Estilo base de modales */

.modal h3 {
  margin-bottom: 15px;
  color: #128C7E;
  font-size: 18px;
}
/* NO ELIMINAR - Título en modales */

.modal .input-group-centered {
  display: inline-block;
  text-align: left;
  width: 100%;
  padding: 0 5%;
}
/* NO ELIMINAR - Grupo de inputs en modales */

.modal .input-group-centered label {
  display: block;
  font-weight: 600;
  font-size: 14px;
  color: #333;
  margin-bottom: 6px;
  padding-left: 12px;
  text-align: left;
}
/* NO ELIMINAR - Etiquetas en inputs de modales */

.modal .input-group-centered input {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #ccc;
  border-radius: 8px;
  font-size: 15px;
  font-weight: bold;
  font-family: 'Segoe UI', system-ui, sans-serif;
  text-align: left;
  background-color: #fafafa;
  box-sizing: border-box;
}
/* NO ELIMINAR - Inputs en modales */

.modal button {
  background-color: #128C7E;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  margin-top: 15px;
}
/* NO ELIMINAR - Botones en modales */

.modal button:hover {
  background-color: #0b6a54;
}
/* NO ELIMINAR - Hover en botones de modales */

.modal .error {
  color: #e51c23;
  font-size: 13px;
  margin: 5px 0;
}
/* NO ELIMINAR - Mensajes de error en modales */

/* ========== ESTILOS ESPECÍFICOS PARA FORMULARIOS DE MODALES ========== */
.modal-form {
  display: flex;
  flex-direction: column;
  gap: 8px;
  padding: 16px;
  background: white;
}
/* NO ELIMINAR - Formularios en modales */

.modal-input-row {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  color: #555;
}
/* NO ELIMINAR - Filas de inputs en formularios */

.modal-input-row label {
  flex: 0 0 90px;
  text-align: left;
  font-weight: 500;
  font-size: 14px;
}
/* NO ELIMINAR - Etiquetas en filas de inputs */

.modal-input-row input {
  flex: 1;
  min-width: 0;
  width: 180px;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  color: #333;
}
/* NO ELIMINAR - Inputs en filas */

.modal-input-row input[type="file"] {
  width: 180px;
  padding: 8px 10px;
  border: 1px solid #ddd;
  border-radius: 6px;
  font-size: 14px;
  color: #333;
  background: white;
  cursor: pointer;
}
/* NO ELIMINAR - Input tipo file */

.modal-input-row input[type="file"]::-webkit-file-upload-button {
  display: none;
}
/* NO ELIMINAR - Ocultar botón nativo de file input */

.modal-submit {
  background-color: #128C7E;
  color: white;
  border: none;
  padding: 10px 20px;
  border-radius: 8px;
  cursor: pointer;
  font-size: 15px;
  margin: 18px auto 15px;
  align-self: center;
}
/* NO ELIMINAR - Botón de submit en formularios */

.modal-submit:hover {
  background-color: #0b6a54;
}
/* NO ELIMINAR - Hover en botón submit */

.modal-error {
  color: #e51c23;
  font-size: 13px;
  margin: 5px 12px 10px 12px;
  min-height: 0;
  background-color: #ffebee;
  padding: 8px 10px;
  border-radius: 4px;
  border: 1px solid #ffcdd2;
  display: none;
}
/* NO ELIMINAR - Estilo de errores en formularios */

.modal-error:not(:empty) {
  display: block;
  min-height: 20px;
}
/* NO ELIMINAR - Mostrar errores si existen */

/* ========== ESTILOS ESPECÍFICOS PARA MODALES DE MENÚ ========== */
.modal-header {
  background: #e0e0e0;
  border-bottom: 1px solid #ccc;
  padding: 12px 16px;
  display: flex;
  justify-content: space-between;
  align-items: center;
  color: #333;
  font-size: 16px;
  font-weight: 500;
  min-height: 32px;
  margin: 0;
  width: 100%;
  box-sizing: border-box;
}
/* NO ELIMINAR - Header en modales de menú */

.modal-title {
  font-size: 16px;
  font-weight: 500;
  color: #333;
}
/* NO ELIMINAR - Título en modales de menú */

.modal-close {
  width: 24px;
  height: 24px;
  background: #aaa;
  color: white;
  border: none;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 14px;
  font-weight: bold;
  cursor: pointer;
  box-shadow: 0 1px 2px rgba(0,0,0,0.2);
  transition: all 0.2s;
  line-height: 1;
  padding: 0;
}
/* NO ELIMINAR - Botón de cerrar en modales */

.modal-close:hover {
  background: #999;
}
/* NO ELIMINAR - Hover en botón cerrar */

.modal-close:active {
  transform: translateY(1px);
}
/* NO ELIMINAR - Estado activo en botón cerrar */

/* === VER MAS XATS INICIO === */
/* === IMPLEMENTACION SIMPLIFICADA BOTON - CSS INICIO === */
.btn-ver-mas {
  padding: 12px 20px;
  background: linear-gradient(145deg, #25D366, #128C7E);
  color: white;
  font-size: 14px;
  font-weight: 600;
  text-align: center;
  border-radius: 25px;
  border: none;
  cursor: pointer;
  margin: 15px auto;
  width: auto;
  max-width: 280px;
  box-shadow: 0 4px 12px rgba(37, 211, 102, 0.3);
  transition: all 0.3s ease;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 8px;
  height: 44px;
  white-space: nowrap;
}
/* NO ELIMINAR - Botón "Ver + Xats" */

.btn-ver-mas:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.4);
}
/* NO ELIMINAR - Hover en botón "Ver + Xats" */

.spinner-pequeno {
  width: 16px;
  height: 16px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid white;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  display: inline-block;
}
/* NO ELIMINAR - Spinner en botón "Ver + Xats" */

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}
/* NO ELIMINAR - Animación de spinner */

.btn-ver-mas[style*="background: linear-gradient"][style*="#ff6b6b"] {
  background: linear-gradient(145deg, #ff6b6b, #c0392b) !important;
  color: white !important;
  border: 2px solid #e74c3c !important;
  box-shadow: 0 4px 12px rgba(231, 76, 60, 0.3) !important;
}
/* NO ELIMINAR - Estilo de error/restricción en botón "Ver + Xats" */

/* ============================ */
/* ✅ ESTILOS MODALES - UNIFICADOS */
/* ============================ */

/*
OCULTAR CLASE: .modal-title (segunda definición)
→ Ya está definida arriba y no afecta burbujas.
*/
/*
.modal-title {
    font-weight: bold;
    font-size: 1.1rem;
    color: #333;
    text-align: center;
    width: 100%;
    padding: 0 5px;
}
*/

/*
OCULTAR CLASE: .modal-body-text
→ No afecta burbujas, pero por si acaso, lo dejamos comentado.
*/
/*
.modal-body-text {
    padding: 15px;
    line-height: 1.4;
    color: #555;
    text-align: center;
}
*/

/*
OCULTAR CLASE: .modal-body-text p
→ No afecta burbujas.
*/
/*
.modal-body-text p {
    margin-bottom: 8px;
}
*/