/* GHN Cart Table — 3-column layout */

/* ── Empty cart ── */
/* Divi's core CSS hides the whole module (`display: none`) when it adds the
   `et_pb_wc_cart_empty` class, since by default it renders no inner content
   for an empty cart. We inject our own message via render_block filter, so
   force the module visible again in that state. */
.et_pb_wc_cart_products.et_pb_wc_cart_empty {
	display: block !important;
}

.ghn-wc-cart-empty-msg {
	text-align: left !important;
	padding: 0 !important;
	font-size: 2rem !important;
}

/* ── Table structure ── */
.ghn-cart-table {
	border-collapse: collapse;
	width: 100%;
}

.ghn-cart-table thead tr,
.ghn-cart-table thead tr th {
	padding-top: 0 !important;
	padding-bottom: 0 !important;
}

.ghn-cart-table thead tr th {
	font-weight: 600;
	font-size: 0.9rem;
	text-transform: none;
	letter-spacing: 0;
	border-bottom: none !important;
}

.ghn-cart-table tbody .woocommerce-cart-form__cart-item:first-child,
.ghn-cart-table tbody .woocommerce-cart-form__cart-item:first-child td {
	padding-top: 0 !important;
}

.ghn-cart-table thead tr th {
	padding-bottom: 40px !important;
}

.ghn-cart-table thead th:first-child,
.ghn-cart-table tbody td:first-child {
	padding-left: 0 !important;
}

.ghn-cart-table thead th:last-child,
.ghn-cart-table tbody td:last-child {
	padding-right: 0 !important;
}

.ghn-cart-table thead th.product-name {
	text-align: left;
}

.ghn-cart-table thead th.product-quantity {
	text-align: left;
}

.ghn-cart-table thead th.product-subtotal {
	text-align: right;
}

/* ── Row ── */
.ghn-cart-table tbody .woocommerce-cart-form__cart-item td {
	padding: 20px 0;
	border-top: none !important;
	border-bottom: 1px solid #e5e5e5;
	vertical-align: middle;
}

.ghn-cart-table tbody .woocommerce-cart-form__cart-item td.product-quantity,
.ghn-cart-table tbody .woocommerce-cart-form__cart-item td.product-subtotal {
	vertical-align: top;
}

.ghn-cart-table tbody .woocommerce-cart-form__cart-item:first-child td {
	border-top: none !important;
}

/* ── Product cell ── */
.ghn-cart-table th.product-name,
.ghn-cart-table td.product-name {
	width: 50% !important;
}

.ghn-product-cell {
	display: flex;
	align-items: flex-start;
	gap: 20px;
}

.ghn-product-thumb {
	flex-shrink: 0;
	width: 90px;
	height: 90px;
	border-radius: 10px;
	overflow: hidden;
	background: #f6f6f6;
}

.ghn-product-thumb img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.ghn-product-thumb a {
	display: block;
	width: 100%;
	height: 100%;
}

