/* المحترف PWA — بطاقة التثبيت التفاعلية v1.1.0 */

.am-pwa-root {
	position: fixed;
	inset: 0;
	z-index: 999999;
	pointer-events: none;
	font-family: inherit;
	line-height: 1.6;
}

.am-pwa-root *,
.am-pwa-root *::before,
.am-pwa-root *::after {
	box-sizing: border-box;
}

/* ---------- الخلفية المعتمة ---------- */
.am-pwa-backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.5);
	backdrop-filter: blur(3px);
	-webkit-backdrop-filter: blur(3px);
	opacity: 0;
	transition: opacity 0.35s ease;
	pointer-events: auto;
}

.am-pwa-open .am-pwa-backdrop {
	opacity: 1;
}

/* ---------- البطاقة السفلية ---------- */
.am-pwa-sheet {
	position: absolute;
	bottom: 0;
	inset-inline: 0;
	margin-inline: auto;
	max-width: 460px;
	background: #ffffff;
	color: #111827;
	border-radius: 26px 26px 0 0;
	padding: 10px 22px calc(22px + env(safe-area-inset-bottom, 0px));
	text-align: center;
	box-shadow: 0 -12px 44px rgba(0, 0, 0, 0.28);
	transform: translateY(105%);
	transition: transform 0.45s cubic-bezier(0.22, 1, 0.36, 1);
	pointer-events: auto;
	touch-action: pan-y;
	outline: none;
}

@media (min-width: 640px) {
	.am-pwa-sheet {
		bottom: 24px;
		border-radius: 26px;
	}
}

.am-pwa-open .am-pwa-sheet {
	transform: translateY(0);
}

.am-pwa-sheet.am-pwa-dragging {
	transition: none;
}

/* مقبض السحب */
.am-pwa-handle {
	width: 44px;
	height: 5px;
	border-radius: 999px;
	background: #d1d5db;
	margin: 4px auto 14px;
}

/* زر الإغلاق */
.am-pwa-x {
	position: absolute;
	top: 12px;
	inset-inline-start: 12px;
	width: 32px;
	height: 32px;
	border: 0;
	border-radius: 50%;
	background: #f3f4f6;
	color: #6b7280;
	font-size: 19px;
	line-height: 1;
	cursor: pointer;
	font-family: inherit;
	transition: background 0.15s ease, color 0.15s ease;
}

.am-pwa-x:hover {
	background: #e5e7eb;
	color: #374151;
}

/* الأيقونة بهالة نابضة */
.am-pwa-s-icon {
	display: inline-block;
	width: 72px;
	height: 72px;
	border-radius: 18px;
	object-fit: cover;
	margin-bottom: 12px;
	box-shadow:
		0 6px 18px rgba(0, 0, 0, 0.14),
		0 0 0 0 var(--am-pwa-color, #111827);
	animation: am-pwa-ring 2.4s ease-out infinite;
}

@keyframes am-pwa-ring {
	0%   { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14), 0 0 0 0 rgba(17, 24, 39, 0.28); }
	70%  { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14), 0 0 0 14px rgba(17, 24, 39, 0); }
	100% { box-shadow: 0 6px 18px rgba(0, 0, 0, 0.14), 0 0 0 0 rgba(17, 24, 39, 0); }
}

.am-pwa-s-icon-fb {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 34px;
	background: #f3f4f6;
	animation: none;
}

.am-pwa-s-title {
	font-size: 18px;
	font-weight: 800;
	margin: 0 0 4px;
}

.am-pwa-s-sub {
	font-size: 13px;
	color: #6b7280;
	margin: 0 0 14px;
	padding-inline: 6px;
}

/* ---------- شارات المميزات ---------- */
.am-pwa-chips {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	gap: 8px;
	margin: 0 0 16px;
}

