@property --am-angle {
	syntax: '<angle>';
	inherits: false;
	initial-value: 0deg;
}

.amir-guard-widget {
	--amir-accent: #00FF96;
	--tiltX: 0deg;
	--tiltY: 0deg;
	font-family: 'Vazirmatn', 'IRANYekan', sans-serif;
	direction: rtl;
	max-width: 460px;
	margin: 28px auto;
}

.amir-guard-scene { perspective: 900px; }

/* ---------- Card shell ---------- */
.amir-guard-card {
	position: relative;
	border-radius: 22px;
	padding: 2px;
	isolation: isolate;
	transform-style: preserve-3d;
	transform: rotateX(var(--tiltY)) rotateY(var(--tiltX));
	transition: transform .5s cubic-bezier(.22,1,.36,1);
}

.amir-guard-border-spin {
	position: absolute;
	inset: 0;
	border-radius: 22px;
	padding: 1px;
	background: conic-gradient(
		from var(--am-angle),
		#00FF96 0deg, #00D4FF 60deg, #8A6BFF 120deg,
		#FF5FA2 180deg, #FFB020 240deg, #00FF96 300deg, #00FF96 360deg
	);
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	animation: amir-guard-rotate 5.5s linear infinite;
	opacity: .65;
	transition: opacity .25s ease;
	pointer-events: none;
	z-index: 1;
}

.amir-guard-card:hover .amir-guard-border-spin,
.amir-guard-widget.is-uploading .amir-guard-border-spin,
.amir-guard-widget.is-scanning .amir-guard-border-spin,
.amir-guard-widget.is-checking .amir-guard-border-spin {
	opacity: 1;
	animation-duration: 1.6s;
}

@keyframes amir-guard-rotate { to { --am-angle: 360deg; } }

.amir-guard-inner {
	position: relative;
	z-index: 2;
	border-radius: 21px;
	background:
		radial-gradient(120% 140% at 50% -10%, rgba(0, 255, 150, 0.06), transparent 55%),
		linear-gradient(160deg, rgba(255,255,255,0.045), rgba(255,255,255,0.012));
	border: 1px solid rgba(255, 255, 255, 0.06);
	backdrop-filter: blur(18px) saturate(140%);
	-webkit-backdrop-filter: blur(18px) saturate(140%);
	color: #eafff5;
	overflow: hidden;
	padding: 22px 22px 18px;
}

.amir-guard-widget.is-blocked .amir-guard-inner,
.amir-guard-widget.is-malicious .amir-guard-inner,
.amir-guard-widget.is-error .amir-guard-inner {
	animation: amir-guard-shake .45s ease;
}

@keyframes amir-guard-shake {
	10%, 90% { transform: translateX(-1px); }
	20%, 80% { transform: translateX(2px); }
	30%, 50%, 70% { transform: translateX(-4px); }
	40%, 60% { transform: translateX(4px); }
}

