/**
 * New Checkout for WooCommerce — frontend styles.
 * Every rule is scoped to .nwc-checkout so the theme is never affected.
 * Colors and sizes come from CSS variables printed from the Design settings.
 */

.nwc-checkout {
	--nwc-primary: #4f46e5;
	--nwc-secondary: #eef2ff;
	--nwc-btn-bg: #4f46e5;
	--nwc-btn-text: #ffffff;
	--nwc-bg: #ffffff;
	--nwc-input-bg: #f9fafb;
	--nwc-input-border: #e5e7eb;
	--nwc-text: #374151;
	--nwc-heading: #111827;
	--nwc-radius: 16px;
	--nwc-btn-radius: 12px;
	--nwc-input-radius: 10px;
	--nwc-font-size: 15px;
	--nwc-heading-size: 20px;
	--nwc-label-size: 14px;
	--nwc-btn-size: 17px;
	--nwc-shadow: 0 1px 2px rgba(16, 24, 40, .05), 0 8px 24px rgba(16, 24, 40, .06);
	--nwc-error: #dc2626;
	--nwc-error-bg: #fef2f2;
	--nwc-success: #16a34a;
	--nwc-muted: #6b7280;

	position: relative;
	box-sizing: border-box;
	width: 100%;
	max-width: 620px;
	margin: 16px 0;
	color: var(--nwc-text);
	font-size: var(--nwc-font-size);
	line-height: 1.5;
	text-align: start;
}

.nwc-checkout *,
.nwc-checkout *::before,
.nwc-checkout *::after {
	box-sizing: border-box;
}

.nwc-checkout [hidden] {
	display: none !important;
}

.nwc-checkout .nwc-checkout-form {
	display: flex;
	flex-direction: column;
	gap: 12px;
	margin: 0;
	padding: 16px;
	background: var(--nwc-bg);
	border: 1px solid var(--nwc-input-border);
	border-radius: var(--nwc-radius);
	box-shadow: var(--nwc-shadow);
}

/* Header */
.nwc-checkout .nwc-checkout-header {
	padding: 4px 2px 2px;
}

.nwc-checkout .nwc-checkout-title {
	margin: 0;
	padding: 0;
	color: var(--nwc-heading);
	font-size: var(--nwc-heading-size);
	font-weight: 700;
	line-height: 1.3;
	letter-spacing: normal;
	text-transform: none;
}

.nwc-checkout .nwc-checkout-subtitle {
	margin: 4px 0 0;
	padding: 0;
	color: var(--nwc-muted);
	font-size: calc(var(--nwc-font-size) - 1px);
}

/* Cards */
.nwc-checkout .nwc-card {
	padding: 14px;
	background: var(--nwc-bg);
	border: 1px solid var(--nwc-input-border);
	border-radius: calc(var(--nwc-radius) - 4px);
}

.nwc-checkout .nwc-section {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.nwc-checkout .nwc-section-title {
	color: var(--nwc-heading);
	font-size: calc(var(--nwc-label-size) + 1px);
	font-weight: 700;
}

/* Product */
.nwc-checkout .nwc-product {
	display: flex;
	gap: 14px;
	align-items: center;
	background: var(--nwc-secondary);
	border-color: transparent;
}

.nwc-checkout .nwc-product-media {
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
	overflow: hidden;
	border-radius: calc(var(--nwc-radius) - 6px);
	background: var(--nwc-bg);
}

.nwc-checkout .nwc-product-media img,
.nwc-checkout .nwc-product-placeholder {
	display: block;
	width: 100%;
	height: 100%;
	max-width: none;
	margin: 0;
	object-fit: cover;
	border-radius: 0;
}

.nwc-checkout .nwc-product-placeholder {
	background: linear-gradient(135deg, var(--nwc-input-border), var(--nwc-secondary));
}

.nwc-checkout .nwc-product-info {
	min-width: 0;
}

.nwc-checkout .nwc-product-name {
	color: var(--nwc-heading);
	font-weight: 600;
	line-height: 1.35;
	overflow-wrap: anywhere;
}

.nwc-checkout .nwc-product-price {
	margin-top: 2px;
	color: var(--nwc-primary);
	font-weight: 700;
}

.nwc-checkout .nwc-product-price del {
	color: var(--nwc-muted);
	font-weight: 400;
	opacity: .8;
}

.nwc-checkout .nwc-product-price ins {
	text-decoration: none;
	background: none;
}

.nwc-checkout .nwc-stock-notice {
	margin-top: 4px;
	color: var(--nwc-error);
	font-size: calc(var(--nwc-label-size) - 1px);
	font-weight: 600;
}

/* Fields */
.nwc-checkout .nwc-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
}

