/**
 * Reward Points meta box on the WooCommerce order editor, including the
 * collapsible Redeem Points section at its foot.
 */

/* ------------------------------------------------------------ shared bits */

/* WordPress hides an idle spinner with visibility, so it still takes its 20px
   plus a flex gap. In these tight rows that reads as a stray indent, and the
   scripts here all toggle is-active. */
.spar-order-points__edit-row .spinner:not(.is-active),
.spar-order-points__status-actions .spinner:not(.is-active),
.spar-order-redeem__actions .spinner:not(.is-active) {
	display: none;
}

.spar-order-points-info p {
	margin: 0 0 8px;
}

.spar-order-points-info .spar-order-points__hint {
	margin: 0 0 12px;
	font-size: 11px;
	line-height: 1.5;
	color: #787c82;
}

.spar-order-points-info > *:last-child {
	margin-bottom: 0;
}

.spar-order-points-info > .spar-order-redeem:last-child {
	margin-bottom: -12px;
}

/* Potential points: the figure is the point of the card, so it gets the room */

.spar-order-points__stat {
	margin: 0 0 12px;
	padding: 10px 12px;
	border: 1px solid #dcdcde;
	border-radius: 2px;
	background: #fff;
}

.spar-order-points__stat-label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: #50575e;
}

.spar-order-points__stat-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 6px;
	min-height: 26px;
}

.spar-order-points__stat-value {
	font-size: 22px;
	font-weight: 600;
	line-height: 1.1;
	color: #1d2327;
	white-space: nowrap;
}

.spar-order-points__stat-actions {
	display: flex;
	flex: 0 0 auto;
	align-items: center;
	gap: 4px;
}

.spar-order-points__edit.spar-order-points__edit {
	flex: 0 0 auto;
}

/* A figure set by hand: badged on the label, explained under the row */

.spar-order-points__badge {
	display: inline-block;
	margin-left: 6px;
	padding: 1px 6px;
	border-radius: 2px;
	background: #f0f6fc;
	color: #2271b1;
	font-size: 10px;
	font-weight: 600;
	letter-spacing: .02em;
	line-height: 1.6;
	text-transform: uppercase;
	vertical-align: middle;
}

.spar-order-points__stat-note {
	display: block;
	margin-top: 6px;
	font-size: 11px;
	line-height: 1.4;
	color: #787c82;
}

/* Inline "Modify" editor *//* Inline "Modify" editor */

.spar-order-points__edit-row {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 6px;
	margin: 6px 0 0;
}

.spar-order-points__edit-row input[type="number"] {
	flex: 1 1 70px;
	min-width: 0;
	margin: 0;
	padding: 4px 8px;
	font-weight: 600;
	text-align: right;
}

.spar-order-points__edit-row .spinner {
	float: none;
	margin: 0;
}

/* Awarded / deducted result */

.spar-order-points__result {
	margin: 0 0 12px;
	padding: 8px 10px;
	border: 1px solid #dcdcde;
	border-left: 3px solid #00a32a;
	border-radius: 2px;
	background: #fff;
}

.spar-order-points__result.is-deducted {
	border-left-color: #d63638;
}

.spar-order-points__result-label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: #50575e;
}

.spar-order-points__result-value {
	display: block;
	margin-top: 2px;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.2;
	color: #00812b;
}

.spar-order-points__result.is-deducted .spar-order-points__result-value {
	color: #b32d2e;
}

.spar-order-points__result-note {
	display: block;
	margin-top: 2px;
	font-size: 11px;
	line-height: 1.4;
	color: #787c82;
}

/* Points held back by the PRO points delay */

.spar-order-points__pending {
	margin: 0 0 12px;
	padding: 8px 10px;
	border: 1px solid #dcdcde;
	border-left: 3px solid #dba617;
	border-radius: 2px;
	background: #fff;
}

.spar-order-points__pending-label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: #50575e;
}

.spar-order-points__pending-value {
	display: block;
	margin-top: 2px;
	font-size: 18px;
	font-weight: 600;
	line-height: 1.2;
	color: #996800;
}

