/*
 * ADHDHacker - commerce funnel layer
 *
 * Loaded ONLY on cart, checkout and My Account. These pages are personalised
 * and must never be served from a public page cache, so keeping their CSS
 * separate also keeps the cached storefront payload smaller.
 *
 * Everything here styles WooCommerce's native markup. No checkout step, field
 * or payment element is replaced; the official gateway owns that.
 */

/* Woo's native visibility toggle must remain touch-accessible. */
.woocommerce .password-input .show-password-input {
	min-width: 44px;
	min-height: 44px;
	top: 50%;
	right: 0;
	transform: translateY(-50%);
	display: grid;
	place-items: center;
}
.woocommerce .password-input input {
	padding-inline-end: 3rem;
}

/* --------------------------------------------------------- shared tables */

.woocommerce table.shop_table,
.woocommerce table.woocommerce-orders-table,
.woocommerce table.woocommerce-table--order-details,
.woocommerce table.woocommerce-table--downloads {
	width: 100%;
	margin: 0 0 1.5rem;
	border: 1px solid var(--ah-line);
	border-collapse: collapse;
	border-radius: var(--ah-radius-lg);
	overflow: hidden;
	font-size: 0.9375rem;
}

.woocommerce table.shop_table th,
.woocommerce table.shop_table td,
.woocommerce table.woocommerce-orders-table th,
.woocommerce table.woocommerce-orders-table td,
.woocommerce table.woocommerce-table--downloads th,
.woocommerce table.woocommerce-table--downloads td {
	padding: 0.875rem 1rem;
	border: 0;
	border-bottom: 1px solid var(--ah-line);
	text-align: start;
	vertical-align: middle;
}

.woocommerce table.shop_table thead th,
.woocommerce table.woocommerce-orders-table thead th,
.woocommerce table.woocommerce-table--downloads thead th {
	background: var(--ah-bg-deep);
	color: var(--ah-text-subtle);
	font-family: var(--ah-mono);
	font-size: 0.75rem;
	font-weight: 500;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	white-space: nowrap;
}

.woocommerce table.shop_table td {
	color: var(--ah-text-muted);
}

.woocommerce table.shop_table td a {
	color: var(--ah-text);
	text-decoration: none;
	font-weight: 500;
}

.woocommerce table.shop_table td a:hover {
	color: var(--ah-accent);
}

.woocommerce table.shop_table tfoot th,
.woocommerce table.shop_table tfoot td {
	background: var(--ah-bg-deep);
	color: var(--ah-text);
	font-weight: 650;
}

.woocommerce table.shop_table .amount,
.woocommerce .woocommerce-Price-amount {
	font-family: var(--ah-mono);
	font-weight: 600;
}

.woocommerce table.shop_table img {
	width: 3.5rem;
	height: 3.5rem;
	border: 1px solid var(--ah-line);
	border-radius: var(--ah-radius-sm);
	object-fit: cover;
}

/* Mobile: collapse the cart table into stacked rows. */
@media (max-width: 47.99rem) {
	.woocommerce table.shop_table_responsive thead,
	.woocommerce table.shop_table_responsive tbody th {
		display: none;
	}

	.woocommerce table.shop_table_responsive tr {
		display: block;
		margin-bottom: 0.75rem;
		border: 1px solid var(--ah-line);
		border-radius: var(--ah-radius);
	}

	.woocommerce table.shop_table_responsive td {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 1rem;
		border-bottom: 1px solid var(--ah-line);
		text-align: end;
	}

	.woocommerce table.shop_table_responsive td::before {
		content: attr(data-title) ": ";
		flex: none;
		color: var(--ah-text-subtle);
		font-family: var(--ah-mono);
		font-size: 0.75rem;
		letter-spacing: 0.04em;
		text-transform: uppercase;
	}

	.woocommerce table.shop_table_responsive td:last-child {
		border-bottom: 0;
	}
}

/* ------------------------------------------------------------------ cart */

.woocommerce .cart-collaterals,
.woocommerce-cart .cart-collaterals {
	width: 100%;
}

