/**
 * NMW Termine – Frontend- und Admin-Styles.
 *
 * Gescoptes CSS mit Präfix "nmw-termine". Alle Gestaltungsvariablen sind als
 * CSS Custom Properties auf :root definiert und können von Kunden-Themes
 * einfach überschrieben werden (z. B. im Customizer per "Zusätzliches CSS").
 */

:root {
	--nmw-termine-accent: #2563eb;
	--nmw-termine-accent-hover: #1d4ed8;
	--nmw-termine-text: #1f2933;
	--nmw-termine-text-muted: #64748b;
	--nmw-termine-card-bg: #ffffff;
	--nmw-termine-border: #e2e8f0;
	--nmw-termine-radius: 8px;
	--nmw-termine-shadow: 0 1px 3px rgba(15, 23, 42, 0.08);
	--nmw-termine-shadow-hover: 0 6px 16px rgba(15, 23, 42, 0.12);
	--nmw-termine-gap: 24px;
	--nmw-termine-button-text: #ffffff;
}

/* ==========================================================================
   Terminliste
   ========================================================================== */

.nmw-termine-liste {
	box-sizing: border-box;
}

.nmw-termine-liste *,
.nmw-termine-liste *::before,
.nmw-termine-liste *::after,
.nmw-termine-detail *,
.nmw-termine-detail *::before,
.nmw-termine-detail *::after {
	box-sizing: border-box;
}

.nmw-termine-liste-items {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: var(--nmw-termine-gap);
	margin: 0 0 24px;
	padding: 0;
	list-style: none;
}

/* Alternative "Liste"-Darstellung: statt Grid-Kacheln volle Breite,
   Termine übereinander mit Bild links, Inhalt rechts. Wahlweise per
   Shortcode-Attribut ansicht="liste" oder im Divi-"Terminliste"-Modul
   unter "Darstellung" aktivierbar (Standard: Grid). */
.nmw-termine-liste-items--liste {
	grid-template-columns: 1fr;
}

.nmw-termine-liste-items--liste .nmw-termine-karte-link {
	flex-direction: row;
}

.nmw-termine-liste-items--liste .nmw-termine-karte-bild {
	flex: 0 0 180px;
	padding: 0;
}

.nmw-termine-liste-items--liste .nmw-termine-karte-bild img {
	width: 180px;
	height: 100%;
}

.nmw-termine-liste-items--liste .nmw-termine-karte-inhalt {
	flex: 1;
	justify-content: center;
}

.nmw-termine-monat {
	grid-column: 1 / -1;
	margin: 32px 0 4px;
	padding-bottom: 8px;
	border-bottom: 2px solid var(--nmw-termine-border);
	color: var(--nmw-termine-text);
	font-size: 1.25em;
	font-weight: 700;
}

.nmw-termine-liste-items .nmw-termine-monat:first-child {
	margin-top: 0;
}

.nmw-termine-liste-mehr {
	text-align: center;
	margin: 16px 0 0;
}

/* ==========================================================================
   Terminkarte
   ========================================================================== */

.nmw-termine-karte {
	background: var(--nmw-termine-card-bg);
	border: 1px solid var(--nmw-termine-border);
	border-radius: var(--nmw-termine-radius);
	box-shadow: var(--nmw-termine-shadow);
	overflow: hidden;
	transition: box-shadow 0.2s ease, transform 0.2s ease;
}

.nmw-termine-karte:hover,
.nmw-termine-karte:focus-within {
	box-shadow: var(--nmw-termine-shadow-hover);
	transform: translateY(-2px);
}

.nmw-termine-karte-link {
	display: flex;
	flex-direction: column;
	height: 100%;
	color: inherit;
	text-decoration: none;
}

.nmw-termine-karte-bild {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	background: color-mix(in srgb, var(--nmw-termine-accent) 8%, transparent);
}

.nmw-termine-karte-bild svg {
	height: 48px;
	width: auto;
	max-width: 100%;
}

/* Raster-Terminbilder (JPG/PNG/WEBP) wollen randabschneidend statt als
   freigestelltes Icon dargestellt werden – kein Innenabstand/Hintergrund. */
.nmw-termine-karte-bild:has(img) {
	padding: 0;
	background: none;
}

.nmw-termine-karte-bild img {
	width: 100%;
	height: 160px;
	object-fit: cover;
	display: block;
}

