/* Products tab (admin) - edit styles */

#productViewPanel {
  display: grid;
  gap: 0;
}

.product-view-layout {
  display: grid;
  gap: 10px;
}

#productViewPanel[hidden] {
  display: none !important;
}

.admin-product-grid {
  grid-template-columns: 1fr;
}

.product-two-col {
  display: grid;
  grid-template-columns: 3fr 2fr; /* 60% / 40% */
  gap: 14px;
  margin-top: 0;
  align-items: start;
}

.product-right {
  min-width: 0;
  display: grid;
  gap: 0;
  min-height: 0;
  overflow: hidden;
  align-self: start;
  height: var(--product-right-height, auto);
  max-height: var(--product-right-height, none);
}

.product-left {
  min-width: 0;
  min-height: 0;
  align-content: start;
  grid-auto-rows: max-content;
}

/* Keep typography consistent across editor content */
.desc-editor .admin-editor-html-rich {
  font-size: 14px;
  line-height: 1.35;
  font-family: inherit;
}

.desc-editor {
  display: grid;
  border: none;
  border-radius: 0;
  background: transparent;
  min-width: 0;
  min-height: 0;
}

.desc-editor.admin-editor-html {
  --admin-editor-html-min-height: 0;
  height: 100%;
  min-height: 0;
  grid-template-rows: auto minmax(0, 1fr);
}

.desc-editor.admin-editor-html .admin-editor-html-surface {
  min-height: 0;
  height: auto;
}

.product-description-surface {
  position: relative;
}

.product-description-media-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 3;
}

.media-remove.media-remove--editor {
  position: absolute;
  pointer-events: auto;
}

.desc-editor.admin-editor-html .admin-editor-html-rich,
.desc-editor.admin-editor-html .admin-editor-html-code {
  min-height: 0;
}

.field-media {
  margin-top: 0;
  padding-top: 0;
}

.t-variants {
  grid-template-columns: 1.6fr 180px 180px;
}

/* Variants list uses global ListView rows (lv-variants just preserves the column layout). */
.lv-variants {
  --lv-cols: 1.6fr 180px 180px;
}

.t-actions {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  align-items: center;
}

.gen-option-input {
  width: 100%;
}

.gen-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 10px;
}

.product-creatives-panel {
  min-width: 0;
}

.product-creatives-board-wrap {
  min-width: 0;
  overflow-x: auto;
  overflow-y: hidden;
  padding: 0 0 12px;
}

.product-creatives-board {
  min-width: 1320px;
  border: 1px solid var(--admin-border);
  border-radius: calc(var(--r) + 2px);
  background: #fff;
  overflow: hidden;
}

.product-creatives-board-row {
  display: grid;
  grid-template-columns: repeat(6, minmax(210px, 1fr));
  gap: 0;
}

.product-creatives-board-header {
  background: #f5f5f7;
}

.product-creatives-board-cell {
  min-width: 0;
  border-right: 1px solid var(--admin-border);
}

.product-creatives-board-cell:last-child {
  border-right: none;
}

.product-creatives-column-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-height: 45px;
  height: 45px;
  box-sizing: border-box;
  padding: 0 12px;
  background: #f5f5f7;
  border-bottom: 1px solid var(--admin-border);
}

.product-creatives-column-title-wrap {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  min-width: 0;
}

.product-creatives-column-dot {
  width: 8px;
  height: 8px;
  border-radius: 999px;
  flex: 0 0 auto;
}

.product-creatives-column--na-fila .product-creatives-column-dot {
  background: #7a7f89;
}

.product-creatives-column--em-andamento .product-creatives-column-dot {
  background: #0ea5e9;
}

.product-creatives-column--em-teste .product-creatives-column-dot {
  background: #d69a11;
}

.product-creatives-column--rejeitado .product-creatives-column-dot {
  background: #dc2626;
}

.product-creatives-column--concluido .product-creatives-column-dot,
.product-creatives-column--aprovado .product-creatives-column-dot {
  background: #16a34a;
}

.product-creatives-column-title {
  margin: 0;
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  font-size: var(--admin-fs-sm);
  font-weight: var(--admin-fw-semibold);
  line-height: var(--admin-lh-tight);
  color: var(--admin-muted);
}

.product-creatives-column-add-btn {
  width: 28px;
  height: 28px;
  padding: 0;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  border-radius: 999px;
  border: 1px solid var(--admin-border);
  background: #fff;
  color: var(--admin-muted);
  font-size: 18px;
  line-height: 1;
  cursor: pointer;
  flex: 0 0 auto;
  transition:
    border-color 120ms ease,
    background 120ms ease,
    color 120ms ease;
}

.product-creatives-column-add-btn:hover {
  border-color: var(--admin-accent-soft-border);
  background: var(--admin-accent-weak);
  color: var(--admin-accent);
}

