/* Container for all catalog tiles */
.catalog-tile-container {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(150px, 1fr));
  grid-auto-rows: masonry;   /* experimental masonry rows */
  gap: 1rem;                 /* spacing between tiles */
  justify-content: center;   /* center grid in wide containers */
  padding: 10px;
}

/* Each individual tile */
.catalog-tile {
  display: flex;
  flex-direction: column;
  align-items: center;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
  cursor: pointer;
  break-inside: avoid; /* prevent tiles from splitting in masonry */
  transition: transform 0.2s ease, box-shadow 0.2s ease;
}

.catalog-tile:hover {
  transform: translateY(-3px);
  box-shadow: 0 6px 12px rgba(0,0,0,0.15);
}

/* Tile thumbnail image */
.catalog-tile img {
  width: 100%;
  height: auto;
  display: block;
  object-fit: cover;
}

/* Tile info (id, name, grade) */
.catalog-info {
  padding: 10px;
  text-align: center;
  font-size: 1.1rem;
  font-weight: 500;
  color: #222;
}

/* Popup overlay for fullscreen images */
.catalog-popup {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  place-items: center;
  background: rgba(0,0,0,0.85);
  display: flex;
  justify-content: center;
  align-items: center;
  z-index: 9999;
}

.catalog-popup-content img {
  max-width: 90%;
  max-height: 90%;
  border-radius: 8px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.3);
}

.catalog-popup .caption {
  margin-top: 12px;
  color: #fff;
  text-align: center;
  font-size: 1.3rem;
}

/* Flex wrapper so controls sit above/below and iframe fills the rest */
.pdb-host {
  display: flex;
  flex-direction: column;
  height: 100%;
  width: 100%;
}

/* Minimal outside-the-iframe controls */
.pdb-controls {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 6px 8px;
  border: 1px solid #eee;
  background: #f0f0f0;
  flex: 0 0 auto;
}

.pdb-controls .pdb-buttonbar,
.pdb-swatch-group {
  display: inline-flex;
  align-items: center;
  border: 0;
  background: #ffffff;
  border-radius: 6px;
  padding: 0px;
  overflow: hidden;
}

.catalog-popup .pdb-swatch-group {
  border: 1px solid var(--pdb-border, #d0d0d0);
}

.pdb-controls .pdb-label,
.pdb-swatch-group .pdb-label {
  font-size: 12px;
  font-weight: 600;
  color: #555;
  margin-right: 0;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
}

.pdb-controls .pdb-swatch,
.pdb-swatch-group .pdb-swatch-image {
  height: 34px;
  padding: 0px;
  cursor: pointer;
  border: 0px;
}

.pdb-controls .pdb-swatch img {
  height: 100%;
  width: auto;
}

.pdb-controls .pdb-value,
.pdb-swatch-group .pdb-info {
  font-size: 12px;
  font-weight: 400;
  color: #555;
  display: inline-flex;
  align-items: center;
  height: 34px;
  padding: 0 10px;
  text-wrap: nowrap;
}

.pdb-controls .pdb-btn {
  border: 1px solid #ccc;
  background: #fff;
  padding: 4px 8px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 12px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
}

.pdb-controls .pdb-btn.active {
  outline: none;
  background: #e8f0fe;
  border-color: #3b82f6;
}

.pdb-controls .pdb-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.pdb-controls .pdb-buttonbar .pdb-btn {
  height: 34px;
  padding: 2px 8px;
  border-radius: 0;
}

.pdb-controls .pdb-buttonbar .pdb-btn:first-of-type {
  border-top-left-radius: 6px;
  border-bottom-left-radius: 6px;
}

.pdb-controls .pdb-buttonbar .pdb-btn:last-of-type {
  border-top-right-radius: 6px;
  border-bottom-right-radius: 6px;
}

.pdb-controls .pdb-buttonbar .pdb-btn .pdb-icon {
  height: 100%;
  width: auto;
}

.pdb-iframe {
    flex: 1 1 auto;
    min-height: 600px;
    width: 100%;
    border: 0;
}

.pdb-image-viewer {
    flex: 1 1 auto;
    min-height: 0;
    width: 100%;
}

.catalog-options-content {
  max-width: 900px;
  margin: 0 auto;
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0,0,0,.2);
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.catalog-options-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 0.75rem 1rem;
  border-bottom: 1px solid #eee;
}
.catalog-options-title {
  font-weight: 600;
  font-size: 1.6em;
  margin-left: auto;
  margin-right: auto;
}
.catalog-options-close {
  border: 0;
  background: transparent;
  font-size: 1.75em;
  line-height: 1;
  cursor: pointer;
}