.woocommerce-cart .woocommerce {
	display: grid;
	gap: 2rem;
}

@media (min-width: 64rem) {
	.woocommerce-cart form.woocommerce-cart-form {
		margin: 0;
	}

	.woocommerce-cart .cart-collaterals {
		max-width: 26rem;
		margin-inline-start: auto;
	}
}

.woocommerce .cart_totals > h2,
.woocommerce .cross-sells > h2 {
	font-size: 1.25rem;
}

.woocommerce .cart_totals table.shop_table {
	margin-bottom: 1rem;
}

.woocommerce .wc-proceed-to-checkout {
	padding: 0;
}

.woocommerce .wc-proceed-to-checkout .checkout-button {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 3rem;
	background: var(--ah-accent);
	border: 0;
	border-radius: var(--ah-radius);
	color: var(--ah-bg);
	font-size: 1rem;
	font-weight: 700;
	text-decoration: none;
}

.woocommerce .wc-proceed-to-checkout .checkout-button:hover {
	background: color-mix(in srgb, var(--ah-accent) 85%, var(--ah-bg));
	color: var(--ah-bg);
}

.woocommerce .coupon {
	display: flex;
	flex-wrap: wrap;
	gap: 0.5rem;
	align-items: center;
}

.woocommerce .coupon input[type="text"] {
	width: auto;
	flex: 1 1 10rem;
}

.woocommerce button.button,
.woocommerce input.button,
.woocommerce a.button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	min-height: var(--ah-tap);
	padding: 0.5rem 1.125rem;
	background: var(--ah-tint);
	border: 1px solid var(--ah-line-strong);
	border-radius: var(--ah-radius);
	color: var(--ah-text);
	font-size: 0.9375rem;
	font-weight: 600;
	text-decoration: none;
	cursor: pointer;
}

.woocommerce button.button:hover,
.woocommerce input.button:hover,
.woocommerce a.button:hover {
	border-color: var(--ah-accent);
	color: var(--ah-text);
}

.woocommerce button.button.alt,
.woocommerce input.button.alt,
.woocommerce a.button.alt,
.woocommerce #place_order {
	background: var(--ah-accent);
	border-color: var(--ah-accent);
	color: var(--ah-bg);
}

.woocommerce button.button.alt:hover,
.woocommerce input.button.alt:hover,
.woocommerce a.button.alt:hover,
.woocommerce #place_order:hover {
	background: color-mix(in srgb, var(--ah-accent) 85%, var(--ah-bg));
	border-color: var(--ah-accent);
	color: var(--ah-bg);
}

.woocommerce button.button[disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

.woocommerce a.remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 1.75rem;
	height: 1.75rem;
	border: 1px solid var(--ah-line-strong);
	border-radius: var(--ah-radius-pill);
	color: var(--ah-text-subtle) !important;
	font-size: 1rem;
	text-decoration: none;
}

.woocommerce a.remove:hover {
	background: transparent !important;
	border-color: var(--ah-error);
	color: var(--ah-error) !important;
}

/* Empty cart: WooCommerce's own notice plus the theme's recovery links. */

.ah-cartempty {
	max-width: 44rem;
	margin-top: 1.5rem;
}

.ah-cartempty__links {
	display: flex;
	flex-wrap: wrap;
	gap: 0.625rem;
	margin-top: 1rem;
}

/* -------------------------------------------------------------- checkout */

.woocommerce-checkout form.checkout {
	display: grid;
	gap: 2rem;
}

@media (min-width: 64rem) {
	.woocommerce-checkout form.checkout {
		grid-template-columns: minmax(0, 1.2fr) minmax(0, 1fr);
		align-items: start;
		column-gap: 3rem;
	}

	.woocommerce-checkout #customer_details {
		grid-column: 1;
	}

	.woocommerce-checkout .woocommerce-checkout-review-order {
		grid-column: 2;
		position: sticky;
		top: calc(var(--ah-header-h) + 1rem);
	}
}

.woocommerce-checkout #customer_details .col-1,
.woocommerce-checkout #customer_details .col-2 {
	float: none;
	width: 100%;
}

