.godam-button-icon {

	svg {
		// P0: follow the WP admin colour scheme (GoDAM pink as fallback).
		fill: var(--wp-admin-theme-color, #ab3a6c);
	}
}

.godam-dashboard-container {
	background-color: #fff;
	overflow-x: hidden;
	width: 100%;
	max-width: 100vw;
}

.dashboard-container {
	padding: 1rem;
	max-width: 1440px;
	margin-left: auto;
	margin-right: auto;
}

.api-key-message a {
	color: var(--wp-admin-theme-color, #ab3a6c);
	text-decoration: none;
	font-weight: 600;
}

.api-key-overlay-banner {
	display: flex;
	flex-direction: column;
	margin: 0 2rem;
	font-size: 1rem;
	font-weight: 400;

	&-header {
		font-size: 1.25rem;
		font-weight: 500;
		display: flex;
		flex-direction: column;
		gap: 1.5rem;
	}

	&-header a {
		margin: auto;
	}

	&-footer a {
		margin: auto;
	}

	&-footer {
		font-size: 0.975rem;
		font-weight: 400;
		margin-top: 0;
	}

	// Style the buy button to not take full width
	a.components-button.godam-button.is-primary {
		align-self: center;
		width: auto;
		display: inline-block;
	}
}

.api-key-message a:hover {
	text-decoration: underline;
}

.api-key-overlay-banner-header a:hover {
	text-decoration: none;
}

.top-media-container {
	margin-bottom: 1.5rem;

	h2 {
		font-weight: 600;
		margin: 0;
		display: flex;
		// Baseline (not center) so a trailing count/badge shares the heading's
		// text baseline instead of floating against its vertical centre.
		align-items: baseline;
	}

	&__head {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 16px;
		padding-top: 1rem;
		flex-wrap: wrap;
	}

	&__tools {
		display: flex;
		align-items: center;
		gap: 16px;
		flex-wrap: wrap;
	}

	&__search {
		min-width: 220px;
	}

	.export-button {
		background-color: #F4F4F5;
		display: flex;
		align-items: center;
		gap: 8px;
		padding: 0 14px;
		color: #000;
		border-radius: 6px;
		height: 40px;

		.export-icon {
			width: 16px;
			height: 16px;
		}
	}

	.export-button:hover {
		background-color: #E4E4E7;
		cursor: pointer;
	}

	.table-container {
		margin-top: 12px;
		border: 1px solid #E4E4E7;
		border-radius: 6px;
		border-collapse: collapse;
	}

	table {
		width: 100%;

		th, td {
			padding: 8px 16px;
			text-align: left;
			font-weight: 500;
			border-bottom: 1px solid #E4E4E7;
		}

		tr:last-child td {
			border-bottom: none;
		}

		th {
			font-size: 1rem;
			padding: 16px;
			color: #71717A;
		}

		td {

			.video-info {
				display: flex;
				align-items: center;
				gap: 1rem;
				justify-content: flex-start;

				a {
					text-decoration: none;
					color: #000;
				}

				.thumbnail-link {
					width: 40px;
					height: 40px;
					overflow: hidden;

					img {
						width: 100%;
						height: 100%;
						object-fit: cover;
						border-radius: 3px;
					}
				}

				.title-link {
					font-weight: 600;
					font-size: 14px;
					max-width: 200px;
					white-space: nowrap;
					overflow: hidden;
					text-overflow: ellipsis;
				}
			}
		}
	}

	.godam-pagination {
		display: flex;
		align-items: center;
		justify-content: flex-end;
		gap: 4px;
		margin-top: 16px;

		&__nav,
		&__page {
			display: inline-flex;
			align-items: center;
			justify-content: center;
			min-width: 32px;
			height: 32px;
			padding: 0 8px;
			border: 1px solid #E4E4E7;
			border-radius: 6px;
			background-color: #fff;
			color: #3F3F46;
			font-size: 13px;
			cursor: pointer;

			&:disabled {
				opacity: 0.4;
				cursor: default;
			}

			&:hover:not( :disabled ) {
				background-color: #F4F4F5;
			}
		}

		&__page.is-current {
			border-color: var( --wp-admin-theme-color, #ab3a6c );
			color: var( --wp-admin-theme-color, #ab3a6c );
			font-weight: 600;
		}

		&__gap {
			min-width: 24px;
			text-align: center;
			color: #A1A1AA;
		}

		.chevron-icon {
			width: 16px;
			height: 16px;
		}
	}

	// Prev/next pagination for the Reel Pops analytics table (godam-for-woo),
	// which renders inside `.top-media-container` and reuses these classes.
	// Keep them even though the Top Videos table above uses `.godam-pagination`.
	.previous-btn {
		background-color: transparent;
	}

	.next-btn {
		background-color: transparent;
	}

	.previous-btn:hover, .next-btn:hover {
		cursor: pointer;
	}

	.icon-disabled {
		filter: grayscale(100%) opacity(0.2);
		pointer-events: none;
	}

	.skeleton {
		background-color: #e5e7eb;
		border-radius: 4px;
		animation: skeletonPulse 1.5s ease-in-out infinite;
	}

	@keyframes skeletonPulse {

		0% {
			opacity: 1;
		}

		50% {
			opacity: 0.4;
		}

		100% {
			opacity: 1;
		}
	}
}

#tooltip-container {
	position: relative;
	display: inline-block;
	cursor: pointer;
}

#tooltip-container .tooltip-text {
	position: absolute;
	top: 100%;
	left: -95%;
	visibility: hidden;
	background-color: rgba(0, 0, 0, 0.8);
	color: #fff;
	text-align: center;
	padding: 8px;
	border-radius: 5px;
	min-width: 110px;
	width: max-content;
	max-width: 200px;
	z-index: 100;
	pointer-events: none;
	font-size: 12px;
	line-height: 1.2;
	opacity: 0;
	transition: opacity 0.2s ease, visibility 0.2s ease;
	word-wrap: break-word;
	overflow-wrap: break-word;
}

#tooltip-container:hover .tooltip-text {
	visibility: visible;
	opacity: 1;
}

/* Tooltip styling */
.tooltip {
	position: absolute;
	background: rgba(0, 0, 0, 0.75);
	color: #fff;
	padding: 5px 10px;
	border-radius: 5px;
	font-size: 12px;
	pointer-events: none; /* Prevents interfering with mouse events */
	opacity: 0; /* Initially hidden */
	transition: opacity 0.2s ease-in-out;
}

.blurred {
	filter: blur(5px);
	pointer-events: none;
}

.api-key-overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	display: flex;
	justify-content: center;
	align-items: center;
	background: rgba(0, 0, 0, 0.4);
	backdrop-filter: blur(5px);
	z-index: 99;
}