.catalog-options-prompt {
  padding: 0.5rem 1rem;
  opacity: .85;
}

.catalog-options-body {
  padding: 0.75rem 1rem;
  overflow: auto;
  flex: 1 1 auto;
  min-height: 0;
}

.catalog-popup { padding: clamp(12px, 5vw, 50px); }
.catalog-options-content {
  width: 100%;
  max-height: 100%;
  border-radius: 8px;
}

.catalog-options-tabs {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #eee;
}

.catalog-options-tab {
  border: 1px solid #ddd;
  background: #fafafa;
  padding: 0.25rem 0.5rem;
  border-radius: 6px;
  cursor: pointer;
  font-size: 0.95rem;
}

.catalog-options-tab.active {
  background: #fff;
  border-color: #bbb;
  font-weight: 600;
}

.catalog-tile.selected {
  outline: 2px solid currentColor;
  outline-offset: 2px;
}
.catalog-options-toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #eee;
}
.catalog-options-search { flex: 1 1 auto; }

.catalog-options-toolbar {
  display: flex;
  gap: 0.5rem;
  padding: 0.5rem 1rem;
  border-bottom: 1px solid #eee;
  align-items: center;
  --ctl-h: 36px;
  --ctl-br: 10px;
}

.catalog-options-search,
.catalog-options-grade {
  height: var(--ctl-h);
  border: 1px solid #d6d6d6;
  border-radius: var(--ctl-br);
  background: #fff;
  padding: 0 .6rem;
  font: inherit;
  color: inherit;
  outline: none;
  box-shadow: none;
}

