/* Catalog library */
.catalog-set-page {
  --ml-set-row-height: clamp(43px, 8.9vh, 64px);
  container-type: inline-size;
}
.catalog-set-page .page-heading { margin-bottom: clamp(10px, 3vh, 24px); }
.catalog-set-page .ml-set-filters {
  display: grid;
  grid-template-columns: minmax(0,1.34fr) repeat(3,minmax(0,1fr));
  gap: clamp(6px,1vw,12px);
  max-width: 720px;
  margin-bottom: clamp(10px,3vh,22px);
}
.catalog-set-page .ml-set-search,
.catalog-set-page .ml-set-filters select { width: 100%; }
.catalog-set-page .ml-set-filters input,
.catalog-set-page .ml-set-filters select { height: 34px; }
.catalog-set-table th, .catalog-set-table td { padding-inline: clamp(6px,1vw,14px); }
.catalog-set-table thead th { height: clamp(32px,5.7vh,42px); }
.catalog-set-table thead th:nth-child(1) { width: 18.5%; }
.catalog-set-table thead th:nth-child(2) { width: 9.5%; }
.catalog-set-table thead th:nth-child(3) { width: 15.5%; }
.catalog-set-table thead th:nth-child(4) { width: 9.5%; }
.catalog-set-table thead th:nth-child(5) { width: 12.5%; }
.catalog-set-table thead th:nth-child(6) { width: 10%; }
.catalog-set-table thead th:nth-child(7) { width: 24.5%; }
.catalog-set-page.ml-set-readonly .catalog-set-table thead th { width: auto; }
.catalog-set-page.ml-set-readonly .catalog-set-table thead th:first-child { width: 27%; }
.catalog-set-thumb { position: relative; }
.catalog-set-thumb > img { position: absolute; inset: 0; display: block; width: 100%; height: 100%; object-fit: cover; }
.catalog-set-play {
  display: grid; place-items: center; position: absolute; left: 50%; top: 50%; transform: translate(-50%,-50%);
  width: 45%; height: 45%; border: 1px solid #f4f5f6; border-radius: 50%; background: #16191bd9; color: white;
}
.catalog-set-play svg { width: 65%; height: 65%; }
.catalog-set-geo { white-space: nowrap; font-variant-numeric: tabular-nums; }
.catalog-set-flag { margin-right: .45em; vertical-align: middle; }
.catalog-set-media-type { display: inline-flex; gap: 6px; align-items: center; max-width: 100%; vertical-align: middle; }
.catalog-set-media-type svg { width: 16px; height: 16px; flex: none; color: #c3c9ce; }
.catalog-set-media-type span { overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.catalog-set-table .ml-set-action-group { gap: clamp(3px,.9vw,14px); }
.catalog-set-table .ml-set-action-group button + button { padding-left: clamp(5px,1.1vw,16px); }

@media (max-width:660px), (min-width:821px) and (max-width:899px) {
  .catalog-set-page { --ml-set-row-height: 74px; }
  .catalog-set-table tbody tr {
    grid-template-columns: minmax(34px,.7fr) minmax(48px,1.2fr) minmax(26px,1fr) max-content auto;
    grid-template-areas: "name name name status actions" "geo type brand price price";
    column-gap: 6px;
  }
  .catalog-set-table .catalog-set-geo { grid-area: geo; }
  .catalog-set-table .catalog-set-type { grid-area: type; }
  .catalog-set-table .catalog-set-price { text-align: right; }
  .catalog-set-table .ml-set-action-group { gap: 0; }
  .catalog-set-table .ml-set-action-group button + button { padding-left: 4px; }
  .catalog-set-media-type { gap: 4px; }
  .catalog-set-media-type svg { width: 13px; height: 13px; }
  .catalog-set-table .catalog-set-type,
  .catalog-set-table .catalog-set-geo { font-size: 11px; color: #bdc3cb; }
}
@container (min-width:600px) and (max-width:820px) {
  .catalog-set-table .ml-set-action-group { gap: 1px; }
  .catalog-set-table .ml-set-action-group button { font-size: 10px; gap: 3px; }
  .catalog-set-table th, .catalog-set-table td { padding-inline: 5px; }
}
@media (max-width:565px) {
  .catalog-set-page .ml-set-filters { grid-template-columns: repeat(2,minmax(0,1fr)); }
}
@media (max-height:480px) {
  .catalog-set-page { margin-block: -8px; }
  .catalog-set-page .page-heading { margin-bottom: 4px; }
  .catalog-set-page .ml-set-filters { margin-bottom: 5px; }
  .catalog-set-page .ml-set-filters input,
  .catalog-set-page .ml-set-filters select { height: 28px; }
}

/* Both operations use the same product, media and copy panels. */
.catalog-editor.ad-set-dialog {
  --catalog-line: #383c40;
  --catalog-pad: clamp(13px,2vw,27px);
  --catalog-gap: clamp(8px,2.2vh,20px);
  width: min(1440px,90vw);
  height: min(820px,86vh);
  height: min(820px,86dvh);
  max-height: calc(100vh - 12px);
  max-height: calc(100dvh - 12px);
  color: #eceef0;
  border-color: #4a4d51;
  border-radius: 12px;
  background: #222527;
}
.catalog-editor::backdrop { backdrop-filter: blur(3px); background: rgb(8 10 12 / 65%); }
.catalog-editor > .ad-set-form {
  height: 100%; max-height: none; min-height: 0;
}
.catalog-editor .dialog-header { flex: none; padding: clamp(9px,2.1vh,18px) var(--catalog-pad); }
.catalog-editor .dialog-header h2 { margin: 0; font-size: clamp(17px,1.65vw,24px); font-weight: 600; }
.catalog-editor .dialog-header button {
  display: grid; place-items: center; min-height: 28px; min-width: 28px;
  border: none; background: transparent; border-radius: 4px; padding: 2px; color: inherit;
}
.catalog-editor .dialog-header button:hover { background: #35393d; }
.catalog-editor .dialog-header svg { width: 17px; height: 17px; }
.catalog-editor .ad-set-dialog-body {
  flex: 1; min-width: 0; min-height: 0; display: flex; flex-direction: column; align-items: stretch;
  gap: var(--catalog-gap); padding: var(--catalog-gap) var(--catalog-pad); overflow: visible;
}
.catalog-editor .catalog-editor-product {
  flex: none; display: grid; align-items: end; grid-template-columns: minmax(0,2.55fr) minmax(0,1.55fr) minmax(0,1.43fr) minmax(0,.96fr) minmax(0,.98fr);
  gap: 8px clamp(8px,1.35vw,20px); padding: 0; border: 0; background: transparent; border-radius: 0;
}
.catalog-editor .catalog-editor-product--legacy { grid-template-columns: minmax(0,1.6fr) minmax(0,1fr); }
.catalog-editor .field { gap: clamp(3px,.75vh,7px); min-width: 0; margin: 0; }
.catalog-editor .field-label { color: #d7d9dc; font-weight: 500; line-height: 1.25; font-size: clamp(12px,1.03vw,15px); }
.catalog-editor .field input, .catalog-editor .field select, .catalog-editor textarea, .catalog-editor-panes select {
  width: 100%; min-width: 0; margin: 0; height: clamp(28px,5.5vh,42px); min-height: 0;
  background: #1b1e20; border: 1px solid #474b50; border-radius: 7px;
  font-family: inherit; font-size: clamp(12px,1.04vw,15px); font-weight: 400; line-height: 1.4;
  padding: 4px clamp(7px,1vw,14px); color: #eef0f2;
}
.catalog-editor .field input:focus, .catalog-editor .field select:focus, .catalog-editor textarea:focus {
  border-color: #1988eb; box-shadow: 0 0 0 2px #1489ec24;
}
.catalog-editor .catalog-editor-layout {
  flex: 1; min-height: 0; min-width: 0; display: grid;
  grid-template-columns: minmax(0,1fr) minmax(0,1.94fr); gap: clamp(9px,1.2vw,20px);
}
.catalog-editor .catalog-editor-media, .catalog-editor .catalog-editor-texts {
  min-width: 0; min-height: 0; padding: clamp(8px,1.7vh,16px) clamp(10px,1.25vw,20px);
  border: 1px solid var(--catalog-line); border-radius: 10px;
}
.catalog-editor h3 { margin: 0; color: #ebedf0; font-size: clamp(14px,1.37vw,20px); line-height: 1.25; font-weight: 600; }
.catalog-editor .catalog-editor-media { display: flex; flex-direction: column; gap: clamp(4px,1vh,9px); }
.catalog-media-heading { flex: none; display: flex; gap: 12px; align-items: center; }
.catalog-media-heading svg { width: clamp(20px,2.4vw,30px); height: clamp(20px,2.4vw,30px); flex: none; color: #bac1c8; }
.catalog-media-heading small { display: block; margin-top: 2px; color: #aeb6c0; font-size: clamp(11px,1vw,14px); line-height: 1.3; }
.catalog-editor-preview {
  flex: 1; min-height: 0; min-width: 0; display: grid; grid-template: minmax(0,1fr) / minmax(0,1fr);
  place-items: center; container-type: size;
}
.catalog-editor-preview .ad-set-preview {
  width: 100%; height: 100%; min-height: 0; max-height: 100%; max-width: 100%;
  border: 0; background: transparent; border-radius: 7px;
}
@supports (width: 1cqh) {
  .catalog-editor-preview .ad-set-preview { width: min(100cqw,100cqh); height: auto; aspect-ratio: 1; }
}
.catalog-editor-preview .ad-set-preview img, .catalog-editor-preview .ad-set-preview video {
  max-width: 100%; max-height: 100%; min-height: 0; object-fit: contain;
}
.catalog-editor-preview .ad-set-preview:has(> span) {
  background: #1d2023; border: 1px dashed #454b52;
}
.catalog-media-actions {
  display: flex; flex-wrap: wrap; align-items: center; justify-content: center; gap: 5px 8px; min-width: 0;
}
.catalog-media-actions .btn {
  min-height: clamp(26px,4.4vh,36px); padding: 3px 12px; gap: 6px;
  font-size: clamp(11px,1vw,14px); color: #dee2e5; background: transparent;
}
.catalog-media-actions .btn svg { width: 15px; height: 15px; }
.catalog-media-actions select {
  min-width: 0; max-width: 100%; border: 1px solid #474b50; border-radius: 6px;
  background: #1b1e20; color: #dee2e5; padding: 4px; text-overflow: ellipsis; font-size: 12px;
}
.catalog-editor .catalog-editor-texts {
  display: grid; align-content: start; grid-template-rows: auto minmax(0,1.38fr) auto minmax(0,1fr);
  gap: clamp(8px,2.6vh,23px); padding-bottom: clamp(9px,4vh,35px);
}
.catalog-editor-texts .field { min-height: 0; }
.catalog-editor-texts textarea {
  flex: 1; height: 0; min-height: 0; padding-block: clamp(4px,1vh,9px); resize: none; scrollbar-width: none;
}
.catalog-editor-texts textarea[name=headline] { flex: none; height: clamp(29px,6.8vh,58px); }
.catalog-editor-texts textarea::-webkit-scrollbar { width: 0; height: 0; }
.catalog-editor .ad-set-footer {
  flex: none; align-items: center; gap: clamp(6px,1vw,14px);
  padding: clamp(8px,1.65vh,16px) clamp(12px,1.45vw,22px) clamp(8px,1.65vh,16px) var(--catalog-pad);
  border-color: var(--catalog-line); background: transparent;
}
.catalog-editor .ad-set-footer .btn { min-height: clamp(29px,5vh,40px); padding: 4px clamp(10px,1.6vw,25px); font-size: clamp(12px,1.1vw,15px); }
.catalog-editor .ad-set-footer .btn-primary { background: #0c83f1; border-color: #1689fa; }
.catalog-editor-state { display: inline-flex; align-items: center; gap: 9px; flex: none; font-size: clamp(12px,1.05vw,15px); }
.catalog-editor-state::before {
  content: ""; width: 9px; height: 9px; flex: none; border-radius: 50%; background: #acb3bb;
}
.catalog-editor-state[data-state=ready]::before { background: #3bbb67; }
.catalog-editor-state[data-state=draft]::before { background: #d7a55f; }
.catalog-editor .ad-set-message { line-height: 1.3; }
.catalog-editor .catalog-editor-panes { display: none; }

@media (min-width:741px) and (min-height:511px) and (max-height:650px) {
  .catalog-editor.ad-set-dialog { height: 91vh; height: 91dvh; }
  .catalog-editor .catalog-editor-texts { gap: clamp(7px,2vh,13px); padding-bottom: 13px; }
}
@media (max-width:740px), (max-height:510px) {
  .catalog-editor.ad-set-dialog {
    --catalog-pad: clamp(10px,2vw,16px); --catalog-gap: clamp(6px,1.6vh,13px);
    width: min(625px,calc(100vw - 12px));
    height: min(690px,calc(100vh - 12px)); height: min(690px,calc(100dvh - 12px));
  }
  .catalog-editor .dialog-header { padding-block: clamp(5px,1.3vh,11px); }
  .catalog-editor .catalog-editor-panes {
    flex: none; display: flex; align-items: center; padding: 5px var(--catalog-pad); border-bottom: 1px solid var(--catalog-line);
  }
  .catalog-editor .catalog-editor-panes select { height: clamp(26px,5vh,36px); }
  .catalog-editor .catalog-editor-product { display: none; }
  .catalog-editor[data-editor-pane=product] .catalog-editor-product {
    display: grid; align-content: start; grid-template-columns: repeat(2,minmax(0,1fr));
  }
  .catalog-editor-product > .field:first-child { grid-column: 1/-1; }
  .catalog-editor[data-editor-pane=product] .catalog-editor-layout { display: none; }
  .catalog-editor .catalog-editor-layout { grid-template-columns: minmax(0,1fr); grid-template-rows: minmax(0,1fr); }
  .catalog-editor .catalog-editor-media, .catalog-editor .catalog-editor-texts { display: none; }
  .catalog-editor[data-editor-pane=media] .catalog-editor-media { display: flex; }
  .catalog-editor[data-editor-pane=texts] .catalog-editor-texts { display: grid; }
  .catalog-editor .catalog-editor-texts { gap: var(--catalog-gap); padding: clamp(7px,1.2vh,12px); }
  .catalog-editor .ad-set-footer { flex-wrap: wrap; padding: var(--catalog-gap) var(--catalog-pad); }
  .catalog-editor .catalog-editor-state { margin-right: auto; gap: 5px; }
  .catalog-editor .ad-set-message:empty { display: none; }
  .catalog-editor .ad-set-message:not(:empty) { flex-basis: 100%; order: -1; }
}
@media (max-width:430px) and (min-height:470px) {
  .catalog-editor-product > .field:nth-child(-n+3) { grid-column: 1/-1; }
}
@media (max-height:420px) {
  .catalog-editor .dialog-header { padding-block: 3px; }
  .catalog-editor .dialog-header h2 { font-size: 16px; }
  .catalog-editor .catalog-editor-panes { padding-block: 2px; }
  .catalog-editor .ad-set-dialog-body { padding-block: 4px; }
  .catalog-editor .ad-set-footer { padding-block: 3px; }
  .catalog-editor .catalog-editor-texts > h3 { display: none; }
  .catalog-editor .catalog-editor-texts { grid-template-rows: minmax(0,1.25fr) auto minmax(0,1fr); gap: 4px; }
  .catalog-editor .field { gap: 2px; }
  .catalog-editor .catalog-editor-product { column-gap: 8px; row-gap: 4px; }
}
