/* embed mode (ฝังใน iframe จากหน้า workspace) */
html.mb-embed #maibit-header {
  display: none;
}

html.mb-embed .page-heading-row {
  display: none;
}

html.mb-embed body {
  background: transparent;
}

html.mb-embed .page-shell {
  padding: 0.5rem 0 1rem;
}

html.mb-embed .maibit-container {
  max-width: 100%;
  padding: 0 0.4rem;
}

.page-shell {
  padding: 1.6rem 0 2.4rem;
}

.page-heading-row {
  display: flex;
  justify-content: space-between;
  align-items: flex-start;
  gap: 0.75rem;
  margin-bottom: 1.2rem;
  flex-wrap: wrap;
}

.page-heading-row h1 {
  font-size: 1.4rem;
  font-weight: 700;
  margin-bottom: 0.2rem;
}

.page-heading-row p {
  font-size: 0.86rem;
  opacity: 0.8;
  max-width: 32rem;
}

.btn-outline {
  padding: 0.4rem 1rem;
  border-radius: 999px;
  border: 1px solid rgba(148, 163, 184, 0.8);
  background: transparent;
  color: #e5e7eb;
  font-size: 0.8rem;
  cursor: pointer;
  white-space: nowrap;
}

.btn-outline:hover {
  background: rgba(15, 23, 42, 0.9);
}

.listing-layout {
  display: grid;
  grid-template-columns: minmax(0, 1.3fr) minmax(0, 0.9fr);
  gap: 1.4rem;
}

.preview-aside {
  position: sticky;
  top: 1rem;
  align-self: start;
}

.lp-card {
  background: rgba(15, 23, 42, 0.7);
  border: 1px solid rgba(31, 41, 55, 0.95);
  border-radius: 0.9rem;
  overflow: hidden;
  margin-bottom: 1rem;
}

.lp-cover {
  aspect-ratio: 16/9;
  background: #131c33;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #64748b;
  font-size: 0.85rem;
  background-size: cover;
  background-position: center;
}

.lp-body {
  padding: 0.9rem;
}

.lp-title {
  font-weight: 700;
  font-size: 0.95rem;
  margin-bottom: 0.35rem;
  word-break: break-word;
}

.lp-meta {
  font-size: 0.75rem;
  opacity: 0.6;
  margin-bottom: 0.5rem;
}

.lp-desc {
  font-size: 0.8rem;
  opacity: 0.8;
  margin-bottom: 0.7rem;
  line-height: 1.4;
  display: -webkit-box;
  -webkit-line-clamp: 3;
  -webkit-box-orient: vertical;
  overflow: hidden;
}

.lp-price-row {
  display: flex;
  align-items: center;
  justify-content: space-between;
}

.lp-price {
  font-size: 1.2rem;
  font-weight: 900;
  color: #7dd3fc;
}

.lp-badge {
  font-size: 0.7rem;
  opacity: 0.7;
}

.tips-details {
  margin-top: 1rem;
  font-size: 0.85rem;
}

.tips-details summary {
  cursor: pointer;
  font-weight: 600;
  color: #cbd5e1;
  padding: 0.3rem 0;
}

@media (max-width: 760px) {
  .listing-layout {
    grid-template-columns: 1fr;
    gap: 0.7rem;
  }

  .preview-aside {
    position: static;
  }
}

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

  .delivery-mode-tabs {
    flex-wrap: wrap;
  }

  .delivery-mode-tabs button {
    flex: 1;
    min-width: 100px;
    font-size: 0.78rem;
  }
}

.card {
  background: rgba(15, 23, 42, 0.96);
  border: 1px solid rgba(31, 41, 55, 0.95);
  border-radius: 0.9rem;
  padding: 1rem 1rem 0.9rem;
}

.card-header {
  display: flex;
  justify-content: space-between;
  align-items: baseline;
  margin-bottom: 0.7rem;
}

.card-header h2 {
  font-size: 1rem;
  font-weight: 600;
}

.card-header span {
  font-size: 0.75rem;
  opacity: 0.7;
}

.form-grid-2 {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 0.9rem;
  margin-bottom: 0.9rem;
}

@media (max-width: 720px) {
  .form-grid-2 {
    grid-template-columns: 1fr;
  }
}