.nwc-checkout .nwc-checkout-field {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	margin: 0;
}

.nwc-checkout .nwc-label {
	display: block;
	margin: 0;
	color: var(--nwc-heading);
	font-size: var(--nwc-label-size);
	font-weight: 600;
	line-height: 1.4;
}

.nwc-checkout .nwc-required {
	color: var(--nwc-error);
}

.nwc-checkout .nwc-input,
.nwc-checkout .nwc-select {
	display: block;
	width: 100%;
	height: 48px;
	min-height: 48px;
	margin: 0;
	padding: 0 14px;
	color: var(--nwc-heading);
	font: inherit;
	font-size: 16px; /* 16px prevents iOS zoom on focus */
	line-height: normal;
	background-color: var(--nwc-input-bg);
	border: 1px solid var(--nwc-input-border);
	border-radius: var(--nwc-input-radius);
	box-shadow: none;
	outline: none;
	-webkit-appearance: none;
	appearance: none;
	transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
}

.nwc-checkout .nwc-input::placeholder {
	color: var(--nwc-muted);
	opacity: .7;
}

.nwc-checkout .nwc-input:focus,
.nwc-checkout .nwc-select:focus {
	background-color: var(--nwc-bg);
	border-color: var(--nwc-primary);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--nwc-primary) 18%, transparent);
}

.nwc-checkout .nwc-input-ltr {
	direction: ltr;
	text-align: start;
}

.nwc-checkout[dir="rtl"] .nwc-input-ltr {
	text-align: right;
}

.nwc-checkout .nwc-select {
	padding-inline-end: 40px;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='8' viewBox='0 0 12 8'%3E%3Cpath fill='none' stroke='%236b7280' stroke-width='1.6' stroke-linecap='round' stroke-linejoin='round' d='M1 1.5 6 6.5l5-5'/%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 14px center;
	background-size: 12px 8px;
	cursor: pointer;
}

.nwc-checkout[dir="rtl"] .nwc-select {
	background-position: left 14px center;
}

.nwc-checkout .nwc-select:disabled {
	cursor: not-allowed;
	opacity: .6;
}

.nwc-checkout .nwc-has-error .nwc-input,
.nwc-checkout .nwc-has-error .nwc-select {
	border-color: var(--nwc-error);
	background-color: var(--nwc-error-bg);
}

.nwc-checkout .nwc-field-error {
	color: var(--nwc-error);
	font-size: calc(var(--nwc-label-size) - 1px);
	line-height: 1.4;
}

.nwc-checkout .nwc-field-error:empty {
	display: none;
}

/* Attribute chips */
.nwc-checkout .nwc-chips {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.nwc-checkout .nwc-chip {
	position: relative;
	display: inline-flex;
	margin: 0;
	cursor: pointer;
}

.nwc-checkout .nwc-chip-input,
.nwc-checkout .nwc-ship-input {
	position: absolute;
	width: 1px;
	height: 1px;
	margin: 0;
	padding: 0;
	opacity: 0;
	pointer-events: none;
}

.nwc-checkout .nwc-chip-label {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 48px;
	min-height: 42px;
	padding: 8px 16px;
	color: var(--nwc-heading);
	font-size: var(--nwc-font-size);
	font-weight: 500;
	line-height: 1.2;
	background: var(--nwc-input-bg);
	border: 1.5px solid var(--nwc-input-border);
	border-radius: var(--nwc-input-radius);
	transition: border-color .15s ease, background-color .15s ease, color .15s ease;
	user-select: none;
}

.nwc-checkout .nwc-chip:hover .nwc-chip-label {
	border-color: var(--nwc-primary);
}

.nwc-checkout .nwc-chip-input:checked + .nwc-chip-label {
	color: var(--nwc-primary);
	background: var(--nwc-secondary);
	border-color: var(--nwc-primary);
	font-weight: 600;
}

.nwc-checkout .nwc-chip-input:focus-visible + .nwc-chip-label,
.nwc-checkout .nwc-ship-input:focus-visible ~ .nwc-ship-radio {
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--nwc-primary) 25%, transparent);
}

.nwc-checkout .nwc-chip.is-unavailable .nwc-chip-label {
	color: var(--nwc-muted);
	text-decoration: line-through;
	opacity: .55;
}

