/*
 * DKM account pages: status badges, savings, the dashboard's latest order and
 * figures. Colours are the shop's tokens; each status's badge colours are added
 * inline from Order Statuses.
 */

.dkm-status,
body[class*="dkm-order-status-"] mark.order-status {
	display: inline;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--text-secondary);
	font-size: 14px;
	font-weight: 700;
	line-height: 1.3;
	white-space: nowrap;
}

/* Savings */

.dkm-saved-line {
	display: block;
	margin-top: 2px;
	color: var(--text-success);
	font-size: 13px;
	font-weight: 600;
}

del.dkm-regular {
	margin-right: 6px;
	color: var(--text-tertiary);
	font-weight: 400;
}

.dkm-saved {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 14px 0 24px;
	padding: 12px 16px;
	border: var(--border-hairline) solid var(--card-border);
	border-radius: var(--card-radius);
	background: var(--bg-success);
	line-height: 1.2;
}

.dkm-cancel {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin: 0 0 24px;
	padding: 12px 16px;
	border: var(--border-hairline) solid var(--card-border);
	border-radius: var(--card-radius);
	background: var(--bg-surface);
}

.dkm-cancel__text {
	flex: 1 1 240px;
	margin: 0;
	color: var(--text-secondary);
	font-size: 15px;
	line-height: 1.4;
}

.dkm-cancel__button {
	flex: 0 0 auto;
}

.dkm-cancel__dialog {
	width: min(440px, calc(100vw - 32px));
	padding: 24px;
	border: var(--border-hairline) solid var(--card-border);
	border-radius: var(--card-radius);
	background: var(--bg-surface);
	color: var(--text-primary);
}

/* Centred on the screen. WooCommerce's ".woocommerce .woocommerce-order-details
   :last-child { margin-bottom: 0 }" reaches the dialog (it sits in the order's section) and
   leaves it standing on the bottom edge, so the margins are not negotiable. */
.dkm-cancel .dkm-cancel__dialog[open] {
	position: fixed;
	inset: 0;
	box-sizing: border-box;
	max-height: calc(100vh - 32px);
	height: fit-content;
	margin: auto !important;
	overflow: auto;
}

/* "No, keep the order" is the primary button (blue, by .alt); the account page paints every
   submit button primary, so the one that cancels is set back to the plain one. */
body .woocommerce-MyAccount-content .dkm-cancel .dkm-cancel__dialog .dkm-cancel__confirm {
	background: var(--button-secondary-bg);
	color: var(--button-secondary-text);
	font-weight: 600;
}

body .woocommerce-MyAccount-content .dkm-cancel .dkm-cancel__dialog .dkm-cancel__confirm:hover,
body .woocommerce-MyAccount-content .dkm-cancel .dkm-cancel__dialog .dkm-cancel__confirm:focus {
	background: var(--button-secondary-hover-bg);
	color: var(--button-secondary-text);
}

.dkm-cancel__dialog::backdrop {
	background: rgb(0 0 0 / 0.5);
}

.dkm-cancel__title {
	margin: 0 0 8px;
	font-size: 20px;
	line-height: 1.25;
}

.dkm-cancel__warning {
	margin: 0 0 20px;
	color: var(--text-secondary);
	font-size: 15px;
	line-height: 1.45;
}

.dkm-cancel__actions {
	display: flex;
	flex-wrap: wrap;
	justify-content: flex-end;
	gap: 8px;
}

@media (max-width: 480px) {
	.dkm-cancel__actions .button {
		flex: 1 1 100%;
	}
}

.dkm-saved__label {
	color: var(--text-primary);
	font-size: 15px;
	font-weight: 600;
}

.dkm-saved__amount,
.dkm-saved__amount .woocommerce-Price-amount {
	color: var(--text-success);
	font-size: 16px;
	font-weight: 800;
	white-space: nowrap;
}

/* An order's products: picture, name linked to the product, its condition
   and condition notes. */

.woocommerce-table--order-details td.product-name {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr);
	align-items: start;
	column-gap: 14px;
}

.woocommerce-table--order-details td.product-name > * {
	grid-column: 2;
}

