/**
 * Al Aliyah OTP login modal.
 *
 * Tokens taken from the "Al Aliyah OTP Login Popup" design. Two rules from it are load-
 * bearing and easy to lose in a refactor:
 *
 *   - Nothing is rounded. Every edge in the design is square, and a stray border-radius
 *     immediately reads as a different brand.
 *   - Gold (#DBAC35) is the only action colour. It marks the primary button and the code
 *     boxes the customer has already filled, and nothing else competes with it.
 */

.aa-otp {
	--aa-ground:     #EFE8D8;
	--aa-surface:    #FBF8F0;
	--aa-field:      #FFFFFF;
	--aa-ink:        #171410;
	--aa-muted:      #6B6250;
	--aa-soft:       #A79B82;
	--aa-line:       #D9CCA8;
	--aa-line-soft:  #E3D8BC;
	--aa-gold:       #DBAC35;
	--aa-gold-deep:  #C9971F;
	--aa-gold-ink:   #8A6B1F;
	--aa-danger:     #A6381C;

	--aa-display: Jost, system-ui, sans-serif;
	--aa-body:    'IBM Plex Sans', system-ui, sans-serif;
	--aa-arabic:  'Reem Kufi', 'IBM Plex Sans Arabic', system-ui, sans-serif;

	position: fixed;
	inset: 0;
	z-index: 99999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 24px;
	font-family: var(--aa-body);
}

/* Dims whatever account page sits behind, as in the design. */
.aa-otp__scrim {
	position: absolute;
	inset: 0;
	background: rgba(23, 20, 16, .42);
	backdrop-filter: blur(1px);
}

.aa-otp__dialog {
	position: relative;
	width: 404px;
	max-width: 100%;
	max-height: calc(100vh - 48px);
	overflow-y: auto;
	background: var(--aa-surface);
	box-shadow: 0 24px 60px rgba(23, 20, 16, .28);
}

.aa-otp__body { padding: 32px 32px 28px; }

/* ---------- brand ---------- */

.aa-otp__brand {
	display: flex;
	justify-content: center;
	margin-bottom: 22px;
}

.aa-otp__brand img {
	height: 38px;
	width: auto;
	display: block;
}

.aa-otp__wordmark {
	font-family: var(--aa-display);
	font-weight: 300;
	font-size: 22px;
	letter-spacing: .04em;
	color: var(--aa-ink);
}

/* ---------- headings ---------- */

.aa-otp__head {
	text-align: center;
	margin-bottom: 26px;
}

.aa-otp__ar {
	font-family: var(--aa-arabic);
	font-weight: 600;
	font-size: 19px;
	line-height: 1.5;
	color: var(--aa-ink);
	margin: 0 0 6px;
}

.aa-otp__en {
	font-family: var(--aa-display);
	font-size: 12px;
	letter-spacing: .14em;
	text-transform: uppercase;
	color: var(--aa-muted);
	margin: 0;
}

.aa-otp__sent {
	text-align: center;
	font-size: 13px;
	color: var(--aa-muted);
	margin: -14px 0 22px;
}

/* ---------- form ---------- */

.aa-otp__form {
	display: flex;
	flex-direction: column;
}

.aa-otp__label {
	font-family: var(--aa-display);
	font-size: 11px;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--aa-muted);
	margin-bottom: 8px;
}

.aa-otp__label + .aa-otp__field { margin-bottom: 0; }
.aa-otp__field + .aa-otp__label { margin-top: 18px; }

.aa-otp__optional {
	text-transform: none;
	letter-spacing: 0;
	color: var(--aa-soft);
	margin-inline-start: 6px;
}

.aa-otp__field {
	display: flex;
	border: 1.5px solid var(--aa-line);
	background: var(--aa-field);
}

.aa-otp__field:focus-within { border-color: var(--aa-gold); }

.aa-otp__cc {
	display: flex;
	align-items: center;
	padding: 0 14px;
	border-inline-end: 1.5px solid var(--aa-line);
	font-size: 15px;
	color: var(--aa-ink);
	font-variant-numeric: tabular-nums;
}