.am-pwa-chip {
	font-size: 12.5px;
	font-weight: 600;
	padding: 6px 13px;
	border-radius: 999px;
	background: #f3f4f6;
	background: color-mix(in srgb, var(--am-pwa-color, #111827) 9%, #ffffff);
	color: #374151;
	border: 1px solid rgba(0, 0, 0, 0.05);
	opacity: 0;
	transform: translateY(8px);
	animation: am-pwa-chip-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

@keyframes am-pwa-chip-in {
	to { opacity: 1; transform: translateY(0); }
}

/* ---------- زر التثبيت بلمعة متحركة ---------- */
.am-pwa-cta {
	position: relative;
	overflow: hidden;
	display: block;
	width: 100%;
	border: 0;
	cursor: pointer;
	background: var(--am-pwa-color, #111827);
	background-image: linear-gradient(
		135deg,
		var(--am-pwa-color, #111827),
		color-mix(in srgb, var(--am-pwa-color, #111827) 72%, #3b82f6)
	);
	color: var(--am-pwa-btn-text, #ffffff);
	border-radius: 15px;
	padding: 15px 20px;
	font-size: 16px;
	font-weight: 800;
	font-family: inherit;
	letter-spacing: 0.2px;
	box-shadow: 0 8px 20px color-mix(in srgb, var(--am-pwa-color, #111827) 35%, transparent);
	transition: transform 0.12s ease, filter 0.15s ease;
}

.am-pwa-cta::after {
	content: "";
	position: absolute;
	top: 0;
	inset-inline-start: -70%;
	width: 45%;
	height: 100%;
	background: linear-gradient(
		105deg,
		rgba(255, 255, 255, 0) 0%,
		rgba(255, 255, 255, 0.34) 50%,
		rgba(255, 255, 255, 0) 100%
	);
	transform: skewX(-18deg);
	animation: am-pwa-shine 3s ease-in-out infinite;
}

@keyframes am-pwa-shine {
	0%, 55% { inset-inline-start: -70%; }
	85%, 100% { inset-inline-start: 130%; }
}

.am-pwa-cta:hover { filter: brightness(1.07); }
.am-pwa-cta:active { transform: scale(0.97); }

/* زر «مو هسه» */
.am-pwa-later {
	display: block;
	width: 100%;
	margin-top: 8px;
	border: 0;
	background: transparent;
	color: #9ca3af;
	font-size: 13.5px;
	font-weight: 600;
	font-family: inherit;
	padding: 10px;
	cursor: pointer;
	transition: color 0.15s ease;
}

.am-pwa-later:hover { color: #4b5563; }

/* ---------- خطوات iOS ---------- */
.am-pwa-steps {
	text-align: start;
	margin: 2px 0 6px;
}

.am-pwa-step {
	display: flex;
	align-items: center;
	gap: 11px;
	font-size: 14px;
	color: #374151;
	padding: 9px 4px;
	border-bottom: 1px dashed #e5e7eb;
	opacity: 0;
	transform: translateY(8px);
	animation: am-pwa-chip-in 0.45s cubic-bezier(0.22, 1, 0.36, 1) forwards;
}

.am-pwa-step:nth-child(1) { animation-delay: 0.15s; }
.am-pwa-step:nth-child(2) { animation-delay: 0.3s; }
.am-pwa-step:nth-child(3) { animation-delay: 0.45s; border-bottom: 0; }

.am-pwa-step-n {
	flex: 0 0 26px;
	width: 26px;
	height: 26px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: color-mix(in srgb, var(--am-pwa-color, #111827) 12%, #ffffff);
	color: var(--am-pwa-color, #111827);
	font-size: 13px;
	font-weight: 800;
}

/* ---------- توست النجاح ---------- */
.am-pwa-toast {
	position: fixed;
	bottom: calc(22px + env(safe-area-inset-bottom, 0px));
	inset-inline: 16px;
	margin-inline: auto;
	max-width: 380px;
	z-index: 1000000;
	background: #111827;
	color: #f9fafb;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	padding: 13px 18px;
	border-radius: 999px;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
	opacity: 0;
	transform: translateY(20px);
	transition: opacity 0.35s ease, transform 0.35s cubic-bezier(0.22, 1, 0.36, 1);
	pointer-events: none;
}

.am-pwa-toast-show {
	opacity: 1;
	transform: translateY(0);
}

/* ---------- النمط المدمج (شريط بسيط) ---------- */
.am-pwa-mode-bar .am-pwa-bar {
	position: absolute;
	inset-inline: 12px;
	bottom: calc(12px + env(safe-area-inset-bottom, 0px));
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: 520px;
	margin-inline: auto;
	padding: 12px 14px;
	background: #ffffff;
	color: #111827;
	border: 1px solid rgba(0, 0, 0, 0.08);
	border-radius: 16px;
	box-shadow: 0 10px 34px rgba(0, 0, 0, 0.2);
	transform: translateY(130%);
	opacity: 0;
	transition: transform 0.35s cubic-bezier(0.2, 0.8, 0.2, 1), opacity 0.3s ease;
	pointer-events: auto;
}

.am-pwa-open .am-pwa-bar {
	transform: translateY(0);
	opacity: 1;
}

.am-pwa-b-icon {
	width: 48px;
	height: 48px;
	flex: 0 0 48px;
	border-radius: 12px;
	object-fit: cover;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12);
}

.am-pwa-b-text { flex: 1; min-width: 0; text-align: start; }
.am-pwa-b-title { font-weight: 700; font-size: 14px; margin: 0 0 2px; }
.am-pwa-b-sub { font-size: 12px; color: #6b7280; }

.am-pwa-cta-sm {
	display: inline-block;
	width: auto;
	flex: 0 0 auto;
	padding: 9px 20px;
	font-size: 14px;
	border-radius: 999px;
	box-shadow: none;
}

.am-pwa-x-bar {
	position: static;
	flex: 0 0 auto;
	background: transparent;
	width: auto;
	height: auto;
	padding: 4px 6px;
	font-size: 22px;
	color: #9ca3af;
}

.am-pwa-x-bar:hover { background: transparent; color: #4b5563; }

/* ---------- زر الشورت كود ---------- */
.am-pwa-sc-btn {
	cursor: pointer;
	border: 0;
	background: var(--am-pwa-color, #111827);
	color: var(--am-pwa-btn-text, #ffffff);
	border-radius: 10px;
	padding: 10px 22px;
	font-size: 15px;
	font-weight: 700;
	font-family: inherit;
}

/* ---------- الوضع الداكن ---------- */
@media (prefers-color-scheme: dark) {
	.am-pwa-sheet,
	.am-pwa-mode-bar .am-pwa-bar {
		background: #1f2937;
		color: #f9fafb;
		border-color: rgba(255, 255, 255, 0.08);
	}
	.am-pwa-handle { background: #4b5563; }
	.am-pwa-x { background: #374151; color: #9ca3af; }
	.am-pwa-x:hover { background: #4b5563; color: #e5e7eb; }
	.am-pwa-s-sub, .am-pwa-b-sub { color: #9ca3af; }
	.am-pwa-chip {
		background: #374151;
		background: color-mix(in srgb, var(--am-pwa-color, #111827) 26%, #1f2937);
		color: #e5e7eb;
		border-color: rgba(255, 255, 255, 0.06);
	}
	.am-pwa-step { color: #d1d5db; border-bottom-color: #374151; }
	.am-pwa-step-n { background: #374151; color: #f9fafb; }
	.am-pwa-later { color: #9ca3af; }
	.am-pwa-later:hover { color: #e5e7eb; }
	.am-pwa-s-icon-fb { background: #374151; }
	.am-pwa-toast { background: #f9fafb; color: #111827; }
}

/* ---------- شاشات صغيرة جداً ---------- */
@media (max-width: 360px) {
	.am-pwa-sheet { padding-inline: 16px; }
	.am-pwa-s-icon { width: 62px; height: 62px; }
	.am-pwa-cta { padding: 13px 16px; font-size: 15px; }
}

/* ---------- تقليل الحركة ---------- */
@media (prefers-reduced-motion: reduce) {
	.am-pwa-sheet,
	.am-pwa-mode-bar .am-pwa-bar,
	.am-pwa-backdrop,
	.am-pwa-toast {
		transition: opacity 0.2s ease;
		transform: none;
	}
	.am-pwa-s-icon { animation: none; }
	.am-pwa-cta::after { animation: none; display: none; }
	.am-pwa-chip, .am-pwa-step { animation: none; opacity: 1; transform: none; }
}
