/* ====== Editor Base ====== */
.ed-wrap {
  max-width: 1000px;
  margin: 28px auto;
  padding: 0 16px;
}

.ed-toolbar {
  display: flex;
  flex-wrap: wrap;
  gap: .4rem;
  align-items: center;
  margin: 0 0 12px;
  padding: 8px;
  border: 1px solid #2d3748;
  border-radius: 10px;
  background: rgba(255, 255, 255, .06);
}

body:not(.dark) .ed-toolbar {
  border-color: #d0d0d0;
  background: #fff;
}

.ed-btn {
  font-size: .9rem;
  line-height: 1.1;
  padding: .35rem .55rem;
  border: 1px solid #3a424f;
  border-radius: 8px;
  background: #1f2630;
  color: #fff;
  cursor: pointer;
}

.ed-btn:hover {
  background: #293240;
}

body:not(.dark) .ed-btn {
  background: #fff;
  color: #111;
  border-color: #d0d0d0;
}

body:not(.dark) .ed-btn:hover {
  background: #f4f4f4;
}

.ed-divider {
  width: 1px;
  height: 28px;
  background: #3a424f;
  opacity: .4;
}

body:not(.dark) .ed-divider {
  background: #d0d0d0;
}

.ed-editor {
  min-height: 50vh;
  padding: 12px;
  border: 1px dashed #3a424f;
  border-radius: 12px;
  outline: none;
  background: rgba(255, 255, 255, .04);
  /* Damit frei bewegliche Bilder absolut innerhalb des Editors
     positioniert werden kÃ¶nnen, muss der Editor relativ positioniert sein. */
  position: relative;
}

/*
 * Im Lightâ€‘Mode (white mode) soll der Editor eine weiÃŸe FlÃ¤che wie der Rest der Seite
 * darstellen. Der vorherige Farbton (rgba(0,0,0,.04)) wirkte grau und fÃ¼hrte dazu,
 * dass der Editor zu dunkel erschien. Wir setzen daher den Hintergrund auf reines
 * WeiÃŸ und passen die Umrandungsfarbe an den Standardrahmen an. Die Textfarbe
 * bleibt dunkel. Diese Ã„nderung behebt den Darstellungsfehler im Bearbeitungsmodus
 * fÃ¼r News und Events.
 */
body:not(.dark) .ed-editor {
  background: #fff;
  border-color: #d0d0d0;
  color: #111;
}

.ed-status {
  font-size: .9rem;
  opacity: .8;
  margin-left: auto;
}

/* Content cosmetics */
.ed-editor h1 {
  font-size: 1.8rem;
  margin: .6em 0 .3em;
}

.ed-editor h2 {
  font-size: 1.4rem;
  margin: .6em 0 .3em;
}

.ed-editor p {
  line-height: 1.5;
  margin: .5em 0;
}

.ed-editor ul,
.ed-editor ol {
  padding-left: 1.2em;
}

.ed-editor blockquote {
  border-left: 3px solid #6b7280;
  margin: .6em 0;
  padding: .3em .8em;
  opacity: .9;
}

/* Image wrapper + mini-toolbar */
.ed-imgwrap {
  display: inline-block;
  position: relative;
  max-width: 100%;
}

.ed-imgwrap img {
  max-width: 100%;
  border-radius: 10px;
}

.ed-imgwrap.selected {
  outline: 2px dashed #8ab4f8;
  outline-offset: 4px;
}

/* Bilder, die frei beweglich sein sollen, erhalten die Klasse .ed-floating.
   Sie werden absolut innerhalb des Editors positioniert und kÃ¶nnen mit der
   Maus verschoben werden. Der Cursor Ã¤ndert sich zu "move", um das
   Ziehen zu signalisieren. */
.ed-imgwrap.ed-floating {
  position: absolute;
  cursor: move;
  /* Damit sich schwebende Bilder Ã¼ber dem Text befinden */
  z-index: 2;
}

