/* ========== 大陶匠 - 发布组件样式（分组卡片式） ========== */

/* 弹窗遮罩 */
.pub-overlay {
  position: fixed;
  top: 0; left: 0; right: 0; bottom: 0;
  background: rgba(0,0,0,0.5);
  z-index: 9999;
  display: none;
  align-items: flex-end;
  justify-content: center;
}
.pub-overlay.show { display: flex; animation: pubFadeIn 0.2s ease; }
@keyframes pubFadeIn { from { opacity: 0; } to { opacity: 1; } }

/* 弹窗容器 */
.pub-modal {
  width: 100%;
  max-width: 480px;
  max-height: 92vh;
  background: #faf6f0;
  border-radius: 16px 16px 0 0;
  display: flex;
  flex-direction: column;
  animation: pubSlideUp 0.3s ease;
  overflow: hidden;
}
@keyframes pubSlideUp { from { transform: translateY(100%); } to { transform: translateY(0); } }

/* 标题栏 */
.pub-modal-title {
  height: 52px;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 0 16px;
  background: #fff;
  border-bottom: 1px solid #f0ebe3;
  font-size: 17px;
  font-weight: 600;
  color: #333;
  position: relative;
  flex-shrink: 0;
}
.pub-modal-close {
  position: absolute;
  left: 16px;
  top: 50%;
  transform: translateY(-50%);
  width: 32px;
  height: 32px;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  color: #333;
  font-size: 18px;
}

/* 内容区 */
.pub-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px;
  -webkit-overflow-scrolling: touch;
}

/* 卡片 */
.pub-card {
  background: #fff;
  border-radius: 12px;
  margin-bottom: 14px;
  overflow: hidden;
  box-shadow: 0 1px 4px rgba(139,69,19,0.06);
}
.pub-card:last-child { margin-bottom: 0; }

.pub-card-header {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 14px 16px 10px;
}
.pub-card-icon { flex-shrink: 0; display: flex; }
.pub-card-title {
  font-size: 15px;
  font-weight: 600;
  color: #333;
}
.pub-card-subtitle {
  font-size: 12px;
  color: #999;
  margin-left: auto;
  font-weight: normal;
}
.pub-card-body { padding: 0 16px 16px; }

/* 表单字段 */
.pub-field { margin-bottom: 14px; }
.pub-field:last-child { margin-bottom: 0; }
.pub-field label {
  display: block;
  font-size: 13px;
  color: #666;
  margin-bottom: 6px;
  font-weight: 500;
}
.pub-field-hint {
  font-size: 11px;
  color: #b8a898;
  font-weight: normal;
}

