/* =====================================================
   ANALYTICS DASHBOARD — STYLESHEET
   Scope   : analytics.html only
   Depends : style.css (CSS variables)
   ===================================================== */

/* ══════════════════════════════════════════════════
   PAGE HEADER
══════════════════════════════════════════════════ */
.analytics-header {
	background: linear-gradient(135deg, var(--blue-deeper) 0%, var(--blue) 50%, #4dabf7 100%);
	padding: 36px 0 32px;
	position: relative;
	overflow: hidden;
}

.analytics-header::before {
	content: '';
	position: absolute;
	inset: 0;
	background:url("data:image/svg+xml,%3Csvg width='60' height='60' viewBox='0 0 60 60' xmlns='http://www.w3.org/2000/svg'%3E%3Cg fill='none' fill-rule='evenodd'%3E%3Cg fill='%23ffffff' fill-opacity='0.04'%3E%3Cpath d='M36 34v-4h-2v4h-4v2h4v4h2v-4h4v-2h-4zm0-30V0h-2v4h-4v2h4v4h2V6h4V4h-4zM6 34v-4H4v4H0v2h4v4h2v-4h4v-2H6zM6 4V0H4v4H0v2h4v4h2V6h4V4H6z'/%3E%3C/g%3E%3C/g%3E%3C/svg%3E") repeat;
	pointer-events: none;
}

/* dot grid */
.analytics-header::after {
	content: '';
	position: absolute;
	inset: 0;
	background-image: radial-gradient(circle, rgba(255, 255, 255, .04) 1px, transparent 1px);
	background-size: 28px 28px;
	pointer-events: none;
}

.analytics-header .container-xl {
	position: relative;
	z-index: 1;
}

.analytics-page-title {
	font-size: clamp(22px, 3vw, 30px);
	font-weight: 800;
	color: white;
	letter-spacing: -0.5px;
	line-height: 1.2;
	margin-bottom: 6px;
}

.analytics-page-sub {
	font-size: 13.5px;
	color: rgba(255, 255, 255, .5);
}

/* Live badge */
.live-badge {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--bs-primary);
	border: 1px solid var(--bs-primary);
	color: var(--bs-gray-100);
	padding: 4px 10px;
	border-radius: 99px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.3px;
}

.live-dot {
	width: 6px;
	height: 6px;
	border-radius: 50%;
	background: #4ade80;
	animation: pulse-dot 1.6s ease-in-out infinite;
}

@keyframes pulse-dot {

	0%,
	100% {
		opacity: 1;
		transform: scale(1);
	}

	50% {
		opacity: .5;
		transform: scale(.7);
	}
}

/* ── Section Nav Tabs ── */
.analytics-nav {
	background: white;
	border-bottom: 1.5px solid var(--gray-200);
	position: sticky;
	top: 95px;
	z-index: 100;
	box-shadow: 0 2px 8px rgba(0, 0, 0, .04);
}

.analytics-nav-strip {
	display: flex;
	align-items: center;
	gap: 0;
	overflow-x: auto;
	-ms-overflow-style: none;
	scrollbar-width: none;
}

.analytics-nav-strip::-webkit-scrollbar {
	display: none;
}

.anav-btn {
	display: flex;
	align-items: center;
	gap: 7px;
	padding: 14px 18px;
	border: none;
	background: transparent;
	font-family: var(--font-ui);
	font-size: 13px;
	font-weight: 600;
	color: var(--gray-500);
	cursor: pointer;
	white-space: nowrap;
	border-bottom: 2px solid transparent;
	margin-bottom: -1.5px;
	transition: all var(--transition);
}

.anav-btn svg {
	width: 14px;
	height: 14px;
}

.anav-btn:hover {
	color: var(--blue);
	background: var(--blue-xlight);
}

.anav-btn.active {
	color: var(--blue);
	border-bottom-color: var(--blue);
}

