/* ── Umbruch langer Wörter ── */

/* Lange Zeichenketten ohne Leerzeichen (Dateinamen, Inline-Code, URLs) umbrechen. „anywhere“ statt „break-word“,
   weil nur so auch die Mindestbreite sinkt und der Text die Flex-Spalten daneben nicht zusammendrückt. */
.oo-richtext,
.jodit-wysiwyg {
    overflow-wrap: anywhere;
}

/* Tabellen scrollen horizontal (siehe unten) – Zellen nicht zeichenweise zerlegen */
.oo-richtext table,
.jodit-wysiwyg table {
    overflow-wrap: normal;
}

/* ── Basis Abstände ── */

.oo-richtext p,
.jodit-wysiwyg p {
    margin: 0 0 0.5rem 0;
}

.oo-richtext p:last-child,
.jodit-wysiwyg p:last-child {
    margin-bottom: 0;
}

/* ── Überschriften ── */

.oo-richtext h1,
.oo-richtext h2,
.oo-richtext h3,
.oo-richtext h4,
.oo-richtext h5,
.oo-richtext h6,
.jodit-wysiwyg h1,
.jodit-wysiwyg h2,
.jodit-wysiwyg h3,
.jodit-wysiwyg h4,
.jodit-wysiwyg h5,
.jodit-wysiwyg h6 {
    margin-top: 1rem;
    margin-bottom: 0.4rem;
    color: #2c3e50;
    padding: 0.35rem 0.75rem;
    border-radius: 4px;
}

.oo-richtext h1,
.jodit-wysiwyg h1 {
    background-color: rgba(52, 152, 219, 0.05);
    border-left: 4px solid rgba(52, 152, 219, 0.25);
}

.oo-richtext h2,
.jodit-wysiwyg h2 {
    background-color: rgba(52, 152, 219, 0.04);
    border-left: 4px solid rgba(52, 152, 219, 0.2);
}

.oo-richtext h3,
.jodit-wysiwyg h3 {
    background-color: rgba(52, 152, 219, 0.03);
    border-left: 3px solid rgba(52, 152, 219, 0.15);
}

.oo-richtext h4,
.jodit-wysiwyg h4 {
    background-color: transparent;
    border-left: 3px solid rgba(52, 152, 219, 0.12);
}

.oo-richtext h5,
.jodit-wysiwyg h5 {
    background-color: transparent;
    border-left: 2px solid rgba(52, 152, 219, 0.1);
}

.oo-richtext h6,
.jodit-wysiwyg h6 {
    background-color: transparent;
    border-left: 2px solid rgba(52, 152, 219, 0.07);
}


/* ── Listen ── */

.oo-richtext ul,
.oo-richtext ol,
.jodit-wysiwyg ul,
.jodit-wysiwyg ol {
    margin-top: 0.25rem;
    margin-bottom: 0.5rem;
    padding-left: 1rem;
}

.oo-richtext ul:first-child,
.oo-richtext ol:first-child,
.jodit-wysiwyg ul:first-child,
.jodit-wysiwyg ol:first-child {
    margin-top: 0;
}

.oo-richtext li,
.jodit-wysiwyg li {
    margin-bottom: 0.15rem;
}


/* ── Bilder ── */

.oo-richtext img,
.jodit-wysiwyg img {
    max-width: 100%;
    height: auto;
    border-radius: 8px;
    margin: 1.5rem 0;
}


/* ── Blockquote ── */

.oo-richtext blockquote,
.jodit-wysiwyg blockquote {
    border-left: 4px solid var(--oo-info);
    background-color: var(--oo-gray-100);
    padding: 0.4rem 1.25rem;
    margin: 0.75rem 0;
}


/* ── Tabellen ── */

