body { font-family: Inter, sans-serif; }

.tool-card {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 0.75rem;
  padding: 1.5rem;
  box-shadow: 0 3px 12px rgba(0,0,0,.04);
}

/* ── Format buttons ── */
.format-btn {
  display: inline-flex;
  flex-direction: column;
  align-items: center;
  gap: 3px;
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.6rem 1rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 500;
  color: #374151;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
  line-height: 1.3;
  min-width: 100px;
}
.format-btn:hover { border-color: #10b981; color: #059669; }
.format-btn.active-format {
  border-color: #059669;
  background: #f0fdf4;
  color: #059669;
  font-weight: 600;
}
.fmt-dims { font-size: 0.65rem; color: #9ca3af; font-weight: 400; }
.format-btn.active-format .fmt-dims { color: #6ee7b7; }

/* ── JPG/PNG toggle ── */
.filefmt-btn {
  border: 1px solid #e5e7eb;
  background: #fff;
  border-radius: 0.5rem;
  padding: 0.4rem 1.1rem;
  cursor: pointer;
  font-size: 0.8rem;
  font-weight: 600;
  color: #374151;
  transition: border-color 0.15s, background 0.15s, color 0.15s;
}
.filefmt-btn:hover { border-color: #10b981; color: #059669; }
.filefmt-btn.active-filefmt { border-color: #059669; background: #f0fdf4; color: #059669; }

/* ── Padding color swatches ── */
.bg-swatch {
  width: 26px; height: 26px;
  border-radius: 50%;
  border: 2px solid #e5e7eb;
  cursor: pointer;
  padding: 0;
  flex-shrink: 0;
  transition: transform 0.12s, border-color 0.12s, box-shadow 0.12s;
}
.bg-swatch:hover { transform: scale(1.2); border-color: #10b981; }
.bg-swatch.active-swatch { border-color: #059669; box-shadow: 0 0 0 3px #d1fae5; }

/* ── Page checkboxes ── */
.page-check-label {
  display: inline-flex;
  align-items: center;
  gap: 5px;
  background: #f9fafb;
  border: 1px solid #e5e7eb;
  border-radius: 0.375rem;
  padding: 0.32rem 0.65rem;
  cursor: pointer;
  font-size: 0.75rem;
  color: #374151;
  transition: border-color 0.12s, background 0.12s;
  user-select: none;
}
.page-check-label:hover { border-color: #10b981; background: #f0fdf4; }
.page-check-label:has(input:checked) { border-color: #059669; color: #059669; font-weight: 600; }
.page-check { accent-color: #059669; }

/* ── Settings section label ── */
.settings-label {
  display: block;
  font-size: 0.7rem;
  font-weight: 600;
  text-transform: uppercase;
  letter-spacing: 0.07em;
  color: #9ca3af;
  margin-bottom: 0.6rem;
}

/* ── Progress bar ── */
.progress-bar {
  width: 100%;
  height: 6px;
  background: #e5e7eb;
  border-radius: 4px;
  overflow: hidden;
  margin: 0.5rem 0;
}
.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, #10b981, #059669);
  transition: width 0.25s ease;
  border-radius: 4px;
}

/* ── Thumbnail preview grid (shown immediately after upload) ── */
.thumb-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  gap: 0.6rem;
  margin-top: 1rem;
}
.thumb-card {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 0.4rem;
  overflow: hidden;
  background: #f9fafb;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s;
}
.thumb-card canvas { display: block; width: 100%; }
.thumb-label {
  text-align: center;
  font-size: 0.65rem;
  color: #6b7280;
  padding: 3px 0 4px;
  background: #f9fafb;
}
.thumb-card.selected { border-color: #059669; box-shadow: 0 0 0 2px #d1fae5; }
.thumb-card .tick {
  position: absolute;
  top: 4px; right: 4px;
  width: 18px; height: 18px;
  background: #059669;
  border-radius: 50%;
  display: none;
  align-items: center;
  justify-content: center;
}
.thumb-card.selected .tick { display: flex; }
.thumb-card .tick svg { width: 10px; height: 10px; }

/* ── Output preview grid ── */
.preview-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
  gap: 0.75rem;
  margin: 1.25rem 0;
}
.preview-card {
  position: relative;
  border: 1px solid #e5e7eb;
  border-radius: 0.5rem;
  overflow: hidden;
  background: #f9fafb;
  transition: box-shadow 0.15s, transform 0.15s;
}
.preview-card:hover { box-shadow: 0 4px 14px rgba(0,0,0,.1); transform: translateY(-2px); }
.preview-card img { width: 100%; height: auto; display: block; }
.slide-label {
  position: absolute;
  top: 6px; left: 6px;
  background: rgba(0,0,0,.6);
  color: #fff;
  font-size: 0.65rem;
  font-weight: 600;
  padding: 2px 6px;
  border-radius: 3px;
}
.card-dl-btn {
  position: absolute;
  bottom: 0; left: 0; right: 0;
  background: rgba(5,150,105,.92);
  color: #fff;
  border: none;
  padding: 7px;
  font-size: 0.7rem;
  font-weight: 600;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 4px;
  opacity: 0;
  transform: translateY(3px);
  transition: opacity 0.15s, transform 0.15s;
}
.preview-card:hover .card-dl-btn { opacity: 1; transform: translateY(0); }

/* ── Upload drag-over ── */
#uploadArea.drag-over { border-color: #10b981 !important; background: #f0fdf4; }

/* ── Animations ── */
@keyframes fadeUp {
  from { opacity: 0; transform: translateY(8px); }
  to   { opacity: 1; transform: translateY(0); }
}
.fade-up { animation: fadeUp 0.3s ease-out; }

#status { transition: opacity 0.2s; opacity: 0; }

@media (max-width: 480px) {
  .format-btn { min-width: 80px; padding: 0.5rem 0.6rem; font-size: 0.73rem; }
  .preview-grid { grid-template-columns: repeat(auto-fill, minmax(130px, 1fr)); }
  .thumb-grid { grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); }
}
