/**
 * NS Floating Contact Button - Frontend Styles
 *
 * طراحی و توسعه توسط امیر پذیرا - https://amirpazira.ir
 * همه کلاس‌ها با پیشوند ns- و سازگار با RTL و LTR
 */

#ns-fc-root {
	position: fixed;
	z-index: var(--ns-fc-z, 999999999);
	font-family: inherit;
	pointer-events: none;
	direction: rtl;
	box-sizing: border-box;
}

[dir="ltr"] #ns-fc-root {
	direction: ltr;
}

#ns-fc-root * {
	box-sizing: border-box;
}

/* Light Theme Variables */
#ns-fc-root.ns-fc-theme-light {
	--ns-fc-bg: #ffffff;
	--ns-fc-text: #16181d;
	--ns-fc-muted: #6b7280;
	--ns-fc-border: rgba(15, 23, 42, 0.08);
	--ns-fc-item-hover: rgba(13, 148, 136, 0.08);
}

/* Dark Theme Variables */
#ns-fc-root.ns-fc-theme-dark {
	--ns-fc-bg: #1b1d24;
	--ns-fc-text: #f4f5f7;
	--ns-fc-muted: #9aa0ac;
	--ns-fc-border: rgba(255, 255, 255, 0.08);
	--ns-fc-item-hover: rgba(255, 255, 255, 0.06);
}

/* Auto Theme Variables (System Preference) */
@media (prefers-color-scheme: dark) {
	#ns-fc-root.ns-fc-theme-auto {
		--ns-fc-bg: #1b1d24;
		--ns-fc-text: #f4f5f7;
		--ns-fc-muted: #9aa0ac;
		--ns-fc-border: rgba(255, 255, 255, 0.08);
		--ns-fc-item-hover: rgba(255, 255, 255, 0.06);
	}
}

@media (prefers-color-scheme: light) {
	#ns-fc-root.ns-fc-theme-auto {
		--ns-fc-bg: #ffffff;
		--ns-fc-text: #16181d;
		--ns-fc-muted: #6b7280;
		--ns-fc-border: rgba(15, 23, 42, 0.08);
		--ns-fc-item-hover: rgba(13, 148, 136, 0.08);
	}
}

/* Backdrop Overlay */
#ns-fc-overlay {
	position: fixed;
	inset: 0;
	background: rgba(10, 12, 20, 0.42);
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.3s ease, visibility 0.3s ease;
	z-index: calc(var(--ns-fc-z, 999999999) - 1);
	pointer-events: none;
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
}

#ns-fc-root.ns-fc-open + #ns-fc-overlay {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

