/* ============================================================
   DaiWAF 论坛编辑器样式（前后台共用，自包含不依赖外部变量）
   ============================================================ */

.fe {
  position: relative;
  border: 1px solid #dcdfe6;
  border-radius: 8px;
  background: #fff;
  overflow: visible;
}

/* 边框高亮只跟随正文区焦点（JS 加 fe-focus），面板内按钮聚焦不触发 */
.fe.fe-focus {
  border-color: #2b6bff;
  box-shadow: 0 0 0 2px rgba(43, 107, 255, .12);
}

/* ---------------- 工具栏 ---------------- */

.fe-bar {
  display: flex;
  align-items: center;
  flex-wrap: wrap;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid #ebeef5;
  border-radius: 8px 8px 0 0;
  background: #f7f8fa;
}

.fe-bar .fe-btn {
  min-width: 28px;
  height: 28px;
  padding: 0 6px;
  border: none;
  background: transparent;
  border-radius: 5px;
  cursor: pointer;
  color: #4b5563;
  font-size: 13px;
  line-height: 28px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 2px;
}

.fe-bar .fe-btn:hover {
  background: #e8ebf2;
  color: #1f2329;
}

.fe-sep {
  width: 1px;
  height: 16px;
  background: #dcdfe6;
  margin: 0 4px;
}

.fe-caret {
  width: 0;
  height: 0;
  border-left: 3px solid transparent;
  border-right: 3px solid transparent;
  border-top: 4px solid currentColor;
  margin-left: 1px;
}

/* ---------------- 面板通用 ---------------- */

.fe-panel-wrap {
  position: relative;
  display: inline-flex;
}

.fe-panel {
  display: none;
  position: absolute;
  top: 34px;
  left: 0;
  z-index: 90;
  background: #fff;
  border: 1px solid #e4e7ed;
  border-radius: 8px;
  box-shadow: 0 10px 32px rgba(15, 27, 51, .14);
}

.fe-panel-wrap.fe-open .fe-panel {
  display: block;
  animation: fe-panel-in .14s ease-out;
}

@keyframes fe-panel-in {
  from { opacity: 0; transform: translateY(-4px); }
  to { opacity: 1; transform: translateY(0); }
}

/* ---------------- 色板 ---------------- */

.fe-color-panel {
  display: none;
  padding: 10px;
  grid-template-columns: repeat(4, 24px);
  gap: 8px;
}

.fe-color-wrap.fe-open .fe-color-panel {
  display: grid;
}

.fe-swatch {
  width: 24px;
  height: 24px;
  border-radius: 5px;
  border: 1px solid rgba(0, 0, 0, .08);
  cursor: pointer;
}

.fe-swatch:hover {
  transform: scale(1.12);
}

/* ---------------- 表情面板 ---------------- */

.fe-emoji-panel {
  width: 320px;
  padding: 8px;
}

.fe-emoji-tabs {
  display: flex;
  flex-wrap: wrap;
  gap: 4px;
  padding: 2px 2px 8px;
  border-bottom: 1px solid #ebeef5;
  margin-bottom: 8px;
}

.fe-emoji-tab {
  border: 1px solid transparent;
  background: #f2f3f7;
  color: #4b5563;
  border-radius: 20px;
  padding: 3px 12px;
  font-size: 12px;
  cursor: pointer;
}

.fe-emoji-tab:hover {
  color: #2b6bff;
}

.fe-emoji-tab.on {
  background: rgba(43, 107, 255, .1);
  border-color: rgba(43, 107, 255, .35);
  color: #2b6bff;
  font-weight: 600;
}

.fe-emoji-grid {
  display: grid;
  grid-template-columns: repeat(6, 1fr);
  gap: 4px;
  max-height: 240px;
  overflow-y: auto;
}

.fe-emoji-item {
  border: none;
  background: transparent;
  border-radius: 6px;
  padding: 4px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
}

.fe-emoji-item:hover {
  background: #f2f3f7;
}

.fe-emoji-item .fe-emoji {
  width: 30px;
  height: 30px;
}

/* ---------------- 表单面板（引用/链接） ---------------- */

.fe-form-panel {
  width: 300px;
  padding: 12px;
}

.fe-form-title {
  font-size: 13px;
  font-weight: 600;
  color: #1f2329;
  margin-bottom: 8px;
}

.fe-input {
  width: 100%;
  box-sizing: border-box;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  padding: 6px 9px;
  font-size: 13px;
  line-height: 1.5;
  color: #1f2329;
  outline: none;
  font-family: inherit;
}

.fe-input:focus {
  border-color: #2b6bff;
  box-shadow: 0 0 0 2px rgba(43, 107, 255, .1);
}

.fe-textarea {
  resize: vertical;
  min-height: 62px;
}

.fe-form-foot {
  display: flex;
  justify-content: flex-end;
  gap: 8px;
  margin-top: 10px;
}

.fe-form-btn {
  border: 1px solid #dcdfe6;
  background: #fff;
  color: #4b5563;
  border-radius: 5px;
  padding: 5px 14px;
  font-size: 12.5px;
  cursor: pointer;
}

