/**
 * صفحات ورود / OTP با شماره موبایل — هماهنگ با تم تیره baGPT
 */
:root {
	--ba-bg: #07080d;
	--ba-surface: #0c0e14;
	--ba-elevated: #12141c;
	--ba-border: rgba(255, 255, 255, 0.1);
	--ba-border-focus: rgba(6, 182, 212, 0.55);
	--ba-text: #f4f4f5;
	--ba-muted: #a1a1aa;
	--ba-danger: #f87171;
	--ba-danger-bg: rgba(239, 68, 68, 0.12);
	--ba-success-bg: rgba(16, 185, 129, 0.12);
	--ba-accent: linear-gradient(135deg, #14b8a6, #06b6d4);
	--ba-radius: 14px;
	--ba-radius-btn: 14px;
	--ba-shadow: 0 24px 64px rgba(0, 0, 0, 0.55);
	/* هم‌رنگ با app.css — اسکرول‌بار */
	--bagpt-scrollbar-track: rgba(255, 255, 255, 0.06);
	--bagpt-scrollbar-thumb: rgba(255, 255, 255, 0.22);
	--bagpt-scrollbar-thumb-hover: rgba(255, 255, 255, 0.36);
	--bagpt-scrollbar-size: 10px;
}

.bagpt-auth-page {
	margin: 0;
	min-height: 100dvh;
	background: var(--ba-bg);
	color: var(--ba-text);
	-webkit-font-smoothing: antialiased;
}

.bagpt-auth {
	box-sizing: border-box;
	min-height: 100dvh;
	min-width: 0;
	max-width: 100%;
	display: flex;
	flex-direction: column;
	padding: max(12px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
		max(20px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
	overflow-x: hidden;
}

.bagpt-auth__topbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 44px;
	margin-bottom: 8px;
	/* دکمهٔ بازگشت همیشه سمت چپ بوم (مثل iOS)؛ در RTL فلکس اول = راست می‌شد */
	direction: ltr;
}

.bagpt-auth__back {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 44px;
	height: 44px;
	margin-inline-start: -8px;
	border: none;
	border-radius: 12px;
	background: transparent;
	color: var(--ba-muted);
	cursor: pointer;
	transition: background 0.15s ease, color 0.15s ease;
}

.bagpt-auth__back:hover {
	background: rgba(255, 255, 255, 0.06);
	color: var(--ba-text);
}

.bagpt-auth__back svg {
	width: 22px;
	height: 22px;
}

.bagpt-auth__brand {
	flex: 1;
	text-align: center;
	direction: rtl;
	font-size: 15px;
	font-weight: 700;
	letter-spacing: 0.02em;
	color: var(--ba-text);
}

.bagpt-auth__spacer {
	width: 44px;
	height: 44px;
	flex-shrink: 0;
}

.bagpt-auth__main {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	justify-content: center;
	max-width: 420px;
	width: 100%;
	margin: 0 auto;
	padding-bottom: 24px;
	box-sizing: border-box;
}

.bagpt-auth__title {
	margin: 0 0 8px;
	font-size: 1.35rem;
	font-weight: 700;
	line-height: 1.35;
	text-align: right;
}

.bagpt-auth__lead {
	margin: 0 0 24px;
	font-size: 0.9375rem;
	line-height: 1.65;
	color: var(--ba-muted);
	text-align: right;
}

/* شماره موبایل داخل جملهٔ فارسی: جلوگیری از برعکس شدن ارقام در RTL */
.bagpt-auth-ltr-inline {
	direction: ltr;
	unicode-bidi: isolate;
}

.bagpt-auth__alert {
	margin: 0 0 16px;
	padding: 12px 14px;
	border-radius: var(--ba-radius);
	font-size: 0.875rem;
	line-height: 1.5;
	text-align: right;
	border: 1px solid rgba(239, 68, 68, 0.35);
	background: var(--ba-danger-bg);
	color: #fecaca;
}

.bagpt-auth__alert--err {
	border-color: rgba(248, 113, 113, 0.4);
	background: rgba(239, 68, 68, 0.14);
	color: #fecaca;
}

.bagpt-auth__alert--ok {
	border-color: rgba(16, 185, 129, 0.35);
	background: var(--ba-success-bg);
	color: #a7f3d0;
}

.bagpt-auth__field {
	margin-bottom: 18px;
	text-align: right;
}

.bagpt-auth__label {
	display: block;
	margin-bottom: 8px;
	font-size: 0.8125rem;
	font-weight: 600;
	color: var(--ba-muted);
}

.bagpt-auth__input {
	box-sizing: border-box;
	width: 100%;
	padding: 14px 16px;
	font-size: 1.0625rem;
	line-height: 1.4;
	color: var(--ba-text);
	background: var(--ba-elevated);
	border: 1px solid var(--ba-border);
	border-radius: var(--ba-radius);
	outline: none;
	transition: border-color 0.15s ease, box-shadow 0.15s ease;
	direction: ltr;
	text-align: left;
}

.bagpt-auth__input::placeholder {
	color: #71717a;
}

.bagpt-auth__input:focus {
	border-color: var(--ba-border-focus);
	box-shadow: 0 0 0 3px rgba(6, 182, 212, 0.15);
}

.bagpt-auth__input--error {
	border-color: rgba(248, 113, 113, 0.6);
}

.bagpt-auth__input--otp {
	text-align: center;
	letter-spacing: 0.35em;
	font-size: 1.25rem;
	font-variant-numeric: tabular-nums;
	padding-inline: 12px;
}

.bagpt-auth__hint {
	margin: 8px 0 0;
	font-size: 0.75rem;
	color: var(--ba-danger);
	text-align: right;
	min-height: 1.25em;
}

.bagpt-auth__timer {
	margin: 4px 0 20px;
	font-size: 0.8125rem;
	color: var(--ba-muted);
	text-align: center;
	min-height: 1.25em;
}

.bagpt-auth__timer.is-done {
	color: #86efac;
}

.bagpt-auth__submit {
	width: 100%;
	padding: 14px 18px;
	border: none;
	border-radius: var(--ba-radius-btn);
	font-size: 1rem;
	font-weight: 700;
	cursor: pointer;
	color: #042f2e;
	background: var(--ba-accent);
	box-shadow: 0 8px 28px rgba(6, 182, 212, 0.22);
	transition: transform 0.12s ease, filter 0.12s ease, opacity 0.15s ease;
}

.bagpt-auth__submit:hover:not(:disabled) {
	filter: brightness(1.06);
	transform: translateY(-1px);
}

.bagpt-auth__submit:active:not(:disabled) {
	transform: translateY(0);
}

.bagpt-auth__submit:disabled {
	opacity: 0.45;
	cursor: not-allowed;
	transform: none;
}

.bagpt-auth__link {
	display: inline-block;
	margin-top: 20px;
	width: 100%;
	text-align: center;
	font-size: 0.875rem;
	color: #7dd3fc;
	text-decoration: none;
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	font-family: inherit;
}

.bagpt-auth__link:hover {
	text-decoration: underline;
}

.bagpt-auth__link--muted {
	color: var(--ba-muted);
}

.bagpt-auth__link--inline {
	display: inline;
	width: auto;
	margin-top: 0;
	padding: 0;
}

/* صفحهٔ قیمت‌گذاری (لندینگ پلن) */
.bagpt-auth-page--pricing {
	background: radial-gradient(120% 80% at 50% -20%, rgba(6, 182, 212, 0.12), transparent 55%), var(--ba-bg);
}

.bagpt-auth-page--pricing .bagpt-auth__title {
	font-size: clamp(1.35rem, 3.8vw, 1.85rem);
	text-align: center;
}

.bagpt-auth-page--pricing .bagpt-auth__lead {
	text-align: center;
	max-width: 36rem;
	margin-inline: auto;
}

.bagpt-auth__main--pricing {
	justify-content: flex-start;
	padding-top: 4px;
	width: 100%;
	max-width: 1120px;
	max-width: min(1120px, 100%);
}

.bagpt-pricing {
	width: 100%;
	min-width: 0;
	max-width: 100%;
	box-sizing: border-box;
}

.bagpt-pricing__status-hint {
	margin: 0 0 14px;
	padding: 10px 14px;
	font-size: 0.8125rem;
	line-height: 1.55;
	color: var(--ba-muted);
	text-align: right;
	border-radius: 12px;
	border: 1px solid rgba(52, 211, 153, 0.22);
	background: rgba(52, 211, 153, 0.07);
}

.bagpt-pricing__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(min(260px, 100%), 1fr));
	gap: 16px;
	margin-top: 8px;
	align-items: stretch;
	min-width: 0;
	width: 100%;
}

