/*
 * The property excerpt is rendered as a <p> (skins/bootstrap3/single/excerpt.php).
 * Divi's reset `p:not(.has-background):last-of-type { padding-bottom: 0 }`
 * (specificity 0,2,1) outranks the skin's `.immomakler-single
 * .immomakler-property-excerpt` rule (0,2,0) and strips the excerpt box's
 * bottom padding when it's the last <p> in its container. Restore it with a
 * higher-specificity selector (0,3,1).
 */
.immomakler-single p.immomakler-property-excerpt:last-of-type {
	padding-bottom: 1rem;
}

.immomakler-virtual-tour,
.immomakler_single_virtual_tours .immomakler-media-list__item {
	width: 100%;
	border-style: solid;
}

.immomakler-contact-box {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	gap: 1rem;
}

.immomakler-contact-photo,
.immomakler-contact-photo img {
	width: 160px;
	height: 240px;
}
.immomakler-contact-photo img {
	object-fit: cover;
}

.immomakler-contact-data {
	display: grid;
	grid-template-columns: auto 1fr;
	column-gap: 1rem;
	row-gap: .5rem;
	flex: 1 1 195px;
	min-width: 195px;
}

dl.immomakler-contact-data {
	margin: 0;
}

.immomakler-contact-data dt {
	font-weight: 600;
}

.immomakler-contact-data dd {
	margin: 0;
}

.immomakler-visually-hidden-labels dt {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	border: 0;
}

.immomakler-visually-hidden-labels {
	display: block;
}

.immomakler-visually-hidden-labels dd {
	display: block;
}

/* ── Eckdaten-Boxen (immomakler/single-data-boxes) ─────────────────────────── */

.immomakler-data-boxes {
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.immomakler-data-box {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	min-width: 80px;
}

.immomakler-data-box__content {
	margin: 0;
	width: 100%;
}

.immomakler-data-box__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 0.4em;
}

.immomakler-data-box__icon svg {
	width: 28px;
	height: 28px;
}

.immomakler-data-box__label {
	font-size: 0.8em;
	opacity: 0.7;
	margin: 0;
}

.immomakler-data-box__value {
	font-weight: 600;
	margin: 0;
}

.immomakler-data-box--inline .immomakler-data-box__content {
	display: flex;
	align-items: center;
	gap: 0.4em;
}

.immomakler-data-separator {
	align-self: center;
	opacity: 0.5;
	padding: 0 0.1em;
	user-select: none;
	flex-shrink: 0;
}

/* ── Eckdaten-Icon-Liste (immomakler/single-icon-list) ──────────────────────── */

.immomakler-icon-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 1em;
	list-style: none;
	margin: 0;
	padding: 0;
}

.immomakler-icon-list-item {
	display: flex;
	align-items: center;
	gap: 0.4em;
}

.immomakler-icon-list-icon {
	display: flex;
	align-items: center;
	flex-shrink: 0;
}

.immomakler-icon-list-icon svg {
	width: 1em;
	height: 1em;
}

.immomakler-icon-list-value {
	white-space: nowrap;
}

/* ── PDF Exposé Button (immomakler/single-pdf-button) ───────────────────────── */

/*
 * The module's Background, Border and Spacing style its wrapper, which is
 * what visitors see as the button, so the link fills it: the whole button is
 * clickable, not just its text.
 */
.immomakler-pdf-button {
	display: block;
	box-sizing: border-box;
	padding: 0.6em 1.4em;
	color: inherit;
	text-decoration: none;
	border-radius: 3px;
	font-weight: 600;
	transition: opacity 0.2s ease;
}

.immomakler-pdf-button:hover {
	color: inherit;
	text-decoration: none;
	opacity: 0.85;
}

/* ── Downloads & Links (immomakler/single-downloads-links) ──────────────────── */

.immomakler-dl-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.immomakler-dl-item {
	display: flex;
	align-items: center;
	gap: 0.5em;
	margin-bottom: 8px;
}

.immomakler-dl-item:last-child {
	margin-bottom: 0;
}

.immomakler-dl-icon.et-pb-icon {
	font-size: 1em;
	flex-shrink: 0;
}