.ed-imgbar {
  position: absolute;
  left: 50%;
  transform: translateX(-50%);
  /* Die Werkzeugleiste wird Ã¼ber dem Bild angezeigt. Zuvor stand sie unter dem Bild und
     war bei langen Inhalten oft abgeschnitten. Durch die Positionierung nach oben
     bleibt die Leiste stets sichtbar. */
  top: -42px;
  display: flex;
  gap: .4rem;
  align-items: center;
  padding: 6px 8px;
  background: #1f2630;
  color: #fff;
  border: 1px solid #3a424f;
  border-radius: 8px;
  z-index: 10;
  white-space: nowrap;
}

body:not(.dark) .ed-imgbar {
  background: #fff;
  color: #111;
  border-color: #d0d0d0;
}

/* Resizer fÃ¼r Bilder
   Der kleine Quadrathandle ermÃ¶glicht es, die Breite eines ausgewÃ¤hlten Bildes durch Ziehen zu verÃ¤ndern.
   Er erscheint nur, wenn der Bild-Wrapper die Klasse .selected trÃ¤gt. */
.ed-resizer {
  position: absolute;
  bottom: -6px;
  right: -6px;
  width: 12px;
  height: 12px;
  background: #fff;
  border: 1px solid #666;
  cursor: se-resize;
  border-radius: 2px;
  display: none;
  z-index: 11;
}

.ed-imgwrap.selected .ed-resizer {
  display: block;
}

.ed-imgbar input[type="range"] {
  width: 120px;
}

/* Alignment helper classes */
.ed-align-left {
  display: block;
  margin: .4rem auto .4rem 0;
}

.ed-align-center {
  display: block;
  margin: .4rem auto;
}

.ed-align-right {
  display: block;
  margin: .4rem 0 .4rem auto;
}


/* ===== Editor: Bild-Umfluss (Wrap) ===== */
.ed-editor .ed-imgwrap {
  display: inline-block;
  max-width: 100%;
}

.ed-editor .ed-imgwrap img {
  display: block;
  height: auto;
}

/* Textumfluss */
.ed-editor .ed-align-left {
  float: left;
  margin: 0 14px 10px 0;
}

.ed-editor .ed-align-right {
  float: right;
  margin: 0 0 10px 14px;
}

.ed-editor .ed-align-center {
  float: none;
  display: block;
  margin: 10px auto;
  text-align: center;
}

/* Floats innerhalb des Editors sauber beenden */
.ed-editor::after {
  content: "";
  display: block;
  clear: both;
}

/* Mobile: Floats zurÃ¼cknehmen, Bild vollbreit */
@media (max-width: 720px) {

  .ed-editor .ed-align-left,
  .ed-editor .ed-align-right {
    float: none;
    display: block;
    margin: 10px auto;
  }

  .ed-editor .ed-imgwrap img {
    width: 100% !important;
  }
}

/* ===== Editor: Bild-Umfluss mit shape-outside ===== */
.ed-editor .ed-imgwrap {
  display: inline-block;
  max-width: 100%;
}

.ed-editor .ed-imgwrap img {
  display: block;
  height: auto;
}

/* Ausrichtung (Float) wie gehabt */
.ed-editor .ed-align-left {
  float: left;
  margin: 0 14px 10px 0;
}

.ed-editor .ed-align-right {
  float: right;
  margin: 0 0 10px 14px;
}

.ed-editor .ed-align-center {
  float: none;
  display: block;
  margin: 10px auto;
  text-align: center;
}

/* Enger Umfluss: Rund / Abgerundet */
.ed-editor .ed-shape-circle {
  /* Radius via --shape-r (30â€“60%), Default 50% */
  --shape-r: 50%;
  shape-outside: circle(var(--shape-r) at 50% 50%);
  shape-margin: 12px;
}

