
/**
 * Floating Community launcher + notification popover.
 * Site-wide entry point (bottom-right). Aligns with ACC design tokens.
 */

/* -------------------------------------------------------------------------- */
/* Root / layout                                                              */
/* -------------------------------------------------------------------------- */

.acc-fab-root {
	--acc-fab-size: 56px;
	--acc-fab-right: 24px;
	/* Comfortable thumb zone — not flush to the bottom edge */
	--acc-fab-bottom: calc(28px + env(safe-area-inset-bottom, 0px));
	--acc-fab-gap: 12px;
	--acc-fab-panel-width: min(360px, calc(100dvw - 32px));
	--acc-fab-panel-max-h: min(420px, calc(100vh - 120px));
	--acc-fab-z: 10060;
	--acc-fab-scrim-z: 10055;

	position: fixed;
	right: var(--acc-fab-right);
	bottom: var(--acc-fab-bottom);
	z-index: var(--acc-fab-z);
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	pointer-events: none;
	font-family: var(--acc-font-family);
}

body.acc-modal-open .acc-fab-root,
body.acc-sidebar-drawer-open .acc-fab-root,
body.acc-lightbox-open .acc-fab-root {
	visibility: hidden !important;
	opacity: 0 !important;
	pointer-events: none !important;
}

.acc-fab-root > * {
	pointer-events: auto;
}

/* -------------------------------------------------------------------------- */
/* Scrim (mobile focus)                                                       */
/* -------------------------------------------------------------------------- */

.acc-fab-scrim {
	position: fixed;
	inset: 0;
	z-index: var(--acc-fab-scrim-z);
	background: var(--acc-color-scrim);
	opacity: 0;
	transition: opacity var(--acc-transition-base, 220ms ease);
	pointer-events: none;
}

.acc-fab-root.is-open .acc-fab-scrim {
	opacity: 1;
	pointer-events: auto;
}

/* -------------------------------------------------------------------------- */
/* FAB button                                                                 */
/* -------------------------------------------------------------------------- */

