#collage-mode-row{padding:12px 0}.collage-toggle{display:flex;align-items:center;gap:10px;font-size:14px;font-weight:700;cursor:pointer}.collage-toggle input{width:18px;height:18px;accent-color:#111827}.collage-layouts{display:grid;grid-template-columns:repeat(2,minmax(0,1fr));gap:9px;margin:12px 0 18px}.collage-layout{border:1px solid #d0d5dd;border-radius:10px;background:#fff;padding:9px;display:flex;flex-direction:column;align-items:center;gap:7px;cursor:pointer;font-size:11px;font-weight:700;color:#344054}.collage-layout.selected{border:2px solid #111827;background:#f9fafb}.collage-layout-thumb{position:relative;display:block;width:85px;height:58px;background:#fff;border:1px solid #d0d5dd}.collage-layout-thumb i{position:absolute;box-sizing:border-box;border:2px solid white;background:#b6c3d3}.collage-control{margin:14px 0}.collage-control label{display:flex;justify-content:space-between;gap:8px;font-weight:700;font-size:12px;margin-bottom:7px}.collage-control input[type=range]{width:100%;accent-color:#111827}.collage-control input[type=color]{width:100%;height:38px;border:1px solid #d0d5dd;border-radius:7px;padding:3px}.collage-help,.collage-photo-count{font-size:12px;line-height:1.5;color:#667085;margin-top:9px}.collage-photo-count{font-weight:700}.collage-active .gview>.gorgimg,.collage-active .gview>.gbackimg,.collage-active .gview>.inner-file-upload{visibility:hidden}.collage-stage{position:absolute;inset:0;z-index:30;overflow:hidden}.collage-cell{position:absolute;display:block;overflow:hidden;padding:0;background:#f1f3f5;cursor:pointer;box-sizing:border-box;color:#475467;border-radius:0}.collage-cell img{display:block;width:100%;height:100%;object-fit:cover}.collage-cell-empty{display:flex;align-items:center;justify-content:center;flex-direction:column;width:100%;height:100%;font-size:24px}.collage-cell-empty small{font-size:10px;font-weight:700}.collage-cell-edit{position:absolute;right:4px;bottom:4px;background:rgba(0,0,0,.7);color:white;padding:3px 6px;border-radius:4px;font-size:10px;opacity:0}.collage-cell:hover .collage-cell-edit{opacity:1}@media(max-width:650px){.collage-layouts{grid-template-columns:repeat(2,minmax(0,1fr))}}

/* Collage template selector: 3 visual options per row, normal dropdown header. */
#collage-controls { min-width:0; }
#collage-template-select-dynamic-select { width:100%; max-width:100%; min-width:0; }
#collage-template-select-dynamic-select .dynamic-select-options,
#collage-template-select-dynamic-select .dynamic-select-dropdown,
#collage-template-select-dynamic-select .dynamic-select-list { max-height:340px; overflow-y:auto; }
#collage-template-select-dynamic-select .dynamic-select-options,
#collage-template-select-dynamic-select .dynamic-select-list { grid-template-columns:repeat(3,minmax(0,1fr)); }
#collage-template-select-dynamic-select img { display:block; width:100%; max-width:80px; height:52px; object-fit:contain; margin:0 auto 5px; }
#collage-template-select-dynamic-select .dynamic-select-header img,
#collage-template-select-dynamic-select .dynamic-select-selected img { width:44px; height:32px; margin:0; }
#collage-template-select-dynamic-select .dynamic-select-option,
#collage-template-select-dynamic-select .dynamic-select-item { min-width:0; box-sizing:border-box; text-align:center; overflow-wrap:normal; word-break:normal; font-size:11px; line-height:1.3; }

/* Split Canvas and Canvas Packages: override legacy fixed 55px cards.
   Table rows are flattened into one 3-column grid to avoid short last rows. */
