/* =========================================================
   رتب | مصادقة الزوّار في «حسابي» (تبويبات: دخول / إنشاء حساب)
   يعمل بالعربية (RTL) والإنجليزية (LTR) ومتجاوبًا من 320px.
   يعتمد على متغيّرات woocommerce.css المحمّلة قبله.
   ========================================================= */

/* البطاقة الحاوية أوسع قليلًا من نموذج الدخول القديم لتستوعب الحقول. */
body.woocommerce-account:not(.logged-in) .woocommerce {
	max-width: 540px;
}

.rattb-auth {
	--rattb-auth-gap: 16px;
	width: 100%;
}

/* ---------- التبويبات ---------- */
.rattb-auth__tabs {
	display: grid;
	grid-auto-flow: column;
	grid-auto-columns: 1fr;
	gap: 6px;
	margin: 0 0 22px;
	padding: 5px;
	background: var(--wc-color-surface-container, #eeedf7);
	border: 1px solid rgba(140, 113, 102, 0.18);
	border-radius: 999px;
}

.rattb-auth__tab {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--wc-color-on-surface-variant, #5f5e5e);
	font: inherit;
	font-weight: 700;
	font-size: 15px;
	line-height: 1.2;
	padding: 11px 12px;
	border-radius: 999px;
	cursor: pointer;
	transition: background 0.2s var(--wc-ease), color 0.2s var(--wc-ease), box-shadow 0.2s var(--wc-ease);
}

.rattb-auth__tab:hover {
	color: var(--wc-color-on-surface, #1a1b22);
}

.rattb-auth__tab[aria-selected='true'] {
	background: #ffffff;
	color: var(--wc-color-primary, #a14100);
	box-shadow: 0 2px 10px rgba(120, 60, 0, 0.12);
}

.rattb-auth__tab:focus-visible {
	outline: 2px solid var(--wc-color-primary, #a14100);
	outline-offset: 2px;
}

/* ---------- اللوحات ---------- */
.rattb-auth__title {
	text-align: center;
	font-size: 22px;
	font-weight: 800;
	margin: 0 0 18px;
	color: var(--wc-color-on-surface, #1a1b22);
}

/* قواعد إخفاء اللوحات غير النشطة تُطبّق فقط عند تفعيل جافاسكربت،
   فيبقى كلا النموذجين ظاهرين ويعملان بدون JS. */
.rattb-auth--js .rattb-auth__panel {
	display: none;
}

.rattb-auth--js .rattb-auth__panel.is-active {
	display: block;
	animation: rattb-auth-fade 0.22s var(--wc-ease);
}

@keyframes rattb-auth-fade {
	from { opacity: 0; transform: translateY(4px); }
	to   { opacity: 1; transform: none; }
}

@media (prefers-reduced-motion: reduce) {
	.rattb-auth--js .rattb-auth__panel.is-active { animation: none; }
}

/* ---------- الحقول ---------- */
.rattb-auth .woocommerce-form-row label {
	font-size: 14px;
	font-weight: 600;
	color: var(--wc-color-on-surface, #1a1b22);
}

.rattb-auth .woocommerce-form-row + .woocommerce-form-row {
	margin-block-start: 4px;
}

.rattb-auth input[type='text'],
.rattb-auth input[type='email'],
.rattb-auth input[type='password'],
.rattb-auth input[type='tel'],
.rattb-auth select {
	inline-size: 100%;
	box-sizing: border-box;
	height: 46px;
}

.rattb-auth input.input-text,
.rattb-auth select {
	margin-block-start: 6px;
	padding: 0 12px;
}

/* ---------- حقل كلمة المرور + زر الإظهار ---------- */
.rattb-auth__pw.password-input {
	position: relative;
	display: block;
}

.rattb-auth__pw .woocommerce-Input {
	padding-inline-end: 46px;
}

.rattb-auth__pw-toggle {
	position: absolute;
	inset-block-start: 6px;
	inset-inline-end: 0;
	inline-size: 44px;
	block-size: 46px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--wc-color-on-surface-variant, #5f5e5e);
	cursor: pointer;
	border-radius: 8px;
}

.rattb-auth__pw-toggle::before {
	content: '';
	inline-size: 20px;
	block-size: 20px;
	background-color: currentColor;
	-webkit-mask: var(--rattb-eye) center / contain no-repeat;
	mask: var(--rattb-eye) center / contain no-repeat;
}

.rattb-auth__pw-toggle[aria-pressed='true']::before {
	-webkit-mask: var(--rattb-eye-off) center / contain no-repeat;
	mask: var(--rattb-eye-off) center / contain no-repeat;
}

.rattb-auth__pw-toggle:hover {
	color: var(--wc-color-primary, #a14100);
}

.rattb-auth__pw-toggle:focus-visible {
	outline: 2px solid var(--wc-color-primary, #a14100);
	outline-offset: 2px;
}

/* أيقونتا العين (SVG مضمّنة كـ data URI) */
.rattb-auth {
	--rattb-eye: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M2 12s3.5-7 10-7 10 7 10 7-3.5 7-10 7-10-7-10-7Z'/%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3C/svg%3E");
	--rattb-eye-off: url("data:image/svg+xml;charset=utf-8,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%23000' stroke-width='1.8' stroke-linecap='round' stroke-linejoin='round'%3E%3Cpath d='M9.9 4.24A9.12 9.12 0 0 1 12 4c6.5 0 10 7 10 7a13.16 13.16 0 0 1-1.67 2.68'/%3E%3Cpath d='M6.61 6.61A13.5 13.5 0 0 0 2 11s3.5 7 10 7a9.74 9.74 0 0 0 5.39-1.61'/%3E%3Cpath d='M14.12 14.12A3 3 0 1 1 9.88 9.88'/%3E%3Cpath d='m2 2 20 20'/%3E%3C/svg%3E");
}

/* ---------- رسالة تطابق كلمتي المرور ---------- */
.rattb-auth__pw-match {
	display: block;
	min-block-size: 1.2em;
	margin-block-start: 4px;
	font-size: 12.5px;
	line-height: 1.5;
}

.rattb-auth__pw-match.is-match { color: #0f7a2c; }
.rattb-auth__pw-match.is-mismatch { color: #b32d2e; }

/* ---------- حقل الهاتف (رمز الدولة + الرقم) ---------- */
.rattb-auth__phone {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin-block-start: 6px;
}

/* في RTL نعكس ترتيب الظهور ليبدأ الرقم بعد رمز الدولة منطقيًا. */
.rtl .rattb-auth__phone {
	flex-direction: row-reverse;
}

.rattb-auth__phone select {
	flex: 0 0 auto;
	inline-size: auto;
	min-inline-size: 150px;
	max-inline-size: 100%;
	margin-block-start: 0;
	direction: ltr;
}

.rattb-auth__phone input {
	flex: 1 1 160px;
	min-inline-size: 0;
	margin-block-start: 0;
	direction: ltr;
	text-align: start;
}

/* ---------- الشروط ---------- */
.rattb-auth__terms {
	margin-block-start: 6px;
}

.rattb-auth__terms label {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	font-weight: 500;
	font-size: 13.5px;
	line-height: 1.6;
	color: var(--wc-color-on-surface-variant, #5f5e5e);
	cursor: pointer;
}

.rattb-auth__terms input[type='checkbox'] {
	flex: 0 0 auto;
	inline-size: 18px;
	block-size: 18px;
	margin: 2px 0 0;
	accent-color: var(--wc-color-primary, #a14100);
}

.rattb-auth__terms a {
	color: var(--wc-color-primary, #a14100);
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ---------- الأزرار ---------- */
.rattb-auth button[type='submit'] {
	inline-size: 100%;
	min-block-size: 48px;
	font-weight: 700;
}

.rattb-auth__row-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 10px 14px;
}

.rattb-auth__row-actions .woocommerce-form-login__rememberme {
	margin: 0;
}

.rattb-auth__row-actions button[type='submit'] {
	flex: 1 1 100%;
}

.rattb-auth .lost_password {
	text-align: center;
	margin-block-start: 14px;
}

.rattb-auth .lost_password a {
	color: var(--wc-color-primary, #a14100);
}

/* ---------- مقياس قوة كلمة المرور (يُدرجه ووكوميرس) ---------- */
.rattb-auth .woocommerce-password-strength {
	display: block;
	margin-block-start: 6px;
	padding: 7px 10px;
	border-radius: 8px;
	font-size: 12.5px;
	font-weight: 600;
	line-height: 1.5;
}

.rattb-auth .woocommerce-password-strength.short,
.rattb-auth .woocommerce-password-strength.bad {
	background: #fdecec;
	color: #b32d2e;
}

.rattb-auth .woocommerce-password-strength.good {
	background: #fff5e0;
	color: #8a5a00;
}

.rattb-auth .woocommerce-password-strength.strong {
	background: #e7f6ea;
	color: #0f7a2c;
}

.rattb-auth .woocommerce-password-hint {
	display: block;
	margin-block-start: 4px;
	font-size: 12px;
	color: var(--wc-color-on-surface-variant, #5f5e5e);
}

/* عند تعطيل زر الإرسال بسبب ضعف كلمة المرور */
.rattb-auth button[type='submit'].disabled,
.rattb-auth button[type='submit'][disabled] {
	opacity: 0.55;
	cursor: not-allowed;
}

/* ---------- استجابة ---------- */
@media screen and (max-width: 520px) {
	body.woocommerce-account:not(.logged-in) .woocommerce {
		padding: 24px 18px 22px;
	}

	.rattb-auth__tabs {
		margin-bottom: 18px;
	}

	.rattb-auth__tab {
		font-size: 14px;
		padding: 10px 8px;
	}
}

@media screen and (max-width: 360px) {
	.rattb-auth__phone {
		gap: 6px;
	}

	.rattb-auth__phone select {
		min-inline-size: 100%;
	}

	.rattb-auth__phone input {
		flex-basis: 100%;
	}
}

/* شاشة رمز التحقق (OTP) */
.rattb-auth__otp {
	display: block;
}

.rattb-auth__otp .rattb-auth__otp-intro {
	margin: 0 0 16px;
	line-height: 1.7;
	color: #475569;
}

.rattb-auth__otp #rattb_otp_code {
	font-size: 24px;
	letter-spacing: 8px;
	text-align: center;
	direction: ltr;
	max-inline-size: 240px;
}

.rattb-auth__otp-flash {
	margin: 0 0 14px;
	padding: 10px 12px;
	border-radius: 8px;
	background: #ecfdf5;
	color: #065f46;
	border: 1px solid #a7f3d0;
}

.rattb-auth__otp-error {
	margin: 0 0 14px;
	padding: 10px 12px;
	border-radius: 8px;
	background: #fef2f2;
	color: #991b1b;
	border: 1px solid #fecaca;
}

.rattb-auth__otp-actions {
	margin-top: 14px;
}

.rattb-auth__otp-resend-form {
	margin-top: 10px;
}

.rattb-auth__otp-resend {
	background: none;
	border: 0;
	padding: 0;
	color: var(--rattb-accent, #0f172a);
	text-decoration: underline;
	cursor: pointer;
	font: inherit;
}

.rattb-auth__otp-resend[disabled] {
	color: #94a3b8;
	text-decoration: none;
	cursor: default;
}

.rattb-auth__otp-link {
	color: var(--rattb-accent, #0f172a);
}

/* لوحة التحقق داخل صفحة الدفع */
.rattb-otp-checkout {
	display: block;
	margin: 0 0 24px;
	padding: 18px 18px 16px;
	border: 1px solid rgba(140, 113, 102, 0.3);
	border-radius: 10px;
	background: rgba(251, 248, 255, 0.6);
}

.rattb-otp-checkout .rattb-auth__title {
	margin-bottom: 8px;
}

.rattb-auth__otp-help {
	margin: 0 0 12px;
	font-size: 14px;
	line-height: 1.7;
	color: var(--wc-color-on-surface-variant, #5f5e5e);
}

.rattb-otp-checkout #rattb_otp_code {
	display: block;
	inline-size: 100%;
	max-inline-size: 240px;
	box-sizing: border-box;
	height: 46px;
	padding: 0 12px;
	letter-spacing: 6px;
	font-size: 20px;
	text-align: center;
	direction: ltr;
}

.rattb-otp-checkout .rattb-auth__otp-actions {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 12px;
	margin: 12px 0 0;
}

.rattb-otp-checkout .rattb-auth__otp-resend {
	background: none;
	border: 0;
	padding: 0;
	color: var(--wc-color-primary, #a14100);
	text-decoration: underline;
	cursor: pointer;
	font: inherit;
}

.rattb-otp-checkout .rattb-auth__otp-resend[disabled] {
	color: #94a3b8;
	text-decoration: none;
	cursor: default;
}

