/* Carrello e checkout - hi-custom-elements-for-stampatesi. Colori del sito: rosso #c23650, azzurro #609dd6. */
.woocommerce-cart,
.woocommerce-checkout {
	--hi-rosso: #c23650;
	--hi-azzurro: #609dd6;
	--hi-bordo: #e3e6ea;
	--hi-testo: #2b2f36;
	--hi-tenue: #6b7280;
	--hi-fondo: #f6f8fb;
}

/* ---------- Dettagli della tesi (carrello, checkout, mini-carrello) ---------- */
.woocommerce-cart dl.variation,
.woocommerce-checkout dl.variation,
.woo-cart-dropdown dl.variation {
	display: grid;
	grid-template-columns: max-content 1fr;
	gap: 5px 14px;
	margin: 10px 0 0 !important;
	padding: 12px 14px !important;
	border-radius: 10px;
	background: var(--hi-fondo);
	font-size: 13px;
	line-height: 1.4;
	text-align: left;
}
.woocommerce-cart dl.variation dt,
.woocommerce-checkout dl.variation dt,
.woo-cart-dropdown dl.variation dt {
	float: none !important;
	clear: none !important;
	margin: 0 !important;
	padding: 0 !important;
	font-weight: 600;
	color: var(--hi-tenue);
}
.woocommerce-cart dl.variation dd,
.woocommerce-checkout dl.variation dd,
.woo-cart-dropdown dl.variation dd {
	float: none !important;
	margin: 0 !important;
	padding: 0 !important;
	font-weight: 600;
	color: var(--hi-testo);
}
.woocommerce-cart dl.variation dd p,
.woocommerce-checkout dl.variation dd p,
.woo-cart-dropdown dl.variation dd p { margin: 0 !important; }

