/**
 * AddToCart Cross Sell PopUp — style frontendu.
 *
 * Wszystkie selektory są izolowane pod #atc-csp-root, aby nie nadpisywać
 * globalnych styli motywu ani Elementora. Wartości kolorów, wymiarów itd.
 * są dostarczane dynamicznie (inline) z ustawień wtyczki.
 */

body.atc-csp-no-scroll {
	overflow: hidden;
}

#atc-csp-root .atc-csp-popup {
	position: fixed;
	inset: 0;
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.25s ease, visibility 0.25s ease;
}

#atc-csp-root .atc-csp-popup.atc-csp-open {
	opacity: 1;
	visibility: visible;
}

#atc-csp-root .atc-csp-overlay {
	position: absolute;
	inset: 0;
	cursor: pointer;
}

#atc-csp-root .atc-csp-modal {
	position: relative;
	z-index: 2;
	box-sizing: border-box;
	max-height: 88vh;
	overflow-y: auto;
	box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
	transform: translateY(12px) scale(0.98);
	transition: transform 0.25s ease;
	line-height: 1.5;
	-webkit-overflow-scrolling: touch;
}

#atc-csp-root .atc-csp-popup.atc-csp-open .atc-csp-modal {
	transform: translateY(0) scale(1);
}

#atc-csp-root .atc-csp-modal * {
	box-sizing: border-box;
}

/* --- Nagłówek / komunikaty ------------------------------------------- */

#atc-csp-root .atc-csp-title {
	margin: 0 32px 10px 0;
	padding: 0;
	font-weight: 700;
	line-height: 1.25;
}

#atc-csp-root .atc-csp-added {
	margin: 0 0 14px;
	display: flex;
	align-items: flex-start;
	gap: 8px;
}

#atc-csp-root .atc-csp-check {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: #2f9e44;
	color: #fff;
	font-size: 12px;
	line-height: 1;
	margin-top: 2px;
}

#atc-csp-root .atc-csp-heading {
	margin: 6px 0 12px;
	padding: 0;
	font-size: 1.05em;
	font-weight: 600;
}

#atc-csp-root .atc-csp-message {
	margin: 0 0 12px;
	padding: 10px 12px;
	border-radius: 8px;
	font-size: 0.95em;
}

#atc-csp-root .atc-csp-message-success {
	background: #e6f6ea;
	color: #205b31;
}

#atc-csp-root .atc-csp-message-error {
	background: #fdeaea;
	color: #8a2222;
}

/* --- Przycisk zamknięcia ---------------------------------------------- */

#atc-csp-root .atc-csp-close {
	position: absolute;
	top: 10px;
	right: 10px;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.06);
	color: inherit;
	font-size: 22px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease;
}

#atc-csp-root .atc-csp-close:hover,
#atc-csp-root .atc-csp-close:focus {
	background: rgba(0, 0, 0, 0.14);
	outline-offset: 2px;
}

/* --- Kafelki cross-sell ------------------------------------------------ */

#atc-csp-root .atc-csp-item {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 10px;
	text-align: center;
}

#atc-csp-root .atc-csp-item-added {
	border-color: #2f9e44;
	box-shadow: 0 0 0 1px #2f9e44 inset;
}

#atc-csp-root .atc-csp-sale-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	z-index: 2;
	padding: 3px 8px;
	border-radius: 999px;
	background: #d6336c;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.02em;
}

#atc-csp-root .atc-csp-item-image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 6px;
}

#atc-csp-root .atc-csp-item-name {
	color: inherit;
	font-weight: 600;
	text-decoration: none;
	line-height: 1.3;
}

#atc-csp-root .atc-csp-item-name:hover {
	text-decoration: underline;
}

#atc-csp-root .atc-csp-item-price del {
	opacity: 0.6;
	margin-right: 6px;
}

#atc-csp-root .atc-csp-item-price ins {
	text-decoration: none;
	font-weight: 700;
}

#atc-csp-root .atc-csp-item-unavailable {
	font-size: 0.9em;
	opacity: 0.7;
}

/* --- Przyciski ---------------------------------------------------------- */

#atc-csp-root .atc-csp-btn {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: auto;
	padding: 10px 16px;
	border: 0;
	font-size: 0.95em;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease, opacity 0.15s ease;
}

#atc-csp-root .atc-csp-btn:hover,
#atc-csp-root .atc-csp-btn:focus {
	filter: brightness(0.92);
	text-decoration: none;
}

#atc-csp-root .atc-csp-btn-ghost {
	background: transparent !important;
	color: inherit !important;
	border: 1px solid rgba(0, 0, 0, 0.2);
}

#atc-csp-root .atc-csp-btn[disabled] {
	opacity: 0.7;
	cursor: wait;
}

/* Loader */
#atc-csp-root .atc-csp-spinner {
	display: none;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: atc-csp-spin 0.7s linear infinite;
}

#atc-csp-root .atc-csp-loading .atc-csp-spinner {
	display: inline-block;
}

@keyframes atc-csp-spin {
	to {
		transform: rotate(360deg);
	}
}

/* --- Stopka popupu ------------------------------------------------------ */

#atc-csp-root .atc-csp-footer {
	display: flex;
	flex-wrap: wrap;
	margin-top: 20px;
}

#atc-csp-root .atc-csp-footer .atc-csp-btn {
	flex: 1 1 auto;
}

/* --- Sekcja inline (shortcode) ------------------------------------------ */

.atc-csp-inline-wrap .atc-csp-items {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
}

@media (max-width: 600px) {
	.atc-csp-inline-wrap .atc-csp-items {
		grid-template-columns: 1fr;
	}
}

/* --- Dostępność / ruch ---------------------------------------------------- */

@media (prefers-reduced-motion: reduce) {
	#atc-csp-root .atc-csp-popup,
	#atc-csp-root .atc-csp-modal,
	#atc-csp-root .atc-csp-spinner {
		transition: none;
		animation-duration: 0.01s;
	}
}

/* Style kafelków w trybie inline (shortcode) — te same klasy poza rootem. */
.atc-csp-inline-wrap .atc-csp-item {
	position: relative;
	display: flex;
	flex-direction: column;
	gap: 8px;
	padding: 12px;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 10px;
	text-align: center;
}

.atc-csp-inline-wrap .atc-csp-item-name {
	color: inherit;
	font-weight: 600;
	text-decoration: none;
}

.atc-csp-inline-wrap .atc-csp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	margin-top: auto;
	padding: 10px 16px;
	border: 0;
	border-radius: 8px;
	background: #2f6f4f;
	color: #fff;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.atc-csp-inline-wrap .atc-csp-sale-badge {
	position: absolute;
	top: 8px;
	left: 8px;
	padding: 3px 8px;
	border-radius: 999px;
	background: #d6336c;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	text-transform: uppercase;
}

.atc-csp-inline-wrap .atc-csp-item-image img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 6px;
}

.atc-csp-inline-wrap .atc-csp-spinner {
	display: none;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255, 255, 255, 0.4);
	border-top-color: currentColor;
	border-radius: 50%;
	animation: atc-csp-spin 0.7s linear infinite;
}

.atc-csp-inline-wrap .atc-csp-loading .atc-csp-spinner {
	display: inline-block;
}
