.ids-widget {
	max-width: 980px;
	margin: 2em auto;
	font-family: inherit;
}

.ids-title {
	text-align: center;
	margin-bottom: 1em;
	font-size: 1.6em;
	font-weight: 700;
	color: #111827;
}

.ids-status {
	text-align: center;
	padding: 1em;
	color: #6b7280;
	font-style: italic;
}

/* Highlight badges (e.g. "5 new listings this week") */
.ids-badges {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 0.6em;
	margin-bottom: 1.25em;
	min-height: 0;
}

.ids-badge {
	display: inline-block;
	background: linear-gradient(135deg, #2563eb, #1d4ed8);
	color: #fff;
	font-size: 0.85em;
	font-weight: 600;
	padding: 0.5em 1.1em;
	border-radius: 999px;
	box-shadow: 0 4px 10px rgba(37, 99, 235, 0.25);
}

.ids-body {
	transition: opacity 0.3s ease;
}

.ids-body-ready {
	opacity: 1;
}

/* Core stat cards */
.ids-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1em;
	margin-bottom: 1.5em;
}

.ids-stat {
	position: relative;
	background: #ffffff;
	border: 1px solid #e5e7eb;
	border-radius: 14px;
	padding: 1.25em 0.85em;
	text-align: center;
	box-shadow: 0 1px 2px rgba(16, 24, 40, 0.04);
	transition: transform 0.2s ease, box-shadow 0.2s ease;
	overflow: hidden;
}

.ids-stat:hover {
	transform: translateY(-3px);
	box-shadow: 0 10px 20px rgba(16, 24, 40, 0.08);
}

.ids-stat::before {
	content: '';
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	height: 3px;
	background: linear-gradient(90deg, #2563eb, #60a5fa);
	opacity: 0.9;
}

.ids-stat--extra::before {
	background: linear-gradient(90deg, #9333ea, #c084fc);
}

/* Cards that become clickable once we know a URL (Listings, Highest, Lowest) */
.ids-stat--has-link {
	padding: 0;
}

.ids-stat-link {
	display: block;
	padding: 1.25em 0.85em;
	color: inherit;
	text-decoration: none;
}

.ids-stat--has-link:hover {
	border-color: #93c5fd;
}

.ids-stat--has-link .ids-stat-value {
	position: relative;
}

.ids-stat--has-link:hover .ids-stat-value {
	color: #2563eb;
}

.ids-stat--has-link::after {
	content: '↗';
	position: absolute;
	top: 0.6em;
	right: 0.8em;
	font-size: 0.85em;
	color: #93a3b8;
	opacity: 0;
	transition: opacity 0.15s ease;
}

.ids-stat--has-link:hover::after {
	opacity: 1;
}

.ids-stat-icon {
	display: block;
	font-size: 1.3em;
	margin-bottom: 0.3em;
	opacity: 0.75;
}

.ids-stat-value {
	display: block;
	font-size: 1.55em;
	font-weight: 800;
	color: #111827;
	line-height: 1.2;
	letter-spacing: -0.01em;
}

.ids-stat-label {
	display: block;
	margin-top: 0.4em;
	font-size: 0.78em;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #6b7280;
	font-weight: 600;
}

/* Extra (optional) stat cards get their own row so the core five stay a
   clean, predictable grid regardless of which extra fields exist */
.ids-extra-stats-grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 1em;
	margin-bottom: 1.5em;
}

.ids-extra-stats-grid:empty {
	display: none;
	margin: 0;
}

/* Price range gauge */
.ids-price-gauge {
	margin: 0 auto 2em;
	max-width: 640px;
}

.ids-gauge-track {
	position: relative;
	height: 10px;
	border-radius: 999px;
	background: #eef0f3;
	overflow: visible;
}

.ids-gauge-fill {
	position: absolute;
	top: 0;
	left: 0;
	height: 100%;
	width: 0;
	border-radius: 999px;
	background: linear-gradient(90deg, #16a34a, #2563eb);
	transition: width 1s cubic-bezier(.22,.9,.34,1);
}

.ids-gauge-marker {
	position: absolute;
	top: 50%;
	left: 0;
	width: 14px;
	height: 14px;
	border-radius: 50%;
	background: #111827;
	border: 3px solid #fff;
	box-shadow: 0 0 0 1px rgba(0,0,0,0.15);
	transform: translate(-50%, -50%);
	transition: left 1s cubic-bezier(.22,.9,.34,1);
}

.ids-gauge-labels {
	display: flex;
	justify-content: space-between;
	margin-top: 0.6em;
	font-size: 0.82em;
	color: #6b7280;
}

.ids-gauge-mid {
	font-weight: 700;
	color: #111827;
}

/* Donut + legend */
.ids-chart-wrap {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: center;
	gap: 2.5em;
	padding-top: 0.5em;
}

.ids-chart-wrap + .ids-chart-wrap {
	margin-top: 1.5em;
	padding-top: 1.75em;
	border-top: 1px solid #eef0f3;
}

.ids-donut-figure {
	position: relative;
	width: 220px;
	height: 220px;
	flex-shrink: 0;
}

.ids-donut-svg {
	width: 100%;
	height: 100%;
	display: block;
}

.ids-donut-center {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	text-align: center;
	pointer-events: none;
}

.ids-donut-center-value {
	display: block;
	font-size: 2em;
	font-weight: 800;
	color: #111827;
	line-height: 1;
}

.ids-donut-center-label {
	display: block;
	margin-top: 0.25em;
	font-size: 0.75em;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #6b7280;
}

.ids-donut-segment {
	cursor: default;
}

.ids-donut-segment--linked {
	cursor: pointer;
}

.ids-legend-item--linked {
	position: relative;
}

.ids-legend-link {
	display: contents;
	color: inherit;
	text-decoration: none;
	cursor: pointer;
}

.ids-legend-item--linked:hover .ids-legend-label {
	color: #2563eb;
	text-decoration: underline;
}

.ids-legend-wrap {
	min-width: 220px;
	flex: 1 1 240px;
	max-width: 340px;
}

.ids-legend-heading {
	display: block;
	font-size: 0.78em;
	text-transform: uppercase;
	letter-spacing: 0.05em;
	color: #9ca3af;
	font-weight: 700;
	margin-bottom: 0.75em;
}

.ids-legend {
	list-style: none;
	margin: 0;
	padding: 0;
}

.ids-legend-item {
	display: grid;
	grid-template-columns: 12px 1fr auto;
	align-items: center;
	column-gap: 0.6em;
	margin-bottom: 0.85em;
	font-size: 0.92em;
}

.ids-swatch {
	display: inline-block;
	width: 12px;
	height: 12px;
	border-radius: 3px;
	flex-shrink: 0;
}

.ids-legend-label {
	color: #374151;
	font-weight: 600;
}

.ids-legend-value {
	color: #6b7280;
	font-variant-numeric: tabular-nums;
	white-space: nowrap;
}

.ids-legend-bar {
	grid-column: 2 / span 2;
	display: block;
	height: 6px;
	border-radius: 999px;
	background: #eef0f3;
	overflow: hidden;
	margin-top: 0.35em;
}

.ids-legend-bar-fill {
	display: block;
	height: 100%;
	width: 0;
	border-radius: 999px;
	transition: width 0.8s cubic-bezier(.22,.9,.34,1);
}

@media (max-width: 640px) {
	.ids-stats-grid,
	.ids-extra-stats-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.ids-chart-wrap {
		flex-direction: column;
	}
	.ids-legend-wrap {
		max-width: 100%;
		width: 100%;
	}
}