.fe-form-btn:hover {
  color: #2b6bff;
  border-color: #2b6bff;
}

.fe-form-primary {
  background: #2b6bff;
  border-color: #2b6bff;
  color: #fff;
}

.fe-form-primary:hover {
  background: #1f5ce6;
  border-color: #1f5ce6;
  color: #fff;
}

/* ---------------- 上传面板 ---------------- */

.fe-upload-panel {
  width: 280px;
  padding: 10px;
}

.fe-dropzone {
  border: 1.5px dashed #c4cbd8;
  border-radius: 8px;
  padding: 22px 14px;
  text-align: center;
  cursor: pointer;
  color: #8a919f;
  transition: border-color .15s, background .15s;
  outline: none;
}

.fe-dropzone:hover,
.fe-dropzone:focus,
.fe-dropzone.fe-dragover {
  border-color: #2b6bff;
  background: rgba(43, 107, 255, .05);
  color: #2b6bff;
}

.fe-dz-icon {
  margin-bottom: 6px;
}

.fe-dz-text {
  font-size: 13px;
  color: #1f2329;
}

.fe-dz-hint {
  margin-top: 5px;
  font-size: 12px;
  color: #a2a9b8;
}

/* ---------------- 编辑区 ---------------- */

.fe-area {
  padding: 14px 16px;
  font-size: 14px;
  line-height: 1.75;
  color: #1f2329;
  outline: none;
  overflow-y: auto;
  border-radius: 0 0 8px 8px;
}

.fe-area:empty::before {
  content: attr(data-ph);
  color: #b3bac6;
  pointer-events: none;
}

.fe-area img {
  max-width: 100%;
}

.fe-area img.fe-emoji {
  display: inline-block;
  width: 22px;
  height: 22px;
  vertical-align: -5px;
  margin: 0 2px;
}

.fe-area pre {
  background: #f4f5f8;
  border: 1px solid #e4e7ed;
  border-radius: 6px;
  padding: 10px 12px;
  font-family: Consolas, Monaco, monospace;
  font-size: 13px;
  line-height: 1.6;
  overflow-x: auto;
  white-space: pre-wrap;
  word-break: break-all;
}

.fe-area blockquote {
  margin: 8px 0;
  padding: 8px 12px;
  border-left: 3px solid #2b6bff;
  background: #f5f8ff;
  border-radius: 0 6px 6px 0;
  color: #4b5563;
}

.fe-area ul,
.fe-area ol {
  padding-left: 24px;
  margin: 6px 0;
}

.fe-area.fe-dragover {
  background: rgba(43, 107, 255, .04);
}

/* ---------------- 上传占位 ---------------- */

.fe-uploading {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  min-width: 88px;
  height: 30px;
  padding: 0 10px;
  background: #f2f3f7;
  border: 1px solid #dcdfe6;
  border-radius: 6px;
  vertical-align: middle;
  font-size: 12px;
  color: #6b7280;
}

.fe-uploading em {
  font-style: normal;
}

.fe-spin {
  width: 12px;
  height: 12px;
  border: 2px solid #c4cbd8;
  border-top-color: #2b6bff;
  border-radius: 50%;
  animation: fe-spin .7s linear infinite;
}

@keyframes fe-spin {
  to { transform: rotate(360deg); }
}

/* ---------------- 浮动工具层（图片尺寸 / 块级删除） ---------------- */

.fe-float {
  display: none;
  position: absolute;
  z-index: 95;
  align-items: center;
  gap: 2px;
  padding: 3px 4px;
  background: #1f2329;
  border-radius: 6px;
  box-shadow: 0 6px 20px rgba(15, 27, 51, .28);
}

.fe-float.show {
  display: flex;
  animation: fe-panel-in .12s ease-out;
}

.fe-float-btn {
  border: none;
  background: transparent;
  color: #e5e9f0;
  font-size: 12px;
  line-height: 1;
  padding: 5px 8px;
  border-radius: 4px;
  cursor: pointer;
  white-space: nowrap;
}

.fe-float-btn:hover {
  background: rgba(255, 255, 255, .14);
  color: #fff;
}

.fe-float-danger {
  color: #ff9c9c;
}

.fe-float-danger:hover {
  background: rgba(246, 109, 109, .22);
  color: #ffc2c2;
}

.fe-float-sep {
  width: 1px;
  height: 14px;
  background: rgba(255, 255, 255, .2);
  margin: 0 2px;
}

.fe .fe-selected {
  outline: 2px solid #2b6bff;
  outline-offset: 2px;
}

/* ---------------- Toast ---------------- */

.fe-toast {
  position: fixed;
  top: 76px;
  left: 50%;
  transform: translateX(-50%);
  z-index: 9100;
  background: #fef2f2;
  border: 1px solid #fecaca;
  color: #b91c1c;
  padding: 10px 20px;
  border-radius: 10px;
  font-size: 13px;
  box-shadow: 0 8px 24px rgba(15, 27, 51, .12);
}