.woocommerce-table--order-details td.product-name > .dkm-item-thumb {
	grid-column: 1;
	grid-row: 1 / span 6;
}

.dkm-item-thumb {
	display: block;
	overflow: hidden;
	width: 64px;
	height: 64px;
	border: var(--border-hairline) solid var(--card-border);
	border-radius: var(--radius-sm);
	background: var(--bg-surface);
}

.dkm-item-thumb img {
	display: block;
	width: 100%;
	height: 100%;
	margin: 0;
	object-fit: contain;
}

.dkm-item-name,
.dkm-item-name a {
	color: var(--text-primary);
	font-weight: 700;
}

.woocommerce-table--order-details td.product-name > .product-quantity {
	margin-top: 2px;
	color: var(--text-tertiary);
	font-size: 14px;
	font-weight: 500;
}

.dkm-condition {
	margin: 6px 0 0;
	color: var(--text-secondary);
	font-size: 14px;
}

.dkm-condition__label {
	color: var(--text-tertiary);
}

.dkm-condition-notes {
	margin-top: 8px;
	padding: 10px 12px;
	border: var(--border-hairline) solid var(--card-border);
	border-radius: var(--card-radius);
	background: var(--bg-page);
	font-size: 14px;
	line-height: 1.5;
}

.dkm-condition-notes p {
	margin: 0;
}

.dkm-condition-notes__title {
	color: var(--text-primary);
	font-weight: 600;
}

.dkm-condition-notes__text {
	color: var(--text-secondary);
}

/* The order's addresses: the text alone, without WooCommerce's phone and
   envelope icons. */
.woocommerce .woocommerce-customer-details address p.woocommerce-customer-details--phone,
.woocommerce .woocommerce-customer-details address p.woocommerce-customer-details--email {
	margin: 0;
	padding-left: 0;
}

.woocommerce .woocommerce-customer-details address p.woocommerce-customer-details--phone::before,
.woocommerce .woocommerce-customer-details address p.woocommerce-customer-details--email::before {
	display: none;
	content: none;
}

/* Buttons the shortcodes draw: the design system's buttons (components.css),
   read from the same component tokens. Primary for the step this card is
   for, secondary for the rest. */

.dkm-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	box-sizing: border-box;
	min-height: var(--control-md);
	padding: 0 18px;
	border: 0;
	border-radius: var(--button-radius);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	white-space: nowrap;
	cursor: pointer;
	transition: var(--motion-control);
}

.dkm-button:hover {
	text-decoration: none;
}

.dkm-button:focus-visible {
	outline: 2px solid var(--border-focus);
	outline-offset: 2px;
}

.dkm-button--primary {
	background: var(--button-primary-bg);
	color: var(--button-primary-text);
	font-weight: 700;
}

.dkm-button--primary:hover {
	background: var(--button-primary-hover-bg);
	color: var(--button-primary-text);
}

.dkm-button--primary:active {
	background: var(--button-primary-press-bg);
}

.dkm-button--secondary {
	background: var(--button-secondary-bg);
	color: var(--button-secondary-text);
}

.dkm-button--secondary:hover {
	background: var(--button-secondary-hover-bg);
	color: var(--button-secondary-text);
}

.dkm-button--secondary:active {
	background: var(--button-secondary-press-bg);
}

/* Latest order */

.dkm-latest-order {
	padding: 24px;
	border: var(--border-hairline) solid var(--card-border);
	border-radius: var(--card-radius);
	background: var(--bg-surface);
}

.dkm-latest-order__head {
	display: flex;
	flex-wrap: wrap;
	align-items: flex-start;
	justify-content: space-between;
	gap: 16px;
}

.dkm-latest-order__title {
	margin: 10px 0 4px;
	color: var(--text-primary);
	font-size: 22px;
	line-height: 1.3;
	letter-spacing: -0.014em;
}

.dkm-latest-order__meta,
.dkm-latest-order__empty {
	margin: 0;
	color: var(--text-tertiary);
	font-size: 15px;
}

