/* ==========================================================================
   RichTextEditor – uses LexKit defaultLexKitTheme class names exclusively.
   ========================================================================== */

/* --------------------------------------------------------------------------
   Outer wrapper
   -------------------------------------------------------------------------- */
.rte-wrapper {
  border: 1px solid var(--border-color, #d0d5dd);
  border-radius: 8px;
  overflow: hidden;
  background: #fff;
  transition: border-color 0.2s ease, box-shadow 0.2s ease;
}

.rte-wrapper:focus-within {
  border-color: var(--primary-color, #2b5ce6);
  box-shadow: 0 0 0 3px rgba(43, 92, 230, 0.12);
}

.rte-wrapper--error {
  border-color: #d32f2f;
}

.rte-wrapper--error:focus-within {
  border-color: #d32f2f;
  box-shadow: 0 0 0 3px rgba(211, 47, 47, 0.12);
}

.rte-wrapper--disabled {
  background: #f5f5f5;
  opacity: 0.7;
  pointer-events: none;
}

/* Error message (e.g. required on submit) */
.rte-error-message {
  margin-top: 6px;
  font-size: 12px;
  color: #d32f2f;
}

/* --------------------------------------------------------------------------
   Toolbar
   -------------------------------------------------------------------------- */
.rte-toolbar {
  display: flex;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid var(--border-color, #d0d5dd);
  background: #fafafa;
  flex-wrap: wrap;
}

.rte-toolbar-group {
  display: flex;
  align-items: center;
  gap: 2px;
}

.rte-toolbar__divider {
  display: inline-block;
  width: 1px;
  height: 20px;
  background: #d0d5dd;
  margin: 0 4px;
  flex-shrink: 0;
}

/* --------------------------------------------------------------------------
   Toolbar buttons
   -------------------------------------------------------------------------- */
.lexkit-toolbar-button {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  width: 30px;
  height: 30px;
  border: none;
  border-radius: 6px;
  background: transparent;
  color: #444;
  cursor: pointer;
  font-size: 14px;
  line-height: 1;
  transition: background 0.15s ease, color 0.15s ease;
  padding: 0;
}

.lexkit-toolbar-button:hover:not(.lexkit-toolbar-button-disabled):not(:disabled) {
  background: #e8eaf0;
  color: #1a1a2e;
}

.lexkit-toolbar-button-active {
  background: #e3eaff;
  color: var(--primary-color, #2b5ce6);
}

.lexkit-toolbar-button-active:hover {
  background: #d0daff;
}

.lexkit-toolbar-button-disabled,
.lexkit-toolbar-button:disabled {
  opacity: 0.35;
  cursor: not-allowed;
  pointer-events: none;
}

/* Block-format native select */
.rte-block-select {
  height: 30px;
  padding: 0 24px 0 8px;
  border: 1px solid #d0d5dd;
  border-radius: 6px;
  background: #fff url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6' viewBox='0 0 10 6'%3E%3Cpath d='M0 0l5 6 5-6z' fill='%23888'/%3E%3C/svg%3E") no-repeat right 8px center;
  appearance: none;
  -webkit-appearance: none;
  font-size: 13px;
  color: #333;
  cursor: pointer;
  outline: none;
  transition: border-color 0.15s ease, box-shadow 0.15s ease;
  min-width: 108px;
}

.rte-block-select:focus {
  border-color: var(--primary-color, #2b5ce6);
  box-shadow: 0 0 0 2px rgba(43, 92, 230, 0.15);
}

/* --------------------------------------------------------------------------
   Editor content area
   -------------------------------------------------------------------------- */
.lexkit-editor-container {
  position: relative;
  min-height: 140px;
}

.lexkit-content-editable {
  min-height: 140px;
  padding: 12px 14px;
  outline: none;
  font-size: 14px;
  line-height: 1.6;
  color: #1a1a2e;
  word-break: break-word;
  overflow-wrap: break-word;
}

.lexkit-placeholder {
  position: absolute;
  top: 12px;
  left: 14px;
  pointer-events: none;
  color: #9aa0b0;
  font-size: 14px;
  line-height: 1.6;
  user-select: none;
  z-index: 1;
}

/* --------------------------------------------------------------------------
   Inline text formats
   -------------------------------------------------------------------------- */
.lexkit-text-bold {
  font-weight: 700;
}

.lexkit-text-italic {
  font-style: italic;
}

.lexkit-text-underline {
  text-decoration: underline;
}

.lexkit-text-strikethrough {
  text-decoration: line-through;
}

.lexkit-text-code {
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.88em;
  background: #f0f2f5;
  border: 1px solid #e0e3e8;
  border-radius: 3px;
  padding: 1px 5px;
}

/* --------------------------------------------------------------------------
   Block formats
   -------------------------------------------------------------------------- */
.lexkit-paragraph {
  margin: 0 0 0.4em;
}

.lexkit-paragraph:last-child {
  margin-bottom: 0;
}

.lexkit-heading-h1 {
  font-size: 1.6em;
  font-weight: 700;
  margin: 0.6em 0 0.4em;
}

.lexkit-heading-h2 {
  font-size: 1.35em;
  font-weight: 700;
  margin: 0.6em 0 0.4em;
}

.lexkit-heading-h3 {
  font-size: 1.15em;
  font-weight: 600;
  margin: 0.5em 0 0.3em;
}

.lexkit-quote {
  border-left: 3px solid var(--primary-color, #2b5ce6);
  margin: 0.5em 0;
  padding: 4px 12px;
  color: #555;
  font-style: italic;
}

/* --------------------------------------------------------------------------
   Lists
   -------------------------------------------------------------------------- */
.lexkit-list-ul,
.lexkit-list-ol {
  margin: 0.4em 0;
  padding-left: 1.6em;
}

.lexkit-list-ul {
  list-style-type: disc;
}

.lexkit-list-ol {
  list-style-type: decimal;
}

.lexkit-list-item {
  margin: 0.1em 0;
  padding-left: 0.2em;
}

.lexkit-nested-list-item {
  list-style-type: none;
}

/* --------------------------------------------------------------------------
   Code block
   -------------------------------------------------------------------------- */
.lexkit-code {
  display: block;
  font-family: "SFMono-Regular", Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 0.875em;
  background: #f6f8fa;
  border: 1px solid #e0e3e8;
  border-radius: 6px;
  padding: 12px 14px;
  margin: 0.5em 0;
  overflow-x: auto;
  line-height: 1.5;
  color: #24292e;
  white-space: pre-wrap;
  word-break: break-all;
}

/* --------------------------------------------------------------------------
   Link
   -------------------------------------------------------------------------- */
.lexkit-link {
  color: var(--primary-color, #2b5ce6);
  text-decoration: underline;
  cursor: pointer;
}

.lexkit-link:hover {
  opacity: 0.8;
}

/* --------------------------------------------------------------------------
   Table
   -------------------------------------------------------------------------- */
.lexkit-table {
  width: 100%;
  border-collapse: collapse;
  margin: 0.6em 0;
  font-size: 0.9em;
  overflow: hidden;
  border-radius: 6px;
}

.lexkit-table-cell,
.lexkit-table-cell-header {
  border: 1px solid #d0d5dd;
  padding: 6px 10px;
  min-width: 60px;
  vertical-align: top;
}

.lexkit-table-cell-header {
  background: #f0f2f5;
  font-weight: 600;
  text-align: left;
}

.lexkit-table-cell:focus,
.lexkit-table-cell-header:focus {
  outline: 2px solid var(--primary-color, #2b5ce6);
  outline-offset: -2px;
}

/* --------------------------------------------------------------------------
   Image
   -------------------------------------------------------------------------- */
.lexkit-image {
  max-width: 100%;
  height: auto;
  border-radius: 4px;
  display: block;
  margin: 0.5em auto;
}

.lexkit-image-selected {
  outline: 2px solid var(--primary-color, #2b5ce6);
  outline-offset: 2px;
}

.lexkit-heading-h1,
.lexkit-heading-h2,
.lexkit-heading-h3 {
  display: revert !important;
}

.lexkit-heading-h2 {
  text-align: inherit !important;
  margin-inline: inherit !important;
}

.lexkit-heading-h3 {
  text-align: inherit !important;
  margin-inline: inherit !important;
  font-weight: revert !important;
}
