/*
 * TrueHugz Cart & Checkout.
 *
 * Tokens match the account plugin and the live PrestaShop theme:
 *   primary #F17100 · accent #1EB0C2 · accent-dark #058696 · tint #E9F6F8
 *   page    #F1F1F1 · panel #FFFFFF · border #E3E3E3 · text #333 · muted #777
 */

.truehugz-cart,
.truehugz-checkout {
	--th-primary: #f17100;
	--th-accent: #1eb0c2;
	--th-accent-dark: #058696;
	--th-tint: #e9f6f8;
	--th-page: #f1f1f1;
	--th-panel: #fff;
	--th-border: #e3e3e3;
	--th-text: #333;
	--th-muted: #777;
	--th-radius: 4px;

	display: grid;
	grid-template-columns: minmax(0, 1fr) 340px;
	gap: 24px;
	align-items: start;
	max-width: 1180px;
	margin: 0 auto;
	color: var(--th-text);
	font-family: "Poppins", -apple-system, BlinkMacSystemFont, "Segoe UI", Arial, sans-serif;
	font-size: 15px;
	line-height: 1.5;
}

.truehugz-cart__side,
.truehugz-checkout__side {
	position: sticky;
	top: 24px;
	display: flex;
	flex-direction: column;
	gap: 0;
}

/* ---------- Panels ---------- */

.truehugz-cart__panel,
.truehugz-step,
.truehugz-summary,
.truehugz-promo,
.truehugz-total-box {
	background: var(--th-panel);
	border: 1px solid var(--th-border);
	border-radius: var(--th-radius);
}

.truehugz-summary,
.truehugz-promo,
.truehugz-total-box {
	border-radius: 0;
	border-bottom: 0;
}

.truehugz-summary { border-radius: var(--th-radius) var(--th-radius) 0 0; }
.truehugz-total-box {
	border-radius: 0 0 var(--th-radius) var(--th-radius);
	border-bottom: 1px solid var(--th-border);
}

/* ---------- Buttons ---------- */

.truehugz-btn,
.truehugz-cart__update,
.truehugz-summary__cta .checkout-button,
.truehugz-checkout #place_order {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 10px 22px;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
	text-align: center;
	text-decoration: none;
	color: #fff;
	background: var(--th-accent);
	border: 2px solid var(--th-accent);
	border-radius: var(--th-radius);
	cursor: pointer;
	transition: background-color .15s ease, border-color .15s ease, color .15s ease;
}

.truehugz-btn:hover,
.truehugz-cart__update:hover,
.truehugz-summary__cta .checkout-button:hover,
.truehugz-checkout #place_order:hover {
	background: var(--th-accent-dark);
	border-color: var(--th-accent-dark);
	color: #fff;
}

.truehugz-btn--outline {
	background: transparent;
	color: var(--th-accent-dark);
}

.truehugz-btn--outline:hover {
	background: var(--th-accent);
	color: #fff;
}

.truehugz-summary__cta .checkout-button,
.truehugz-checkout #place_order {
	width: 100%;
	margin-top: 12px;
	padding: 12px 22px;
	font-size: 15px;
}

/* ---------- Cart ---------- */

.truehugz-cart__heading {
	margin: 0;
	padding: 16px 20px;
	border-bottom: 1px solid var(--th-border);
	font-family: "Poppins", sans-serif;
	font-size: 18px;
	font-weight: 700;
	color: var(--th-text);
}

.truehugz-cart__items {
	margin: 0;
	padding: 0;
	list-style: none;
}

.truehugz-cart__item {
	display: grid;
	grid-template-columns: 88px minmax(0, 1fr) auto auto 28px;
	gap: 16px;
	align-items: center;
	padding: 18px 20px;
	border-bottom: 1px solid var(--th-border);
}

.truehugz-cart__item:last-child { border-bottom: 0; }

.truehugz-cart__thumb img {
	width: 100%;
	height: auto;
	border-radius: var(--th-radius);
}

.truehugz-cart__name {
	margin: 0 0 6px;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.35;
}

.truehugz-cart__name a { color: var(--th-text); text-decoration: none; }
.truehugz-cart__name a:hover { color: var(--th-primary); }

.truehugz-cart__pricing {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	font-size: 14px;
}

.truehugz-cart__was { color: var(--th-muted); text-decoration: line-through; }
.truehugz-cart__was .amount { color: inherit; }

.truehugz-cart__badge {
	padding: 1px 6px;
	font-size: 12px;
	font-weight: 700;
	color: var(--th-muted);
}

.truehugz-cart__meta {
	margin-top: 6px;
	font-size: 13px;
	color: var(--th-muted);
}

