/**
 * Elementor Hub Stats — base layout.
 * Visual styling comes from Elementor controls; this file only provides
 * structure and fallbacks (single source: the block below).
 */

.irhub-stats {
	position: relative;

	/* Fallbacks (Elementor-generated control CSS overrides these). */
	--irhub-stats-gap: 24px;
	--irhub-stat-angle: 135deg;
	--irhub-sep-color: #DCE4EE;
	--irhub-sep-width: 1px;
	--irhub-stat-valign: center;
	--irhub-stat-item-gap: 14px;
	--irhub-stat-body-gap: 4px;
}

.irhub-stats-grid {
	display: grid;
	gap: var(--irhub-stats-gap);
	grid-template-columns: repeat(auto-fit, minmax(min(100%, 240px), 1fr));
}

.irhub-stat {
	display: flex;
	/* Vertical alignment follows the «تراز عمودی آیتم‌ها» control. In the
	 * column layout the same variable feeds justify-content instead (see
	 * item_layout’s selector), where it is the vertical axis. */
	align-items: var(--irhub-stat-valign);
	gap: var(--irhub-stat-item-gap);
	box-sizing: border-box;
	padding: 16px;
	background-color: transparent;
	border: 0 solid #E6EBF2;
	border-style: solid;
	border-radius: 16px;
	transition: box-shadow 0.2s ease, background-color 0.2s ease;
}

.irhub-stat-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	/* Anchor for the gradient-border ::before (گرادیان حاشیه آیکون). */
	position: relative;
	/* The border control draws INSIDE the box — the circle keeps its size. */
	box-sizing: border-box;
	width: 58px;
	height: 58px;
	font-size: 26px;
	line-height: 1;
	background-color: #EEF6F1;
	border-radius: 50%;
	overflow: hidden;
	/* The box becomes a container so the glyph can scale with it (cqw). */
	container-type: inline-size;
}

/* Glyph size = 45% of the icon box, so it follows the box in any unit
 * (px stays identical to the emitted font-size; % scales with the card). */
.irhub-stat-icon > * {
	font-size: 45cqw;
}

.irhub-stat-icon svg {
	display: block;
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.irhub-stat-icon i {
	line-height: 1;
}

.irhub-stat-icon img {
	display: block;
	width: 60%;
	/* Square box keeps the icon inside the circle in every sizing mode. */
	height: auto;
	aspect-ratio: 1;
	object-fit: contain;
}

/* --------------------------------------------------------------------
 * Per-metric gradients (inline styles are emitted by the widget)
 * ------------------------------------------------------------------ */

/* Uploaded SVG served as <img>: hide it and paint a masked pseudo-element. */
.irhub-stat-icon.img-gradient {
	position: relative;
}

.irhub-stat-icon.img-gradient img {
	visibility: hidden;
}

.irhub-stat-icon.img-gradient::after {
	content: '';
	position: absolute;
	/* Matches the centred 60% box of the hidden <img>. */
	inset: 20%;
	background-image: var(--irhub-img-grad, none);
	-webkit-mask-image: var(--irhub-img-src);
	mask-image: var(--irhub-img-src);
	-webkit-mask-repeat: no-repeat;
	mask-repeat: no-repeat;
	-webkit-mask-position: center;
	mask-position: center;
	-webkit-mask-size: contain;
	mask-size: contain;
}

/* Inline <svg> icon: point its paint at the per-row gradient def. */
.irhub-stat-icon.svg-gradient svg,
.irhub-stat-icon.svg-gradient svg * {
	fill: var(--irhub-svg-grad, currentColor);
}

/* Font icon: the glyph keeps the gradient in ITS OWN box (the class arrives
 * with the inline --irhub-fg var), so background-clip:text never touches
 * .irhub-stat-icon — otherwise it clips the circle's background-color away
 * and «رنگ پس‌زمینه آیکون» stops working whenever a gradient is on. */
.irhub-stat-icon.font-gradient > * {
	background-image: var(--irhub-fg, none);
	-webkit-background-clip: text;
	background-clip: text;
	-webkit-text-fill-color: transparent;
}

.irhub-stat-grad-def {
	position: absolute;
	width: 0;
	height: 0;
	overflow: hidden;
	pointer-events: none;
}

.irhub-stat-body {
	display: flex;
	flex-direction: column;
	gap: var(--irhub-stat-body-gap);
	min-width: 0;
}

.irhub-stat-label {
	font-size: 14px;
	line-height: 1.5;
	color: #69788A;
	overflow-wrap: anywhere;
}

.irhub-stat-value {
	font-size: 30px;
	font-weight: 700;
	line-height: 1.2;
	color: #1F8A4C;
	font-variant-numeric: tabular-nums;
}

.irhub-stats-foot {
	margin-top: 16px;
}

.irhub-stats-chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	box-sizing: border-box;
	padding: 6px 14px;
	background-color: #E7F6EC;
	color: #1B7F4C;
	border-radius: 100px;
	font-size: 14px;
	line-height: 1.6;
}

.irhub-stats-chip[hidden] {
	display: none !important;
}

.irhub-stats-chip-name {
	font-weight: 700;
}

.irhub-stats-reset {
	border: 0;
	background-color: #FFFFFF;
	color: inherit;
	border-radius: 100px;
	padding: 4px 12px;
	font-size: 13px;
	line-height: 1.6;
	cursor: pointer;
	transition: background-color 0.15s ease, opacity 0.15s ease;
}

.irhub-stats-reset:hover {
	opacity: 0.8;
}

.irhub-stats-reset[hidden] {
	display: none !important;
}
