/* ═══════════════════════════════════════════════
   Phase 5 — File Support
   Drag-drop, upload bar, previews, chip removal
   ═══════════════════════════════════════════════ */

/* ── File bar (above input) ── */
#file-bar {
  display: none;
  flex-wrap: wrap;
  gap: 6px;
  padding: 0 24px;
  max-width: 800px;
  width: 100%;
  margin: 0 auto 8px;
}
#file-bar.has-files {
  display: flex;
}

/* ── File chip ── */
.file-chip {
  display: flex;
  align-items: center;
  gap: 6px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 4px 8px 4px 6px;
  font-size: 12px;
  color: var(--text);
  animation: chipIn .2s ease;
  max-width: 200px;
}
@keyframes chipIn {
  from { opacity: 0; transform: scale(.9); }
  to { opacity: 1; transform: scale(1); }
}

.file-chip .file-icon {
  width: 16px;
  height: 16px;
  flex-shrink: 0;
  border-radius: 3px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 10px;
}
.file-chip .file-icon.img { background: var(--accent-soft); color: var(--accent); }
.file-chip .file-icon.pdf { background: rgba(255,71,87,.15); color: #ff4757; }
.file-chip .file-icon.txt { background: rgba(46,213,115,.15); color: #2ed573; }
.file-chip .file-icon.code { background: rgba(255,165,2,.15); color: #ffa502; }
.file-chip .file-icon.other { background: var(--surface-hover); color: var(--text-dim); }

.file-chip .file-name {
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  flex: 1;
}
.file-chip .file-size {
  font-size: 10px;
  color: var(--text-dim);
  opacity: .6;
  white-space: nowrap;
}

.file-chip .file-remove {
  background: none;
  border: none;
  color: var(--text-dim);
  cursor: pointer;
  padding: 2px;
  border-radius: 3px;
  display: flex;
  transition: all .15s;
  flex-shrink: 0;
}
.file-chip .file-remove:hover {
  color: var(--danger);
  background: rgba(255,71,87,.1);
}

/* Image chip with thumbnail */
.file-chip.image-chip {
  padding: 2px 8px 2px 2px;
}
.file-chip.image-chip .file-thumb {
  width: 28px;
  height: 28px;
  border-radius: 4px;
  object-fit: cover;
  flex-shrink: 0;
}

/* ── Attach button ── */
#attach-btn {
  width: 40px;
  height: 40px;
  border-radius: 50%;
  border: 1px solid var(--border);
  background: none;
  color: var(--text-dim);
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all .2s;
}
#attach-btn:hover {
  border-color: var(--accent);
  color: var(--accent);
  background: var(--accent-soft);
}

/* ── Drag-over state ── */
#chat-area.dragover {
  outline: 2px dashed var(--accent);
  outline-offset: -8px;
  background: var(--accent-soft);
  border-radius: var(--radius);
  transition: all .15s;
}
#chat-area.dragover::after {
  content: 'Drop files here';
  position: absolute;
  top: 50%;
  left: 50%;
  transform: translate(-50%, -50%);
  font-size: 18px;
  font-weight: 600;
  color: var(--accent);
  pointer-events: none;
  opacity: .8;
}

/* ── Image preview in chat ── */
.msg-img {
  max-width: 100%;
  border-radius: var(--radius-sm);
  margin: 6px 0;
  cursor: pointer;
  transition: transform .2s;
  border: 1px solid var(--border);
}
.msg-img:hover {
  transform: scale(1.02);
}

/* ── File attachment in chat ── */
.msg-file {
  display: flex;
  align-items: center;
  gap: 10px;
  padding: 8px 12px;
  background: var(--surface);
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  margin: 6px 0;
}
.msg-file .mf-icon {
  font-size: 20px;
}
.msg-file .mf-name {
  font-size: 13px;
  font-weight: 500;
}
.msg-file .mf-size {
  font-size: 11px;
  color: var(--text-dim);
}

@media (max-width: 768px) {
  #file-bar { padding: 0 16px; }
}
