/**
 * Popup "Polozka pridana do kosiku".
 *
 * Nahrazuje vysouvaci side cart. Markup viz includes/CartPopupRender.php.
 *
 * Vsechny selektory uvnitr popupu jsou zanorene pod .msc-popup zamerne:
 * Elementor kit stylu ma pravidla typu `.elementor-kit-108677 h2` se specificitou
 * (0,1,1), ktera by jednotlive BEM tridy (0,1,0) prebila. Dve tridy (0,2,0) vyhraji
 * a nemusime sahat po ID ani !important.
 *
 * @since 1.1.0
 */

.msc-popup {
	--msc-radius: 10px;
	--msc-border: #EAEBEB;
	--msc-text: #2B3838;
	--msc-muted: #6b7575;
	--msc-green: #08b060;
	--msc-yellow: #ffdd00;
	--msc-blue: #0d6efd;

	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;

	/*
	 * Na mobilu je 100vh vyska viewportu BEZ listy s adresou, takze fixovany
	 * prvek pres cely viewport je vyssi nez viditelna plocha a horni cast zaleze
	 * pod listu. `dvh` se meni spolu s listou. Radek s `vh` je fallback pro
	 * prohlizece bez podpory dvh — poradi nechat, prepisuje se zdola.
	 */
	height: 100vh;
	height: 100dvh;
}

.msc-popup[hidden] {
	display: none;
}

.msc-popup .msc-popup__overlay {
	position: absolute;
	inset: 0;
	background: rgba(30, 39, 39, 0.5);
}

.msc-popup .msc-popup__dialog {
	position: relative;
	width: 100%;
	max-width: 640px;
	max-height: calc(100vh - 40px);
	max-height: calc(100dvh - 40px);
	overflow-y: auto;
	/* Dojete rolovani uvnitr dialogu nesmi pokracovat strankou pod nim. */
	overscroll-behavior: contain;
	background: #fff;
	border-radius: var(--msc-radius);
	box-shadow: 0 12px 40px rgba(30, 39, 39, 0.25);
}

.msc-popup .msc-popup__inner {
	padding: 20px 24px;
}

body.msc-popup-is-open {
	overflow: hidden;
}

/* --- Reset typografie proti Elementor kitu ---------------------------- */

.msc-popup .msc-popup__title,
.msc-popup .msc-popup__section-title,
.msc-popup .msc-popup__product-name {
	margin: 0;
	font-family: inherit;
	letter-spacing: normal;
	text-transform: none;
}

.msc-popup .msc-popup__product-qty,
.msc-popup .msc-popup__shipping-label,
.msc-popup .msc-popup__rec-name {
	margin: 0;
	font-family: inherit;
}

/* --- Hlavicka --------------------------------------------------------- */

.msc-popup .msc-popup__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding-bottom: 10px;
	padding-top:10px;
}

.msc-popup .msc-popup__check {
	display: flex;
	flex: 0 0 26px;
	width: 26px;
	height: 26px;
}

.msc-popup .msc-popup__check svg {
	display: block;
	width: 26px;
	height: 26px;
}

.msc-popup .msc-popup__title {
	flex: 1 1 auto;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--msc-text);
}

.msc-popup .msc-popup__close {
	flex: 0 0 auto;
	width: 28px;
	height: 28px;
	padding: 0;
	background: none;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	position: relative;
}

.msc-popup .msc-popup__close:hover,
.msc-popup .msc-popup__close:focus {
	background: none;
}

.msc-popup .msc-popup__close::before,
.msc-popup .msc-popup__close::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	width: 15px;
	height: 1.5px;
	background: var(--msc-text);
}

.msc-popup .msc-popup__close::before {
	transform: translate(-50%, -50%) rotate(45deg);
}

.msc-popup .msc-popup__close::after {
	transform: translate(-50%, -50%) rotate(-45deg);
}

/* --- Posledni pridany produkt ----------------------------------------- */

.msc-popup .msc-popup__product {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 19px 0;
	margin-bottom:16px;
}

.msc-popup .msc-popup__product-thumb {
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
}

.msc-popup .msc-popup__product-thumb a {
	display: block;
	width: 100%;
	height: 100%;
}

.msc-popup .msc-popup__product-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	border-radius: 8px;
}

.msc-popup .msc-popup__product-data {
	flex: 1 1 auto;
	min-width: 0;
}

.msc-popup .msc-popup__product-name {
	margin-bottom: 4px;
	font-size: 16px;
	font-weight: 700;	
	line-height:1.6;
}
.msc-popup .msc-popup__product-data .variation{
	display:none;
}