.cv-multi .size-tbl { min-width:0; width:100%; }
.cv-multi .size-tbl table { display:block; width:100%; border:0; border-collapse:collapse; margin:0; }
.cv-multi .size-tbl table > tbody { display:grid; width:100%; grid-template-columns:repeat(3,minmax(0,1fr)); gap:10px; }
.cv-multi .size-tbl table > tbody > tr { display:contents; }
.cv-multi .size-tbl table > tbody > tr > td { display:block; box-sizing:border-box; width:auto !important; min-width:0; padding:0 !important; border:0; }
.cv-multi .size-tbl .size-img {
  box-sizing:border-box; display:flex; flex-direction:column; align-items:center; justify-content:center;
  gap:6px; width:100% !important; max-width:none !important; min-width:0;
  min-height:100px; margin:0; padding:9px 5px;
  border:1px solid #d9e0e6; border-radius:9px; background:#fff;
  color:#25364a; text-align:center; cursor:pointer;
}
.cv-multi .size-tbl .size-img:hover { background:#f3f8fc; border-color:#88b4d3; color:#25364a; }
.cv-multi .size-tbl .size-img.active { border:2px solid #357db5; background:#edf6fc; color:#173b5a; }
.cv-multi .size-tbl .size-img h5 {
  display:block; width:100%; height:auto !important; min-height:0;
  margin:0 !important; padding:0; font-size:11px; font-weight:600; line-height:1.3;
  white-space:normal; overflow-wrap:break-word; word-break:normal; text-align:center;
}
.tcp-group-layout-preview { width:100%; max-width:90px; height:54px; margin:0 auto; flex:0 0 auto; }
.tcp-group-layout-svg { display:block; width:100%; height:100%; }
@media(max-width:360px) {
  .cv-multi .size-tbl table > tbody { gap:6px; }
  .cv-multi .size-tbl .size-img { min-height:92px; padding:6px 3px; }
  .cv-multi .size-tbl .size-img h5 { font-size:10px; }
  #collage-template-select-dynamic-select img { height:43px; }
}

/* TCP - Split Canvas & Canvas Packages
   Full-width three-column template selector */

#sizePickerPanel .cv-multi .size-tbl {
  display: block !important;
  width: 100% !important;
  max-width: 100% !important;
  box-sizing: border-box !important;
}

  #sizePickerPanel .cv-multi .size-tbl table,
  #sizePickerPanel .cv-multi .size-tbl tbody {
    display: block !important;
    width: 100% !important;
    border: 0 !important;
    border-spacing: 0 !important;
  }

  #sizePickerPanel .cv-multi .size-tbl tr {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    gap: 6px !important;
    width: 100% !important;
  }

  #sizePickerPanel .cv-multi .size-tbl td {
    display: block !important;
    width: 100% !important;
    min-width: 0 !important;
    padding: 0 !important;
    margin: 0 !important;
    box-sizing: border-box !important;
  }

  #sizePickerPanel .cv-multi .size-tbl .size-img {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    height: 100px !important;
    margin: 0 !important;
    padding: 8px 5px !important;
    box-sizing: border-box !important;
  }

  #sizePickerPanel .cv-multi .size-tbl .tcp-group-layout-preview {
    width: 100% !important;
    min-width: 0 !important;
  }

  #sizePickerPanel .cv-multi .size-tbl .tcp-group-layout-svg {
    display: block !important;
    width: 100% !important;
    height: 55px !important;
  }

  #sizePickerPanel .cv-multi .size-tbl .size-img h5 {
    width: 100% !important;
    margin: 5px 0 0 !important;
    text-align: center !important;
    font-size: 11px !important;
    line-height: 1.3 !important;
    white-space: nowrap !important;
  }

/* TCP Photo Collage - Full-width 3-column DynamicSelect */

#collage-template-select {
  width: 100% !important;
  max-width: 100% !important;
  position: relative;
}

  /* Dropdown panel */
  #collage-template-select .dynamic-select-options {
    display: none;
    position: absolute;
    left: 0;
    right: 0;
    top: 100%;
    width: 100% !important;
    min-width: 100% !important;
    max-width: 100% !important;
    padding: 6px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    z-index: 100;
    background: #fff;
    border: 1px solid #d9e1e8;
    border-radius: 8px;
    box-shadow: 0 6px 20px rgba(0,0,0,.08);
    grid-template-columns: repeat(3, minmax(0, 1fr));
    gap: 6px;
  }

  /* Show grid only when dropdown is open */
  #collage-template-select
  .dynamic-select-header-active + .dynamic-select-options {
    display: grid !important;
  }

  /* Equal-width cards */
  #collage-template-select .dynamic-select-option {
    display: flex !important;
    flex-direction: column !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    min-width: 0 !important;
    max-width: none !important;
    min-height: 96px;
    padding: 8px 4px !important;
    margin: 0 !important;
    box-sizing: border-box !important;
    border: 1px solid #d9e1e8;
    border-radius: 8px;
    background: #fff;
    cursor: pointer;
  }

    /* Template preview */
    #collage-template-select .dynamic-select-option img {
      display: block;
      width: 100% !important;
      max-width: 90px !important;
      height: 55px !important;
      object-fit: contain;
      margin: 0 auto 5px;
    }

  /* Template name */
  #collage-template-select .dynamic-select-option-text {
    display: block;
    width: 100%;
    font-size: 11px;
    line-height: 1.3;
    text-align: center;
    white-space: normal !important;
    overflow-wrap: break-word;
  }

  /* Selected template */
  #collage-template-select
  .dynamic-select-option.dynamic-select-selected {
    border-color: #357db5;
    background: #edf6fc;
  }

  /* Selected template in collapsed header */
  #collage-template-select .dynamic-select-header {
    width: 100%;
    box-sizing: border-box;
  }