.nwc-checkout .nwc-chip.is-unavailable {
	cursor: not-allowed;
}

/* Quantity */
.nwc-checkout .nwc-qty {
	display: inline-flex;
	align-items: stretch;
	width: max-content;
	direction: ltr;
	border: 1px solid var(--nwc-input-border);
	border-radius: var(--nwc-input-radius);
	overflow: hidden;
	background: var(--nwc-input-bg);
}

.nwc-checkout .nwc-qty-btn {
	width: 44px;
	height: 44px;
	margin: 0;
	padding: 0;
	color: var(--nwc-heading);
	font-size: 20px;
	line-height: 1;
	background: transparent;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	cursor: pointer;
}

.nwc-checkout .nwc-qty-btn:hover {
	background: var(--nwc-secondary);
	color: var(--nwc-primary);
}

.nwc-checkout .nwc-qty .nwc-qty-input {
	width: 56px;
	height: 44px;
	min-height: 44px;
	padding: 0 4px;
	text-align: center;
	border: 0;
	border-radius: 0;
	background: transparent;
	-moz-appearance: textfield;
}

.nwc-checkout .nwc-qty .nwc-qty-input:focus {
	box-shadow: none;
}

.nwc-checkout .nwc-qty-input::-webkit-outer-spin-button,
.nwc-checkout .nwc-qty-input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

/* Shipping */
.nwc-checkout .nwc-shipping-options {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.nwc-checkout .nwc-shipping-options:empty {
	display: none;
}

.nwc-checkout .nwc-ship-option {
	position: relative;
	display: flex;
	align-items: center;
	gap: 12px;
	margin: 0;
	padding: 14px;
	background: var(--nwc-input-bg);
	border: 1.5px solid var(--nwc-input-border);
	border-radius: var(--nwc-input-radius);
	cursor: pointer;
	transition: border-color .15s ease, background-color .15s ease;
}

.nwc-checkout .nwc-ship-option:hover {
	border-color: var(--nwc-primary);
}

.nwc-checkout .nwc-ship-option.is-selected {
	background: var(--nwc-secondary);
	border-color: var(--nwc-primary);
}

.nwc-checkout .nwc-ship-radio {
	position: relative;
	flex: 0 0 20px;
	width: 20px;
	height: 20px;
	border: 2px solid var(--nwc-input-border);
	border-radius: 50%;
	background: var(--nwc-bg);
	transition: border-color .15s ease;
}

.nwc-checkout .nwc-ship-input:checked ~ .nwc-ship-radio {
	border-color: var(--nwc-primary);
}

.nwc-checkout .nwc-ship-input:checked ~ .nwc-ship-radio::after {
	content: "";
	position: absolute;
	inset: 3px;
	border-radius: 50%;
	background: var(--nwc-primary);
}

.nwc-checkout .nwc-ship-label {
	flex: 1 1 auto;
	color: var(--nwc-heading);
	font-weight: 500;
}

.nwc-checkout .nwc-ship-price {
	color: var(--nwc-heading);
	font-weight: 700;
	white-space: nowrap;
}

.nwc-checkout .nwc-shipping-hint {
	margin: 0;
	padding: 12px 14px;
	color: var(--nwc-muted);
	font-size: calc(var(--nwc-label-size) - 1px);
	background: var(--nwc-input-bg);
	border: 1px dashed var(--nwc-input-border);
	border-radius: var(--nwc-input-radius);
}

/* Summary */
.nwc-checkout .nwc-summary {
	display: flex;
	flex-direction: column;
	gap: 8px;
	background: var(--nwc-input-bg);
}

.nwc-checkout .nwc-summary-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
}

.nwc-checkout .nwc-summary-row > span:last-child {
	color: var(--nwc-heading);
	font-weight: 600;
	white-space: nowrap;
}

.nwc-checkout .nwc-summary-total-row {
	margin-top: 4px;
	padding-top: 10px;
	border-top: 1px dashed var(--nwc-input-border);
	color: var(--nwc-heading);
	font-weight: 700;
}

.nwc-checkout .nwc-summary-total-row > span:last-child {
	color: var(--nwc-primary);
	font-size: calc(var(--nwc-heading-size) - 1px);
	font-weight: 800;
}

