/* Contenedor principal de la barra de input */
.chat-input {
  display: flex;
  flex-direction: column;
  gap: 0;
  padding: 0;
}

/* Interior: chips + input + iconos */
.chat-input-inner {
 display: flex;
 flex-wrap: wrap;           /* 👉 permite 2 filas */
 align-items: center;
 gap: 6px;
 background: transparent;
 border-radius: 0;
 padding: 8px 12px;
}

/* Input de texto */
#chatInput {
  border: none;
  outline: none;
  background: transparent;
  color: #f5f5f5;
  flex: 1 1 auto;
  min-width: 40px;
}



/* Contenedor de chips dentro de la barra */
/* Contenedor de chips dentro de la barra */
.chat-media-chips {
  display: flex;
  align-items: center;
  gap: 6px;

  flex-shrink: 0;
  flex-basis: 100%;     /* ocupa todo el ancho de la barra */
  order: -1;            /* se dibuja arriba del input */
  margin-bottom: 4px;

  /* 👉 clave para que vayan "a lo largo" */
  flex-wrap: nowrap;    /* NO envolver a otra línea */
  overflow-x: auto;     /* si no entran, scroll horizontal */
  overflow-y: hidden;
}


/* Cada imagen-miniatura */
.chat-media-chip {
  position: relative;
  width: 56px;
  height: 56px;
  border-radius: 12px;
  overflow: hidden;
  flex-shrink: 0;
  box-shadow: 0 0 4px rgba(0,0,0,0.25);
}

/* Imagen dentro del chip */
.chat-media-chip img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Botón X en cada chip */
.chat-media-chip-close {
  position: absolute;
  top: -2px;
  right: -2px;
  width: 18px;
  height: 18px;
  border-radius: 999px;
  border: none;
  font-size: 11px;
  line-height: 18px;
  text-align: center;
  cursor: pointer;
  background: rgba(0,0,0,0.8);
  color: #fff;
  padding: 0;
}





@media (max-width: 600px) {
  .chat-input-inner {
    padding: 6px 8px;
  }

  .chat-media-chip {
    width: 46px;
    height: 46px;
  }
}

.chat-img-msg {
  display: block;
  width: 100%;
  height: auto;
  border-radius: 14px;   /* 18 (burbuja) - 4 (padding) */
  margin: 0;
  image-orientation: from-image;
}

.chat-video-msg {
  display: block;
  width: 100%;
  height: auto;
  max-height: 420px;
  border-radius: 14px;   /* mismo criterio */
  background: #000;
  object-fit: cover;
  margin: 0;
}

/* ==================== SPINNER Y BARRA DE PROGRESO ==================== */

.chat-media-upload-progress {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 8px 12px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 8px;
  width: auto;
  max-width: 100%;
  flex-shrink: 0;
  position: relative;
}

/* Spinner animado */
.upload-spinner {
  width: 20px;
  height: 20px;
  border: 2px solid rgba(100, 200, 255, 0.3);
  border-top: 2px solid #64c8ff;
  border-radius: 50%;
  animation: spin-upload 1s linear infinite;
  flex-shrink: 0;
}

@keyframes spin-upload {
  to {
    transform: rotate(360deg);
  }
}

/* Barra de progreso contenedor */
.upload-progress-bar {
  flex: 1;
  height: 4px;
  background: rgba(255, 255, 255, 0.2);
  border-radius: 2px;
  overflow: hidden;
  min-width: 80px;
}

/* Barra de progreso fill */
.upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #64c8ff, #4da6ff);
  border-radius: 2px;
  transition: width 0.2s ease-in-out;
}

/* Porcentaje de progreso */
.upload-progress-text {
  font-size: 11px;
  font-weight: 600;
  color: #64c8ff;
  min-width: 30px;
  text-align: right;
  flex-shrink: 0;
}

/* Media query para móviles */
@media (max-width: 600px) {
  .chat-media-upload-progress {
    padding: 6px 8px;
  }

  .upload-spinner {
    width: 16px;
    height: 16px;
    border-width: 1.5px;
  }

  .upload-progress-text {
    font-size: 10px;
    min-width: 26px;
  }
}

/* ==================== MODAL DE CARGA DE IMAGEN ==================== */
/* Overlay oscuro de fondo */
.chat-media-upload-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
  backdrop-filter: blur(2px);
}

/* Modal centrado */
.chat-media-upload-modal {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.15);
  max-width: 360px;
  width: 90%;
  text-align: center;
}

.chat-media-upload-modal .modal-content {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.chat-media-upload-modal h3 {
  margin: 0;
  font-size: 18px;
  font-weight: 600;
  color: #1a1a1a;
}

.chat-media-upload-modal .upload-progress-bar {
  height: 6px;
  background: rgba(0, 0, 0, 0.1);
  border-radius: 3px;
  overflow: hidden;
}

.chat-media-upload-modal .upload-progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #0b9488, #059669);
  border-radius: 3px;
  transition: width 0.2s ease-in-out;
}

.chat-media-upload-modal .upload-progress-text {
  font-size: 14px;
  font-weight: 600;
  color: #0b9488;
}

/* Responsivo para móvil */
@media (max-width: 480px) {
  .chat-media-upload-modal {
    padding: 20px;
    max-width: 100%;
    width: 85%;
  }

  .chat-media-upload-modal h3 {
    font-size: 16px;
  }

  .chat-media-upload-modal .upload-progress-text {
    font-size: 13px;
  }
}
