/**
 * Sanganeri OTP login — Figma "Auth Modal / Login" + "Auth Modal / OTP".
 * Every value comes from the Bricks Style Guide variables.
 */

.sng-auth {
	display: flex;
	flex-direction: column;
	gap: var(--space-15);
	padding: var(--space-30);
	font-family: var(--font-body);
	color: var(--color-ink);
}

.sng-auth [hidden] {
	display: none !important;
}

.sng-auth__view,
.sng-auth__form {
	display: flex;
	flex-direction: column;
	gap: var(--space-15);
}

.sng-auth__title {
	margin: 0;
	font-family: var(--font-display);
	font-size: var(--text-h3);
	font-weight: 600;
	line-height: var(--lh-h3);
	color: var(--color-ink);
}

/* Fields */
.sng-auth__field {
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
}

.sng-auth__label {
	font-size: var(--text-sm);
	font-weight: 500;
	line-height: var(--lh-sm);
	color: var(--color-ink);
}

.sng-auth__input {
	width: 100%;
	margin: 0;
	padding: var(--space-12) var(--pad-14);
	font-family: var(--font-body);
	font-size: var(--text-sm);
	font-weight: 500;
	line-height: var(--lh-sm);
	color: var(--color-ink);
	background: var(--color-surface-cream);
	border: var(--hairline) solid var(--color-border-subtle);
	border-radius: var(--radius-card);
	box-shadow: none;
}

.sng-auth__input::placeholder {
	color: var(--color-ink-soft);
	opacity: 1;
}

.sng-auth__input:focus,
.sng-auth__otp-cell:focus,
.sng-auth__phone:focus-within .sng-auth__cc {
	border-color: var(--color-brand-accent);
	outline: none;
}

/* Mobile number: country code + number */
.sng-auth__phone {
	display: flex;
}

.sng-auth__cc {
	position: relative;
	display: flex;
	gap: var(--space-6);
	padding-right: var(--pad-14);
	flex: 0 0 var(--country-code-w);
	align-items: center;
	background: var(--color-surface-cream);
	border: var(--hairline) solid var(--color-border-subtle);
	border-radius: var(--radius-card) 0 0 var(--radius-card);
}

.sng-auth__cc-label {
	display: flex;
	align-items: center;
	gap: var(--space-6);
	padding: var(--space-12) 0 var(--space-12) var(--pad-14);
	font-size: var(--text-sm);
	font-weight: 500;
	line-height: var(--lh-sm);
	white-space: nowrap;
	color: var(--color-ink);
}

.sng-auth__chevron {
	flex: 0 0 auto;
	width: var(--icon-xs);
	height: var(--icon-xs);
	color: var(--color-ink-muted);
	pointer-events: none;
}

.sng-auth__input--phone {
	flex: 1 1 auto;
	min-width: 0;
	border-width: var(--hairline-md);
	border-left: 0;
	border-radius: 0 var(--radius-card) var(--radius-card) 0;
}

/* "or" divider */
.sng-auth__or {
	display: flex;
	align-items: center;
	gap: var(--space-12);
	font-family: var(--font-mono);
	font-size: var(--text-eyebrow);
	font-weight: 600;
	line-height: var(--lh-eyebrow);
	letter-spacing: var(--ls-eyebrow);
	color: var(--color-ink-muted);
}

.sng-auth__or::before,
.sng-auth__or::after {
	content: "";
	flex: 1;
	height: var(--hairline);
	background: var(--color-border-subtle);
}

/* Primary button */
.sng-auth__submit {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: var(--pad-14) var(--space-16);
	font-family: var(--font-body);
	font-size: var(--text-md);
	font-weight: 600;
	line-height: var(--lh-tight-md);
	color: var(--color-on-accent);
	text-decoration: none;
	background: var(--color-brand-accent);
	border: 0;
	border-radius: var(--radius-pill);
	cursor: pointer;
	transition: background-color 0.2s ease;
}

.sng-auth__submit:hover,
.sng-auth__submit:focus-visible {
	color: var(--color-on-accent);
	background: var(--color-brand-deep);
}

.sng-auth__submit:focus-visible,
.sng-auth__resend:focus-visible,
.sng-auth__edit:focus-visible {
	outline: var(--hairline-md) solid var(--color-brand-deep);
	outline-offset: var(--gap-2);
}

.sng-auth__submit[disabled] {
	cursor: progress;
	opacity: 0.7;
}

