/* ==========================================================================
   Guía Construcción · Buscador AJAX
   ========================================================================== */
.gcb {
	--gcb-primary: #ff7438;
	--gcb-dark: #1f1f1f;
	--gcb-border: #e7e8ec;
	--gcb-muted: #9aa0a8;
	--gcb-soft: #f6f7f9;
	position: relative;
	width: 100%;
	max-width: 640px;
	margin: 0 auto;
	font-family: inherit;
	box-sizing: border-box;
}
.gcb *, .gcb *::before, .gcb *::after { box-sizing: border-box; }

/* Barra */
.gcb__bar {
	display: flex;
	align-items: center;
	gap: 10px;
	background: #fff;
	border: 1px solid var(--gcb-border);
	border-radius: 999px;
	padding: 6px 8px 6px 18px;
	box-shadow: 0 1px 2px rgba(16, 24, 40, .04);
	transition: border-color .15s, box-shadow .15s;
}
.gcb__bar:focus-within {
	border-color: var(--gcb-primary);
	box-shadow: 0 0 0 4px rgba(255, 116, 56, .12);
}
.gcb__search-icon { color: var(--gcb-muted); display: inline-flex; flex: none; }
.gcb__search-icon svg { width: 20px; height: 20px; }

.gcb__input {
	flex: 1 1 auto;
	border: 0;
	outline: 0;
	background: transparent;
	font-size: 15px;
	color: var(--gcb-dark);
	padding: 10px 0;
	min-width: 0;
}
.gcb__input::placeholder { color: var(--gcb-muted); }

/* Selector de región */
.gcb__region { position: relative; flex: none; }
.gcb__region-btn {
	display: inline-flex;
	align-items: center;
	gap: 7px;
	background: #fff;
	border: 1px solid var(--gcb-border);
	border-radius: 999px;
	padding: 9px 14px;
	cursor: pointer;
	font-size: 14px;
	color: var(--gcb-dark);
	white-space: nowrap;
	transition: border-color .15s, background .15s;
}
.gcb__region-btn:hover { border-color: #d7d9de; background: var(--gcb-soft); }
.gcb__pin { width: 16px; height: 16px; color: var(--gcb-primary); flex: none; }
.gcb__caret { width: 15px; height: 15px; color: var(--gcb-muted); flex: none; }
.gcb__region-label { max-width: 150px; overflow: hidden; text-overflow: ellipsis; }

/* Menú de región */
.gcb__region-menu {
	position: absolute;
	top: calc(100% + 8px);
	right: 0;
	z-index: 30;
	width: 260px;
	max-height: 320px;
	overflow-y: auto;
	background: #fff;
	border: 1px solid var(--gcb-border);
	border-radius: 14px;
	box-shadow: 0 12px 30px rgba(16, 24, 40, .12);
	padding: 6px;
	list-style: none;
	margin: 0;
}
.gcb__region-opt {
	display: block;
	width: 100%;
	text-align: left;
	background: transparent;
	border: 0;
	border-radius: 9px;
	padding: 10px 12px;
	font-size: 14px;
	color: var(--gcb-dark);
	cursor: pointer;
}
.gcb__region-opt:hover { background: var(--gcb-soft); }
.gcb__region-opt.is-active { background: rgba(255, 116, 56, .1); color: var(--gcb-primary); font-weight: 600; }

/* Resultados */
.gcb__results {
	position: absolute;
	top: calc(100% + 10px);
	left: 0;
	right: 0;
	z-index: 25;
	background: #fff;
	border: 1px solid var(--gcb-border);
	border-radius: 16px;
	box-shadow: 0 16px 40px rgba(16, 24, 40, .14);
	padding: 8px;
	max-height: 440px;
	overflow-y: auto;
}
.gcb__group + .gcb__group { border-top: 1px solid var(--gcb-border); margin-top: 6px; padding-top: 6px; }
.gcb__group-title {
	font-size: 11.5px;
	text-transform: uppercase;
	letter-spacing: .06em;
	color: var(--gcb-muted);
	margin: 6px 10px;
	font-weight: 700;
}

.gcb__item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 10px;
	border-radius: 12px;
	text-decoration: none;
	color: inherit;
}
.gcb__item:hover { background: var(--gcb-soft); }
.gcb__avatar {
	width: 42px; height: 42px;
	border-radius: 10px;
	object-fit: cover;
	flex: none;
	background: var(--gcb-soft);
}
.gcb__avatar--ph { display: inline-flex; align-items: center; justify-content: center; color: var(--gcb-muted); border: 1px solid var(--gcb-border); }
.gcb__avatar--ph svg { width: 20px; height: 20px; }

.gcb__item-body { display: flex; flex-direction: column; gap: 2px; min-width: 0; }
.gcb__item-top { display: flex; align-items: center; gap: 8px; }
.gcb__item-name { font-weight: 600; color: var(--gcb-dark); font-size: 14.5px; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcb__item-meta { font-size: 12.5px; color: #6b7280; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; }
.gcb__item-loc { font-size: 12px; color: var(--gcb-muted); }

.gcb__badge {
	font-size: 10.5px;
	font-weight: 700;
	padding: 2px 8px;
	border-radius: 999px;
	white-space: nowrap;
	flex: none;
}
.gcb__badge--maestro { background: #eaf4ff; color: #1d6fd6; }
.gcb__badge--constructora { background: #fff1ea; color: #d2570f; }
.gcb__badge--proveedor { background: #ecf8f0; color: #1a9255; }

/* Estados */
.gcb__empty, .gcb__loading { padding: 18px; text-align: center; color: var(--gcb-muted); font-size: 14px; }
.gcb__loading { display: flex; align-items: center; justify-content: center; gap: 10px; }
.gcb__spinner {
	width: 16px; height: 16px;
	border: 2px solid var(--gcb-border);
	border-top-color: var(--gcb-primary);
	border-radius: 999px;
	display: inline-block;
	animation: gcb-spin .7s linear infinite;
}
@keyframes gcb-spin { to { transform: rotate(360deg); } }

/* Responsive */
@media (max-width: 560px) {
	.gcb__bar { flex-wrap: wrap; border-radius: 20px; padding: 8px 12px; }
	.gcb__input { order: 1; flex-basis: 100%; padding: 6px 0; }
	.gcb__search-icon { order: 0; }
	.gcb__region { order: 2; margin-left: auto; }
	.gcb__region-menu { width: 220px; }
}
