.sap-lightbox {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: none;
}

.sap-lightbox.is-open {
	display: block;
}

/* Backdrop je ten "tmavý prostor" - musí chytat klik */
.sap-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0,0,0,0.86);
	cursor: pointer;
}

/*
	UI držíme přes celý viewport, ale nesmí blokovat kliky do backdropu.
	Tím vyřešíme: klik do tmy = zavřít.
*/
.sap-lightbox__ui {
	position: absolute;
	inset: 0;
	pointer-events: none;
}

/* Obsah */
.sap-lightbox__content {
	position: absolute;
	inset: 0;
	display: flex;
	justify-content: center;
	align-items: center;
	padding: clamp(12px, 3vw, 24px);
	pointer-events: none;
}

.sap-lightbox__img {
	max-width: min(1200px, 92vw);
	max-height: calc(100vh - 140px);
	width: auto;
	height: auto;
	display: block;
	pointer-events: auto;
}

/* Counter */
.sap-lightbox__counter {
	position: absolute;
	left: 50%;
	bottom: calc(16px + env(safe-area-inset-bottom));
	transform: translateX(-50%);
	color: rgba(255,255,255,0.85);
	font-size: 13px;
	pointer-events: none;
}

/* Tlačítka - jednotný vzhled, žádná červená */
.sap-lightbox__close,
.sap-lightbox__prev,
.sap-lightbox__next {
	position: absolute;
	appearance: none;
	-webkit-appearance: none;
	border: 0;
	border-radius: 0;
	background: #fff;
	color: #000;
	padding: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-family: inherit;
	font-weight: 700;
	cursor: pointer;
	pointer-events: auto;
	box-shadow: none;
	text-decoration: none;
}

/* Hover + focus - požadavek: #E6E1D5 pozadí, černý font */
.sap-lightbox__close:hover,
.sap-lightbox__prev:hover,
.sap-lightbox__next:hover {
	background: #E6E1D5;
	color: #000;
}

.sap-lightbox__close:focus,
.sap-lightbox__prev:focus,
.sap-lightbox__next:focus {
	outline: none;
}

.sap-lightbox__close:focus-visible,
.sap-lightbox__prev:focus-visible,
.sap-lightbox__next:focus-visible {
	outline: 2px solid #E6E1D5;
	outline-offset: 3px;
}

/* Zavírací křížek - o pár px větší */
.sap-lightbox__close {
	top: calc(16px + env(safe-area-inset-top));
	right: calc(16px + env(safe-area-inset-right));
	width: 46px;
	height: 46px;
	font-size: 30px; /* zvětšení */
	line-height: 1;
}

/* WP admin bar (když jste přihlášený) */
body.admin-bar .sap-lightbox__close {
	top: calc(16px + 46px);
}
@media (min-width: 783px) {
	body.admin-bar .sap-lightbox__close {
		top: calc(16px + 32px);
	}
}

/* Šipky */
.sap-lightbox__prev,
.sap-lightbox__next {
	top: 50%;
	transform: translateY(-50%);
	width: 46px;
	height: 46px;
	font-size: 30px;
	line-height: 1;
}

.sap-lightbox__prev {
	left: calc(16px + env(safe-area-inset-left));
}

.sap-lightbox__next {
	right: calc(16px + env(safe-area-inset-right));
}

/* Mobil - menší padding a větší max-height, aby to sedělo v portrait */
@media (max-width: 640px) {
	.sap-lightbox__content {
		padding: 12px;
	}
	.sap-lightbox__img {
		max-width: 92vw;
		max-height: calc(100vh - 120px);
	}
	.sap-lightbox__prev,
	.sap-lightbox__next {
		width: 44px;
		height: 44px;
		font-size: 28px;
	}
	.sap-lightbox__close {
		width: 44px;
		height: 44px;
		font-size: 28px;
	}
}

/* --- FIX: z-index (šipky/close vždy nad obrázkem) --- */
.sap-lightbox__backdrop { z-index: 0; }
.sap-lightbox__ui { z-index: 1; }
.sap-lightbox__content { z-index: 1; }

.sap-lightbox__img {
	position: relative;
	z-index: 1;
}

.sap-lightbox__close,
.sap-lightbox__prev,
.sap-lightbox__next {
	z-index: 5;
}

/* --- FIX: žádná červená na active/focus (přebije theme/Elementor) --- */
.sap-lightbox .sap-lightbox__close,
.sap-lightbox .sap-lightbox__prev,
.sap-lightbox .sap-lightbox__next {
	background: #fff !important;
	color: #000 !important;
	border-radius: 0 !important;
	box-shadow: none !important;
	outline: none !important;
	-webkit-tap-highlight-color: transparent;
}

.sap-lightbox .sap-lightbox__close:hover,
.sap-lightbox .sap-lightbox__prev:hover,
.sap-lightbox .sap-lightbox__next:hover {
	background: #E6E1D5 !important;
	color: #000 !important;
}

/* po kliknutí (active) */
.sap-lightbox .sap-lightbox__close:active,
.sap-lightbox .sap-lightbox__prev:active,
.sap-lightbox .sap-lightbox__next:active {
	background: #E6E1D5 !important;
	color: #000 !important;
}

/* po kliknutí zůstane často focus -> držíme bílé/naše barvy */
.sap-lightbox .sap-lightbox__close:focus,
.sap-lightbox .sap-lightbox__prev:focus,
.sap-lightbox .sap-lightbox__next:focus {
	background: #fff !important;
	color: #000 !important;
}

.sap-lightbox .sap-lightbox__close:focus-visible,
.sap-lightbox .sap-lightbox__prev:focus-visible,
.sap-lightbox .sap-lightbox__next:focus-visible {
	outline: 2px solid #E6E1D5 !important;
	outline-offset: 3px;
}