.opt-tag {
  font-size: 0.72rem;
  opacity: 0.5;
  font-weight: 400;
}

.form-hint {
  font-size: 0.73rem;
  opacity: 0.65;
  line-height: 1.5;
}

.input,
.select,
.textarea {
  background: rgba(15, 23, 42, 0.9);
  color: #e5e7eb;
  border: 1px solid rgba(148, 163, 184, 0.7);
  border-radius: 0.55rem;
  padding: 0.45rem 0.6rem;
  font-size: 0.86rem;
  outline: none;
}

.input:focus,
.select:focus,
.textarea:focus {
  border-color: rgba(56, 189, 248, 0.9);
}

/* ===== Delivery Method Cards ===== */
.dmethod-card {
  display: block;
  cursor: pointer;
  padding: 0.85rem 1rem;
  background: rgba(2, 6, 23, 0.5);
  border: 1.5px solid rgba(148, 163, 184, 0.3);
  border-radius: 0.75rem;
  transition: all 0.18s;
  position: relative;
}

.dmethod-card input {
  position: absolute;
  opacity: 0;
  pointer-events: none;
}

.dmethod-card:hover {
  border-color: rgba(56, 189, 248, 0.5);
  background: rgba(56, 189, 248, 0.05);
}

.dmethod-card:has(input:checked) {
  border-color: #f59e0b;
  background: rgba(245, 158, 11, 0.08);
  box-shadow: 0 0 0 1px rgba(245, 158, 11, 0.4);
}

.dmethod-card.disabled {
  opacity: 0.4;
  cursor: not-allowed;
  pointer-events: none;
}

.dm-title {
  font-weight: 700;
  color: #e5e7eb;
  font-size: 0.92rem;
  margin-bottom: 0.25rem;
}

.dm-desc {
  color: #94a3b8;
  font-size: 0.76rem;
  line-height: 1.4;
}

/* ===== Grouped sub-sections ===== */
.subsection {
  border: 1px solid rgba(148, 163, 184, 0.16);
  border-radius: 0.7rem;
  background: rgba(2, 6, 23, 0.35);
  padding: 0.9rem 1rem 0.4rem;
  margin-bottom: 1rem;
}

.subsection-head {
  display: flex;
  align-items: center;
  gap: 0.45rem;
  font-size: 0.9rem;
  font-weight: 700;
  color: #cbd5e1;
  margin-bottom: 0.8rem;
  padding-bottom: 0.5rem;
  border-bottom: 1px solid rgba(148, 163, 184, 0.12);
}

.subsection-head .mbi {
  width: 1rem;
  height: 1rem;
  color: #7dd3fc;
}

.subsection .form-group:last-child {
  margin-bottom: 0.5rem;
}

/* ===== Variants / dims workflow ===== */
#variants-box.dims-active {
  display: flex;
  flex-direction: column;
}

#variants-box.dims-active .vb-dims-wrap {
  order: 1;
}

#variants-box.dims-active .vb-rows-wrap {
  order: 2;
}

.vb-rows-head {
  font-size: 0.8rem;
  font-weight: 700;
  color: #cbd5e1;
  margin: 0.2rem 0 0.5rem;
}

#variants-box.dims-active .vb-rows-head-generic {
  display: none;
}

#variants-box.dims-active .vb-rows-head-step3 {
  display: inline !important;
}

.dims-steps {
  list-style: none;
  padding: 0;
  margin: 0 0 0.6rem;
}

.dims-step {
  display: flex;
  gap: 0.45rem;
  align-items: flex-start;
  font-size: 0.78rem;
  color: #cbd5e1;
  margin-bottom: 0.5rem;
}

.dims-step .num {
  flex: none;
  width: 1.15rem;
  height: 1.15rem;
  border-radius: 999px;
  background: rgba(56, 189, 248, 0.2);
  border: 1px solid rgba(56, 189, 248, 0.5);
  color: #7dd3fc;
  font-size: 0.68rem;
  font-weight: 700;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-top: 0.05rem;
}

/* ===== Checkbox ===== */
.checkbox {
  display: flex;
  align-items: center;
  gap: 0.5rem;
  font-size: 0.85rem;
  cursor: pointer;
}

.checkbox input {
  width: 18px;
  height: 18px;
  cursor: pointer;
}

