/* -------------------------------------------------------------------------
 * Birthday field
 *
 * Themes almost always style input[type="text"] and input[type="email"] and
 * forget input[type="date"], which is why the field renders small and bare
 * next to its neighbours. These rules give it the same shape as an ordinary
 * text input while borrowing the theme's own font and colours.
 * ---------------------------------------------------------------------- */

.sbr-field {
	--sbr-radius: 6px;
	--sbr-border: rgba(0, 0, 0, .18);
	--sbr-border-strong: rgba(0, 0, 0, .38);
}

.sbr-field label {
	display: block;
	margin-bottom: .45em;
}

.sbr-field input[type="date"] {
	-webkit-appearance: none;
	appearance: none;
	box-sizing: border-box;
	display: block;
	width: 100%;
	min-height: 46px;
	margin: 0;
	padding: .7em .9em;

	font: inherit;
	font-size: 1em;
	line-height: 1.4;
	color: inherit;

	background-color: #fff;
	border: 1px solid var(--sbr-border);
	border-radius: var(--sbr-radius);
	box-shadow: none;

	/* Tints the native calendar popup to the shop's own colour. */
	accent-color: currentColor;
	transition: border-color .15s ease, box-shadow .15s ease;
}

.sbr-field input[type="date"]:hover:not(:disabled) {
	border-color: var(--sbr-border-strong);
}

.sbr-field input[type="date"]:focus,
.sbr-field input[type="date"]:focus-visible {
	outline: none;
	border-color: var(--sbr-border-strong);
	box-shadow: 0 0 0 3px rgba(0, 0, 0, .07);
}

.sbr-field input[type="date"]:disabled {
	background-color: rgba(0, 0, 0, .04);
	color: rgba(0, 0, 0, .55);
	cursor: not-allowed;
}

/* Give the little calendar button room and make it obviously clickable. */
.sbr-field input[type="date"]::-webkit-calendar-picker-indicator {
	cursor: pointer;
	padding: .25em;
	margin-left: .4em;
	border-radius: 4px;
	opacity: .5;
	transition: opacity .15s ease, background-color .15s ease;
}

.sbr-field input[type="date"]::-webkit-calendar-picker-indicator:hover {
	opacity: 1;
	background-color: rgba(0, 0, 0, .06);
}

/* Chrome renders ηη/μμ/εεεε as separate spinners; keep them from looking cramped. */
.sbr-field input[type="date"]::-webkit-datetime-edit {
	padding: 0;
}

.sbr-field input[type="date"]::-webkit-datetime-edit-fields-wrapper {
	padding: 0;
}

.sbr-field input[type="date"]::-webkit-datetime-edit-text {
	padding: 0 .15em;
	opacity: .45;
}

/* An empty date input shows its placeholder parts in full black in some
   browsers, which reads as if it were already filled in. */
.sbr-field input[type="date"]:not(:focus):invalid::-webkit-datetime-edit-day-field,
.sbr-field input[type="date"]:not(:focus):invalid::-webkit-datetime-edit-month-field,
.sbr-field input[type="date"]:not(:focus):invalid::-webkit-datetime-edit-year-field {
	opacity: .45;
}

/* The "(optional)" marker, standing in for the usual required asterisk. */
.sbr-optional {
	display: inline-block;
	margin-left: .5em;
	padding: .1em .55em;
	border-radius: 999px;

	font-size: .72em;
	font-weight: 500;
	letter-spacing: .02em;
	text-transform: none;
	vertical-align: middle;

	color: rgba(0, 0, 0, .6);
	background-color: rgba(0, 0, 0, .06);
}

.sbr-field__note {
	display: block;
	margin-top: .55em;
	font-size: .85em;
	line-height: 1.55;
	opacity: .75;
}

/* -------------------------------------------------------------------------
 * [sbr_my_rewards]
 * ---------------------------------------------------------------------- */

.sbr-rewards-table {
	width: 100%;
	border-collapse: collapse;
}

.sbr-rewards-table th,
.sbr-rewards-table td {
	padding: .6em .7em;
	border-bottom: 1px solid rgba(0, 0, 0, .1);
	text-align: left;
}

.sbr-rewards-table th {
	font-size: .85em;
	text-transform: uppercase;
	letter-spacing: .03em;
	opacity: .7;
}

.sbr-rewards-table code {
	font-size: .95em;
	padding: .15em .45em;
	border-radius: 4px;
	background-color: rgba(0, 0, 0, .05);
}

/* Dark themes: swap the hard-coded white field background for the surface
   colour the theme is already using. */
@media (prefers-color-scheme: dark) {
	.sbr-field {
		--sbr-border: rgba(255, 255, 255, .22);
		--sbr-border-strong: rgba(255, 255, 255, .45);
	}

	.sbr-field input[type="date"] {
		background-color: rgba(255, 255, 255, .06);
	}

	.sbr-field input[type="date"]:focus {
		box-shadow: 0 0 0 3px rgba(255, 255, 255, .1);
	}

	.sbr-optional {
		color: rgba(255, 255, 255, .7);
		background-color: rgba(255, 255, 255, .12);
	}
}
