/* ============================================================
   大陶匠社区V2 - 发布主题弹窗组件
   独立组件，全社区统一调用
   提取自老社区，已适配新社区
   ============================================================ */

/* 发布主题弹窗 */
.post-modal-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0, 0, 0, 0.5);
  z-index: 1000;
  display: none;
  align-items: center;
  justify-content: center;
  padding: 16px;
}

.post-modal-overlay.open {
  display: flex;
}

.post-modal {
  background: #fff;
  border-radius: 16px;
  width: 100%;
  max-width: 480px;
  max-height: 85vh;
  display: flex;
  flex-direction: column;
  overflow: hidden;
  animation: postModalIn 0.2s ease;
}

@keyframes postModalIn {
  from { opacity: 0; transform: translateY(20px) scale(0.98); }
  to { opacity: 1; transform: translateY(0) scale(1); }
}

.post-modal-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 16px 20px;
  border-bottom: 1px solid #f0ede8;
  flex-shrink: 0;
}

.post-modal-title {
  font-size: 16px;
  font-weight: 600;
  color: #3d2c1e;
}

.post-modal-close {
  width: 26px;
  height: 26px;
  border: none;
  background: #f5f0eb;
  border-radius: 50%;
  font-size: 18px;
  color: #999;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

.post-modal-close:hover {
  background: #ebe4db;
  color: #666;
}

.post-modal-body {
  flex: 1;
  overflow-y: auto;
  padding: 16px 20px;
  position: relative;
}

.post-modal-footer {
  display: flex;
  gap: 12px;
  padding: 14px 20px;
  border-top: 1px solid #f0ede8;
  flex-shrink: 0;
}

.post-cancel-btn {
  flex: 1;
  height: 42px;
  border: 1px solid #ddd;
  background: #fff;
  color: #666;
  border-radius: 8px;
  font-size: 14px;
  cursor: pointer;
}

.post-cancel-btn:hover {
  background: #f9f9f9;
}

.post-submit-btn {
  flex: 1;
  height: 42px;
  border: none;
  background: linear-gradient(135deg, #8B4513, #D96A1F);
  color: #fff;
  border-radius: 8px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
}

.post-submit-btn:hover:not(:disabled) {
  opacity: 0.9;
}

.post-submit-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

/* 表单样式 */
.post-form-group {
  margin-bottom: 16px;
}

.post-form-label {
  display: block;
  font-size: 13px;
  font-weight: 600;
  color: #3d2c1e;
  margin-bottom: 8px;
}

.post-required {
  color: #e74c3c;
}

.post-form-input {
  width: 100%;
  height: 40px;
  padding: 0 12px;
  border: 1px solid #e0d6cc;
  border-radius: 8px;
  font-size: 14px;
  color: #333;
  box-sizing: border-box;
  outline: none;
  transition: border-color 0.15s;
}

.post-form-input:focus {
  border-color: #8B4513;
}

.post-textarea-wrap {
  border: 1px solid #e0d6cc;
  border-radius: 8px;
  overflow: hidden;
  transition: border-color 0.15s;
}

.post-textarea-wrap:focus-within {
  border-color: #8B4513;
}

.post-form-textarea {
  width: 100%;
  height: 120px;
  padding: 12px 14px;
  border: none;
  border-radius: 0;
  background: transparent;
  font-size: 14px;
  color: #333;
  box-sizing: border-box;
  outline: none;
  resize: none;
  overflow-y: auto;
  font-family: inherit;
  line-height: 1.6;
  display: block;
}

.post-textarea-tools {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 8px 12px;
  border-top: 1px solid #f0ede8;
  background: #faf8f5;
}

.post-tools-left {
  display: flex;
  align-items: center;
  gap: 8px;
}

.post-toolbar-btn {
  width: 32px;
  height: 32px;
  border: none;
  background: transparent;
  border-radius: 6px;
  color: #888;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.15s;
}

.post-toolbar-btn:hover {
  background: #f0ebe4;
  color: #8B4513;
}

.post-toolbar-btn.active {
  background: #f5ebe0;
  color: #8B4513;
}

.post-toolbar-btn:disabled {
  opacity: 0.4;
  cursor: not-allowed;
}

.post-form-counter {
  font-size: 12px;
  color: #999;
}

/* 分类选择 */
.post-cat-tabs {
  display: flex;
  gap: 8px;
}

.post-cat-tab {
  flex: 1;
  height: 36px;
  border: 1px solid #e0d6cc;
  background: #fff;
  color: #666;
  border-radius: 8px;
  font-size: 13px;
  cursor: pointer;
  transition: all 0.15s;
}

.post-cat-tab:hover {
  border-color: #8B4513;
  color: #8B4513;
}

.post-cat-tab.active {
  background: linear-gradient(135deg, #8B4513, #D96A1F);
  color: #fff;
  border-color: transparent;
}

.post-cat-tab.is-locked,
.post-cat-tab:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

.post-subcat-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.post-subcat-item {
  padding: 6px 14px;
  border: 1px solid #e0d6cc;
  background: #fff;
  color: #666;
  border-radius: 16px;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.15s;
}

.post-subcat-item:hover {
  border-color: #8B4513;
  color: #8B4513;
}

.post-subcat-item.active {
  background: #f5ebe0;
  color: #8B4513;
  border-color: #8B4513;
  font-weight: 600;
}

/* 图片上传预览 */
.post-image-upload {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  margin-top: 10px;
}

.post-image-preview-item {
  position: relative;
  width: 72px;
  height: 72px;
  border-radius: 8px;
  overflow: hidden;
}

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

.post-image-remove {
  position: absolute;
  top: 2px;
  right: 2px;
  width: 20px;
  height: 20px;
  border: none;
  background: rgba(0, 0, 0, 0.5);
  color: #fff;
  border-radius: 50%;
  font-size: 14px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
}

/* 表情面板 */
.post-emoji-panel {
  display: none;
  position: absolute;
  bottom: 100%;
  left: 0;
  right: 0;
  margin-bottom: 8px;
  border: 1px solid #e0d6cc;
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
  z-index: 10;
}

.post-emoji-panel.active {
  display: block;
}

.post-emoji-tabs {
  display: flex;
  border-bottom: 1px solid #f0ede8;
  background: #faf8f5;
}

.post-emoji-tab {
  flex: 1;
  padding: 8px;
  border: none;
  background: transparent;
  font-size: 12px;
  color: #666;
  cursor: pointer;
  transition: all 0.15s;
}

.post-emoji-tab.active {
  background: #fff;
  color: #8B4513;
  font-weight: 600;
  border-bottom: 2px solid #8B4513;
}

.post-emoji-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 4px;
  padding: 10px;
  max-height: 160px;
  overflow-y: auto;
}

.post-emoji-item {
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 20px;
  padding: 4px;
  border-radius: 6px;
  cursor: pointer;
  transition: background 0.15s;
}

.post-emoji-item:hover {
  background: #f5ebe0;
}

/* 响应式 */
@media (max-width: 480px) {
  .post-modal {
    max-height: 90vh;
  }
  
  .post-emoji-grid {
    grid-template-columns: repeat(6, 1fr);
  }
}


/* ============================================================
   悬浮发布按钮
   ============================================================ */
.fab-publish {
  position: fixed;
  right: 16px;
  bottom: 130px;
  width: 52px;
  height: 52px;
  border-radius: 50%;
  background: #ffffff;
  color: #8B4513;
  border: 2px solid #8B4513;
  display: flex;
  align-items: center;
  justify-content: center;
  cursor: pointer;
  box-shadow: 0 4px 12px rgba(139, 69, 19, 0.18);
  z-index: 950;
  transition: transform 0.15s, box-shadow 0.15s;
  -webkit-tap-highlight-color: transparent;
}

.fab-publish:hover {
  transform: scale(1.05);
  box-shadow: 0 6px 16px rgba(139, 69, 19, 0.28);
}

.fab-publish:active {
  transform: scale(0.95);
}

.fab-publish svg {
  width: 24px;
  height: 24px;
  fill: none;
  stroke: currentColor;
  stroke-width: 2;
  stroke-linecap: round;
  stroke-linejoin: round;
}

/* 响应式：小屏幕调整位置 */
@media (max-width: 480px) {
  .fab-publish {
    right: 14px;
    bottom: 126px;
    width: 48px;
    height: 48px;
  }
  
  .fab-publish svg {
    width: 22px;
    height: 22px;
  }
}




/* 电脑端/平板端放大弹窗 */
@media (min-width: 768px) {
  .post-modal {
    max-width: 640px;
    max-height: 88vh;
  }
  .post-modal-body {
    padding: 24px;
  }
  .post-modal-footer {
    padding: 16px 24px;
  }
  .post-emoji-grid {
    grid-template-columns: repeat(8, 1fr);
    max-height: 200px;
  }
}

/* 表情框向上弹出 */
.post-emoji-panel {
  bottom: auto !important;
  top: 0 !important;
}

/* 图片上传状态遮罩 */
.post-image-preview-item { position: relative; }
.post-image-status {
  position: absolute; bottom: 0; left: 0; right: 0;
  background: rgba(0,0,0,.6); color: #fff;
  font-size: 11px; text-align: center; padding: 3px 0;
}
.post-image-status-error { background: rgba(220,50,50,.8); }