.product-creatives-column-body {
  display: flex;
  flex-direction: column;
  gap: 8px;
  min-height: var(--admin-board-column-min-height, 180px);
  padding: 10px;
  background: #fff;
}

.product-creatives-column-body.is-drop-target {
  background: var(--admin-accent-weak);
  outline: 1px dashed var(--admin-accent-soft-border);
  outline-offset: -6px;
}

.product-creatives-card {
  position: relative;
  width: 100%;
  min-width: 0;
  display: flex;
  align-items: center;
  padding: 9px 10px;
  padding-right: 44px;
  border: 1px solid var(--admin-border);
  border-radius: var(--r);
  background: #fff;
  box-shadow: 0 4px 14px rgba(0, 0, 0, 0.04);
  color: var(--admin-text);
  cursor: pointer;
  font: inherit;
  font-size: var(--admin-fs-md);
  font-weight: var(--admin-fw-medium);
  line-height: 1.35;
  text-align: left;
  transition:
    background 140ms ease,
    border-color 140ms ease;
}

.product-creatives-card:hover {
  background: rgba(55, 53, 47, 0.06);
  border-color: rgba(55, 53, 47, 0.14);
}

.product-creatives-card:focus-visible {
  outline: 2px solid var(--admin-accent-focus);
  outline-offset: 2px;
}

.product-creatives-card.is-dragging {
  opacity: 0.5;
  transform: scale(0.98);
}

.product-creatives-card.is-editing {
  cursor: text;
}

.product-creatives-card-title {
  min-width: 0;
  flex: 1 1 auto;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-creatives-card-title-input {
  display: block;
  width: 100%;
  min-width: 0;
  min-height: 1.35em;
  margin: 0;
  padding: 0;
  border: none;
  outline: none;
  box-sizing: border-box;
  overflow: hidden;
  background: transparent;
  color: inherit;
  font: inherit;
  line-height: 1.35;
  letter-spacing: inherit;
  text-align: inherit;
  box-shadow: none;
}

.product-creatives-card-title-input::placeholder {
  color: var(--admin-muted);
  opacity: 1;
}

.product-creatives-card-edit-btn {
  top: 50%;
  transform: translateY(-50%);
}

.product-creative-modal-card {
  width: min(1120px, calc(100vw - 32px));
  max-width: none;
}

.product-creative-modal-body {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  overflow-x: hidden;
}

.product-creative-select-trigger {
  display: inline-flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  text-align: left;
  cursor: pointer;
}

.product-creative-select-trigger:hover {
  background: #fff;
}

.product-creative-select-trigger-text {
  min-width: 0;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.product-creative-select-trigger-icon {
  width: 16px;
  height: 16px;
  color: var(--admin-muted);
  flex: 0 0 auto;
}

.product-creative-select-trigger-icon svg {
  width: 16px;
  height: 16px;
  display: block;
}

.product-creative-select-popup-host .admin-category-popup {
  width: min(320px, calc(100vw - 20px));
}

.product-creative-modal-layout {
  display: grid;
  grid-template-columns: 1fr;
  gap: 14px;
  align-items: start;
}

.product-creative-top-row {
  display: grid;
  grid-template-columns: minmax(0, 1fr) minmax(220px, 320px);
  gap: 12px;
  min-width: 0;
}

.product-creative-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
}

.product-creative-script-field {
  display: block;
  min-height: 0;
}

.product-creative-script-editor {
  height: min(560px, calc(100vh - 280px));
  min-height: 460px;
  max-height: 560px;
}

.product-creative-script-editor.admin-editor-markdown {
  grid-template-rows: auto minmax(0, 1fr);
  height: min(560px, calc(100vh - 280px));
  min-height: 460px;
  max-height: 560px;
}

.product-creative-script-editor .admin-editor-markdown-surface,
.product-creative-script-editor .admin-editor-markdown-formatted,
.product-creative-script-editor .admin-editor-markdown-textarea {
  min-height: 0;
}

.product-creative-script-editor .admin-editor-markdown-surface {
  overflow: auto;
}

.product-creative-script-editor .admin-editor-markdown-textarea {
  height: 100%;
  min-height: 0;
  max-height: none;
  overflow: auto;
}

#productViewPanel > .danger-zone {
  display: flex;
  justify-content: flex-end;
  margin-top: 15px;
}

#variantsModal .modal-card {
  width: min(1100px, calc(100vw - 32px));
  max-width: none;
  margin: 0 auto;
  box-sizing: border-box;
}

#variantsModal .modal-body {
  max-height: calc(100vh - 180px);
  overflow-y: auto;
  overflow-x: hidden;
}

.variants-modal-layout {
  display: grid;
  gap: 16px;
}

.variants-modal-section {
  display: grid;
  gap: 12px;
  min-width: 0;
  padding: 14px;
  border: 1px solid var(--admin-border);
  border-radius: var(--r);
  background: #fff;
}