.ghn-product-info {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.ghn-product-info a {
	font-weight: 600;
	font-size: 1rem;
	color: inherit;
	text-decoration: none;
}

.ghn-product-info a:hover {
	text-decoration: underline;
}

.ghn-product-info .variation,
.ghn-product-info dl.variation {
	margin: 0;
	font-size: 0.875rem;
	color: #555;
}

.ghn-product-info dl.variation dt,
.ghn-product-info dl.variation dd {
	display: inline;
	margin: 0;
}

.ghn-product-info dl.variation dt::after {
	content: ': ';
}

.ghn-product-info dl.variation dd::after {
	content: '';
}

/* ── Quantity cell ── */
.ghn-qty-cell {
	display: flex;
	align-items: center;
	justify-content: flex-start;
	gap: 80px;
}

.ghn-qty-stepper {
	display: flex;
	align-items: center;
	border: 1.5px solid #333;
	border-radius: 999px;
	overflow: hidden;
	height: 36px;
	width: 100px;
	flex-shrink: 0;
}

.ghn-qty-btn {
	background: transparent;
	border: none;
	cursor: pointer;
	font-size: 1.1rem;
	line-height: 1;
	flex: 0 0 28px;
	height: 36px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #333;
	padding: 0;
	transition: background 0.15s;
}

.ghn-qty-btn:hover {
	background: #f0f0f0;
}

.ghn-qty-stepper .quantity {
	display: flex;
	align-items: center;
	justify-content: center;
	flex: 1;
}

.ghn-qty-stepper .quantity input.qty {
	border: none;
	border-left: 1.5px solid #333;
	border-right: 1.5px solid #333;
	border-radius: 0;
	text-align: center !important;
	width: 100%;
	height: 36px;
	line-height: 36px;
	font-size: 0.95rem;
	font-weight: 500;
	padding: 0 !important;
	-moz-appearance: textfield;
	background: #fff;
	box-shadow: none;
	outline: none;
}

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

/* ── Remove (trash) button ── */
/* Higher specificity + !important needed to override WooCommerce core's
   `.woocommerce a.remove` / `.woocommerce a.remove:hover` rules (red circle,
   forced white color, 1em box) which still apply since the link keeps the
   `remove` class alongside `ghn-remove-btn`. */
.woocommerce a.remove.ghn-remove-btn {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: auto !important;
	height: auto !important;
	font-size: inherit !important;
	line-height: inherit !important;
	border-radius: 0 !important;
	background: none !important;
	color: #374a36 !important;
	text-decoration: none;
	transition: color 0.15s;
	flex-shrink: 0;
}

.woocommerce a.remove.ghn-remove-btn:hover {
	color: #cc0000 !important;
	background: none !important;
}

.ghn-remove-btn svg {
	display: block;
}

/* ── Subtotal / Total cell ── */
.ghn-cart-table td.product-subtotal {
	text-align: right;
}

.ghn-subtotal-wrap {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 2px;
	line-height: 1.4;
}

.ghn-original-price {
	color: #999;
	font-weight: 400;
	font-size: 0.9rem;
	text-decoration: line-through;
}

.ghn-discount-pct {
	color: #333;
	font-size: 0.9rem;
}

.ghn-final-price {
	font-weight: 700;
	font-size: 1rem;
}

/* ── Loading overlay ── */
.ghn-cart-overlay {
	position: fixed;
	inset: 0;
	background: rgba(255, 255, 255, 0.6);
	z-index: 9999;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ghn-cart-spinner {
	width: 36px;
	height: 36px;
	border: 3px solid #ddd;
	border-top-color: #333;
	border-radius: 50%;
	animation: ghn-spin 0.7s linear infinite;
}

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

/* ── Actions row ── */
.ghn-cart-table .actions {
	padding-top: 20px;
}

/* ── Cart totals summary ── */
.ghn-cart-totals {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	max-width: 320px;
	margin-left: auto;
	font-size: 1rem;
}

.ghn-cart-totals__row {
	display: flex;
	justify-content: space-between;
	gap: 20px;
}

.ghn-cart-totals__label {
	color: #555;
}

.ghn-cart-totals__row--subtotal .ghn-cart-totals__label,
.ghn-cart-totals__row--subtotal .ghn-cart-totals__value {
	font-weight: 700;
}

/* ── Responsive: stack on mobile ── */
@media (max-width: 600px) {
	.ghn-cart-table thead {
		display: none;
	}

	.ghn-cart-table tbody .woocommerce-cart-form__cart-item {
		display: block;
		background: #fafafa;
		border-radius: 12px;
		border-bottom: none;
		padding: 24px;
		margin-bottom: 12px;
	}

	.ghn-cart-table tbody .woocommerce-cart-form__cart-item td {
		display: block;
		border: none;
		padding: 6px 0;
		text-align: left !important;
	}

	.ghn-cart-table th.product-name,
	.ghn-cart-table td.product-name {
		width: 100% !important;
	}

	/* WooCommerce floats a bold data-title label (::before) next to each cell;
	   drop it for product/quantity since the image and stepper are self-explanatory. */
	.ghn-cart-table tbody .woocommerce-cart-form__cart-item td.product-name::before,
	.ghn-cart-table tbody .woocommerce-cart-form__cart-item td.product-quantity::before {
		content: none;
		display: none;
	}

	.ghn-product-thumb {
		width: 64px;
		height: 64px;
	}

	.ghn-product-cell {
		gap: 12px;
		align-items: center;
	}

	.ghn-qty-cell {
		justify-content: space-between;
		width: 100%;
		gap: 16px;
	}

	/* Un-float the "Total:" label so it sits inline with the price instead of
	   breaking the flex layout. */
	.ghn-cart-table tbody .woocommerce-cart-form__cart-item td.product-subtotal {
		display: flex;
		align-items: baseline;
		justify-content: space-between;
		gap: 12px;
		text-align: left;
	}

	.ghn-cart-table tbody .woocommerce-cart-form__cart-item td.product-subtotal::before {
		float: none;
		flex-shrink: 0;
	}

	.ghn-subtotal-wrap {
		flex-direction: row;
		flex-wrap: wrap;
		align-items: baseline;
		justify-content: flex-end;
		gap: 6px;
	}
}
