/* ==========================================================================
   Parsaipro SMS Login — Frontend Styles v2
   RTL, responsive, OTP boxes, modal
   ========================================================================== */

/* ── Container ── */
.parsaipro-sms-login {
	direction: rtl;
	text-align: right;
	font-family: Vazirmatn, Tahoma, Arial, sans-serif;
	max-width: 420px;
	margin: 0 auto;
	padding: 32px 24px;
	background: #fff;
	border-radius: var(--parsaipro-radius, 16px);
	box-shadow: 0 4px 32px rgba(0,0,0,.10);
}

/* ── Steps ── */
.parsaipro-hidden { display: none !important; }

/* ── Typography ── */
.parsaipro-title {
	font-size: 1.45rem;
	font-weight: 700;
	color: #1a1a2e;
	margin: 0 0 8px;
	text-align: center;
}
.parsaipro-subtitle {
	font-size: .92rem;
	color: #555;
	margin: 0 0 22px;
	text-align: center;
	line-height: 1.7;
}

/* ── Field ── */
.parsaipro-field-wrap { margin-bottom: 14px; }

.parsaipro-label {
	display: block;
	font-size: .85rem;
	font-weight: 600;
	color: #333;
	margin-bottom: 6px;
}

.parsaipro-input {
	width: 100%;
	box-sizing: border-box;
	padding: 12px 16px;
	border: 2px solid #e0e0e0;
	border-radius: var(--parsaipro-radius, 10px);
	font-size: 1rem;
	font-family: inherit;
	color: #1a1a2e;
	background: #fafafa;
	transition: border-color .2s, box-shadow .2s;
	outline: none;
	direction: ltr;
	text-align: center;
}
.parsaipro-input:focus {
	border-color: var(--parsaipro-primary, #4f46e5);
	box-shadow: 0 0 0 3px rgba(79,70,229,.15);
	background: #fff;
}

/* ── OTP individual boxes ── */
.parsaipro-otp-boxes {
	display: flex;
	gap: 8px;
	justify-content: center;
	direction: ltr;
	margin-bottom: 14px;
}

.parsaipro-otp-box {
	width: 48px;
	height: 58px;
	text-align: center;
	font-size: 1.6rem;
	font-weight: 700;
	border: 2px solid #e0e0e0;
	border-radius: var(--parsaipro-radius, 10px);
	background: #fafafa;
	outline: none;
	transition: border-color .2s, box-shadow .2s, transform .1s;
	caret-color: transparent;
	color: #1a1a2e;
}
.parsaipro-otp-box:focus {
	border-color: var(--parsaipro-primary, #4f46e5);
	box-shadow: 0 0 0 3px rgba(79,70,229,.15);
	background: #fff;
	transform: scale(1.06);
}
.parsaipro-otp-box:not(:placeholder-shown) {
	border-color: var(--parsaipro-primary, #4f46e5);
}

/* 7-8 digit boxes — slightly smaller */
.parsaipro-otp-boxes[data-length="7"] .parsaipro-otp-box,
.parsaipro-otp-boxes[data-length="8"] .parsaipro-otp-box {
	width: 38px;
	height: 50px;
	font-size: 1.3rem;
	gap: 5px;
}

/* ── Buttons ── */
.parsaipro-btn {
	cursor: pointer;
	font-family: inherit;
	border: none;
	outline: none;
	transition: background .2s, transform .1s, opacity .2s;
}
.parsaipro-btn:active { transform: scale(.98); }

.parsaipro-btn-primary {
	display: block;
	width: 100%;
	padding: 13px 24px;
	background: var(--parsaipro-primary, #4f46e5);
	color: #fff;
	font-size: 1rem;
	font-weight: 700;
	border-radius: var(--parsaipro-radius, 10px);
	margin-top: 6px;
}
.parsaipro-btn-primary:hover:not(:disabled) {
	filter: brightness(1.08);
}
.parsaipro-btn-primary:disabled { opacity: .6; cursor: not-allowed; }

.parsaipro-btn-link {
	background: none;
	color: var(--parsaipro-primary, #4f46e5);
	font-size: .88rem;
	font-weight: 600;
	padding: 4px 0;
	text-decoration: underline;
}
.parsaipro-btn-text {
	background: none;
	color: #888;
	font-size: .82rem;
	padding: 4px 0;
}
.parsaipro-btn-text:hover { color: var(--parsaipro-primary, #4f46e5); text-decoration: underline; }

/* ── Error ── */
.parsaipro-error {
	color: #dc2626;
	font-size: .85rem;
	min-height: 18px;
	margin-bottom: 6px;
	padding: 0 2px;
	font-weight: 500;
}

/* ── Resend / change phone ── */
.parsaipro-resend-wrap {
	text-align: center;
	margin-top: 18px;
	font-size: .88rem;
	color: #666;
}
#parsaipro-countdown { font-weight: 700; color: var(--parsaipro-primary, #4f46e5); }
.parsaipro-change-phone-wrap { text-align: center; margin-top: 10px; }

/* ── Success ── */
.parsaipro-success-icon {
	text-align: center;
	font-size: 3rem;
	color: #16a34a;
	margin-bottom: 12px;
	animation: parsaipro-pop .4s ease;
}
@keyframes parsaipro-pop {
	0%  { transform: scale(.5); opacity: 0; }
	70% { transform: scale(1.15); }
	100%{ transform: scale(1); opacity: 1; }
}

/* ── Loading spinner ── */
.parsaipro-btn-loading { position: relative; }
.parsaipro-btn-loading::after {
	content: '';
	display: inline-block;
	width: 14px; height: 14px;
	margin-right: 8px;
	border: 2px solid rgba(255,255,255,.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: parsaipro-spin .6s linear infinite;
	vertical-align: middle;
}
@keyframes parsaipro-spin { to { transform: rotate(360deg); } }

/* ── Logged-in state ── */
.parsaipro-logged-in { text-align: center; color: #555; padding: 24px; }

/* ═══════════════════════════════════════════════
   MODAL
   ═══════════════════════════════════════════════ */
.parsaipro-modal-overlay {
	position: fixed;
	inset: 0;
	background: rgba(0,0,0,.55);
	z-index: 999999;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
	backdrop-filter: blur(2px);
	animation: parsaipro-fade-in .2s ease;
}
@keyframes parsaipro-fade-in { from { opacity: 0; } to { opacity: 1; } }

.parsaipro-modal-box {
	position: relative;
	width: 100%;
	max-width: 440px;
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 20px 60px rgba(0,0,0,.3);
	animation: parsaipro-slide-up .25s ease;
	max-height: 92vh;
	overflow-y: auto;
}
@keyframes parsaipro-slide-up {
	from { transform: translateY(30px); opacity: 0; }
	to   { transform: translateY(0);    opacity: 1; }
}

.parsaipro-modal-close {
	position: absolute;
	top: 12px;
	left: 12px;
	background: #f3f4f6;
	border: none;
	width: 30px; height: 30px;
	border-radius: 50%;
	cursor: pointer;
	font-size: .85rem;
	color: #555;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: background .15s;
}
.parsaipro-modal-close:hover { background: #e5e7eb; color: #111; }

.parsaipro-modal-body .parsaipro-sms-login {
	box-shadow: none;
	border-radius: 0;
}

body.parsaipro-modal-open { overflow: hidden; }

/* ── Login success toast ─────────────────────────────────────────────── */
#parsaipro-toast {
	position: fixed;
	top: 24px;
	left: 50%;
	transform: translateX(-50%);
	background: #16a34a;
	color: #fff;
	font-family: Vazirmatn, Tahoma, Arial, sans-serif;
	font-size: 1rem;
	font-weight: 600;
	padding: 14px 32px;
	border-radius: 12px;
	box-shadow: 0 4px 24px rgba(22,163,74,.35);
	z-index: 9999999;
	direction: rtl;
	text-align: center;
	white-space: nowrap;
	opacity: 1;
	transition: opacity .5s ease;
	pointer-events: none;
	animation: parsaipro-toast-in .3s ease;
}
@keyframes parsaipro-toast-in {
	from { opacity: 0; transform: translateX(-50%) translateY(-10px); }
	to   { opacity: 1; transform: translateX(-50%) translateY(0); }
}
#parsaipro-toast.parsaipro-toast-hide { opacity: 0; }

/* Prevent iOS auto-zoom: modal inputs must be ≥ 16px */
.parsaipro-modal-overlay input,
.parsaipro-modal-overlay .parsaipro-otp-box {
	font-size: 16px !important;
}

/* ─── Responsive ─── */
@media (max-width: 480px) {
	.parsaipro-sms-login {
		padding: 20px 14px;
		border-radius: 12px;
		box-shadow: none;
	}
	.parsaipro-title { font-size: 1.2rem; }
	.parsaipro-otp-box { width: 40px; height: 50px; font-size: 1.3rem; }
	.parsaipro-otp-boxes[data-length="7"] .parsaipro-otp-box,
	.parsaipro-otp-boxes[data-length="8"] .parsaipro-otp-box {
		width: 32px; height: 42px; font-size: 1.1rem;
	}
	.parsaipro-modal-box { border-radius: 14px; }
}
