.richtexteditor {
  position: relative;
  border: 1px solid #d8dee8;
  border-radius: 8px;
  background: #fff;
  box-shadow: rgba(15, 23, 42, 0.08) 0 14px 30px;
  overflow: hidden;
}

.richtexteditor::after {
  position: absolute;
  inset: 42px 0 0;
  display: none;
  align-items: center;
  justify-content: center;
  color: #1f2937;
  font-weight: 600;
  background: rgba(248, 250, 252, 0.82);
  content: "Uploading image...";
  pointer-events: none;
}

.richtexteditor.rte-uploading::after {
  display: flex;
}

.richtexteditor.rte-drag-over {
  border-color: #2d7ff9;
  box-shadow: rgba(45, 127, 249, 0.18) 0 0 0 3px;
}

.rte-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
  align-items: center;
  padding: 10px;
  border-bottom: 1px solid #dfe5ee;
  background: linear-gradient(180deg, #fbfcfe 0%, #f3f6fa 100%);
}

.rte-button-group {
  display: inline-flex;
  gap: 2px;
  align-items: center;
  min-height: 38px;
  padding: 3px;
  border: 1px solid #e1e7f0;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.88);
  box-shadow: rgba(15, 23, 42, 0.04) 0 1px 2px;
}

.rte-toolbar button,
.rte-toolbar select,
.rte-color {
  height: 32px;
  border: 0;
  border-radius: 6px;
  background: transparent;
  color: #1f2937;
  font: inherit;
}

.rte-toolbar button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  min-width: 32px;
  padding: 0;
  font-weight: 600;
  cursor: pointer;
  transition: background 120ms ease, color 120ms ease, box-shadow 120ms ease;
}

.rte-toolbar button:hover,
.rte-toolbar select:hover,
.rte-color:hover {
  background: #eef3f8;
  color: #0f172a;
}

.rte-toolbar button:active {
  background: #dce8f5;
}

.rte-toolbar button:focus,
.rte-toolbar select:focus,
.rte-color:focus-within,
.rte-content:focus {
  outline: 2px solid rgba(37, 99, 235, 0.24);
  outline-offset: 1px;
}

.rte-toolbar select {
  width: 136px;
  padding: 0 30px 0 10px;
  color: #172033;
  background: transparent;
  cursor: pointer;
}

.rte-color {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 34px;
  padding: 3px;
  cursor: pointer;
  transition: background 120ms ease;
}

.rte-color input {
  width: 20px;
  height: 20px;
  padding: 0;
  border: 1px solid #cbd5e1;
  border-radius: 5px;
  background: transparent;
  cursor: pointer;
}

.rte-separator {
  width: 1px;
  height: 22px;
  margin: 0 2px;
  background: #d9dee6;
}

.rte-content,
.rte-source {
  min-height: 460px;
  padding: 18px;
}

.rte-content {
  line-height: 1.55;
  color: #1f2937;
  background: #fff;
  overflow: auto;
}

.rte-content:empty::before {
  content: attr(data-placeholder);
  color: #8b96a5;
}

.rte-content a {
  color: #2563eb;
  text-decoration: underline;
}

.rte-content img {
  max-width: 100%;
  height: auto;
}

.rte-content blockquote {
  margin: 12px 0;
  padding: 8px 12px;
  border-left: 4px solid #cfd6df;
  background: #f8fafc;
  color: #374151;
}

.rte-content table {
  width: 100%;
  margin: 12px 0;
  border-collapse: collapse;
}

.rte-content td,
.rte-content th {
  min-width: 80px;
  padding: 8px;
  border: 1px solid #cfd6df;
  vertical-align: top;
}

.rte-content hr {
  border: 0;
  border-top: 1px solid #d7dce3;
  margin: 16px 0;
}

.rte-source {
  display: none;
  width: 100%;
  border: 0;
  resize: vertical;
  font-family: ui-monospace, SFMono-Regular, Menlo, Monaco, Consolas, "Liberation Mono", monospace;
  font-size: 13px;
  line-height: 1.5;
  color: #111827;
  background: #fbfdff;
}

.rte-source-mode .rte-content {
  display: none;
}

.rte-source-mode .rte-source {
  display: block;
}

.rte-file-input {
  display: none;
}

@media (max-width: 768px) {
  .rte-toolbar {
    gap: 6px;
    padding: 8px;
  }

  .rte-button-group {
    min-height: 36px;
  }

  .rte-toolbar button {
    min-width: 30px;
    width: 30px;
  }

  .rte-toolbar select {
    max-width: 120px;
  }
}
