/**
 * Category Tiles Styles
 *
 * @package SiteWidgets
 */

/* ── Grid ─────────────────────────────────────────────────────────── */

.cattiles {
	--cattiles-cols: 3;
	--cattiles-cols-tablet: 2;
	--cattiles-cols-mobile: 1;
	display: grid;
	grid-template-columns: repeat(var(--cattiles-cols), 1fr);
	gap: 16px;
	align-items: stretch;
}

@media (max-width: 575.98px) {
	.cattiles {
		grid-template-columns: repeat(var(--cattiles-cols-mobile), 1fr);
		gap: 12px;
	}
}

@media (min-width: 576px) and (max-width: 991.98px) {
	.cattiles {
		grid-template-columns: repeat(var(--cattiles-cols-tablet), 1fr);
	}
}

/* ── Tile ─────────────────────────────────────────────────────────── */

.cattile {
	background: #fff;
	border: 1px solid #dce5f0;
	border-radius: 12px;
	padding: 18px 20px 16px;
}

/* ── Tile header ──────────────────────────────────────────────────── */

.cattile-head {
	display: flex;
	align-items: center;
	gap: 10px;
	margin-bottom: 12px;
	padding-bottom: 12px;
	border-bottom: 1px solid #edf1f8;
}

.cattile-ico {
	width: 28px;
	height: 28px;
	flex: 0 0 28px;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cattile-ico img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	filter: grayscale(1) contrast(1.1);
	opacity: 0.62;
}

.cattile-title {
	font-size: 15px;
	font-weight: 700;
	line-height: 1.3;
	color: #1464d8;
	text-decoration: none;
	word-break: break-word;
}

a.cattile-title:hover {
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ── Tile body (children) ─────────────────────────────────────────── */

.cattile-body {
	font-size: 13px;
	line-height: 1.75;
	color: #5a6478;
	word-break: break-word;
}

a.cattile-child {
	color: #1464d8;
	text-decoration: none;
	font-size: 13px;
	line-height: inherit;
}

a.cattile-child:hover {
	text-decoration: underline;
	text-underline-offset: 2px;
}

.cattile-sep {
	color: #b8c6d8;
	font-size: 11px;
	user-select: none;
}

/* ── Deep mode (level > 1) ────────────────────────────────────────── */

/* L2 children: normal blue link */
a.cattile-child--d1 {
	font-weight: 500;
}

/* L3+ children: slightly smaller and muted */
a.cattile-child--d2,
a.cattile-child--d3,
a.cattile-child--d4 {
	font-size: 12px;
	color: #3a7bd5;
	opacity: 0.88;
}

/* In deep mode, each depth-group line-break adds visible spacing */
.cattiles--deep .cattile-body br {
	display: block;
	content: '';
	margin-top: 4px;
}

/* ── Current page item (non-clickable) ───────────────────────────── */

span.cattile-child--current {
	color: #1a2540;
	font-weight: 600;
	cursor: default;
}

span.cattile-title--current {
	color: #1a2540;
	font-weight: 700;
	cursor: default;
}

/* ── Inline expand button ("all N") ──────────────────────────────── */

.cattile-expand {
	background: none;
	border: none;
	padding: 0;
	margin: 0;
	cursor: pointer;
	color: #7a90b0;
	font-size: 12px;
	font-weight: 500;
	font-family: inherit;
	line-height: inherit;
	white-space: nowrap;
}

.cattile-expand:hover {
	color: #1464d8;
	text-decoration: underline;
	text-underline-offset: 2px;
}

/* ── AJAX wrapper ─────────────────────────────────────────────────── */

.cattiles-ajax-wrap {
	display: block;
}

.cattiles-ajax-content:empty {
	display: none;
}

/* ── AJAX button ──────────────────────────────────────────────────── */

.cattiles-btn {
	display: inline-flex;
	align-items: center;
	gap: 9px;
	padding: 12px 28px;
	font-size: 14px;
	font-weight: 600;
	color: #fff;
	background: #141b2d;
	border: none;
	border-radius: 8px;
	cursor: pointer;
	letter-spacing: 0.01em;
	line-height: 1.4;
	transition: background 0.15s ease, box-shadow 0.15s ease;
	box-shadow: 0 2px 8px rgba(0,0,0,0.18);
}

.cattiles-btn:hover {
	background: #1e2a42;
	box-shadow: 0 4px 14px rgba(0,0,0,0.22);
}

.cattiles-btn:active {
	background: #0e1422;
	box-shadow: none;
}

.cattiles-btn:disabled {
	opacity: 0.6;
	cursor: default;
	box-shadow: none;
}

.cattiles-btn.is-loading::after {
	content: '';
	display: inline-block;
	width: 14px;
	height: 14px;
	border: 2px solid rgba(255,255,255,0.5);
	border-top-color: #fff;
	border-radius: 50%;
	animation: cattiles-spin 0.55s linear infinite;
}

@keyframes cattiles-spin {
	to { transform: rotate(360deg); }
}
