/* Johnson Cart */

.jc-cart {
	--jc-accent: #c4292f;
	--jc-accent-dark: #840717;
	--jc-border: #e8e8e8;
	--jc-muted: #666666;
	--jc-bg: #ffffff;
	--jc-surface: #fafafa;
	--jc-radius: 8px;
	width: 100%;
	margin: 0 auto;
	font-family: inherit;
	color: #111111;
}

.jc-cart *,
.jc-cart *::before,
.jc-cart *::after {
	box-sizing: border-box;
}

/* Hide default WooCommerce cart block when custom cart is active */
.jc-cart ~ .wp-block-woocommerce-cart,
.jc-cart ~ .woocommerce-cart-form,
body:has(.jc-cart) .wp-block-woocommerce-cart {
	display: none !important;
}

/* Layout */
.jc-cart__layout {
	display: flex;
	flex-direction: column;
	gap: 32px;
}

.jc-cart__top {
	display: grid;
	grid-template-columns: minmax(0, 7fr) minmax(0, 3fr);
	gap: 32px;
	align-items: start;
}

@media (max-width: 991px) {
	.jc-cart__top {
		grid-template-columns: 1fr;
		gap: 24px;
	}
}

/* Header */
.jc-cart__header {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 20px;
	padding-bottom: 16px;
	border-bottom: 2px solid var(--jc-accent);
}

.jc-cart__title {
	margin: 0;
	font-size: clamp(22px, 3vw, 28px);
	font-weight: 700;
	line-height: 1.2;
	color: var(--jc-accent);
}

.jc-cart__count {
	font-size: 14px;
	color: var(--jc-muted);
}

/* Items list */
.jc-cart__items {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.jc-cart-item {
	display: grid;
	grid-template-columns: 100px minmax(0, 1fr);
	gap: 16px;
	padding: 16px;
	border: 1px solid var(--jc-border);
	border-radius: var(--jc-radius);
	background: var(--jc-bg);
	transition: box-shadow 0.2s ease;
}

.jc-cart-item:hover {
	box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
}

@media (max-width: 575px) {
	.jc-cart-item {
		grid-template-columns: 80px minmax(0, 1fr);
		gap: 12px;
		padding: 12px;
	}
}

.jc-cart-item__media-link {
	display: block;
	overflow: hidden;
	border-radius: 6px;
	background: var(--jc-surface);
}

.jc-cart-item__image {
	display: block;
	width: 100%;
	height: auto;
	aspect-ratio: 1;
	object-fit: cover;
}

.jc-cart-item__top {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 8px;
}

.jc-cart-item__name {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
}

.jc-cart-item__name a {
	color: inherit;
	text-decoration: none;
}

.jc-cart-item__name a:hover {
	color: var(--jc-accent);
}

.jc-cart-item__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	border-radius: 4px;
	background: transparent;
	color: #999999;
	cursor: pointer;
	transition: color 0.2s ease, background-color 0.2s ease;
}

.jc-cart-item__remove:hover {
	color: var(--jc-accent);
	background: #fdf2f2;
}

.jc-cart-item__meta {
	margin-top: 6px;
	font-size: 13px;
	color: var(--jc-muted);
}

.jc-cart-item__meta dl {
	margin: 0;
}

.jc-cart-item__footer {
	display: grid;
	grid-template-columns: 1fr auto auto;
	align-items: center;
	gap: 12px;
	margin-top: 12px;
}

@media (max-width: 575px) {
	.jc-cart-item__footer {
		grid-template-columns: 1fr 1fr;
		grid-template-rows: auto auto;
	}

	.jc-cart-item__price {
		grid-column: 1 / -1;
	}

	.jc-cart-item__subtotal {
		justify-self: end;
	}
}

.jc-cart-item__unit {
	font-size: 14px;
	color: var(--jc-muted);
}

.jc-cart-item__subtotal {
	font-size: 16px;
	font-weight: 700;
	color: #111111;
	white-space: nowrap;
}

/* Quantity */
.jc-cart-item__qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--jc-border);
	border-radius: 4px;
	overflow: hidden;
	background: var(--jc-bg);
}

.jc-qty-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	padding: 0;
	border: 0;
	background: var(--jc-surface);
	color: #111111;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.jc-qty-btn:hover {
	background: #eeeeee;
}

.jc-qty-input {
	width: 44px;
	height: 36px;
	padding: 0;
	border: 0;
	border-left: 1px solid var(--jc-border);
	border-right: 1px solid var(--jc-border);
	background: var(--jc-bg);
	color: #111111;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	-moz-appearance: textfield;
}

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