.truehugz-cart__meta p,
.truehugz-cart__meta dl { margin: 0; }
.truehugz-cart__meta dt,
.truehugz-cart__meta dd { display: inline; margin: 0; font-weight: 400; }
.truehugz-cart__meta dd::after { content: ""; display: block; }

.truehugz-cart__subtotal { font-weight: 700; white-space: nowrap; }

.truehugz-cart__remove .remove {
	display: block;
	width: 24px;
	height: 24px;
	line-height: 22px;
	font-size: 20px;
	text-align: center;
	color: var(--th-text);
	text-decoration: none;
}

.truehugz-cart__remove .remove:hover { color: var(--th-primary); }

/* Quantity stepper */

.truehugz-cart__qty .quantity {
	display: inline-flex;
	align-items: stretch;
	border: 1px solid var(--th-border);
	border-radius: var(--th-radius);
	overflow: hidden;
}

.truehugz-qty__btn {
	width: 32px;
	border: 0;
	background: var(--th-panel);
	color: var(--th-text);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
}

.truehugz-qty__btn:hover { background: var(--th-tint); }

.truehugz-cart__qty input.qty {
	width: 46px;
	height: 36px;
	padding: 0;
	border: 0;
	border-left: 1px solid var(--th-border);
	border-right: 1px solid var(--th-border);
	text-align: center;
	font: inherit;
	-moz-appearance: textfield;
}

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

.truehugz-cart__update {
	margin: 16px 20px;
	background: transparent;
	color: var(--th-accent-dark);
}

.truehugz-continue-shopping { margin-top: 16px; }

.truehugz-points-strip {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-top: 16px;
	padding: 12px 16px;
	background: #f5f5f5;
	border-radius: var(--th-radius);
	font-size: 13px;
}

/* ---------- Summary sidebar ---------- */

.truehugz-summary__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	padding: 14px 18px;
	background: none;
	border: 0;
	border-bottom: 1px solid var(--th-border);
	font: inherit;
	font-size: 15px;
	color: var(--th-primary);
	cursor: pointer;
}

.truehugz-summary__chevron { transition: transform .15s ease; }
.truehugz-summary__toggle[aria-expanded="true"] .truehugz-summary__chevron { transform: rotate(180deg); }

.truehugz-summary__items {
	margin: 0;
	padding: 0;
	list-style: none;
	border-bottom: 1px solid var(--th-border);
}

.truehugz-summary__item {
	display: grid;
	grid-template-columns: 48px minmax(0, 1fr) auto;
	gap: 10px;
	align-items: center;
	padding: 12px 18px;
	font-size: 13px;
}

.truehugz-summary__item + .truehugz-summary__item { border-top: 1px solid #f0f0f0; }
.truehugz-summary__item-thumb { position: relative; }
.truehugz-summary__item-thumb img { width: 100%; height: auto; border-radius: var(--th-radius); }

.truehugz-summary__item-qty {
	position: absolute;
	top: -6px;
	right: -6px;
	min-width: 18px;
	height: 18px;
	padding: 0 4px;
	border-radius: 9px;
	background: var(--th-accent);
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 18px;
	text-align: center;
}

.truehugz-summary__rows { padding: 14px 18px; }

.truehugz-summary__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	padding: 4px 0;
}

.truehugz-summary__row--discount { color: var(--th-accent-dark); }

.truehugz-total-box .truehugz-summary__row--total {
	padding: 14px 18px;
	font-size: 16px;
	font-weight: 700;
}

.truehugz-summary__cta { margin-top: 0; }

/* ---------- Promo ---------- */

.truehugz-promo { padding: 14px 18px; }

.truehugz-promo__label {
	margin: 0 0 8px;
	color: var(--th-primary);
	font-size: 14px;
}

.truehugz-promo__form { display: flex; gap: 0; }

.truehugz-promo__input {
	flex: 1 1 auto;
	min-width: 0;
	padding: 8px 10px;
	border: 1px solid var(--th-border);
	border-right: 0;
	border-radius: var(--th-radius) 0 0 var(--th-radius);
	font: inherit;
	font-size: 14px;
}

.truehugz-promo__btn {
	flex: 0 0 auto;
	padding: 8px 18px;
	border: 1px solid var(--th-accent);
	border-radius: 0 var(--th-radius) var(--th-radius) 0;
	background: var(--th-accent);
	color: #fff;
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	cursor: pointer;
}

.truehugz-promo__btn:hover { background: var(--th-accent-dark); border-color: var(--th-accent-dark); }

.truehugz-promo__offers {
	margin-top: 10px;
	font-size: 14px;
	line-height: 1.45;
}

.truehugz-promo__applied {
	margin: 10px 0 0;
	padding: 0;
	list-style: none;
	font-size: 13px;
}

