/* ==========================================================================
   Smart Jhuri — one-page checkout popup
   Builds on the modal shell defined in products.css.
   ========================================================================== */

.sj-checkout__dialog {
	width: min(660px, 100%);
	max-height: calc(100vh - 40px);
	padding: 0;
	display: flex;
	flex-direction: column;
	overflow: hidden;
}

.sj-checkout__dialog .sj-modal__head {
	flex: none;
	padding: 18px 22px;
	margin-bottom: 0;
}

.sj-checkout__form {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 18px 22px 22px;
}

.sj-checkout.is-loading .sj-checkout__form { opacity: .45; pointer-events: none; }
.sj-checkout .sj-modal__loading { padding: 0 22px 16px; }

/* ---------------------------------------------------------------- Fields */

.sj-checkout__fields {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 18px;
}

.sj-field {
	display: flex;
	align-items: stretch;
	border: 1.5px solid var(--sj-line);
	border-radius: var(--sj-radius-sm);
	overflow: hidden;
	transition: border-color var(--sj-ease);
}
.sj-field:focus-within { border-color: var(--sj-orange); }

.sj-field__icon {
	display: grid;
	place-items: center;
	width: 48px;
	flex: none;
	background: var(--sj-soft);
	color: var(--sj-muted);
}

.sj-field input {
	flex: 1;
	min-width: 0;
	border: 0;
	padding: 13px 14px;
	background: #fff;
	font-family: var(--sj-font-body);
	font-size: 14.5px;
	color: var(--sj-ink);
}
.sj-field input:focus { outline: none; }

/* ------------------------------------------------------------ Line items */

.sj-checkout__items {
	border-top: 1px solid var(--sj-line);
	margin-bottom: 18px;
}

.sj-line {
	display: grid;
	grid-template-columns: auto 64px 1fr auto;
	align-items: center;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--sj-line);
}

.sj-line__remove {
	display: grid;
	place-items: center;
	width: 34px;
	height: 34px;
	flex: none;
	padding: 0;
	border: 0;
	border-radius: var(--sj-radius-sm);
	background: none;
	color: var(--sj-muted);
	cursor: pointer;
}
.sj-line__remove:hover { background: var(--sj-orange-50); color: var(--sj-orange); }

.sj-line__img {
	width: 64px;
	height: 64px;
	object-fit: contain;
	border: 1px solid var(--sj-line);
	border-radius: var(--sj-radius-sm);
	background: #fff;
}

.sj-line__info {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.sj-line__name {
	font-family: var(--sj-font-body);
	font-size: 14px;
	line-height: 1.35;
	color: var(--sj-ink);
}

.sj-line__meta {
	align-self: flex-start;
	padding: 2px 8px;
	border-radius: 999px;
	background: var(--sj-soft);
	font-size: 11.5px;
	color: var(--sj-muted);
}

.sj-line__side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 8px;
	flex: none;
}

.sj-line__price {
	font-family: var(--sj-font-head);
	font-size: 15px;
	font-weight: 700;
	color: var(--sj-ink);
	white-space: nowrap;
}

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

.sj-qty__btn {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	background: var(--sj-orange-50);
	color: var(--sj-orange);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}
