/* ===================================================================
   Razhur SMS Auth — RTL form styles
   Themes restyle the form by overriding the --ru-* tokens below
   Font: IRANSansX (loaded by theme) | Tahoma fallback
   =================================================================== */

/* ── Design tokens (default palette; override --ru-* from the theme) ─ */
:root {
	--ru-green-900:   #1F4339;
	--ru-green-700:   #2D5043;
	--ru-green-600:   #356253;
	--ru-green-100:   #E5EBE7;
	--ru-green-50:    #F0F4F1;

	--ru-gold-600:    #B58A4A;
	--ru-gold-500:    #C9A063;
	--ru-gold-200:    #E7D4B4;
	--ru-gold-50:     #F6EEDF;

	--ru-cream:       #F7F5F0;
	--ru-cream2:      #EFEBE3;
	--ru-ink:         #2B2B2B;
	--ru-ink2:        #5A5A55;
	--ru-muted:       #8A8A82;
	--ru-line:        #E7E3DA;
	--ru-line2:       #D9D4C9;
	--ru-danger:      #C0392B;

	/* semantic aliases */
	--ru-primary:        var(--ru-green-900);
	--ru-primary-hover:  var(--ru-green-700);
	--ru-primary-light:  var(--ru-green-50);
	--ru-accent:         var(--ru-gold-500);
	--ru-bg:             #fff;
	--ru-surface:        var(--ru-cream);
	--ru-border:         var(--ru-line);
	--ru-text:           var(--ru-ink);
	--ru-text-2:         var(--ru-ink2);

	--ru-radius-sm:   6px;
	--ru-radius:      8px;
	--ru-radius-lg:   12px;
	--ru-radius-xl:   16px;

	--ru-shadow-xs:   0 1px 2px rgba(43,43,43,.05);
	--ru-shadow-sm:   0 2px 8px rgba(43,43,43,.06);
	--ru-shadow:      0 6px 20px rgba(43,43,43,.08);
	--ru-shadow-lg:   0 14px 40px rgba(31,67,57,.12);

	/* Follow the active theme's Persian font token (--font-fa) when it
	   exists, otherwise IRANSansX. */
	--ru-font:        var(--font-fa, 'IRANSansX'), 'Tahoma', 'Arial', sans-serif;
	--ru-transition:  .18s ease;
}

/* ── Outer wrapper ───────────────────────────────────────────────── */
	.ru-auth-wrap {
		direction:     rtl;
		font-family:   var(--ru-font);
	font-size:     15px;
	line-height:   1.8;
	color:         var(--ru-text);
	max-width:     460px;
	margin:        0 auto;
	padding:       8px 0;
		position:      relative;
	}

	.ru-auth-logo-wrap {
		text-align:    center;
		line-height:   0;
		margin:        0 0 18px;
	}

	.ru-auth-logo {
		display:       inline-block;
		width:         auto;
		max-width:     100%;
		height:        auto;
	}

	/* ── Card (each step) ────────────────────────────────────────────── */
.ru-step {
	background:    var(--ru-bg);
	border:        1.5px solid var(--ru-border);
	border-radius: var(--ru-radius-xl);
	padding:       40px 36px;
	box-shadow:    var(--ru-shadow-lg);
}

.ru-step-hidden {
	display: none;
}

/* ── Step header ─────────────────────────────────────────────────── */
.ru-step-title {
	font-size:    22px;
	font-weight:  800;
	color:        var(--ru-primary);
	margin:       0 0 6px;
	line-height:  1.3;
}

.ru-step-desc {
	color:       var(--ru-text-2);
	font-size:   14px;
	margin:      0 0 28px;
	line-height: 1.7;
}

/* ── Field group ─────────────────────────────────────────────────── */
.ru-field-group {
	display:        flex;
	flex-direction: column;
	gap:            6px;
	margin-bottom:  18px;
}

.ru-label {
	font-size:   13px;
	font-weight: 700;
	color:       var(--ru-text);
	line-height: 1;
}