.woocommerce-checkout h3,
.woocommerce-checkout #order_review_heading {
	margin: 0 0 1rem;
	font-size: 1.25rem;
}

.woocommerce form .form-row {
	display: block;
	margin: 0 0 1rem;
	padding: 0;
}

.woocommerce form .form-row label {
	display: block;
	margin-bottom: 0.375rem;
	color: var(--ah-text-muted);
	font-size: 0.875rem;
	font-weight: 500;
}

.woocommerce form .form-row .required {
	color: var(--ah-error);
	text-decoration: none;
}

.woocommerce form .form-row-first,
.woocommerce form .form-row-last {
	width: 100%;
	float: none;
}

@media (min-width: 40rem) {
	.woocommerce form .form-row-first,
	.woocommerce form .form-row-last {
		display: inline-block;
		width: calc(50% - 0.5rem);
		vertical-align: top;
	}

	.woocommerce form .form-row-first {
		margin-inline-end: 0.875rem;
	}
}

.woocommerce .select2-container .select2-selection--single {
	min-height: var(--ah-tap);
	background: var(--ah-bg-deep);
	border: 1px solid var(--ah-line-strong);
	border-radius: var(--ah-radius);
}

.woocommerce .select2-container--default .select2-selection--single .select2-selection__rendered {
	line-height: var(--ah-tap);
	color: var(--ah-text);
	padding-inline-start: 0.875rem;
}

.woocommerce .select2-container--default .select2-selection--single .select2-selection__arrow {
	height: var(--ah-tap);
}

.woocommerce-checkout-review-order {
	padding: 1.25rem;
	background: var(--ah-bg-deep);
	border: 1px solid var(--ah-line);
	border-radius: var(--ah-radius-lg);
}

.woocommerce-checkout-review-order table.shop_table {
	border: 0;
	margin-bottom: 1rem;
}

.woocommerce-checkout #payment {
	background: transparent;
	border-radius: 0;
}

.woocommerce-checkout #payment ul.payment_methods {
	margin: 0 0 1rem;
	padding: 0;
	border: 0;
	list-style: none;
}

.woocommerce-checkout #payment ul.payment_methods li {
	margin: 0 0 0.5rem;
	padding: 0.875rem;
	background: var(--ah-surface);
	border: 1px solid var(--ah-line);
	border-radius: var(--ah-radius);
}

.woocommerce-checkout #payment ul.payment_methods li label {
	display: inline;
	color: var(--ah-text);
	font-weight: 600;
}

.woocommerce-checkout #payment div.payment_box {
	margin-top: 0.75rem;
	padding: 0.875rem;
	background: var(--ah-bg-deep);
	border: 1px solid var(--ah-line);
	border-radius: var(--ah-radius);
	color: var(--ah-text-muted);
	font-size: 0.875rem;
}

.woocommerce-checkout #payment div.payment_box::before {
	content: none;
}

/* No payment method available: a real, explicit state. Never a fake button. */
.woocommerce-checkout #payment .woocommerce-notice--info,
.woocommerce-checkout-payment .woocommerce-info {
	margin: 0 0 1rem;
}

.woocommerce-privacy-policy-text,
.woocommerce-terms-and-conditions-wrapper {
	color: var(--ah-text-subtle);
	font-size: 0.8125rem;
}

.woocommerce-checkout #place_order {
	width: 100%;
	min-height: 3rem;
	font-size: 1rem;
	font-weight: 700;
}