.truehugz-promo__applied li {
	display: flex;
	justify-content: space-between;
	gap: 8px;
	padding: 3px 0;
}

.truehugz-promo__remove { color: var(--th-muted); text-decoration: none; font-size: 16px; line-height: 1; }
.truehugz-promo__remove:hover { color: var(--th-primary); }

/* ---------- Checkout steps ---------- */

.truehugz-checkout__main { display: flex; flex-direction: column; gap: 12px; }
.truehugz-checkout__form { display: contents; }

.truehugz-step__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 14px 20px;
}

.truehugz-step__title {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	font-family: "Poppins", sans-serif;
	font-size: 16px;
	font-weight: 600;
	color: var(--th-text);
}

.truehugz-step__num {
	display: inline-block;
	min-width: 14px;
	color: var(--th-muted);
	font-weight: 400;
	text-align: center;
}

.truehugz-step__edit {
	display: none;
	align-items: center;
	gap: 5px;
	padding: 0;
	background: none;
	border: 0;
	color: var(--th-primary);
	font: inherit;
	font-size: 14px;
	cursor: pointer;
}

.truehugz-step__edit:hover { text-decoration: underline; }

.truehugz-step__body {
	display: none;
	padding: 0 20px 20px;
	border-top: 1px solid var(--th-border);
	padding-top: 18px;
}

.truehugz-step.is-open .truehugz-step__body { display: block; }
.truehugz-step.is-done .truehugz-step__edit { display: inline-flex; }
.truehugz-step.is-done .truehugz-step__num { visibility: hidden; position: relative; }

.truehugz-step.is-done .truehugz-step__num::before {
	content: "\2713";
	visibility: visible;
	position: absolute;
	inset: 0;
	color: var(--th-text);
}

.truehugz-step.is-locked .truehugz-step__title { color: var(--th-muted); }

.truehugz-step__intro { margin: 0 0 16px; font-size: 14px; }
.truehugz-muted { color: var(--th-muted); }

/* Tabs */

.truehugz-tabs {
	display: flex;
	gap: 18px;
	margin-bottom: 18px;
	border-bottom: 1px solid var(--th-border);
}

.truehugz-tab {
	padding: 0 0 8px;
	background: none;
	border: 0;
	border-bottom: 2px solid transparent;
	font: inherit;
	font-size: 14px;
	color: var(--th-muted);
	cursor: pointer;
}

.truehugz-tab.is-active {
	color: var(--th-primary);
	border-bottom-color: var(--th-primary);
}

.truehugz-pane { display: none; }
.truehugz-pane.is-active { display: block; }

/* ---------- Form fields ---------- */

.truehugz-checkout .form-row,
.truehugz-checkout .woocommerce-form-row {
	display: block;
	margin: 0 0 16px;
	padding: 0;
}

.truehugz-fields .woocommerce-billing-fields__field-wrapper,
.truehugz-fields .woocommerce-shipping-fields__field-wrapper,
.truehugz-form {
	display: grid;
	grid-template-columns: repeat(2, minmax(0, 1fr));
	gap: 0 24px;
}

.truehugz-fields .form-row-wide,
.truehugz-form .form-row { grid-column: auto; }
.truehugz-form > button,
.truehugz-form > input[type="hidden"] { grid-column: 1 / -1; justify-self: start; }

.truehugz-checkout label {
	display: block;
	margin-bottom: 6px;
	font-size: 14px;
	font-weight: 600;
}

.truehugz-checkout .required,
.truehugz-checkout abbr.required {
	color: var(--th-primary);
	border: 0;
	text-decoration: none;
}

.truehugz-checkout input[type="text"],
.truehugz-checkout input[type="email"],
.truehugz-checkout input[type="tel"],
.truehugz-checkout input[type="password"],
.truehugz-checkout select,
.truehugz-checkout textarea,
.truehugz-checkout .select2-container .select2-selection--single {
	width: 100%;
	box-sizing: border-box;
	min-height: 40px;
	padding: 9px 12px;
	border: 1px solid var(--th-border);
	border-radius: var(--th-radius);
	background: #fff;
	font: inherit;
	font-size: 14px;
	color: var(--th-text);
}

.truehugz-checkout input:focus,
.truehugz-checkout select:focus,
.truehugz-checkout textarea:focus {
	outline: none;
	border-color: var(--th-accent);
	box-shadow: 0 0 0 3px rgba(30, 176, 194, .18);
}

.truehugz-visually-hidden { display: none !important; }

.truehugz-checkbox {
	display: flex;
	align-items: flex-start;
	gap: 9px;
	font-weight: 400;
	font-size: 14px;
	cursor: pointer;
}

