/*
 * A customer changing or cancelling an order (inc/order-edit.php): the order page's Edit order card and messages, the
 * cart page's edit heading, link box and Update order / Keep the order as it was buttons, Cancel order with its
 * question, the empty cart's actions, and the bar under the header on other pages.
 */

/* Cart page while editing: Update order takes the checkout button's place (the Cart block always draws that one). */
.dolphin-cart-editing .wc-block-cart__submit,
.dolphin-cart-editing .wc-block-cart__submit-container--sticky {
	display: none !important;
}

/* Edit heading: "Changing order #188" and what to do */
.dolphin-edit-head {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.dolphin-edit-note {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 16px;
	background: var(--wp--preset--color--orange-50);
	border: 1px solid var(--wp--preset--color--peach);
	border-radius: 16px;
	color: var(--wp--preset--color--forest);
	font-size: 15px;
	line-height: 1.5;
}

.dolphin-edit-note__icon {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 999px;
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--orange-700);
}

.dolphin-edit-note__text {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
	padding-block-start: 6px;
}

.dolphin-edit-note__text p {
	margin: 0;
}

.dolphin-edit-note__text p:first-child {
	font-weight: 600;
}

.dolphin-edit-busy {
	margin: 0;
	padding: 12px 16px;
	background: var(--wp--preset--color--sand);
	border-radius: 12px;
	color: var(--wp--preset--color--forest);
	font-size: 15px;
	line-height: 1.5;
}

/* Cart page opened from an edit link: "Change order #188?" */
.dolphin-edit-ask {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 8px;
	margin: 0 0 24px;
	padding: 20px;
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 16px;
	box-shadow: var(--dolphin-shadow-card);
}

.dolphin-edit-ask.is-closed {
	background: var(--wp--preset--color--sand);
	border-color: transparent;
	box-shadow: none;
}

.dolphin-edit-ask__title {
	margin: 0;
	font-size: 20px;
	font-weight: 700;
	line-height: 1.3;
}

.dolphin-edit-ask__text {
	max-width: 60ch;
	margin: 0;
	font-size: 15px;
	line-height: 1.5;
}

.dolphin-edit-ask .dolphin-edit-form {
	margin-block-start: 8px;
}

/* Buttons */
.dolphin-edit-form {
	margin: 0;
}

.dolphin-edit-ask__button,
.dolphin-edit-actions__update,
.dolphin-edit-actions__keep,
.dolphin-ty-edit__button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 24px;
	box-sizing: border-box;
	border-radius: 999px;
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
}

.dolphin-edit-ask__button,
.dolphin-edit-actions__update {
	border: 0;
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--cream);
}

.dolphin-edit-ask__button:hover,
.dolphin-edit-actions__update:hover {
	background: var(--wp--preset--color--forest-900);
}

.dolphin-edit-actions__keep,
.dolphin-ty-edit__button {
	border: 1.5px solid var(--wp--preset--color--forest);
	background: var(--wp--preset--color--white);
	color: var(--wp--preset--color--forest) !important;
}

.dolphin-edit-actions__keep:hover,
.dolphin-ty-edit__button:hover {
	background: var(--wp--preset--color--cream);
}

.dolphin-edit-ask__button:focus-visible,
.dolphin-edit-actions__update:focus-visible,
.dolphin-edit-actions__keep:focus-visible,
.dolphin-ty-edit__button:focus-visible {
	outline: 3px solid var(--wp--preset--color--orange-600);
	outline-offset: 2px;
}

.dolphin-edit-form button[disabled] {
	cursor: progress;
	opacity: 0.75;
}

/* Update order / Keep the order as it was, where the checkout button was */
.dolphin-edit-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin: 20px 0 0;
}

.dolphin-edit-actions .dolphin-edit-actions__update,
.dolphin-edit-actions .dolphin-edit-actions__keep {
	width: 100%;
}

/* Empty cart while editing: Continue shopping and Keep the order as it was */
.dolphin-cart-empty.is-editing .dolphin-cart-empty__text {
	max-width: 340px;
}

.dolphin-cart-empty__actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 12px;
	margin-block-start: 24px;
}

.dolphin-cart-empty__actions .dolphin-cart-empty__button {
	margin: 0;
}

/* Order-placed page: messages and the Edit order card under the status pill */
.dolphin-ty-flash {
	width: 100%;
	max-width: 520px;
	margin: 16px 0 0;
	padding: 12px 16px;
	box-sizing: border-box;
	border-radius: 12px;
	background: var(--wp--preset--color--sage-50);
	color: var(--wp--preset--color--forest);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.5;
}

.dolphin-ty-flash.is-confirmed,
.dolphin-ty-flash.is-changed,
.dolphin-ty-flash.is-cancelled,
.dolphin-ty-flash.is-closed {
	background: var(--wp--preset--color--orange-50);
}