.spar-order-points__pending-note {
	display: block;
	margin-top: 2px;
	font-size: 11px;
	line-height: 1.4;
	color: #787c82;
}

/* Status notice - severity comes from the notice-* class WordPress already
   puts on it, rather than one hardcoded amber for every state. */

.spar-order-points__status.spar-order-points__status {
	margin: 0 0 12px;
	padding: 8px 10px;
	border: 1px solid #dcdcde;
	border-left: 3px solid #dba617;
	border-radius: 2px;
	background: #fff;
}

.spar-order-points__status.notice-error {
	border-left-color: #d63638;
}

.spar-order-points__status.notice-success {
	border-left-color: #00a32a;
}

.spar-order-points__status strong {
	display: block;
	font-size: 12px;
	line-height: 1.4;
	color: #1d2327;
}

.spar-order-points__status small {
	display: block;
	margin-top: 3px;
	font-size: 11px;
	line-height: 1.5;
	color: #787c82;
}

.spar-order-points__status-actions {
	display: flex;
	align-items: center;
	gap: 6px;
	margin-top: 8px;
}

.spar-order-points__status-actions .button {
	flex: 1 1 auto;
	text-align: center;
}

.spar-order-points__status-actions .spinner {
	flex: 0 0 auto;
	float: none;
	margin: 0;
}

/* Customer whose points these are */

.spar-order-points__customer {
	margin: 0;
	border: 1px solid #dcdcde;
	border-radius: 2px;
	background: #fff;
}

.spar-order-points__customer-head {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 10px;
}

.spar-order-points__avatar {
	flex: 0 0 auto;
	line-height: 0;
}

.spar-order-points__avatar img {
	display: block;
	width: 32px;
	height: 32px;
	border-radius: 50%;
}

.spar-order-points__customer-text {
	flex: 1 1 auto;
	min-width: 0;
}

.spar-order-points__customer-name {
	display: block;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.3;
	color: #1d2327;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.spar-order-points__customer-email {
	display: block;
	font-size: 11px;
	line-height: 1.4;
	color: #787c82;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.spar-order-points__balance {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	padding: 7px 10px;
	border-top: 1px solid #f0f0f1;
	background: #fbfbfc;
}

.spar-order-points__balance-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: #50575e;
}

.spar-order-points__balance-value {
	font-size: 14px;
	font-weight: 600;
	color: #1d2327;
	white-space: nowrap;
}

/* ------------------------------------------- collapsible Redeem Points */

.spar-order-redeem {
	margin: 12px -12px -12px;
	padding: 12px;
	border-top: 1px solid #dcdcde;
	background: #f6f7f7;
	border-radius: 0 0 2px 2px;
}

.spar-order-redeem[hidden] {
	display: none !important;
}

/* Styled as a secondary WordPress button rather than a bare heading, so it
   reads as something to press. */
.spar-order-redeem__toggle {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	width: 100%;
	margin: 0;
	padding: 0 10px;
	min-height: 30px;
	border: 1px solid #c3c4c7;
	border-radius: 3px;
	background: #fff;
	box-shadow: 0 1px 0 #c3c4c7;
	color: #2271b1;
	cursor: pointer;
	text-align: left;
	vertical-align: top;
}

.spar-order-redeem__toggle:hover {
	background: #f6f7f7;
	border-color: #0a4b78;
	color: #0a4b78;
}

.spar-order-redeem__toggle:focus {
	border-color: #2271b1;
	box-shadow: 0 0 0 1px #2271b1;
	outline: 2px solid transparent;
}

.spar-order-redeem__toggle:active {
	box-shadow: none;
	transform: translateY(1px);
}

.spar-order-redeem__toggle[aria-expanded="true"] {
	border-bottom-left-radius: 0;
	border-bottom-right-radius: 0;
	box-shadow: none;
}

.spar-order-redeem__title {
	font-size: 12px;
	font-weight: 600;
	line-height: 1;
}

.spar-order-redeem__chevron.spar-order-redeem__chevron {
	width: 16px;
	height: 16px;
	font-size: 16px;
	line-height: 1;
	transition: transform .15s ease-in-out;
}