.aa-otp__input {
	flex: 1;
	min-width: 0;
	border: 0;
	background: transparent;
	padding: 14px;
	font-family: var(--aa-body);
	font-size: 15px;
	color: var(--aa-ink);
	border-radius: 0;
}

.aa-otp__input:focus { outline: none; }
.aa-otp__input::placeholder { color: var(--aa-soft); }

.aa-otp__help {
	font-size: 12px;
	line-height: 1.5;
	color: var(--aa-soft);
	margin: 8px 0 0;
}

/* ---------- code entry ---------- */

.aa-otp__code {
	display: flex;
	gap: 10px;
	justify-content: center;
	margin-bottom: 22px;
}

.aa-otp__digit {
	width: 52px;
	height: 60px;
	padding: 0;
	text-align: center;
	font-family: var(--aa-display);
	font-size: 22px;
	color: var(--aa-ink);
	background: var(--aa-field);
	border: 1.5px solid var(--aa-line);
	border-radius: 0;
	font-variant-numeric: tabular-nums;
}

/* Filled boxes take the gold border, so progress through the code is visible at a glance. */
.aa-otp__digit:not(:placeholder-shown),
.aa-otp__digit.is-filled { border-color: var(--aa-gold); }

.aa-otp__digit:focus {
	outline: none;
	border-color: var(--aa-gold);
	box-shadow: inset 0 0 0 1px var(--aa-gold);
}

/* ---------- actions ---------- */

.aa-otp__cta {
	margin-top: 22px;
	width: 100%;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	background: var(--aa-gold);
	color: var(--aa-ink);
	padding: 15px;
	font-family: var(--aa-display);
	font-weight: 500;
	font-size: 13px;
	letter-spacing: .12em;
	text-transform: uppercase;
	transition: background .15s ease;
}

.aa-otp__cta:hover { background: var(--aa-gold-deep); }
.aa-otp__cta:focus-visible { outline: 2px solid var(--aa-ink); outline-offset: 2px; }
.aa-otp__cta[disabled] { opacity: .6; cursor: progress; }

.aa-otp__resend-line {
	text-align: center;
	margin: 18px 0 0;
	font-size: 13px;
	color: var(--aa-muted);
}

.aa-otp__link {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	font: inherit;
	color: var(--aa-gold-ink);
	text-decoration: underline;
}

.aa-otp__link:hover { color: var(--aa-gold-deep); }
.aa-otp__link[disabled] {
	color: var(--aa-soft);
	text-decoration: none;
	cursor: default;
	font-variant-numeric: tabular-nums;
}

/* ---------- footer ---------- */

.aa-otp__foot {
	border-top: 1px solid var(--aa-line-soft);
	padding: 14px 32px;
	text-align: center;
	font-size: 12px;
	color: var(--aa-soft);
}

.aa-otp__foot a { color: var(--aa-gold-ink); text-decoration: underline; }
.aa-otp__foot a:hover { color: var(--aa-gold-deep); }

/* ---------- errors ---------- */

.aa-otp__error {
	margin: 14px 0 0;
	padding: 10px 12px;
	border: 1px solid var(--aa-danger);
	background: rgba(166, 56, 28, .06);
	color: var(--aa-danger);
	font-size: 13px;
	line-height: 1.45;
}

/* ---------- narrow screens ---------- */

