/* Global Family Widget Styles */
:root {
	/* Space Theme Colors */
	--gf-space-deep: #0a0e17; /* Deep space black-blue */
	--gf-space-nebula: #1a1f35; /* Slightly lighter nebula */
	--gf-star-glow: rgba(255, 255, 255, 0.7);
	--gf-accent-glow: rgba(43, 189, 166, 0.15); /* Soft IABT accent glow */

	/* Shadow System */
	--gf-shadow-sm: 0 2px 8px rgba(215, 235, 255, 0.3);
	--gf-shadow-md: 0 6px 20px rgba(215, 235, 255, 0.4);
	--gf-shadow-lg: 0 12px 40px rgba(215, 235, 255, 0.5);

	/* Animation Timings */
	--gf-transition-fast: 0.2s ease;
	--gf-transition-base: 0.4s ease;
	--gf-transition-slow: 0.6s cubic-bezier(0.4, 0, 0.2, 1);

	/* 3D Enhancement Variables */
	--gf-3d-perspective: 1200px;
	--gf-3d-tilt-x: 12deg; /* Subtle downward tilt */
	--gf-3d-depth-offset: 3px; /* Thickness of donut */
	--gf-shadow-3d: 0 8px 32px rgba(0, 0, 0, 0.2);
}

.global-family-area {
	position: relative;
	overflow: hidden;
	/* Space Background */
	background: radial-gradient(
		ellipse 120% 100% at 50% 40%,
		var(--gf-space-nebula) 0%,
		var(--gf-space-deep) 60%
	);
}

/* Starfield Layer - Subtle scattered stars */
.global-family-area::before {
	content: '';
	position: absolute;
	inset: 0;
	background-image:
        /* Small dim stars scattered across */
		radial-gradient(1px 1px at 10% 15%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 25% 8%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 40% 22%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 55% 5%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 70% 18%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 85% 12%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 95% 25%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 5% 35%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 18% 45%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 32% 52%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 48% 38%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 62% 48%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 78% 42%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 92% 55%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 8% 65%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 22% 72%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 38% 68%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 52% 75%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 68% 62%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 82% 78%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 12% 88%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 28% 92%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 45% 85%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 58% 95%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 75% 88%, var(--gf-star-glow), transparent),
		radial-gradient(1px 1px at 88% 82%, var(--gf-star-glow), transparent);
	opacity: 0.5;
	pointer-events: none;
	z-index: 0;
}

/* Nebula Glow - Soft accent bloom behind globe */
.global-family-area::after {
	content: '';
	position: absolute;
	top: 60%;
	left: 27%;
	transform: translate(-50%, -50%);
	width: 450px;
	height: 450px;
	background: radial-gradient(circle, var(--gf-accent-glow) 0%, transparent 65%);
	opacity: 0.6;
	pointer-events: none;
	z-index: 0;
}
.global-family-wrapper {
	position: relative;
}

/* Globe Container */
.global-family-globe {
	position: relative;
	min-height: 500px; /* Increased for larger chart */

	display: flex;
	align-items: center;
	justify-content: center;
}

.globe-container {
	position: relative;
	width: 350px;
	height: 350px;
}

.globe-container svg {
	width: 100%;
	height: 100%;
}

/* Loading State */
.globe-loading {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	text-align: center;
	z-index: 10;
}

.globe-loading .spinner {
	border: 4px solid rgba(0, 0, 0, 0.1);
	border-left-color: #667eea;
	border-radius: 50%;
	width: 50px;
	height: 50px;
	animation: spin 1s linear infinite;
	margin: 0 auto 15px;
}

@keyframes spin {
	0% {
		transform: rotate(0deg);
	}
	100% {
		transform: rotate(360deg);
	}
}

.globe-loading p {
	font-size: 14px;
	color: #666;
	margin: 0;
}

.globe-loading.hidden {
	display: none;
}

/* Globe Elements */
.globe-sphere {
	fill: #f8f9fa;
	stroke: #e0e0e0;
	stroke-width: 1px;
}

.globe-land {
	fill: #e0e0e0;
	stroke: #d0d0d0;
	stroke-width: 0.5px;
	transition: fill 0.3s ease;
}

.globe-land.highlighted {
	fill: #c0c0c0;
}

.globe-pin {
	fill: #ff6b6b;
	stroke: #fff;
	stroke-width: 2px;
	cursor: pointer;
	transition:
		all 0.3s ease,
		opacity 0.3s ease;
}

.globe-pin:hover {
	fill: #ff5252;
	r: 6;
}

.globe-connection-line {
	fill: none;
	stroke: #999;
	stroke-width: 1.5px;
	stroke-dasharray: 5, 5;
	opacity: 0.6;
}

/* Header Section (Title at Top) */

.global-family-header .global-family-title h2 {
	margin-bottom: var(--iabt-paragraph-margin);
}

