/* =============================================================
   SimpliMed Termin-Popup – Frontend CSS
   Entwickelt von SottMedia
   ============================================================= */

/* ------ Trigger-Button (Shortcode ohne Divi-Klasse) ---------- */
.smtp-trigger-btn {
	display: inline-flex;
	align-items: center;
	gap: .45em;
	padding: .75em 1.5em;
	font-size: 1rem;
	font-family: inherit;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	border: 2px solid currentColor;
	border-radius: 4px;
	background: transparent;
	transition: background .2s, color .2s, transform .1s;
}
.smtp-trigger-btn:hover {
	opacity: .85;
}
.smtp-trigger-btn:active {
	transform: scale(.97);
}
.smtp-trigger-btn:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 3px;
}

/* Icon innerhalb des Buttons */
.smtp-btn-icon {
	font-size: 1.1em;
}

/* ------ Inline-Wrapper (kein Modal) -------------------------- */
.smtp-inline-wrap {
	width: 100%;
	overflow: hidden;
	border-radius: 10px;
	box-shadow: 0 6px 24px rgba(0,0,0,.10);
}
.smtp-inline-wrap .smtp-iframe {
	display: block;
	border: none;
	width: 100%;
	min-height: 550px; /* SimpliMed-Mindesthöhe */
}

/* ------ Modal Overlay --------------------------------------- */
.smtp-modal {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;          /* JS setzt display:flex wenn offen */
	align-items: center;
	justify-content: center;
	padding: 12px;
}

/* Geöffneter Zustand (via JS-Klasse) */
.smtp-modal.smtp-is-open {
	display: flex;
}

/* Hintergrund-Abdunklung */
.smtp-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .60);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	cursor: pointer;
	animation: smtp-fade-in .2s ease;
}

/* ------ Modal-Panel ----------------------------------------- */
.smtp-modal__panel {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	/* SimpliMed rendert intern auf ~540px – Panel knapp drüber damit kein Leerraum */
	width: min(600px, calc(100vw - 24px));
	max-height: min(92vh, 860px);
	background: #ffffff;
	border-radius: 16px;
	box-shadow: 0 20px 60px rgba(0,0,0,.30);
	overflow: hidden;
	animation: smtp-slide-up .25s cubic-bezier(.22,.61,.36,1);
}

/* Header */
.smtp-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid rgba(0,0,0,.10);
	flex-shrink: 0;
	background: #fff;
}

.smtp-modal__title {
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
	display: flex;
	align-items: center;
	gap: .4em;
	line-height: 1.2;
}

.smtp-modal__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border: none;
	border-radius: 50%;
	background: rgba(0,0,0,.06);
	color: inherit;
	cursor: pointer;
	flex-shrink: 0;
	transition: background .18s;
}
.smtp-modal__close:hover {
	background: rgba(0,0,0,.12);
}
.smtp-modal__close:focus-visible {
	outline: 3px solid currentColor;
	outline-offset: 2px;
}

/* Body: iFrame-Bereich */
.smtp-modal__body {
	flex: 1 1 auto;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	padding: 0; /* kein Padding – iFrame soll voll ausfüllen */
	background: #f5f5f5;
}

.smtp-modal__body .smtp-iframe {
	display: block;
	border: none;
	width: 100%;
	flex: 1 1 auto;
	/* Höhe dynamisch: Panel-Höhe minus Header (~57px) minus Footer (~41px) */
	height: calc(min(92vh, 860px) - 57px - 41px);
	min-height: 550px; /* SimpliMed-Mindesthöhe laut Doku */
}

/* Footer */
.smtp-modal__footer {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 10px 20px;
	border-top: 1px solid rgba(0,0,0,.08);
	font-size: .8rem;
	color: rgba(0,0,0,.45);
	flex-shrink: 0;
	background: #fff;
}

.smtp-privacy-link {
	color: inherit;
	text-decoration: underline;
}
.smtp-privacy-link:hover {
	opacity: .7;
}

/* ------ Animationen ----------------------------------------- */
@keyframes smtp-fade-in {
	from { opacity: 0; }
	to   { opacity: 1; }
}
@keyframes smtp-slide-up {
	from { opacity: 0; transform: translateY(24px); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ------ Body-Lock wenn Modal offen -------------------------- */
body.smtp-modal-open {
	overflow: hidden;
}

/* ------ Responsiv ------------------------------------------- */
@media (max-width: 640px) {
	.smtp-modal {
		padding: 0;
		align-items: flex-end;   /* Bottom-Sheet von unten */
	}
	.smtp-modal__panel {
		border-radius: 20px 20px 0 0;
		max-height: 92vh;
		width: 100%;
		animation: smtp-slide-up-mobile .3s cubic-bezier(.22,.61,.36,1);
	}
	.smtp-modal__header {
		padding: 14px 16px 12px;
	}
	.smtp-modal__title {
		font-size: 1rem;
	}
	.smtp-modal__body .smtp-iframe {
		height: calc(92vh - 57px - 41px);
		min-height: 420px;  /* Auf 375px Geräten etwas flexibler */
	}
	.smtp-modal__footer {
		padding: 8px 16px;
		font-size: .75rem;
	}
}

/* Schmale Geräte (375px iPhone SE etc.) */
@media (max-width: 390px) {
	.smtp-modal__title {
		font-size: .9rem;
	}
	.smtp-modal__body .smtp-iframe {
		min-height: 400px;
	}
}

@keyframes smtp-slide-up-mobile {
	from { opacity: 0; transform: translateY(100%); }
	to   { opacity: 1; transform: translateY(0); }
}

/* ------ Divi-Kompatibilität: .et_pb_button Override --------- */
/*
 * Wenn der User class="et_pb_button" angibt, greift Divi-Styling.
 * Diese Regel stellt sicher, dass der Klick-Handler trotzdem funktioniert.
 * Kein optisches Override – das Styling überlässt Divi.
 */
.et_pb_button.smtp-trigger-btn {
	cursor: pointer;
}