.truehugz-checkbox input[type="checkbox"] {
	flex: 0 0 auto;
	width: 16px;
	height: 16px;
	margin: 3px 0 0;
	accent-color: var(--th-accent);
}

.truehugz-same-address { margin: 4px 0 18px; }
.truehugz-signed-in { margin: 0 0 16px; font-size: 14px; }
.truehugz-signed-in a { color: var(--th-primary); margin-left: 8px; }

.truehugz-login-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	grid-column: 1 / -1;
}

.truehugz-login-row a { color: var(--th-accent-dark); font-size: 14px; }

/* ---------- Shipping ---------- */

.truehugz-shipping-row {
	display: grid;
	grid-template-columns: 20px minmax(0, 1fr) auto auto;
	gap: 14px;
	align-items: center;
	padding: 12px 0;
	margin: 0;
	font-weight: 400;
	cursor: pointer;
}

.truehugz-shipping-row + .truehugz-shipping-row { border-top: 1px solid var(--th-border); }
.truehugz-shipping-row input[type="radio"] { margin: 0; accent-color: var(--th-primary); }
.truehugz-shipping-name { font-weight: 700; font-size: 14px; }
.truehugz-shipping-desc { color: var(--th-text); font-size: 14px; }
.truehugz-shipping-cost { font-size: 14px; white-space: nowrap; }

.truehugz-order-notes-label {
	margin: 18px 0 8px;
	font-size: 14px;
	font-weight: 700;
}

/* ---------- Payment ---------- */

.truehugz-checkout #payment { background: none; border: 0; padding: 0; }

.truehugz-checkout .wc_payment_methods {
	margin: 0;
	padding: 0;
	list-style: none;
	border: 0;
}

.truehugz-checkout .wc_payment_method > label {
	display: flex;
	align-items: center;
	gap: 10px;
	margin: 0;
	padding: 8px 0;
	font-size: 14px;
	font-weight: 700;
	cursor: pointer;
}

.truehugz-checkout .wc_payment_method input[type="radio"] { accent-color: var(--th-primary); }
.truehugz-checkout .wc_payment_method label img { max-height: 22px; width: auto; margin: 0 2px; }

.truehugz-checkout .payment_box {
	margin: 4px 0 12px 26px;
	padding: 12px 14px;
	background: var(--th-tint);
	border-radius: var(--th-radius);
	font-size: 13px;
}

.truehugz-checkout .payment_box::before { display: none; }

.truehugz-checkout .woocommerce-terms-and-conditions-wrapper { margin: 10px 0 4px; }
.truehugz-checkout .woocommerce-privacy-policy-text { font-size: 13px; color: var(--th-muted); }

.truehugz-checkout .form-row.validate-required.woocommerce-invalid input,
.truehugz-checkout .woocommerce-invalid input.input-text { border-color: #c0392b; }

/* Notices, matching the pink error panel in the PrestaShop flow */

.truehugz-checkout .woocommerce-error,
.truehugz-cart .woocommerce-error {
	margin: 14px 0 0;
	padding: 12px 16px;
	list-style: none;
	background: #f9dede;
	border: 0;
	border-radius: var(--th-radius);
	color: #a94442;
	font-size: 14px;
}

.truehugz-checkout .woocommerce-error::before,
.truehugz-cart .woocommerce-error::before { display: none; }

/* ---------- Responsive ---------- */

@media (max-width: 980px) {
	.truehugz-cart,
	.truehugz-checkout { grid-template-columns: minmax(0, 1fr); }

	.truehugz-cart__side,
	.truehugz-checkout__side { position: static; }
}

@media (max-width: 600px) {
	.truehugz-cart__item {
		grid-template-columns: 64px minmax(0, 1fr) 24px;
		grid-template-areas:
			"thumb details remove"
			"qty   qty     subtotal";
		row-gap: 12px;
	}

	.truehugz-cart__thumb    { grid-area: thumb; }
	.truehugz-cart__details  { grid-area: details; }
	.truehugz-cart__remove   { grid-area: remove; }
	.truehugz-cart__qty      { grid-area: qty; }
	.truehugz-cart__subtotal { grid-area: subtotal; text-align: right; }

	.truehugz-fields .woocommerce-billing-fields__field-wrapper,
	.truehugz-fields .woocommerce-shipping-fields__field-wrapper,
	.truehugz-form { grid-template-columns: minmax(0, 1fr); }

	.truehugz-shipping-row {
		grid-template-columns: 20px minmax(0, 1fr) auto;
		row-gap: 4px;
	}

	.truehugz-shipping-desc { grid-column: 2 / -1; color: var(--th-muted); font-size: 13px; }
}
