/* ============================================================
   Float Connect – Floating Widget Styles
   Version: 1.0.0
   ============================================================ */

/* ── CSS Custom Properties ───────────────────────────────── */
:root {
	--fc-size:        52px;
	--fc-gap:         10px;
	--fc-edge:        20px;
	--fc-z:           99999;
	--fc-shadow:      0 4px 18px rgba(0, 0, 0, 0.22);
	--fc-toggle-bg:   #2c3e50;
	--fc-toggle-size: 56px;
	--fc-radius:      50%;
	--fc-transition:  0.32s cubic-bezier(0.34, 1.56, 0.64, 1);
	--fc-fade:        0.22s ease;
}

/* ── Widget Container ────────────────────────────────────── */
.fc-widget {
	position: fixed;
	top: 50%;
	transform: translateY(-50%);
	z-index: var(--fc-z);
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--fc-gap);
}

.fc-widget.fc-right {
	right: var(--fc-edge);
	left: auto;
}

.fc-widget.fc-left {
	left: var(--fc-edge);
	right: auto;
}

/* ── Channel Icons Container ─────────────────────────────── */
.fc-channels {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: var(--fc-gap);
	overflow: hidden;
}

/* ── Individual Icon (anchor & div) ─────────────────────── */
.fc-item {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	width: var(--fc-size);
	height: var(--fc-size);
	border-radius: var(--fc-radius);
	background-color: var(--fc-color, #333);
	box-shadow: var(--fc-shadow);
	cursor: pointer;
	text-decoration: none;
	border: none;
	outline: none;
	flex-shrink: 0;
	transition:
		transform var(--fc-transition),
		box-shadow var(--fc-transition),
		opacity var(--fc-fade);
}

.fc-item svg {
	width: 26px;
	height: 26px;
	pointer-events: none;
	flex-shrink: 0;
}

.fc-item:hover,
.fc-item:focus-visible {
	transform: scale(1.15);
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.28);
}

.fc-item:active {
	transform: scale(0.96);
}

/* ── Tooltips ────────────────────────────────────────────── */
.fc-tooltip {
	position: absolute;
	top: 50%;
	transform: translateY(-50%) translateX(0);
	background: rgba(30, 30, 30, 0.92);
	color: #fff;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 12px;
	font-weight: 500;
	white-space: nowrap;
	padding: 5px 11px;
	border-radius: 6px;
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.18s ease, transform 0.18s ease;
	box-shadow: 0 2px 8px rgba(0,0,0,.22);
	letter-spacing: .3px;
}

/* Tooltip arrow */
.fc-tooltip::after {
	content: "";
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	border: 5px solid transparent;
}

/* Right-side widget → tooltip on the left */
.fc-widget.fc-right .fc-tooltip {
	right: calc(var(--fc-size) + 10px);
	left: auto;
}

.fc-widget.fc-right .fc-tooltip::after {
	right: -10px;
	left: auto;
	border-left-color: rgba(30, 30, 30, 0.92);
}

/* Left-side widget → tooltip on the right */
.fc-widget.fc-left .fc-tooltip {
	left: calc(var(--fc-size) + 10px);
	right: auto;
}

.fc-widget.fc-left .fc-tooltip::after {
	left: -10px;
	right: auto;
	border-right-color: rgba(30, 30, 30, 0.92);
}

.fc-item:hover .fc-tooltip,
.fc-item:focus-visible .fc-tooltip {
	opacity: 1;
}

/* ── WeChat popup ────────────────────────────────────────── */
.fc-popup-bubble {
	position: absolute;
	top: 50%;
	transform: translateY(-50%) scale(0.9);
	background: #fff;
	border: 1px solid #e0e0e0;
	border-radius: 12px;
	padding: 10px 16px;
	white-space: nowrap;
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
	font-size: 13px;
	font-weight: 600;
	color: #1d2327;
	box-shadow: 0 6px 24px rgba(0,0,0,.14);
	pointer-events: none;
	opacity: 0;
	transition: opacity 0.22s ease, transform 0.22s ease;
	z-index: 1;
}

