/* Site Pulse Dashboard */

.wpsp-wrap {
	max-width: 1200px;
	margin: 20px auto 0;
}

/* ===== Level 1: Hero Banner ===== */
.wpsp-hero {
	display: flex;
	justify-content: center;
	padding: 32px;
	margin: 24px 0 28px;
}

.wpsp-hero__indicator {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
}

.wpsp-hero__dot {
	display: block;
	width: 64px;
	height: 64px;
	border-radius: 50%;
}

.wpsp-hero__dot--green {
	background: #00a32a;
	box-shadow: 0 0 0 8px rgba(0, 163, 42, 0.15), 0 0 0 16px rgba(0, 163, 42, 0.06);
}

.wpsp-hero__dot--yellow {
	background: #dba617;
	box-shadow: 0 0 0 8px rgba(219, 166, 23, 0.15), 0 0 0 16px rgba(219, 166, 23, 0.06);
}

.wpsp-hero__dot--red {
	background: #d63638;
	box-shadow: 0 0 0 8px rgba(214, 54, 56, 0.15), 0 0 0 16px rgba(214, 54, 56, 0.06);
	animation: wpsp-pulse 2s ease-in-out infinite;
}

@keyframes wpsp-pulse {
	0%, 100% { box-shadow: 0 0 0 8px rgba(214, 54, 56, 0.15), 0 0 0 16px rgba(214, 54, 56, 0.06); }
	50% { box-shadow: 0 0 0 12px rgba(214, 54, 56, 0.2), 0 0 0 24px rgba(214, 54, 56, 0.08); }
}

/* ===== Level 2: Pillars ===== */
.wpsp-pillars {
	display: grid;
	grid-template-columns: 1fr 1fr;
	gap: 20px;
	margin-bottom: 32px;
}

.wpsp-pillar {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 8px;
	padding: 24px;
	border-top: 4px solid #c3c4c7;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.06);
}