/* The saved tracking link: one slim row, with a copy button. */
.dkm-link-row {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-top: 20px;
	padding: 12px 16px;
	border-radius: var(--radius-md);
	background: var(--bg-subtle);
}

.dkm-link-row__icon {
	flex: none;
	width: 18px;
	height: 18px;
	background: var(--text-tertiary);
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5'/%3E%3Cpath d='M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='black' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M10 14a3.5 3.5 0 0 0 5 0l4-4a3.5 3.5 0 0 0-5-5l-.5.5'/%3E%3Cpath d='M14 10a3.5 3.5 0 0 0-5 0l-4 4a3.5 3.5 0 0 0 5 5l.5-.5'/%3E%3C/svg%3E") center / contain no-repeat;
}

.dkm-link-row__text {
	flex: 1;
	min-width: 0;
	color: var(--text-secondary);
	font-size: 14px;
	line-height: 1.4;
}

.dkm-link-row button.dkm-link-row__copy {
	flex: none;
	height: var(--control-sm);
	padding: 0 14px;
	border: var(--border-hairline) solid var(--chip-border);
	border-radius: var(--button-radius);
	background: var(--bg-surface);
	color: var(--text-primary);
	font: inherit;
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: var(--motion-control);
}

/* Hover one step, press two, as every button. Not on :focus - a click leaves
   the button focused, and it looked pressed until the next click elsewhere. */
.dkm-link-row button.dkm-link-row__copy:hover {
	border-color: var(--chip-border);
	background: var(--bg-subtle);
	color: var(--text-primary);
}

.dkm-link-row button.dkm-link-row__copy:active {
	background: var(--bg-press);
	transform: scale(var(--motion-press-scale));
}

.dkm-link-row button.dkm-link-row__copy:focus {
	outline: none;
}

.dkm-link-row button.dkm-link-row__copy:focus-visible {
	outline: 2px solid var(--border-focus);
	outline-offset: 2px;
}

/* FunnelKit's thank-you summary: the total, with its VAT line, and the invoice buttons. */
.wfty_order_details tfoot th {
	white-space: nowrap;
}

.wfty_order_details tfoot tr:last-child th {
	font-size: 16px;
}

.wfty_order_details tfoot tr:last-child td {
	color: var(--text-primary);
	font-size: 24px;
	line-height: 1.2;
}

.wfty_order_details tfoot tr:last-child td .includes_tax {
	display: block;
	margin-top: 2px;
	color: var(--text-tertiary) !important; /* FunnelKit's own table styles outrank a plain rule here. */
	font-size: 12px !important;
	font-weight: 400 !important;
	line-height: 1.4;
}

/* The VAT amount inside it is wrapped in WooCommerce's price markup, which FunnelKit styles too. */
.wfty_order_details tfoot tr:last-child td .includes_tax * {
	color: inherit !important;
	font-size: inherit !important;
	font-weight: inherit !important;
}

.wffn_order_details_table .wfty_wrap.wfty_frontend_view > br {
	display: none;
}

.wffn_order_details_table .wfty_wrap.wfty_frontend_view {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 16px 0;
}

.wffn_order_details_table .wfty_wrap.wfty_frontend_view > :not(a.button) {
	flex: 1 1 100%;
}

.wffn_order_details_table .wfty_wrap.wfty_frontend_view a.button {
	display: inline-flex;
	flex: 1 1 0;
	align-items: center;
	justify-content: center;
	min-height: var(--control-md);
	margin: 0;
	padding: 0 16px;
	border: 0;
	border-radius: var(--button-radius);
	background: var(--button-secondary-bg);
	color: var(--button-secondary-text);
	font-size: 15px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	/* FunnelKit's `.wfty_wrap a { transition: all .4s ease-in-out }` made these
	   the slowest buttons on the site. */
	transition: var(--motion-control);
}

/* The secondary button's states (components.css .dkm-btn--secondary). */
.wffn_order_details_table .wfty_wrap.wfty_frontend_view a.button:hover {
	background: var(--button-secondary-hover-bg);
	color: var(--button-secondary-text);
}

