/* Custom Product Modal Styles */
.custom-modal-overlay {
  position: fixed !important;
  top: 0 !important;
  left: 0 !important;
  right: 0 !important;
  bottom: 0 !important;
  width: 100% !important;
  height: 100% !important;
  background: rgba(0, 0, 0, 0.5) !important;
  z-index: 1050 !important;
  display: none !important;
  align-items: center !important;
  justify-content: center !important;
  padding: 20px;
}
.custom-modal-overlay.is-open {
  display: flex !important;
  visibility: visible !important;
  opacity: 1 !important;
}
.custom-modal-container {
  background: #fff;
  width: 100%;
  max-width: 1000px;
  border: 1px solid #dee2e6;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
  position: relative;
  z-index: 1051;
}
.custom-modal-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  border-bottom: 1px solid #dee2e6;
  background: #f8f9fa;
}
.modal-title { margin: 0; font-size: 16px; font-weight: 600; color: #212529; }
.btn-close-modal {
  background: none;
  border: none;
  font-size: 20px;
  cursor: pointer;
  padding: 4px;
  line-height: 1;
  color: #6c757d;
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}
.btn-close-modal:hover { color: #212529; }
.custom-modal-body {
  display: flex;
  flex-direction: column;
  padding: 20px;
  max-height: 70vh;
  overflow-y: auto;
}

/* 价格区域 */
.custom-price-section {
  display: flex;
  gap: 20px;
  margin-bottom: 16px;
}
.custom-price-left {
  flex: 1;
}
.custom-price-info {
  margin-bottom: 12px;
}
.custom-price-label {
  font-size: 12px;
  color: #6c757d;
  display: block;
  margin-bottom: 4px;
}
.custom-price-value {
  display: flex;
  align-items: baseline;
  gap: 8px;
}
.custom-price-amount {
  font-size: 24px;
  font-weight: 700;
  color: #212529;
}
.custom-price-diff {
  font-size: 14px;
  color: #28a745;
}
.custom-quantity-section {
  display: flex;
  align-items: center;
  gap: 12px;
}
.custom-quantity-label {
  font-size: 12px;
  color: #6c757d;
}
.custom-quantity-control {
  display: flex;
  align-items: center;
  border: 1px solid #dee2e6;
}
.qty-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: #f8f9fa;
  cursor: pointer;
  font-size: 16px;
  color: #6c757d;
  transition: all 0.2s;
}
.qty-btn:hover { background: #e9ecef; color: #212529; }
.qty-input {
  width: 50px;
  height: 32px;
  border: none;
  border-left: 1px solid #dee2e6;
  border-right: 1px solid #dee2e6;
  text-align: center;
  font-size: 14px;
}
.qty-input:focus { outline: none; }
.custom-price-right {
  width: 180px;
}
.custom-price-right .btn {
  padding: 10px 16px;
  font-weight: 600;
}
.custom-price-original {
  font-size: 14px;
  color: #6c757d;
  text-decoration: line-through;
  margin-left: 8px;
}
#custom-price-display {
  font-size: 1.75rem;
  font-weight: 700;
  line-height: 1;
}

/* 定制区域 */
.custom-content-section {
  display: flex;
  gap: 16px;
}
.custom-preview-area {
  width: 600px;
  flex-shrink: 0;
}
.custom-preview-title {
  display: none;
  font-size: 12px;
  color: #6c757d;
  margin-bottom: 8px;
}
.custom-preview-image {
  width: 600px;
  aspect-ratio: 1;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  display: flex;
  align-items: center;
  justify-content: center;
  position: relative;
  overflow: hidden;
}
.custom-preview-base-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.custom-preview-overlay {
  position: absolute;
  inset: 0;
  pointer-events: none;
  z-index: 2;
}
.custom-preview-item {
  position: absolute;
  z-index: 2;
}
/* 可选：预览元素选中时的边框 */
.custom-preview-item.selected {
  outline: 2px dashed #0d6efd;
  outline-offset: 2px;
}
/* 旋转手柄 - 显示在元素顶部中央 */
.custom-preview-item .rotate-handle {
  position: absolute;
  top: -28px;
  left: 50%;
  margin-left: -10px;
  width: 20px;
  height: 20px;
  background: #fff;
  border: 2px solid #e6a23c;
  border-radius: 50%;
  cursor: grab;
  z-index: 10;
  display: flex;
  align-items: center;
  justify-content: center;
  opacity: 0;
  transition: opacity 0.2s;
  pointer-events: none;
}
.custom-preview-item:hover .rotate-handle,
.custom-preview-item.selected .rotate-handle {
  opacity: 1;
  pointer-events: auto;
}
.custom-preview-item .rotate-handle::before {
  content: '';
  position: absolute;
  bottom: -10px;
  left: 50%;
  width: 2px;
  height: 10px;
  background: #e6a23c;
  transform: translateX(-50%);
}
.custom-preview-item .rotate-handle:active {
  cursor: grabbing;
}
.custom-preview-item .rotate-handle svg {
  width: 12px;
  height: 12px;
  color: #e6a23c;
}
.custom-preview-shape-mask {
  /* 占位：形状蒙版通过 #custom-preview-image 上的 clip-path 实现 */
  display: none;
}
.custom-preview-mask-image {
  position: absolute;
  inset: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
  pointer-events: none;
  z-index: 3;
}
.custom-preview-item-text {
  font-size: 16px;
  font-weight: 600;
  line-height: 1.2;
  text-align: center;
  word-break: break-word;
}
.custom-preview-text-content,
.custom-preview-option-text {
  display: block;
}
.custom-preview-option-image,
.custom-preview-upload-image {
  width: 100%;
  height: 100%;
  object-fit: contain;
  display: block;
}
.custom-preview-placeholder {
  font-size: 12px;
  color: #adb5bd;
}
.custom-form-area {
  width: 40%;
  overflow-y: auto;
}

/* 表单样式 */
.form-section { flex: 1; overflow-y: auto; }
.surface-description {
  padding: 10px 12px;
  background: #e9ecef;
  margin-bottom: 16px;
  display: none;
  font-size: 14px;
  color: #495057;
}
.surface-description .surface-title {
  font-size: 15px;
  font-weight: 600;
  color: #212529;
  margin-bottom: 4px;
}
.surface-description .surface-desc-text {
  color: #6c757d;
  line-height: 1.5;
}
.custom-surface-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding: 0 0 12px 0;
  margin-bottom: 12px;
  border-bottom: 1px solid #dee2e6;
}
.custom-surface-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 72px;
  max-width: 110px;
}
.custom-surface-tab:hover {
  border-color: #0d6efd;
  background: #f8f9fa;
}
.custom-surface-tab.active {
  border-color: #0d6efd;
  background: #e7f1ff;
  color: #0d6efd;
}
.custom-surface-tab-thumb {
  width: 56px;
  height: 56px;
  max-width: 56px;
  max-height: 56px;
  min-width: 0;
  flex: 0 0 56px;
  object-fit: cover;
  border-radius: 4px;
  background: #f8f9fa;
  display: block;
}
.custom-surface-tab-fallback {
  width: 56px;
  height: 56px;
  flex: 0 0 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 4px;
  font-size: 20px;
  font-weight: 600;
  color: #6c757d;
}
.custom-surface-tab-label {
  font-size: 12px;
  line-height: 1.3;
  max-width: 80px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.elements-form { display: flex; flex-direction: column; gap: 16px; }
.form-element { padding: 16px; background: #fff; border: 1px solid #dee2e6; transition: all 0.2s; }
.badge-optional {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 400;
  color: #6c757d;
  background: #e9ecef;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}
.badge-filled {
  display: inline-block;
  padding: 2px 8px;
  font-size: 11px;
  font-weight: 400;
  color: #fff;
  background: #198754;
  border-radius: 10px;
  margin-left: 6px;
  vertical-align: middle;
}
.btn-clear-element {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #dc3545;
  font-size: 16px;
  margin-left: 8px;
  vertical-align: middle;
  transition: all 0.2s;
}
.btn-clear-element:hover {
  color: #bb2d3b;
  transform: scale(1.1);
}
.form-label { font-weight: 600; font-size: 14px; color: #212529; margin-bottom: 10px; display: block; }
.sub-label { font-size: 12px; color: #6c757d; margin-bottom: 6px; display: block; }
.font-selector { margin-bottom: 10px; }
.font-selector .sub-label { font-weight: 500; }
.font-selector .form-select { width: auto; min-width: 150px; }
.color-selector { margin-bottom: 10px; }
.color-options { display: flex; flex-wrap: wrap; gap: 8px; }
.color-option {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  cursor: pointer;
  border: 2px solid transparent;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #fff;
  font-size: 14px;
  transition: all 0.2s;
}
.color-option:hover { opacity: 0.8; }
.color-option.selected { border-color: #212529; }
.text-input-wrapper { position: relative; }
.text-input-wrapper .form-control { padding-right: 60px; }
.char-count { position: absolute; right: 10px; top: 50%; transform: translateY(-50%); font-size: 11px; color: #6c757d; }
.image-upload-area {
  border: 2px dashed #ced4da;
  padding: 24px;
  text-align: center;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}
.image-upload-area:hover { border-color: #0d6efd; }
.image-upload-area.has-images { padding: 12px; }
.upload-placeholder { display: flex; flex-direction: column; align-items: center; gap: 8px; }
.upload-placeholder .bi { color: #6c757d; }
.upload-text { font-weight: 500; color: #495057; }
.uploaded-images-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(80px, 1fr)); gap: 8px; }
.uploaded-image-item { position: relative; aspect-ratio: 1; overflow: hidden; border: 1px solid #dee2e6; }
.uploaded-image-item img { width: 100%; height: 100%; object-fit: cover; }
.btn-remove-image {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.btn-remove-image:hover { background: #dc3545; }
.add-more-images {
  aspect-ratio: 1;
  border: 2px dashed #ced4da;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6c757d;
}
.image-list-area { margin-top: 8px; }
.image-list-grid { display: grid; grid-template-columns: repeat(4, 1fr); gap: 8px; }
.image-list-item {
  position: relative;
  aspect-ratio: 1;
  overflow: hidden;
  border: 1px solid #dee2e6;
  background: #f8f9fa;
}
.image-list-item img { width: 100%; height: 100%; object-fit: cover; }
.image-list-item .btn-remove-image {
  position: absolute;
  top: 4px;
  right: 4px;
  width: 24px;
  height: 24px;
  border: none;
  background: rgba(0,0,0,0.6);
  color: #fff;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 12px;
}
.image-list-item .btn-remove-image:hover { background: #dc3545; }
.image-upload-btn {
  border: 2px dashed #ced4da;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #6c757d;
  font-size: 24px;
  transition: all 0.2s;
}
.image-upload-btn:hover { border-color: #0d6efd; color: #0d6efd; }
.add-more-images:hover { border-color: #0d6efd; color: #0d6efd; }
.option-list { display: flex; flex-direction: column; gap: 6px; }
.option-list-item {
  display: flex;
  align-items: center;
  padding: 10px 14px;
  border: 1px solid #dee2e6;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}
.option-list-item:hover:not(.disabled) { border-color: #0d6efd; background: #f8f9fa; }
.option-list-item.selected { border-color: #0d6efd; background: #e7f1ff; color: #0d6efd; }
.option-list-item.disabled { opacity: 0.5; cursor: not-allowed; }
.option-list-item .option-name { flex: 1; font-weight: 500; }
.option-list-item .option-check { color: #0d6efd; }
.option-list-item .option-thumb {
  width: 32px;
  height: 32px;
  border-radius: 4px;
  overflow: hidden;
  margin-right: 10px;
  flex-shrink: 0;
  background: #f1f3f5;
}
.option-list-item .option-thumb img { width: 100%; height: 100%; object-fit: cover; }
.option-grid { display: grid; grid-template-columns: repeat(auto-fill, minmax(90px, 1fr)); gap: 10px; }
.option-grid-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  padding: 12px 8px;
  border: 1px solid #dee2e6;
  cursor: pointer;
  transition: all 0.2s;
  background: #fff;
}
.option-grid-item:hover:not(.disabled) { border-color: #0d6efd; }
.option-grid-item.selected { border-color: #0d6efd; background: #e7f1ff; }
.option-grid-item.disabled { opacity: 0.5; cursor: not-allowed; }
.option-grid-item .option-image { width: 50px; height: 50px; overflow: hidden; margin-bottom: 6px; }
.option-grid-item .option-image img { width: 100%; height: 100%; object-fit: cover; }
.option-grid-item .option-icon {
  width: 50px;
  height: 50px;
  background: #e9ecef;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 6px;
  font-size: 24px;
  color: #6c757d;
}
.option-grid-item .option-name { font-size: 12px; font-weight: 500; text-align: center; color: #212529; }
.option-grid-item .option-price { font-size: 11px; color: #28a745; display: block; margin-top: 4px; }
.element-price-diff { font-size: 12px; color: #28a745; margin-top: 8px; }

/* Footer */
.custom-modal-footer {
  display: flex;
  justify-content: flex-end;
  gap: 12px;
  padding: 16px 20px;
  border-top: 1px solid #dee2e6;
  background: #fff;
}

/* Responsive — H5 / 移动端适配 */
@media (max-width: 768px) {
  /* 弹窗占满整屏，去掉居中圆角 */
  .custom-modal-overlay {
    padding: 0 !important;
    align-items: stretch !important;
    justify-content: flex-start !important;
  }
  .custom-modal-container {
    max-height: 100% !important;
    height: 100% !important;
    max-width: 100% !important;
    width: 100% !important;
    border-radius: 0 !important;
    box-shadow: none !important;
  }

  /* 头部紧凑 */
  .custom-modal-header {
    padding: 12px 14px !important;
    flex-shrink: 0;
  }
  .modal-title { font-size: 15px !important; }

  /* body 用 flex 1 吃掉高度，作为 H5 下唯一滚动容器 */
  .custom-modal-body {
    max-height: none !important;
    height: auto !important;
    flex: 1;
    min-height: 0;
    overflow-y: auto !important;
    -webkit-overflow-scrolling: touch;
  }

  /* 价格区上下结构、按钮并排 */
  .custom-price-section {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 10px 14px !important;
    margin-bottom: 8px !important;
    flex-shrink: 0;
  }
  .custom-price-left {
    display: flex !important;
    align-items: center !important;
    justify-content: space-between !important;
    gap: 12px;
    width: 100%;
  }
  .custom-price-info { margin-bottom: 0 !important; flex: 1; }
  .custom-price-amount { font-size: 20px !important; }
  #custom-price-display { font-size: 1.25rem !important; }
  .custom-quantity-section { margin: 0 !important; flex-shrink: 0; }
  .custom-quantity-label { display: none; }
  .custom-price-right {
    width: 100% !important;
    display: flex !important;
    gap: 8px !important;
  }
  .custom-price-right .btn { flex: 1; padding: 10px 12px !important; }

  /* 定制区域上下堆叠 */
  .custom-content-section {
    flex-direction: column !important;
    gap: 10px !important;
    padding: 0 14px 12px !important;
    flex: 1;
    min-height: 0;
  }

  /* 预览图固定高度，避免 aspect-ratio 在窄屏占满屏高 */
  .custom-preview-area {
    width: 100% !important;
    flex: 0 0 auto;
  }
  .custom-preview-title {
    font-size: 12px !important;
    margin-bottom: 4px !important;
  }

  /* tab 容器横滑，避免缩略图被挤压 */
  .custom-surface-tabs {
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch;
    padding: 0 0 8px 0 !important;
    margin-bottom: 8px !important;
    gap: 6px !important;
  }
  .custom-surface-tab {
    flex: 0 0 auto !important;
    min-width: 60px !important;
    max-width: 88px !important;
    padding: 4px 8px !important;
  }
  .custom-surface-tab-thumb,
  .custom-surface-tab-fallback {
    width: 44px !important;
    height: 44px !important;
    flex: 0 0 44px !important;
    max-width: 44px !important;
    max-height: 44px !important;
  }
  .custom-surface-tab-label {
    font-size: 11px !important;
    max-width: 72px !important;
  }

  /* 表单区：H5 下改为普通块，整体由 custom-modal-body 滚动 */
  .custom-form-area {
    width: 100% !important;
    overflow: visible !important;
    flex: 0 0 auto;
  }
  .form-section { padding: 8px 0 !important; overflow: visible !important; }
  .surface-description {
    padding: 8px 10px !important;
    margin-bottom: 10px !important;
    font-size: 13px !important;
  }
  .form-element { padding: 12px !important; }
  .form-label { font-size: 13px !important; margin-bottom: 8px !important; }
  .sub-label { font-size: 11px !important; }

  /* 字体/颜色/选项控件 */
  .font-selector { flex-wrap: wrap; }
  .font-selector .form-select { width: 100% !important; min-width: 0 !important; }
  .color-options { gap: 6px !important; }
  .color-option { width: 28px !important; height: 28px !important; font-size: 13px !important; }

  /* 输入框字号 >=16 避免 iOS 自动放大 */
  .text-input-wrapper .form-control,
  .form-control,
  .qty-input {
    font-size: 16px !important;
  }

  /* 选项栅格在窄屏 2 列 */
  .option-grid { grid-template-columns: repeat(2, 1fr) !important; gap: 8px !important; }
  .option-grid-item { padding: 10px 6px !important; }
  .option-grid-item .option-image,
  .option-grid-item .option-icon { width: 40px !important; height: 40px !important; }
  .option-grid-item .option-name { font-size: 11px !important; }

  /* 图片上传 */
  .image-upload-area { padding: 16px !important; }
  .uploaded-images-grid { grid-template-columns: repeat(auto-fill, minmax(64px, 1fr)) !important; }
  .image-list-grid { grid-template-columns: repeat(3, 1fr) !important; }
}

/* 极窄屏（<=360px）再做一次精修 */
@media (max-width: 360px) {
  .custom-price-amount { font-size: 18px !important; }
  .custom-surface-tab { min-width: 54px !important; }
  .custom-surface-tab-thumb,
  .custom-surface-tab-fallback { width: 40px !important; height: 40px !important; flex-basis: 40px !important; }
  .custom-preview-image { height: 180px !important; }
}

/* Validation */
.is-invalid { border-color: #dc3545 !important; }
.invalid-feedback { display: block; color: #dc3545; font-size: 12px; margin-top: 4px; }

/* =========================================
 * 购物车 / 结算页 / Mini 购物车定制详情块
 * 通过 .cart-custom-details 通用样式渲染
 * ========================================= */
.cart-custom-details-wrapper {
  margin-top: 6px;
}

.cart-custom-details {
  background: #f8f9fa;
  border: 1px solid #e9ecef;
  border-radius: 6px;
  font-size: 13px;
  overflow: hidden;
  margin-top: 6px;
}

.cart-custom-details__header {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 6px 10px;
  background: linear-gradient(135deg, #eef2ff 0%, #f3e8ff 100%);
  color: #5b21b6;
  font-weight: 600;
  font-size: 12px;
}

.cart-custom-details__header .bi-palette {
  color: #667eea;
}

.cart-custom-details__diff {
  margin-left: auto;
  background: #fff;
  border: 1px solid #c7d2fe;
  color: #4338ca;
  padding: 1px 8px;
  border-radius: 10px;
  font-size: 11px;
  font-weight: 600;
}

.cart-custom-details__body {
  padding: 8px 10px;
}

.cart-custom-field {
  display: flex;
  align-items: flex-start;
  gap: 8px;
  padding: 4px 0;
  border-bottom: 1px dashed #f1f3f5;
}

.cart-custom-field:last-child {
  border-bottom: none;
}

.cart-custom-field__label {
  flex: 0 0 90px;
  color: #6c757d;
  font-size: 12px;
  padding-top: 1px;
}

.cart-custom-field__value {
  flex: 1;
  color: #212529;
  word-break: break-word;
}

.cart-custom-images {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
  flex: 1;
}

.cart-custom-image-item img {
  width: 48px;
  height: 48px;
  object-fit: cover;
  border-radius: 4px;
  border: 1px solid #dee2e6;
  background: #fff;
}

.cart-custom-image-item:hover img {
  transform: scale(1.05);
  transition: transform 0.15s ease;
}

.cart-custom-pricing {
  background: #fff;
  border: 1px solid #e5e7eb;
  border-radius: 4px;
  padding: 6px 10px;
  margin-bottom: 8px;
}

.cart-custom-pricing__row {
  display: flex;
  justify-content: space-between;
  gap: 12px;
  font-size: 12px;
  padding: 2px 0;
}

.cart-custom-pricing__row--total {
  padding-top: 4px;
  margin-top: 4px;
  border-top: 1px dashed #e5e7eb;
  font-weight: 600;
}

/* Mini 购物车尺寸微调 */
.cart-custom-details--mini {
  font-size: 12px;
  margin-top: 4px;
}

.cart-custom-details--mini .cart-custom-field__label {
  flex: 0 0 70px;
  font-size: 11px;
}

.cart-custom-details--mini .cart-custom-image-item img {
  width: 36px;
  height: 36px;
}

/* 结算页右侧栏尺寸微调 */
.cart-custom-details--checkout {
  margin-top: 6px;
}

.cart-custom-details--checkout .cart-custom-field__label {
  flex: 0 0 80px;
}

/* ========================
   后台订单详情：定制预览区域
   ======================== */
.admin-custom-preview {
  display: flex;
  flex-direction: row;
  flex: 1;
  overflow: hidden;
  gap: 20px;
  min-height: 400px;
}

.admin-preview-left {
  width: 600px;
  flex: 0 0 600px;
  display: flex;
  flex-direction: column;
  gap: 12px;
  overflow: hidden;
}

.admin-surface-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  padding-bottom: 12px;
  border-bottom: 1px solid #dee2e6;
}

.admin-surface-tab {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 6px 10px;
  background: #fff;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  cursor: pointer;
  transition: all 0.2s;
  min-width: 72px;
  max-width: 110px;
}

.admin-surface-tab:hover {
  border-color: #0d6efd;
  background: #f8f9fa;
}

.admin-surface-tab.active {
  border-color: #0d6efd;
  background: #e7f1ff;
  color: #0d6efd;
}

.admin-surface-tab-thumb {
  width: 56px;
  height: 56px;
  object-fit: cover;
  border-radius: 4px;
  background: #f8f9fa;
}

.admin-surface-tab-fallback {
  width: 56px;
  height: 56px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: #f8f9fa;
  border-radius: 4px;
  font-size: 20px;
  font-weight: 600;
  color: #6c757d;
}

.admin-surface-tab-label {
  font-size: 12px;
  line-height: 1.3;
  max-width: 80px;
  text-align: center;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

.admin-preview-image {
  position: relative;
  width: 100%;
  aspect-ratio: 1;
  background: #f8f9fa;
  border: 1px solid #dee2e6;
  border-radius: 6px;
  overflow: hidden;
  display: flex;
  align-items: center;
  justify-content: center;
}

.admin-preview-image img.admin-preview-base-image {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  object-fit: contain;
}

/* 订单详情 / 订单列表 modal：限定预览图宽度到 300px，
   避免在宽 card / modal 中横撑满。窄屏时 max-width:100% 自动收缩不溢出。*/
.admin-custom-preview-wrapper .custom-preview-image {
  width: 300px;
  max-width: 100%;
  margin-left: auto;
  margin-right: auto;
}

.admin-preview-overlay {
  position: absolute;
  top: 0;
  left: 0;
  width: 100%;
  height: 100%;
  pointer-events: none;
}

.admin-preview-placeholder {
  color: #adb5bd;
  font-size: 14px;
}

.admin-preview-actions {
  display: flex;
  justify-content: flex-start;
}

.admin-preview-right {
  flex: 1;
  overflow-y: auto;
  min-width: 0;
  padding-right: 8px;
}

/* 响应式：小屏幕时堆叠布局 */
@media (max-width: 768px) {
  .admin-custom-preview {
    flex-direction: column;
  }

  .admin-preview-left {
    width: 100%;
    flex: 0 0 auto;
  }

  .admin-preview-image {
    max-height: 400px;
  }
}
