/* ============================================================
   Format Converter — gallery.css
   Step 2: thumbnail grid — each selected image as a card with
   remove + rotate controls, plus an "Add more" tile in the grid
   ============================================================ */


/* ══════════════════════════════════════════
   1. GRID
   ══════════════════════════════════════════ */
/* auto-fit (not a fixed repeat count) so that when the number of
   images isn't a multiple of the column count, the leftover empty
   track collapses instead of sitting there as dead space — the row
   always fills edge to edge, never bunches left. minmax(104px,…)
   keeps this at 3 columns on a typical phone width. */
.fc-format-convert-gallery {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(104px, 1fr));
  gap: 10px;
  margin-bottom: 4px;
}


/* ══════════════════════════════════════════
   2. CARD
   ══════════════════════════════════════════ */
.fc-format-convert-card {
  position: relative;
  display: flex;
  flex-direction: column;
  border-radius: 14px;
  overflow: hidden;
  background: #fff;
  border: 1.5px solid var(--fc-line);
  animation: fcCardIn 0.22s ease both;
}

@keyframes fcCardIn {
  from { opacity: 0; transform: scale(0.94); }
  to   { opacity: 1; transform: scale(1); }
}

.fc-format-convert-card__thumbwrap {
  position: relative;
  width: 100%;
  aspect-ratio: 1 / 1;
  background:
    linear-gradient(45deg, #e9e9ef 25%, transparent 25%) -8px 0/ 16px 16px,
    linear-gradient(-45deg, #e9e9ef 25%, transparent 25%) -8px 0/ 16px 16px,
    linear-gradient(45deg, transparent 75%, #e9e9ef 75%) -8px 0/ 16px 16px,
    linear-gradient(-45deg, transparent 75%, #e9e9ef 75%) -8px 0/ 16px 16px,
    #fafafd;
  overflow: hidden;
}

.fc-format-convert-card__thumb {
  display: block;
  width: 100%;
  height: 100%;
  object-fit: contain;
  transition: transform 0.2s ease;
}

/* ── Overlay controls: remove (top-right) + rotate (bottom-right) ── */
.fc-format-convert-card__remove,
.fc-format-convert-card__rotate {
  position: absolute;
  width: 28px;
  height: 28px;
  border-radius: 50%;
  border: none;
  display: flex;
  align-items: center;
  justify-content: center;
  background: rgba(26,26,34,0.55);
  color: #fff;
  cursor: pointer;
  backdrop-filter: blur(2px);
  transition: background 0.15s ease, transform 0.15s ease;
}

.fc-format-convert-card__remove svg,
.fc-format-convert-card__rotate svg {
  width: 15px;
  height: 15px;
}

.fc-format-convert-card__remove {
  top: 6px;
  right: 6px;
}

.fc-format-convert-card__remove:active,
.fc-format-convert-card__rotate:active {
  transform: scale(0.9);
}

.fc-format-convert-card__remove:hover {
  background: var(--fc-error);
}

.fc-format-convert-card__rotate {
  bottom: 6px;
  right: 6px;
}

.fc-format-convert-card__rotate:hover {
  background: var(--fc-brand);
}

/* ── File name / meta ── */
.fc-format-convert-card__name {
  margin: 8px 8px 0;
  font-size: 11.5px;
  font-weight: 700;
  color: var(--fc-ink);
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.fc-format-convert-card__meta {
  margin: 2px 8px 8px;
  font-size: 10.5px;
  font-weight: 600;
  color: var(--fc-ink-soft);
  text-transform: uppercase;
  letter-spacing: 0.3px;
}


/* ══════════════════════════════════════════
   3. "ADD MORE" TILE — lives inside the same grid
   ══════════════════════════════════════════ */
.fc-format-convert-gallery__add {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 6px;
  aspect-ratio: 1 / 1;
  border-radius: 14px;
  border: 1.5px dashed var(--fc-line-strong);
  background: var(--fc-bg);
  color: var(--fc-brand-dark);
  cursor: pointer;
  transition: border-color 0.15s ease, background 0.15s ease;
}

.fc-format-convert-gallery__add svg {
  width: 22px;
  height: 22px;
  color: var(--fc-brand);
}

.fc-format-convert-gallery__add span {
  font-size: 11px;
  font-weight: 700;
}

.fc-format-convert-gallery__add:hover,
.fc-format-convert-gallery__add:active {
  border-color: var(--fc-brand);
  background: var(--fc-brand-soft);
}


/* ══════════════════════════════════════════
   4. DESKTOP ENHANCEMENTS (≥768px)
   ══════════════════════════════════════════ */
@media (min-width: 768px) {
  .fc-format-convert-gallery {
    /* Same auto-fit approach, just sized for the wider desktop row —
       minmax(150px,…) lands on 4 columns at this wrap's full 720px
       width, but — unlike the old repeat(4, 1fr) — collapses cleanly
       to 1-3 columns without leaving a dead trailing gap when the
       person has fewer images. */
    grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
    gap: 14px;
  }

  .fc-format-convert-card__remove:hover,
  .fc-format-convert-card__rotate:hover {
    transform: scale(1.08);
  }
}


/* ══════════════════════════════════════════
   5. ACCESSIBILITY
   ══════════════════════════════════════════ */
@media (prefers-reduced-motion: reduce) {
  .fc-format-convert-card {
    animation: none;
  }
}
