/* =====================================================================
   Composer & Direct Message File Preview Gallery
   ===================================================================== */

file-preview-gallery {
    width: 92%;
    max-width: 650px;
    display: block;
}

feed-panel file-preview-gallery {
  max-width: initial;
  margin-bottom: 8px;
}

/* =====================================================================
   Preview Container (Horizontal Scroll Tray)
   ===================================================================== */

preview-container {
    display: flex;
    flex-direction: row;
    flex-wrap: nowrap;
    gap: 8px;
    padding: 8px 2px;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    scrollbar-width: thin;
}

preview-container:empty {
    display: none;
}


/* =====================================================================
   Preview Item Cards
   ===================================================================== */
.preview-item {
    position: relative;
    flex: 0 0 auto;
    width: 96px;
    height: 96px;
    border-radius: 10px;
    overflow: hidden;
    border: 1px solid var(--border-subtle, #edebe6);
    background: #ffffff;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.04);
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    text-align: center;
    transition: transform 0.15s ease, box-shadow 0.15s ease;
}

.preview-item:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.08);
}

.preview-item img,
.preview-item video {
  width: 100%;
  height: 100%;
  object-fit: cover;
  display: block;
}

/* Accent borders by file type */
.preview-item.pdf {
  border-left: 3px solid #ef4444;               /* Modern rose red */
}

.preview-item.audio {
  border-left: 3px solid var(--accent, #4f46e5);/* Brand indigo */
}

/* Icon & Label styles (for non-media files) */
.preview-item .file-icon {
  font-size: 28px;
  line-height: 1;
  margin-bottom: 6px;
}

.preview-item .file-name {
  font-size: 11px;
  font-weight: 500;
  color: var(--text-muted, #656f77);
  width: 85%;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

/* =====================================================================
   Remove Button (Frosted Glass Close Button)
   ===================================================================== */

.remove-btn {
  position: absolute;
  top: 6px;
  right: 6px;
  width: 22px;
  height: 22px;
  border-radius: 50%;
  background: rgba(13, 17, 23, 0.65);
  backdrop-filter: blur(6px);
  -webkit-backdrop-filter: blur(6px);
  border: 1px solid rgba(255, 255, 255, 0.2);
  color: #ffffff;
  font-size: 13px;
  font-weight: 600;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s ease;
  z-index: 2;
}

.remove-btn:hover {
  background: #ef4444;
  border-color: #ef4444;
  transform: scale(1.08);
}

/* =====================================================================
   Mobile Optimization
   ===================================================================== */

@media (max-width: 768px) {
  preview-container {
    padding: 6px 2px;
    gap: 8px;
    max-height: 110px;
  }

  .preview-item {
    width: 76px;
    height: 76px;
    border-radius: 8px;
  }

  .preview-item .file-icon {
    font-size: 24px;
  }

  .remove-btn {
    width: 24px;
    height: 24px;
    top: 4px;
    right: 4px;
  }
}