/* Popup Panel */
#ns-fc-panel {
	position: absolute;
	bottom: calc(var(--ns-fc-launcher-size, 60px) + 16px);
	width: min(340px, calc(100vw - 32px));
	max-height: min(480px, 70vh);
	background: var(--ns-fc-bg, #ffffff);
	color: var(--ns-fc-text, #16181d);
	border-radius: 20px;
	box-shadow: 0 18px 46px rgba(15, 23, 42, 0.22), 0 2px 8px rgba(15, 23, 42, 0.08);
	display: flex;
	flex-direction: column;
	overflow: hidden;
	opacity: 0;
	visibility: hidden;
	transform: translateY(16px) scale(0.96);
	transition: opacity 0.28s cubic-bezier(0.34, 1.2, 0.64, 1), transform 0.32s cubic-bezier(0.34, 1.2, 0.64, 1), visibility 0.32s;
	pointer-events: none;
}

#ns-fc-root.ns-fc-open #ns-fc-panel {
	opacity: 1;
	visibility: visible;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

/* Panel Header */
.ns-fc-panel-head {
	padding: 18px 20px 16px;
	background: linear-gradient(135deg, var(--ns-fc-c1, #0D9488), var(--ns-fc-c2, #0EA5A4));
	color: #ffffff;
	flex-shrink: 0;
	position: relative;
}

.ns-fc-panel-title {
	font-size: 16px;
	font-weight: 800;
	margin: 0 0 4px;
	line-height: 1.4;
	color: var(--ns-fc-title-color, #ffffff);
}

.ns-fc-panel-subtitle {
	font-size: 12.5px;
	opacity: 0.95;
	margin: 0;
	line-height: 1.6;
	color: var(--ns-fc-subtitle-color, #ffffff);
}

/* Close Button strictly styled with high specificity */
#ns-fc-root #ns-fc-close-btn,
#ns-fc-root button#ns-fc-close-btn,
#ns-fc-root button.ns-fc-panel-close,
#ns-fc-panel button.ns-fc-panel-close {
	all: unset !important;
	position: absolute !important;
	inset-inline-end: 14px !important;
	top: 14px !important;
	width: 32px !important;
	height: 32px !important;
	min-width: 32px !important;
	max-width: 32px !important;
	min-height: 32px !important;
	max-height: 32px !important;
	border-radius: 50% !important;
	background: rgba(255, 255, 255, 0.22) !important;
	border: 1px solid rgba(255, 255, 255, 0.45) !important;
	color: #ffffff !important;
	cursor: pointer !important;
	display: flex !important;
	align-items: center !important;
	justify-content: center !important;
	padding: 0 !important;
	margin: 0 !important;
	line-height: 1 !important;
	outline: none !important;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.12) !important;
	backdrop-filter: blur(4px) !important;
	-webkit-backdrop-filter: blur(4px) !important;
	transition: transform 0.25s cubic-bezier(0.34, 1.56, 0.64, 1), background 0.2s ease, border-color 0.2s ease !important;
	box-sizing: border-box !important;
	-webkit-appearance: none !important;
	appearance: none !important;
	z-index: 10 !important;
}

#ns-fc-root #ns-fc-close-btn:hover,
#ns-fc-root button#ns-fc-close-btn:hover,
#ns-fc-root button.ns-fc-panel-close:hover,
#ns-fc-panel button.ns-fc-panel-close:hover {
	background: rgba(255, 255, 255, 0.38) !important;
	border: 1px solid rgba(255, 255, 255, 0.75) !important;
	color: #ffffff !important;
	transform: rotate(90deg) scale(1.08) !important;
}

#ns-fc-root #ns-fc-close-btn:focus,
#ns-fc-root button#ns-fc-close-btn:focus,
#ns-fc-root button.ns-fc-panel-close:focus {
	background: rgba(255, 255, 255, 0.38) !important;
	border: 1px solid rgba(255, 255, 255, 0.75) !important;
	outline: none !important;
	box-shadow: 0 0 0 3px rgba(255, 255, 255, 0.35) !important;
}

#ns-fc-root #ns-fc-close-btn:active,
#ns-fc-root button#ns-fc-close-btn:active,
#ns-fc-root button.ns-fc-panel-close:active {
	transform: scale(0.92) !important;
	background: rgba(255, 255, 255, 0.48) !important;
}

#ns-fc-root #ns-fc-close-btn svg,
#ns-fc-root button#ns-fc-close-btn svg,
#ns-fc-root .ns-fc-panel-close svg,
#ns-fc-panel button.ns-fc-panel-close svg {
	width: 14px !important;
	height: 14px !important;
	display: block !important;
	stroke: #ffffff !important;
	fill: none !important;
	stroke-width: 2.5 !important;
	margin: 0 !important;
	padding: 0 !important;
}

/* Panel Body & Items */
.ns-fc-panel-body {
	overflow-y: auto;
	padding: 10px;
	flex: 1;
}

.ns-fc-panel-body::-webkit-scrollbar {
	width: 5px;
}

.ns-fc-panel-body::-webkit-scrollbar-thumb {
	background: var(--ns-fc-border, rgba(15, 23, 42, 0.08));
	border-radius: 10px;
}