.variants-modal-section-head {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  min-width: 0;
}

.variants-modal-section-title {
  min-width: 0;
  font-size: 13px;
  font-weight: var(--admin-fw-semibold);
  color: var(--admin-text);
  display: none;
}

.variants-modal-grid {
  display: grid;
  grid-template-columns: repeat(2, minmax(0, 1fr));
  gap: 12px;
  min-width: 0;
}

.variants-modal-options {
  display: grid;
  gap: 10px;
  min-width: 0;
}

.variants-options-list {
  min-width: 0;
}

#variantsModal #genOptionsList,
#variantsModal #genOptionsRows {
  min-width: 0;
}

#variantsModal .gen-options-head,
#variantsModal .gen-options-row {
  --lv-cols: minmax(160px, 0.45fr) minmax(0, 1.55fr);
  width: 100%;
  min-width: 0;
}

#variantsModal .gen-options-row {
  min-height: 45px;
  height: 45px;
  cursor: pointer;
}

#variantsModal .gen-options-row .lv-cell,
#variantsModal .gen-options-row .lv-cell-button,
#variantsModal .gen-options-row .lv-inline-cell,
#variantsModal .gen-options-row .lv-inline-cell-text {
  min-width: 0;
}

#variantsModal .gen-options-row > div {
  align-items: center;
}

.gen-options-cell {
  min-width: 0;
  width: 100%;
  height: 100%;
}

.variants-modal-list {
  min-width: 0;
}

.variants-modal-list-shell {
  min-width: 0;
  overflow-x: auto;
  padding-bottom: 2px;
}

#variantsModal #variantsList {
  width: 100%;
  min-width: 0;
}

#variantsModal .lv-row {
  align-items: stretch;
}

#variantsModal .lv-row > div,
#variantsModal .lv-cell,
#variantsModal .lv-cell-button,
#variantsModal .lv-cell-button > .lv-cell,
#variantsModal .lv-inline-cell,
#variantsModal .lv-file-cell {
  min-width: 0;
  min-height: 100%;
}

#variantsModal .lv-row > div > * {
  min-width: 0;
}

#variantsModal .lv-head.lv-variants,
#variantsModal #variantsRows .lv-row {
  width: 100%;
  min-width: 0;
}

#variantsModal .variant-money-cell .lv-cell-button,
#variantsModal .variant-money-cell .lv-inline-cell,
#variantsModal .variant-price-cell .lv-cell-button,
#variantsModal .variant-price-cell .lv-inline-cell {
  align-items: center;
  min-height: 100%;
  height: 100%;
}

#variantsModal .variant-price-cell-text {
  display: block;
  min-width: 0;
}

#variantsModal .lv-variants {
  --lv-cols: minmax(220px, 1fr) minmax(128px, 160px) minmax(112px, 140px);
}

#variantsModal .variants-name-cell {
  min-width: 0;
  overflow: hidden;
}

#variantsModal .variants-name-cell .t-main {
  min-width: 0;
  width: 100%;
  display: grid;
  gap: 2px;
}

#variantsModal .lv-empty,
#variantsModal .lv-loading {
  padding: 12px;
}

.gen-options-lv {
  margin-top: 2px;
  min-width: 0;
}

.gen-options-footer {
  display: grid;
  justify-items: start;
  gap: 0;
  margin-top: 2px;
}

#variantsModal #addVariantOptionBtn {
  justify-self: start;
}

.variant-static-title {
  color: inherit;
  min-width: 0;
  max-width: 100%;
}

.variant-static-title .t-title {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

#variantsModal .t-sub {
  min-width: 0;
  max-width: 100%;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
  color: var(--admin-muted);
}

#variantsModal .pricing-editor {
  width: min(320px, calc(100vw - 24px));
  max-width: calc(100vw - 24px);
  box-sizing: border-box;
}

@media (max-width: 520px) {
  .gen-row {
    grid-template-columns: 1fr;
  }

  #variantsModal .gen-options-head,
  #variantsModal .gen-options-row {
    --lv-cols: minmax(132px, 0.5fr) minmax(0, 1.5fr);
  }
}

@media (max-width: 980px) {
  .product-creative-modal-layout {
    grid-template-columns: 1fr;
  }

  .product-creative-script-editor,
  .product-creative-script-editor.admin-editor-markdown {
    height: auto;
    max-height: none;
  }

  .product-creative-top-row {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 820px) {
  .variants-modal-grid {
    grid-template-columns: 1fr;
  }

  .product-creative-modal-grid {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 980px) {
  .admin-product-grid {
    grid-template-columns: 1fr;
  }

  .product-two-col {
    grid-template-columns: 1fr;
  }

  .product-right {
    height: auto;
    max-height: none;
  }

  .desc-editor {
    min-height: 280px;
    height: auto;
  }

  #variantsModal .modal-card {
    width: min(calc(100vw - 24px), 1000px);
  }
}