.dolphin-ty-edit {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	width: 100%;
	max-width: 520px;
	margin: 20px 0 0;
	padding: 16px;
	box-sizing: border-box;
	background: var(--wp--preset--color--white);
	border: 1px solid var(--wp--preset--color--line);
	border-radius: 16px;
}

.dolphin-ty-edit__title {
	margin: 0;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.3;
	color: var(--wp--preset--color--forest);
}

.dolphin-ty-edit__text {
	margin: 0;
	color: var(--wp--preset--color--muted);
	font-size: 15px;
	line-height: 1.5;
}

.dolphin-ty-edit .dolphin-edit-form,
.dolphin-ty-edit > .dolphin-ty-edit__button {
	margin-block-start: 8px;
}

/* Cancel order: a quiet button under Edit order (or Keep the order as it was) opens the question and the red
   "Yes, cancel the order" (<details>, no script). */
.dolphin-cancel {
	width: 100%;
	text-align: center;
}

.dolphin-cancel__toggle {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--wp--preset--color--orange-700);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.3;
	text-decoration: underline;
	text-underline-offset: 3px;
	list-style: none;
	cursor: pointer;
}

.dolphin-cancel__toggle::-webkit-details-marker {
	display: none;
}

.dolphin-cancel__toggle:hover {
	color: var(--wp--preset--color--forest);
}

.dolphin-cancel__toggle:focus-visible {
	border-radius: 4px;
	outline: 3px solid var(--wp--preset--color--orange-600);
	outline-offset: 2px;
}

.dolphin-cancel__panel {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	margin-block-start: 4px;
	padding: 14px 16px;
	box-sizing: border-box;
	border-radius: 12px;
	background: var(--wp--preset--color--orange-50);
	color: var(--wp--preset--color--forest);
}

.dolphin-cancel__question {
	margin: 0;
	font-size: 16px;
	font-weight: 700;
	line-height: 1.4;
}

.dolphin-cancel__text {
	max-width: 60ch;
	margin: 0;
	font-size: 15px;
	line-height: 1.5;
}

.dolphin-cancel .dolphin-edit-form {
	margin-block-start: 6px;
}

.dolphin-cancel__confirm {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-height: 48px;
	padding: 0 24px;
	box-sizing: border-box;
	border: 0;
	border-radius: 999px;
	background: var(--wp--preset--color--orange-700);
	color: var(--wp--preset--color--white);
	font-family: inherit;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	cursor: pointer;
}

.dolphin-cancel__confirm:hover {
	background: var(--wp--preset--color--forest);
}

.dolphin-cancel__confirm:focus-visible {
	outline: 3px solid var(--wp--preset--color--forest);
	outline-offset: 2px;
}

/* In the link's box, along its start edge */
.dolphin-edit-ask .dolphin-cancel {
	text-align: start;
}

.dolphin-edit-ask .dolphin-cancel__panel {
	align-items: flex-start;
	max-width: 520px;
}

/* With Update order: as wide as the buttons above */
.dolphin-edit-actions .dolphin-cancel .dolphin-edit-form,
.dolphin-edit-actions .dolphin-cancel__confirm {
	width: 100%;
}

/* Emptied cart: under its buttons */
.dolphin-cart-empty .dolphin-cancel {
	max-width: 400px;
	margin: 12px auto 0;
}

/* Payment card: the amount changed with the order */
.dolphin-ty-pay__changed {
	margin: 12px 0 0;
	padding: 10px 12px;
	border-radius: 12px;
	background: var(--wp--preset--color--orange-50);
	color: var(--wp--preset--color--forest);
	font-size: 14px;
	line-height: 1.5;
}

/* Bar under the header on other pages: "You're changing order #188 · Review and update" */
.dolphin-edit-bar[hidden] {
	display: none !important;
}

.dolphin-edit-bar {
	margin-block: 0;
	background: var(--wp--preset--color--forest);
	color: var(--wp--preset--color--cream);
}

.dolphin-edit-bar__inner {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 4px 16px;
	max-width: var(--dolphin-container);
	margin-inline: auto;
	padding: 6px var(--dolphin-gutter);
	box-sizing: border-box;
}

.dolphin-edit-bar__text {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-width: 0;
	margin: 0;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
}

.dolphin-edit-bar__icon {
	display: flex;
	flex: none;
	color: var(--wp--preset--color--peach);
}

.dolphin-edit-bar__link {
	display: inline-flex;
	align-items: center;
	min-height: 44px;
	color: var(--wp--preset--color--cream) !important;
	font-size: 14px;
	font-weight: 700;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.dolphin-edit-bar__link:hover {
	color: var(--wp--preset--color--white) !important;
}

.dolphin-edit-bar__link:focus-visible {
	outline: 3px solid var(--wp--preset--color--peach);
	outline-offset: 2px;
}

/* No new order while changing one: the mini-cart keeps "View my cart" only. */
.dolphin-editing-order .wc-block-mini-cart__footer-checkout {
	display: none !important;
}
