/**
 * CR Search Autocomplete · CSS do dropdown
 * Aparece abaixo do input de busca · sticky, scrollable
 */

.cr-ac-dropdown {
	position: absolute;
	top: calc(100% + 4px);
	left: 0;
	right: 0;
	max-height: 480px;
	overflow-y: auto;
	background: #ffffff;
	border: 1px solid #D9DEE8;
	border-radius: 12px;
	box-shadow: 0 12px 32px -8px rgba(11,31,58,0.18), 0 4px 12px -2px rgba(11,31,58,0.08);
	z-index: 1000;
	display: none;
	font-family: 'Inter', system-ui, sans-serif;
}
.cr-ac-dropdown.is-open { display: block; }

@media (max-width: 900px) {
	.cr-ac-dropdown {
		position: fixed;
		top: auto;
		left: 8px;
		right: 8px;
		max-height: 70vh;
	}
}

.cr-ac-section { padding: 6px 0; }
.cr-ac-section + .cr-ac-section { border-top: 1px solid #ECEEF3; }
.cr-ac-section-label {
	font-size: 10px;
	font-weight: 800;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #94A3B8;
	padding: 6px 16px 4px;
}

.cr-ac-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 9px 16px;
	color: #0B1F3A;
	text-decoration: none;
	transition: background 0.1s;
	cursor: pointer;
}
.cr-ac-item:hover,
.cr-ac-item.is-selected { background: #F4F7FB; }

.cr-ac-section--cat {
	background: linear-gradient(135deg, #FAF1D8 0%, #F8E9C2 100%);
	margin: 6px;
	border-radius: 8px;
	padding: 4px 0;
}
.cr-ac-section--cat .cr-ac-section-label { color: #8B6E1A; }
.cr-ac-item--cat { padding: 8px 12px; }
.cr-ac-item--cat:hover,
.cr-ac-item--cat.is-selected { background: rgba(255,255,255,0.5); }
.cr-ac-cat-icon { font-size: 18px; line-height: 1; }
.cr-ac-cat-text {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 1px;
	min-width: 0;
}
.cr-ac-cat-name {
	font-size: 13px;
	font-weight: 700;
	color: #0B1F3A;
	line-height: 1.3;
}
.cr-ac-cat-count {
	font-size: 11px;
	color: #8B6E1A;
	font-weight: 600;
}
.cr-ac-arrow { color: #8B6E1A; font-size: 16px; font-weight: 700; }

.cr-ac-item--prod { gap: 10px; }
.cr-ac-prod-text {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 1px;
}
.cr-ac-prod-sigla {
	font-size: 13px;
	font-weight: 700;
	color: #0B1F3A;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.cr-ac-prod-sub {
	display: flex;
	gap: 8px;
	align-items: center;
	font-size: 11px;
	color: #475569;
	flex-wrap: wrap;
}
.cr-ac-prod-cargo { font-weight: 500; }
.cr-ac-prod-edital {
	font-size: 9px;
	font-weight: 700;
	letter-spacing: 0.04em;
	padding: 1px 6px;
	background: #ECEEF3;
	border-radius: 999px;
	text-transform: uppercase;
	color: #475569;
}
.cr-ac-prod-price {
	font-size: 13px;
	font-weight: 700;
	color: #1D4ED8;
	white-space: nowrap;
	flex-shrink: 0;
}

.cr-ac-see-all {
	display: block;
	padding: 10px 16px;
	background: #F4F7FB;
	color: #1D4ED8;
	text-decoration: none;
	font-size: 12px;
	font-weight: 700;
	text-align: center;
	border-top: 1px solid #ECEEF3;
	transition: background 0.1s;
}
.cr-ac-see-all:hover,
.cr-ac-see-all.is-selected { background: #1D4ED8; color: #ffffff; }
.cr-ac-see-all strong { font-weight: 800; }

.cr-ac-empty {
	padding: 20px 16px;
	text-align: center;
	color: #94A3B8;
	font-size: 13px;
}

/* ── HISTÓRICO ───────────────────────────────── */
.cr-ac-section--history { padding: 6px 0 8px; }
.cr-ac-history-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 6px 16px 4px;
}
.cr-ac-history-clear {
	background: transparent;
	border: 0;
	font-size: 10px;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #94A3B8;
	cursor: pointer;
	padding: 2px 4px;
	transition: color 0.15s;
	font-family: inherit;
}
.cr-ac-history-clear:hover { color: #1D4ED8; }

.cr-ac-item--history {
	gap: 10px;
	padding: 8px 16px;
}
.cr-ac-history-icon {
	font-size: 14px;
	opacity: 0.6;
	flex-shrink: 0;
}
.cr-ac-history-text {
	flex: 1;
	font-size: 13px;
	font-weight: 600;
	color: #475569;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}
.cr-ac-history-remove {
	background: transparent;
	border: 0;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	color: #94A3B8;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.15s;
	flex-shrink: 0;
	padding: 0;
}
.cr-ac-history-remove:hover {
	background: #FEE2E2;
	color: #DC2626;
}