.acc-fab {
	position: relative;
	width: var(--acc-fab-size);
	height: var(--acc-fab-size);
	border: none;
	border-radius: var(--acc-radius-pill, 9999px);
	background: var(--acc-color-accent, #8c7eff);
	color: #ffffff;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	box-shadow: var(--acc-shadow-fab);
	transition:
		transform var(--acc-transition-fast, 150ms ease),
		box-shadow var(--acc-transition-fast, 150ms ease),
		background var(--acc-transition-fast, 150ms ease);
	flex-shrink: 0;
	-webkit-tap-highlight-color: transparent;
}@media (hover: hover) and (pointer: fine) {
	.acc-fab:hover {
		background: var(--acc-color-accent-hover, #7a6aef);
		box-shadow: var(--acc-shadow-fab);
		transform: translateY(-1px) scale(1.03);
	}
}

.acc-fab:active {
	transform: translateY(0) scale(0.96);
	box-shadow: var(--acc-shadow-soft);
}

.acc-fab:focus-visible {
	outline: 2px solid var(--acc-color-accent, #8c7eff);
	outline-offset: 3px;
}

.acc-fab-root.is-open .acc-fab {
	background: var(--acc-color-accent-hover, #7a6aef);
	box-shadow: var(--acc-shadow-fab);
}

.acc-fab__icon {
	display: inline-flex;
	line-height: 0;
	transition: transform var(--acc-transition-base, 220ms ease);
}

.acc-fab-root.is-open .acc-fab__icon {
	transform: scale(0.92);
}

.acc-fab__icon .acc-icon,
.acc-fab__icon svg {
	width: 24px;
	height: 24px;
	display: block;
}

/* Badge */
.acc-fab__badge {
	position: absolute;
	top: -2px;
	right: -2px;
	min-width: 20px;
	height: 20px;
	padding: 0 6px;
	border-radius: var(--acc-radius-pill, 9999px);
	background: var(--acc-color-danger);
	color: #ffffff;
	font-size: 0.6875rem;
	font-weight: 700;
	line-height: 20px;
	text-align: center;
	border: 2px solid var(--acc-color-bg-elevated);
	box-sizing: border-box;
	pointer-events: none;
	transform-origin: center;
	animation: acc-fab-badge-in 280ms cubic-bezier(0.34, 1.4, 0.64, 1) both;
}

.acc-fab__badge.is-bump {
	animation: acc-fab-badge-bump 360ms cubic-bezier(0.34, 1.4, 0.64, 1);
}

@keyframes acc-fab-badge-in {
	from {
		opacity: 0;
		transform: scale(0.5);
	}
	to {
		opacity: 1;
		transform: scale(1);
	}
}

@keyframes acc-fab-badge-bump {
	0% {
		transform: scale(1);
	}
	40% {
		transform: scale(1.22);
	}
	100% {
		transform: scale(1);
	}
}

/* -------------------------------------------------------------------------- */
/* Panel container                                                            */
/* -------------------------------------------------------------------------- */

.acc-fab-panel {
	position: absolute;
	right: 0;
	bottom: calc(var(--acc-fab-size) + var(--acc-fab-gap));
	width: var(--acc-fab-panel-width);
	max-height: var(--acc-fab-panel-max-h);
	background: var(--acc-color-bg-elevated);
	border: 1px solid var(--acc-color-border, #e5e7eb);
	border-radius: var(--acc-radius-xl, 20px);
	box-shadow: var(--acc-shadow-dropdown);
	overflow: hidden;
	display: flex;
	flex-direction: column;
	transform-origin: bottom right;
	opacity: 0;
	transform: translateY(10px) scale(0.96);
	transition:
		opacity var(--acc-transition-base, 220ms ease),
		transform var(--acc-transition-base, 220ms ease);
	pointer-events: none;
	z-index: 1;
}

.acc-fab-panel.is-visible {
	opacity: 1;
	transform: translateY(0) scale(1);
	pointer-events: auto;
}

.acc-fab-panel[hidden] {
	display: none;
}

.acc-fab-panel__inner {
	display: flex;
	flex-direction: column;
	min-height: 0;
	max-height: var(--acc-fab-panel-max-h);
}

/* Community primary action */
.acc-fab-community {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 14px 16px;
	text-decoration: none;
	color: var(--acc-color-text, #1a1a2e);
	background: linear-gradient(
		180deg,
		var(--acc-color-accent-softer, rgba(140, 126, 255, 0.08)) 0%,
		var(--acc-color-white, #fff) 100%
	);
	border-bottom: 1px solid var(--acc-color-border, #e5e7eb);
	transition: background var(--acc-transition-fast, 150ms ease);
	flex-shrink: 0;
}@media (hover: hover) and (pointer: fine) {
	.acc-fab-community:hover,
.acc-fab-community:focus-visible {
		background: var(--acc-color-accent-soft, rgba(140, 126, 255, 0.12));
	outline: 2px solid var(--acc-color-accent); outline-offset: 2px;
	}
}

.acc-fab-community:focus-visible {
	box-shadow: inset 0 0 0 2px var(--acc-color-accent, #8c7eff);
}

.acc-fab-community__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 36px;
	height: 36px;
	border-radius: 12px;
	background: var(--acc-color-accent, #8c7eff);
	color: var(--acc-color-white, #fff);
	flex-shrink: 0;
}

.acc-fab-community__icon .acc-icon,
.acc-fab-community__icon svg {
	width: 20px;
	height: 20px;
	display: block;
}

.acc-fab-community__text {
	flex: 1;
	font-size: var(--acc-font-size-sm, 0.875rem);
	font-weight: 600;
	line-height: 1.3;
}

.acc-fab-community__chevron {
	display: inline-flex;
	color: var(--acc-color-text-muted, #6b7280);
	line-height: 0;
}

/* Notifications section */
.acc-fab-panel__section {
	display: flex;
	flex-direction: column;
	min-height: 0;
	flex: 1;
}

.acc-fab-panel__head {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 14px 8px;
	gap: 8px;
	flex-shrink: 0;
}

.acc-fab-panel__heading {
	font-size: var(--acc-font-size-sm, 0.875rem);
	font-weight: 600;
	color: var(--acc-color-text, #1a1a2e);
}

.acc-fab-panel__mark-all {
	font-size: 0.75rem;
	white-space: nowrap;
}

.acc-fab-panel__list {
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	max-height: min(280px, calc(var(--acc-fab-panel-max-h) - 120px));
	overscroll-behavior: contain;
}

/* Reuse notification item styles with slightly denser padding inside FAB */
.acc-fab-panel .acc-notif-item {
	padding: 11px 14px;
}

.acc-fab-panel .acc-notif-item__avatar {
	flex-shrink: 0;
}

.acc-fab-panel .acc-notif-item__avatar img,
.acc-fab-panel .acc-notif-item__avatar-fallback {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	display: block;
	object-fit: cover;
}

.acc-fab-panel .acc-notif-item__avatar-fallback {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: var(--acc-color-accent-soft, rgba(140, 126, 255, 0.12));
	color: var(--acc-color-accent, #8c7eff);
	font-size: 0.75rem;
	font-weight: 600;
}

.acc-fab-panel .acc-notif-item__body {
	flex: 1;
	min-width: 0;
}

.acc-fab-panel .acc-notif-item__text {
	font-size: 0.875rem;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

/* Guest empty state */
.acc-fab-guest {
	padding: 20px 16px 24px;
	text-align: center;
}

.acc-fab-guest__text {
	margin: 0 0 14px;
	color: var(--acc-color-text-muted, #6b7280);
	font-size: var(--acc-font-size-sm, 0.875rem);
	line-height: 1.5;
}

.acc-fab-guest__btn {
	min-height: 40px;
	padding: 8px 20px;
	text-decoration: none;
}

.acc-fab-panel__placeholder {
	margin: 0;
}

/* Skeleton rows inside FAB list */
.acc-fab-panel .acc-notif-skeleton {
	padding: 8px 14px 12px;
}

.acc-fab-panel .acc-notif-skeleton__row {
    background: linear-gradient(90deg, var(--acc-color-bg-soft) 0%, var(--acc-color-border) 50%, var(--acc-color-bg-soft) 100%);
    background-size: 200% 100%;
    animation: acc-shimmer 1.2s ease-in-out infinite;
}

.acc-fab-panel .acc-notif-skeleton__row:last-child {
	margin-bottom: 0;
}

@keyframes acc-shimmer {
	0% {
		background-position: 100% 0;
	}
	100% {
		background-position: -100% 0;
	}
}

/* -------------------------------------------------------------------------- */
/* Responsive                                                                 */
/* -------------------------------------------------------------------------- */

@media (max-width: 480px) {
	.acc-fab-root {
		--acc-fab-size: 52px;
		--acc-fab-right: 16px;
		--acc-fab-bottom: calc(24px + env(safe-area-inset-bottom, 0px));
		--acc-fab-panel-width: calc(100dvw - 24px);
		--acc-fab-panel-max-h: min(70dvh, 480px);
	}

	.acc-fab-panel {
		position: fixed;
		left: 12px;
		right: 12px;
		width: auto;
		transform: translateY(10px) scale(0.98);
		border-radius: 18px;
		bottom: calc(var(--acc-fab-size) + var(--acc-fab-gap) + var(--acc-fab-bottom) + 8px);
		top: max(16px, env(safe-area-inset-top, 0px));
		max-height: calc(100vh - var(--acc-fab-size) - var(--acc-fab-gap) - var(--acc-fab-bottom) - 32px);
	}

	.acc-fab-panel.is-visible {
		transform: translateY(0) scale(1);
	}

	/* Show scrim only on small screens when open */
	.acc-fab-scrim {
		display: block;
	}
}

@media (min-width: 481px) {
	.acc-fab-scrim {
		/* Desktop: no full-screen dim — popover is enough */
		display: none;
	}
}

/* Single-thread reply composer still sits at bottom — lift FAB above it */
body.acc-community:has(.acc-composer-sticky) .acc-fab-root {
	--acc-fab-bottom: calc(88px + env(safe-area-inset-bottom, 0px));
}

/* Obrolan Umum uses .acc-chat-composer (sticky thread composer is hidden) */
body.acc-community:has(.acc-chat-composer-wrap) .acc-fab-root,
body.acc-community:has(.acc-page-chat) .acc-fab-root {
	--acc-fab-bottom: calc(100px + env(safe-area-inset-bottom, 0px));
}

@media (max-width: 768px) {
	body.acc-community:has(.acc-chat-composer-wrap) .acc-fab-root,
	body.acc-community:has(.acc-page-chat) .acc-fab-root {
		--acc-fab-bottom: calc(108px + env(safe-area-inset-bottom, 0px));
	}
}

/* Short viewports: restrict height & reduce bottom offset */
@media (max-height: 600px) {
	.acc-fab-root {
		--acc-fab-bottom: calc(16px + env(safe-area-inset-bottom, 0px));
		--acc-fab-panel-max-h: min(300px, calc(100vh - 80px));
	}
}

/* Print: never show */
@media print {
	.acc-fab-root {
		display: none;
	}
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
	.acc-fab,
	.acc-fab__icon,
	.acc-fab-panel,
	.acc-fab-scrim,
	.acc-fab__badge {
		transition: none;
		animation: none;
	}

	.acc-fab-panel {
		transform: none;
	}

	.acc-fab-panel.is-visible {
		transform: none;
	}

	.acc-fab-panel .acc-notif-skeleton__row {
		animation: none;
	}
}