/* ══════════════════════════════════════════════════
   KPI CARDS
══════════════════════════════════════════════════ */
.kpi-grid {
	display: grid;
	grid-template-columns: repeat(6, 1fr);
	gap: 14px;
	margin-bottom: 24px;
}

.kpi-card {
	background: white;
	border: 1.5px solid var(--gray-200);
	border-radius: var(--radius-lg);
	padding: 18px 20px;
	position: relative;
	overflow: hidden;
	transition: box-shadow var(--transition), transform var(--transition);
}

.kpi-card:hover {
	box-shadow: var(--shadow-md);
	transform: translateY(-1px);
}

.kpi-card::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
}

.kpi-card.blue::before {
	background: var(--blue);
}

.kpi-card.green::before {
	background: var(--green);
}

.kpi-card.orange::before {
	background: var(--orange);
}

.kpi-card.purple::before {
	background: #6f42c1;
}

.kpi-card.teal::before {
	background: #20c997;
}

.kpi-card.red::before {
	background: var(--red);
}

.kpi-icon {
	width: 36px;
	height: 36px;
	border-radius: var(--radius-sm);
	display: flex;
	align-items: center;
	justify-content: center;
	margin-bottom: 12px;
}

.kpi-icon svg {
	width: 18px;
	height: 18px;
}

.kpi-icon.blue {
	background: var(--blue-xlight);
	color: var(--blue);
}

.kpi-icon.green {
	background: #d1fae5;
	color: var(--green);
}

.kpi-icon.orange {
	background: #fff3cd;
	color: var(--orange);
}

.kpi-icon.purple {
	background: #f3e8ff;
	color: #6f42c1;
}

.kpi-icon.teal {
	background: #d1fae5;
	color: #20c997;
}

.kpi-icon.red {
	background: #fee2e2;
	color: var(--red);
}

.kpi-num {
	font-family: var(--font-mono);
	font-size: 24px;
	font-weight: 700;
	letter-spacing: -1px;
	line-height: 1;
	margin-bottom: 4px;
}

.kpi-label {
	font-size: 11.5px;
	color: var(--gray-500);
	font-weight: 500;
	margin-bottom: 8px;
}

.kpi-trend {
	display: flex;
	align-items: center;
	gap: 4px;
	font-size: 11px;
	font-weight: 700;
}

.kpi-trend.up {
	color: var(--green);
}

.kpi-trend.down {
	color: var(--red);
}

.kpi-trend svg {
	width: 11px;
	height: 11px;
}

/* ══════════════════════════════════════════════════
   CHART PANELS
══════════════════════════════════════════════════ */
.chart-panel {
	background: white;
	border: 1.5px solid var(--gray-200);
	border-radius: var(--radius-lg);
	overflow: hidden;
	margin-bottom: 20px;
}

.chart-panel-header {
	padding: 16px 22px;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	border-bottom: 1px solid var(--gray-100);
	background: var(--gray-50);
	flex-wrap: wrap;
}

.chart-panel-title-group {
	display: flex;
	align-items: center;
	gap: 10px;
}

.chart-panel-icon {
	width: 32px;
	height: 32px;
	border-radius: var(--radius-sm);
	background: var(--blue-xlight);
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
}

.chart-panel-icon svg {
	width: 16px;
	height: 16px;
	color: var(--blue);
}

.chart-panel-title {
	font-size: 13.5px;
	font-weight: 700;
	color: var(--gray-800);
}

.chart-panel-sub {
	font-size: 11.5px;
	color: var(--gray-400);
	margin-top: 1px;
}

.chart-panel-body {
	padding: 20px 22px;
	position: relative;
}

/* Chart filter pills */
.chart-filter-pills {
	display: flex;
	gap: 4px;
}

