/* Traffic cell + sparkline */
.gpl-traffic-metric-cell {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	white-space: nowrap;
}

.gpl-traffic-metric-cell__value {
	font-weight: 500;
}

.gpl-metrics-graph-host.is-graph-active .gpl-metrics-sparkline-line {
	stroke-width: 2;
}

.gpl-metrics-graph-trigger {
	display: inline-flex;
	line-height: 0;
	cursor: pointer;
}

.gpl-metrics-graph-trigger:focus-visible {
	outline: 2px solid #2271b1;
	outline-offset: 2px;
	border-radius: 2px;
}

.gpl-metrics-sparkline {
	display: block;
	overflow: visible;
}

/* Shared panel (popover + modal) */
.gpl-metrics-graph-panel__header,
.gpl-metrics-graph-modal .gpl-metrics-graph-panel__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-bottom: 8px;
}

.gpl-metrics-graph-panel__header h3,
.gpl-metrics-graph-modal .gpl-metrics-graph-panel__header h3 {
	margin: 0;
	font-size: 14px;
	font-weight: 600;
}

.gpl-metrics-graph-panel__header a,
.gpl-metrics-graph-modal .gpl-metrics-graph-panel__header a {
	font-size: 12px;
	color: #2271b1;
	text-decoration: none;
	max-width: 55%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gpl-metrics-graph-panel__header a:hover {
	text-decoration: underline;
}

.gpl-metrics-graph-panel__chart svg,
.gpl-metrics-graph-modal .gpl-metrics-graph-panel__chart svg {
	display: block;
	max-width: 100%;
	height: auto;
}

.gpl-metrics-graph-label {
	font-size: 11px;
	fill: #888;
}

.gpl-metrics-graph-dot-hit {
	cursor: pointer;
}

.gpl-metrics-graph-dot-wrap.is-active .gpl-metrics-graph-dot {
	r: 5.5;
}

/* Dot value tooltip */
.gpl-metrics-graph-dot-tip {
	position: fixed;
	z-index: 100003;
	transform: translate(-50%, -100%);
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 6px;
	box-shadow: 0 4px 14px rgba(0, 0, 0, 0.12);
	padding: 8px 12px;
	pointer-events: none;
	text-align: center;
	line-height: 1.4;
}

.gpl-metrics-graph-dot-tip strong {
	display: block;
	font-size: 13px;
	font-weight: 600;
	color: #111;
}

.gpl-metrics-graph-dot-tip span {
	display: block;
	font-size: 12px;
	color: #555;
	margin-top: 2px;
}

/* Popover */
.gpl-metrics-graph-popover {
	position: fixed;
	z-index: 100001;
	display: none;
	pointer-events: none;
}

.gpl-metrics-graph-popover.is-visible {
	display: block;
	pointer-events: auto;
}

.gpl-metrics-graph-popover .gpl-metrics-graph-panel {
	background: #fff;
	border: 1px solid #e5e7eb;
	border-radius: 8px;
	box-shadow: 0 8px 28px rgba(0, 0, 0, 0.18);
	padding: 14px;
	width: 400px;
	max-width: calc(100vw - 16px);
}

/* Modal */
.gpl-metrics-graph-modal {
	position: fixed;
	inset: 0;
	z-index: 100002;
	display: none;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.gpl-metrics-graph-modal.is-open {
	display: flex;
}

.gpl-metrics-graph-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
}

.gpl-metrics-graph-modal__close {
	position: absolute;
	top: 8px;
	right: 10px;
	z-index: 2;
	border: 0;
	background: transparent;
	font-size: 24px;
	cursor: pointer;
	color: #666;
}

.gpl-metrics-graph-modal .gpl-metrics-graph-panel {
	position: relative;
	z-index: 1;
	background: #fff;
	border-radius: 8px;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.18);
	padding: 20px 20px 16px;
	width: 460px;
	max-width: 100%;
}

.gpl-metrics-graph-modal .gpl-metrics-graph-panel__header {
	margin-bottom: 12px;
	padding-right: 28px;
}

.gpl-metrics-graph-modal .gpl-metrics-graph-panel__header h3 {
	font-size: 16px;
}

body.gpl-metrics-graph-modal-open {
	overflow: hidden;
}

.wc-product-table .gpl-traffic-metric-cell {
	justify-content: flex-end;
}

.wc-product-table td:has(.gpl-metrics-graph-host) {
	overflow: visible;
}

/* Product page — sparkline under metric (hover = full chart popover) */
.gpl-metric-item--has-graph {
	flex-wrap: wrap;
	justify-content: center;
	align-content: center;
	row-gap: 2px;
	padding-bottom: 2px;
}

.gpl-metric-item--has-graph .gpl-metric-item__graph {
	display: flex;
	justify-content: center;
	line-height: 0;
}