.api-key-overlay--upgrade {
	background-size: 100% calc(100% - 32px);
	background-repeat: no-repeat;
	background-position: center 32px;
}

.api-key-message {
	background: #fff;
	padding: 15px 20px;
	border-radius: 5px;
	box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
	text-align: center;
	font-size: 16px;
	font-weight: 700;
	max-width: 1200px;
	width: 95vw;
}

.api-key-message .annual-plan-offer-banner {
	margin-left: 0;
}

.hidden {
	display: none;
}

.playback-country-container {
	display: flex;
	gap: 12px;

	.playback-performance {
		flex: 2;
	}

	.country-views {
		max-width: 30%;
		display: flex;
		flex-direction: column;
		gap: 20px;
		background: #fff;
		border: 1px solid #ddd;
		border-radius: 8px;
		overflow: hidden;
		padding: 20px;
		flex: 1;

		.country-views-map {
			width: 100%;
		}

		.country-views-table {
			width: 100%;
			max-height: 200px;
			overflow-y: auto;
			padding-right: 4px;

			scrollbar-width: thin;
			scrollbar-color: var(--wp-admin-theme-color, #ab3a6c) #f0f0f0;

			&::-webkit-scrollbar {
				width: 4px;
			}

			&::-webkit-scrollbar-thumb {
				background-color: var(--wp-admin-theme-color, #ab3a6c);
				border-radius: 3px;
			}

			&::-webkit-scrollbar-track {
				background-color: #f0f0f0;
				border-radius: 3px;
			}
		}
	}
}

.dashboard-donut-container {
	border-radius: 12px;
}

.hero-donut-block {
	background-image: url(../../assets/src/images/hero-bg.webp);
	background-size: cover;
	background-position: center;
	background-repeat: no-repeat;
}

@keyframes slide-in {

	from {
		transform: translateX(100%);
		opacity: 0;
	}

	to {
		transform: translateX(0%);
		opacity: 1;
	}
}

.animate-slide-in {
	animation: slide-in 0.5s ease forwards;
}

.marketing-carousel-read-more {
	display: inline-block;
	padding: 0.4rem 1rem;
	font-size: 0.875rem;
	font-weight: 500;
	color: #fff;
	background-color: var(--wp-admin-theme-color);
	border-radius: 0.375rem;
	transition: background-color 0.3s ease, transform 0.2s ease;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05);
	outline: none;
}

.marketing-carousel-read-more:hover {
	background-color: #922c59;
	transform: translateY(-1px);
	text-decoration: none;
	color: #fff;
}

.dashboard-modal-banner {
	margin-bottom: 2rem;
	
	.annual-plan-offer-banner__link {
		display: block;
		width: 100%;
		text-align: center;
	}

	.annual-plan-offer-banner__image {
		display: block;
		max-width: 100%;
		height: auto;
		max-height: 200px;
		object-fit: contain;
		border-radius: 8px;
	}
}

// P0: friendly empty state for the Top Videos table (no plays recorded yet).
.godam-empty-state {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 4px;
	padding: 40px 16px;
	text-align: center;

	&__title {
		margin: 0;
		font-size: 15px;
		font-weight: 600;
		color: #1e1e1e;
	}

	&__hint {
		margin: 0;
		font-size: 13px;
		color: #757575;
		max-width: 420px;
	}
}

// =====================================================================
// GoDAM 2.0 dashboard reskin (P0, FE-only) — "Insights" layout.
// =====================================================================
.godam-dashboard-head {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px 16px;
	margin-bottom: 16px;

	.godam-dashboard-title {
		margin: 0;
		font-size: 22px;
		font-weight: 600;
		color: #1e1e1e;
	}

	// "See Reel Pop Analytics" link — pushed to the right edge of the head row.
	.godam-reel-pop-link {
		margin-left: auto;
		display: inline-flex;
		align-items: center;
		gap: 4px;
		font-size: 13px;
		font-weight: 500;
		color: var(--wp-admin-theme-color);
		text-decoration: none;
		white-space: nowrap;

		&:hover {
			text-decoration: underline;
		}
	}
}

.godam-dashboard-grid {
	display: grid;
	grid-template-columns: minmax(280px, 1fr) 2fr;
	gap: 16px;
	align-items: start;

	@media (max-width: 1024px) {
		grid-template-columns: 1fr;
	}
}

.godam-dashboard-right {
	display: flex;
	flex-direction: column;
	gap: 16px;
	// Allow the responsive chart/SVG to shrink within the grid track.
	min-width: 0;
}

// Note: the shared card primitives (.godam-card, .godam-pill, .godam-insights-card)
// live in pages/analytics/index.scss so the per-video Analytics page (which only
// bundles that stylesheet) can use them too. The dashboard imports analytics/index.scss,
// so they remain available here as well.

// Left card: viewers gauge + geography. The geography block is the plain
// .country-views markup (its card styling only applies inside the old
// .playback-country-container, so style it for this context here).
.godam-viewers-card {

	.country-views {
		display: flex;
		flex-direction: column;
		gap: 12px;
		margin-top: 8px;

		.country-views-map {
			width: 100%;
		}

		.country-views-table {
			width: 100%;
			max-height: 220px;
			overflow-y: auto;
			padding-right: 4px;

			scrollbar-width: thin;
			scrollbar-color: var(--wp-admin-theme-color, #ab3a6c) #f0f0f0;

			&::-webkit-scrollbar {
				width: 4px;
			}

			&::-webkit-scrollbar-thumb {
				background-color: var(--wp-admin-theme-color, #ab3a6c);
				border-radius: 3px;
			}
		}
	}
}

.godam-gauge {

	&__chart {
		position: relative;
		width: 100%;
		max-width: 260px;
		margin: 0 auto;
	}

	&__svg {
		display: block;
		width: 100%;
		height: auto;
		overflow: visible;
	}

	// Light track = background (Total Plays); dark fill = Unique Viewers portion.
	&__track {
		stroke: color-mix(in srgb, var(--wp-admin-theme-color, #ab3a6c) 20%, #fff);
	}

	&__fill {
		stroke: var(--wp-admin-theme-color, #ab3a6c);
		transition: stroke-dasharray 0.4s ease;
	}

	&__center {
		position: absolute;
		left: 0;
		right: 0;
		bottom: 4px;
		display: flex;
		flex-direction: column;
		align-items: center;
		gap: 2px;
	}

	&__value {
		font-size: 30px;
		font-weight: 700;
		line-height: 1;
		color: #1e1e1e;
	}

	&__label {
		font-size: 12px;
		color: #757575;
	}

	// Hover tooltip: legend of the two arc segments + their raw values.
	&__tooltip {
		position: absolute;
		top: 6px;
		left: 50%;
		transform: translateX(-50%);
		display: flex;
		flex-direction: column;
		gap: 6px;
		padding: 12px 16px;
		background: #1e1e1e;
		border-radius: 10px;
		box-shadow: 0 6px 20px rgba(0, 0, 0, 0.25);
		white-space: nowrap;
		opacity: 0;
		visibility: hidden;
		pointer-events: none;
		transition: opacity 0.15s ease;
		z-index: 5;
	}

	&__chart:hover &__tooltip,
	&__chart:focus-within &__tooltip {
		opacity: 1;
		visibility: visible;
	}

	&__tooltip-row {
		display: flex;
		align-items: center;
		gap: 10px;
		font-size: 13px;
		color: #fff;
	}

	&__swatch {
		width: 12px;
		height: 12px;
		border-radius: 3px;
		flex-shrink: 0;

		&--light {
			background: color-mix(in srgb, var(--wp-admin-theme-color, #ab3a6c) 20%, #fff);
		}

		&--dark {
			background: var(--wp-admin-theme-color, #ab3a6c);
		}
	}

	&__tooltip-label {
		flex: 1;
		color: #e5e7eb;
	}

	&__tooltip-value {
		font-weight: 600;
		margin-left: 20px;
	}
}

// (.godam-insights-card moved to pages/analytics/index.scss — shared by both surfaces.)

// .godam-analytics-unavailable moved to pages/shared/analytics-unavailable.scss (shared via AnalyticsUnavailableNotice).
