/* R13.1.A — composer attachment bar.
 * Renders pasted/uploaded images as thumbnails above the chat input
 * with remove (X) + click-to-preview. Marker only goes into the
 * message text at send-time; textarea stays clean.
 */

.attachment-bar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 8px 10px;
  margin: 0 0 6px 0;
  background: #f5f3ff;
  border: 1px dashed #c4b5fd;
  border-radius: 10px;
  max-height: 120px;
  overflow-y: auto;
  overscroll-behavior: contain;
}
.attachment-bar[hidden] { display: none; }

.attachment-item {
  position: relative;
  width: 64px;
  height: 64px;
  flex-shrink: 0;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  border: 1px solid #e5e7eb;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
  cursor: pointer;
  transition: transform 100ms ease, box-shadow 100ms ease;
}
.attachment-item:hover { transform: translateY(-1px); box-shadow: 0 3px 8px rgba(0, 0, 0, 0.12); }
.attachment-item:focus-visible { outline: 2px solid #f97316; outline-offset: 2px; }

.attachment-img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

.attachment-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border-radius: 50%;
  border: 0;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  font-size: 13px;
  font-weight: 700;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0;
  transition: background 100ms ease;
}
.attachment-remove:hover { background: rgba(220, 38, 38, 0.9); }
.attachment-remove:focus-visible { outline: 2px solid #fff; outline-offset: 2px; }

.attachment-name {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(transparent, rgba(0, 0, 0, 0.65));
  color: #fff;
  font-size: 9px;
  line-height: 1.2;
  padding: 12px 4px 3px 4px;
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  pointer-events: none;
}

/* Full-image preview modal triggered by thumbnail click */
.attachment-preview-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.8);
  z-index: 9998;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 24px;
  cursor: pointer;
}
.attachment-preview-overlay[hidden] { display: none; }
.attachment-preview-img {
  max-width: 100%;
  max-height: 100%;
  border-radius: 10px;
  box-shadow: 0 8px 32px rgba(0, 0, 0, 0.4);
}

@media (max-width: 820px) {
  .attachment-item { width: 56px; height: 56px; }
}
