/* eb-sms auth card — RTL, Persian. Uses the theme's own "estedad" font (already
   self-hosted + loaded sitewide) and the real Woodmart brand blue (#0049A4) so
   this fits the existing site rather than importing a new font/palette. */

.eb-sms-auth {
	--eb-primary: #0049a4;
	--eb-primary-dark: #003b85;
	--eb-accent: #c99a2e;
	--eb-accent-dark: #ab8021;
	--eb-text: #1f2430;
	--eb-muted: #6b7280;
	--eb-border: #e2e5ea;
	--eb-bg: #f5f7fa;
	--eb-card: #ffffff;
	--eb-error: #ca1919;
	--eb-error-bg: #fdecec;
	--eb-success: #1e8e3e;
	--eb-success-bg: #eaf7ed;
	--eb-radius: 14px;
	--eb-radius-sm: 10px;

	direction: rtl;
	text-align: right;
	font-family: estedad, Tahoma, sans-serif;
	max-width: 440px;
	margin: 0 auto;
	color: var(--eb-text);
}

.eb-sms-auth * {
	box-sizing: border-box;
}

.eb-sms-auth.eb-sms-compact {
	max-width: 340px;
	margin: 0;
}

.eb-sms-card {
	background: var(--eb-card);
	border: 1px solid var(--eb-border);
	border-radius: var(--eb-radius);
	box-shadow: 0 8px 30px rgba(20, 30, 60, 0.08);
	padding: 28px 26px 26px;
}

.eb-sms-compact .eb-sms-card {
	padding: 18px 16px 16px;
	box-shadow: none;
	border: none;
}

/* ── Tabs ─────────────────────────────────────────────────────────────────── */

.eb-sms-tabs {
	display: flex;
	gap: 4px;
	background: var(--eb-bg);
	border-radius: 999px;
	padding: 4px;
	margin-bottom: 22px;
}

.eb-sms-tab {
	flex: 1;
	border: none;
	background: transparent;
	font-family: inherit;
	font-size: 15px;
	font-weight: 600;
	padding: 10px 12px;
	border-radius: 999px;
	color: var(--eb-muted);
	cursor: pointer;
	transition: background-color 200ms ease, color 200ms ease;
}

.eb-sms-tab.is-active {
	background: var(--eb-card);
	color: var(--eb-primary);
	box-shadow: 0 2px 8px rgba(20, 30, 60, 0.1);
}

.eb-sms-tab:focus-visible {
	outline: 3px solid rgba(0, 73, 164, 0.35);
	outline-offset: 2px;
}

/* ── Panels ───────────────────────────────────────────────────────────────── */

.eb-sms-panel {
	display: none;
	animation: eb-sms-fade-in 220ms ease;
}

.eb-sms-panel.is-active {
	display: block;
}

@keyframes eb-sms-fade-in {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: translateY(0); }
}

@media (prefers-reduced-motion: reduce) {
	.eb-sms-panel { animation: none; }
}

.eb-sms-heading {
	font-size: 19px;
	font-weight: 700;
	margin: 0 0 4px;
	color: var(--eb-text);
}

.eb-sms-subheading {
	font-size: 13.5px;
	color: var(--eb-muted);
	margin: 0 0 20px;
	line-height: 1.6;
}

.eb-sms-compact .eb-sms-heading {
	font-size: 16px;
}

.eb-sms-compact .eb-sms-subheading {
	margin-bottom: 14px;
}

/* ── Fields — one per row ─────────────────────────────────────────────────── */

.eb-sms-field {
	margin-bottom: 18px;
}

.eb-sms-label {
	display: block;
	font-size: 13.5px;
	font-weight: 600;
	margin-bottom: 6px;
	color: var(--eb-text);
}

.eb-sms-label .required {
	color: var(--eb-error);
	margin-inline-start: 2px;
}

.eb-sms-input-wrap {
	position: relative;
	display: flex;
	align-items: stretch;
	gap: 8px;
}