.immomakler-dl-link {
	text-decoration: none;
}

.immomakler-dl-link:hover {
	text-decoration: underline;
}

/* ── Definition-Listen (single-data, single-data-areas, etc.) ───────────────── */

/*
 * Grid: parent sets two named columns; each row uses subgrid so all rows share
 * the same column widths — values align even when label lengths differ.
 * The row div stays a real box (not display:contents) so a full-width
 * border-top on the row creates a continuous divider line.
 */
.immomakler-divi5-dl {
	display: grid;
	/*
	 * First track: var(--immomakler-dl-label-width) when the user sets a column
	 * width (Spaltenbreite slider); falls back to max-content (natural label width).
	 * Setting the var on the <dl> element directly controls the track, because
	 * subgrid rows inherit parent tracks — min-width on <dt> cannot change them.
	 */
	grid-template-columns: var(--immomakler-dl-label-width, max-content) 1fr;
	column-gap: 1rem;
	row-gap: 0.4rem;
	margin: 0;
}

.immomakler-divi5-dl-row {
	display: grid;
	grid-column: 1 / -1;
	grid-template-columns: subgrid;
	align-items: baseline;
}

.immomakler-divi5-dl dt {
	font-weight: 600;
}

.immomakler-divi5-dl dd {
	margin: 0;
}

/* no-labels: single-column, revert to block flow */
.immomakler-divi5-dl--no-labels {
	display: block;
}

.immomakler-divi5-dl--no-labels .immomakler-divi5-dl-row {
	display: block;
	margin-bottom: 0.4rem;
}

.immomakler-divi5-dl--no-labels .immomakler-divi5-dl-row:last-child {
	margin-bottom: 0;
}

/* row dividers — continuous border across the full row width */
.immomakler-divi5-dl--dividers {
	row-gap: 0;
}

.immomakler-divi5-dl--dividers .immomakler-divi5-dl-row:not(:first-child) {
	border-top: 1px solid var(--immomakler-divider-color, rgba(0,0,0,0.15));
	padding-top: 0.5rem;
	margin-top: 0.5rem;
}

/* custom text color (all list text) and link color (only <a> elements) */
.immomakler-divi5-dl--custom-text-color {
	color: var(--immomakler-text-color);
}

.immomakler-divi5-dl--custom-link-color a {
	color: var(--immomakler-link-color);
}


/* ── Kontaktformular Farbanpassungen (immomakler/single-contact-form) ────────── */

/*
 * Override Bootstrap 3's .btn-primary with user-picked colors.
 * We omit the fallback intentionally: an undefined CSS custom property triggers
 * IACVT (invalid at computed value time), causing the browser to treat the
 * declaration as unset — so Bootstrap's own colors win when no color is chosen.
 */
.immomakler-contact-form-colors .btn-primary,
.immomakler-contact-form-colors .btn-primary:hover,
.immomakler-contact-form-colors .btn-primary:focus,
.immomakler-contact-form-colors .btn-primary:active,
.immomakler-contact-form-colors .btn-primary.active {
	/* stylelint-disable-next-line declaration-no-important */
	background-color: var(--immomakler-contact-btn-bg) !important;
	/* stylelint-disable-next-line declaration-no-important */
	border-color: var(--immomakler-contact-btn-bg) !important;
}

.immomakler-contact-form-colors .btn-primary,
.immomakler-contact-form-colors .btn-primary:hover,
.immomakler-contact-form-colors .btn-primary:focus,
.immomakler-contact-form-colors .btn-primary:active,
.immomakler-contact-form-colors .btn-primary.active {
	/* stylelint-disable-next-line declaration-no-important */
	color: var(--immomakler-contact-btn-text) !important;
}

.immomakler-contact-form-colors a {
	/* stylelint-disable-next-line declaration-no-important */
	color: var(--immomakler-contact-link) !important;
}

/* inline / one-liner: values side-by-side separated by · */
.immomakler-divi5-dl--inline {
	display: flex;
	flex-direction: row;
	flex-wrap: wrap;
	gap: 0;
}

