/* 商品主图上传 + 富文本编辑器 */

.admin-version {
  display: inline-flex;
  align-items: center;
  height: 22px;
  padding: 0 8px;
  border: 1px solid var(--line);
  border-radius: 999px;
  background: var(--surface);
  color: var(--muted);
  font-family: "SFMono-Regular", Consolas, monospace;
  font-size: 8.5px;
  letter-spacing: 0.04em;
}

.cover-editor {
  display: grid;
  grid-template-columns: 132px minmax(0, 1fr);
  gap: 16px;
  align-items: start;
}

.cover-preview {
  position: relative;
  width: 132px;
  height: 132px;
  border: 1px solid var(--line);
  border-radius: 14px;
  background: var(--surface-2);
  overflow: hidden;
}

.cover-preview img {
  width: 100%;
  height: 100%;
  object-fit: cover;
}

.cover-preview .cover-empty {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 100%;
  height: 100%;
  color: var(--muted-2);
  font-size: 10px;
}

.cover-side {
  display: flex;
  flex-direction: column;
  gap: 10px;
}

.cover-actions {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 8px;
}

.cover-actions .btn {
  height: 36px;
  padding: 0 14px;
  font-size: 11px;
}

.cover-hint {
  color: var(--muted-2);
  font-size: 8.5px;
  line-height: 1.6;
}

.cover-presets {
  display: flex;
  flex-wrap: wrap;
  gap: 6px;
}

.cover-preset {
  width: 42px;
  height: 42px;
  padding: 2px;
  border: 1px solid var(--line);
  border-radius: 8px;
  background: var(--surface-2);
  cursor: pointer;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.cover-preset img {
  width: 100%;
  height: 100%;
  border-radius: 5px;
  object-fit: cover;
}

.cover-preset.active {
  border-color: var(--brand);
  box-shadow: 0 0 0 2px var(--brand-soft);
}

.rich-editor {
  border: 1px solid var(--line);
  border-radius: 12px;
  background: var(--surface-2);
  overflow: hidden;
  transition: border-color 0.2s, box-shadow 0.2s;
}

.rich-editor.is-focused {
  border-color: var(--brand);
  box-shadow: 0 0 0 3px rgba(29, 77, 58, 0.08);
}

.rich-toolbar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 3px;
  padding: 7px 8px;
  border-bottom: 1px solid var(--line);
  background: var(--surface);
}

.rich-toolbar button,
.rich-toolbar select {
  height: 30px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: var(--ink-soft);
  font-size: 10px;
  line-height: 1;
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s;
}

.rich-toolbar button {
  display: inline-flex;
  align-items: center;
  gap: 3px;
  padding: 0 8px;
}

.rich-toolbar button:hover,
.rich-toolbar select:hover {
  background: var(--brand-soft);
  color: var(--brand);
}

.rich-toolbar select {
  width: auto;
  padding: 0 22px 0 8px;
  border-color: var(--line);
  background: var(--surface-2);
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='10' viewBox='0 0 24 24' fill='none' stroke='%237c857c' stroke-width='2'%3E%3Cpath d='m6 9 6 6 6-6'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 7px center;
}

.rich-toolbar button .icon {
  width: 14px;
  height: 14px;
}

.rich-toolbar button strong,
.rich-toolbar button em,
.rich-toolbar button u,
.rich-toolbar button s {
  font-size: 11px;
}

.rich-sep {
  width: 1px;
  height: 18px;
  margin: 0 3px;
  background: var(--line);
}

.rich-content {
  min-height: 190px;
  max-height: 420px;
  padding: 14px 16px;
  overflow-y: auto;
  outline: 0;
  background: var(--surface-2);
  color: var(--ink-soft);
  font-size: 12px;
  line-height: 1.85;
}

.rich-content:empty::before {
  content: attr(data-placeholder);
  color: var(--muted-2);
  pointer-events: none;
}

.rich-content p {
  margin: 0 0 10px;
}

.rich-content h2 {
  margin: 16px 0 8px;
  font-family: var(--font-serif);
  font-size: 20px;
  font-weight: 600;
  line-height: 1.4;
}

.rich-content h3 {
  margin: 14px 0 6px;
  font-size: 15px;
  font-weight: 600;
}

.rich-content blockquote {
  margin: 10px 0;
  padding: 8px 12px;
  border-left: 2px solid var(--brand-3);
  background: var(--brand-mist);
  color: var(--muted);
}

.rich-content ul,
.rich-content ol {
  margin: 8px 0;
  padding-left: 22px;
  list-style: disc;
}

.rich-content ol {
  list-style: decimal;
}

.rich-content img {
  max-width: 100%;
  height: auto;
  margin: 10px 0;
  border-radius: 10px;
  display: block;
}

.rich-content a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

.rich-hint {
  padding: 6px 12px;
  border-top: 1px solid var(--line);
  color: var(--muted-2);
  font-size: 8px;
  background: var(--surface);
}

.rich-hint.uploading {
  color: var(--brand);
}

.product-description {
  color: var(--muted);
  font-size: 12.5px;
  line-height: 1.95;
}

.product-description h2,
.product-description h3 {
  margin: 18px 0 8px;
  color: var(--ink);
  font-family: var(--font-serif);
  font-weight: 600;
}

.product-description h2 {
  font-size: 22px;
}

.product-description h3 {
  font-size: 16px;
}

.product-description p {
  margin: 0 0 10px;
}

.product-description ul,
.product-description ol {
  margin: 8px 0 12px;
  padding-left: 22px;
  list-style: disc;
}

.product-description ol {
  list-style: decimal;
}

.product-description blockquote {
  margin: 12px 0;
  padding: 10px 14px;
  border-left: 2px solid var(--brand-3);
  background: var(--brand-mist);
}

.product-description img {
  max-width: 100%;
  height: auto;
  margin: 12px 0;
  border-radius: 12px;
}

.product-description a {
  color: var(--brand);
  text-decoration: underline;
  text-underline-offset: 3px;
}

@media (max-width: 600px) {
  .cover-editor {
    grid-template-columns: 100px minmax(0, 1fr);
    gap: 12px;
  }

  .cover-preview {
    width: 100px;
    height: 100px;
  }

  .rich-content {
    min-height: 160px;
    max-height: 320px;
  }

  .rich-toolbar button {
    padding: 0 6px;
  }
}