.spar-order-redeem__toggle[aria-expanded="true"] .spar-order-redeem__chevron {
	transform: rotate(180deg);
}

/* Opened: the panel reads as the body of the button above it. */
.spar-order-redeem-body {
	padding: 10px;
	border: 1px solid #c3c4c7;
	border-top: 0;
	border-radius: 0 0 3px 3px;
	/* Matches the section rather than the button, so the white cards inside
	   keep their contrast. */
	background: #f6f7f7;
}

.spar-order-redeem-body[hidden] {
	display: none !important;
}

/* Field *//* Field */

.spar-order-redeem__field {
	display: flex;
	gap: 6px;
	margin: 0 0 8px;
}

.spar-order-redeem-input.spar-order-redeem-input {
	flex: 1 1 auto;
	min-width: 0;
	margin: 0;
	padding: 5px 8px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	text-align: right;
}

.spar-order-redeem__max.spar-order-redeem__max {
	flex: 0 0 auto;
	min-height: 0;
	padding: 0 10px;
	line-height: 2;
	font-size: 11px;
}

/* Live value */

.spar-order-redeem__value {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 8px;
	margin: 0 0 8px;
	padding: 8px 10px;
	border: 1px solid #dcdcde;
	border-left: 3px solid #2271b1;
	border-radius: 2px;
	background: #fff;
}

.spar-order-redeem__value-label {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: #50575e;
}

.spar-order-redeem__value-amount {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	color: #2271b1;
	white-space: nowrap;
}

.spar-order-redeem__value.is-invalid {
	border-left-color: #d63638;
}

.spar-order-redeem__value.is-invalid .spar-order-redeem__value-amount {
	color: #d63638;
}

/* Applied state */

.spar-order-redeem__applied {
	margin: 0 0 12px;
	padding: 8px 10px;
	border: 1px solid #dcdcde;
	border-left: 3px solid #00a32a;
	border-radius: 2px;
	background: #fff;
}

.spar-order-redeem__applied-label {
	display: block;
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .02em;
	text-transform: uppercase;
	color: #50575e;
}

.spar-order-redeem__applied-amount {
	display: block;
	margin: 2px 0 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	color: #00812b;
}

.spar-order-redeem__applied-points {
	display: block;
	margin-top: 2px;
	font-size: 11px;
	color: #787c82;
}

.spar-order-redeem__applied-points strong {
	color: #1d2327;
	font-weight: 600;
}

/* Actions and copy */

.spar-order-redeem__hint {
	margin: 0 0 12px;
	font-size: 11px;
	line-height: 1.5;
	color: #787c82;
}

.spar-order-redeem__actions {
	display: flex;
	align-items: center;
	gap: 6px;
}

.spar-order-redeem__actions .button {
	flex: 1 1 auto;
	text-align: center;
}

.spar-order-redeem__actions + .spar-order-redeem__hint {
	margin: 8px 0 0;
}

.spar-order-redeem__actions .spinner {
	flex: 0 0 auto;
	float: none;
	margin: 0;
}

/* Messages */

.spar-order-redeem__notice {
	margin: 0;
	padding: 8px 10px;
	border: 1px solid #dcdcde;
	border-left: 3px solid #dba617;
	border-radius: 2px;
	background: #fff;
	font-size: 11px;
	line-height: 1.5;
	color: #50575e;
}

.spar-order-redeem__notice strong {
	display: block;
	margin-bottom: 2px;
	color: #1d2327;
	font-size: 12px;
}

.spar-order-redeem__notice strong + strong {
	display: inline;
	margin-bottom: 0;
	font-size: inherit;
}

.spar-order-redeem-notice {
	margin: 10px 0 0;
	padding: 8px 10px;
	border-left: 3px solid #d63638;
	border-radius: 2px;
	background: #fcf0f1;
	font-size: 11px;
	line-height: 1.5;
	color: #8a1f22;
}

.spar-order-redeem-notice[hidden] {
	display: none !important;
}

.spar-order-redeem.is-busy {
	opacity: .6;
	pointer-events: none;
}
