/**
 * Modal „Dodano do koszyka” + produkty uzupełniające.
 * Kolory przez zmienne Elementora — bazowy #F7BD01, hover #E3AC00.
 */

.stwb-modal {
	--stwb-accent: var( --e-global-color-primary, #f7bd01 );
	--stwb-accent-hover: var( --e-global-color-48a4e19, #e3ac00 );
	--stwb-ink: var( --e-global-color-594e3db, #111 );
	--stwb-text: var( --e-global-color-text, #444 );
	--stwb-line: var( --e-global-color-accent, #d3cec7 );
	--stwb-surface: var( --e-global-color-d7ce02d, #fff );

	position: fixed;
	inset: 0;
	z-index: 10000;
	display: flex;
	align-items: flex-start;
	justify-content: center;
	padding: 24px 16px;
	overflow-y: auto;
}

.stwb-modal[hidden] {
	display: none;
}

body.stwb-modal-open {
	overflow: hidden;
}

.stwb-modal__backdrop {
	position: fixed;
	inset: 0;
	background: rgba( 0, 0, 0, 0.55 );
}

.stwb-modal__dialog {
	position: relative;
	width: 100%;
	max-width: 1000px;
	margin: auto;
	background: var( --stwb-surface );
	border-radius: 8px;
	box-shadow: 0 20px 60px rgba( 0, 0, 0, 0.3 );
}

.stwb-modal__dialog.is-busy {
	opacity: 0.6;
	pointer-events: none;
}

/* --- nagłówek --- */

.stwb-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 24px;
	border-bottom: 1px solid var( --stwb-line );
}

.stwb-modal__title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	font-family: var( --e-global-typography-text-font-family, "Golos Text" ), sans-serif;
	font-size: 24px;
	color: var( --stwb-ink );
}

.stwb-modal__check {
	width: 28px;
	height: 28px;
	border: 2px solid var( --stwb-accent );
	border-radius: 50%;
	position: relative;
	flex: 0 0 auto;
}

.stwb-modal__check::after {
	content: "";
	position: absolute;
	left: 8px;
	top: 4px;
	width: 7px;
	height: 12px;
	border: solid var( --stwb-accent );
	border-width: 0 2px 2px 0;
	transform: rotate( 45deg );
}

.stwb-modal__close {
	background: none;
	border: 0;
	padding: 0 4px;
	font-size: 30px;
	line-height: 1;
	color: var( --stwb-ink );
	cursor: pointer;
}

/* --- pozycje --- */

.stwb-modal__body {
	padding: 24px;
}

.stwb-modal__items {
	width: 100%;
	border-collapse: collapse;
	margin: 0 0 16px;
}

.stwb-modal__items th {
	padding: 0 12px 12px;
	font-size: 13px;
	font-weight: 400;
	text-align: left;
	color: var( --stwb-text );
	border: 0;
}

.stwb-modal__items td {
	padding: 16px 12px;
	border: 0;
	border-top: 1px solid var( --stwb-line );
	vertical-align: middle;
	background: none;
}

.stwb-modal__items tbody tr:hover > td {
	background: none;
}

.stwb-modal__items .is-remove {
	width: 1%;
	white-space: nowrap;
}

/* Jak w koszyku: px, nie procent — inaczej max-width zjada obrazek. */
.stwb-modal__items .is-thumb {
	width: 100px;
	white-space: nowrap;
}

.stwb-modal__items .is-price,
.stwb-modal__items .is-total {
	text-align: right;
	white-space: nowrap;
}

.stwb-modal__items img {
	display: block;
	width: 80px;
	max-width: none;
	height: auto;
	border-radius: 4px;
}

.stwb-modal__name {
	display: block;
	font-family: var( --e-global-typography-text-font-family, "Golos Text" ), sans-serif;
	font-weight: 600;
	font-size: 16px;
	color: var( --stwb-ink );
}

.stwb-modal__remove {
	background: none;
	border: 0;
	font-size: 22px;
	line-height: 1;
	color: var( --stwb-text );
	cursor: pointer;
}

.stwb-modal__remove:hover {
	color: var( --stwb-ink );
}

/* --- stepper ilości --- */

.stwb-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var( --stwb-line );
	border-radius: 4px;
	overflow: hidden;
}

.stwb-qty__btn {
	width: 34px;
	height: 38px;
	background: none;
	border: 0;
	font-size: 18px;
	line-height: 1;
	color: var( --stwb-ink );
	cursor: pointer;
}

.stwb-qty__input {
	width: 46px;
	height: 38px;
	border: 0;
	border-left: 1px solid var( --stwb-line );
	border-right: 1px solid var( --stwb-line );
	border-radius: 0;
	padding: 0;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.stwb-qty__input::-webkit-inner-spin-button,
.stwb-qty__input::-webkit-outer-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* --- podsumowanie i akcje --- */

.stwb-modal__summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	flex-wrap: wrap;
	padding-top: 16px;
	border-top: 1px solid var( --stwb-line );
}

.stwb-modal__clear {
	background: none;
	border: 0;
	padding: 0;
	text-decoration: underline;
	color: var( --stwb-ink );
	cursor: pointer;
}

.stwb-modal__total {
	margin: 0;
	font-size: 18px;
	color: var( --stwb-ink );
}

.stwb-modal__total strong {
	color: var( --stwb-accent );
	font-size: 22px;
	margin-left: 6px;
}

.stwb-modal__actions {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 12px;
	margin-top: 20px;
}

/* --- przyciski --- */

.stwb-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 16px 20px;
	border: 1px solid transparent;
	border-radius: 4px;
	font-family: "Barlow", sans-serif;
	font-size: 15px;
	font-weight: 600;
	text-transform: uppercase;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: all 0.2s;
}

.stwb-btn--primary {
	background: var( --stwb-accent );
	border-color: var( --stwb-accent );
	color: var( --e-global-color-secondary, #000 );
}

.stwb-btn--primary:hover,
.stwb-btn--primary:focus {
	background: var( --stwb-accent-hover );
	border-color: var( --stwb-accent-hover );
	color: var( --e-global-color-secondary, #000 );
}

.stwb-btn--dark {
	background: var( --stwb-ink );
	border-color: var( --stwb-ink );
	color: var( --stwb-surface );
}

.stwb-btn--dark:hover,
.stwb-btn--dark:focus {
	background: var( --stwb-accent );
	border-color: var( --stwb-accent );
	color: var( --e-global-color-secondary, #000 );
}

/* --- produkty uzupełniające --- */

.stwb-crosssell {
	margin-top: 28px;
	padding-top: 24px;
	border-top: 1px solid var( --e-global-color-accent, #d3cec7 );
}

.stwb-crosssell__heading {
	margin: 0 0 18px;
	font-family: var( --e-global-typography-text-font-family, "Golos Text" ), sans-serif;
	font-size: 22px;
	color: var( --e-global-color-594e3db, #111 );
}

.stwb-crosssell__grid {
	display: grid;
	grid-template-columns: repeat( 3, 1fr );
	gap: 16px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.stwb-crosssell__item {
	display: flex;
	gap: 14px;
	padding: 14px;
	border: 1px solid var( --e-global-color-accent, #d3cec7 );
	border-radius: 6px;
}

.stwb-crosssell__thumb {
	flex: 0 0 auto;
	width: 84px;
}

.stwb-crosssell__thumb img {
	display: block;
	width: 100%;
	height: auto;
	border-radius: 4px;
}

.stwb-crosssell__body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.stwb-crosssell__name {
	font-family: var( --e-global-typography-text-font-family, "Golos Text" ), sans-serif;
	font-weight: 600;
	font-size: 17px;
	line-height: 1.2;
	color: var( --e-global-color-594e3db, #111 );
	text-decoration: none;
}

.stwb-crosssell__desc {
	margin: 0;
	font-size: 13px;
	line-height: 1.35;
	color: var( --e-global-color-primary, #f7bd01 );
}

.stwb-crosssell__price {
	font-weight: 600;
	color: var( --e-global-color-594e3db, #111 );
}

.stwb-crosssell__cta {
	margin-top: auto;
	padding: 10px 14px;
	border: 1px solid var( --e-global-color-primary, #f7bd01 );
	border-radius: 4px;
	background: none;
	font-family: "Barlow", sans-serif;
	font-size: 13px;
	font-weight: 600;
	text-transform: uppercase;
	text-align: center;
	text-decoration: none;
	color: var( --e-global-color-594e3db, #111 );
	cursor: pointer;
	transition: all 0.2s;
}

.stwb-crosssell__cta:hover {
	background: var( --e-global-color-primary, #f7bd01 );
}

.stwb-crosssell__cta.loading {
	opacity: 0.5;
	pointer-events: none;
}

/* --- mobile --- */

@media ( max-width: 767px ) {
	.stwb-modal {
		padding: 0;
	}

	.stwb-modal__dialog {
		border-radius: 0;
		min-height: 100%;
	}

	.stwb-modal__body {
		padding: 16px;
	}

	/* Tabela zamienia się w karty — inaczej nie mieści się na telefonie. */
	.stwb-modal__items thead {
		display: none;
	}

	.stwb-modal__items,
	.stwb-modal__items tbody,
	.stwb-modal__items tr,
	.stwb-modal__items td {
		display: block;
		width: 100%;
	}

	.stwb-modal__item {
		position: relative;
		display: grid;
		grid-template-columns: 72px 1fr;
		gap: 4px 12px;
		padding: 16px 0;
		border-top: 1px solid var( --stwb-line );
	}

	.stwb-modal__items td {
		border: 0;
		padding: 0;
	}

	.stwb-modal__items .is-thumb {
		grid-row: 1 / span 3;
	}

	.stwb-modal__items img {
		width: 72px;
	}

	.stwb-modal__items .is-remove {
		position: absolute;
		top: 12px;
		right: 0;
		width: auto;
	}

	.stwb-modal__items .is-price,
	.stwb-modal__items .is-total {
		text-align: left;
	}

	.stwb-modal__items .is-price::before,
	.stwb-modal__items .is-total::before {
		content: attr( data-label ) ": ";
		color: var( --stwb-text );
		font-size: 13px;
	}

	.stwb-modal__actions,
	.stwb-crosssell__grid {
		grid-template-columns: 1fr;
	}
}

/* =====================================================================
 * STRONA KOSZYKA
 * ===================================================================== */

.stwb-cart {
	--stwb-accent: var( --e-global-color-primary, #f7bd01 );
	--stwb-accent-hover: var( --e-global-color-48a4e19, #e3ac00 );
	--stwb-ink: var( --e-global-color-594e3db, #111 );
	--stwb-text: var( --e-global-color-text, #444 );
	--stwb-line: var( --e-global-color-accent, #d3cec7 );
	--stwb-surface: var( --e-global-color-d7ce02d, #fff );

	display: grid;
	grid-template-columns: minmax( 0, 1fr ) 400px;
	gap: 32px;
	align-items: start;
}

.stwb-cart__main {
	min-width: 0;
}

/* --- tabela pozycji --- */

.stwb-cart__table {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
	background: var( --stwb-surface );
	border: 1px solid var( --stwb-line );
	border-radius: 8px;
	overflow: hidden;
}

.stwb-cart__table th {
	padding: 16px 16px 12px;
	border: 0;
	font-size: 12px;
	font-weight: 600;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	text-align: left;
	color: var( --stwb-text );
}

.stwb-cart__col-amount {
	text-align: right !important;
	white-space: nowrap;
}

.stwb-cart__table td {
	padding: 20px 16px;
	border: 0;
	border-top: 1px solid var( --stwb-line );
	vertical-align: middle;
	background: none;
}

.stwb-cart__table tbody tr:hover > td {
	background: none;
}

.stwb-cart__table tbody tr:first-child td {
	border-top: 0;
}

.stwb-cart__col-remove {
	width: 1%;
	white-space: nowrap;
}

/*
 * Kolumna miniatury MUSI mieć szerokość w px.
 * Reset Hello daje `img { max-width: 100% }`, a procent liczony od komórki
 * `width: 1%` w tabeli shrink-to-fit wychodzi zerowy i przycina obrazek do 0.
 */
.stwb-cart__col-thumb {
	width: 130px;
	white-space: nowrap;
}

/* Audyt: większe miniaturki. */
.stwb-cart__col-thumb img {
	display: block;
	width: 110px;
	max-width: none;
	height: auto;
	border-radius: 4px;
}

.stwb-cart__name {
	display: block;
	font-family: var( --e-global-typography-text-font-family, "Golos Text" ), sans-serif;
	font-weight: 600;
	font-size: 18px;
	line-height: 1.25;
	color: var( --stwb-ink );
	text-decoration: none;
}

.stwb-cart__col-product .variation,
.stwb-cart__col-product dl {
	margin: 4px 0 0;
	font-size: 14px;
	color: var( --stwb-text );
}

.stwb-cart__col-product .stwb-qty {
	margin-top: 10px;
}

.stwb-cart__remove {
	display: inline-block;
	font-size: 22px;
	line-height: 1;
	color: var( --stwb-text );
	text-decoration: none;
}

.stwb-cart__remove:hover {
	color: var( --stwb-ink );
}

/* Fallback bez JS — przy działającym stepperze niepotrzebny. */
.stwb-cart__update {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	border: 0;
	padding: 0;
}

/* --- kupon --- */

.stwb-cart__coupon {
	display: flex;
	gap: 12px;
	margin-top: 16px;
	padding: 16px;
	background: var( --stwb-surface );
	border: 1px solid var( --stwb-line );
	border-radius: 8px;
}

.stwb-cart__coupon input[type="text"] {
	flex: 1 1 auto;
	min-width: 0;
	border: 1px solid var( --stwb-line );
	border-radius: 4px;
	padding: 14px 16px;
}

/* Audyt: kupon miał wyższy kontrast niż „Przejdź do kasy”. */
.stwb-btn--outline {
	background: none;
	border-color: var( --stwb-accent );
	color: var( --stwb-ink );
	flex: 0 0 auto;
}

.stwb-btn--outline:hover,
.stwb-btn--outline:focus {
	background: var( --stwb-accent );
	color: var( --e-global-color-secondary, #000 );
}

/* --- ciemny box podsumowania --- */

.stwb-cart__aside {
	position: sticky;
	top: 24px;
}

.stwb-summary {
	padding: 28px;
	border-radius: 8px;
	background: var( --e-global-color-594e3db, #111 );
	color: var( --e-global-color-d7ce02d, #fff );
}

.stwb-summary__heading {
	margin: 0 0 20px;
	font-family: var( --e-global-typography-text-font-family, "Golos Text" ), sans-serif;
	font-weight: 700;
	font-size: 20px;
}

.stwb-summary__rows {
	width: 100%;
	border-collapse: collapse;
	margin: 0;
}

.stwb-summary__rows th,
.stwb-summary__rows td {
	padding: 6px 0;
	border: 0;
	background: none;
	font-size: 15px;
	font-weight: 400;
	color: var( --e-global-color-d7ce02d, #fff );
}

.stwb-summary__rows td {
	text-align: right;
}

.stwb-summary__row--total th,
.stwb-summary__row--total td {
	padding-top: 12px;
	font-family: var( --e-global-typography-text-font-family, "Golos Text" ), sans-serif;
	font-size: 22px;
	font-weight: 700;
}

.stwb-summary__row--total td,
.stwb-summary__row--total .amount {
	color: var( --e-global-color-primary, #f7bd01 );
	font-size: 28px;
}

.stwb-summary__tax {
	margin: 2px 0 20px;
	font-size: 13px;
	opacity: 0.65;
}

/* CTA w ciemnym boxie. */
.stwb-summary__cta .checkout-button,
.stwb-summary__cta .button {
	display: block;
	width: 100%;
	padding: 18px 24px;
	border: 0;
	border-radius: 4px;
	background: var( --e-global-color-primary, #f7bd01 );
	color: var( --e-global-color-secondary, #000 );
	font-family: "Barlow", sans-serif;
	font-size: 17px;
	font-weight: 600;
	text-transform: uppercase;
	text-align: center;
	text-decoration: none;
	transition: all 0.2s;
}

.stwb-summary__cta .checkout-button:hover,
.stwb-summary__cta .button:hover {
	background: var( --e-global-color-48a4e19, #e3ac00 );
	color: var( --e-global-color-secondary, #000 );
}

.stwb-summary__logos {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 20px 0;
	padding: 0;
	list-style: none;
}

.stwb-summary__logos img {
	max-height: 24px;
	width: auto;
	opacity: 0.9;
}

.stwb-summary__checkpoints {
	margin: 20px 0 0;
	padding: 20px 0 0;
	border-top: 1px solid rgba( 255, 255, 255, 0.15 );
	list-style: none;
}

.stwb-summary__checkpoints li {
	position: relative;
	padding-left: 28px;
	margin-bottom: 12px;
	font-size: 14px;
	line-height: 1.4;
}

.stwb-summary__checkpoints li:last-child {
	margin-bottom: 0;
}

.stwb-summary__checkpoints li::before {
	content: "✓";
	position: absolute;
	left: 0;
	top: 0;
	color: var( --e-global-color-primary, #f7bd01 );
	font-weight: 700;
}

/* --- pusty koszyk --- */

.stwb-cart-empty {
	max-width: 520px;
	margin: 0 auto;
	padding: 48px 24px;
	text-align: center;
}

.stwb-cart-empty__title {
	margin: 0 0 12px;
	font-family: var( --e-global-typography-text-font-family, "Golos Text" ), sans-serif;
	font-size: 32px;
	color: var( --e-global-color-594e3db, #111 );
}

.stwb-cart-empty__text {
	margin: 0 0 24px;
	color: var( --e-global-color-text, #444 );
}

/* --- koszyk: mobile --- */

@media ( max-width: 1024px ) {
	.stwb-cart {
		grid-template-columns: 1fr;
	}

	.stwb-cart__aside {
		position: static;
	}
}

@media ( max-width: 767px ) {
	.stwb-cart__table thead {
		display: none;
	}

	.stwb-cart__table,
	.stwb-cart__table tbody,
	.stwb-cart__table tr,
	.stwb-cart__table td {
		display: block;
		width: 100%;
	}

	.stwb-cart__item {
		position: relative;
		display: grid;
		grid-template-columns: 90px minmax( 0, 1fr );
		gap: 4px 14px;
		padding: 16px;
		border-top: 1px solid var( --stwb-line );
	}

	.stwb-cart__table td {
		padding: 0;
		border: 0;
	}

	.stwb-cart__col-thumb {
		grid-row: 1 / span 2;
	}

	.stwb-cart__col-thumb img {
		width: 90px;
	}

	.stwb-cart__col-remove {
		position: absolute;
		top: 12px;
		right: 12px;
		width: auto;
	}

	.stwb-cart__col-amount {
		text-align: left !important;
		font-weight: 600;
		font-size: 18px;
		color: var( --stwb-ink );
	}

	.stwb-cart__coupon {
		flex-direction: column;
	}
}

.stwb-cart.is-busy,
.stwb-cart-empty.is-busy {
	opacity: 0.55;
	pointer-events: none;
}

/* =====================================================================
 * NADPISANIA — tylko to, czego nie da się usunąć
 *
 * woocommerce-layout i woocommerce-smallscreen są wyłączone globalnie,
 * a woocommerce-general nie ładuje się na koszyku (STWB_Assets).
 * Zostaje walka z Global Kitem Elementora, którego wyłączyć nie można,
 * bo trzyma całą resztę strony.
 *
 *   .elementor-kit-7 h2   (0,1,1)   font-size: 44px
 * ===================================================================== */

/*
 * Nagłówki — Kit narzuca h2 rozmiar 44px ORAZ kolor #111.
 * Kolor jest groźniejszy: box podsumowania też jest #111, więc nagłówek
 * znikał jako czarny na czarnym.
 */
.stwb-summary .stwb-summary__heading {
	font-size: 20px;
	line-height: 1.2;
	color: var( --e-global-color-d7ce02d, #fff );
	overflow-wrap: anywhere;
}

.stwb-cart-empty .stwb-cart-empty__title {
	font-size: 32px;
	line-height: 1.15;
}

.stwb-crosssell .stwb-crosssell__heading,
.stwb-modal .stwb-modal__title {
	font-size: 22px;
	line-height: 1.2;
}

/* Modal żyje też na stronach produktu, gdzie woocommerce-general nadal działa. */
.stwb-modal a.remove {
	color: var( --stwb-text ) !important;
}

/* =====================================================================
 * KOMUNIKATY WOOCOMMERCE
 * Na koszyku nie ma już general, a komunikaty o kuponie muszą być widoczne.
 * ===================================================================== */

.woocommerce-message,
.woocommerce-error,
.woocommerce-info {
	margin: 0 0 20px;
	padding: 16px 20px;
	border-left: 4px solid var( --e-global-color-primary, #f7bd01 );
	border-radius: 4px;
	background: var( --e-global-color-fcd35c1, #fdfdfd );
	color: var( --e-global-color-594e3db, #111 );
	list-style: none;
}

.woocommerce-error {
	border-left-color: #c0392b;
}

.woocommerce-message a,
.woocommerce-error a,
.woocommerce-info a {
	color: var( --e-global-color-594e3db, #111 );
	text-decoration: underline;
}

.woocommerce-error li {
	margin: 0;
	list-style: none;
}

.screen-reader-text {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect( 0 0 0 0 );
	white-space: nowrap;
	border: 0;
}

/* Podtytuł z kategorii produktu — mockup: „Szkolenie online”. */
.stwb-cart__type {
	display: block;
	margin-top: 2px;
	font-size: 14px;
	color: var( --e-global-color-text, #444 );
}