.sj-qty__btn:hover { background: var(--sj-orange); color: #fff; }

.sj-qty__value {
	min-width: 36px;
	text-align: center;
	font-family: var(--sj-font-head);
	font-size: 14px;
	font-weight: 600;
}

/* --------------------------------------------- Shipping / payment options */

.sj-checkout__block { margin-bottom: 18px; }

.sj-checkout__legend {
	margin: 0 0 8px;
	font-family: var(--sj-font-head);
	font-size: 15px;
	font-weight: 700;
	color: var(--sj-ink);
}

.sj-options {
	border: 1px solid var(--sj-line);
	border-radius: var(--sj-radius-sm);
	overflow: hidden;
}

.sj-option {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 13px 14px;
	border-bottom: 1px solid var(--sj-line);
	cursor: pointer;
}
.sj-option:last-child { border-bottom: 0; }
.sj-option:hover { background: var(--sj-blue-50); }

.sj-option input {
	width: 17px;
	height: 17px;
	flex: none;
	accent-color: var(--sj-blue);
}

.sj-option__label {
	flex: 1;
	font-family: var(--sj-font-body);
	font-size: 14.5px;
	color: var(--sj-ink);
}

.sj-option__cost {
	font-family: var(--sj-font-head);
	font-size: 14px;
	font-weight: 700;
	color: var(--sj-ink);
}

/* Gateways may render their own inputs or instructions. */
.sj-option__fields {
	padding: 12px 14px;
	border-bottom: 1px solid var(--sj-line);
	background: var(--sj-soft);
	font-size: 13.5px;
	color: var(--sj-muted);
}
.sj-option__fields p { margin: 0; }
.sj-option__fields[hidden] { display: none; }

/* ---------------------------------------------------------------- Coupon */

.sj-coupon__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	padding: 13px 14px;
	border: 1px solid var(--sj-line);
	border-radius: var(--sj-radius-sm);
	background: #fff;
	color: var(--sj-ink);
	font-family: var(--sj-font-head);
	font-size: 14.5px;
	font-weight: 600;
	cursor: pointer;
}
.sj-coupon__toggle .sj-icon { color: var(--sj-muted); transition: transform var(--sj-ease); }
.sj-coupon__toggle[aria-expanded="true"] .sj-icon { transform: rotate(180deg); }

.sj-coupon__panel {
	display: flex;
	gap: 8px;
	margin-top: 8px;
}
.sj-coupon__panel[hidden] { display: none; }

.sj-coupon__input {
	flex: 1;
	min-width: 0;
	height: 44px;
	padding: 0 14px;
	border: 1.5px solid var(--sj-line);
	border-radius: var(--sj-radius-sm);
	font-family: var(--sj-font-body);
	font-size: 14px;
}
.sj-coupon__input:focus { outline: none; border-color: var(--sj-orange); }

.sj-coupon__apply {
	height: 44px;
	padding: 0 20px;
	border: 0;
	border-radius: var(--sj-radius-sm);
	background: var(--sj-blue);
	color: #fff;
	font-family: var(--sj-font-head);
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}
.sj-coupon__apply:hover { background: var(--sj-blue-600); }

.sj-coupon__applied {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 8px;
}

.sj-coupon__tag {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 5px 10px;
	border-radius: 999px;
	background: var(--sj-green-50);
	color: var(--sj-green-600);
	font-size: 12.5px;
	font-weight: 600;
}
.sj-coupon__tag button {
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
}

/* -------------------------------------------------------- Totals + submit */

.sj-checkout__totals {
	padding: 14px 16px;
	margin-bottom: 14px;
	border-radius: var(--sj-radius-sm);
	background: var(--sj-soft);
}

.sj-total {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 5px 0;
	font-family: var(--sj-font-body);
	font-size: 14px;
	color: var(--sj-body);
}

.sj-total--grand {
	margin-top: 6px;
	padding-top: 10px;
	border-top: 1px solid var(--sj-line);
	font-family: var(--sj-font-head);
	font-size: 17px;
	font-weight: 700;
	color: var(--sj-ink);
}

.sj-checkout__error {
	margin: 0 0 12px;
	padding: 11px 14px;
	border-radius: var(--sj-radius-sm);
	background: #FEF2F2;
	color: #B91C1C;
	font-size: 13.5px;
}
.sj-checkout__error[hidden] { display: none; }

.sj-checkout__submit {
	display: block;
	width: 100%;
	min-height: 54px;
	border: 0;
	border-radius: var(--sj-radius-sm);
	background: var(--sj-orange);
	color: #fff;
	font-family: var(--sj-font-head);
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	transition: background var(--sj-ease);
}
.sj-checkout__submit:hover:not([disabled]) { background: var(--sj-orange-600); }
.sj-checkout__submit[disabled] { opacity: .7; cursor: wait; }
.sj-checkout__submit.is-loading .sj-checkout__submit-label::after { content: "…"; }

