/**
 * Admin bar insights card (admin-bar-insights.php, js/admin-bar-insights.js).
 * Same palette as the upgrade hint and the admin panel skin.
 */

#wccp-abi {
	--wccp-abi-primary: #6C63FF;
	--wccp-abi-primary-dark: #4F46E5;
	--wccp-abi-accent: #22C7E0;
	--wccp-abi-ink: #0B1220;
	--wccp-abi-muted: #6B7280;
	--wccp-abi-line: #EEF0F3;
	--wccp-abi-hot: #EA580C;
	--wccp-abi-warn: #B45309;
	--wccp-abi-alert: #DC2626;
	--wccp-abi-good: #059669;

	position: fixed;
	top: 0;
	left: 0;
	z-index: 100000; /* above #wpadminbar (99999) */
	width: 340px;
	max-width: calc(100vw - 24px);
	box-sizing: border-box;
	background: #fff;
	border: 1px solid rgba(0, 0, 0, .08);
	border-radius: 16px;
	box-shadow: 0 18px 50px rgba(15, 23, 42, .22), 0 2px 6px rgba(15, 23, 42, .08);
	font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
	font-size: 13px;
	line-height: 1.45;
	color: var(--wccp-abi-ink);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transform: translateY(6px);
	transition: opacity .18s ease, transform .22s ease, visibility 0s linear .22s;
}

#wccp-abi.is-visible {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
	transform: none;
	transition: opacity .18s ease, transform .22s ease;
}

#wccp-abi *,
#wccp-abi *::before,
#wccp-abi *::after {
	box-sizing: border-box;
}

/* Hover bridge over the gap between the icon and the card. */
#wccp-abi::after {
	content: "";
	position: absolute;
	inset: -12px 0 auto 0;
	height: 12px;
}

#wccp-abi::before {
	content: "";
	position: absolute;
	inset: 0 0 auto 0;
	height: 4px;
	border-radius: 16px 16px 0 0;
	background: linear-gradient(90deg, var(--wccp-abi-primary), var(--wccp-abi-accent));
}

#wccp-abi .wccp-abi__arrow {
	position: absolute;
	top: -7px;
	left: 24px;
	width: 14px;
	height: 14px;
	margin-left: -7px;
	background: var(--wccp-abi-primary);
	border-radius: 3px 0 0 0;
	transform: rotate(45deg);
}

#wccp-abi .wccp-abi__body {
	position: relative;
	padding: 16px 16px 14px;
}

#wccp-abi p {
	margin: 0;
	padding: 0;
	font-size: 13px;
}

#wccp-abi .dashicons {
	flex: none;
	width: 18px;
	height: 18px;
	font-size: 18px;
	line-height: 1;
}

/* ---- Activity ---- */

#wccp-abi .wccp-abi__title {
	display: flex;
	align-items: center;
	gap: 6px;
	color: var(--wccp-abi-muted);
	font-size: 12px;
	font-weight: 600;
}

#wccp-abi .wccp-abi__title .dashicons {
	color: var(--wccp-abi-primary);
}

#wccp-abi .wccp-abi__big {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 6px;
}

#wccp-abi .wccp-abi__num {
	font-size: 32px;
	font-weight: 700;
	line-height: 1.05;
	letter-spacing: -.02em;
	font-variant-numeric: tabular-nums;
}

#wccp-abi .wccp-abi__trend {
	padding: 1px 8px;
	border-radius: 999px;
	background: #F1F5F9;
	color: var(--wccp-abi-muted);
	font-size: 11px;
	font-weight: 700;
	white-space: nowrap;
}

#wccp-abi .wccp-abi__trend.is-up {
	background: rgba(234, 88, 12, .1);
	color: var(--wccp-abi-hot);
}

#wccp-abi .wccp-abi__trend.is-down {
	background: rgba(5, 150, 105, .1);
	color: var(--wccp-abi-good);
}

#wccp-abi .wccp-abi__label {
	color: var(--wccp-abi-ink);
}

#wccp-abi .wccp-abi__bars {
	display: flex;
	align-items: flex-end;
	gap: 4px;
	height: 38px;
	margin: 12px 0 6px;
}

#wccp-abi .wccp-abi__bar {
	flex: 1;
	min-height: 3px;
	border-radius: 4px 4px 2px 2px;
	background: rgba(108, 99, 255, .25);
}