.bagpt-pricing-card {
	position: relative;
	box-sizing: border-box;
	display: flex;
	flex-direction: column;
	min-height: 100%;
	padding: 22px 20px 20px;
	border-radius: 20px;
	border: 1px solid var(--ba-border);
	background: var(--ba-surface);
	box-shadow: 0 18px 48px rgba(0, 0, 0, 0.35);
	transition: border-color 0.2s ease, box-shadow 0.2s ease, transform 0.2s ease;
}

.bagpt-pricing-card:hover {
	border-color: rgba(255, 255, 255, 0.16);
	box-shadow: 0 22px 56px rgba(0, 0, 0, 0.42);
}

.bagpt-pricing-card--featured {
	border-color: rgba(6, 182, 212, 0.45);
	box-shadow: 0 0 0 1px rgba(6, 182, 212, 0.2), 0 24px 64px rgba(6, 182, 212, 0.12);
	transform: translateY(-2px);
	z-index: 1;
}

.bagpt-pricing-card--current {
	border-color: rgba(52, 211, 153, 0.52);
	box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.14), 0 18px 48px rgba(0, 0, 0, 0.35);
	z-index: 2;
}

.bagpt-pricing-card--current:hover {
	border-color: rgba(52, 211, 153, 0.68);
}

.bagpt-pricing-card--featured.bagpt-pricing-card--current {
	transform: translateY(-2px);
	border-color: rgba(52, 211, 153, 0.58);
	box-shadow: 0 0 0 1px rgba(52, 211, 153, 0.2), 0 24px 64px rgba(52, 211, 153, 0.1);
}

