/**
 * Shortcode: Asociaciones Federadas PIMEM
 * Uso: [pimem_asociaciones] + [pimem_asociaciones_sectores]
 * Scope: #asoc-sc, .asoc-sector-grid
 *
 * @package Astra Child
 */

/* ─── Variables locales ─────────────────────────────────────────── */
#asoc-sc {
	--asoc-red:    var(--isla-red, #e8312b);
	--asoc-ink:    var(--isla-ink, #17171c);
	--asoc-gray:   var(--isla-gray, #5c5c66);
	--asoc-muted:  var(--isla-muted, #85858f);
	--asoc-line:   var(--isla-line, #e7e7ec);
	--asoc-soft:   var(--isla-soft, #f4f4f6);

	font-family: var(--isla-font-primary, 'Poppins', sans-serif);
	color: var(--asoc-ink);
	line-height: 1.6;
}

#asoc-sc *,
.asoc-sector-grid * {
	box-sizing: border-box;
}

/* ─── Reset headings ────────────────────────────────────────────── */
#asoc-sc h3 {
	letter-spacing: -0.02em;
	line-height: 1.2;
	margin: 0;
	font-family: var(--isla-font-primary, 'Poppins', sans-serif) !important;
}

/* ─── Shell (container principal) ───────────────────────────────── */
.asoc-shell {
	background: #fff;
	border: 1px solid var(--asoc-line);
	border-radius: 8px;
	overflow: hidden;
}

/* ─── Toolbar (buscador + chips) ────────────────────────────────── */
.asoc-toolbar {
	display: grid;
	grid-template-columns: minmax(240px, 420px) 1fr;
	gap: 16px;
	align-items: start;
	padding: 22px;
	border-bottom: 1px solid var(--asoc-line);
	background: #fff;
}

/* ─── Searchbox ─────────────────────────────────────────────────── */
.asoc-searchbox {
	position: relative;
	display: block;
}

.asoc-searchbox input {
	width: 100%;
	border: 1px solid var(--asoc-line);
	border-radius: 999px;
	padding: 14px 18px 14px 45px;
	font-size: 14px;
	font-family: inherit;
	color: var(--asoc-ink);
	outline: 0;
	background: #fafafa;
}

.asoc-searchbox input:focus {
	border-color: var(--asoc-red);
	background: #fff;
	box-shadow: 0 0 0 4px rgba(232, 49, 43, 0.1);
}

.asoc-searchbox svg {
	position: absolute;
	left: 17px;
	top: 50%;
	transform: translateY(-50%);
	color: var(--asoc-muted);
	display: block;
}

/* ─── Chips de sector ───────────────────────────────────────────── */
.asoc-chips {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	justify-content: flex-end;
}

.asoc-chip {
	border: 1px solid var(--asoc-line);
	background: #fff;
	color: #34343c;
	border-radius: 999px;
	padding: 9px 13px;
	font-size: 12px;
	font-weight: 800;
	font-family: inherit;
	cursor: pointer;
	transition: all 0.16s ease;
	line-height: 1.1;
}

.asoc-chip:hover,
.asoc-chip.active {
	border-color: var(--asoc-red);
	color: var(--asoc-red);
	background: #fff5f4;
}

/* ─── Meta bar ──────────────────────────────────────────────────── */
.asoc-meta {
	display: flex;
	justify-content: space-between;
	gap: 16px;
	align-items: center;
	padding: 18px 22px;
	border-bottom: 1px solid var(--asoc-line);
	background: #fafafa;
	color: var(--asoc-gray);
	font-size: 13px;
}

.asoc-meta b {
	color: var(--asoc-ink);
}

/* ─── Grid de asociaciones ──────────────────────────────────────── */
.asoc-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 0;
}

.asoc-card {
	border-right: 1px solid var(--asoc-line);
	border-bottom: 1px solid var(--asoc-line);
	padding: 20px;
	min-height: 178px;
	display: flex;
	flex-direction: column;
	gap: 14px;
	position: relative;
	background: #fff;
	transition: background 0.18s ease;
}

.asoc-card:nth-child(3n) {
	border-right: 0;
}

.asoc-card:hover {
	background: #fafafa;
}

.asoc-card h3 {
	font-size: 16px;
	font-weight: 900;
	letter-spacing: -0.38px;
	line-height: 1.25;
}

/* ─── Badges ────────────────────────────────────────────────────── */
.asoc-row {
	display: flex;
	gap: 8px;
	flex-wrap: wrap;
	margin-top: auto;
}

.asoc-badge {
	display: inline-flex;
	align-items: center;
	border-radius: 999px;
	padding: 6px 9px;
	font-size: 11px;
	font-weight: 900;
	line-height: 1.1;
	border: 1px solid var(--asoc-line);
	color: #4b4b55;
	background: #fff;
}

.asoc-badge--red {
	background: #fdeceb;
	color: var(--asoc-red);
	border-color: #f7c8c5;
}

/* ─── Links / No-web ────────────────────────────────────────────── */
.asoc-link {
	color: var(--asoc-red);
	font-size: 12px;
	font-weight: 900;
	text-decoration: none;
	margin-top: 2px;
}

.asoc-link:hover {
	text-decoration: underline;
}

.asoc-noweb {
	color: var(--asoc-muted);
	font-size: 12px;
	font-weight: 800;
	margin-top: 2px;
}

/* ─── Empty state ───────────────────────────────────────────────── */
.asoc-empty {
	padding: 42px;
	text-align: center;
	color: var(--asoc-gray);
	display: none;
}

/* ═══════════════════════════════════════════════════════════════════
 * Shortcode [pimem_asociaciones_sectores]
 * Grid de tarjetas contador por sector
 * ═══════════════════════════════════════════════════════════════════ */

.asoc-sector-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 14px;
}

.asoc-sector-card {
	background: #fff;
	border: 1px solid var(--isla-line, #e7e7ec);
	border-radius: 8px;
	padding: 22px;
	min-height: 146px;
}

.asoc-sector-card b {
	display: block;
	color: var(--isla-red, #e8312b);
	font-size: 26px;
	font-weight: 900;
	letter-spacing: -0.8px;
}

.asoc-sector-card h3 {
	font-size: 16px;
	font-weight: 900;
	letter-spacing: -0.35px;
	margin-top: 7px;
	line-height: 1.2;
	font-family: var(--isla-font-primary, 'Poppins', sans-serif) !important;
}

.asoc-sector-card p {
	font-size: 12.5px;
	color: var(--isla-gray, #5c5c66);
	margin: 7px 0 0;
}

/* ─── Responsive ────────────────────────────────────────────────── */
@media (max-width: 1100px) {
	.asoc-toolbar {
		grid-template-columns: 1fr;
	}

	.asoc-chips {
		justify-content: flex-start;
	}

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

	.asoc-card:nth-child(3n) {
		border-right: 1px solid var(--asoc-line);
	}

	.asoc-card:nth-child(2n) {
		border-right: 0;
	}

	.asoc-sector-grid {
		grid-template-columns: 1fr 1fr;
	}
}

@media (max-width: 720px) {
	.asoc-grid,
	.asoc-sector-grid {
		grid-template-columns: 1fr;
	}

	.asoc-card {
		border-right: 0 !important;
		border-bottom: 1px solid var(--asoc-line) !important;
	}

	.asoc-card:last-child {
		border-bottom: 0 !important;
	}

	.asoc-meta {
		align-items: flex-start;
		flex-direction: column;
	}
}