.pub-field input,
.pub-field select,
.pub-field textarea {
  width: 100%;
  height: 38px;
  padding: 0 12px;
  border: 1px solid #e8ddd0;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
  background: #faf8f5;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  box-sizing: border-box;
}
.pub-field input:focus,
.pub-field select:focus,
.pub-field textarea:focus {
  border-color: #8B4513;
  background: #fff;
  box-shadow: 0 0 0 3px rgba(139,69,19,0.08);
}
.pub-field input::placeholder,
.pub-field textarea::placeholder { color: #b8a898; }
.pub-field textarea {
  height: auto;
  min-height: 72px;
  padding: 10px 12px;
  resize: none;
  line-height: 1.5;
}
.pub-field select {
  appearance: none;
  -webkit-appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 24 24' fill='none' stroke='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
  padding-right: 32px;
  cursor: pointer;
}
.pub-field input[type="file"] {
  height: 38px;
  line-height: 38px;
  padding: 0 12px;
  font-size: 13px;
  color: #333;
  cursor: pointer;
}
.pub-field input[type="file"]::file-selector-button {
  height: 28px;
  padding: 0 14px;
  margin-right: 10px;
  background: linear-gradient(135deg, #8B4513, #A0522D);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}
.pub-field input[type="file"]::-webkit-file-upload-button {
  height: 28px;
  padding: 0 14px;
  margin-right: 10px;
  background: linear-gradient(135deg, #8B4513, #A0522D);
  color: #fff;
  border: none;
  border-radius: 6px;
  font-size: 12px;
  font-family: inherit;
  cursor: pointer;
}

/* 双列网格 */
.pub-grid {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.pub-grid .pub-field { margin-bottom: 0; }

/* 图片预览 */
.pub-preview { margin-top: 8px; }
.pub-preview img {
  max-width: 100%;
  max-height: 160px;
  border-radius: 8px;
  display: block;
}

/* 多图上传网格 */
.pub-image-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 8px;
}
.pub-image-thumb {
  position: relative;
  width: 100%;
  padding-top: 100%;
  border-radius: 8px;
  overflow: hidden;
  background: #faf8f5;
}
.pub-image-thumb img {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  object-fit: cover;
  display: block;
}
.pub-image-remove {
  position: absolute;
  top: 4px; right: 4px;
  width: 22px; height: 22px;
  background: rgba(0,0,0,0.5);
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  padding: 0;
  z-index: 1;
  color: #fff;
  font-size: 12px;
  font-weight: bold;
}
.pub-image-add {
  width: 100%;
  padding-top: 100%;
  position: relative;
  border: 1.5px dashed #e0d5c5;
  border-radius: 8px;
  background: #faf8f5;
  cursor: pointer;
  transition: all 0.2s;
}
.pub-image-add:active {
  border-color: #8B4513;
  background: #fff;
}
.pub-image-add-inner {
  position: absolute;
  top: 0; left: 0;
  width: 100%; height: 100%;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
}
.pub-image-add-inner span {
  font-size: 11px;
  color: #999;
}
.pub-image-count {
  position: absolute;
  bottom: 4px; right: 6px;
  font-size: 10px;
  color: #b8a898;
}

/* 原料配比列表 */
.pub-ing-list { margin-bottom: 10px; }
.pub-ing-row {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-bottom: 8px;
}
.pub-ing-row:last-child { margin-bottom: 0; }

.pub-ing-material {
  flex: 1;
  min-width: 0;
  height: 36px;
  padding: 0 28px 0 10px;
  border: 1px solid #e8ddd0;
  border-radius: 8px;
  font-size: 13px;
  color: #333;
  background: #faf8f5;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  appearance: none;
  -webkit-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='%23999' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 10px center;
  cursor: pointer;
  box-sizing: border-box;
}
.pub-ing-material:focus {
  border-color: #8B4513;
  background-color: #fff;
}

.pub-ing-percent-wrap {
  flex: 0 0 64px;
  width: 64px;
  height: 36px;
  position: relative;
  flex-shrink: 0;
}
.pub-ing-percent {
  width: 100%;
  height: 36px;
  padding: 0 20px 0 8px;
  border: 1px solid #e8ddd0 !important;
  border-radius: 8px;
  font-size: 13px;
  color: #333;
  background: #faf8f5;
  font-family: inherit;
  outline: none;
  transition: all 0.2s;
  text-align: right;
  box-sizing: border-box;
  -moz-appearance: textfield;
  display: block;
}
.pub-ing-percent::-webkit-outer-spin-button,
.pub-ing-percent::-webkit-inner-spin-button {
  -webkit-appearance: none;
  margin: 0;
}
.pub-ing-percent:focus {
  border-color: #8B4513;
  background: #fff;
}
.pub-ing-percent-sign {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  font-size: 13px;
  color: #8B7355;
  pointer-events: none;
  font-weight: 500;
}

.pub-ing-del-btn {
  flex: 0 0 20px;
  width: 20px;
  height: 20px;
  padding: 0;
  background: transparent;
  color: #b8a898;
  border: none;
  border-radius: 0;
  font-size: 16px;
  font-weight: bold;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
  flex-shrink: 0;
  line-height: 1;
}
.pub-ing-del-btn:active { color: #c62828; }

/* 合计显示 */
.pub-ing-total {
  font-size: 12px;
  min-height: 24px;
}
.pub-ing-total-ok {
  display: inline-block;
  padding: 4px 10px;
  background: #e8f5e9;
  color: #2e7d32;
  border-radius: 6px;
}
.pub-ing-total-warn {
  display: inline-block;
  padding: 4px 10px;
  background: #fff3e0;
  color: #e65100;
  border-radius: 6px;
}

/* 保存按钮 */
.pub-save-btn {
  width: 100%;
  height: 44px;
  background: linear-gradient(135deg, #8B4513, #A0522D);
  color: #fff;
  border: none;
  border-radius: 10px;
  font-size: 15px;
  font-weight: 600;
  cursor: pointer;
  font-family: inherit;
  transition: opacity 0.2s;
  margin-top: 4px;
}
.pub-save-btn:active { opacity: 0.85; }

/* 底部安全区 */
.pub-safe-bottom { height: 20px; }

/* 滚动条美化 */
.pub-modal-body {
  scrollbar-width: none;
  -ms-overflow-style: none;
}
.pub-modal-body::-webkit-scrollbar {
  display: none;
  width: 0;
  height: 0;
}



/* 字数统计 */
.pub-field.with-counter {
  position: relative;
}
.pub-field.with-counter .char-counter {
  position: absolute;
  right: 12px;
  bottom: 8px;
  font-size: 11px;
  color: #999;
  pointer-events: none;
  z-index: 1;
}
.pub-field.with-counter textarea + .char-counter {
  bottom: 8px;
}
.pub-field.with-counter input,
.pub-field.with-counter textarea {
  padding-right: 50px;
}