.sj-checkout__reassure {
	margin: 10px 0 0;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	color: var(--sj-green-600);
}

/* Explains why the email field is there when nothing is forcing it. */
.sj-checkout__hint {
	margin: -4px 0 4px;
	padding: 8px 12px;
	border-radius: var(--sj-radius-sm);
	background: var(--sj-blue-50);
	color: var(--sj-blue-700);
	font-size: 12.5px;
	line-height: 1.5;
}

@media (max-width: 575px) {
	.sj-checkout__dialog { max-height: calc(100vh - 24px); }
	.sj-checkout__dialog .sj-modal__head { padding: 14px 16px; }
	.sj-checkout__form { padding: 14px 16px 18px; }

	.sj-line {
		grid-template-columns: auto 52px 1fr;
		gap: 10px;
	}
	.sj-line__img { width: 52px; height: 52px; }
	.sj-line__name { font-size: 13px; }

	/* Price and quantity move onto their own row rather than squeezing. */
	.sj-line__side {
		grid-column: 2 / -1;
		flex-direction: row;
		align-items: center;
		justify-content: space-between;
		width: 100%;
	}

	.sj-checkout__submit { min-height: 50px; font-size: 15px; }
}


/* ==========================================================================
   Checkout page — the same form, as a page card instead of a dialog
   ========================================================================== */

.sj-checkout--page {
	width: min(660px, 100%);
	margin: 0 auto 40px;
}

.sj-checkout__card {
	position: relative;
	background: #fff;
	border: 1px solid var(--sj-line);
	border-radius: 16px;
	box-shadow: var(--sj-shadow-sm);
	overflow: hidden;
}

.sj-checkout__head {
	padding: 18px 22px;
	border-bottom: 1px solid var(--sj-line);
}

.sj-checkout__head-title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	letter-spacing: -.01em;
}

.sj-checkout__head-sub {
	margin: 4px 0 0;
	font-size: 13.5px;
	color: var(--sj-muted);
}

/*
 * On the page the form is not a scroll container: the page itself scrolls,
 * so the dialog's inner overflow would trap the content in a short box.
 */
.sj-checkout--page .sj-checkout__form {
	overflow: visible;
	max-height: none;
}

.sj-checkout--page.is-loading .sj-checkout__form { opacity: .45; pointer-events: none; }
.sj-checkout--page .sj-modal__loading { padding: 0 22px 16px; }

/* The page title above the card would only repeat the card's own heading. */
.woocommerce-checkout .sj-page-title { display: none; }

/* ==========================================================================
   Empty cart — the checkout page state and the header popup share this
   ========================================================================== */

.sj-empty-cart__dialog {
	width: min(420px, 100%);
	text-align: center;
}

.sj-empty-cart__body {
	display: grid;
	justify-items: center;
	gap: 6px;
	padding: 22px 20px 8px;
	text-align: center;
}

/* On the checkout page it stands alone, so it carries its own frame. */
.woocommerce-checkout .sj-empty-cart__body {
	max-width: 520px;
	margin: 0 auto 40px;
	padding: 48px 28px;
	border: 1px dashed var(--sj-line);
	border-radius: 16px;
	background: var(--sj-soft);
}

.sj-empty-cart__icon {
	display: grid;
	place-items: center;
	width: 68px;
	height: 68px;
	margin-bottom: 6px;
	border-radius: 50%;
	background: var(--sj-orange-50);
	color: var(--sj-orange);
}

.sj-empty-cart__title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
}

.sj-empty-cart__text {
	margin: 0 0 14px;
	max-width: 40ch;
	font-size: 14px;
	color: var(--sj-muted);
}

@media (max-width: 575px) {
	.sj-checkout__head { padding: 14px 16px; }
	.sj-checkout__head-title { font-size: 18px; }
	.woocommerce-checkout .sj-empty-cart__body { padding: 36px 20px; }
}