.nmw-termine-karte-inhalt {
	padding: 16px 18px 20px;
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.nmw-termine-titel {
	margin: 4px 0 0;
	font-size: 1.1em;
	line-height: 1.35;
	color: var(--nmw-termine-text);
}

.nmw-termine-feld-datum,
.nmw-termine-feld-uhrzeit,
.nmw-termine-feld-enddatum,
.nmw-termine-feld-end-uhrzeit,
.nmw-termine-feld-ort,
.nmw-termine-feld-kategorie {
	margin: 0;
	font-size: 0.9em;
	color: var(--nmw-termine-text-muted);
}

/* Icon vor Datum/Uhrzeit/Ort im nativen "Termin Feld"-Divi-Modul (nur dort
   wählbar, siehe includes/divi5/class-nmw-termine-d5-feld.php). */
.nmw-termine-d5-feld-wrapper {
	display: flex;
	align-items: center;
	gap: 6px;
}

.nmw-termine-feld-icon.et-pb-icon {
	flex-shrink: 0;
	font-size: 1.3em;
	line-height: 1;
}

.nmw-termine-feld-icon-svg {
	display: inline-flex;
	flex-shrink: 0;
}

.nmw-termine-feld-icon-svg svg {
	height: 1.3em;
	width: auto;
}

.nmw-termine-karte-zeit {
	display: flex;
	flex-wrap: wrap;
	gap: 2px 10px;
}

.nmw-termine-karte-badge {
	align-self: flex-start;
	margin: 0;
	padding: 2px 10px;
	border-radius: 999px;
	font-size: 0.75em;
	font-weight: 600;
	background: color-mix(in srgb, var(--nmw-termine-accent) 15%, transparent);
	color: var(--nmw-termine-accent);
}

.nmw-termine-feld-bild svg {
	height: 64px;
	width: auto;
	max-width: 100%;
}

.nmw-termine-feld-bild img {
	max-width: 100%;
	height: auto;
	border-radius: var(--nmw-termine-radius);
}

.nmw-termine-feld-ort a {
	color: inherit;
	text-decoration: underline;
}

/* ==========================================================================
   Buttons
   ========================================================================== */

.nmw-termine-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 6px;
	padding: 10px 20px;
	background: var(--nmw-termine-accent);
	color: var(--nmw-termine-button-text);
	border: none;
	border-radius: var(--nmw-termine-radius);
	font-size: 0.95em;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.nmw-termine-button:hover,
.nmw-termine-button:focus {
	background: var(--nmw-termine-accent-hover);
	color: var(--nmw-termine-button-text);
}

.nmw-termine-button:disabled,
.nmw-termine-button[disabled] {
	opacity: 0.6;
	cursor: not-allowed;
	background: var(--nmw-termine-accent);
}

/* ==========================================================================
   Detailansicht
   ========================================================================== */

.nmw-termine-detail {
	max-width: 760px;
	margin: 0 auto;
}

.nmw-termine-detail-bild {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 32px;
	margin-bottom: 24px;
	border-radius: var(--nmw-termine-radius);
	background: color-mix(in srgb, var(--nmw-termine-accent) 8%, transparent);
}

.nmw-termine-detail-bild svg {
	height: 96px;
	width: auto;
	max-width: 100%;
}

.nmw-termine-detail-bild:has(img) {
	padding: 0;
	background: none;
}

.nmw-termine-detail-bild img {
	width: 100%;
	height: 280px;
	object-fit: cover;
	display: block;
	border-radius: var(--nmw-termine-radius);
}

.nmw-termine-detail-titel {
	margin: 0 0 16px;
	font-size: 1.75em;
	line-height: 1.3;
	color: var(--nmw-termine-text);
}

.nmw-termine-detail-meta {
	display: flex;
	flex-wrap: wrap;
	gap: 8px 20px;
	margin-bottom: 24px;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--nmw-termine-border);
}

.nmw-termine-detail-meta p {
	margin: 0;
	color: var(--nmw-termine-text-muted);
}

.nmw-termine-detail-text {
	margin-bottom: 28px;
	color: var(--nmw-termine-text);
	line-height: 1.65;
}

.nmw-termine-detail-aktionen {
	display: flex;
	flex-wrap: wrap;
	gap: 12px;
}

/* ==========================================================================
   Admin: Meta-Box PDF-Feld + Kategorie-Icon-Vorschau
   ========================================================================== */

.nmw-termine-pdf-field {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
}

.nmw-termine-pdf-field .nmw-termine-pdf-filename {
	margin: 0;
	flex-basis: 100%;
	color: var(--nmw-termine-text-muted);
}

.nmw-termine-bild-vorschau img {
	max-width: 150px;
	height: auto;
	display: block;
	margin-bottom: 8px;
	border-radius: var(--nmw-termine-radius);
}

.nmw-termine-weitere-zeile {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-bottom: 8px;
}

.nmw-termine-weitere-entfernen {
	color: #b32d2e;
	font-size: 1.2em;
	line-height: 1;
	text-decoration: none;
}

.nmw-termine-kat-icon-preview {
	margin: 0 0 8px;
}

.nmw-termine-kat-icon-preview svg,
.nmw-termine-kat-icon-preview img {
	max-height: 60px;
	max-width: 100%;
	width: auto;
	height: auto;
}

/* ==========================================================================
   Mobil
   ========================================================================== */

@media (max-width: 480px) {
	.nmw-termine-liste-items {
		grid-template-columns: 1fr;
	}

	.nmw-termine-liste-items--liste .nmw-termine-karte-link {
		flex-direction: column;
	}

	.nmw-termine-liste-items--liste .nmw-termine-karte-bild {
		flex-basis: auto;
	}

	.nmw-termine-liste-items--liste .nmw-termine-karte-bild img {
		width: 100%;
		height: 160px;
	}

	.nmw-termine-detail-aktionen {
		flex-direction: column;
		align-items: stretch;
	}
}