.global-family-title h2 {
	font-family: var(--iabt-font-family);
	font-size: var(--iabt-h2);
	font-weight: var(--iabt-font-semibold);
	line-height: var(--iabt-line-height-heading);
	margin-bottom: var(--iabt-paragraph-margin);
	letter-spacing: var(--iabt-letter-spacing-normal);
	color: var(--iabt-text-white);
}

.global-family-subtitle {
	font-size: var(--iabt-text-lg);
	font-weight: var(--iabt-font-semibold);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px;
}

.global-family-subtitle .total-countries {
	display: inline-block;
	font-weight: var(--iabt-font-semibold);
	color: var(--iabt-primary);
	font-size: var(--iabt-h3);
}

/* Country Gauges Container */
.country-gauges-container {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(180px, 1fr));
	gap: 30px;
	margin-top: 30px;
}

.country-gauge-item {
	display: flex;
	align-items: center;
	gap: 15px;
	opacity: 0;
	transform: translateY(20px);
	animation: fadeInUp 0.6s ease forwards;
	color: rgba(255, 255, 255, 0.9); /* Light text for dark background */
}

.country-gauge-item:nth-child(1) {
	animation-delay: 0.1s;
}
.country-gauge-item:nth-child(2) {
	animation-delay: 0.2s;
}
.country-gauge-item:nth-child(3) {
	animation-delay: 0.3s;
}
.country-gauge-item:nth-child(4) {
	animation-delay: 0.4s;
}
.country-gauge-item:nth-child(5) {
	animation-delay: 0.5s;
}
.country-gauge-item:nth-child(6) {
	animation-delay: 0.6s;
}
.country-gauge-item:nth-child(7) {
	animation-delay: 0.7s;
}
.country-gauge-item:nth-child(8) {
	animation-delay: 0.8s;
}
.country-gauge-item:nth-child(9) {
	animation-delay: 0.9s;
}
.country-gauge-item:nth-child(10) {
	animation-delay: 1s;
}
.country-gauge-item:nth-child(11) {
	animation-delay: 1.1s;
}
.country-gauge-item:nth-child(12) {
	animation-delay: 1.2s;
}

@keyframes fadeInUp {
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Gauge Ring */
.gauge-ring-container {
	position: relative;
	width: 80px;
	height: 80px;
	flex-shrink: 0;
}

.gauge-ring-svg {
	width: 100%;
	height: 100%;
	transform: rotate(-90deg);
}

.gauge-ring-bg {
	fill: none;
	/* stroke color is defined inline in the SVG with unique gradient per country */
	stroke-width: 8;
}

.gauge-ring-progress {
	fill: none;
	/* White progress indicator - stroke color defined inline */
	stroke-width: 8;
	stroke-linecap: round;
	transition: stroke-dashoffset 1s ease-in-out;
	opacity: 0.9;
}

.gauge-percentage {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	font-size: 18px;
	font-weight: 700;
	text-align: center;
	line-height: 1;
}

/* Country Name */
.country-name {
	font-size: 16px;
	font-weight: 600;
	line-height: 1.4;
	color: rgba(255, 255, 255, 0.9); /* Light text for dark background */
}

/* Responsive Design */
@media (max-width: 991px) {
	.global-family-title h2 {
		font-size: 36px;
	}

	.global-family-subtitle {
		font-size: 20px;
	}

	.global-family-subtitle .total-countries {
		font-size: 24px;
	}

	.global-family-globe {
		min-height: 300px;
		margin-bottom: 30px;
	}
}

@media (max-width: 767px) {
	.global-family-title h2 {
		font-size: 32px;
	}

	.global-family-subtitle {
		font-size: 18px;
	}

	.global-family-subtitle .total-countries {
		font-size: 22px;
	}

	.country-gauges-container {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 20px 14px;
	}

	.country-gauge-item {
		flex-direction: column;
		justify-content: flex-start;
		text-align: center;
		gap: 8px;
	}

	.gauge-ring-container {
		width: 70px;
		height: 70px;
	}

	.gauge-percentage {
		font-size: 16px;
	}

	.country-name {
		font-size: 14px;
		max-width: 100%;
		overflow-wrap: anywhere;
	}
}

@media (max-width: 575px) {
	.global-family-title h2 {
		font-size: 28px;
	}

	.global-family-subtitle {
		font-size: 16px;
	}

	.country-gauges-container {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 18px 12px;
	}

	.gauge-ring-container {
		width: 64px;
		height: 64px;
	}

	.gauge-percentage {
		font-size: 14px;
	}

	.country-name {
		font-size: 13px;
	}
}

/* Error State */
.global-family-error {
	padding: 20px;
	background: #fee;
	border: 1px solid #fcc;
	border-radius: 8px;
	color: #c33;
	text-align: center;
}

.global-family-error p {
	margin: 0;
	font-size: 14px;
}

/* Fade transition for country sets */
.country-gauge-item.fade-out {
	animation: fadeOut 0.5s ease forwards;
}

@keyframes fadeOut {
	to {
		opacity: 0;
		transform: translateY(-20px);
	}
}
