/* Rich Text Editor Styles */
.rich-editor-toolbar {
  background: #23272f;
  border-radius: 8px;
  padding: 6px 8px;
  margin-bottom: 8px;
}
.rich-editor-toolbar button {
  background: none;
  border: none;
  color: #cbd5e1;
  font-size: 1rem;
  padding: 4px 8px;
  border-radius: 4px;
  cursor: pointer;
  transition: background 0.15s;
}
.rich-editor-toolbar button:hover {
  background: #334155;
  color: #fff;
}
.rich-editor-area {
  min-height: 120px;
  outline: none;
  font-size: 1rem;
  background: #1e293b;
  color: #f1f5f9;
  border: 1px solid #334155;
  border-radius: 8px;
  margin-bottom: 8px;
}
.rich-editor-preview {
  min-height: 80px;
  background: #0f172a;
  color: #cbd5e1;
  border: 1px solid #334155;
  border-radius: 8px;
  margin-top: 8px;
  padding: 8px 12px;
}

/* Compact single-row toolbar (applies to both legacy and new classes) */
.rich-toolbar, .rich-editor-toolbar {
  display: flex;
  align-items: center;
  gap: 6px;
  flex-wrap: nowrap;              /* one line only */
  overflow-x: auto;               /* horizontal scroll when overflow */
  overflow-y: hidden;
  scrollbar-width: thin;          /* Firefox */
  -ms-overflow-style: none;       /* IE/Edge */
}

/* Keep the content toolbar above editor content when scrolling */
.rich-toolbar[data-target="edit-content"],
.rich-editor-toolbar[data-target="edit-content"]{
  position: sticky;
  top: 0;
  z-index: var(--z-popover, 60);                 /* higher than any media controls */
  background: #23272f;           /* solid background to cover content under */
}

/* Ensure editor content sits below toolbar in stacking order */
#edit-content.rich-editor-area{
  position: relative;
  z-index: 0;
}

/* Optional: subtle scrollbar for WebKit */
.rich-toolbar::-webkit-scrollbar,
.rich-editor-toolbar::-webkit-scrollbar {
  height: 6px;
}
.rich-toolbar::-webkit-scrollbar-thumb,
.rich-editor-toolbar::-webkit-scrollbar-thumb {
  background: #334155;
  border-radius: 4px;
}
.rich-toolbar::-webkit-scrollbar-track,
.rich-editor-toolbar::-webkit-scrollbar-track {
  background: transparent;
}

/* Grouping and separators to keep one-line tidy */
.rich-toolbar .toolbar-group,
.rich-editor-toolbar .toolbar-group {
  display: flex;
  align-items: center;
  gap: 6px;
  flex: 0 0 auto;                 /* prevent wrapping */
}
.rich-toolbar .toolbar-separator,
.rich-editor-toolbar .toolbar-separator {
  width: 1px;
  height: 22px;
  background: #334155;
  opacity: 0.9;
  flex: 0 0 auto;
  margin: 0 2px;
}

/* Compact buttons/selects */
.rich-toolbar .toolbar-btn,
.rich-editor-toolbar button,
.rich-editor-toolbar .toolbar-btn {
  background: transparent;
  border: none;
  color: #cbd5e1;
  padding: 6px;
  border-radius: 6px;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  line-height: 1;
  flex: 0 0 auto;                 /* keep on one row */
}
.rich-toolbar .toolbar-btn:hover,
.rich-editor-toolbar button:hover,
.rich-editor-toolbar .toolbar-btn:hover {
  background: #334155;
  color: #fff;
}
.rich-toolbar .toolbar-btn.active,
.rich-editor-toolbar .toolbar-btn.active {
  background: #475569;            /* active state */
  color: #fff;
}

.rich-toolbar .toolbar-select,
.rich-editor-toolbar .toolbar-select {
  background: #1e293b;
  border: 1px solid #334155;
  color: #e2e8f0;
  padding: 4px 8px;
  border-radius: 6px;
  height: 28px;
  flex: 0 0 auto;                 /* prevent expand */
}

/* Ensure small description editor stays compact */
.rich-editor.small {
  min-height: 80px;
}

/* Image resize UI */
.image-container {
  position: relative;
}
.image-container .image-resize-handle {
  position: absolute;
  top: 50%;
  transform: translateY(-50%);
  width: 10px;
  height: 28px;
  background: rgba(59,130,246,0.85);
  border-radius: 4px;
  opacity: 0;
  transition: opacity .12s ease;
  z-index: 1;
}
.image-container:hover .image-resize-handle { opacity: 0.9; }
.image-container .image-resize-handle.left { left: -6px; cursor: ew-resize; }
.image-container .image-resize-handle.right { right: -6px; cursor: ew-resize; }