.bagpt-pricing-card__badge {
	position: absolute;
	inset-block-start: 14px;
	inset-inline-end: 14px;
	padding: 4px 10px;
	font-size: 0.6875rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	border-radius: 999px;
	background: rgba(6, 182, 212, 0.18);
	color: #5eead4;
	border: 1px solid rgba(6, 182, 212, 0.35);
}

.bagpt-pricing-card__badge--current {
	background: rgba(52, 211, 153, 0.14);
	color: #6ee7b7;
	border-color: rgba(52, 211, 153, 0.38);
}

.bagpt-pricing-card__head {
	margin-bottom: 16px;
	padding-top: 4px;
}

.bagpt-pricing-card--featured .bagpt-pricing-card__head {
	padding-top: 22px;
}

.bagpt-pricing-card--current .bagpt-pricing-card__head {
	padding-top: 22px;
}

.bagpt-pricing-card__active-until {
	margin: 0 0 8px;
	font-size: 0.75rem;
	color: var(--ba-muted);
	text-align: right;
	line-height: 1.45;
}

.bagpt-pricing-card__name {
	margin: 0 0 10px;
	font-size: 1.125rem;
	font-weight: 700;
	line-height: 1.3;
	text-align: right;
}

.bagpt-pricing-card__price {
	margin: 0;
	display: flex;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 6px 10px;
	text-align: right;
}