.wpsp-pillar--green { border-top-color: #00a32a; }
.wpsp-pillar--yellow { border-top-color: #dba617; }
.wpsp-pillar--red { border-top-color: #d63638; }

.wpsp-pillar__header {
	display: flex;
	align-items: center;
	gap: 12px;
	margin-bottom: 20px;
}

.wpsp-pillar__dot {
	display: block;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	flex-shrink: 0;
}

.wpsp-pillar__dot--green {
	background: #00a32a;
	box-shadow: 0 0 0 3px rgba(0, 163, 42, 0.2);
}

.wpsp-pillar__dot--yellow {
	background: #dba617;
	box-shadow: 0 0 0 3px rgba(219, 166, 23, 0.2);
}

.wpsp-pillar__dot--red {
	background: #d63638;
	box-shadow: 0 0 0 3px rgba(214, 54, 56, 0.2);
}

.wpsp-pillar__title {
	font-size: 15px;
	font-weight: 600;
	color: #1d2327;
}

.wpsp-pillar__metrics {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.wpsp-metric {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 10px 14px;
	background: #f6f7f7;
	border-radius: 6px;
}

.wpsp-metric__label {
	font-size: 13px;
	color: #50575e;
}

.wpsp-metric__value {
	font-size: 15px;
	font-weight: 600;
	font-variant-numeric: tabular-nums;
}

.wpsp-metric__value--green { color: #00a32a; }
.wpsp-metric__value--yellow { color: #996800; }
.wpsp-metric__value--red { color: #d63638; }

/* ===== Level 3: Group Headings ===== */
.wpsp-group-heading {
	font-size: 15px;
	font-weight: 600;
	color: #50575e;
	text-transform: uppercase;
	letter-spacing: 0.8px;
	margin: 32px 0 16px;
	padding-bottom: 8px;
	border-bottom: 2px solid #dcdcde;
}

/* ---- Sections ---- */
.wpsp-section {
	background: #fff;
	border: 1px solid #c3c4c7;
	border-radius: 8px;
	padding: 24px;
	margin-bottom: 20px;
	box-shadow: 0 1px 1px rgba(0, 0, 0, 0.04);
}

.wpsp-section h3 {
	margin: 0 0 16px;
	padding: 0;
	font-size: 15px;
	color: #1d2327;
}

.wpsp-section--compact {
	padding: 20px 24px;
}

.wpsp-section__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 16px;
}

.wpsp-section__header h3 {
	margin-bottom: 0;
}

/* ---- Range Toggle ---- */
.wpsp-range-toggle {
	display: flex;
	gap: 4px;
	background: #f0f0f1;
	border-radius: 4px;
	padding: 2px;
}

.wpsp-range-btn {
	padding: 4px 16px;
	border: none;
	border-radius: 3px;
	background: transparent;
	cursor: pointer;
	font-size: 13px;
	color: #50575e;
	font-weight: 500;
	transition: all 0.15s;
}

.wpsp-range-btn:hover {
	color: #1d2327;
}

.wpsp-range-btn--active {
	background: #fff;
	color: #2271b1;
	box-shadow: 0 1px 2px rgba(0, 0, 0, 0.1);
}

/* ---- Charts ---- */
.wpsp-chart-container {
	position: relative;
	height: 300px;
}

.wpsp-percentiles {
	margin-top: 12px;
	display: flex;
	gap: 24px;
	flex-wrap: wrap;
	font-size: 13px;
	color: #646970;
}

.wpsp-percentiles span {
	font-weight: 600;
	color: #1d2327;
}

/* ---- Saturation Panel ---- */
.wpsp-saturation {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(220px, 1fr));
	gap: 16px;
}

.wpsp-saturation__item {
	display: flex;
	flex-direction: column;
	padding: 16px;
	background: #f6f7f7;
	border-radius: 6px;
}

.wpsp-saturation__label {
	font-size: 12px;
	color: #646970;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
}

.wpsp-saturation__value {
	font-size: 20px;
	font-weight: 600;
	color: #1d2327;
	font-variant-numeric: tabular-nums;
}

/* ---- Info Tooltip ---- */
.wpsp-info {
	position: relative;
	display: inline-block;
	margin-left: 4px;
	vertical-align: middle;
	cursor: help;
}

.wpsp-info__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 16px;
	height: 16px;
	border-radius: 50%;
	border: 1.5px solid #8c8f94;
	color: #8c8f94;
	font-size: 10px;
	font-weight: 700;
	font-style: italic;
	font-family: Georgia, serif;
	line-height: 1;
	transition: border-color 0.15s, color 0.15s;
}

.wpsp-info:hover .wpsp-info__icon,
.wpsp-info:focus .wpsp-info__icon {
	border-color: #2271b1;
	color: #2271b1;
}

.wpsp-info__tooltip {
	display: none;
	position: absolute;
	bottom: calc(100% + 8px);
	left: 50%;
	transform: translateX(-50%);
	width: 280px;
	padding: 10px 12px;
	background: #1d2327;
	color: #fff;
	font-size: 12px;
	font-weight: 400;
	font-style: normal;
	line-height: 1.6;
	border-radius: 6px;
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.25);
	z-index: 100;
	pointer-events: none;
}

.wpsp-info__tooltip::after {
	content: "";
	position: absolute;
	top: 100%;
	left: 50%;
	transform: translateX(-50%);
	border: 6px solid transparent;
	border-top-color: #1d2327;
}

.wpsp-info:hover .wpsp-info__tooltip,
.wpsp-info:focus .wpsp-info__tooltip {
	display: block;
}

/* ---- Gauge Bar ---- */
.wpsp-gauge {
	width: 100%;
	height: 6px;
	background: #e0e0e0;
	border-radius: 3px;
	margin-top: 8px;
	overflow: hidden;
}

.wpsp-gauge__bar {
	height: 100%;
	border-radius: 3px;
	transition: width 0.4s ease;
}

.wpsp-gauge--green { background: #00a32a; }
.wpsp-gauge--yellow { background: #dba617; }
.wpsp-gauge--red { background: #d63638; }

/* ---- Tables ---- */
.wpsp-table {
	border-collapse: collapse;
}

.wpsp-table th {
	text-align: left;
	font-weight: 600;
}

.wpsp-nowrap {
	white-space: nowrap;
}

.wpsp-mono {
	font-family: Consolas, Monaco, monospace;
	font-size: 12px;
}

.wpsp-sql-short {
	cursor: help;
	max-width: 400px;
	display: inline-block;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	vertical-align: middle;
	font-family: Consolas, Monaco, monospace;
	font-size: 12px;
}

/* ---- Badges ---- */
.wpsp-badge {
	display: inline-block;
	padding: 2px 8px;
	border-radius: 10px;
	font-size: 11px;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.3px;
}

.wpsp-badge--page_down {
	background: #facfd2;
	color: #8a1e22;
}

.wpsp-badge--page_slow {
	background: #f5e6ab;
	color: #6e4e00;
}

.wpsp-badge--db_slow {
	background: #f5e6ab;
	color: #6e4e00;
}

.wpsp-badge--db_error {
	background: #facfd2;
	color: #8a1e22;
}

/* ---- Query Stats ---- */
.wpsp-query-stats {
	display: flex;
	align-items: center;
	gap: 32px;
	flex-wrap: wrap;
}

.wpsp-query-stats__total {
	display: flex;
	flex-direction: column;
	min-width: 120px;
}

.wpsp-query-stats__label {
	font-size: 12px;
	color: #646970;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin-bottom: 4px;
}

.wpsp-query-stats__value {
	font-size: 36px;
	font-weight: 700;
	line-height: 1;
	color: #1d2327;
	font-variant-numeric: tabular-nums;
}

.wpsp-query-stats__chart-wrap {
	width: 160px;
	height: 160px;
}

.wpsp-query-stats__breakdown {
	display: flex;
	flex-direction: column;
	gap: 8px;
	font-size: 13px;
	color: #1d2327;
	font-variant-numeric: tabular-nums;
}

.wpsp-dot {
	display: inline-block;
	width: 10px;
	height: 10px;
	border-radius: 50%;
	margin-right: 6px;
}

.wpsp-dot--select { background: #2271b1; }
.wpsp-dot--insert { background: #00a32a; }
.wpsp-dot--update { background: #dba617; }
.wpsp-dot--delete { background: #d63638; }

/* ---- URL List ---- */
.wpsp-url-list {
	list-style: none;
	margin: 0;
	padding: 0;
}

.wpsp-url-list__item {
	display: flex;
	align-items: center;
	gap: 8px;
	padding: 8px 12px;
	background: #f6f7f7;
	border-radius: 4px;
	margin-bottom: 6px;
	font-family: Consolas, Monaco, monospace;
	font-size: 13px;
}

.wpsp-url-list__item .dashicons {
	color: #2271b1;
}

/* ---- Misc ---- */
.wpsp-note {
	color: #646970;
	font-style: italic;
	font-size: 13px;
}

.wpsp-empty {
	color: #646970;
	font-style: italic;
}

/* ---- Responsive ---- */

/* Tablet & narrow desktop (WP admin collapses sidebar at 782px) */
@media (max-width: 782px) {
	.wpsp-wrap {
		margin: 10px 0 0;
	}

	.wpsp-pillars {
		grid-template-columns: 1fr;
		gap: 14px;
	}

	.wpsp-hero {
		padding: 24px;
		margin: 16px 0 20px;
	}

	.wpsp-hero__dot {
		width: 52px;
		height: 52px;
	}

	.wpsp-group-heading {
		margin: 24px 0 12px;
	}

	.wpsp-section {
		padding: 16px;
		margin-bottom: 14px;
		border-radius: 6px;
	}

	.wpsp-section--compact {
		padding: 14px 16px;
	}

	.wpsp-chart-container {
		height: 220px;
	}

	.wpsp-saturation {
		grid-template-columns: 1fr 1fr;
	}

	.wpsp-query-stats {
		gap: 20px;
	}

	.wpsp-query-stats__value {
		font-size: 28px;
	}

	.wpsp-query-stats__chart-wrap {
		width: 120px;
		height: 120px;
	}
}

/* Mobile — iPhone 12 (390px) and similar */
@media (max-width: 480px) {
	.wpsp-wrap {
		margin: 6px 6px 0;
	}

	/* WP admin adds 10px padding on #wpcontent; cancel excess */
	#wpcontent {
		padding-left: 0;
	}

	.wpsp-wrap > h1 {
		font-size: 18px;
	}

	/* Hero */
	.wpsp-hero {
		padding: 20px;
		margin: 12px 0 16px;
	}

	.wpsp-hero__dot {
		width: 44px;
		height: 44px;
	}

	/* Pillars */
	.wpsp-pillar {
		padding: 16px;
	}

	.wpsp-pillar__title {
		font-size: 14px;
	}

	.wpsp-metric {
		flex-direction: column;
		align-items: flex-start;
		gap: 2px;
		padding: 8px 12px;
	}

	.wpsp-metric__value {
		font-size: 14px;
	}

	/* Group headings */
	.wpsp-group-heading {
		font-size: 13px;
		margin: 20px 0 10px;
	}

	/* Sections */
	.wpsp-section {
		padding: 12px;
		border-radius: 6px;
		overflow: hidden;
	}

	.wpsp-section__header {
		flex-direction: column;
		align-items: flex-start;
		gap: 8px;
	}

	.wpsp-section h3 {
		font-size: 14px;
	}

	/* Charts */
	.wpsp-chart-container {
		height: 180px;
	}

	.wpsp-percentiles {
		flex-direction: column;
		gap: 4px;
		font-size: 12px;
	}

	/* Saturation */
	.wpsp-saturation {
		grid-template-columns: 1fr;
		gap: 10px;
	}

	.wpsp-saturation__item {
		padding: 12px;
	}

	.wpsp-saturation__value {
		font-size: 17px;
	}

	/* Tooltip — position below on mobile to avoid clipping */
	.wpsp-info__tooltip {
		position: fixed;
		bottom: auto;
		top: 50%;
		left: 50%;
		transform: translate(-50%, -50%);
		width: calc(100vw - 48px);
		max-width: 320px;
		z-index: 10000;
	}

	.wpsp-info__tooltip::after {
		display: none;
	}

	/* Tables — horizontal scroll */
	.wpsp-table {
		display: block;
		overflow-x: auto;
		-webkit-overflow-scrolling: touch;
		font-size: 12px;
	}

	.wpsp-table th,
	.wpsp-table td {
		padding: 6px 8px;
	}

	.wpsp-sql-short {
		max-width: 180px;
		font-size: 11px;
	}

	/* Query stats */
	.wpsp-query-stats {
		flex-direction: column;
		align-items: flex-start;
		gap: 16px;
	}

	.wpsp-query-stats__total {
		flex-direction: row;
		align-items: baseline;
		gap: 8px;
	}

	.wpsp-query-stats__value {
		font-size: 24px;
	}

	.wpsp-query-stats__chart-wrap {
		width: 100px;
		height: 100px;
	}

	/* URL list */
	.wpsp-url-list__item {
		font-size: 11px;
		padding: 6px 10px;
		word-break: break-all;
	}

	/* Badges */
	.wpsp-badge {
		font-size: 10px;
		padding: 2px 6px;
	}
}