/* ============ LIVE RADAR STAGE (always animating) ============ */
.amir-guard-radar-stage {
	position: relative;
	width: 100%;
	aspect-ratio: 1.9 / 1;
	border-radius: 16px;
	background: radial-gradient(circle at 50% 50%, rgba(0,255,150,.05), #060707 72%);
	border: 1px solid rgba(0,255,150,.15);
	overflow: hidden;
	margin-bottom: 16px;
}

.amir-guard-radar-rings {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
}
.amir-guard-radar-rings circle {
	fill: none;
	stroke: rgba(0,255,150,.28);
	stroke-width: .6;
}
.amir-guard-radar-rings line {
	stroke: rgba(0,255,150,.16);
	stroke-width: .5;
}

.amir-guard-radar-grid {
	position: absolute;
	inset: 0;
	background-image:
		linear-gradient(rgba(0,255,150,.09) 1px, transparent 1px),
		linear-gradient(90deg, rgba(0,255,150,.09) 1px, transparent 1px);
	background-size: 16px 16px;
	-webkit-mask-image: radial-gradient(circle at 50% 50%, #fff 0%, transparent 75%);
	mask-image: radial-gradient(circle at 50% 50%, #fff 0%, transparent 75%);
}

.amir-guard-radar-sweep {
	position: absolute;
	inset: 0;
	background: conic-gradient(
		from 0deg,
		transparent 0deg,
		rgba(0,255,150,.55) 8deg,
		rgba(0,255,150,.18) 20deg,
		transparent 50deg,
		transparent 360deg
	);
	transform-origin: 50% 50%;
	animation: amir-guard-radar-spin 4s linear infinite;
	mix-blend-mode: screen;
}

.amir-guard-widget.is-uploading .amir-guard-radar-sweep,
.amir-guard-widget.is-scanning .amir-guard-radar-sweep,
.amir-guard-widget.is-checking .amir-guard-radar-sweep {
	animation-duration: 1.1s;
}

@keyframes amir-guard-radar-spin { to { transform: rotate(360deg); } }

.amir-guard-radar-core {
	position: absolute;
	top: 50%; left: 50%;
	transform: translate(-50%, -50%);
	width: 30px; height: 30px;
	display: grid; place-items: center;
	color: var(--amir-accent);
	background: rgba(0,0,0,.35);
	border-radius: 50%;
	border: 1px solid rgba(0,255,150,.35);
	box-shadow: 0 0 14px rgba(0,255,150,.35);
	z-index: 2;
}
.amir-guard-radar-core svg { width: 15px; height: 15px; }

.amir-guard-radar-blip {
	position: absolute;
	width: 5px; height: 5px;
	border-radius: 50%;
	background: var(--amir-accent);
	box-shadow: 0 0 8px 2px rgba(0,255,150,.7);
	opacity: 0;
	animation: amir-guard-blip-pulse 3s ease-in-out infinite;
}
.amir-guard-radar-blip-1 { top: 30%; left: 66%; animation-delay: .4s; }
.amir-guard-radar-blip-2 { top: 68%; left: 32%; animation-delay: 1.8s; }

@keyframes amir-guard-blip-pulse {
	0%, 100% { opacity: 0; transform: scale(.6); }
	15%, 35% { opacity: 1; transform: scale(1); }
}

/* ============ FILE BUTTON (full width, progress fill inside) ============ */
.amir-guard-file-btn {
	position: relative;
	width: 100%;
	height: 52px;
	border-radius: 14px;
	border: 1px solid rgba(0,255,150,.3);
	background: rgba(255,255,255,0.03);
	color: #eafff5;
	font-family: inherit;
	font-size: 14.5px;
	font-weight: 600;
	cursor: pointer;
	overflow: hidden;
	margin-bottom: 12px;
	transition: border-color .2s ease, background .2s ease;
}
.amir-guard-file-btn:hover { border-color: rgba(0,255,150,.55); background: rgba(0,255,150,.04); }

.amir-guard-file-btn-fill {
	position: absolute;
	inset: 0;
	width: 0%;
	background: linear-gradient(90deg, rgba(0,255,150,.28), rgba(0,255,150,.14));
	transition: width .15s linear;
	z-index: 1;
}

.amir-guard-file-btn-label {
	position: relative;
	z-index: 2;
}

.amir-guard-widget.is-scanning .amir-guard-file-btn-label {
	animation: amir-guard-pulse-text 1.1s ease-in-out infinite;
}

@keyframes amir-guard-pulse-text {
	0%, 100% { opacity: 1; }
	50% { opacity: .45; }
}

.amir-guard-widget.is-safe .amir-guard-file-btn { border-color: rgba(0,255,150,.55); }
.amir-guard-widget.is-blocked .amir-guard-file-btn { border-color: rgba(255,90,90,.5); }

/* ============ LINK BAR (same box language as file button) ============ */
.amir-guard-link-bar {
	display: flex;
	align-items: center;
	gap: 8px;
	height: 52px;
	border-radius: 14px;
	border: 1px solid rgba(255,255,255,.12);
	background: rgba(255,255,255,0.03);
	padding: 0 6px 0 6px;
	margin-bottom: 16px;
	direction: ltr;
	transition: border-color .2s ease;
}
.amir-guard-link-bar:focus-within { border-color: rgba(0,255,150,.4); }

.amir-guard-link-input-full {
	flex: 1;
	min-width: 0;
	height: 100%;
	background: transparent;
	border: none;
	color: #eafff5;
	font-size: 13px;
	font-family: inherit;
	direction: ltr;
	text-align: left;
	padding: 0 10px;
}
.amir-guard-link-input-full:focus { outline: none; }
.amir-guard-link-input-full::placeholder { color: rgba(255,255,255,.32); }

.amir-guard-link-go {
	flex-shrink: 0;
	width: 38px; height: 38px;
	border-radius: 10px;
	border: 1px solid rgba(0,255,150,.35);
	background: rgba(0,255,150,.08);
	color: var(--amir-accent);
	display: grid; place-items: center;
	cursor: pointer;
	transition: background .2s ease, transform .15s ease;
}
.amir-guard-link-go:hover { background: rgba(0,255,150,.16); }
.amir-guard-link-go:active { transform: scale(.94); }
.amir-guard-link-go svg { width: 17px; height: 17px; }
.amir-guard-link-go:disabled { opacity: .5; cursor: default; }

/* ============ AI CHAT BOX ============ */
.amir-guard-chat {
	border-radius: 14px;
	border: 1px solid rgba(255,255,255,.1);
	background: rgba(255,255,255,0.025);
	overflow: hidden;
}

.amir-guard-chat-header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 12px 14px;
	border-bottom: 1px solid rgba(255,255,255,.08);
}
.amir-guard-chat-avatar {
	width: 32px; height: 32px;
	border-radius: 50%;
	background: rgba(0,255,150,.1);
	color: var(--amir-accent);
	display: grid; place-items: center;
	flex-shrink: 0;
}
.amir-guard-chat-avatar svg { width: 17px; height: 17px; }
.amir-guard-chat-avatar img { width: 100%; height: 100%; object-fit: cover; border-radius: 50%; }
.amir-guard-chat-title { font-size: 12.5px; font-weight: 600; color: #eafff5; }
.amir-guard-chat-sub { font-size: 10.5px; color: rgba(234,255,245,.4); margin-top: 1px; }

.amir-guard-chat-messages {
	max-height: 130px;
	overflow-y: auto;
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	gap: 8px;
}
.amir-guard-chat-msg {
	max-width: 88%;
	padding: 8px 12px;
	border-radius: 12px;
	font-size: 12.5px;
	line-height: 1.7;
}
.amir-guard-chat-msg-bot {
	align-self: flex-start;
	background: rgba(255,255,255,.05);
	border: 1px solid rgba(255,255,255,.07);
	color: rgba(234,255,245,.85);
}
.amir-guard-chat-msg-user {
	align-self: flex-end;
	background: rgba(0,255,150,.1);
	border: 1px solid rgba(0,255,150,.25);
	color: #eafff5;
}
.amir-guard-chat-msg-thinking {
	animation: amir-guard-pulse-text 1.1s ease-in-out infinite;
}

.amir-guard-chat-input-row {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 10px 12px;
	border-top: 1px solid rgba(255,255,255,.08);
}

/* ---------- Chat input glow: same 6-color rotating border, active on focus ---------- */
.amir-guard-chat-input-wrap {
	position: relative;
	border-radius: 13px;
	padding: 1px;
}

.amir-guard-input-border-spin {
	position: absolute;
	inset: 0;
	border-radius: 13px;
	padding: 1.5px;
	background: conic-gradient(
		from var(--am-angle),
		#00FF96 0deg, #00D4FF 60deg, #8A6BFF 120deg,
		#FF5FA2 180deg, #FFB020 240deg, #00FF96 300deg, #00FF96 360deg
	);
	-webkit-mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	mask: linear-gradient(#fff 0 0) content-box, linear-gradient(#fff 0 0);
	-webkit-mask-composite: xor;
	mask-composite: exclude;
	animation: amir-guard-rotate 2s linear infinite;
	opacity: 0;
	transition: opacity .2s ease;
	pointer-events: none;
	z-index: 1;
}

.amir-guard-chat-input-wrap:focus-within .amir-guard-input-border-spin {
	opacity: 1;
}

.amir-guard-chat-input-wrap .amir-guard-chat-input-row {
	position: relative;
	z-index: 2;
	border-top: none;
	background: rgba(0,0,0,.15);
	border-radius: 12px;
}
.amir-guard-chat-input {
	flex: 1;
	min-width: 0;
	background: rgba(255,255,255,.04);
	border: 1px solid rgba(255,255,255,.09);
	border-radius: 10px;
	padding: 8px 12px;
	color: #eafff5;
	font-size: 12.5px;
	font-family: inherit;
}
.amir-guard-chat-input:focus { outline: none; border-color: rgba(0,255,150,.35); }
.amir-guard-chat-input::placeholder { color: rgba(255,255,255,.3); }

.amir-guard-chat-send {
	flex-shrink: 0;
	width: 34px; height: 34px;
	border-radius: 9px;
	border: 1px solid rgba(0,255,150,.3);
	background: rgba(0,255,150,.08);
	color: var(--amir-accent);
	display: grid; place-items: center;
	cursor: pointer;
	transition: background .2s ease;
}
.amir-guard-chat-send:hover { background: rgba(0,255,150,.16); }
.amir-guard-chat-send svg { width: 15px; height: 15px; }

/* ============ Particle burst (kept for success feedback) ============ */
.amir-guard-particles { position: absolute; inset: 0; z-index: 3; pointer-events: none; overflow: visible; }
.amir-guard-particle {
	position: absolute; top: 20%; left: 50%;
	width: 5px; height: 5px; border-radius: 50%;
	background: var(--amir-accent);
	opacity: 0;
	box-shadow: 0 0 6px rgba(0,255,150,.8);
}
.amir-guard-widget.is-safe .amir-guard-particle,
.amir-guard-widget.is-link-safe .amir-guard-particle {
	animation: amir-guard-burst .8s cubic-bezier(.2,.8,.3,1) forwards;
}
.amir-guard-particle:nth-child(1)  { --dx: 60px;  --dy: -30px; animation-delay: .02s; }
.amir-guard-particle:nth-child(2)  { --dx: -55px; --dy: -40px; animation-delay: .05s; }
.amir-guard-particle:nth-child(3)  { --dx: 40px;  --dy: 45px;  animation-delay: .01s; }
.amir-guard-particle:nth-child(4)  { --dx: -45px; --dy: 40px;  animation-delay: .07s; }
.amir-guard-particle:nth-child(5)  { --dx: 75px;  --dy: 5px;   animation-delay: .04s; }
.amir-guard-particle:nth-child(6)  { --dx: -75px; --dy: 0px;   animation-delay: .06s; }
.amir-guard-particle:nth-child(7)  { --dx: 20px;  --dy: -60px; animation-delay: .03s; }
.amir-guard-particle:nth-child(8)  { --dx: -20px; --dy: -55px; animation-delay: .08s; }
.amir-guard-particle:nth-child(9)  { --dx: 55px;  --dy: 55px;  animation-delay: .02s; }
.amir-guard-particle:nth-child(10) { --dx: -60px; --dy: 50px;  animation-delay: .05s; }
.amir-guard-particle:nth-child(11) { --dx: 10px;  --dy: 70px;  animation-delay: .06s; }
.amir-guard-particle:nth-child(12) { --dx: -10px; --dy: -70px; animation-delay: .03s; }
.amir-guard-particle:nth-child(13) { --dx: 85px;  --dy: -15px; animation-delay: .07s; }
.amir-guard-particle:nth-child(14) { --dx: -85px; --dy: -10px; animation-delay: .04s; }

@keyframes amir-guard-burst {
	0%   { opacity: 1; transform: translate(-50%, -50%) scale(1); }
	100% { opacity: 0; transform: translate(calc(-50% + var(--dx)), calc(-50% + var(--dy))) scale(0); }
}

/* ============ Shared status panel ============ */
.amir-guard-status {
	margin-top: 14px;
	border-radius: 14px;
	font-size: 13.5px;
	line-height: 1.9;
	color: #d5ffe9;
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	transform: translateY(-4px) scale(.98);
	transition: max-height .3s ease, opacity .25s ease, transform .3s cubic-bezier(.22,1,.36,1);
}
.amir-guard-status:not(:empty) { max-height: 240px; opacity: 1; transform: translateY(0) scale(1); }

.amir-guard-status.is-scanning, .amir-guard-status.is-checking,
.amir-guard-status.is-safe, .amir-guard-status.is-link-safe,
.amir-guard-status.is-blocked, .amir-guard-status.is-suspicious,
.amir-guard-status.is-malicious, .amir-guard-status.is-error {
	padding: 13px 18px;
	backdrop-filter: blur(12px);
	-webkit-backdrop-filter: blur(12px);
	border-radius: 14px;
	font-weight: 500;
}
.amir-guard-status.is-scanning, .amir-guard-status.is-checking {
	background: rgba(255,255,255,0.04);
	border: 1px solid rgba(255,255,255,0.09);
	color: rgba(234,255,245,0.8);
}
.amir-guard-status.is-safe, .amir-guard-status.is-link-safe {
	background: linear-gradient(135deg, rgba(0,255,150,0.10), rgba(0,255,150,0.03));
	border: 1px solid rgba(0, 255, 150, 0.32);
	box-shadow: 0 8px 28px -12px rgba(0, 255, 150, 0.35);
}
.amir-guard-status.is-suspicious {
	background: linear-gradient(135deg, rgba(255,176,32,0.12), rgba(255,176,32,0.03));
	border: 1px solid rgba(255, 176, 32, 0.4);
	color: #ffe3ad;
}
.amir-guard-status.is-blocked, .amir-guard-status.is-malicious, .amir-guard-status.is-error {
	background: linear-gradient(135deg, rgba(255,70,70,0.10), rgba(255,70,70,0.03));
	border: 1px solid rgba(255, 70, 70, 0.35);
	color: #ffd9d9;
	box-shadow: 0 8px 28px -12px rgba(255, 70, 70, 0.3);
}
.amir-guard-meta { font-size: 11.5px; opacity: .65; margin-top: 4px; font-weight: 400; }

/* ============ Badge ============ */
.amir-guard-badge {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 6px;
	margin-top: 22px;
	text-align: center;
}
.amir-guard-badge-main {
	display: flex; align-items: center; justify-content: center; gap: 8px;
	font-size: 13px; font-weight: 600; letter-spacing: .4px;
	opacity: .8; color: #eafff5; text-transform: uppercase;
}
.amir-guard-badge-main svg { width: 16px; height: 16px; color: var(--amir-accent); filter: drop-shadow(0 0 4px rgba(0,255,150,.5)); }
.amir-guard-badge-credit { font-size: 11px; opacity: .45; color: #eafff5; direction: ltr; }
.amir-guard-badge-credit strong { color: var(--amir-accent); font-weight: 600; opacity: .9; }

@media (prefers-reduced-motion: reduce) {
	.amir-guard-card, .amir-guard-border-spin, .amir-guard-radar-sweep,
	.amir-guard-status, .amir-guard-particle, .amir-guard-file-btn-label,
	.amir-guard-radar-blip {
		animation: none !important;
		transition: none !important;
	}
	.amir-guard-card { transform: none !important; }
}

/* ============ Fullscreen display mode (front-end, for site visitors) ============ */
.amir-guard-widget--fullscreen {
	position: fixed;
	inset: 0;
	z-index: 99999;
	max-width: none;
	margin: 0;
	background: #060707;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 0;
	overflow-y: auto;
	padding: 24px;
}
.amir-guard-widget--fullscreen .amir-guard-scene {
	width: 100%;
	max-width: 460px;
}
body:has(.amir-guard-widget--fullscreen) {
	overflow: hidden;
}