.textarea {
  min-height: 96px;
  width: 100%;
  resize: vertical;
  line-height: 1.5;
}

.price-row {
  display: grid;
  grid-template-columns: 1fr 1.4fr;
  gap: 0.6rem;
}

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

.form-footer {
  display: flex;
  gap: 0.5rem;
  flex-wrap: wrap;
  margin-top: 0.6rem;
  justify-content: flex-end;
}

.btn-primary {
  background: linear-gradient(135deg, #5b8bc4, #0ea5e9);
  color: #020617;
  border: none;
}

.btn-primary:disabled {
  opacity: 0.6;
  cursor: not-allowed;
}

.btn-secondary {
  background: transparent;
  color: #e5e7eb;
  border-color: rgba(148, 163, 184, 0.7);
}

.alert.ok {
  background: rgba(91, 139, 196, 0.15);
  border: 1px solid rgba(91, 139, 196, 0.5);
  color: #a9c8e5;
}

.tips-list {
  list-style: none;
  padding: 0;
  font-size: 0.8rem;
  line-height: 1.7;
}

.tips-list li::before {
  content: "✓ ";
  color: #8badd6;
}

.summary-box {
  margin-top: 1rem;
  background: #0b1228;
  border: 1px solid rgba(31, 41, 55, 0.9);
  border-radius: 0.55rem;
  padding: 0.6rem 0.8rem;
}

.summary-row {
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-size: 0.78rem;
  padding: 0.2rem 0;
}

.summary-row strong {
  color: #e5e7eb;
  max-width: 60%;
  text-align: right;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.upload-box {
  border: 2px dashed rgba(148, 163, 184, 0.4);
  border-radius: 0.85rem;
  padding: 1.5rem 1rem;
  background: rgba(15, 23, 42, 0.5);
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  position: relative;
}

.upload-box:hover {
  border-color: rgba(56, 189, 248, 0.6);
  background: rgba(56, 189, 248, 0.04);
}

.upload-box.dragover {
  border-color: #5b8bc4;
  background: rgba(91, 139, 196, 0.08);
  transform: scale(1.01);
}

.upload-box input[type=file] {
  display: none;
}

.upload-icon {
  font-size: 2rem;
  opacity: 0.5;
  margin-bottom: 0.4rem;
}

.upload-label {
  color: #e5e7eb;
  font-size: 0.9rem;
  font-weight: 600;
  margin-bottom: 0.2rem;
}

.upload-label .accent {
  color: #38bdf8;
  text-decoration: underline;
}

.upload-note {
  font-size: 0.72rem;
  opacity: 0.6;
}

.preview {
  margin-top: 0.9rem;
  border-radius: 0.65rem;
  overflow: hidden;
  border: 1px solid rgba(31, 41, 55, 0.9);
  position: relative;
  display: none;
}

.preview.show {
  display: block;
}

.preview img {
  width: 100%;
  display: block;
  max-height: 280px;
  object-fit: cover;
}

.preview-remove {
  position: absolute;
  top: 0.4rem;
  right: 0.4rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: 1px solid rgba(255, 255, 255, 0.2);
  border-radius: 999px;
  width: 28px;
  height: 28px;
  cursor: pointer;
  font-family: inherit;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 1rem;
}

.preview-remove:hover {
  background: rgba(239, 68, 68, 0.85);
}

.preview-grid {
  margin-top: 0.9rem;
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(90px, 1fr));
  gap: 0.5rem;
}

.pg-item {
  position: relative;
  border-radius: 0.55rem;
  overflow: hidden;
  border: 1px solid rgba(31, 41, 55, 0.9);
  aspect-ratio: 1;
  background: #131c33;
}

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

.pg-cover-badge {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  background: rgba(56, 189, 248, 0.85);
  color: #020617;
  font-size: 0.62rem;
  font-weight: 800;
  text-align: center;
  padding: 0.1rem;
}

.pg-remove {
  position: absolute;
  top: 0.25rem;
  right: 0.25rem;
  background: rgba(0, 0, 0, 0.7);
  color: #fff;
  border: none;
  border-radius: 999px;
  width: 22px;
  height: 22px;
  cursor: pointer;
  font-size: 0.8rem;
  display: flex;
  align-items: center;
  justify-content: center;
}

.pg-remove:hover {
  background: rgba(239, 68, 68, 0.9);
}