.eb-sms-input {
	flex: 1;
	width: 100%;
	min-height: 46px;
	padding: 0 14px;
	border: 1.5px solid var(--eb-border);
	border-radius: var(--eb-radius-sm);
	font-family: inherit;
	font-size: 15px;
	color: var(--eb-text);
	background: #fff;
	transition: border-color 150ms ease, box-shadow 150ms ease;
	direction: rtl;
	text-align: right;
}

/* Every field is Persian/RTL by default (name, family name only); fields that hold
   Latin/numeric content (mobile, email, username, password, OTP code) carry an
   explicit dir="ltr" in the markup and are fully left-justified — none of that
   content is Persian text, so there's no reason to keep it right-aligned. */
.eb-sms-input[dir="ltr"] {
	direction: ltr;
	text-align: left;
}

.eb-sms-input::placeholder {
	color: #a8adb8;
}

.eb-sms-input:focus {
	outline: none;
	border-color: var(--eb-primary);
	box-shadow: 0 0 0 4px rgba(0, 73, 164, 0.14);
}

.eb-sms-field.has-error .eb-sms-input {
	border-color: var(--eb-error);
}

.eb-sms-field.has-error .eb-sms-input:focus {
	box-shadow: 0 0 0 4px rgba(202, 25, 25, 0.12);
}

.eb-sms-help {
	font-size: 12.5px;
	color: var(--eb-muted);
	margin-top: 6px;
	line-height: 1.6;
}

.eb-sms-field-error {
	font-size: 12.5px;
	color: var(--eb-error);
	margin-top: 6px;
	display: none;
	align-items: center;
	gap: 4px;
}

.eb-sms-field.has-error .eb-sms-field-error {
	display: flex;
}

/* Only password fields have the show/hide icon overlaid — reserve room for it there
   only (previously a blanket padding on every input, unused dead space elsewhere). */
.eb-sms-field-password .eb-sms-input {
	padding-inline-end: 44px;
}

/* Password show/hide toggle */
.eb-sms-toggle-visibility {
	position: absolute;
	inset-inline-end: 4px;
	top: 4px;
	bottom: 4px;
	width: 38px;
	background: none;
	border: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--eb-muted);
	border-radius: 8px;
}

.eb-sms-toggle-visibility:hover {
	background: var(--eb-bg);
	color: var(--eb-text);
}

.eb-sms-toggle-visibility svg {
	width: 20px;
	height: 20px;
}

/* ── Login mode toggle (password / OTP) ──────────────────────────────────── */

.eb-sms-mode-toggle {
	display: flex;
	gap: 6px;
	margin-bottom: 18px;
	background: var(--eb-bg);
	border-radius: var(--eb-radius-sm);
	padding: 4px;
}

.eb-sms-mode-toggle label {
	flex: 1;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	padding: 9px 8px;
	border-radius: 8px;
	color: var(--eb-muted);
	cursor: pointer;
	transition: background-color 150ms ease, color 150ms ease;
}

.eb-sms-mode-toggle input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.eb-sms-mode-toggle label.is-checked {
	background: var(--eb-card);
	color: var(--eb-primary);
	box-shadow: 0 1px 4px rgba(20, 30, 60, 0.1);
}

/* ── OTP send-code control ────────────────────────────────────────────────── */

.eb-sms-send-code {
	flex: 0 0 auto;
	min-height: 46px;
	padding: 0 16px;
	border: none;
	border-radius: var(--eb-radius-sm);
	background: var(--eb-primary);
	color: #fff;
	font-family: inherit;
	font-size: 13.5px;
	font-weight: 600;
	white-space: nowrap;
	cursor: pointer;
	transition: background-color 150ms ease, transform 150ms ease;
}

.eb-sms-send-code:hover:not(:disabled) {
	background: var(--eb-primary-dark);
}

.eb-sms-send-code:active:not(:disabled) {
	transform: scale(0.97);
}

