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

#productEditPanel {
  display: grid;
  gap: 14px;
}

#productEditPanel[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: 10px;
  align-items: start;
}

.product-right {
  min-width: 0;
  display: grid;
  grid-template-rows: auto 1fr;
  gap: 10px;
  overflow: hidden;
}

.product-left {
  min-width: 0;
}

.form {
  display: grid;
  gap: 10px;
  margin-top: 6px;
}

.f-label {
  font-size: 12px;
  font-weight: 700;
  color: var(--admin-muted);
  margin-top: 6px;
}

.input-full {
  width: 100%;
  min-width: 0;
}

.textarea {
  width: 100%;
  min-height: 44px;
  padding: 10px 12px;
  border-radius: var(--r);
  border: 1px solid var(--admin-border);
  background: #fff;
  font-weight: 500;
  resize: vertical;
  box-sizing: border-box;
}

/* Meta descricao: no resize handle */
#pMeta {
  resize: none;
  min-height: 0;
}

.field-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 10px;
  margin: 0;
}

.field-row .f-label {
  margin-top: 6px;
  margin-bottom: 0;
}

.mini-icon {
  width: 36px;
  height: 26px;
  border-radius: 8px;
  border: 1px solid var(--admin-border);
  background: #fff;
  cursor: pointer;
  display: grid;
  place-items: center;
  font-family:
    ui-monospace,
    SFMono-Regular,
    Menlo,
    Monaco,
    Consolas,
    'Liberation Mono',
    'Courier New',
    monospace;
  font-weight: 800;
  color: var(--admin-muted);
  line-height: 1;
}

.mini-icon.is-on {
  border-color: rgba(255, 138, 0, 0.35);
  background: rgba(255, 138, 0, 0.08);
  color: var(--admin-text);
}

.mini-icon:hover {
  border-color: rgba(96, 100, 108, 0.35);
}

.desc-editor {
  display: flex;
  flex: 1;
  min-height: 0;
  border: 1px solid var(--admin-border);
  border-radius: var(--r);
  background: #fff;
  overflow: hidden;
}

.desc-editor > .richbox,
.desc-editor > .textarea {
  flex: 1;
}

.desc-editor .textarea {
  resize: none;
  overflow: auto;
  scrollbar-gutter: stable;
  background-clip: padding-box;
  border: none;
  border-radius: 0;
  padding: 10px 12px;
}

.desc-editor .textarea:focus {
  outline: none;
  box-shadow: none;
}

.desc-editor:focus-within {
  border-color: var(--admin-border);
  box-shadow: none;
}

.richbox {
  width: 100%;
  min-height: 44px;
  max-height: none;
  padding: 10px 12px;
  border-radius: 0;
  border: none;
  background: transparent;
  font-weight: 500;
  box-sizing: border-box;
  outline: none;
  overflow: auto;
  resize: none;
  scrollbar-gutter: stable;
  background-clip: padding-box;
}

/* Keep typography consistent across inputs/textareas/editor */
.input-full,
.textarea,
.money-input,
.richbox {
  font-size: 14px;
  line-height: 1.35;
  font-family: inherit;
}

/* Focus styling is handled on the wrapper (.desc-editor:focus-within). */
.richbox:focus {
  outline: none;
}

/* Make pasted HTML look closer to Shopify defaults (readable spacing). */
.richbox h1,
.richbox h2,
.richbox h3,
.richbox h4 {
  margin: 12px 0 6px;
  line-height: 1.25;
}

.richbox p {
  margin: 0 0 10px;
}

.richbox ul,
.richbox ol {
  margin: 0 0 10px;
  padding-left: 18px;
}

.richbox li {
  margin: 4px 0;
}

.richbox > *:first-child {
  margin-top: 0;
}

.richbox > *:last-child {
  margin-bottom: 0;
}

.media {
  display: grid;
  gap: 12px;
}

.media-input {
  display: none;
}

.media-drop {
  border: 1px dashed rgba(96, 100, 108, 0.35);
  border-radius: var(--r);
  padding: 14px 12px;
  color: var(--admin-muted);
  font-weight: 650;
  background: #fff;
  width: 100%;
  text-align: left;
  cursor: pointer;
}

.media-drop.is-dragover {
  border-color: rgba(255, 138, 0, 0.65);
  background: rgba(255, 138, 0, 0.08);
  color: var(--admin-text);
}

.media-grid {
  display: grid;
  grid-template-columns: repeat(6, minmax(0, 1fr));
  gap: 6px;
}

.media-item {
  position: relative;
  aspect-ratio: 1 / 1;
  border-radius: var(--r);
  border: 1px solid var(--admin-border);
  background: linear-gradient(180deg, #fafafa, #f1f1f6);
  overflow: hidden;
  cursor: grab;
}

.media-item.is-dragging {
  opacity: 0.6;
  cursor: grabbing;
}

.media-item.is-dragover {
  border-color: rgba(255, 138, 0, 0.65);
  box-shadow: 0 0 0 1px rgba(255, 138, 0, 0.18);
}

.media-item img {
  width: 100%;
  height: 100%;
  display: block;
  object-fit: cover;
}

.media-remove {
  position: absolute;
  top: 8px;
  right: 8px;
  width: 30px;
  height: 30px;
  border-radius: 10px;
  border: 1px solid rgba(255, 255, 255, 0.35);
  background: rgba(17, 18, 20, 0.55);
  color: #fff;
  cursor: pointer;
  font-weight: 800;
}

.field-media {
  margin-top: 6px;
  padding-top: 6px;
}

.field-media-h {
  display: flex;
  align-items: baseline;
  justify-content: space-between;
  gap: 10px;
  margin-bottom: 8px;
}

.field-media-title {
  font-size: 12px;
  font-weight: 700;
  color: var(--admin-muted);
}

.t-variants {
  grid-template-columns: 1.6fr 0.7fr 0.8fr 0.7fr;
}

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

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

.money {
  position: relative;
}

.money-prefix {
  position: absolute;
  top: 50%;
  left: 12px;
  transform: translateY(-50%);
  color: var(--admin-muted);
  font-weight: 700;
  pointer-events: none;
}

.money-input {
  width: 100%;
  padding: 10px 12px 10px 30px;
  border-radius: var(--r);
  border: 1px solid var(--admin-border);
  background: #fff;
  font-weight: 500;
  box-sizing: border-box;
}

.money-input::-webkit-outer-spin-button,
.money-input::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}

.money-input[type='number'] {
  -moz-appearance: textfield;
  appearance: textfield;
}

.gen-options {
  display: grid;
  gap: 10px;
}

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

.danger-zone {
  display: flex;
  justify-content: flex-end;
  margin-top: 14px;
}

/* Empty state inside the variants table needs padding so it doesn't hug the border */
#variantsRows .empty {
  padding: 12px;
}

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

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

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

  .media-grid {
    grid-template-columns: repeat(2, minmax(0, 1fr));
  }
}