/* Die Tabelle ist ein Block, damit sie auf schmalen Bildschirmen seitlich scrollt. Rahmen und Schatten sitzen am Block,
   die Zellen bilden darin eine eigene Tabelle in Inhaltsbreite. Eine Breite aus dem HTML (Jodit setzt beim Einfügen
   „width: 100%“, Word/Excel eigene Werte) würde nur den Block verbreitern – der Rahmen ginge dann über die Zellen hinaus.
   Deshalb gilt hier immer die Inhaltsbreite, höchstens so breit wie der Artikel; darüber hinaus scrollt die Tabelle. */
.oo-richtext table,
.jodit-wysiwyg table {
    display: block;
    width: fit-content !important;
    min-width: 0 !important;
    max-width: 100%;
    overflow-x: auto;
    overflow-y: hidden;
    -webkit-overflow-scrolling: touch;
    border-collapse: separate;
    border-spacing: 0;
    background: #fff;
    border: 1px solid #e0e0e0;
    border-radius: 8px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
    margin: 1.25rem 0;
}

/* ── Tabellenkopf ── */
.oo-richtext thead tr,
.jodit-wysiwyg thead tr {
    background: var(--oo-primary, #357abd);
    color: #fff;
}

.oo-richtext thead th,
.jodit-wysiwyg thead th {
    padding: 0.7rem 1rem;
    text-align: left;
    font-weight: 600;
    letter-spacing: 0.03em;
    white-space: nowrap;
    border-right: 1px solid rgba(255, 255, 255, 0.15);
    border-bottom: 2px solid var(--oo-primary-dark, #2a6199);
}

.oo-richtext thead th:last-child,
.jodit-wysiwyg thead th:last-child {
    border-right: none;
}

/* ── Tabellenkörper ── */
.oo-richtext tbody tr,
.jodit-wysiwyg tbody tr {
    transition: background 0.15s ease;
}

.oo-richtext tbody tr:nth-child(even),
.jodit-wysiwyg tbody tr:nth-child(even) {
    background: #f5f8fc;
}

.oo-richtext tbody tr:hover,
.jodit-wysiwyg tbody tr:hover {
    background: #e8f1fb;
}

.oo-richtext tbody tr:hover th,
.jodit-wysiwyg tbody tr:hover th {
    background: #d1e4f6;
}

.oo-richtext tbody th,
.jodit-wysiwyg tbody th {
    padding: 0.6rem 1rem;
    vertical-align: middle;
    text-align: left;
    font-weight: 600;
    white-space: nowrap;
    background: #f5f8fc;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.oo-richtext tbody td,
.jodit-wysiwyg tbody td {
    padding: 0.6rem 1rem;
    vertical-align: middle;
    border-right: 1px solid #e0e0e0;
    border-bottom: 1px solid #e0e0e0;
}

.oo-richtext tbody td:last-child,
.jodit-wysiwyg tbody td:last-child {
    border-right: none;
}

.oo-richtext tbody tr:last-child td,
.oo-richtext tbody tr:last-child th,
.jodit-wysiwyg tbody tr:last-child td,
.jodit-wysiwyg tbody tr:last-child th {
    border-bottom: none;
}

/* ── Tabellenfuß ── */
.oo-richtext tfoot tr,
.jodit-wysiwyg tfoot tr {
    background: #f0f0f0;
    font-weight: 600;
}

.oo-richtext tfoot td,
.jodit-wysiwyg tfoot td {
    padding: 0.65rem 1rem;
    border-right: 1px solid #e0e0e0;
    border-top: 2px solid #ccc;
}

.oo-richtext tfoot td:last-child,
.jodit-wysiwyg tfoot td:last-child {
    border-right: none;
}

/* ── Ausrichtungs-Hilfsklassen ── */
.oo-richtext th.text-right,
.oo-richtext td.text-right,
.jodit-wysiwyg th.text-right,
.jodit-wysiwyg td.text-right {
    text-align: right;
}

.oo-richtext th.text-center,
.oo-richtext td.text-center,
.jodit-wysiwyg th.text-center,
.jodit-wysiwyg td.text-center {
    text-align: center;
}
