/**
 * Estilos para o Sistema de Upload de Imagens
 * Compatível com o design existente do SoundyAI
 * Implementação: Dezembro 2024
 */

/* Container principal de preview das imagens */
.image-preview-container {
  display: none;
  flex-wrap: wrap;
  gap: 8px;
  margin: 8px 0;
  padding: 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 8px;
  border: 1px solid rgba(255, 255, 255, 0.1);
  backdrop-filter: blur(10px);
  transition: all 0.3s ease;
}

.image-preview-container.show {
  display: flex;
  animation: slideDown 0.3s ease-out;
}

/* Item individual de preview */
.image-preview-item {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 8px;
  background: rgba(255, 255, 255, 0.08);
  border-radius: 6px;
  border: 1px solid rgba(255, 255, 255, 0.15);
  max-width: 120px;
  transition: all 0.2s ease;
  cursor: pointer;
}

.image-preview-item:hover {
  background: rgba(255, 255, 255, 0.12);
  border-color: rgba(255, 255, 255, 0.25);
  transform: translateY(-2px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

/* Imagem de preview */
.image-preview-item img {
  width: 100%;
  height: 80px;
  object-fit: cover;
  border-radius: 4px;
  margin-bottom: 4px;
  transition: transform 0.2s ease;
}

.image-preview-item:hover img {
  transform: scale(1.05);
}

/* Nome do arquivo */
.image-preview-filename {
  font-size: 11px;
  color: rgba(255, 255, 255, 0.7);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  width: 100%;
  margin-bottom: 4px;
  font-weight: 500;
}

/* Tamanho do arquivo */
.image-preview-size {
  font-size: 10px;
  color: rgba(255, 255, 255, 0.5);
  margin-bottom: 6px;
  font-family: 'Courier New', monospace;
}

/* Botão de remover */
.image-preview-remove {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 20px;
  height: 20px;
  border: none;
  background: rgba(255, 0, 0, 0.8);
  color: white;
  border-radius: 50%;
  cursor: pointer;
  font-size: 12px;
  font-weight: bold;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s ease;
  z-index: 10;
}

.image-preview-remove:hover {
  background: rgba(255, 0, 0, 1);
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(255, 0, 0, 0.4);
}

/* Estados de loading */
.image-preview-item.loading {
  opacity: 0.6;
  pointer-events: none;
}

.image-preview-item.loading::after {
  content: '';
  position: absolute;
  top: 50%;
  left: 50%;
  width: 20px;
  height: 20px;
  margin: -10px 0 0 -10px;
  border: 2px solid rgba(255, 255, 255, 0.3);
  border-top: 2px solid rgba(255, 255, 255, 0.8);
  border-radius: 50%;
  animation: spin 1s linear infinite;
}

/* Animações */
@keyframes slideDown {
  from {
    opacity: 0;
    transform: translateY(-10px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

@keyframes spin {
  0% { transform: rotate(0deg); }
  100% { transform: rotate(360deg); }
}

/* Indicador de arraste e solte */
.image-drop-zone {
  border: 2px dashed rgba(255, 255, 255, 0.3);
  border-radius: 8px;
  padding: 20px;
  text-align: center;
  color: rgba(255, 255, 255, 0.6);
  transition: all 0.3s ease;
  margin: 8px 0;
}

.image-drop-zone.drag-over {
  border-color: rgba(0, 150, 255, 0.8);
  background: rgba(0, 150, 255, 0.1);
  color: rgba(0, 150, 255, 0.9);
}

.image-drop-zone.drag-over::before {
  content: '📸 Solte as imagens aqui';
  font-size: 14px;
  font-weight: 500;
}

/* Contadores e informações */
.image-upload-info {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin: 4px 0;
  padding: 4px 8px;
  background: rgba(255, 255, 255, 0.05);
  border-radius: 4px;
  font-size: 11px;
  color: rgba(255, 255, 255, 0.6);
}

.image-count {
  color: rgba(0, 150, 255, 0.8);
  font-weight: 600;
}

.image-size-total {
  color: rgba(255, 255, 255, 0.7);
  font-family: 'Courier New', monospace;
}

/* Estados de erro */
.image-preview-error {
  border-color: rgba(255, 0, 0, 0.5);
  background: rgba(255, 0, 0, 0.1);
}

.image-preview-error .image-preview-filename {
  color: rgba(255, 100, 100, 0.9);
}

/* Tooltip para informações adicionais */
.image-preview-tooltip {
  position: absolute;
  bottom: -30px;
  left: 50%;
  transform: translateX(-50%);
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 4px 8px;
  border-radius: 4px;
  font-size: 10px;
  white-space: nowrap;
  opacity: 0;
  pointer-events: none;
  transition: opacity 0.2s ease;
  z-index: 1000;
}

.image-preview-item:hover .image-preview-tooltip {
  opacity: 1;
}

/* Responsividade */
@media (max-width: 768px) {
  .image-preview-container {
    gap: 6px;
    padding: 6px;
    margin: 6px 0;
  }
  
  .image-preview-item {
    max-width: 100px;
    padding: 6px;
  }
  
  .image-preview-item img {
    height: 60px;
  }
  
  .image-preview-filename {
    font-size: 10px;
  }
  
  .image-preview-size {
    font-size: 9px;
  }
}

/* Integração com botões existentes */
.chat-plus-btn[data-has-images="true"] {
  background: rgba(0, 150, 255, 0.2);
  border-color: rgba(0, 150, 255, 0.5);
}

.chat-plus-btn[data-has-images="true"]::after {
  content: '';
  position: absolute;
  top: -2px;
  right: -2px;
  width: 8px;
  height: 8px;
  background: #0096ff;
  border-radius: 50%;
  border: 1px solid rgba(255, 255, 255, 0.3);
}

/* Estados do botão de envio com imagens */
.chatbot-send-btn[disabled] {
  opacity: 0.5;
  cursor: not-allowed;
}

.chatbot-send-btn[data-has-images="true"] {
  background: linear-gradient(135deg, #0096ff, #00d4ff);
}

/* Notificações específicas para imagens */
.image-notification {
  position: fixed;
  top: 20px;
  right: 20px;
  background: rgba(0, 0, 0, 0.9);
  color: white;
  padding: 12px 16px;
  border-radius: 8px;
  border-left: 4px solid #0096ff;
  font-size: 14px;
  max-width: 300px;
  z-index: 10000;
  animation: slideIn 0.3s ease-out;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3);
}

.image-notification.error {
  border-left-color: #ff4757;
  background: rgba(255, 0, 0, 0.1);
  backdrop-filter: blur(10px);
}

.image-notification.success {
  border-left-color: #2ed573;
  background: rgba(0, 255, 0, 0.1);
  backdrop-filter: blur(10px);
}

@keyframes slideIn {
  from {
    transform: translateX(100%);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

/* Placeholder para quando não há imagens */
.image-preview-placeholder {
  display: none;
  text-align: center;
  color: rgba(255, 255, 255, 0.4);
  font-size: 12px;
  padding: 20px;
  border: 1px dashed rgba(255, 255, 255, 0.2);
  border-radius: 6px;
  margin: 8px 0;
  transition: all 0.3s ease;
}

.image-preview-placeholder.show {
  display: block;
}

.image-preview-placeholder:hover {
  border-color: rgba(255, 255, 255, 0.4);
  color: rgba(255, 255, 255, 0.6);
}