.wffn_order_details_table .wfty_wrap.wfty_frontend_view a.button:active {
	background: var(--button-secondary-press-bg);
	transform: scale(var(--motion-press-scale));
}

.wffn_order_details_table .wfty_wrap.wfty_frontend_view a.button:focus {
	outline: none;
}

.wffn_order_details_table .wfty_wrap.wfty_frontend_view a.button:focus-visible {
	outline: 2px solid var(--border-focus);
	outline-offset: 2px;
}

@media (max-width: 520px) {
	.dkm-link-row {
		flex-wrap: wrap;
	}

	.dkm-link-row__text {
		flex-basis: calc(100% - 30px);
	}

	.dkm-link-row button.dkm-link-row__copy {
		width: 100%;
	}
}

.dkm-latest-order__actions {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.dkm-latest-order--empty {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.dkm-steps {
	display: grid;
	grid-auto-columns: minmax(0, 1fr);
	grid-auto-flow: column;
	gap: 8px;
	margin: 20px 0 0;
	padding: 0;
	list-style: none;
}

.dkm-steps__step {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
}

.dkm-steps__bar {
	height: 6px;
	border-radius: var(--radius-full);
	background: var(--bg-press);
}

.dkm-steps__step.is-done .dkm-steps__bar,
.dkm-steps__step.is-current .dkm-steps__bar {
	background: var(--action-primary);
}

.dkm-steps__label {
	color: var(--text-tertiary);
	font-size: 14px;
	font-weight: 600;
}

.dkm-steps__step.is-done .dkm-steps__label {
	color: var(--text-primary);
}

.dkm-steps__step.is-current .dkm-steps__label {
	color: var(--text-link-hover);
	font-weight: 700;
}

/* Figures */

.dkm-stats {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(200px, 1fr));
	gap: 16px;
}

.dkm-stat {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 20px;
	border: var(--border-hairline) solid var(--card-border);
	border-radius: var(--card-radius);
	background: var(--bg-surface);
	color: var(--text-secondary);
	text-decoration: none;
}

a.dkm-stat:hover {
	border-color: var(--border-default);
	text-decoration: none;
}

.dkm-stat__label {
	color: var(--text-tertiary);
	font-size: 14px;
	font-weight: 600;
}

.dkm-stat__value,
.dkm-stat__value .woocommerce-Price-amount {
	color: var(--text-primary);
	font-size: 36px;
	font-weight: 800;
	line-height: 1.1;
	letter-spacing: -0.03em;
}

.dkm-stat__note {
	color: var(--text-secondary);
	font-size: 14px;
}

/* What was saved: the shop's green for money kept, on a pale green card. */
.dkm-stat--dark {
	border-color: var(--border-subtle);
	background: var(--bg-success);
}

.dkm-stat--dark .dkm-stat__label,
.dkm-stat--dark .dkm-stat__note {
	color: var(--text-success);
}

.dkm-stat--dark .dkm-stat__value,
.dkm-stat--dark .dkm-stat__value .woocommerce-Price-amount {
	color: var(--text-success);
}

/* Money to spend: the shop's blue. */
.dkm-stat--accent {
	border-color: var(--border-subtle);
	background: var(--bg-info);
}

.dkm-stat--accent .dkm-stat__label,
.dkm-stat--accent .dkm-stat__note {
	color: var(--text-link-hover);
}

.dkm-stat--accent .dkm-stat__value,
.dkm-stat--accent .dkm-stat__value .woocommerce-Price-amount {
	color: var(--text-link-hover);
}

@media (max-width: 767px) {
	.dkm-latest-order {
		padding: 18px;
	}

	.dkm-latest-order__actions,
	.dkm-latest-order__actions .dkm-button,
	.dkm-latest-order--empty .dkm-button {
		width: 100%;
	}

	/* No order on its way: the sentence, then the button across the card. */
	.dkm-latest-order--empty {
		flex-direction: column;
		align-items: stretch;
	}

	.dkm-steps__label {
		font-size: 12px;
	}

	.dkm-stat__value,
	.dkm-stat__value .woocommerce-Price-amount {
		font-size: 28px;
	}
}