/* Account notices must not inherit the commerce plugin's light palette. */
.woocommerce-account .woocommerce-info,
.woocommerce-account .woocommerce-message,
.woocommerce-account .woocommerce-error {
	background: var(--ah-bg-deep, #111c2c);
	color: var(--ah-text, #eef2fb);
	border: 1px solid var(--ah-line, #2d3d54);
	border-top: 3px solid var(--ah-link, #7dd3fc);
	border-radius: 10px;
	box-shadow: none;
}
.woocommerce-account .woocommerce-message { border-top-color: var(--ah-accent, #4ade80); }
.woocommerce-account .woocommerce-error { border-top-color: var(--ah-error, #fda4af); }
.woocommerce-account .woocommerce-info::before { color: var(--ah-link, #7dd3fc); }
.woocommerce-account .woocommerce-message::before { color: var(--ah-accent, #4ade80); }
.woocommerce-account .woocommerce-error::before { color: var(--ah-error, #fda4af); }
.woocommerce-account .woocommerce-info .button,
.woocommerce-account .woocommerce-message .button,
.woocommerce-account .woocommerce-error .button {
	background: var(--ah-accent, #4ade80);
	color: #062b16;
	border: 1px solid var(--ah-accent, #4ade80);
	text-decoration: none;
	white-space: normal;
}
.woocommerce-account .woocommerce-info .button:hover,
.woocommerce-account .woocommerce-message .button:hover,
.woocommerce-account .woocommerce-error .button:hover {
	background: #86efac;
	color: #062b16;
}

/* ------------------------------------------------------------ my account */

.woocommerce-account.logged-in .woocommerce {
	display: grid;
	gap: 2rem;
}

/* Woo's float clearfix must not occupy account grid cells. */
.woocommerce-account.logged-in .woocommerce::before,
.woocommerce-account.logged-in .woocommerce::after {
	content: none;
}

/* Notices precede both columns; an empty wrapper needs no grid row. */
.woocommerce-account.logged-in .woocommerce > .woocommerce-notices-wrapper {
	grid-column: 1 / -1;
}

.woocommerce-account.logged-in .woocommerce > .woocommerce-notices-wrapper:empty {
	display: none;
}

@media (min-width: 64rem) {
	.woocommerce-account.logged-in .woocommerce {
		grid-template-columns: 15rem minmax(0, 1fr);
		column-gap: 3rem;
		align-items: start;
	}
}

.woocommerce-account .woocommerce-MyAccount-navigation {
	width: 100%;
	float: none;
	margin: 0;
}

.woocommerce-account .woocommerce-MyAccount-navigation ul {
	display: flex;
	flex-wrap: wrap;
	gap: 0.25rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

@media (min-width: 64rem) {
	.woocommerce-account .woocommerce-MyAccount-navigation ul {
		display: block;
		padding: 0.5rem;
		background: var(--ah-bg-deep);
		border: 1px solid var(--ah-line);
		border-radius: var(--ah-radius-lg);
		position: sticky;
		top: calc(var(--ah-header-h) + 1rem);
	}
}

.woocommerce-account .woocommerce-MyAccount-navigation li a {
	display: block;
	min-height: var(--ah-tap);
	padding: 0.625rem 0.875rem;
	border-radius: var(--ah-radius);
	color: var(--ah-text-muted);
	font-weight: 500;
	text-decoration: none;
}

.woocommerce-account .woocommerce-MyAccount-navigation li a:hover {
	background: var(--ah-tint-weak);
	color: var(--ah-text);
}

.woocommerce-account .woocommerce-MyAccount-navigation li.is-active a {
	background: var(--ah-tint);
	color: var(--ah-text);
	box-shadow: inset 3px 0 0 var(--ah-accent);
}

.woocommerce-account .woocommerce-MyAccount-content {
	width: 100%;
	float: none;
	margin: 0;
	min-width: 0;
}

.woocommerce-account .woocommerce-MyAccount-content > p:first-child {
	color: var(--ah-text-muted);
}

.woocommerce-account fieldset {
	margin: 1.5rem 0;
	padding: 1.25rem;
	border: 1px solid var(--ah-line);
	border-radius: var(--ah-radius-lg);
}

.woocommerce-account legend {
	padding-inline: 0.5rem;
	color: var(--ah-text-subtle);
	font-family: var(--ah-mono);
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.woocommerce .woocommerce-customer-details address,
.woocommerce .woocommerce-Address address {
	padding: 1rem;
	background: var(--ah-bg-deep);
	border: 1px solid var(--ah-line);
	border-radius: var(--ah-radius);
	color: var(--ah-text-muted);
	font-style: normal;
	line-height: 1.7;
}

.woocommerce .woocommerce-Addresses {
	display: grid;
	gap: 1.25rem;
}

@media (min-width: 48rem) {
	.woocommerce .woocommerce-Addresses {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.woocommerce .woocommerce-Addresses .woocommerce-Address {
	width: 100%;
	float: none;
}

.woocommerce .woocommerce-Address-title {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 1rem;
	margin-bottom: 0.5rem;
}

.woocommerce .woocommerce-Address-title h2,
.woocommerce .woocommerce-Address-title h3 {
	margin: 0;
	font-size: 1.0625rem;
}

/* Downloads and licences: tabular, monospace identifiers. */

.woocommerce table.woocommerce-table--downloads td,
.woocommerce .ah-licences td {
	font-size: 0.9375rem;
}

.woocommerce table.woocommerce-table--downloads .download-remaining,
.woocommerce table.woocommerce-table--downloads .download-expires,
.ah-licences__key,
.ah-licences__status {
	font-family: var(--ah-mono);
	font-size: 0.8125rem;
	color: var(--ah-text-subtle);
}

.woocommerce .order-again .button,
.woocommerce table.woocommerce-table--downloads .woocommerce-MyAccount-downloads-file {
	min-height: 2.25rem;
	padding: 0.375rem 0.875rem;
	font-size: 0.875rem;
}

.woocommerce-order-overview,
.woocommerce ul.order_details {
	display: grid;
	gap: 0.75rem;
	margin: 0 0 2rem;
	padding: 1.25rem;
	background: var(--ah-bg-deep);
	border: 1px solid var(--ah-line);
	border-radius: var(--ah-radius-lg);
	list-style: none;
}

@media (min-width: 48rem) {
	.woocommerce ul.order_details {
		grid-template-columns: repeat(auto-fit, minmax(9rem, 1fr));
	}
}

.woocommerce ul.order_details li {
	margin: 0;
	padding: 0;
	border: 0;
	float: none;
	color: var(--ah-text-subtle);
	font-family: var(--ah-mono);
	font-size: 0.75rem;
	letter-spacing: 0.06em;
	text-transform: uppercase;
}

.woocommerce ul.order_details li strong {
	display: block;
	margin-top: 0.25rem;
	color: var(--ah-text);
	font-family: var(--ah-font);
	font-size: 0.9375rem;
	letter-spacing: normal;
	text-transform: none;
}

/* Login / register */

.woocommerce-account:not(.logged-in) .woocommerce > .u-columns,
.woocommerce .u-columns.col2-set {
	display: grid;
	gap: 2rem;
}

/* Woo's float clearfix would otherwise become extra grid cells. */
.woocommerce .u-columns.col2-set::before,
.woocommerce .u-columns.col2-set::after {
	content: none;
}

@media (min-width: 48rem) {
	.woocommerce .u-columns.col2-set {
		grid-template-columns: repeat(2, minmax(0, 1fr));
	}
}

.woocommerce .u-columns .col-1,
.woocommerce .u-columns .col-2 {
	width: 100%;
	float: none;
}

.woocommerce form.login,
.woocommerce form.register {
	margin: 0;
	padding: 1.5rem;
	background: var(--ah-bg-deep);
	border: 1px solid var(--ah-line);
	border-radius: var(--ah-radius-lg);
}

.woocommerce form.login .woocommerce-form-login__rememberme,
.woocommerce .woocommerce-form__label-for-checkbox {
	display: flex;
	align-items: center;
	gap: 0.5rem;
	color: var(--ah-text-muted);
	font-size: 0.875rem;
	font-weight: 400;
}

.woocommerce .woocommerce-form__input-checkbox {
	width: auto;
	min-height: 0;
	margin: 0;
	accent-color: var(--ah-accent);
}

.woocommerce-form-login__submit,
.woocommerce-form-register__submit {
	width: 100%;
}

.woocommerce-LostPassword {
	margin: 0.75rem 0 0;
	font-size: 0.875rem;
}