/* ---------- Tabella del carrello ---------- */
.woocommerce-cart .cart-custom-message h2 { font-size: 18px; margin: 0 0 4px; }
.woocommerce-cart .cart-custom-message p { margin: 0 0 14px; color: var(--hi-tenue); }
.woocommerce-cart table.shop_table.cart {
	border: 1px solid var(--hi-bordo) !important;
	border-radius: 14px;
	border-collapse: separate !important;
	border-spacing: 0;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 4px 16px rgba(17, 24, 39, .05);
}
.woocommerce-cart table.shop_table.cart th,
.woocommerce-cart table.shop_table.cart td {
	border: 0 !important;
	border-bottom: 1px solid var(--hi-bordo) !important;
	padding: 16px !important;
	vertical-align: middle;
}
.woocommerce-cart table.shop_table.cart thead th {
	background: var(--hi-fondo);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .04em;
	text-transform: uppercase;
	color: var(--hi-tenue);
}
.woocommerce-cart table.shop_table.cart tr:last-child td { border-bottom: 0 !important; }
.woocommerce-cart table.shop_table.cart td.product-name { text-align: left !important; font-size: 16px; font-weight: 700; color: var(--hi-testo); min-width: 260px; }
.woocommerce-cart table.shop_table.cart td.product-thumbnail img { width: 84px !important; height: 84px !important; object-fit: cover; border-radius: 10px; box-shadow: 0 2px 8px rgba(0, 0, 0, .12); }
.woocommerce-cart table.shop_table.cart td.product-price,
.woocommerce-cart table.shop_table.cart td.product-subtotal { font-weight: 700; white-space: nowrap; }
.woocommerce-cart table.shop_table.cart td.product-subtotal { color: var(--hi-rosso); font-size: 16px; }
.woocommerce-cart table.shop_table.cart a.remove {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	width: 30px !important;
	height: 30px !important;
	border-radius: 50% !important;
	background: #fdecef !important;
	color: var(--hi-rosso) !important;
	font-size: 20px !important;
	line-height: 1 !important;
}
.woocommerce-cart table.shop_table.cart a.remove:hover { background: var(--hi-rosso) !important; color: #fff !important; }
.woocommerce-cart table.shop_table.cart input.qty {
	width: 70px;
	height: 44px !important;
	border: 2px solid #d9dde3 !important;
	border-radius: 8px !important;
	font-weight: 700;
	text-align: center;
}
.woocommerce-cart .quantity .amz-qty-inner { border: 0 !important; padding: 0 !important; background: none !important; }

/* Codice promozionale e aggiorna carrello */
.woocommerce-cart table.shop_table.cart td.actions { background: var(--hi-fondo); }
.woocommerce-cart td.actions .coupon { display: inline-flex; gap: 8px; align-items: center; }
.woocommerce-cart td.actions .coupon input.input-text {
	width: 200px !important;
	height: 42px !important;
	padding: 0 12px !important;
	border: 2px solid #d9dde3 !important;
	border-radius: 8px !important;
	margin: 0 !important;
}
.woocommerce-cart td.actions .button {
	height: 42px;
	padding: 0 16px !important;
	border: 2px solid var(--hi-azzurro) !important;
	border-radius: 8px !important;
	background: #fff !important;
	color: var(--hi-testo) !important;
	font-size: 13px !important;
	font-weight: 700 !important;
	text-transform: none !important;
	line-height: 1 !important;
}
.woocommerce-cart td.actions .button:hover:not([disabled]) { background: var(--hi-azzurro) !important; color: #fff !important; }
.woocommerce-cart td.actions .button[disabled] { opacity: .5; }

/* ---------- Totali e spedizione ---------- */
.woocommerce-cart .cart-custom-message h3 { font-size: 17px; margin: 26px 0 0; }
.woocommerce-cart .cart-collaterals .cart_totals {
	float: right;
	width: min(560px, 100%) !important;
	padding: 22px 24px;
	border: 1px solid var(--hi-bordo);
	border-radius: 14px;
	background: #fff;
	box-shadow: 0 4px 16px rgba(17, 24, 39, .05);
}
.woocommerce-cart .cart_totals h2 { font-size: 20px; margin: 0 0 12px; }
.woocommerce-cart .cart_totals table.shop_table { border: 0 !important; margin: 0 0 16px !important; }
.woocommerce-cart .cart_totals table.shop_table th,
.woocommerce-cart .cart_totals table.shop_table td {
	border: 0 !important;
	border-bottom: 1px solid var(--hi-bordo) !important;
	padding: 12px 0 !important;
	background: none !important;
	text-align: left;
	vertical-align: top;
}
.woocommerce-cart .cart_totals table.shop_table th { width: 110px; font-weight: 600; color: var(--hi-tenue); }
.woocommerce-cart .cart_totals table.shop_table td { text-align: right !important; }
.woocommerce-cart .cart_totals tr.order-total th,
.woocommerce-cart .cart_totals tr.order-total td { border-bottom: 0 !important; font-size: 18px; color: var(--hi-testo); }
.woocommerce-cart .cart_totals tr.order-total .amount { color: var(--hi-rosso); font-weight: 700; }

/* Metodi di spedizione come opzioni selezionabili */
.woocommerce-cart ul#shipping_method,
.woocommerce-checkout ul#shipping_method { list-style: none !important; margin: 0 !important; padding: 0 !important; display: grid; gap: 8px; text-align: left; }
.woocommerce-cart ul#shipping_method li,
.woocommerce-checkout ul#shipping_method li {
	position: relative;
	margin: 0 !important;
	padding: 10px 12px 10px 38px !important;
	border: 2px solid var(--hi-bordo);
	border-radius: 10px;
	background: #fff;
	text-indent: 0 !important;
	line-height: 1.35;
	cursor: pointer;
}
.woocommerce-cart ul#shipping_method li:has(input:checked),
.woocommerce-checkout ul#shipping_method li:has(input:checked) { border-color: var(--hi-rosso); background: #fdf3f5; }
.woocommerce-cart ul#shipping_method li input,
.woocommerce-checkout ul#shipping_method li input {
	position: absolute !important;
	left: 12px;
	top: 13px;
	margin: 0 !important;
	accent-color: var(--hi-rosso);
}
.woocommerce-cart ul#shipping_method li label,
.woocommerce-checkout ul#shipping_method li label { display: block !important; margin: 0 !important; font-size: 14px; font-weight: 600; cursor: pointer; }
.woocommerce-cart .woocommerce-shipping-destination { margin: 10px 0 4px; font-size: 13px; color: var(--hi-tenue); text-align: left; }
.woocommerce-cart .woocommerce-shipping-calculator { text-align: left; }

/* Procedi con l'ordine */
.woocommerce-cart .wc-proceed-to-checkout { padding: 0 !important; }
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button,
.woocommerce-checkout #place_order {
	display: flex !important;
	align-items: center;
	justify-content: center;
	width: 100%;
	min-height: 54px;
	padding: 0 20px !important;
	border: 0 !important;
	border-radius: 10px !important;
	background: var(--hi-rosso) !important;
	color: #fff !important;
	font-size: 17px !important;
	font-weight: 700 !important;
	letter-spacing: .02em;
	line-height: 1.2 !important;
	text-transform: none !important;
	box-shadow: 0 4px 14px rgba(194, 54, 80, .3);
}
.woocommerce-cart .wc-proceed-to-checkout a.checkout-button:hover,
.woocommerce-checkout #place_order:hover { filter: brightness(1.08); }