#wccp-abi .wccp-abi__bar.is-today {
	background: linear-gradient(180deg, var(--wccp-abi-primary), var(--wccp-abi-primary-dark));
}

#wccp-abi .wccp-abi__sub {
	color: var(--wccp-abi-muted);
	font-size: 12px;
}

#wccp-abi .wccp-abi__off {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 6px;
	color: var(--wccp-abi-muted);
}

#wccp-abi .wccp-abi__off a {
	color: var(--wccp-abi-primary-dark);
	font-weight: 600;
}

/* ---- Error tiles ---- */

#wccp-abi .wccp-abi__errors {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 6px;
	margin-top: 12px;
}

#wccp-abi .wccp-abi__activity + .wccp-abi__errors {
	padding-top: 12px;
	border-top: 1px solid var(--wccp-abi-line);
}

#wccp-abi .wccp-abi__tile {
	display: flex;
	flex-direction: column;
	gap: 1px;
	padding: 7px 8px;
	border-radius: 10px;
	background: #F8FAFC;
}

#wccp-abi .wccp-abi__tile-num {
	font-size: 17px;
	font-weight: 700;
	line-height: 1.2;
	font-variant-numeric: tabular-nums;
}

#wccp-abi .wccp-abi__tile-label {
	color: var(--wccp-abi-muted);
	font-size: 11px;
	line-height: 1.25;
}

#wccp-abi .wccp-abi__tile.is-warn {
	background: rgba(245, 158, 11, .1);
}

#wccp-abi .wccp-abi__tile.is-warn .wccp-abi__tile-num {
	color: var(--wccp-abi-warn);
}

#wccp-abi .wccp-abi__tile.is-alert {
	background: rgba(220, 38, 38, .08);
}

#wccp-abi .wccp-abi__tile.is-alert .wccp-abi__tile-num {
	color: var(--wccp-abi-alert);
}

/* ---- Stories ---- */

#wccp-abi .wccp-abi__stories {
	margin: 12px 0 0;
	padding: 0;
	list-style: none;
}

#wccp-abi .wccp-abi__story {
	display: flex;
	align-items: flex-start;
	gap: 8px;
	margin: 0 0 6px;
	padding: 8px 10px;
	border-radius: 10px;
	background: rgba(108, 99, 255, .07);
	font-weight: 600;
	animation: wccp-abi-in .35s ease both;
}

#wccp-abi .wccp-abi__story + .wccp-abi__story {
	animation-delay: .08s;
}

#wccp-abi .wccp-abi__story .dashicons {
	margin-top: 1px;
	color: var(--wccp-abi-primary);
}

#wccp-abi .wccp-abi__story.is-hot {
	background: rgba(234, 88, 12, .09);
}

#wccp-abi .wccp-abi__story.is-hot .dashicons {
	color: var(--wccp-abi-hot);
}

#wccp-abi .wccp-abi__story.is-warn {
	background: rgba(245, 158, 11, .1);
}

#wccp-abi .wccp-abi__story.is-warn .dashicons {
	color: var(--wccp-abi-warn);
}

#wccp-abi .wccp-abi__story.is-alert {
	background: rgba(220, 38, 38, .08);
}

#wccp-abi .wccp-abi__story.is-alert .dashicons {
	color: var(--wccp-abi-alert);
}

#wccp-abi .wccp-abi__story.is-good {
	background: rgba(5, 150, 105, .08);
}

#wccp-abi .wccp-abi__story.is-good .dashicons {
	color: var(--wccp-abi-good);
}

/* ---- Footer ---- */

#wccp-abi .wccp-abi__foot {
	margin-top: 12px;
	padding-top: 12px;
	border-top: 1px solid var(--wccp-abi-line);
}

#wccp-abi .wccp-abi__last {
	display: flex;
	align-items: center;
	gap: 7px;
	margin-bottom: 10px;
	color: var(--wccp-abi-muted);
	font-size: 12px;
}

#wccp-abi .wccp-abi__pulse {
	flex: none;
	width: 8px;
	height: 8px;
	border-radius: 50%;
	background: var(--wccp-abi-good);
	box-shadow: 0 0 0 0 rgba(5, 150, 105, .6);
	animation: wccp-abi-pulse 1.8s ease-out infinite;
}