.fc-popup-bubble.fc-popup-visible {
	opacity: 1;
	transform: translateY(-50%) scale(1);
}

.fc-widget.fc-right .fc-popup-bubble {
	right: calc(var(--fc-size) + 12px);
	left: auto;
}

.fc-widget.fc-left .fc-popup-bubble {
	left: calc(var(--fc-size) + 12px);
	right: auto;
}

/* ── Toggle Button ───────────────────────────────────────── */
.fc-toggle {
	width: var(--fc-toggle-size);
	height: var(--fc-toggle-size);
	border-radius: var(--fc-radius);
	background: var(--fc-toggle-bg);
	border: none;
	outline: none;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--fc-shadow);
	transition:
		transform var(--fc-transition),
		background 0.22s ease,
		box-shadow var(--fc-transition);
	position: relative;
	flex-shrink: 0;
}

.fc-toggle:hover {
	background: #1a252f;
	transform: scale(1.08);
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.32);
}

.fc-toggle:active {
	transform: scale(0.94);
}

.fc-toggle svg {
	width: 24px;
	height: 24px;
	position: absolute;
	transition: opacity 0.18s ease, transform 0.22s ease;
}

/* Two icons: info (closed) and × (open) */
.fc-toggle-close {
	opacity: 0;
	transform: rotate(-45deg) scale(0.7);
}

.fc-toggle-open {
	opacity: 1;
	transform: rotate(0deg) scale(1);
}

/* When widget is open, swap icons */
.fc-widget.fc-open .fc-toggle-close {
	opacity: 1;
	transform: rotate(0deg) scale(1);
}

.fc-widget.fc-open .fc-toggle-open {
	opacity: 0;
	transform: rotate(45deg) scale(0.7);
}

/* ── Open / Close Animation ──────────────────────────────── */

/* Closed state: collapse and hide icons */
.fc-widget:not(.fc-open) .fc-channels {
	pointer-events: none;
}

.fc-widget:not(.fc-open) .fc-item {
	opacity: 0;
	transform: scale(0.5) translateY(10px);
	pointer-events: none;
}

/* Staggered reveal when opening */
.fc-widget.fc-open .fc-item {
	opacity: 1;
	transform: scale(1) translateY(0);
}

/* Stagger each icon */
.fc-widget.fc-open .fc-item:nth-child(1) { transition-delay: 0.04s; }
.fc-widget.fc-open .fc-item:nth-child(2) { transition-delay: 0.09s; }
.fc-widget.fc-open .fc-item:nth-child(3) { transition-delay: 0.14s; }
.fc-widget.fc-open .fc-item:nth-child(4) { transition-delay: 0.19s; }

/* Icons also need transition when present */
.fc-item {
	transition:
		transform var(--fc-transition),
		box-shadow var(--fc-transition),
		opacity 0.22s ease;
}

/* ── Pulse ring on toggle (attention) ────────────────────── */
.fc-toggle::before {
	content: "";
	position: absolute;
	inset: -4px;
	border-radius: 50%;
	border: 2px solid rgba(255, 255, 255, 0.35);
	opacity: 0;
	animation: fc-pulse 2.8s ease-in-out 1.5s infinite;
}

@keyframes fc-pulse {
	0%   { opacity: 0.7; transform: scale(1); }
	70%  { opacity: 0;   transform: scale(1.45); }
	100% { opacity: 0;   transform: scale(1.45); }
}

/* Stop pulse when open */
.fc-widget.fc-open .fc-toggle::before {
	animation: none;
	opacity: 0;
}

/* ── Mobile ──────────────────────────────────────────────── */
@media (max-width: 480px) {
	:root {
		--fc-size:        46px;
		--fc-toggle-size: 50px;
		--fc-edge:        14px;
		--fc-gap:         8px;
	}

	.fc-item svg { width: 22px; height: 22px; }
	.fc-toggle svg { width: 20px; height: 20px; }
}

@media (max-width: 360px) {
	:root {
		--fc-size:        42px;
		--fc-toggle-size: 46px;
		--fc-edge:        10px;
	}
}
