/**
 * JDM Majda – kalkulator pelletu (front end).
 * Kolor marki: #ED7013
 */

.jdm-kalk {
	--jdm-brand: #ed7013;
	--jdm-brand-dark: #c95c07;
	--jdm-brand-soft: #fef3e9;
	--jdm-ink: #1f2733;
	--jdm-muted: #667085;
	--jdm-line: #e4e7ec;
	--jdm-bg: #ffffff;
	--jdm-radius: 12px;
	--jdm-shadow: 0 2px 14px rgba(16, 24, 40, 0.07);
	/* Odstęp panelu wyceny od góry okna – wysokość przyklejonego nagłówka
	   motywu. Do nadpisania w motywie potomnym, jeśli nagłówek zmieni wysokość. */
	--jdm-sticky-top: 130px;

	box-sizing: border-box;
	color: var(--jdm-ink);
	font-size: 16px;
	line-height: 1.5;
}

.jdm-kalk *,
.jdm-kalk *::before,
.jdm-kalk *::after {
	box-sizing: inherit;
}

.jdm-kalk__layout {
	display: grid;
	grid-template-columns: minmax(0, 1fr);
	gap: 28px;
	/* Celowo bez align-items: start – kolumna z podsumowaniem musi być
	   rozciągnięta na wysokość wiersza, inaczej position: sticky nie ma
	   zakresu ruchu i panel nie podąża za scrollem. */
}

/* Kolumna z produktami nie musi być rozciągana. */
.jdm-kalk__main {
	align-self: start;
	min-width: 0;
}

@media (min-width: 992px) {
	.jdm-kalk__layout {
		grid-template-columns: minmax(0, 1fr) 360px;
	}
}

/* --- Kroki --------------------------------------------------------------- */

.jdm-step {
	margin-bottom: 34px;
}

.jdm-step__title {
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0 0 6px;
	font-size: 22px;
	line-height: 1.25;
}

.jdm-step__num {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 32px;
	height: 32px;
	border-radius: 50%;
	background: var(--jdm-brand);
	color: #fff;
	font-size: 16px;
	font-weight: 700;
}

.jdm-step__hint {
	margin: 0 0 18px;
	color: var(--jdm-muted);
	font-size: 15px;
}

/* --- Produkty ------------------------------------------------------------ */

.jdm-products {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(260px, 1fr));
	gap: 18px;
}

.jdm-product {
	display: flex;
	flex-direction: column;
	padding: 20px;
	border: 1px solid var(--jdm-line);
	border-radius: var(--jdm-radius);
	background: var(--jdm-bg);
	box-shadow: var(--jdm-shadow);
	transition: border-color 0.15s ease, transform 0.15s ease;
}

.jdm-product:hover {
	border-color: var(--jdm-brand);
}

.jdm-product.is-unavailable {
	opacity: 0.55;
	filter: grayscale(1);
	box-shadow: none;
}

.jdm-product.is-unavailable:hover {
	border-color: var(--jdm-line);
}

.jdm-product__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 8px;
}

.jdm-product__name {
	margin: 0;
	font-size: 19px;
	line-height: 1.3;
}

.jdm-badge {
	flex: 0 0 auto;
	padding: 3px 9px;
	border-radius: 999px;
	font-size: 12px;
	font-weight: 600;
	white-space: nowrap;
}

.jdm-badge--ok {
	background: #e7f6ec;
	color: #17643a;
}

.jdm-badge--out {
	background: #fdecec;
	color: #9b1c1c;
}

.jdm-product__desc {
	margin: 0 0 14px;
	color: var(--jdm-muted);
	font-size: 14px;
}

.jdm-product__specs {
	margin: 0 0 16px;
	padding: 14px 0 0;
	border-top: 1px solid var(--jdm-line);
}

.jdm-product__specs > div {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	padding: 3px 0;
}

.jdm-product__specs dt {
	margin: 0;
	color: var(--jdm-muted);
	font-size: 14px;
	font-weight: 400;
}

.jdm-product__specs dd {
	margin: 0;
	font-size: 15px;
	font-weight: 600;
}

.jdm-product__price {
	color: var(--jdm-brand);
}

.jdm-product__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px;
	margin-top: auto;
}

.jdm-product__msg {
	min-height: 20px;
	margin: 8px 0 0;
	font-size: 13px;
	color: var(--jdm-muted);
}