/* Honeypot (visually hidden without off-screen offsets, so RTL pages never scroll sideways) */
.nwc-checkout .nwc-hp {
	position: absolute !important;
	width: 1px !important;
	height: 1px !important;
	overflow: hidden !important;
	clip-path: inset(50%) !important;
	white-space: nowrap;
}

@supports (color: color-mix(in srgb, red 50%, blue)) {
	.nwc-checkout {
		--nwc-muted: color-mix(in srgb, var(--nwc-text) 65%, transparent);
	}
}

/* Notice */
.nwc-checkout .nwc-checkout-notice {
	padding: 12px 14px;
	color: var(--nwc-error);
	font-size: var(--nwc-label-size);
	font-weight: 500;
	background: var(--nwc-error-bg);
	border: 1px solid color-mix(in srgb, var(--nwc-error) 25%, transparent);
	border-radius: var(--nwc-input-radius);
}

/* Buy Now */
.nwc-checkout .nwc-checkout-button {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 54px;
	margin: 0;
	padding: 12px 20px;
	color: var(--nwc-btn-text);
	font: inherit;
	font-size: var(--nwc-btn-size);
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: normal;
	text-transform: none;
	text-decoration: none;
	background: var(--nwc-btn-bg);
	border: 0;
	border-radius: var(--nwc-btn-radius);
	box-shadow: 0 6px 16px color-mix(in srgb, var(--nwc-btn-bg) 30%, transparent);
	cursor: pointer;
	transition: transform .1s ease, filter .15s ease, opacity .15s ease;
	-webkit-appearance: none;
	appearance: none;
}

.nwc-checkout .nwc-checkout-button:hover,
.nwc-checkout .nwc-checkout-button:focus {
	color: var(--nwc-btn-text);
	background: var(--nwc-btn-bg);
	filter: brightness(1.07);
}

.nwc-checkout .nwc-checkout-button:focus-visible {
	outline: 3px solid color-mix(in srgb, var(--nwc-btn-bg) 35%, transparent);
	outline-offset: 2px;
}

.nwc-checkout .nwc-checkout-button:active {
	transform: translateY(1px);
}

.nwc-checkout .nwc-checkout-button:disabled,
.nwc-checkout .nwc-checkout-button[aria-disabled="true"] {
	cursor: not-allowed;
	filter: grayscale(.3);
	opacity: .55;
	box-shadow: none;
}

.nwc-checkout .nwc-button-spinner {
	display: none;
	width: 18px;
	height: 18px;
	border: 2px solid currentColor;
	border-right-color: transparent;
	border-radius: 50%;
	animation: nwc-spin .7s linear infinite;
}

.nwc-checkout .is-loading .nwc-button-spinner {
	display: inline-block;
}

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

/* Success */
.nwc-checkout .nwc-checkout-success {
	outline: none;
}

.nwc-checkout .nwc-success {
	padding: 32px 20px;
	text-align: center;
	background: var(--nwc-bg);
	border: 1px solid var(--nwc-input-border);
	border-radius: var(--nwc-radius);
	box-shadow: var(--nwc-shadow);
	animation: nwc-pop .3s ease-out;
}

.nwc-checkout .nwc-success-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 64px;
	height: 64px;
	margin-bottom: 14px;
	color: #fff;
	background: var(--nwc-success);
	border-radius: 50%;
	box-shadow: 0 0 0 8px color-mix(in srgb, var(--nwc-success) 15%, transparent);
}

.nwc-checkout .nwc-success-title {
	margin: 0 0 8px;
	padding: 0;
	color: var(--nwc-heading);
	font-size: var(--nwc-heading-size);
	font-weight: 700;
}

.nwc-checkout .nwc-success-message {
	color: var(--nwc-text);
}

.nwc-checkout .nwc-success-message p {
	margin: 0 0 8px;
}

@keyframes nwc-pop {
	from {
		opacity: 0;
		transform: translateY(6px);
	}
	to {
		opacity: 1;
		transform: none;
	}
}

/* Tablet & desktop */
@media (min-width: 480px) {
	.nwc-checkout .nwc-checkout-form {
		padding: 20px;
		gap: 14px;
	}

	.nwc-checkout .nwc-grid {
		grid-template-columns: 1fr 1fr;
	}

	.nwc-checkout .nwc-card {
		padding: 16px;
	}

	.nwc-checkout .nwc-product-media {
		flex-basis: 84px;
		width: 84px;
		height: 84px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.nwc-checkout *,
	.nwc-checkout *::before,
	.nwc-checkout *::after {
		animation: none !important;
		transition: none !important;
	}
}