.immomakler-divi5-dl--inline > div {
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.immomakler-divi5-dl--inline > div:not(:first-child)::before {
	content: "\00A0\00B7\00A0";
	opacity: 0.5;
}

/*
 * The Archive Search Form section must paint above the property-card loop section
 * that follows it in the DOM. Both sections default to z-index: auto (DOM order),
 * so the cards section (which comes later) would normally cover the search form's
 * Bootstrap-select dropdowns. Giving the search section an explicit stacking-context
 * z-index: 100 makes it win against the cards section (z-index: auto = 0).
 */
.et_pb_section:has(.immomakler_archive_search_form) {
	position: relative;
	z-index: 100;
}

.immomakler .bootstrap-select .dropdown-menu {
	z-index: 9999;
}

/* ── Suchformular (immomakler/archive-search-form) ──────────────────────────── */

/*
 * The search form renders as a full-width Bootstrap 3 form inside a Divi column.
 * Remove the Bootstrap row's negative margins so the form aligns flush with the
 * column edges and never scrolls horizontally in narrow layouts.
 */
.et_pb_module .immomakler form {
	width: 100%;
	max-width: 100%;
	overflow-x: hidden;
}

.et_pb_module .immomakler .row {
	margin-inline-start: 0;
	margin-inline-end: 0;
}

/*
 * Button row: allow buttons to wrap so they don't overflow a narrow column.
 * Clear Bootstrap row's negative margin on the panel-heading action bar.
 */
.et_pb_module .immomakler .panel-heading .search-actions.row {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
	margin-inline-start: 0;
	margin-inline-end: 0;
}

/*
 * Note: the legacy `.immomakler-grid-gallery` rules that used to live here
 * (auto-fill grid + image-cell sizing) are gone. The Divi Grid-Galerie module
 * (`Single_Grid_Gallery_Module`) now delegates rendering to the shared
 * gallery library — each preset ships its own stylesheet under
 * `assets/css/gallery/preset-*.css`, and Asset_Enqueuer enqueues the right
 * one based on the per-instance configuration.
 */

/*
 * Whole-card link. Give the module that holds the property link (usually the
 * card's heading) the CSS class `immomakler-card-link`: its link is stretched
 * over the surrounding column, so a click anywhere on a loop card opens the
 * property. It stays one real <a> -- reachable by keyboard, announced once,
 * and working for cards the AJAX search loads later, which Divi's own module
 * links (bound by script at page load) do not. Modules with their own links
 * or controls -- the gallery above all -- stay on top, so swiping and the
 * gallery controls keep working.
 */
.et_pb_column:has(> .immomakler-card-link) {
	position: relative;
}

.et_pb_module.immomakler-card-link,
.immomakler-card-link .et_pb_heading_container {
	position: static;
}

.immomakler-card-link a::after {
	content: "";
	position: absolute;
	inset: 0;
	z-index: 1;
}

/* stylelint-disable-next-line @stylistic/max-line-length */
.et_pb_column:has(> .immomakler-card-link) > :not(.immomakler-card-link):has(a, button, input, select, textarea) {
	position: relative;
	z-index: 2;
}

/*
 * Seitennavigation (Divi 5): result count and page links on one line,
 * wrapping on narrow screens. The current page takes the theme's primary
 * colour unless the module sets its own.
 */
.immomakler-divi5-pagination {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 1em;
}

.immomakler-divi5-pagination .immomakler-pagination-count {
	margin: 0;
	padding: 0;
}

.immomakler-divi5-pagination .immomakler-pagination-links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25em;
}

.immomakler-divi5-pagination .page-numbers {
	display: inline-block;
	min-width: 2.2em;
	padding: 0.3em 0.6em;
	border: 1px solid currentcolor;
	border-radius: 3px;
	text-align: center;
	text-decoration: none;
}

.immomakler-divi5-pagination .page-numbers.dots {
	border-color: transparent;
}

.immomakler-divi5-pagination .page-numbers.current {
	border-color: var(--immomakler-pagination-active, var(--gcid-primary-color, #2ea3f2));
	background-color: var(--immomakler-pagination-active, var(--gcid-primary-color, #2ea3f2));
	color: #fff;
}

.immomakler-divi5-pagination .screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip-path: inset(50%);
	white-space: nowrap;
}
