/* chat/08_attachment_preview_and_dragover.css
 * ------------------------------------------------------------
 * Split 8 of 10 from web/account/css/chat.css (CLAUDE.md §8.16 — see
 * 01_tokens_reset.css's header for the split's background; loaded eighth
 * in chat.html, right after the reply-banner/composer file).
 *
 * Covers: the pending-attachment preview strip above the composer
 * (image_preview.js, attachment_thumb.js — thumbnails, video placeholder
 * label, remove button, file-size caption, per-item upload progress) and
 * the global drag-over state (image_attach.js) applied to whichever
 * element the caller designates as the drop target.
 * ------------------------------------------------------------ */

/* ===== Pending-attachment preview strip (image_preview.js, attachment_thumb.js) ===== */

.chat-image-preview { padding: 0 4px; }
/* Nothing chosen yet — the strip must occupy NO vertical space at all
   (image_preview.js's own doc comment), or the composer would sit
   permanently one row taller than it needs to. */
.chat-image-preview.is-empty { display: none; }

.chat-image-preview__items {
  display: flex;
  gap: 8px;
  overflow-x: auto;
  padding: 8px 4px;
}

.chat-image-preview__item { position: relative; flex-shrink: 0; width: 68px; }

.chat-image-preview__thumb {
  width: 68px; height: 68px;
  border-radius: 10px;
  object-fit: cover;
  background: var(--chat-composer-field);
}

.chat-image-preview__video-wrap {
  position: relative;
  width: 68px; height: 68px;
  border-radius: 10px;
  overflow: hidden;
  background: var(--chat-composer-field);
}
/* The decoded first frame fades in only once `loadeddata` fires
   (attachment_thumb.js) — hidden rather than absent beforehand so the
   video element (already in the DOM, already reading metadata) does not
   flash an unstyled frame the instant it becomes ready. */
.chat-image-preview__video-wrap .chat-image-preview__thumb { opacity: 0; transition: opacity .15s ease; }
.chat-image-preview__video-wrap.is-loaded .chat-image-preview__thumb { opacity: 1; }
.chat-image-preview__placeholder-label {
  position: absolute;
  inset: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  text-align: center;
  padding: 4px;
  font-size: 9px;
  line-height: 1.2;
  color: var(--chat-bubble-muted);
  overflow: hidden;
}
.chat-image-preview__video-wrap.is-loaded .chat-image-preview__placeholder-label { display: none; }
.chat-image-preview__duration {
  position: absolute;
  right: 4px; bottom: 4px;
  background: var(--chat-media-overlay);
  color: var(--chat-bubble-text);
  font-size: 9px;
  padding: 1px 4px;
  border-radius: 4px;
}

.chat-image-preview__remove {
  position: absolute;
  top: -6px; right: -6px;
  width: 20px; height: 20px;
  border-radius: 50%;
  background: var(--chat-composer-bg);
  box-shadow: 0 0 0 1px var(--chat-wash-strong);
  font-size: 13px;
  line-height: 1;
  display: flex; align-items: center; justify-content: center;
}

.chat-image-preview__size {
  display: block;
  margin-top: 3px;
  text-align: center;
  font-size: 9px;
  color: var(--chat-bubble-muted);
}

.chat-image-preview__progress {
  height: 3px;
  margin: 0 4px 6px;
  border-radius: 2px;
  overflow: hidden;
  background: var(--chat-wash-medium);
}
.chat-image-preview__progress.is-hidden { display: none; }
.chat-image-preview__progress-fill {
  height: 100%;
  width: 0%;
  background: var(--chat-read-tick);
  transition: width .2s ease;
}

/* ===== Drag-over (image_attach.js) =====
 * Applied to whichever element the caller hands createImageAttach as its
 * dropTarget (kravspec expects the whole thread, not just the composer, to
 * accept a drop) — a global state rule rather than one scoped to a
 * specific component, since this file cannot assume which element that is. */
.is-drag-over {
  outline: 2px dashed var(--chat-read-tick);
  outline-offset: -4px;
  background-color: color-mix(in srgb, var(--chat-read-tick) 10%, transparent);
}

