/**
 * Index Sticky Button - Overlay Styles
 * @package IndexStickyButton
 */

/* -----------------------------------------------
   Popover – Vollbild-Ebene mit Backdrop

   WICHTIG: display:flex darf NICHT im Basis-Selektor
   stehen, weil es das vom Browser gesetzte display:none
   für geschlossene Popovers überschreiben würde.
   Stattdessen wird display:flex nur über :popover-open
   aktiviert – also ausschließlich wenn das Popover
   tatsächlich offen ist.
   ----------------------------------------------- */
#isb-overlay-popover {
	border: none;
	padding: 0;
	margin: auto;
	background: transparent;
	width: 100%;
	height: 100%;
	max-width: 100vw;
	max-height: 100dvh;
	max-height: 100vh; /* Fallback für ältere Browser */
	overflow: visible;
}

#isb-overlay-popover:popover-open {
	display: flex;
	align-items: center;
	justify-content: center;
}

#isb-overlay-popover::backdrop {
	background: rgba(0, 0, 0, 0.65);
	backdrop-filter: blur(2px);
}

/* -----------------------------------------------
   Container – nutzt CSS-Custom-Properties,
   die per Inline-Style aus den Plugin-Einstellungen
   gesetzt werden (--isb-overlay-width / --isb-overlay-height)
   ----------------------------------------------- */
.isb-overlay-container {
	display: flex;
	flex-direction: column;
	width: var(--isb-overlay-width, 600px);
	max-width: calc(100vw - 2rem);         /* 32px */
	height: var(--isb-overlay-height, 80vh);
	max-height: calc(100dvh - 2rem);       /* 32px */
	max-height: calc(100vh - 2rem);        /* Fallback */
	background: #fff;
	border-radius: 0.75rem;                /* 12px */
	overflow: hidden;
	box-shadow: 0 1.5rem 4rem rgba(0, 0, 0, 0.35);  /* 0 24px 64px */
}

/* -----------------------------------------------
   Header mit Titel und Schließen-Button
   ----------------------------------------------- */
.isb-overlay-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 0.75rem;                          /* 12px */
	padding: 0.75rem 1rem;                 /* 12px 16px */
	border-bottom: 1px solid #e5e5e5;
	background: #fff;
	flex-shrink: 0;
}

.isb-overlay-title {
	font-size: 0.9375rem;                  /* 15px */
	font-weight: 600;
	color: #333;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* -----------------------------------------------
   Schließen-Button

   Vollständiger Reset gegen Theme-Überschreibungen:
   – appearance:none entfernt natives Browser-Button-Styling
   – !important auf allen visuellen Properties verhindert
     Theme-CSS (auch mit !important) bei gleicher oder
     niedrigerer Spezifität zu gewinnen
   – font-size:0 verhindert, dass Theme-Schriftgrößen
     den Button aufblähen (das Icon ist SVG, kein Text)
   – SVG-Icon ist font-unabhängig und überall identisch
   ----------------------------------------------- */
#isb-overlay-popover .isb-overlay-close {
	-webkit-appearance: none !important;
	appearance: none !important;
	box-sizing: border-box !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	flex-shrink: 0 !important;
	width: 2rem !important;                /* 32px */
	height: 2rem !important;              /* 32px */
	min-width: 0 !important;
	max-width: none !important;
	min-height: 0 !important;
	max-height: none !important;
	margin: 0 !important;
	padding: 0 !important;
	border: none !important;
	border-radius: 50% !important;
	background: #f0f0f1 !important;
	color: #333 !important;
	box-shadow: none !important;
	outline: none;
	text-decoration: none !important;
	font-size: 0 !important;
	font-weight: normal !important;
	letter-spacing: normal !important;
	text-transform: none !important;
	line-height: 1 !important;
	cursor: pointer !important;
	transition: background 0.2s ease, color 0.2s ease;
	vertical-align: middle !important;
	float: none !important;
	opacity: 1 !important;
	overflow: visible !important;
	position: static !important;
}

#isb-overlay-popover .isb-overlay-close:hover {
	background: #dcdcde !important;
	color: #000 !important;
}

#isb-overlay-popover .isb-overlay-close:focus-visible {
	outline: 2px solid #2271b1 !important; /* Pixel-genaue Fokusanzeige */
	outline-offset: 2px !important;
}

#isb-overlay-popover .isb-overlay-close svg {
	display: block !important;
	flex-shrink: 0 !important;
	width: 0.875rem !important;            /* 14px */
	height: 0.875rem !important;          /* 14px */
	max-width: none !important;
	max-height: none !important;
	overflow: visible !important;
	pointer-events: none !important;
}

/* -----------------------------------------------
   iFrame-Bereich
   ----------------------------------------------- */
.isb-overlay-body {
	flex: 1;
	overflow: hidden;
	position: relative;
}

#isb-overlay-frame {
	display: block;
	width: 100%;
	height: 100%;
	border: none;
}

/* -----------------------------------------------
   Responsive: Mobile – Vollbild ohne Abstände
   ----------------------------------------------- */
@media (max-width: 30rem) {     /* 480px */
	#isb-overlay-popover:popover-open {
		align-items: flex-end;
	}

	.isb-overlay-container {
		width: 100vw;
		max-width: 100vw;
		height: 92dvh;
		height: 92vh; /* Fallback */
		max-height: 92dvh;
		max-height: 92vh; /* Fallback */
		border-radius: 1rem 1rem 0 0;   /* 16px */
	}
}