.msc-popup .msc-popup__product-name a {
	color: #2B3838;
	text-decoration: none;
	font-weight: 700;
	font-size: 15px;
	line-height: 1.6;

}

.msc-popup .msc-popup__product-qty {
	font-weight: 600;
	font-size: 14px;
	line-height: 160%;
	color:#848C8C;
}

.msc-popup .msc-popup__product-price {
	flex: 0 0 auto;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.6;
	white-space: nowrap;
	color: var(--msc-text);
	align-self: center;
}

/* --- Doprava zdarma --------------------------------------------------- */

.msc-popup .msc-popup__shipping {
	padding: 20px;
	margin-bottom: 20px;
	background: #E6F1F5;
	border-radius: 8px;
	color: #2B3838;
}

.msc-popup .msc-popup__shipping.is-reached {
	background: #E6F1F5;
	color: #2B3838;
}

.msc-popup .msc-popup__shipping-label {
	display: block;
	position:relative;
	padding-left:30px;
	align-items: center;
	gap: 8px;
	margin-bottom: 10px;
	font-size: 14px;
	font-weight:400;
	line-height: 1.6;
	color: inherit;
}

.msc-popup .msc-popup__shipping-label strong {
	font-weight: 700;
}

.msc-popup .msc-popup__shipping-label .amount,
.msc-popup .msc-popup__shipping-label bdi {
	color: inherit;
	font-size: inherit;
}

.msc-popup .msc-popup__shipping-icon {
	display: flex;
	position:absolute;
	left:0;
	top:50%;
	margin-top:-8px;
}

.msc-popup .msc-popup__shipping-bar {
	height: 6px;
	background: #EAEBEB;
	border-radius: 3px;
	overflow: hidden;
}

.msc-popup .msc-popup__shipping-bar span {
	display: block;
	height: 100%;
	background: #00779A;
	border-radius: 3px;
	transition: width 0.3s ease;
}

/* --- Doporucene produkty (placeholder) -------------------------------- */

.msc-popup .msc-popup__section-title {
	margin-bottom: 12px;
	font-size: 18px;
	font-weight: 700;
	line-height: 1.1;
	color: var(--msc-text);
}

.msc-popup .msc-popup__recommended-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 10px;
	margin-bottom: 18px;
}

.msc-popup .msc-popup__rec-item {
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 10px;
	border: 1px solid var(--msc-border);
	border-radius: 8px;
	/* Kotva pro prekryv behem pridavani do kosiku. */
	position: relative;
}

/*
 * Po dobu REST pozadavku prekryje celou dlazdici bily zavoj s tocicim se
 * kolečkem. Prekryv je na pseudo-elementech, aby se nemusel menit markup
 * a dlazdice si drzela puvodni rozmer.
 */
.msc-popup .msc-popup__rec-item.is-loading {
	pointer-events: none;
}

.msc-popup .msc-popup__rec-item.is-loading::before,
.msc-popup .msc-popup__rec-item.is-loading::after {
	content: "";
	position: absolute;
	z-index: 2;
}

.msc-popup .msc-popup__rec-item.is-loading::before {
	inset: 0;
	background: rgba( 255, 255, 255, 0.75 );
	border-radius: 8px;
}

.msc-popup .msc-popup__rec-item.is-loading::after {
	top: 50%;
	left: 50%;
	width: 24px;
	height: 24px;
	margin: -12px 0 0 -12px;
	border: 2px solid rgba( 0, 83, 108, 0.25 );
	border-top-color: #00536C;
	border-radius: 50%;
	animation: msc-popup-spin 0.6s linear infinite;
}

@keyframes msc-popup-spin {
	to {
		transform: rotate( 360deg );
	}
}

/* Pro uzivatele s omezenim animaci zustane jen staticke kolecko. */
@media ( prefers-reduced-motion: reduce ) {
	.msc-popup .msc-popup__rec-item.is-loading::after {
		animation: none;
	}
}

.msc-popup .msc-popup__rec-thumb {
	display: block;
	overflow: hidden;
	border-radius: 8px;
}

.msc-popup .msc-popup__rec-thumb img {
	display: block;
	width: 52px;
	height: 52px;
	object-fit: cover;
	border-radius: 8px;
}

.msc-popup .msc-popup__rec-name {
	font-weight: 700;
	font-size: 14px;
	line-height: 1.6;
	text-decoration: none;
}