.catalog-options-search {
  -webkit-appearance: none;
  appearance: none;
}
.catalog-options-search::placeholder { color: #8a8a8a; }

.catalog-options-grade { padding-right: 1.8rem; }
.catalog-options-grade::-ms-expand { display: none; }

.catalog-options-search:focus,
.catalog-options-grade:focus {
  border-color: #bdbdbd;
  box-shadow: 0 0 0 2px rgba(0,0,0,.06);
}

.is-disabled {
  opacity: 0.5;
  cursor: not-allowed;
  position: relative;
  }
.is-disabled .tile-unavailable {
  position: absolute;
  left: 0;
  right: 0;
  top: 50px;
  color: black;
  font-size: 1.8rem;
  font-weight: 500;
  text-align: center;
  pointer-events: none;
}

@supports not (grid-template-rows: masonry) {
  .catalog-tile-container {
    grid-auto-rows: auto;
  }
}

.catalog-popup {
  --pdb-accent:    #0a84ff;
  --pdb-accent-bg: #e6f0ff;
  --pdb-border:    #d0d0d0;
  --pdb-btn-bg:    #f9f9f9;
  --pdb-btn-fg:    #222;
}

.catalog-popup .catalog-question {
  margin-bottom: .25rem;
  font-weight: 600;
}

.catalog-popup .pdb-buttonbar.pdb-segment {
  display: grid;
  grid-template-columns: 1fr 1fr;
  border: 1px solid var(--pdb-border);
  border-radius: 10px;
  overflow: hidden;
  margin: .75rem;
}

.catalog-popup .pdb-buttonbar.pdb-segment .pdb-btn.toggle {
  appearance: none;
  background: var(--pdb-btn-bg);
  color: var(--pdb-btn-fg);
  border: 0;
  padding: .75rem 1rem;
  text-align: left;
  display: flex;
  flex-direction: column;
  justify-content: center;
  min-height: 64px;
  transition: background .15s ease, box-shadow .15s ease, color .15s ease;
}

.catalog-popup .pdb-buttonbar.pdb-segment .pdb-btn.toggle + .pdb-btn.toggle {
  border-left: 1px solid var(--pdb-border);
}

.catalog-popup .pdb-buttonbar.pdb-segment .pdb-btn.toggle:hover:not(.active) {
  background: #f3f4f6;
}
.catalog-popup .pdb-buttonbar.pdb-segment .pdb-btn.toggle:focus-visible {
  outline: 2px solid var(--pdb-accent);
  outline-offset: 2px;
}

.catalog-popup .pdb-buttonbar.pdb-segment .pdb-btn.toggle.active {
  background: var(--pdb-accent-bg);
  box-shadow:
    inset 0 0 0 1.5px var(--pdb-accent),
    0 0 0 2px rgba(10,132,255,.35);
}

@supports (color: color-mix(in srgb, white, black)) {
  .catalog-popup .pdb-buttonbar.pdb-segment .pdb-btn.toggle.active {
    box-shadow:
      inset 0 0 0 1.5px var(--pdb-accent),
      0 0 0 2px color-mix(in srgb, var(--pdb-accent) 35%, transparent);
  }
}

.catalog-popup .pdb-buttonbar.pdb-segment .label {
  font-weight: 600;
  line-height: 1.1;
  text-align: center;
  color: #555;
  font-size: 18px;
  margin-left: auto;
  margin-right: auto;
}

.catalog-popup .pdb-buttonbar.pdb-segment .pdb-swatch-grid {
    display: inline-grid;
    gap: 3px;
    margin-left: auto;
    margin-right: auto;
}

.pdb-image-viewer {
  flex: 1 1 auto;
  min-height: 0;
  width: 100%;

  display: flex;
  gap: 10px;
  align-items: center;
  justify-content: center;
  overflow: hidden; /* no bleed */
}

.pdb-image-viewer .pdb-main-wrapper {
  flex: 1 1 auto;
  min-width: 0;
  min-height: 0;
  display: flex;
  align-items: center;
  justify-content: center;
  overflow: hidden;
}

.pdb-image-viewer .pdb-main-image {
  max-width: 100%;
  max-height: 100%;
  object-fit: contain;
  display: block;
}

.pdb-image-viewer .pdb-image-sidebar {
  flex: 0 0 auto;
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.pdb-image-viewer .pdb-thumb-image {
  width: 80px;
  cursor: pointer;
  border: 1px solid #ccc;
}

.pdb-image-viewer .pdb-thumb-image:hover {
  border-color: #666;
}

/* Allow the control bar to wrap whole components to new rows */
.pdb-controls {
  flex-wrap: wrap;
  row-gap: 8px;
}

/* Keep each component at its intrinsic width; don't let it shrink */
.pdb-controls .pdb-buttonbar,
.pdb-controls .pdb-swatch-group {
  flex: 0 0 auto;
}

/* If long labels/values were being forced onto one line, let them wrap within the component */
.pdb-controls .pdb-value,
.pdb-swatch-group .pdb-info {
  white-space: normal;
}

.pdb-specifications {
  padding: 6px 8px;
  padding-top: 0px;
  background-color: #f0f0f0;
}

.product-specifications-table {
  width: 100%;
  border-collapse: collapse;
  table-layout: fixed; /* forces equal-width columns */
  background-color: white;
  border-radius: 6px;
}

.product-specifications-table th,
.product-specifications-table td {
  padding: 4px;
  text-align: left;
  width: calc(100% / 12); /* 12 columns in your markup */
  vertical-align: top;
}

.product-specifications-table th span {
  display: block;       /* each span on its own line */
  text-align: left;     /* left aligned */
  line-height: 1.2em;   /* compact vertical spacing */
}

/* Responsive font scaling */
.product-specifications-table {
  font-size: clamp(6px, 1.3vw, 12px);
  max-width: 938px;
  color: #555;
}

.product-specifications-table th {
  font-weight: 600;
}

.catalog-options-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
}
.catalog-options-actions { display: inline-flex; gap: 8px; }
.catalog-json-pre { tab-size: 2; }