.bagpt-pricing-card__price-main {
	font-size: 1.35rem;
	font-weight: 700;
	letter-spacing: -0.02em;
}

.bagpt-pricing-card__price-sub {
	font-size: 0.8125rem;
	color: var(--ba-muted);
	font-weight: 500;
}

.bagpt-pricing-card__features {
	margin: 0 0 20px;
	padding: 0;
	list-style: none;
	flex: 1 1 auto;
}

.bagpt-pricing-card__feature {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 10px;
	font-size: 0.875rem;
	line-height: 1.55;
	color: rgba(244, 244, 245, 0.92);
	text-align: right;
}

.bagpt-pricing-card__feature:last-child {
	margin-bottom: 0;
}

.bagpt-pricing-card__check {
	flex-shrink: 0;
	margin-top: 2px;
	color: #34d399;
}

.bagpt-pricing-card__cta-wrap {
	margin-top: auto;
	padding-top: 4px;
}

.bagpt-pricing-card__cta {
	display: block;
	width: 100%;
	box-sizing: border-box;
	padding: 12px 16px;
	border-radius: 999px;
	font-size: 0.9375rem;
	font-weight: 700;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	border: 1px solid transparent;
	transition: background 0.15s ease, color 0.15s ease, border-color 0.15s ease, transform 0.12s ease;
}

.bagpt-pricing-card__cta--accent {
	color: #042f2e;
	background: var(--ba-accent);
	border-color: transparent;
	box-shadow: 0 8px 28px rgba(6, 182, 212, 0.25);
}

.bagpt-pricing-card__cta--accent:hover {
	filter: brightness(1.05);
	transform: translateY(-1px);
}

.bagpt-pricing-card__cta--solid {
	color: var(--ba-text);
	background: var(--ba-elevated);
	border-color: rgba(255, 255, 255, 0.14);
}

.bagpt-pricing-card__cta--solid:hover {
	border-color: rgba(255, 255, 255, 0.22);
	background: rgba(255, 255, 255, 0.06);
}

.bagpt-pricing-card__cta--ghost {
	color: var(--ba-text);
	background: transparent;
	border-color: rgba(255, 255, 255, 0.2);
}

.bagpt-pricing-card__cta--ghost:hover {
	border-color: rgba(255, 255, 255, 0.32);
	background: rgba(255, 255, 255, 0.04);
}

.bagpt-pricing__note {
	margin: 20px 0 0;
	font-size: 0.75rem;
	line-height: 1.6;
	color: var(--ba-muted);
	text-align: center;
	max-width: 40rem;
	margin-inline: auto;
}

/* چک‌اوت پرداخت */
.bagpt-auth-page--checkout .bagpt-auth__title,
.bagpt-auth-page--checkout .bagpt-auth__lead {
	text-align: center;
}

.bagpt-checkout {
	width: 100%;
	max-width: 420px;
	margin: 0 auto;
}

.bagpt-checkout__cycles {
	display: flex;
	gap: 10px;
	justify-content: center;
	margin: 8px 0 18px;
	flex-wrap: wrap;
}

.bagpt-checkout__chip {
	display: inline-flex;
	align-items: center;
	padding: 8px 16px;
	border-radius: 999px;
	font-size: 0.875rem;
	font-weight: 600;
	text-decoration: none;
	border: 1px solid var(--ba-border);
	color: var(--ba-muted);
	background: var(--ba-surface);
	transition: border-color 0.15s ease, color 0.15s ease, background 0.15s ease;
}

.bagpt-checkout__chip:hover {
	border-color: rgba(255, 255, 255, 0.2);
	color: var(--ba-text);
}

.bagpt-checkout__chip.is-active {
	border-color: rgba(6, 182, 212, 0.45);
	color: #5eead4;
	background: rgba(6, 182, 212, 0.1);
}