/*
 * Orez na dva radky s trema teckami. Klamp je na odkazu, ne na odstavci -
 * -webkit-line-clamp funguje na elementu, ktery text primo obsahuje.
 * Pevna vyska drzi vsechny tri dlazdice stejne vysoko i pri jednoradkovem nazvu.
 */
.msc-popup .msc-popup__rec-name a,
.msc-popup .msc-popup__rec-name a:hover {
	display: -webkit-box;
	-webkit-line-clamp: 2;
	line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	height: calc(2 * 1.6em);
	font-weight: 700;
	font-size: 14px;
	line-height: 1.6;
	overflow-wrap: anywhere;
	text-decoration: none;
}

.msc-popup .msc-popup__rec-bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 6px;
	margin-top: auto;
}

.msc-popup .msc-popup__rec-price {
	font-size: 14px;
	font-weight: 700;
	line-height: 1.6;
	color: var(--msc-text);
}

.msc-popup .msc-popup__rec-price .amount,
.msc-popup .msc-popup__rec-price bdi,
.msc-popup .msc-popup__rec-price del,
.msc-popup .msc-popup__rec-price ins {
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
	background: none;
	text-decoration: none;
}

.msc-popup .msc-popup__rec-price del {
	opacity: 0.5;
	font-size: 11px;
}

.msc-popup .msc-popup__rec-add {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	min-height: 0;
	padding: 0;
	font-size: 15px;
	font-weight: 400;
	line-height: 1;
	text-decoration: none;
	color: #00536C;
	background: #fff;
	border: 1px solid #00536C;
	border-radius: 50%;
	cursor: pointer;
	/* Kotva pro spinner pri odesilani pozadavku. */
	position: relative;
}

.msc-popup .msc-popup__rec-add:hover,
.msc-popup .msc-popup__rec-add:focus {
	color: #ffffff;
	background: #00536C;
	border-color: #00536C;
}

.msc-popup .msc-popup__rec-add[hidden] {
	display: none;
}

/* Prekryv dlazdice resi stav nacitani, tlacitko jen prestane reagovat. */
.msc-popup .msc-popup__rec-add.is-loading {
	pointer-events: none;
}

.msc-popup .msc-popup__rec-add.is-error {
	/*border-color: #dc1b4a;
	color: #dc1b4a;*/
}

/* Stav po pridani primo z popupu. */
.msc-popup .msc-popup__rec-added {
	flex: 0 0 auto;
	font-size: 12px;
	font-weight: 700;
	line-height: 1.2;
	color: #00536C;
}

.msc-popup .msc-popup__rec-added[hidden] {
	display: none;
}

/* --- Pas s benefity (placeholder) ------------------------------------- */

.msc-popup .msc-popup__usp {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	margin: 0 0 18px;
	padding: 0;
	list-style: none;
}

.msc-popup .msc-popup__usp-item {
	display: flex;
	align-items: center;
	gap: 5px;
	margin: 0;
	padding: 0;
	font-size: 14px;
	line-height: 1.2;
	color: var(--msc-muted);
	list-style: none;
}

.msc-popup .msc-popup__usp-item::before,
.msc-popup .msc-popup__usp-item::marker {
	content: none;
}

/* Cesty jsou relativni k assets/css/, proto ../ */
.msc-popup .msc-popup__usp-icon {
	flex: 0 0 28px;
	width: 28px;
	height: 28px;
	background-position: center;
	background-repeat: no-repeat;
	background-size: contain;
}

.msc-popup .msc-popup__usp-item:nth-child(1) .msc-popup__usp-icon {
	background-image: url(../hand.webp);
}

.msc-popup .msc-popup__usp-item:nth-child(2) .msc-popup__usp-icon {
	background-image: url(../slunce.webp);
}

.msc-popup .msc-popup__usp-item:nth-child(3) .msc-popup__usp-icon {
	background-image: url(../bulb.webp);
}

/* --- Souhrn a tlacitka ------------------------------------------------ */
.msc-popup  .msc-popup__footer-container{
	padding:20px;
	background-color: #F5F5F5;
	border-radius:12px;
}
.msc-popup .msc-popup__summary {
	padding: 14px 0;	
}

.msc-popup .msc-popup__summary-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	font-size: 16px;
	line-height: 1.3;
	color: var(--msc-muted);
}

.msc-popup .msc-popup__summary-row--total {
	margin-top: 6px;
}

.msc-popup .msc-popup__summary-row--total .msc-popup__summary-label {
	font-size: 20px;
	font-weight: 700;
	color: var(--msc-text);
}

