/* -------------------------------------------------------------
   Rechtstext-Verwaltung (mod_rechtliches)
   Grundlayout/Historie-Tabelle 1:1 vom Muster in mod_emailtexte.css
   übernommen (Select oben, links Historie, rechts Editor) - hier
   zusätzlich Editor-Toolbar, Vorschau- und Altversion-Anzeige.
   ------------------------------------------------------------- */

/* Titelzeile ganz oben - Kartenoptik nach dem Muster von
   #themen-titel-zeile (mod_themen.css), siehe Auftrag "Titelzeilen
   vereinheitlichen". Markup war schon vorhanden, hier bisher aber
   ohne CSS und ohne Anbindung - Meldungen liefen bislang an
   #rl-editor-meldung im inneren Editor-Panel vorbei (siehe
   js/mod_rechtliches.js, rl_meldung()). */
#rl-titel-zeile {
	display: flex;
	align-items: center;
	gap: .75rem;
	background: var(--bg-panel);
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: .8rem 1rem;
	margin-bottom: 1rem;
}

#rl-titel-zeile h2 {
	margin: 0;
	flex: 0 0 auto;
}

#rl-meldung {
	flex: 1 1 auto;
	justify-content: center;
	text-align: center;
	min-width: 0;
}

#rl-typ-auswahl {
	margin-bottom: 1rem;
}

#rl-typ-auswahl label {
	display: block;
	font-size: .85rem;
	color: var(--text-muted);
	margin-bottom: .25rem;
}

#rl-typ-select {
	width: 100%;
	max-width: 420px;
}

/* Layout: ca. 30:70, wie mod_emailtexte per flex statt Grid, damit
   die rechte Spalte bei fehlendem Inhalt (Select leer) nicht springt */
#rl-layout {
	display: flex;
	gap: 1.5rem;
	align-items: flex-start;
}

#rl-links {
	flex: 0 0 30%;
	min-width: 220px;
}

#rl-links h3 {
	margin-top: 0;
}

#rl-historie-wrap {
	max-height: 420px;
	overflow-y: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius);
}

#rl-historie {
	border-collapse: collapse;
	width: 100%;
	font-size: .85rem;
}

#rl-historie th {
	background: var(--bg-table-head);
	border-bottom: 1px solid var(--border);
	padding: .35rem .5rem;
	text-align: left;
	font-weight: bold;
	position: sticky;
	top: 0;
}

#rl-historie td {
	border-bottom: 1px solid var(--border);
	padding: .35rem .5rem;
	vertical-align: middle;
}

#rl-historie tbody tr {
	cursor: pointer;
	transition: background var(--transition);
}

#rl-historie tbody tr:hover {
	background: rgba(59,130,246,.07);
}

#rl-historie tbody tr.ausgewaehlt {
	background: rgba(59,130,246,.13);
}

#rl-historie .rl-status-aktiv {
	color: var(--msg-ok-text);
	font-weight: bold;
}

#rl-historie .btn-rl-drucken {
	padding: .1rem .4rem;
	font-size: .85rem;
}

/* Rechte Spalte */
#rl-rechts {
	flex: 1 1 0;
	min-width: 0;
}

#rl-editor-leer {
	color: var(--text-muted);
	font-size: .9rem;
	padding: .5rem 0;
}

#rl-editor-wrap label,
#rl-alt-wrap label {
	display: block;
	font-size: .85rem;
	color: var(--text-muted);
	margin-bottom: .2rem;
	margin-top: .75rem;
}

#rl-titel {
	width: 100%;
}

/* -------------------------------------------------------------
   Mini-Toolbar - bewusst schmal, umbricht auf kleinen Bildschirmen
   statt horizontal zu scrollen
   ------------------------------------------------------------- */
#rl-toolbar {
	display: flex;
	flex-wrap: wrap;
	gap: .3rem;
	margin-bottom: .3rem;
}

#rl-toolbar button,
#rl-toolbar select {
	min-height: 34px;
	min-width: 34px;
	padding: .25rem .5rem;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	background: var(--bg-panel);
	color: var(--text-base);
	cursor: pointer;
	font-size: .85rem;
}

#rl-toolbar button:hover {
	background: var(--bg-hover);
}

#rl-toolbar button strong,
#rl-toolbar button em {
	color: inherit;
}

#rl-editor {
	min-height: 320px;
	max-height: 60vh;
	overflow-y: auto;
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: .75rem;
	background: var(--bg-panel);
}

#rl-editor:focus {
	outline: 2px solid var(--btn-bg);
	outline-offset: -1px;
}

#rl-editor h2 { font-size: 1.2rem; margin: .6rem 0 .3rem; }
#rl-editor h3 { font-size: 1.05rem; margin: .5rem 0 .3rem; }
#rl-editor h4 { font-size: 1rem; margin: .4rem 0 .3rem; }
#rl-editor p  { margin: 0 0 .6rem; }
#rl-editor ul, #rl-editor ol { margin: 0 0 .6rem 1.4rem; }

/* -------------------------------------------------------------
   Vorschau / Altversion-Anzeige - identische Innendarstellung wie
   der Editor (ohne contenteditable), damit "was man sieht" zum
   späteren gespeicherten/gedruckten Ergebnis passt
   ------------------------------------------------------------- */
.rl-inhalt-anzeige {
	border: 1px solid var(--border);
	border-radius: var(--radius);
	padding: .75rem;
	background: var(--bg-panel);
}

.rl-inhalt-anzeige h2 { font-size: 1.2rem; margin: .6rem 0 .3rem; }
.rl-inhalt-anzeige h3 { font-size: 1.05rem; margin: .5rem 0 .3rem; }
.rl-inhalt-anzeige h4 { font-size: 1rem; margin: .4rem 0 .3rem; }
.rl-inhalt-anzeige p  { margin: 0 0 .6rem; }
.rl-inhalt-anzeige ul, .rl-inhalt-anzeige ol { margin: 0 0 .6rem 1.4rem; }

#rl-vorschau-box {
	margin-top: 1rem;
}

#rl-vorschau-box h4 {
	margin-bottom: .3rem;
}

/* Responsive: Historie über dem Editor, kein horizontales Scrollen */
@media (max-width: 640px) {
	#rl-layout {
		flex-direction: column;
	}
	#rl-links {
		flex: none;
		width: 100%;
	}
	#rl-editor {
		max-height: 45vh;
	}
}
