.sync-spinner {
  display: flex;
  align-items: center;
  gap: 0.4rem;
  color: #6d7175;
  font-size: 0.875rem;
  padding: 0.375rem 0.75rem;
}
.sync-spinner svg { animation: spin 0.75s linear infinite; }
@keyframes spin { to { transform: rotate(360deg); } }

.prod-thumb--placeholder {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  border: 1px solid #e1e3e5;
  background: #f1f2f3;
}

.prod-thumb--loading {
  width: 48px;
  height: 48px;
  border-radius: 4px;
  background: linear-gradient(90deg, #f1f2f3 25%, #e3e5e7 50%, #f1f2f3 75%);
  background-size: 200% 100%;
  animation: img-shimmer 1.4s ease-in-out infinite;
}
@keyframes img-shimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.prod-name {
  font-weight: 700;
  color: #202223;
  text-decoration: none;
}


.prod-id {
  display: block;
  font-family: monospace;
  font-size: 0.75rem;
  margin-top: 0.1rem;
}

/* Product cell: checkbox, thumbnail and text side by side. One cell rather than
   three columns so Polaris's phone list layout keeps them together. */
.prod-cell {
  display: flex;
  align-items: flex-start;
  gap: 0.75rem;
}

.prod-select { flex: none; width: 1.25rem; padding-top: 0.15rem; }
.prod-thumb  { flex: none; width: 48px; height: 48px; }

/* Thumbnail that opens the full-size image. */
.prod-thumb-btn {
  display: block;
  width: 100%;
  height: 100%;
  padding: 0;
  border: none;
  border-radius: 4px;
  background: none;
  cursor: zoom-in;
}
.prod-thumb-btn:focus-visible { outline: 2px solid #2c6ecb; outline-offset: 2px; }

/* Hover preview: floats beside the thumbnail, never catches the pointer. */
.thumb-hover-preview {
  position: fixed;
  z-index: 60;
  /* Fixed square so its size is known before the image loads (for placement). */
  --thumb-preview-size: min(320px, calc(100vw - 24px), calc(100vh - 24px));
  width: var(--thumb-preview-size);
  height: var(--thumb-preview-size);
  padding: 0.5rem;
  box-sizing: border-box;
  background: #ffffff;
  border: 1px solid #e1e3e5;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  pointer-events: none;
}
.thumb-hover-preview[hidden] { display: none; }

/* Large view: square, never taller than the screen allows. */
.image-viewer {
  width: min(100%, 70vh);
  margin: 0 auto;
}
.prod-text   { flex: 1; min-width: 0; }

s-table-header .prod-thumb { height: auto; }
s-table-header .prod-cell  { align-items: center; }
/* Expanded SKU rows have just one line of info: centre it on the thumbnail.
   A group's first row keeps its title at the top. */
s-table-row[data-group-first="false"] .prod-cell { align-items: center; }

/* One line that never wraps its pieces: a long part description wraps inside
   its own text, so the SKU checkbox and badges stay beside it, not above, and
   centred on however many lines the text takes. */
.sku-line {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  margin-top: 0.1rem;
}
.sku-line > .prod-id-link { flex: 0 1 auto; min-width: 0; }
.sku-line > s-badge       { flex: none; }

/* SKU opens the details modal — a button styled as quiet link text. */
.prod-id-link {
  padding: 0;
  border: none;
  background: none;
  color: #303030;
  text-align: left;
  cursor: pointer;
}

.prod-id-link:hover { color: #2c6ecb; text-decoration: underline; }
.prod-id-link:focus-visible { outline: 2px solid #2c6ecb; outline-offset: 2px; border-radius: 2px; }

/* "Show all N SKUs" — expands a collapsed group. */
.group-expand {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  margin-top: 0.35rem;
  padding: 0;
  border: none;
  background: none;
  color: #005bd3;
  font-size: 0.8125rem;
  font-weight: 600;
  cursor: pointer;
}

.group-expand:hover { text-decoration: underline; }
.group-expand:focus-visible { outline: 2px solid #2c6ecb; outline-offset: 2px; border-radius: 2px; }
.group-expand svg { transition: transform 0.15s; }
.group-expand[aria-expanded="true"] svg { transform: rotate(180deg); }

/* Brand and actions are fixed widths so the right-hand columns sit in the same
   place on every tab; the Product column takes whatever space is left. */
.brand-col { display: inline-block; width: 8rem; }

/* Same width on every tab (fits "Add to Store" + "Archive"), so Brand and the
   actions line up whether a row holds buttons or just the Synced badge. */
.row-actions {
  display: flex;
  align-items: center;
  justify-content: flex-end;
  gap: 0.5rem;
  min-width: 11rem;
}

/* Pinned to the top of the app frame: Shopify's assistant bar sits over the
   bottom of the admin, outside our iframe, where no z-index can reach it. */
.catalog-selection-bar {
  position: fixed;
  left: 50%;
  top: 0.75rem;
  z-index: 50;
  transform: translateX(-50%);
  display: flex;
  align-items: center;
  gap: 0.75rem;
  padding: 0.5rem 0.5rem 0.5rem 1rem;
  background: #ffffff;
  border: 1px solid #e1e3e5;
  border-radius: 12px;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.16);
  font-size: 0.875rem;
  font-weight: 600;
  white-space: nowrap;
}

.catalog-selection-bar[hidden] { display: none; }

/* Phones: four controls don't fit on one line, so let the bar wrap inside the gutter. */
@media (max-width: 600px) {
  .catalog-selection-bar {
    width: calc(100% - 2rem);
    box-sizing: border-box;
    flex-wrap: wrap;
    justify-content: center;
    white-space: normal;
  }
}

/* Per-SKU checkboxes only show while their group is expanded. */
/* Row actions: a collapsed group's first row acts on the whole group; once
   expanded, every SKU row gets its own Archive/Restore instead. */
s-table-row:not([data-expanded="true"]) .sku-action,
s-table-row[data-expanded="true"] .group-action { display: none; }

.sku-select { display: none; flex: none; }
s-table-row[data-expanded="true"] .sku-select { display: inline-flex; }

s-table-row.group-sep {
  box-shadow: inset 0 2px 0 #e1e3e5;
}

#products-table {
  --pc-table-pagination-justify-content: center;
}

.table-toolbar {
  background: #ffffff;
  border: 1px solid #e1e3e5;
  border-bottom: none;
  border-radius: 8px 8px 0 0;
  padding: 0.625rem 0.75rem;
}

.catalog-tabs {
  display: flex;
  border-bottom: 1px solid #e1e3e5;
  margin-bottom: 1rem;
}

.catalog-tab {
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #6d7175;
  text-decoration: none;
  border-bottom: 2px solid transparent;
  margin-bottom: -1px;
}

.catalog-tab:hover { color: #202223; }

.catalog-tab--active {
  color: #202223;
  border-bottom-color: #2c6ecb;
}

.catalog-layout {
  display: flex;
  gap: 1.25rem;
  align-items: flex-start;
  margin-top: 0.75rem;
}

.filter-panel {
  width: 240px;
  flex-shrink: 0;
  background: #fff;
  border: 1px solid #e1e3e5;
  border-radius: 8px;
  overflow: hidden;
  position: sticky;
  top: 1rem;
  max-height: calc(100vh - 2rem);
  overflow-y: auto;
}

.filter-panel-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  font-size: 0.875rem;
  font-weight: 600;
  color: #202223;
  background: #f6f6f7;
  border-bottom: 1px solid #e1e3e5;
}

.filter-section {
  padding: 0.875rem 1rem;
  border-bottom: 1px solid #e1e3e5;
}
.filter-section:last-child { border-bottom: none; }

.filter-section-title {
  font-size: 0.6875rem;
  font-weight: 600;
  color: #6d7175;
  text-transform: uppercase;
  letter-spacing: 0.05em;
  margin-bottom: 0.5rem;
}

.filter-check-label {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.875rem;
  color: #202223;
  cursor: pointer;
  padding: 0.25rem 0;
  user-select: none;
}

.filter-active-dot {
  display: inline-block;
  width: 7px;
  height: 7px;
  border-radius: 50%;
  background: #2c6ecb;
  flex-shrink: 0;
}


.filter-toggle-btn {
  display: none;
  align-items: center;
  gap: 0.375rem;
  padding: 0.375rem 0.75rem;
  font-size: 0.875rem;
  font-weight: 500;
  color: #202223;
  background: #fff;
  border: 1px solid #c9cccf;
  border-radius: 8px;
  cursor: pointer;
  white-space: nowrap;
  flex-shrink: 0;
}

.filter-badge {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 18px;
  height: 18px;
  padding: 0 5px;
  background: #2c6ecb;
  color: #fff;
  font-size: 0.6875rem;
  font-weight: 700;
  border-radius: 999px;
}

.catalog-main { flex: 1; min-width: 0; }

/* Filters card plus the Sync with Shopify card stacked beneath it */
.filter-column {
  width: 240px;
  flex-shrink: 0;
  display: flex;
  flex-direction: column;
  gap: 0.75rem;
}
.filter-column .filter-panel { width: 100%; }

.filter-panel-body { display: block; }

@media (max-width: 768px) {
  .catalog-layout { flex-direction: column; gap: 0.75rem; }
  .filter-panel { width: 100%; }
  .filter-column { width: 100%; }
  .filter-toggle-btn { display: flex; }
  .filter-panel-body { display: none; }
  .filter-panel-body--open { display: block; }
  /* The Filters button opens the panel; while closed, don't show an empty card. */
  .filter-panel:has(.filter-panel-body:not(.filter-panel-body--open)) { display: none; }
}

@media (max-width: 600px) {
  /* Keep the three tabs on one line; scroll sideways on very narrow screens. */
  .catalog-tabs { overflow-x: auto; scrollbar-width: none; }
  .catalog-tab  { padding: 0.75rem 0.625rem; white-space: nowrap; }
}

.ats-choose-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 1rem;
}

.ats-choose-card {
  border: 2px solid #e1e3e5;
  border-radius: 8px;
  padding: 1.25rem;
  cursor: pointer;
  transition: border-color 0.1s;
}
.ats-choose-card:hover { border-color: #2c6ecb; }

@media (max-width: 600px) {
  .filter-grid { grid-template-columns: 1fr; }
  .ats-choose-grid { grid-template-columns: 1fr; }
}

/* ── Pagy pagination nav ── */
.pagy {
  display: flex;
  align-items: center;
  gap: 0.25rem;
  flex-wrap: wrap;
  font-size: 0.875rem;
}
.pagy a:not([role="separator"]) {
  display: block;
  text-decoration: none;
  padding: 0.25rem 0.625rem;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #374151;
  background: #fff;
}
.pagy a[href]:hover {
  background: #f3f4f6;
  color: #111827;
}
.pagy a:not([href]) { cursor: default; opacity: 0.5; }
.pagy a[aria-current] {
  background: #2563eb;
  color: #fff;
  border-color: #2563eb;
  font-weight: 600;
}
.pagy a[role="separator"] {
  color: #9ca3af;
  padding: 0.25rem 0.25rem;
}

/* ── Filter chips (active filter pills) ── */
.filter-chip {
  display: inline-flex;
  align-items: center;
  gap: 0.25rem;
  padding: 0.1875rem 0.5rem;
  background: #eff6ff;
  border: 1px solid #bfdbfe;
  border-radius: 999px;
  font-size: 0.75rem;
  color: #1d4ed8;
  text-decoration: none;
  white-space: nowrap;
}
.filter-chip:hover { background: #dbeafe; }

/* ── Dual-handle price range slider ── */
.price-track {
  position: relative;
  height: 20px;
  display: flex;
  align-items: center;
  margin: 4px 0 2px;
}
.price-track::before {
  content: '';
  position: absolute;
  left: 0;
  right: 0;
  height: 4px;
  background: #e5e7eb;
  border-radius: 2px;
}
.price-track-fill {
  position: absolute;
  height: 4px;
  background: #2c6ecb;
  border-radius: 2px;
  pointer-events: none;
}
.price-track input[type="range"] {
  position: absolute;
  left: 0;
  width: 100%;
  height: 4px;
  background: transparent;
  -webkit-appearance: none;
  appearance: none;
  pointer-events: none;
  margin: 0;
  padding: 0;
  border: 0;
  outline: none;
}
.price-track input[type="range"]::-webkit-slider-thumb {
  -webkit-appearance: none;
  appearance: none;
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #2c6ecb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  cursor: pointer;
  pointer-events: all;
}
.price-track input[type="range"]::-moz-range-thumb {
  width: 16px;
  height: 16px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid #2c6ecb;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  cursor: pointer;
  pointer-events: all;
  box-sizing: border-box;
}

/* ── Results count bar ── */
.results-meta {
  font-size: 0.75rem;
  color: #6b7280;
  margin-bottom: 0.5rem;
}

/* On a first (uncached) load the catalog can paint before Polaris has drawn its
   components, then snap into place as they and the thumbnails appear — the page
   seems to jump while images load. Keep it hidden until Polaris is ready; the
   delayed animation reveals it anyway if polaris.js never loads. Thumbnails
   themselves sit in fixed 48×48 boxes, so they can't move the layout. */
s-page:not(:defined) {
  visibility: hidden;
  animation: reveal-catalog 0s 3s forwards;
}

@keyframes reveal-catalog {
  to { visibility: visible; }
}

@media (max-width: 600px) {
  /* Phones: actions sit under the product, so they needn't reserve desktop width. */
  .row-actions { min-width: 0; justify-content: flex-start; flex-wrap: wrap; }
  .brand-col   { display: none; }
}