/* ---------- Checkout: riepilogo ordine ---------- */
.woocommerce-checkout #order_review table.shop_table {
	border: 1px solid var(--hi-bordo) !important;
	border-radius: 14px;
	border-collapse: separate !important;
	border-spacing: 0;
	overflow: hidden;
	background: #fff;
}
.woocommerce-checkout #order_review table.shop_table th,
.woocommerce-checkout #order_review table.shop_table td { border: 0 !important; border-bottom: 1px solid var(--hi-bordo) !important; padding: 12px 16px !important; }
.woocommerce-checkout #order_review table.shop_table td.product-name { text-align: left; font-weight: 700; }
.woocommerce-checkout #order_review tr.order-total .amount { color: var(--hi-rosso); }
.woocommerce-checkout #payment { border-radius: 14px; background: var(--hi-fondo) !important; }

/* ---------- Mobile ---------- */
@media (max-width: 767px) {
	.woocommerce-cart table.shop_table.cart td.product-name { min-width: 0; }
	.woocommerce-cart table.shop_table_responsive.cart tr td { text-align: right !important; }
	.woocommerce-cart table.shop_table_responsive.cart tr td.product-name { text-align: left !important; }
	.woocommerce-cart table.shop_table_responsive.cart tr td.product-name::before { display: none; }
	.woocommerce-cart table.shop_table_responsive.cart td.product-thumbnail { display: block !important; text-align: center !important; }
	.woocommerce-cart td.actions .coupon { display: flex; width: 100%; margin-bottom: 10px; }
	.woocommerce-cart td.actions .coupon input.input-text { flex: 1 1 auto; width: auto !important; }
	.woocommerce-cart td.actions > .button { width: 100%; }
	.woocommerce-cart .cart-collaterals .cart_totals { float: none; padding: 18px 16px; }
}

/* Regole del tema da superare: .shop_table.cart dl {display:inline-block}, dt {width:100px; text-align:right},
   .coupon .input-text {max-width:150px}, bordi sulle celle dei totali */
.woocommerce-cart dl.variation,
.woocommerce-checkout dl.variation { display: grid !important; width: auto !important; max-width: 420px; }
.woocommerce-cart dl.variation dt,
.woocommerce-checkout dl.variation dt,
.woocommerce-cart dl.variation dd,
.woocommerce-checkout dl.variation dd { width: auto !important; text-align: left !important; }
.woocommerce-cart td.product-name { line-height: 1.3; }
.woocommerce-cart td.actions .coupon input.input-text { max-width: none !important; }
.woocommerce-cart .cart_totals table.shop_table tr,
.woocommerce-cart .cart_totals table.shop_table th,
.woocommerce-cart .cart_totals table.shop_table td { border-left: 0 !important; border-right: 0 !important; border-top: 0 !important; outline: 0 !important; box-shadow: none !important; }
.woocommerce-cart .cart_totals tr.order-total th,
.woocommerce-cart .cart_totals tr.order-total td { border-bottom: 0 !important; padding-top: 16px !important; }

/* Mobile: tabella entro lo schermo, celle e totali impilati */
@media (max-width: 767px) {
	.woocommerce-cart table.shop_table.cart { table-layout: fixed; width: 100% !important; }
	.woocommerce-cart table.shop_table_responsive.cart,
	.woocommerce-cart table.shop_table_responsive.cart tbody,
	.woocommerce-cart table.shop_table_responsive.cart tr,
	.woocommerce-cart table.shop_table_responsive.cart td { display: block !important; width: auto !important; max-width: 100%; box-sizing: border-box; }
	.woocommerce-cart table.shop_table_responsive.cart thead { display: none; }
	.woocommerce-cart table.shop_table_responsive.cart td.product-remove { text-align: right !important; border-bottom: 0 !important; padding-bottom: 0 !important; }
	.woocommerce-cart dl.variation { grid-template-columns: max-content minmax(0, 1fr); max-width: 100%; }
	.woocommerce-cart td.actions .coupon { flex-wrap: wrap; }
	.woocommerce-cart td.actions .coupon input.input-text,
	.woocommerce-cart td.actions .button { width: 100% !important; }
	.woocommerce-cart td.actions .button { height: auto; min-height: 42px; white-space: normal; }
	.woocommerce-cart .cart_totals table.shop_table,
	.woocommerce-cart .cart_totals table.shop_table tbody,
	.woocommerce-cart .cart_totals table.shop_table tr { display: block; width: 100%; }
	.woocommerce-cart .cart_totals table.shop_table tr { display: flex; flex-wrap: wrap; justify-content: space-between; border-bottom: 1px solid var(--hi-bordo); }
	.woocommerce-cart .cart_totals table.shop_table th,
	.woocommerce-cart .cart_totals table.shop_table td { display: block; border-bottom: 0 !important; width: auto; }
	.woocommerce-cart .cart_totals table.shop_table tr.woocommerce-shipping-totals td { width: 100%; text-align: left !important; padding-top: 0 !important; }
	.woocommerce-cart .cart_totals table.shop_table td::before { display: none !important; }
	.woocommerce-cart .cart_totals tr.order-total { border-bottom: 0 !important; }
}