/* Default Item (when icons are enabled) */
.ns-fc-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px;
	border-radius: 14px;
	text-decoration: none;
	color: var(--ns-fc-text, #16181d);
	transition: background 0.2s ease, transform 0.15s ease;
}

.ns-fc-item:hover {
	background: var(--ns-fc-item-hover, rgba(13, 148, 136, 0.08));
	transform: translateX(-2px);
}

[dir="ltr"] .ns-fc-item:hover {
	transform: translateX(2px);
}

.ns-fc-item-icon {
	flex-shrink: 0;
	width: 42px;
	height: 42px;
	border-radius: 12px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.14);
	overflow: hidden;
	position: relative;
}

.ns-fc-item-icon svg {
	width: 22px;
	height: 22px;
	fill: currentColor;
	display: block;
}

.ns-fc-custom-img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
	padding: 4px;
}

.ns-fc-svg-wrapper {
	width: 22px;
	height: 22px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.ns-fc-svg-wrapper svg {
	width: 100%;
	height: 100%;
}

.ns-fc-item-text {
	flex: 1;
	min-width: 0;
}

.ns-fc-item-label {
	font-size: 13.5px;
	font-weight: 700;
	display: block;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	color: inherit;
}

.ns-fc-item-desc {
	font-size: 11.5px;
	color: var(--ns-fc-muted, #6b7280);
	display: block;
	margin-top: 2px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.ns-fc-item-arrow {
	flex-shrink: 0;
	color: var(--ns-fc-muted, #6b7280);
	opacity: 0.6;
	transition: transform 0.2s ease, opacity 0.2s ease;
	display: flex;
	align-items: center;
}

.ns-fc-item-arrow svg {
	width: 16px;
	height: 16px;
}

.ns-fc-item:hover .ns-fc-item-arrow {
	opacity: 1;
	transform: translateX(-3px);
}

[dir="ltr"] .ns-fc-item:hover .ns-fc-item-arrow {
	transform: translateX(3px);
}

/* Minimal Card Style (when icons are disabled) */
.ns-fc-no-icons .ns-fc-item,
.ns-fc-item.ns-fc-item-minimal {
	border-radius: 14px;
	padding: 12px 14px;
	margin-bottom: 8px;
	border-width: 1px;
	border-style: solid;
	gap: 10px;
	box-shadow: 0 2px 8px rgba(0, 0, 0, 0.08);
	transition: filter 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.ns-fc-no-icons .ns-fc-item:last-child,
.ns-fc-item.ns-fc-item-minimal:last-child {
	margin-bottom: 0;
}

.ns-fc-no-icons .ns-fc-item:hover,
.ns-fc-item.ns-fc-item-minimal:hover {
	filter: brightness(1.08);
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.16);
	transform: translateX(-3px);
}

[dir="ltr"] .ns-fc-no-icons .ns-fc-item:hover,
[dir="ltr"] .ns-fc-item.ns-fc-item-minimal:hover {
	transform: translateX(3px);
}

.ns-fc-no-icons .ns-fc-item-arrow,
.ns-fc-item-minimal .ns-fc-item-arrow {
	margin-inline-start: auto;
	color: var(--ns-fc-arrow-color, inherit);
	opacity: 0.95;
}

.ns-fc-no-icons .ns-fc-item-label,
.ns-fc-item-minimal .ns-fc-item-label {
	font-size: 14px;
	font-weight: 700;
	color: inherit;
}

.ns-fc-no-icons .ns-fc-item-desc,
.ns-fc-item-minimal .ns-fc-item-desc {
	font-size: 12px;
	margin-top: 3px;
	color: var(--ns-fc-item-desc-color, rgba(255, 255, 255, 0.9));
}

/* Launcher Wrapper & Button */
#ns-fc-launcher-wrap {
	position: relative;
	display: flex;
	align-items: center;
	gap: 10px;
}

#ns-fc-launcher-text {
	background: var(--ns-fc-bg, #ffffff);
	color: var(--ns-fc-text, #16181d);
	font-size: 13px;
	font-weight: 700;
	padding: 9px 16px;
	border-radius: 12px;
	box-shadow: 0 8px 20px rgba(15, 23, 42, 0.14);
	white-space: nowrap;
	pointer-events: none;
	opacity: 0.97;
	border: 1px solid var(--ns-fc-border, rgba(15, 23, 42, 0.08));
}

#ns-fc-launcher,
button#ns-fc-launcher {
	width: var(--ns-fc-launcher-size, 60px);
	height: var(--ns-fc-launcher-size, 60px);
	border-radius: 50%;
	border: none !important;
	outline: none !important;
	cursor: pointer;
	background: linear-gradient(135deg, var(--ns-fc-c1, #0D9488), var(--ns-fc-c2, #0EA5A4)) !important;
	box-shadow: 0 12px 28px rgba(13, 148, 136, 0.35), 0 2px 8px rgba(0, 0, 0, 0.12);
	display: flex;
	align-items: center;
	justify-content: center;
	position: relative;
	flex-shrink: 0;
	transition: transform 0.3s cubic-bezier(0.34, 1.56, 0.64, 1), box-shadow 0.3s ease;
	pointer-events: auto;
	padding: 0;
	overflow: visible;
	box-sizing: border-box !important;
}

#ns-fc-launcher:hover {
	transform: scale(1.06);
	box-shadow: 0 16px 36px rgba(13, 148, 136, 0.45), 0 4px 12px rgba(0, 0, 0, 0.16);
}

#ns-fc-launcher:active {
	transform: scale(0.96);
}

.ns-fc-ic-open,
.ns-fc-ic-close {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #ffffff;
	transition: opacity 0.25s ease, transform 0.28s cubic-bezier(0.34, 1.2, 0.64, 1);
}

.ns-fc-ic-open svg,
.ns-fc-ic-close svg {
	width: 28px;
	height: 28px;
	fill: currentColor;
	stroke: currentColor;
}

.ns-fc-ic-close svg {
	stroke: #ffffff;
	fill: none;
	stroke-width: 2.5;
}

.ns-fc-ic-open img {
	width: 55%;
	height: 55%;
	object-fit: contain;
}

.ns-fc-ic-close {
	opacity: 0;
	transform: rotate(-90deg) scale(0.7);
}

#ns-fc-root.ns-fc-open .ns-fc-ic-open {
	opacity: 0;
	transform: rotate(90deg) scale(0.7);
}

#ns-fc-root.ns-fc-open .ns-fc-ic-close {
	opacity: 1;
	transform: rotate(0) scale(1);
}

/* Animated Pulse Effect */
.ns-fc-pulse {
	position: absolute;
	inset: -6px;
	border-radius: 50%;
	border: 2px solid var(--ns-fc-c1, #0D9488);
	opacity: 0;
	animation: nsFcPulseAnim 2.2s infinite cubic-bezier(0.24, 0, 0.38, 1);
	pointer-events: none;
}

@keyframes nsFcPulseAnim {
	0% {
		transform: scale(0.95);
		opacity: 0.8;
	}
	70% {
		transform: scale(1.35);
		opacity: 0;
	}
	100% {
		transform: scale(1.35);
		opacity: 0;
	}
}

#ns-fc-root.ns-fc-open .ns-fc-pulse {
	display: none;
}

/* Mobile Responsive Adjustments */
@media (max-width: 560px) {
	#ns-fc-panel {
		position: fixed !important;
		inset-inline-start: 0 !important;
		inset-inline-end: 0 !important;
		bottom: 0 !important;
		width: 100vw !important;
		max-width: 100vw !important;
		max-height: 80vh !important;
		border-radius: 24px 24px 0 0 !important;
		margin: 0 !important;
		transform: translateY(100%) !important;
		transform-origin: center bottom !important;
	}

	#ns-fc-root.ns-fc-open #ns-fc-panel {
		transform: translateY(0) !important;
	}

	#ns-fc-launcher-text {
		display: none !important;
	}
}