.msc-popup .msc-popup__summary-total {
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--msc-text);
}

.msc-popup .msc-popup__summary-total .amount,
.msc-popup .msc-popup__summary-total bdi {
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
}

.msc-popup .msc-popup__actions {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 10px;
}

.msc-popup .msc-popup__button {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	padding: 18px 14px;
	font-family: inherit;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: normal;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	border-radius: 40px;
	cursor: pointer;
	color:#1E2727;
}

.msc-popup .msc-popup__button--ghost{
	color: #00536C;
	background: transparent;
	border: 1px solid #00536C;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
}
.msc-popup .msc-popup__button--ghost:hover,
.msc-popup .msc-popup__button--ghost:focus {
	color: #ffffff;
	background: #00536C;
	border: 1px solid #00536C;
	font-size: 14px;
	font-weight: 700;
	line-height: 1;
}

.msc-popup .msc-popup__button--primary,
.msc-popup .msc-popup__button--primary:hover,
.msc-popup .msc-popup__button--primary:focus {
	color: var(--msc-text);
	background: var(--msc-yellow);
	border: 1px solid var(--msc-yellow);
	font-size: 14px;
	font-weight: 700!important;
	line-height: 1;
}

/* --- Mobil ------------------------------------------------------------ */

/*
 * Na mobilu jsou dlazdice dve. Treti se vykresli, ale schova - server posila
 * vzdy tri, aby se pri zmene sirky okna nemusel popup dotahovat znovu.
 */
@media (max-width: 767px) {

	.msc-popup .msc-popup__recommended-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.msc-popup .msc-popup__rec-item:nth-child(n+3) {
		display: none;
	}

	/*
	 * Dlouhy nazev produktu orezat na dva radky s trema teckami — na uzkem
	 * displeji by se jinak roztahl pres pul popupu.
	 *
	 * Klamp sedi na odkazu, ne na nadpisu: -webkit-line-clamp funguje jen na
	 * elementu, ktery text PRIMO obsahuje. Druhy selektor je pro produkt bez
	 * permalinku, kdy sablona vypise nazev rovnou do <h3>.
	 *
	 * Vyska se zamerne nefixuje (na rozdil od dlazdic doporucenych, kde musi
	 * byt stejne vysoke) — jednoradkovy nazev tu nema delat prazdne misto.
	 */
	.msc-popup .msc-popup__product-name a,
	.msc-popup .msc-popup__product-name a:hover {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		overflow-wrap: anywhere;
	}

	.msc-popup .msc-popup__product-name:not(:has(a)) {
		display: -webkit-box;
		-webkit-line-clamp: 2;
		line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
		overflow-wrap: anywhere;
	}

	/*
	 * Preskladani na dva radky: nazev pres celou sirku, pod nim mnozstvi a cena
	 * vedle sebe. Na uzkem displeji si tri sloupce vedle sebe braly nazvu misto
	 * a ten se lamal po dvou slovech.
	 *
	 * `display: contents` na obalu je tu klicove — mnozstvi je UVNITR
	 * .msc-popup__product-data, kdezto cena je jeho sourozenec, takze je
	 * flexboxem na jeden radek nedostaneme. Obal se tim z rozlozeni vyradi
	 * a jeho deti se stanou polozkami stejneho gridu jako obrazek a cena.
	 */
	.msc-popup .msc-popup__product {
		display: grid;
		grid-template-columns: 72px minmax(0, 1fr) auto;
		grid-template-areas:
			"thumb name name"
			"thumb qty  price";
		column-gap: 16px;
		row-gap: 4px;
		align-items: center;
	}

	.msc-popup .msc-popup__product-thumb {
		grid-area: thumb;
	}

	.msc-popup .msc-popup__product-data {
		display: contents;
	}

	.msc-popup .msc-popup__product-name {
		grid-area: name;
		/* Odsazeni resi row-gap gridu. */
		margin-bottom: 0;
	}

	.msc-popup .msc-popup__product-qty {
		grid-area: qty;
	}

	.msc-popup .msc-popup__product-price {
		grid-area: price;
		justify-self: end;
	}
}

@media (max-width: 480px) {

	.msc-popup {
		padding: 12px;
	}

	.msc-popup .msc-popup__inner {
		padding: 16px;
	}

	.msc-popup .msc-popup__usp {
		flex-wrap: wrap;
		justify-content: center;
		row-gap: 6px;
	}

	.msc-popup .msc-popup__actions button,
	.msc-popup .msc-popup__actions a {
		white-space: break-spaces;
	}
}