#wccp-abi .wccp-abi__actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 8px;
}

#wccp-abi .wccp-abi__cta {
	display: inline-flex;
	align-items: center;
	padding: 8px 15px;
	border-radius: 999px;
	background: linear-gradient(135deg, var(--wccp-abi-primary), var(--wccp-abi-primary-dark));
	box-shadow: 0 6px 16px rgba(108, 99, 255, .35);
	color: #fff;
	font-size: 13px;
	font-weight: 600;
	line-height: 1.2;
	text-decoration: none;
	transition: transform .15s ease, box-shadow .15s ease;
}

#wccp-abi .wccp-abi__cta:hover,
#wccp-abi .wccp-abi__cta:focus {
	color: #fff;
	transform: translateY(-1px);
	box-shadow: 0 10px 22px rgba(108, 99, 255, .45);
}

#wccp-abi .wccp-abi__second {
	color: var(--wccp-abi-primary-dark);
	font-size: 12px;
	font-weight: 600;
	text-decoration: none;
}

#wccp-abi .wccp-abi__second:hover {
	text-decoration: underline;
}

#wccp-abi a:focus-visible {
	outline: 2px solid var(--wccp-abi-primary);
	outline-offset: 2px;
	box-shadow: none;
}

/* ---- Loading ---- */

#wccp-abi .wccp-abi__msg {
	color: var(--wccp-abi-muted);
}

#wccp-abi .wccp-abi__skeleton {
	display: block;
	height: 14px;
	margin-top: 10px;
	border-radius: 7px;
	background: linear-gradient(90deg, #F1F5F9 25%, #E2E8F0 50%, #F1F5F9 75%);
	background-size: 200% 100%;
	animation: wccp-abi-shimmer 1.2s linear infinite;
}

#wccp-abi .wccp-abi__skeleton:nth-child(2) {
	width: 45%;
	height: 30px;
}

#wccp-abi .wccp-abi__skeleton:last-child {
	width: 80%;
}

/* ---- Admin bar icon ---- */

/* Sits right after the (rotated) icon and overlaps its top corner, in LTR and RTL. */
#wpadminbar #wp-admin-bar-wccp_free_top_button .wccp-abi-dot {
	display: inline-block;
	position: relative;
	top: -7px;
	width: 8px;
	height: 8px;
	margin-inline: -12px 4px;
	border-radius: 50%;
	background: #F97316;
	box-shadow: 0 0 0 2px #1d2327;
	vertical-align: middle;
	animation: wccp-abi-dot 1.6s ease-out 3;
}

#wpadminbar #wp-admin-bar-wccp_free_top_button.wccp-abi-open > .ab-item {
	background: #2c3338;
	color: #72aee6;
}

@keyframes wccp-abi-in {
	from { opacity: 0; transform: translateY(4px); }
	to { opacity: 1; transform: none; }
}

@keyframes wccp-abi-pulse {
	0% { box-shadow: 0 0 0 0 rgba(5, 150, 105, .6); }
	70% { box-shadow: 0 0 0 7px rgba(5, 150, 105, 0); }
	100% { box-shadow: 0 0 0 0 rgba(5, 150, 105, 0); }
}

@keyframes wccp-abi-dot {
	0% { box-shadow: 0 0 0 2px #1d2327, 0 0 0 2px rgba(249, 115, 22, .8); }
	70% { box-shadow: 0 0 0 2px #1d2327, 0 0 0 9px rgba(249, 115, 22, 0); }
	100% { box-shadow: 0 0 0 2px #1d2327, 0 0 0 2px rgba(249, 115, 22, 0); }
}

@keyframes wccp-abi-shimmer {
	from { background-position: 200% 0; }
	to { background-position: -200% 0; }
}

@media (max-width: 782px) {
	#wccp-abi {
		display: none;
	}
}

@media (prefers-reduced-motion: reduce) {
	#wccp-abi,
	#wccp-abi.is-visible,
	#wccp-abi .wccp-abi__story,
	#wccp-abi .wccp-abi__pulse,
	#wccp-abi .wccp-abi__skeleton,
	#wpadminbar #wp-admin-bar-wccp_free_top_button .wccp-abi-dot {
		animation: none;
		transition: none;
	}
}
