/* MyFamily.RichTextEditor.Blazor — read-only viewer surface */

.mf-rich-text {
  word-break: break-word;
  line-height: 1.65;
  font-size: 1.05rem;
}

.mf-rich-text > :first-child {
  margin-top: 0;
}

.mf-rich-text > :last-child {
  margin-bottom: 0;
}

.mf-rich-text p,
.mf-rich-text blockquote,
.mf-rich-text ul,
.mf-rich-text ol,
.mf-rich-text table,
.mf-rich-text h1,
.mf-rich-text h2,
.mf-rich-text h3,
.mf-rich-text h4,
.mf-rich-text h5,
.mf-rich-text h6 {
  margin: 0 0 0.75em;
}

.mf-rich-text h1 { font-size: 1.75em; font-weight: 700; line-height: 1.3; }
.mf-rich-text h2 { font-size: 1.45em; font-weight: 700; line-height: 1.35; }
.mf-rich-text h3 { font-size: 1.25em; font-weight: 600; line-height: 1.4; }
.mf-rich-text h4,
.mf-rich-text h5,
.mf-rich-text h6 { font-size: 1.1em; font-weight: 600; }

.mf-rich-text blockquote {
  margin-left: 0;
  padding: 0.25em 0 0.25em 1em;
  border-left: 3px solid rgba(127, 127, 127, 0.45);
  color: inherit;
  opacity: 0.92;
}

.mf-rich-text ul,
.mf-rich-text ol {
  padding-left: 1.5em;
}

.mf-rich-text li {
  margin: 0.2em 0;
}

.mf-rich-text a {
  color: var(--mud-palette-primary, #1976d2);
  text-decoration: underline;
  text-underline-offset: 2px;
}

.mf-rich-text code {
  font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
  font-size: 0.92em;
  padding: 0.1em 0.35em;
  border-radius: 4px;
  background: rgba(127, 127, 127, 0.12);
}

.mf-rich-text table {
  width: 100%;
  border-collapse: collapse;
  display: block;
  overflow-x: auto;
}

.mf-rich-text th,
.mf-rich-text td {
  border: 1px solid rgba(127, 127, 127, 0.35);
  padding: 0.4em 0.65em;
  vertical-align: top;
}

.mf-rich-text th {
  font-weight: 600;
  background: rgba(127, 127, 127, 0.08);
}

.mf-rich-text img {
  max-width: 100%;
  height: auto;
}

.mf-rich-text__empty {
  margin: 0;
  opacity: 0.65;
  font-style: italic;
}

/* ── Editor (HTML-mirror) ─────────────────────────────────────────── */

.mf-rte {
  border: 1px solid rgba(127, 127, 127, 0.35);
  border-radius: 8px;
  overflow: hidden;
  background: var(--mud-palette-surface, #fff);
}

.mf-rte__toolbar {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 2px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(127, 127, 127, 0.25);
  background: rgba(127, 127, 127, 0.06);
}

.mf-rte__btn {
  min-width: 32px;
  height: 30px;
  padding: 0 8px;
  border: 1px solid transparent;
  border-radius: 6px;
  background: transparent;
  color: inherit;
  font-size: 14px;
  line-height: 1;
  cursor: pointer;
}

.mf-rte__btn:hover {
  background: rgba(127, 127, 127, 0.15);
}

.mf-rte__btn--active,
.mf-rte__btn--active:hover {
  border-color: var(--mud-palette-primary, #594ae2);
  background: color-mix(in srgb, var(--mud-palette-primary, #594ae2) 18%, transparent);
  color: var(--mud-palette-primary, #594ae2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mud-palette-primary, #594ae2) 35%, transparent);
}

.mf-rte__btn:active {
  background: rgba(127, 127, 127, 0.25);
}

.mf-rte__btn:focus-visible {
  outline: 2px solid var(--mud-palette-primary, #594ae2);
  outline-offset: 1px;
}

.mf-rte__sep {
  width: 1px;
  align-self: stretch;
  margin: 2px 4px;
  background: rgba(127, 127, 127, 0.3);
}

.mf-rte__btn--primary {
  border-color: var(--mud-palette-primary, #594ae2);
  color: var(--mud-palette-primary, #594ae2);
  font-weight: 600;
}

.mf-rte__panel {
  display: flex;
  flex-wrap: wrap;
  align-items: center;
  gap: 6px;
  padding: 6px 8px;
  border-bottom: 1px solid rgba(127, 127, 127, 0.25);
  background: rgba(127, 127, 127, 0.04);
}

.mf-rte__linkinput,
.mf-rte__textinput {
  flex: 1 1 auto;
  min-width: 0;
  height: 30px;
  padding: 0 8px;
  border: 1px solid rgba(127, 127, 127, 0.4);
  border-radius: 6px;
  background: var(--mud-palette-surface, #fff);
  color: inherit;
  font-size: 14px;
}

.mf-rte__textinput--alt {
  flex-basis: 12rem;
}

.mf-rte__linkinput:focus,
.mf-rte__textinput:focus {
  outline: none;
  border-color: var(--mud-palette-primary, #594ae2);
  box-shadow: inset 0 0 0 1px color-mix(in srgb, var(--mud-palette-primary, #594ae2) 40%, transparent);
}

.mf-rte__field-label {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  font-size: 13px;
  white-space: nowrap;
}

.mf-rte__colorinput {
  width: 34px;
  height: 30px;
  padding: 2px;
  border: 1px solid rgba(127, 127, 127, 0.4);
  border-radius: 6px;
  background: transparent;
  cursor: pointer;
}

@media (max-width: 600px) {
  .mf-rte__panel--image .mf-rte__textinput {
    flex-basis: 100%;
  }
}

.mf-rte__surface {
  padding: 12px 14px;
  outline: none;
  overflow-y: auto;
}

.mf-rte__surface:empty::before {
  content: attr(data-placeholder);
  opacity: 0.55;
  pointer-events: none;
}