/* Messages */
.sng-auth__message {
	display: flex;
	align-items: center;
	gap: var(--space-6);
	margin: 0;
	font-size: var(--text-sm);
	font-weight: 500;
	line-height: var(--lh-pill);
	color: var(--color-sale);
}

.sng-auth__message.is-success {
	color: var(--color-ink-muted);
}

/* Legal */
.sng-auth__terms {
	margin: 0;
	font-size: var(--text-eyebrow);
	font-weight: 600;
	line-height: var(--lh-eyebrow);
	letter-spacing: var(--ls-eyebrow);
	text-align: center;
	color: var(--color-ink-muted);
}

.sng-auth__terms a {
	color: inherit;
	text-decoration: underline;
}

.sng-auth__resend,
.sng-auth__edit {
	padding: 0;
	font: inherit;
	background: none;
	border: 0;
	cursor: pointer;
}

/* OTP step */
.sng-auth__sent {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: var(--space-12);
}

.sng-auth__sent-text {
	display: flex;
	flex-direction: column;
	gap: var(--space-5);
	min-width: 0;
}

.sng-auth__sent-label {
	font-size: var(--text-sm);
	font-weight: 500;
	line-height: var(--lh-sm);
	color: var(--color-ink-muted);
}

.sng-auth__sent-to {
	font-family: var(--font-display);
	font-size: var(--fs-h6);
	font-weight: 600;
	line-height: var(--lh-h6);
	color: var(--color-ink);
	overflow-wrap: anywhere;
}

.sng-auth__edit {
	flex: 0 0 auto;
	width: var(--icon-edit);
	height: var(--icon-edit);
	color: var(--color-brand-accent);
}

.sng-auth__edit svg {
	display: block;
	width: 100%;
	height: 100%;
}

.sng-auth__otp {
	display: flex;
	justify-content: space-between;
	gap: var(--space-15);
	min-width: 0;
	margin: 0;
	padding: 0;
	border: 0;
}

.sng-auth__otp-cell {
	flex: 0 1 var(--otp-cell-w);
	min-width: 0;
	height: var(--otp-cell-h);
	margin: 0;
	padding: 0;
	font-family: var(--font-display);
	font-size: var(--text-h4);
	font-weight: 600;
	line-height: var(--lh-nav);
	text-align: center;
	color: var(--color-ink-muted);
	background: var(--color-surface-cream);
	border: var(--hairline-md) solid var(--color-border-subtle);
	border-radius: var(--radius-sm);
}

.sng-auth__resend {
	align-self: flex-start;
	font-size: var(--text-sm);
	font-weight: 500;
	line-height: var(--lh-sm);
	color: var(--color-brand-accent);
	text-decoration: underline;
}

.sng-auth__resend[disabled] {
	cursor: progress;
}

/* Logged-in state */
.sng-auth__lead {
	margin: 0;
	font-size: var(--text-sm);
	line-height: var(--lh-sm);
	color: var(--color-ink-muted);
}

/* WooCommerce My Account page (logged out) */
.sng-auth-page {
	width: 100%;
	max-width: var(--modal-auth-w);
	margin-inline: auto;
	background: var(--color-surface-sand);
	border-radius: var(--radius-lg);
}

.sng-auth .screen-reader-text {
	position: absolute !important;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

@media (max-width: 478px) {
	.sng-auth {
		padding: var(--space-20);
	}

	.sng-auth__otp {
		gap: var(--space-8);
	}
}

/* Inline field errors (shown on blur). */
.sng-auth__field-error {
	margin: 0;
	font-size: var(--text-eyebrow);
	font-weight: 500;
	line-height: var(--lh-badge);
	color: var(--color-sale);
}

.sng-auth__input[aria-invalid="true"],
.sng-auth__input[aria-invalid="true"]:focus,
.sng-auth__phone:has( [aria-invalid="true"] ) .sng-auth__cc {
	border-color: var(--color-sale);
}

/* Wrong OTP (Figma state "Wrong OTP") */
.sng-auth__message[hidden] {
	display: none;
}

.sng-auth__message-icon {
	flex: 0 0 auto;
	width: var(--icon-xs);
	height: var(--icon-xs);
}

.sng-auth__message.is-success .sng-auth__message-icon {
	display: none;
}

.sng-auth__otp-cell.is-error {
	color: var(--color-sale);
	border-color: var(--color-sale);
}