.jdm-product__msg--ok {
	color: #17643a;
	font-weight: 600;
}

.jdm-product__msg--warn,
.jdm-product__msg--out {
	color: #9b1c1c;
	font-weight: 600;
}

/* --- Licznik ilości ------------------------------------------------------ */

.jdm-qty {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid var(--jdm-line);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
}

.jdm-qty__btn {
	min-width: 38px;
	padding: 0 10px;
	border: 0;
	background: #f7f8fa;
	color: var(--jdm-ink);
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.jdm-qty__btn:hover,
.jdm-qty__btn:focus-visible {
	background: var(--jdm-brand);
	color: #fff;
}

.jdm-qty__input {
	width: 62px;
	height: 40px;
	padding: 0 6px;
	border: 0;
	border-left: 1px solid var(--jdm-line);
	border-right: 1px solid var(--jdm-line);
	text-align: center;
	font-size: 16px;
	font-weight: 600;
	background: #fff;
	color: var(--jdm-ink);
	-moz-appearance: textfield;
}

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

.jdm-qty--sm .jdm-qty__btn {
	min-width: 30px;
	height: 30px;
	font-size: 15px;
}

.jdm-qty__value {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 38px;
	border-left: 1px solid var(--jdm-line);
	border-right: 1px solid var(--jdm-line);
	font-weight: 700;
	font-size: 14px;
}

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

.jdm-kalk .jdm-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 11px 18px;
	border: 1px solid var(--jdm-brand);
	border-radius: 8px;
	background: transparent;
	color: var(--jdm-brand);
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease;
}

.jdm-kalk .jdm-btn--add:hover,
.jdm-kalk .jdm-btn--add:focus-visible {
	background: var(--jdm-brand);
	color: #fff;
}

.jdm-kalk .jdm-btn--primary {
	background: var(--jdm-brand);
	color: #fff;
}

.jdm-kalk .jdm-btn--primary:hover,
.jdm-kalk .jdm-btn--primary:focus-visible {
	background: var(--jdm-brand-dark);
	border-color: var(--jdm-brand-dark);
	color: #fff;
}

.jdm-kalk .jdm-btn--primary[disabled] {
	opacity: 0.6;
	cursor: progress;
}

.jdm-kalk .jdm-btn--block {
	width: 100%;
	padding: 14px 18px;
	font-size: 16px;
}

/* --- Transport ----------------------------------------------------------- */

.jdm-transport {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(240px, 1fr));
	gap: 14px;
}

.jdm-radio {
	display: block;
	cursor: pointer;
}

.jdm-radio input {
	position: absolute;
	opacity: 0;
	width: 0;
	height: 0;
}

.jdm-radio__box {
	display: block;
	height: 100%;
	padding: 16px 18px;
	border: 2px solid var(--jdm-line);
	border-radius: var(--jdm-radius);
	background: #fff;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.jdm-radio input:checked + .jdm-radio__box {
	border-color: var(--jdm-brand);
	background: var(--jdm-brand-soft);
}

.jdm-radio input:focus-visible + .jdm-radio__box {
	outline: 2px solid var(--jdm-brand);
	outline-offset: 2px;
}

.jdm-radio__title {
	display: block;
	font-size: 16px;
	font-weight: 700;
}

.jdm-radio__desc {
	display: block;
	margin-top: 4px;
	color: var(--jdm-muted);
	font-size: 14px;
}

.jdm-radio__price {
	display: block;
	margin-top: 8px;
	color: var(--jdm-brand);
	font-weight: 700;
}

.jdm-delivery {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
	margin-top: 18px;
	padding: 18px;
	border: 1px dashed var(--jdm-brand);
	border-radius: var(--jdm-radius);
	background: var(--jdm-brand-soft);
}

/* --- Uwaga o łączeniu dostaw --------------------------------------------- */

.jdm-note {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin: 14px 0 0;
	padding: 12px 14px;
	border: 1px solid rgba(237, 112, 19, 0.35);
	border-radius: 8px;
	background: var(--jdm-brand-soft);
	color: var(--jdm-ink);
	font-size: 13px;
	line-height: 1.5;
}

