/* ================================================================
   RAJ CONTACT DOCK v3
   Inspired by the existing raftingparsi.ir contact dock behavior.
   No framework / no dependency.
   ================================================================ */

.raj-dock {
	--raj-dock-bg: rgba(6, 22, 31, .95);
	--raj-dock-surface: rgba(14, 55, 68, .35);
	--raj-dock-surface-hover: rgba(20, 78, 94, .45);
	--raj-dock-line: rgba(103, 157, 171, .18);

	--raj-dock-text: #EEF4F6;
	--raj-dock-muted: #89A5AF;

	--raj-dock-accent: #28758A;
	--raj-dock-accent-soft: rgba(40, 117, 138, .20);

	position: fixed;
	z-index: 9999;
	inset-inline: 10px;
	bottom: calc(10px + env(safe-area-inset-bottom));
	display: flex;
	justify-content: center;
	pointer-events: none;
	direction: rtl;
	font-family: inherit;
}

.raj-dock *,
.raj-dock *::before,
.raj-dock *::after {
	box-sizing: border-box;
}

.raj-dock__rail {
	position: relative;
	pointer-events: auto;
	display: flex;
	flex-direction: row;
	align-items: center;
	gap: .2rem;
	width: 100%;
	max-width: 430px;
	padding: .32rem;
	border: 1px solid var(--raj-dock-line);
	border-radius: 16px;
	background: var(--raj-dock-bg);
	-webkit-backdrop-filter: blur(16px) saturate(125%);
	backdrop-filter: blur(16px) saturate(125%);
	box-shadow: 0 18px 42px -28px rgba(0, 0, 0, .85);
}

.raj-dock__handle {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	flex: none;
	padding: 0;
	border: 1px solid var(--raj-dock-line);
	border-radius: 50%;
	color: var(--raj-dock-accent);
	background: var(--raj-dock-surface);
	cursor: pointer;
	transition: background-color 220ms ease, transform 260ms ease;
}

.raj-dock__handle:hover {
	background: var(--raj-dock-accent-soft);
}

.raj-dock__handle svg {
	width: 17px;
	height: 17px;
	transition: transform 260ms ease;
}

.raj-dock__handle[aria-expanded="false"] svg {
	transform: rotate(180deg);
}

.raj-dock__list {
	display: flex;
	flex: 1;
	align-items: stretch;
	gap: .18rem;
	margin: 0;
	padding: 0;
	list-style: none;
}

.raj-dock__item {
	flex: 1;
	display: flex;
}

.raj-dock__btn {
	position: relative;
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: .08rem;
	min-width: 42px;
	min-height: 44px;
	padding: .25rem .2rem;
	border: 0;
	border-radius: 12px;
	color: var(--raj-dock-text);
	background: transparent;
	text-decoration: none;
	cursor: pointer;
	transition:
		background-color 200ms ease,
		transform 200ms ease,
		color 200ms ease;
}

.raj-dock__btn:hover {
	background: var(--raj-dock-surface-hover);
}

.raj-dock__btn:active {
	transform: scale(.96);
}

.raj-dock__ico {
	display: inline-flex;
	line-height: 0;
}

.raj-dock__ico svg {
	width: 19px;
	height: 19px;
}

.raj-dock__btn--call .raj-dock__ico {
	color: var(--raj-dock-accent);
}

.raj-dock__btn--tg .raj-dock__ico {
	color: #78B9D4;
}

.raj-dock__btn--ig .raj-dock__ico {
	color: #D8B6A0;
}

.raj-dock__text {
	display: flex;
	flex-direction: column;
	align-items: center;
	line-height: 1.25;
}

.raj-dock__label {
	font-size: .62rem;
	font-weight: 600;
	white-space: nowrap;
}

.raj-dock__meta {
	font-size: .57rem;
	color: var(--raj-dock-muted);
	max-height: 0;
	opacity: 0;
	overflow: hidden;
	white-space: nowrap;
	transition: max-height 280ms ease, opacity 180ms ease;
}

.raj-dock.is-open .raj-dock__meta {
	max-height: 1.4rem;
	opacity: 1;
}

/* ---------------- DESKTOP ---------------- */

@media (min-width: 900px) {
	.raj-dock {
		inset-inline: auto;
		right: clamp(10px, 1.35vw, 20px);
		top: 50%;
		bottom: auto;
		transform: translateY(-50%);
		justify-content: flex-start;
		max-width: none;
		transition: transform 280ms cubic-bezier(.22, .61, .36, 1);
	}

	.raj-dock__rail {
		flex-direction: column;
		width: auto;
		max-width: none;
		padding: .32rem;
		border-radius: 20px;
		gap: .22rem;
	}

	.raj-dock__handle {
		width: 40px;
		height: 40px;
	}

	.raj-dock__list {
		flex-direction: column;
		flex: none;
		gap: .15rem;
	}

	.raj-dock__item {
		flex: none;
	}

	.raj-dock__btn {
		flex-direction: row;
		justify-content: center;
		width: 46px;
		min-width: 46px;
		height: 46px;
		min-height: 46px;
		padding: 0;
		border-radius: 14px;
	}

	.raj-dock__ico svg {
		width: 19px;
		height: 19px;
	}

	/* Exactly like the reference: labels live outside the rail and
     reveal on hover/focus/open. */
	.raj-dock__text {
		position: absolute;
		right: calc(100% + .48rem);
		top: 50%;
		align-items: flex-end;
		transform: translate(8px, -50%) scale(.97);
		opacity: 0;
		pointer-events: none;
		padding: .38rem .65rem;
		border: 1px solid var(--raj-dock-line);
		border-radius: 10px;
		background: rgba(20, 20, 19, .96);
		box-shadow: 0 14px 30px -24px rgba(0, 0, 0, .9);
		white-space: nowrap;
		transition: opacity 220ms ease, transform 260ms ease;
	}

	.raj-dock__label {
		font-size: .69rem;
	}

	.raj-dock__meta {
		max-height: 0;
	}

	.raj-dock:hover .raj-dock__text,
	.raj-dock:focus-within .raj-dock__text,
	.raj-dock.is-open .raj-dock__text {
		opacity: 1;
		transform: translate(0, -50%) scale(1);
	}

	.raj-dock.is-open .raj-dock__meta {
		max-height: 1.4rem;
	}

	/* Same anti-overlap behavior as the reference implementation. */
	.raj-dock.is-tucked {
		transform: translate(78%, -50%);
	}

	.raj-dock.is-tucked:hover,
	.raj-dock.is-tucked:focus-within,
	.raj-dock.is-tucked.is-open {
		transform: translate(0, -50%);
	}
}

/* Small mobile: keep it genuinely small. */
@media (max-width: 389px) {
	.raj-dock {
		inset-inline: 7px;
		bottom: calc(7px + env(safe-area-inset-bottom));
	}

	.raj-dock__rail {
		padding: .25rem;
		border-radius: 14px;
	}

	.raj-dock__handle {
		width: 37px;
		height: 37px;
	}

	.raj-dock__btn {
		min-height: 41px;
		min-width: 40px;
		padding-inline: .1rem;
	}

	.raj-dock__ico svg {
		width: 18px;
		height: 18px;
	}

	.raj-dock__label {
		font-size: .58rem;
	}
}

@media (prefers-reduced-motion: reduce) {

	.raj-dock *,
	.raj-dock *::before,
	.raj-dock *::after {
		transition-duration: .001ms !important;
	}
}