.ru-required {
	color:        var(--ru-danger);
	margin-right: 2px;
}

.ru-optional {
	color:       var(--ru-muted);
	font-weight: 400;
	font-size:   12px;
}

/* ── Input ───────────────────────────────────────────────────────── */
.ru-input {
	width:         100%;
	padding:       11px 14px;
	border:        1.5px solid var(--ru-border);
	border-radius: var(--ru-radius);
	font-size:     15px;
	font-family:   var(--ru-font);
	color:         var(--ru-text);
	background:    #fff;
	transition:    border-color var(--ru-transition), box-shadow var(--ru-transition);
	box-sizing:    border-box;
	appearance:    none;
}

.ru-input::placeholder {
	color: var(--ru-muted);
	font-size: 13px;
}

.ru-input:focus {
	outline:      none;
	border-color: var(--ru-primary);
	box-shadow:   0 0 0 3px rgba(31,67,57,.1);
	background:   var(--ru-green-50);
}

/* OTP big code input */
.ru-input-otp {
	font-size:      2rem;
	font-weight:    800;
	text-align:     center;
	letter-spacing: .45em;
	padding:        14px 10px;
	border-color:   var(--ru-line2);
	background:     var(--ru-cream);
	color:          var(--ru-primary);
}

.ru-input-otp:focus {
	background: var(--ru-green-50);
}

/* ── Error message ───────────────────────────────────────────────── */
.ru-error {
	color:        var(--ru-danger);
	font-size:    13px;
	font-weight:  500;
	min-height:   20px;
	line-height:  1.5;
	margin-bottom:6px;
}

/* ── Buttons ─────────────────────────────────────────────────────── */
.ru-btn {
	display:          inline-flex;
	align-items:      center;
	justify-content:  center;
	width:            100%;
	padding:          13px 24px;
	border:           none;
	border-radius:    var(--ru-radius);
	font-size:        15px;
	font-family:      var(--ru-font);
	font-weight:      700;
	cursor:           pointer;
	text-align:       center;
	transition:       background var(--ru-transition),
	                  color var(--ru-transition),
	                  border-color var(--ru-transition),
	                  box-shadow var(--ru-transition);
	line-height:      1;
}

.ru-btn + .ru-btn {
	margin-top: 10px;
}

/* Primary — green brand */
.ru-btn-primary {
	background:    var(--ru-primary);
	color:         #fff;
	box-shadow:    0 4px 14px rgba(31,67,57,.22);
}

.ru-btn-primary:hover,
.ru-btn-primary:focus {
	background: var(--ru-primary-hover);
	box-shadow: 0 6px 18px rgba(31,67,57,.30);
}

.ru-btn-primary:active {
	background: var(--ru-green-600);
	box-shadow: none;
}

/* Secondary — outlined green */
.ru-btn-secondary {
	background:    var(--ru-bg);
	color:         var(--ru-primary);
	border:        1.5px solid var(--ru-primary);
}

.ru-btn-secondary:hover,
.ru-btn-secondary:focus {
	background: var(--ru-green-50);
}

/* Ghost — text-only */
.ru-btn-ghost {
	background:  transparent;
	color:       var(--ru-muted);
	font-size:   13px;
	font-weight: 500;
	padding:     8px 0;
	box-shadow:  none;
}

.ru-btn-ghost:hover {
	color: var(--ru-text);
}