.ed-editor .ed-shape-rounded {
  /* Abgerundetes Rechteck */
  --shape-r: 18%;
  shape-outside: inset(0 round var(--shape-r));
  shape-margin: 12px;
}

/* Floats rÃ¤umen */
.ed-editor::after {
  content: "";
  display: block;
  clear: both;
}

/* Toolbar-Kleinkram */
.ed-imgbar {
  user-select: none;
}

.ed-imgbar * {
  user-select: none;
}

.ed-label {
  font-size: .9rem;
  opacity: .8;
  margin-right: 6px;
}

.ed-group {
  display: inline-flex;
  gap: 6px;
  vertical-align: middle;
  margin: 0 8px;
}

.ed-small {
  font-size: .9rem;
  opacity: .9;
  display: inline-flex;
  align-items: center;
  gap: 6px;
}

.ed-shape-range {
  vertical-align: middle;
  width: 120px;
}

/* Mobil: Floats & Shapes & Absolute Positionierung abschalten â†’ Bild vollbreit */
@media (max-width: 720px) {

  .ed-editor .ed-align-left,
  .ed-editor .ed-align-right {
    float: none;
    display: block;
    margin: 10px auto;
  }

  /* Reset fÃ¼r absolut positionierte (floating) Bilder */
  .ed-editor .ed-imgwrap.ed-floating {
    position: static !important;
    left: auto !important;
    top: auto !important;
    transform: none !important;
    margin: 10px auto;
    width: auto !important; /* Wrapper passt sich an */
    max-width: 100%;
  }

  .ed-editor .ed-imgwrap {
    shape-outside: none;
  }

  .ed-editor .ed-imgwrap img {
    width: 100% !important;
    height: auto !important;
  }
}

/* ===== Neue Editor-Elemente (Word-Ã¤hnlich) ===== */
/* Dropdowns fÃ¼r Schriftart und SchriftgrÃ¶ÃŸe */
.ed-select {
  font-size: .9rem;
  padding: .35rem .5rem;
  border: 1px solid #3a424f;
  border-radius: 8px;
  background: #1f2630;
  color: #fff;
  cursor: pointer;
  min-width: 120px;
}

.ed-select:hover {
  background: #293240;
}

body:not(.dark) .ed-select {
  background: #fff;
  color: #111;
  border-color: #d0d0d0;
}

body:not(.dark) .ed-select:hover {
  background: #f4f4f4;
}

/* FarbwÃ¤hler (Color Picker) */
.ed-color {
  width: 40px;
  height: 32px;
  border: 1px solid #3a424f;
  border-radius: 8px;
  cursor: pointer;
  padding: 2px;
}

body:not(.dark) .ed-color {
  border-color: #d0d0d0;
}

/* Tabellen im Editor */
.ed-editor table {
  border-collapse: collapse;
  width: 100%;
  margin: 10px 0;
  border: 1px solid #ccc;
}

.ed-editor table td,
.ed-editor table th {
  padding: 8px;
  border: 1px solid #ccc;
  min-width: 50px;
}

.ed-editor table th {
  background: #f0f0f0;
  font-weight: 600;
}

body.dark .ed-editor table {
  border-color: #3a424f;
}

body.dark .ed-editor table td,
body.dark .ed-editor table th {
  border-color: #3a424f;
}

body.dark .ed-editor table th {
  background: #2d3748;
}
/* Widget Lösch-Button */
.ed-widget { position: relative; }
.ed-widget-remove {
  position: absolute;
  top: -10px; right: -10px;
  background: red; color: white;
  width: 24px; height: 24px;
  border-radius: 50%;
  text-align: center;
  line-height: 24px;
  cursor: pointer;
  z-index: 100;
  font-weight: bold;
  box-shadow: 0 2px 5px rgba(0,0,0,0.3);
  display: none; /* Erst mal verstecken, nur beim Hover zeigen? Oder dauerhaft? */
}
.ed-widget:hover .ed-widget-remove { display: block; }