.jdm-note__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 20px;
	height: 20px;
	border-radius: 50%;
	background: var(--jdm-brand);
	color: #fff;
	font-size: 12px;
	font-weight: 700;
	font-style: italic;
	line-height: 1;
}

.jdm-note--delivery {
	grid-column: 1 / -1;
	margin-top: 4px;
	background: #fff;
}

.jdm-note--summary {
	margin-bottom: 16px;
}

/* --- Pola formularza ----------------------------------------------------- */

.jdm-field {
	margin-bottom: 14px;
}

.jdm-field label {
	display: block;
	margin-bottom: 5px;
	font-size: 14px;
	font-weight: 600;
}

.jdm-kalk input[type="text"],
.jdm-kalk input[type="tel"],
.jdm-kalk input[type="email"],
.jdm-kalk input[type="number"]:not(.jdm-qty__input),
.jdm-kalk textarea {
	width: 100%;
	padding: 10px 12px;
	border: 1px solid var(--jdm-line);
	border-radius: 8px;
	background: #fff;
	color: var(--jdm-ink);
	font-size: 15px;
	font-family: inherit;
}

.jdm-kalk input:focus,
.jdm-kalk textarea:focus {
	outline: none;
	border-color: var(--jdm-brand);
	box-shadow: 0 0 0 3px rgba(237, 112, 19, 0.15);
}

.jdm-field__hint {
	margin: 5px 0 0;
	color: var(--jdm-muted);
	font-size: 13px;
}

.jdm-req {
	color: var(--jdm-brand);
}

.jdm-checkbox {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	font-size: 13px;
	font-weight: 400;
	line-height: 1.45;
	color: var(--jdm-muted);
}

.jdm-checkbox input {
	margin-top: 3px;
	flex: 0 0 auto;
}

.jdm-hp {
	position: absolute;
	left: -9999px;
	width: 1px;
	height: 1px;
	overflow: hidden;
}

/* --- Podsumowanie -------------------------------------------------------- */

.jdm-summary {
	padding: 22px;
	border: 1px solid var(--jdm-line);
	border-top: 4px solid var(--jdm-brand);
	border-radius: var(--jdm-radius);
	background: #fff;
	box-shadow: var(--jdm-shadow);
}

@media (min-width: 992px) {
	.jdm-summary {
		position: sticky;
		top: var(--jdm-sticky-top);
		/* Zabezpieczenie na niskie ekrany: gdyby panel był wyższy niż okno,
		   przewija się wewnętrznie, żeby przycisk wysyłki zawsze dało się kliknąć. */
		max-height: calc(100vh - var(--jdm-sticky-top) - 24px);
		overflow-y: auto;
	}
}

.jdm-summary__title {
	margin: 0 0 14px;
	font-size: 20px;
}

.jdm-cart {
	margin: 0 0 16px;
	padding: 0;
	list-style: none;
	max-height: 320px;
	overflow-y: auto;
}

.jdm-cart__empty {
	padding: 14px;
	border: 1px dashed var(--jdm-line);
	border-radius: 8px;
	color: var(--jdm-muted);
	font-size: 14px;
	text-align: center;
}

.jdm-cart__item {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 4px 10px;
	padding: 12px 0;
	border-bottom: 1px solid var(--jdm-line);
}

.jdm-cart__head {
	grid-column: 1 / -1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
}

.jdm-cart__name {
	font-weight: 700;
	font-size: 15px;
}

.jdm-cart__remove {
	width: 24px;
	height: 24px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #f2f4f7;
	color: var(--jdm-muted);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}

.jdm-cart__remove:hover,
.jdm-cart__remove:focus-visible {
	background: #fdecec;
	color: #9b1c1c;
}

.jdm-cart__controls {
	display: flex;
	align-items: center;
	gap: 8px;
	flex-wrap: wrap;
}

.jdm-cart__unit {
	color: var(--jdm-muted);
	font-size: 13px;
}

.jdm-cart__value {
	align-self: center;
	text-align: right;
	font-size: 15px;
}

.jdm-cart__weight {
	grid-column: 1 / -1;
	color: var(--jdm-muted);
	font-size: 12px;
}

.jdm-totals {
	margin: 0 0 18px;
	padding: 16px 0 0;
	border-top: 1px solid var(--jdm-line);
}

.jdm-totals__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	padding: 4px 0;
}