/* Avvisi WooCommerce (es. "aggiunto al carrello") */
.woocommerce-cart .woocommerce-message,
.woocommerce-checkout .woocommerce-message,
.woocommerce-cart .woocommerce-info,
.woocommerce-checkout .woocommerce-info {
	padding: 14px 18px 14px 46px !important;
	margin: 0 0 20px !important;
	border: 1px solid #cdeedb !important;
	border-radius: 12px;
	background: #effaf3 !important;
	color: var(--hi-testo) !important;
	font-size: 14px;
	line-height: 1.5;
	position: relative;
	overflow: hidden;
}
.woocommerce-cart .woocommerce-info,
.woocommerce-checkout .woocommerce-info { border-color: #cfe1f3 !important; background: #f2f7fc !important; }
.woocommerce-cart .woocommerce-message::before,
.woocommerce-checkout .woocommerce-message::before,
.woocommerce-cart .woocommerce-info::before,
.woocommerce-checkout .woocommerce-info::before { position: absolute !important; left: 16px !important; top: 15px !important; margin: 0 !important; color: #1f7a3a !important; }
.woocommerce-cart .woocommerce-message .button,
.woocommerce-checkout .woocommerce-message .button {
	float: right !important;
	margin: 0 0 0 12px !important;
	padding: 6px 12px !important;
	border: 0 !important;
	border-radius: 6px !important;
	background: var(--hi-rosso) !important;
	color: #fff !important;
	font-size: 12px !important;
	font-weight: 700 !important;
	line-height: 1.3 !important;
	text-transform: none !important;
}

/* Sul carrello il link "Visualizza carrello" dell'avviso porta alla stessa pagina */
.woocommerce-cart .woocommerce-message .button.wc-forward { display: none !important; }

/* ---------- Invito ad aggiungere un'altra tesi (sotto la tabella) ---------- */
.woocommerce-cart .hi-cest-altra-tesi {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	margin: 18px 0 26px;
	padding: 18px 22px;
	border: 2px dashed #cfe1f3;
	border-radius: 14px;
	background: #f2f7fc;
}
.woocommerce-cart .hi-cest-altra-tesi__testo { display: flex; flex-direction: column; gap: 2px; text-align: left; }
.woocommerce-cart .hi-cest-altra-tesi__testo strong { font-size: 16px; color: var(--hi-testo); }
.woocommerce-cart .hi-cest-altra-tesi__testo span { font-size: 14px; color: var(--hi-tenue); }
.woocommerce-cart a.hi-cest-altra-tesi__pulsante {
	flex: 0 0 auto;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 46px;
	padding: 0 20px;
	border: 2px solid var(--hi-azzurro);
	border-radius: 10px;
	background: #fff;
	color: var(--hi-testo) !important;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none !important;
	transition: background .15s, color .15s;
}
.woocommerce-cart a.hi-cest-altra-tesi__pulsante span { font-size: 20px; line-height: 1; color: var(--hi-azzurro); }
.woocommerce-cart a.hi-cest-altra-tesi__pulsante:hover { background: var(--hi-azzurro); color: #fff !important; }
.woocommerce-cart a.hi-cest-altra-tesi__pulsante:hover span { color: #fff; }
@media (max-width: 767px) {
	.woocommerce-cart .hi-cest-altra-tesi { flex-direction: column; align-items: stretch; padding: 16px; }
	.woocommerce-cart a.hi-cest-altra-tesi__pulsante { justify-content: center; }
}