.cpill {
	padding: 4px 11px;
	border-radius: 99px;
	border: 1.5px solid var(--gray-200);
	background: white;
	font-family: var(--font-ui);
	font-size: 11.5px;
	font-weight: 600;
	color: var(--gray-500);
	cursor: pointer;
	transition: all var(--transition);
}

.cpill:hover {
	border-color: var(--blue);
	color: var(--blue);
}

.cpill.active {
	background: var(--blue);
	color: white;
	border-color: var(--blue);
}

/* Canvas sizing */
.chart-panel canvas {
	width: 100% !important;
}

.chart-h-280 {
	height: 280px;
}

.chart-h-320 {
	height: 320px;
}

.chart-h-360 {
	height: 360px;
}

.chart-h-400 {
	height: 400px;
}

.chart-h-220 {
	height: 220px;
}

.chart-h-180 {
	height: 180px;
}

/* ══════════════════════════════════════════════════
   SECTION LABELS
══════════════════════════════════════════════════ */
.section-label {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 14px;
	margin-top: 8px;
}

.section-label-line {
	flex: 1;
	height: 1px;
	background: var(--gray-200);
}

.section-label-text {
	font-size: 10.5px;
	font-weight: 700;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	color: var(--gray-400);
	white-space: nowrap;
}

/* ══════════════════════════════════════════════════
   KEYWORD BUBBLE CLOUD
══════════════════════════════════════════════════ */
.keyword-cloud {
	display: flex;
	flex-wrap: wrap;
	gap: 5px;
	align-items: center;
	padding: 24px;
	min-height: 200px;
}

.kw-bubble {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	border-radius: 99px;
	font-weight: 700;
	cursor: pointer;
	transition: all var(--transition);
	white-space: nowrap;
	position: relative;
}

.kw-bubble:hover {
	filter: brightness(1.08);
	transform: scale(1.04);
}

.kw-bubble .kw-count {
	font-family: var(--font-mono);
	background: rgba(0, 0, 0, .12);
	border-radius: 99px;
	line-height: 1;
}

/* sizes */
.kw-xl {
	font-size: 18px;
	padding: 10px 18px;
}

.kw-xl .kw-count {
	font-size: 11px;
	padding: 3px 7px;
}

.kw-lg {
	font-size: 15px;
	padding: 8px 16px;
}

.kw-lg .kw-count {
	font-size: 10px;
	padding: 2px 6px;
}

.kw-md {
	font-size: 13px;
	padding: 7px 14px;
}

.kw-md .kw-count {
	font-size: 9.5px;
	padding: 2px 5px;
}

.kw-sm {
	font-size: 11.5px;
	padding: 5px 12px;
}

.kw-sm .kw-count {
	font-size: 9px;
	padding: 1px 5px;
}