@media (max-width: 460px) {
	.aa-otp { padding: 0; align-items: stretch; }

	.aa-otp__dialog {
		width: 100%;
		max-height: 100vh;
		min-height: 100vh;
	}

	.aa-otp__body { padding: 28px 20px 24px; }
	.aa-otp__foot { padding: 14px 20px; }

	/* Six 52px boxes plus gaps overflow a small phone; let them shrink together. */
	.aa-otp__code { gap: 8px; }

	.aa-otp__digit {
		width: auto;
		flex: 1;
		min-width: 0;
		height: 56px;
		font-size: 20px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.aa-otp * { transition: none !important; animation: none !important; }
}

/* ---------- Rewards tab (My Account) ---------- */

.aa-rewards__summary {
	display: flex;
	flex-direction: column;
	gap: .15rem;
	padding: 18px 20px;
	border: 1px solid #D9CCA8;
	background: #FBF8F0;
	margin-bottom: 18px;
}

.aa-rewards__label {
	font-family: Jost, system-ui, sans-serif;
	font-size: 11px;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: #6B6250;
}

.aa-rewards__points {
	font-family: Jost, system-ui, sans-serif;
	font-size: 36px;
	line-height: 1.1;
	font-weight: 500;
	color: #171410;
	font-variant-numeric: tabular-nums;
}

.aa-rewards__worth { font-size: 14px; color: #6B6250; }
.aa-rewards__rule  { font-size: 13px; color: #A79B82; margin: 0 0 20px; }

.aa-rewards__table { width: 100%; }
.aa-rewards__table .aa-num { text-align: end; font-variant-numeric: tabular-nums; }
.aa-rewards__table .is-credit { color: #6C7A2E; }
.aa-rewards__table .is-debit  { color: #A6381C; }

/* ---------- close ---------- */

/*
 * Sits on the scrim rather than on the dialog, as in the design: a light glyph in the
 * top-right of the dimmed area. Keeping it off the panel leaves the modal's own composition
 * — logo, headings, field, button — undisturbed.
 */
.aa-otp__close {
	position: absolute;
	top: 16px;
	inset-inline-end: 16px;
	width: 40px;
	height: 40px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 0;
	border-radius: 0;
	cursor: pointer;
	color: #F4EFE2;
	font-family: var(--aa-body);
	font-size: 26px;
	line-height: 1;
	opacity: .8;
	transition: opacity .15s ease;
}

.aa-otp__close:hover { opacity: 1; }

.aa-otp__close:focus-visible {
	outline: 2px solid #F4EFE2;
	outline-offset: 2px;
	opacity: 1;
}

.aa-otp__scrim { cursor: pointer; }

@media (max-width: 460px) {
	/* Full-bleed on small screens, so the glyph needs the dark ink to stay legible. */
	.aa-otp__close {
		color: var(--aa-ink);
		opacity: .55;
	}
}

/* ---------- points at checkout ---------- */

.aa-points {
	border: 1px solid var(--aa-line, #D9CCA8);
	background: var(--aa-surface, #FBF8F0);
	padding: 16px 18px;
	margin: 16px 0;
	font-family: 'IBM Plex Sans', system-ui, sans-serif;
}

.aa-points__label {
	display: block;
	font-family: Jost, system-ui, sans-serif;
	font-size: 11px;
	letter-spacing: .12em;
	text-transform: uppercase;
	font-weight: 500;
	color: #6B6250;
	margin-bottom: 6px;
}

.aa-points__lede,
.aa-points__note p {
	margin: 0 0 12px;
	font-size: 13.5px;
	line-height: 1.55;
	color: #4C4639;
}

.aa-points__note p { margin-bottom: 0; }

.aa-points__row {
	display: flex;
	gap: 10px;
	align-items: stretch;
}

.aa-points__row .aa-otp__field { flex: 1; }

.aa-points__input {
	font-variant-numeric: tabular-nums;
	padding: 11px 12px;
}

.aa-points__apply {
	border: 0;
	border-radius: 0;
	cursor: pointer;
	background: #DBAC35;
	color: #171410;
	padding: 0 20px;
	font-family: Jost, system-ui, sans-serif;
	font-weight: 500;
	font-size: 12px;
	letter-spacing: .12em;
	text-transform: uppercase;
	white-space: nowrap;
	transition: background .15s ease;
}

.aa-points__apply:hover { background: #C9971F; }
.aa-points__apply.is-busy { opacity: .6; cursor: progress; }

.aa-points__applied {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex-wrap: wrap;
}

.aa-points__value {
	font-size: 15px;
	color: #171410;
	font-variant-numeric: tabular-nums;
}

.aa-points__link {
	background: none;
	border: 0;
	padding: 0;
	cursor: pointer;
	font: inherit;
	font-size: 13px;
	color: #8A6B1F;
	text-decoration: underline;
}

.aa-points__link:hover { color: #C9971F; }

.aa-points__error {
	margin: 10px 0 0;
	padding: 9px 11px;
	border: 1px solid #A6381C;
	background: rgba(166, 56, 28, .06);
	color: #A6381C;
	font-size: 13px;
}