/* Sidebar */
.jc-cart__sidebar {
	display: flex;
	flex-direction: column;
	gap: 20px;
	position: sticky;
	top: 24px;
}

@media (max-width: 991px) {
	.jc-cart__sidebar {
		position: static;
	}
}

.jc-cart__summary {
	padding: 20px;
	border: 1px solid var(--jc-border);
	border-radius: var(--jc-radius);
	background: var(--jc-surface);
}

.jc-summary__title {
	margin: 0 0 16px;
	font-size: 18px;
	font-weight: 700;
}

.jc-summary__rows {
	margin: 0 0 16px;
}

.jc-summary__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 8px;
	font-size: 14px;
}

.jc-summary__row dt,
.jc-summary__row dd {
	margin: 0;
}

.jc-summary__row dd {
	font-weight: 600;
}

.jc-summary__row--discount dd {
	color: var(--jc-accent);
}

.jc-summary__total {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding-top: 16px;
	border-top: 1px solid var(--jc-border);
	font-size: 15px;
}

.jc-summary__total strong {
	font-size: 20px;
	font-weight: 700;
	color: var(--jc-accent);
}

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

/* Full-width shipping form */
.jc-cart__shipping--full {
	width: 100%;
}

.jc-cart__shipping--full .jpv-cart-shipping-wrap {
	margin: 0;
	padding: 24px;
	border: 1px solid var(--jc-border);
	border-radius: var(--jc-radius);
	background: var(--jc-surface);
}

.jc-cart__shipping--full .jpv-cart-shipping-form__heading {
	margin: 0 0 8px;
	font-size: 20px;
	font-weight: 700;
	color: var(--jc-accent);
}

.jc-cart__shipping--full .jpv-cart-shipping-form__notice {
	margin: 0 0 20px;
	font-size: 14px;
	line-height: 1.55;
	color: var(--jc-muted);
}

.jc-cart__shipping-fallback {
	padding: 20px;
	border: 1px dashed var(--jc-border);
	border-radius: var(--jc-radius);
	text-align: center;
}

.jc-cart__checkout-link {
	display: inline-block;
	margin-top: 12px;
}

/* Empty state */
.jc-cart__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	padding: 64px 24px;
	text-align: center;
	border: 1px solid var(--jc-border);
	border-radius: var(--jc-radius);
	background: var(--jc-surface);
}

.jc-cart__empty-icon {
	margin-bottom: 16px;
	color: #cccccc;
}

.jc-cart__empty-title {
	margin: 0 0 8px;
	font-size: 24px;
	font-weight: 700;
}

.jc-cart__empty-text {
	margin: 0 0 24px;
	color: var(--jc-muted);
	font-size: 15px;
}

.jc-cart__empty-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 46px;
	padding: 11px 28px;
	border-radius: 4px;
	background: var(--jc-accent);
	color: #ffffff !important;
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: background-color 0.2s ease;
}

.jc-cart__empty-button:hover {
	background: var(--jc-accent-dark);
	color: #ffffff !important;
}

/* Loading state */
.jc-cart.is-loading {
	opacity: 0.65;
	pointer-events: none;
}

.jc-cart.is-loading::after {
	content: '';
	position: fixed;
	inset: 0;
	z-index: 9999;
	background: rgba(255, 255, 255, 0.35);
	pointer-events: none;
}

/* Shipping form: 2 fields per row */
.jc-cart .jpv-cart-shipping-form__grid,
.jc-cart .jpv-cart-shipping-form__location-grid {
	display: grid;
	grid-template-columns: 1fr;
	gap: 16px;
}

@media (min-width: 640px) {
	.jc-cart .jpv-cart-shipping-form__grid,
	.jc-cart .jpv-cart-shipping-form__location-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}

	/* Email field spans full width on its own row */
	.jc-cart .jpv-cart-shipping-form__grid .jpv-estimate-field[data-field="email"] {
		grid-column: 1 / -1;
	}
}

.jc-cart .jpv-estimate-form > .jpv-estimate-field[data-field="delivery_location"],
.jc-cart .jpv-estimate-form > .jpv-estimate-field[data-field="remarks"] {
	width: 100%;
}

.jc-cart .jpv-cart-shipping-form__actions {
	max-width: 360px;
	margin-top: 8px;
}

.jc-cart .jpv-estimate-submit {
	width: 100%;
}