/* Color variants for keyword bubbles */
.kw-bubble.kw-c1 {
	background: linear-gradient(135deg, #0d6efd 0%, #0d6efd 100%);
	color: white;
	box-shadow: 0 2px 8px rgba(13, 110, 253, .2);
}

.kw-bubble.kw-c2 {
	background: linear-gradient(135deg, #198754 0%, #198754 100%);
	color: white;
	box-shadow: 0 2px 8px rgba(25, 135, 84, .2);
}

.kw-bubble.kw-c3 {
	background: linear-gradient(135deg, #dc3545 0%, #dc3545 100%);
	color: white;
	box-shadow: 0 2px 8px rgba(220, 53, 69, .2);
}

.kw-bubble.kw-c4 {
	background: linear-gradient(135deg, #fd7e14 0%, #fd7e14 100%);
	color: white;
	box-shadow: 0 2px 8px rgba(253, 126, 20, .2);
}

.kw-bubble.kw-c5 {
	background: linear-gradient(135deg, #6f42c1 0%, #6f42c1 100%);
	color: white;
	box-shadow: 0 2px 8px rgba(111, 66, 193, .2);
}

.kw-bubble.kw-c6 {
	background: linear-gradient(135deg, #20c997 0%, #20c997 100%);
	color: white;
	box-shadow: 0 2px 8px rgba(32, 201, 151, .2);
}

.kw-bubble.kw-c7 {
	background: linear-gradient(135deg, #e83e8c 0%, #e83e8c 100%);
	color: white;
	box-shadow: 0 2px 8px rgba(232, 62, 140, .2);
}

.kw-bubble.kw-c8 {
	background: linear-gradient(135deg, #17a2b8 0%, #17a2b8 100%);
	color: white;
	box-shadow: 0 2px 8px rgba(23, 162, 184, .2);
}

.kw-bubble.kw-c9 {
	background: linear-gradient(135deg, #ffc107 0%, #ffc107 100%);
	color: #212529;
	box-shadow: 0 2px 8px rgba(255, 193, 7, .2);
}

.kw-bubble.kw-c10 {
	background: linear-gradient(135deg, #00bcd4 0%, #00bcd4 100%);
	color: white;
	box-shadow: 0 2px 8px rgba(0, 188, 212, .2);
}

.kw-bubble:hover {
	filter: brightness(1.08) drop-shadow(0 4px 12px rgba(0, 0, 0, .15));
	transform: scale(1.06) translateY(-2px);
}

.kw-bubble .kw-count {
	font-family: var(--font-mono);
	background: rgba(0, 0, 0, .15);
	border-radius: 99px;
	line-height: 1;
}

/* ══════════════════════════════════════════════════
   INSTITUTION TREEMAP
══════════════════════════════════════════════════ */
.treemap-grid {
	display: grid;
	grid-template-columns: repeat(12, 1fr);
	grid-auto-rows: 16px;
	gap: 4px;
	padding: 20px 22px 22px;
}

.treemap-cell {
	border-radius: var(--radius-sm);
	display: flex;
	flex-direction: column;
	justify-content: center;
	padding: 8px 10px;
	cursor: pointer;
	overflow: hidden;
	transition: filter var(--transition), transform var(--transition);
	position: relative;
}

.treemap-cell:hover {
	filter: brightness(1.08);
	transform: scale(1.015);
	z-index: 1;
}

.treemap-cell-name {
	font-size: 11px;
	font-weight: 700;
	color: white;
	line-height: 1.2;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.treemap-cell-val {
	font-family: var(--font-mono);
	font-size: 10px;
	font-weight: 700;
	color: rgba(255, 255, 255, .7);
	margin-top: 2px;
}

/* ══════════════════════════════════════════════════
   MINI STAT TABLES (inside panels)
══════════════════════════════════════════════════ */
.mini-stat-table {
	width: 100%;
}

.mini-stat-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 7px 0;
	border-bottom: 1px solid var(--gray-100);
}

.mini-stat-row:last-child {
	border-bottom: none;
}

.mini-stat-rank {
	font-family: var(--font-mono);
	font-size: 10.5px;
	font-weight: 700;
	color: var(--gray-400);
	min-width: 18px;
}

.mini-stat-rank.gold {
	color: #f59e0b;
}

.mini-stat-rank.silver {
	color: #94a3b8;
}

.mini-stat-rank.bronze {
	color: #b45309;
}

.mini-stat-label {
	flex: 1;
	font-size: 12.5px;
	color: var(--gray-700);
	font-weight: 500;
}

.mini-stat-bar-wrap {
	width: 80px;
	height: 6px;
	background: var(--gray-100);
	border-radius: 99px;
	overflow: hidden;
}

.mini-stat-bar {
	height: 100%;
	border-radius: 99px;
	background: var(--blue);
	transition: width 1s ease;
}

.mini-stat-val {
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 700;
	color: var(--blue);
	min-width: 40px;
	text-align: right;
}

/* ── Country row ── */
.country-row {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 0;
	border-bottom: 1px solid var(--gray-100);
}

.country-row:last-child {
	border-bottom: none;
}

.country-flag-cell {
	font-size: 18px;
	flex-shrink: 0;
	line-height: 1;
}

.country-name-cell {
	flex: 1;
	font-size: 13px;
	font-weight: 600;
	color: var(--gray-700);
}

.country-bar-wrap {
	width: 100px;
	height: 6px;
	background: var(--gray-100);
	border-radius: 99px;
	overflow: hidden;
}

.country-bar {
	height: 100%;
	border-radius: 99px;
	background: var(--blue);
}

.country-val-cell {
	font-family: var(--font-mono);
	font-size: 12px;
	font-weight: 700;
	color: var(--blue);
	min-width: 32px;
	text-align: right;
}

/* ══════════════════════════════════════════════════
   METRIC HIGHLIGHT STRIP
══════════════════════════════════════════════════ */
.metric-highlight-strip {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 0;
	background: var(--gray-50);
	border-top: 1px solid var(--gray-100);
}

.mh-item {
	padding: 14px 20px;
	text-align: center;
	border-right: 1px solid var(--gray-100);
}

.mh-item:last-child {
	border-right: none;
}

.mh-num {
	font-family: var(--font-mono);
	font-size: 18px;
	font-weight: 700;
	color: var(--blue);
	letter-spacing: -0.5px;
	line-height: 1;
}

.mh-label {
	font-size: 10px;
	text-transform: uppercase;
	letter-spacing: 0.6px;
	color: var(--gray-400);
	font-weight: 600;
	margin-top: 3px;
}

/* ══════════════════════════════════════════════════
   INSIGHT CALLOUT
══════════════════════════════════════════════════ */
.insight-callout {
	background: var(--blue-xlight);
	border: 1.5px solid var(--blue-light);
	border-radius: var(--radius-md);
	padding: 14px 18px;
	display: flex;
	align-items: flex-start;
	gap: 12px;
	margin-top: 16px;
}

.insight-callout svg {
	width: 18px;
	height: 18px;
	color: var(--blue);
	flex-shrink: 0;
	margin-top: 1px;
}

.insight-callout p {
	font-size: 13px;
	color: var(--blue-deeper);
	margin: 0;
	line-height: 1.55;
}

.insight-callout strong {
	font-weight: 700;
}

/* ══════════════════════════════════════════════════
   ANALYTICS CONTENT AREA
══════════════════════════════════════════════════ */
.analytics-body {
	background: var(--gray-50);
	min-height: 100vh;
	padding: 28px 0 60px;
}

/* anchor scrolling offset */
.section-anchor {
	padding-top: 24px;
}

/* ══════════════════════════════════════════════════
   RESPONSIVE
══════════════════════════════════════════════════ */
@media (max-width: 1199.98px) {
	.kpi-grid {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 991.98px) {
	.analytics-nav {
		position: static;
	}

	.kpi-grid {
		grid-template-columns: repeat(2, 1fr);
	}

	.metric-highlight-strip {
		grid-template-columns: repeat(2, 1fr);
	}

	.mh-item:nth-child(2) {
		border-right: none;
	}

	.mh-item:nth-child(3) {
		border-top: 1px solid var(--gray-100);
	}

	.treemap-grid {
		grid-template-columns: repeat(6, 1fr);
	}
}

@media (max-width: 767.98px) {
	.analytics-header {
		padding: 28px 0 24px;
	}

	.kpi-grid {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}

	.anav-btn {
		padding: 12px 12px;
		font-size: 12px;
	}

	.chart-panel-header {
		flex-direction: column;
		align-items: flex-start;
	}

	.chart-h-360 {
		height: 260px;
	}

	.chart-h-400 {
		height: 300px;
	}

	.treemap-grid {
		grid-template-columns: repeat(4, 1fr);
	}
}

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

	.kpi-num {
		font-size: 20px;
	}

	.metric-highlight-strip {
		grid-template-columns: repeat(2, 1fr);
	}
}