.eb-sms-send-code:disabled {
	background: #cbd3e0;
	color: #fff;
	cursor: default;
}

.eb-sms-countdown {
	display: block;
	font-size: 12px;
	color: var(--eb-muted);
	margin-top: 6px;
	font-variant-numeric: tabular-nums;
}

/* ── Submit + links ───────────────────────────────────────────────────────── */

.eb-sms-submit {
	width: 100%;
	min-height: 48px;
	border: none;
	border-radius: var(--eb-radius-sm);
	background: var(--eb-accent);
	color: #241a03;
	font-family: inherit;
	font-size: 16px;
	font-weight: 700;
	cursor: pointer;
	margin-top: 6px;
	transition: background-color 150ms ease, transform 150ms ease, opacity 150ms ease;
}

.eb-sms-submit:hover:not(:disabled) {
	background: var(--eb-accent-dark);
}

.eb-sms-submit:active:not(:disabled) {
	transform: scale(0.98);
}

.eb-sms-submit:disabled {
	opacity: 0.6;
	cursor: default;
}

.eb-sms-links {
	margin-top: 16px;
	text-align: center;
	font-size: 13px;
	color: var(--eb-muted);
}

.eb-sms-links a,
.eb-sms-switch {
	color: var(--eb-primary);
	font-weight: 600;
	text-decoration: none;
	background: none;
	border: none;
	font-family: inherit;
	font-size: inherit;
	cursor: pointer;
	padding: 0;
}

.eb-sms-links a:hover,
.eb-sms-switch:hover {
	text-decoration: underline;
}

/* ── Alert banner (server responses) ─────────────────────────────────────── */

.eb-sms-alert {
	display: none;
	align-items: flex-start;
	gap: 8px;
	font-size: 13px;
	line-height: 1.6;
	border-radius: var(--eb-radius-sm);
	padding: 10px 12px;
	margin-bottom: 16px;
}

.eb-sms-alert.is-visible {
	display: flex;
}

.eb-sms-alert.is-error {
	background: var(--eb-error-bg);
	color: var(--eb-error);
}

.eb-sms-alert.is-success {
	background: var(--eb-success-bg);
	color: var(--eb-success);
}

/* ── Small screens ────────────────────────────────────────────────────────── */

@media (max-width: 480px) {
	.eb-sms-auth {
		max-width: 100%;
	}
	.eb-sms-card {
		padding: 22px 16px 18px;
		border-radius: 12px;
	}
}

/* ── Loading overlay — shown instantly on submit, before the AJAX call even starts,
   so a slow gateway/DB round-trip never reads as "nothing happened" (fixes users
   clicking Login/Register repeatedly while waiting). ─────────────────────────── */

.eb-sms-auth .eb-sms-loading-overlay {
	position: fixed;
	inset: 0;
	background: rgba(255, 255, 255, 0.7);
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 999999;
	opacity: 0;
	transition: opacity 180ms ease;
}

.eb-sms-auth .eb-sms-loading-overlay.is-visible {
	display: flex;
	opacity: 1;
}

.eb-sms-auth .eb-sms-loading-box {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 14px;
	background: var(--eb-card);
	padding: 26px 34px;
	border-radius: var(--eb-radius);
	box-shadow: 0 12px 40px rgba(20, 30, 60, 0.18);
	font-family: estedad, Tahoma, sans-serif;
	font-size: 14px;
	font-weight: 600;
	color: var(--eb-text);
}

.eb-sms-auth .eb-sms-spinner {
	width: 32px;
	height: 32px;
	border: 3px solid var(--eb-border);
	border-top-color: var(--eb-primary);
	border-radius: 50%;
	animation: eb-sms-spin 700ms linear infinite;
}

@keyframes eb-sms-spin {
	to { transform: rotate(360deg); }
}

@media (prefers-reduced-motion: reduce) {
	.eb-sms-auth .eb-sms-spinner {
		animation-duration: 1.4s;
	}
}