.bagpt-checkout__summary {
	margin: 0 0 18px;
	padding: 16px 18px;
	border-radius: var(--ba-radius);
	border: 1px solid var(--ba-border);
	background: var(--ba-surface);
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 8px 14px;
	font-size: 0.875rem;
	text-align: right;
}

.bagpt-checkout__summary dt {
	margin: 0;
	color: var(--ba-muted);
	font-weight: 500;
}

.bagpt-checkout__summary dd {
	margin: 0;
	justify-self: start;
}

.bagpt-checkout__rial {
	display: block;
	margin-top: 4px;
	font-size: 0.75rem;
	font-weight: 500;
	color: var(--ba-muted);
}

.bagpt-checkout__form {
	margin-bottom: 12px;
}

.bagpt-checkout__apply {
	margin-top: 4px;
	background: var(--ba-elevated);
	color: var(--ba-text);
	border: 1px solid var(--ba-border);
	box-shadow: none;
}

.bagpt-checkout__apply:hover:not(:disabled) {
	filter: brightness(1.05);
}

.bagpt-checkout--done {
	text-align: center;
	margin-top: 12px;
}

.bagpt-auth-screen input[type="tel"],
.bagpt-auth-screen input[type="text"],
.bagpt-auth-screen button[type="submit"] {
	pointer-events: auto !important;
	opacity: 1 !important;
	-webkit-user-select: text;
	user-select: text;
}

.bagpt-auth-screen button[type="submit"] {
	user-select: none;
}

/* ارسال خودکار OTP: لودینگ تمام‌صفحه فقط بعد از submit تأیید کد (نه هنگام ارسال پیامک) */
.bagpt-auth__verify-overlay[hidden] {
	display: none !important;
}
.bagpt-auth__verify-overlay:not([hidden]) {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: max(16px, env(safe-area-inset-top)) max(16px, env(safe-area-inset-right))
		max(16px, env(safe-area-inset-bottom)) max(16px, env(safe-area-inset-left));
	background: rgba(7, 8, 13, 0.78);
	backdrop-filter: blur(8px);
	-webkit-backdrop-filter: blur(8px);
}

.bagpt-auth__verify-card {
	text-align: center;
	padding: 24px 28px;
	border-radius: 16px;
	border: 1px solid rgba(255, 255, 255, 0.1);
	background: var(--ba-surface);
	box-shadow: var(--ba-shadow);
	max-width: 280px;
}

.bagpt-auth__verify-spinner {
	box-sizing: border-box;
	width: 40px;
	height: 40px;
	margin: 0 auto 14px;
	border: 3px solid rgba(255, 255, 255, 0.12);
	border-top-color: #2dd4bf;
	border-radius: 50%;
	animation: bagpt-auth-spin 0.75s linear infinite;
}

.bagpt-auth__verify-msg {
	margin: 0;
	font-size: 0.9375rem;
	font-weight: 600;
	color: var(--ba-text);
}

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

/* اسکرول‌بار (هم‌خوان با app.css) — فقط سند؛ نه * روی همهٔ المان‌ها */
html {
	scrollbar-width: thin;
	scrollbar-color: var(--bagpt-scrollbar-thumb) var(--bagpt-scrollbar-track);
}
html::-webkit-scrollbar {
	width: var(--bagpt-scrollbar-size);
	height: var(--bagpt-scrollbar-size);
}
html::-webkit-scrollbar-track {
	background: var(--bagpt-scrollbar-track);
	border-radius: 9999px;
}
html::-webkit-scrollbar-thumb {
	border-radius: 9999px;
	border: 2px solid transparent;
	background-clip: padding-box;
	background-color: var(--bagpt-scrollbar-thumb);
}
html::-webkit-scrollbar-thumb:hover {
	background-color: var(--bagpt-scrollbar-thumb-hover);
}
html::-webkit-scrollbar-corner {
	background: transparent;
}