/* Link-style */
.ru-btn-link {
	background:  transparent;
	color:       var(--ru-primary);
	font-size:   13px;
	font-weight: 600;
	width:       auto;
	padding:     4px 0;
	border:      none;
	cursor:      pointer;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.ru-btn-link:hover {
	color: var(--ru-primary-hover);
}

/* ── Divider ─────────────────────────────────────────────────────── */
.ru-divider {
	display:     flex;
	align-items: center;
	gap:         10px;
	color:       var(--ru-muted);
	font-size:   12px;
	margin:      10px 0;
}

.ru-divider::before,
.ru-divider::after {
	content:    '';
	flex:       1;
	height:     1px;
	background: var(--ru-border);
}

/* ── Resend / countdown area ─────────────────────────────────────── */
.ru-resend-wrap {
	display:         flex;
	align-items:     center;
	justify-content: center;
	flex-wrap:       wrap;
	gap:             6px;
	margin-top:      14px;
	font-size:       13px;
}

.ru-resend-timer {
	color:       var(--ru-muted);
	font-weight: 500;
}

/* ── Loading overlay ─────────────────────────────────────────────── */
.ru-loading {
	position:         absolute;
	inset:            0;
	background:       rgba(247,245,240,.82);
	display:          flex;
	align-items:      center;
	justify-content:  center;
	border-radius:    var(--ru-radius-xl);
	z-index:          20;
	backdrop-filter:  blur(2px);
}

.ru-hidden {
	display: none !important;
}

/* ── Spinner ─────────────────────────────────────────────────────── */
.ru-spinner {
	width:         44px;
	height:        44px;
	border:        4px solid var(--ru-green-100);
	border-top:    4px solid var(--ru-primary);
	border-radius: 50%;
	animation:     ru-spin .65s linear infinite;
}

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

/* ── Phone display chip ──────────────────────────────────────────── */
#ru-otp-phone-display {
	display:       inline-block;
	background:    var(--ru-cream2);
	border:        1px solid var(--ru-line2);
	border-radius: var(--ru-radius-sm);
	padding:       1px 8px;
	font-weight:   700;
	font-size:     14px;
	color:         var(--ru-primary);
	direction:     ltr;
	letter-spacing:.04em;
}

	/* ── Logged-in message ───────────────────────────────────────────── */
	.ru-auth-logged-in {
		padding:       34px 30px;
		background:    linear-gradient(180deg, #fff 0%, var(--ru-green-50) 100%);
		border:        1.5px solid var(--ru-green-100);
		border-radius: var(--ru-radius-xl);
		box-shadow:    var(--ru-shadow-lg);
		font-family:   var(--ru-font);
		font-size:     15px;
		text-align:    center;
	}

	.ru-auth-logged-in__badge {
		display:       inline-flex;
		align-items:   center;
		border:        1px solid var(--ru-gold-200);
		border-radius: 999px;
		background:    var(--ru-gold-50);
		color:         var(--ru-gold-600);
		font-size:     12px;
		font-weight:   800;
		line-height:   1;
		margin-bottom: 14px;
		padding:       7px 12px;
	}

	.ru-auth-logged-in__title {
		color:       var(--ru-primary);
		font-size:   20px;
		font-weight: 800;
		line-height: 1.4;
		margin:      0 0 8px;
	}

	.ru-auth-logged-in__text {
		color:       var(--ru-text-2);
		font-size:   14px;
		line-height: 1.8;
		margin:      0 0 22px;
	}

	.ru-auth-logged-in__actions {
		display:        flex;
		flex-direction: column;
		gap:            10px;
	}
	
	.ru-auth-logged-in__actions .ru-btn {
		text-decoration: none;
	}

	.ru-auth-logged-in__actions .ru-btn + .ru-btn {
		margin-top: 0;
	}

/* ── Responsive ──────────────────────────────────────────────────── */
@media (max-width: 520px) {
	.ru-step {
		padding: 28px 20px;
		border-radius: var(--ru-radius-lg);
	}
	.ru-step-title {
		font-size: 19px;
	}
	.ru-input-otp {
		font-size:      1.6rem;
		letter-spacing: .3em;
	}
}

@media (max-width: 380px) {
	.ru-step {
		padding: 22px 16px;
	}
}

/* ── Back to home link ───────────────────────────────────────────── */
.ru-auth-home-link {
	margin-top: 18px;
	text-align: center;
}
.ru-auth-home-link a {
	display:         inline-flex;
	align-items:     center;
	gap:             6px;
	color:           var(--ru-muted);
	font-size:       14px;
	text-decoration: none;
	transition:      color .15s ease;
}
.ru-auth-home-link a::before {
	content:     "→";
	font-size:   15px;
	line-height: 1;
}
.ru-auth-home-link a:hover {
	color: var(--ru-primary);
}

/* ── Registration disabled panel ─────────────────────────────────── */
.ru-reg-disabled {
	margin-top:    16px;
	padding:       16px 18px;
	background:    var(--ru-gold-50);
	border:        1px solid var(--ru-gold-200);
	border-radius: var(--ru-radius);
}
.ru-reg-disabled__message {
	color:       var(--ru-text);
	font-size:   14px;
	line-height: 1.9;
}
.ru-reg-disabled__message p {
	margin: 0 0 8px;
}
.ru-reg-disabled__message p:last-child {
	margin-bottom: 0;
}
.ru-reg-disabled__message a {
	color:           var(--ru-primary);
	text-decoration: underline;
}
.ru-reg-disabled .ru-btn-alt {
	margin-top: 14px;
}

/* Alternative button — gold accent, sits under the registration message */
.ru-btn-alt {
	background:       var(--ru-gold-600);
	color:           #fff;
	text-decoration: none;
	box-shadow:      0 4px 14px rgba(181, 138, 74, .22);
}
.ru-btn-alt:hover,
.ru-btn-alt:focus {
	background: var(--ru-gold-500);
	color:      #fff;
	box-shadow: 0 6px 18px rgba(181, 138, 74, .30);
}

.ru-pending-message {
	padding:       18px 20px;
	border-radius: 10px;
	background:    #fff7e6;
	border:        1px solid #f0c36d;
	color:         #7a4b00;
	font-size:     15px;
	line-height:   1.8;
	text-align:    center;
}

/* ---------------------------------------------------------------------------
 * Full registration form ([razhur_registration_form])
 * ------------------------------------------------------------------------- */
.ru-regform-wrap textarea.ru-input {
	min-height: 88px;
	resize:     vertical;
}
.ru-regform-wrap select.ru-input {
	appearance:         none;
	-webkit-appearance: none;
	background-image:   linear-gradient(45deg, transparent 50%, currentColor 50%),
	                    linear-gradient(135deg, currentColor 50%, transparent 50%);
	background-position: calc(18px) calc(50% - 2px), calc(12px) calc(50% - 2px);
	background-size:    6px 6px;
	background-repeat:  no-repeat;
	padding-inline-start: 36px;
	cursor: pointer;
}
.ru-field-hint {
	margin:    6px 0 0;
	font-size: 12px;
	color:     #8a8f98;
	line-height: 1.7;
}
.ru-error a {
	color:           inherit;
	font-weight:     700;
	text-decoration: underline;
}

/* Always-visible register CTA under the login form */
.ru-register-cta {
	margin-top: 18px;
}
.ru-register-cta .ru-btn-alt {
	display:    block;
	width:      100%;
	text-align: center;
}

/* ---------------------------------------------------------------------------
 * Theme-typography insulation.
 * When the form is rendered inside an article/prose container (e.g. the
 * theme's .st-post-content), generic `h2`, `p`, `img` and `a` rules leak into
 * it. These higher-specificity rules pin the form's own values.
 * ------------------------------------------------------------------------- */
.ru-auth-wrap .ru-auth-logo {
	margin:        0;
	border-radius: 0;
	box-shadow:    none;
}
.ru-auth-wrap .ru-step-title {
	font-size:   22px;
	margin:      0 0 6px;
	line-height: 1.3;
}
.ru-auth-wrap .ru-step-desc {
	font-size: 14px;
	margin:    0 0 28px;
}
.ru-auth-wrap .ru-field-hint,
.ru-auth-wrap .ru-error,
.ru-auth-wrap .ru-label {
	margin-bottom: 0;
}
.ru-auth-wrap a.ru-btn {
	text-decoration: none;
}
.ru-auth-wrap a.ru-btn-alt,
.ru-auth-wrap a.ru-btn-alt:hover,
.ru-auth-wrap a.ru-btn-alt:focus {
	color: #fff;
}