/* TCP 2026-11-06: keep visual template menus compact and independently scrollable. */
/* Split Canvas / Canvas Packages use an expanded size picker with a real table. */
#sizePickerPanel .cv-multi .size-tbl {
    max-height: 330px !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #9baec0 #edf2f6;
    padding-right: 5px !important;
}
#sizePickerPanel .cv-multi .size-tbl::-webkit-scrollbar,
#collage-template-select .dynamic-select-options::-webkit-scrollbar {
    width: 8px;
}
#sizePickerPanel .cv-multi .size-tbl::-webkit-scrollbar-track,
#collage-template-select .dynamic-select-options::-webkit-scrollbar-track {
    background: #edf2f6;
    border-radius: 8px;
}
#sizePickerPanel .cv-multi .size-tbl::-webkit-scrollbar-thumb,
#collage-template-select .dynamic-select-options::-webkit-scrollbar-thumb {
    background: #9baec0;
    border-radius: 8px;
    border: 2px solid #edf2f6;
}
#sizePickerPanel .cv-multi .size-tbl::-webkit-scrollbar-thumb:hover,
#collage-template-select .dynamic-select-options::-webkit-scrollbar-thumb:hover {
    background: #637d95;
}

/* Photo Collage DynamicSelect: dropdown floats over the settings, not in flow. */
#collage-template-select {
    position: relative !important;
    width: 100% !important;
}
#collage-template-select .dynamic-select-options {
    position: absolute !important;
    top: 100% !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    max-height: 330px !important;
    overflow-y: scroll !important;
    overflow-x: hidden !important;
    overscroll-behavior: contain;
    scrollbar-width: thin;
    scrollbar-color: #9baec0 #edf2f6;
    z-index: 1100 !important;
}
/* Maintain the 3-column visual grid when DynamicSelect opens. */
#collage-template-select .dynamic-select-header-active + .dynamic-select-options {
    display: grid !important;
    grid-template-columns: repeat(3, minmax(0, 1fr)) !important;
    align-content: start;
}


/* Collage controls: toolbar popover beside Zoom / Rotate */
.preview-toolbar { position:relative; }
#tcp-collage-toolbar { position:relative; }
#tcp-collage-toolbar .tcp-collage-settings-menu {
  width:min(340px, calc(100vw - 32px)); min-width:280px;
  max-height:min(480px, 70vh); overflow-y:auto; overflow-x:hidden;
  padding:16px !important; z-index:1060;
  border:1px solid #d9e1e8; border-radius:12px;
  box-shadow:0 12px 32px rgba(0,0,0,.13);
}
#tcp-collage-toolbar .tcp-collage-settings-title {
  font-size:13px; font-weight:700; margin-bottom:12px; color:#1f2937;
}
#tcp-collage-toolbar .collage-control { margin:0 0 16px; }
#tcp-collage-toolbar .collage-control:last-child { margin-bottom:0; }
#tcp-collage-toolbar .collage-control input[type=range] { display:block; width:100%; }
#tcp-collage-toolbar .collage-control input[type=color] { width:100%; }
@media (max-width:650px) {
  #tcp-collage-toolbar .tcp-collage-settings-menu {
    width:min(320px, calc(100vw - 24px)); min-width:0;
  }
}


/* TCP compact collage layout — controls now mount directly in their final slot.
   This avoids the old help/counter text and the extra buybox margin that
   pushed the collage dropdown below Canvas Style. */
.shopify-editor #tcpCanvasStyleRow > #tcpCollageLayoutSlot.tcp-collage-visible {
  display:flex !important;
  flex-direction:column !important;
  justify-content:flex-start !important;
  align-self:start !important;
  gap:0 !important;
  margin:0 !important;
  padding:0 !important;
  min-width:0 !important;
}
.shopify-editor #tcpCollageLayoutSlot > .tcp-collage-fixed-title {
  display:block !important;
  margin:0 0 5px !important;
  padding:0 !important;
  font-size:10px !important;
  font-weight:850 !important;
  line-height:1.3 !important;
}
.shopify-editor #tcpCollageLayoutSlot > #collage-controls.tcp-relocated-collage {
  display:block !important;
  width:100% !important;
  min-width:0 !important;
  margin:0 !important;
  padding:0 !important;
  border:0 !important;
  background:transparent !important;
}
.shopify-editor #tcpCollageLayoutSlot > #collage-controls > .section-title {
  display:none !important;
}
.shopify-editor #tcpCollageLayoutSlot #collage-template-select-dynamic-select,
.shopify-editor #tcpCollageLayoutSlot #collage-template-select-dynamic-select .dynamic-select-header {
  width:100% !important;
  margin:0 !important;
}
.shopify-editor #tcpCollageLayoutSlot .collage-help,
.shopify-editor #tcpCollageLayoutSlot .collage-photo-count {
  display:none !important;
}
@media (max-width:991px) {
  .shopify-editor #tcpCollageLayoutSlot > .tcp-collage-fixed-title {
    margin-bottom:3px !important;
    font-size:9px !important;
  }
}
