/* ============================================================
 *  Peerly — Fichiers (messages)
 *  v8.4.0 — image et bouton download arrondis
 * ============================================================ */

.file-bubble {
  max-width: 340px;
  padding: var(--space-3);
  display: flex;
  flex-direction: column;
  gap: var(--space-3);
}

/* ============================================================
 *  Aperçu image — coins arrondis
 * ============================================================ */
.file-image-wrapper {
  border-radius: var(--radius-lg);
  overflow: hidden;
  cursor: pointer;
  background: var(--md-surface-container);
  position: relative;
  line-height: 0;
}
.file-image-preview {
  width: 100%;
  max-height: 320px;
  object-fit: cover;
  display: block;
  border-radius: var(--radius-lg);
  transition: transform var(--duration-base) var(--ease-out);
}
.file-image-wrapper:hover .file-image-preview {
  transform: scale(1.02);
}

/* ============================================================
 *  Aperçu vidéo
 * ============================================================ */
.file-video-preview {
  width: 100%;
  max-height: 320px;
  border-radius: var(--radius-lg);
  background: #000;
  display: block;
}

/* ============================================================
 *  Aperçu audio
 * ============================================================ */
.file-audio-preview {
  width: 100%;
  border-radius: var(--radius-full);
}

/* ============================================================
 *  Ligne fichier générique
 * ============================================================ */
.file-row {
  display: flex;
  align-items: center;
  gap: var(--space-3);
  padding: 0 var(--space-1);
}

.file-icon {
  font-size: 26px;
  flex-shrink: 0;
  display: inline-flex;
  align-items: center;
  color: var(--md-on-surface-variant);
}
.file-icon i { line-height: 1; }

.file-info {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
  gap: 2px;
}
.file-name {
  font-size: var(--text-sm);
  font-weight: var(--weight-medium);
  color: inherit;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
.file-size {
  font-size: var(--text-xs);
  opacity: 0.7;
  font-family: var(--font-mono);
  letter-spacing: var(--tracking-wide);
}

/* ============================================================
 *  Bouton télécharger — rond
 * ============================================================ */
.file-download-btn {
  width: 36px;
  height: 36px;
  border-radius: 50%;
  background: var(--md-surface-container-highest);
  color: var(--md-on-surface);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  border: none;
  cursor: pointer;
  transition:
    background var(--duration-fast) var(--ease-out),
    transform var(--duration-instant) var(--ease-out);
}
.file-download-btn i {
  font-size: 16px;
  line-height: 1;
}
.file-download-btn:hover {
  background: var(--md-primary);
  color: var(--md-on-primary);
  transform: scale(1.05);
}
.file-download-btn:active {
  transform: scale(0.94);
}

/* Dans une bulle envoyée, adapter les couleurs */
.chat-bubble.sent .file-download-btn {
  background: rgba(0, 0, 0, 0.2);
  color: var(--md-on-primary);
}
.chat-bubble.sent .file-download-btn:hover {
  background: rgba(0, 0, 0, 0.35);
  color: var(--md-on-primary);
}

/* ============================================================
 *  Drag & drop sur la zone de chat
 * ============================================================ */
.chat-messages.drag-over {
  background: var(--md-primary-soft);
  outline: 2px dashed var(--md-primary);
  outline-offset: -12px;
  border-radius: var(--radius-lg);
}

/* ============================================================
 *  Bouton joindre (📎)
 * ============================================================ */
.btn-attach {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 40px;
  height: 40px;
  border-radius: var(--radius-lg);
  background: transparent;
  color: var(--md-on-surface-variant);
  font-size: 18px;
  flex-shrink: 0;
  transition: all var(--duration-fast) var(--ease-out);
  cursor: pointer;
  border: none;
}
.btn-attach:hover:not(:disabled) {
  background: var(--md-surface-container-high);
  color: var(--md-on-surface);
}
.btn-attach:disabled {
  opacity: 0.3;
  cursor: not-allowed;
}
.btn-attach i { line-height: 1; }

/* ============================================================
 *  Hint drag & drop
 * ============================================================ */
.chat-hint {
  margin-top: var(--space-3);
  font-size: var(--text-xs);
  color: var(--md-outline);
}