.jdm-totals__row dt {
	margin: 0;
	color: var(--jdm-muted);
	font-size: 14px;
	font-weight: 400;
}

.jdm-totals__row dd {
	margin: 0;
	font-weight: 600;
	font-size: 15px;
	white-space: nowrap;
}

.jdm-totals__row--grand {
	margin-top: 8px;
	padding-top: 12px;
	border-top: 1px solid var(--jdm-line);
}

.jdm-totals__row--grand dt {
	color: var(--jdm-ink);
	font-size: 16px;
	font-weight: 700;
}

.jdm-totals__row--grand dd {
	color: var(--jdm-brand);
	font-size: 22px;
	font-weight: 800;
}

.jdm-totals__row--muted dt,
.jdm-totals__row--muted dd {
	color: var(--jdm-muted);
	font-size: 13px;
	font-weight: 500;
}

.jdm-footnote {
	margin: 12px 0 0;
	color: var(--jdm-muted);
	font-size: 12.5px;
	line-height: 1.5;
}

.jdm-summary__msg {
	min-height: 18px;
	margin: 8px 0 0;
	font-size: 13px;
	font-weight: 600;
}

.jdm-summary__msg--error {
	color: #9b1c1c;
}

/* --- Modal --------------------------------------------------------------- */

.jdm-modal {
	width: min(680px, calc(100vw - 32px));
	max-width: 680px;
	max-height: calc(100vh - 48px);
	padding: 0;
	border: 0;
	border-radius: var(--jdm-radius);
	background: #fff;
	color: var(--jdm-ink);
	box-shadow: 0 24px 60px rgba(16, 24, 40, 0.28);
	overflow: hidden;
}

.jdm-modal::backdrop {
	background: rgba(16, 24, 40, 0.62);
}

/* Zapasowy wygląd, gdy przeglądarka nie obsługuje <dialog>. */
.jdm-modal:not([open]) {
	display: none;
}

.jdm-modal[open] {
	display: block;
	margin: auto;
}

.jdm-modal__inner {
	display: flex;
	flex-direction: column;
	max-height: calc(100vh - 48px);
}

.jdm-modal__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 22px;
	border-bottom: 1px solid var(--jdm-line);
	background: var(--jdm-brand-soft);
}

.jdm-modal__title {
	margin: 0;
	font-size: 19px;
	line-height: 1.3;
}

.jdm-modal__close {
	width: 34px;
	height: 34px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--jdm-muted);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.jdm-modal__close:hover,
.jdm-modal__close:focus-visible {
	background: #fff;
	color: var(--jdm-brand);
}

.jdm-modal__body {
	padding: 20px 22px 24px;
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

/* --- Zestawienie w modalu ------------------------------------------------ */

.jdm-recap__list {
	margin: 0 0 14px;
	padding: 0;
	list-style: none;
}

.jdm-recap__item {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 8px 0;
	border-bottom: 1px solid var(--jdm-line);
}

.jdm-recap__label {
	font-size: 15px;
}

.jdm-recap__amount {
	white-space: nowrap;
}

.jdm-recap__totals {
	margin: 0;
	padding: 4px 0 0;
}

/* --- Formularz zapytania ------------------------------------------------- */

.jdm-form {
	margin-top: 22px;
	padding-top: 20px;
	border-top: 1px solid var(--jdm-line);
}

.jdm-form__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 0 16px;
}

/* --- Potwierdzenie wysyłki ----------------------------------------------- */

.jdm-success {
	padding: 18px 0 6px;
	text-align: center;
}

.jdm-success__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	margin: 0 auto 14px;
	border-radius: 50%;
	background: #e7f6ec;
	color: #17643a;
	font-size: 28px;
	line-height: 1;
}

.jdm-success__msg {
	margin: 0 0 18px;
	font-size: 16px;
	font-weight: 600;
}

.jdm-form__title {
	margin: 0 0 14px;
	font-size: 17px;
}

.jdm-form__msg {
	margin: 12px 0 0;
	font-size: 14px;
	font-weight: 600;
}

.jdm-form__msg--ok {
	color: #17643a;
}

.jdm-form__msg--error {
	color: #9b1c1c;
}

.jdm-kalk-empty {
	padding: 18px;
	border: 1px dashed #ed7013;
	border-radius: 12px;
	text-align: center;
}

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

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