.shared-media-preview {
  position: relative;
  display: grid;
  width: 100%;
  min-width: 0;
  aspect-ratio: 4 / 3;
  place-items: center;
  isolation: isolate;
  border: 1px solid var(--fs-stroke);
  border-radius: 9px;
  background: var(--fs-recessed);
}

.shared-media-preview > img {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  max-height: none;
  border: 0;
  border-radius: inherit;
  object-fit: contain;
}

.shared-media-preview .shared-media-kind {
  position: relative;
  z-index: 1;
  display: inline-flex;
  align-items: center;
  gap: 5px;
  padding: 3px 5px;
  border-radius: 5px;
  color: var(--fs-secondary);
  font-size: 12px;
  line-height: 1.2;
  white-space: nowrap;
}

.shared-media-preview.has-preview .shared-media-kind { visibility: hidden; }
.shared-media-preview--video .shared-media-kind::before {
  content: "";
  width: 0;
  height: 0;
  border-block: 4px solid transparent;
  border-inline-start: 6px solid currentColor;
}

.shared-media-preview .shared-media-duration {
  position: absolute;
  z-index: 1;
  inset: auto 4px 4px auto;
  padding: 2px 5px;
  border-radius: 4px;
  background: #12141bea;
  color: #fff;
  font-size: 11px;
  line-height: 1.3;
  font-variant-numeric: tabular-nums;
}

.shared-media-preview .shared-media-duration[hidden] { display: none; }
.file-item.file-card-clickable:has(> .shared-media-preview) {
  grid-template-columns: clamp(56px, 7vw, 92px) minmax(0, 1fr);
}

#clientView .file-item.file-card-clickable:has(> .shared-media-preview) {
  grid-template-columns: clamp(56px, 7vw, 92px) minmax(0, 1fr);
}

.shared-media-preview--cover {
  aspect-ratio: 16 / 9;
  max-height: 204px;
}

.shared-media-preview--attachment { width: 60px; }
.attachment-with-preview .shared-media-preview { flex: 0 0 60px; }
.attachment-with-preview > span:last-child { min-width: 0; overflow-wrap: anywhere; }
.file-item .shared-media-preview > img { margin: 0; }
.communication-bubble .communication-attachment:has(> .shared-media-preview) {
  grid-template-columns: 56px minmax(0, 1fr);
}
.communication-bubble .communication-attachment > .shared-media-preview {
  grid-row: span 2;
  width: 100%;
  height: auto;
  min-height: 40px;
  background: var(--fs-recessed);
}
