/**
 * Autocomplete Dropdown - pod vyhledávacím polem
 */

.search-autocomplete-wrapper {
	position: relative;
}

/* Dropdown pod inputem */
.autocomplete-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	background: white;
	border: 2px solid #0da9ef;
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.15);
	max-height: 500px;
	overflow-y: auto;
	z-index: 1000;
	display: none;
	margin-top: 4px;
}

.autocomplete-dropdown.show {
	display: block;
}

.autocomplete-section {
	padding: 0;
}

.autocomplete-section-title {
	padding: 10px 15px;
	background: #f8f9fa;
	border-bottom: 1px solid #e1e7ec;
	font-weight: 600;
	font-size: 12px;
	text-transform: uppercase;
	color: #606975;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 8px;
}

.autocomplete-section-title i {
	font-size: 14px;
	color: #0da9ef;
}

.autocomplete-section-title .badge {
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 10px;
}

.autocomplete-item {
	padding: 12px 15px;
	cursor: pointer;
	border-bottom: 1px solid #f0f0f0;
	transition: all 0.2s ease;
	display: flex;
	align-items: center;
	gap: 12px;
}

.autocomplete-item:last-child {
	border-bottom: none;
}

.autocomplete-item:hover,
.autocomplete-item.active {
	background: #f0f8ff;
	border-left: 3px solid #0da9ef;
	padding-left: 12px;
}

.autocomplete-item-icon {
	width: 60px;
	height: 60px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #f8f9fa;
	border-radius: 6px;
	flex-shrink: 0;
	overflow: hidden;
}

.autocomplete-item-icon img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.autocomplete-item-icon i {
	font-size: 24px;
	color: #0da9ef;
}

.autocomplete-item-content {
	flex: 1;
	min-width: 0;
}

.autocomplete-item-title {
	font-weight: 500;
	color: #374250;
	margin: 0 0 4px 0;
	font-size: 14px;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.autocomplete-item-title sr1,
.autocomplete-item-title sr2 {
	background-color: #fff3cd;
	font-weight: 600;
	padding: 0;
	border-radius: 2px;
}

.autocomplete-item-meta {
	font-size: 12px;
	color: #9da9b9;
	display: flex;
	align-items: center;
	gap: 8px;
}

.autocomplete-item-price {
	font-weight: 600;
	color: #0da9ef;
	font-size: 14px;
}

.autocomplete-item-price del {
	color: #9da9b9;
	margin-right: 5px;
	font-size: 12px;
}

.autocomplete-item-badge {
	background: #ff5252;
	color: white;
	padding: 2px 6px;
	border-radius: 3px;
	font-size: 10px;
	font-weight: 600;
}

.autocomplete-item-actions {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-left: auto;
	flex-shrink: 0;
}

.autocomplete-item-actions .btn {
	padding: 6px 12px;
	font-size: 12px;
	white-space: nowrap;
	display: inline-flex;
	align-items: center;
	gap: 5px;
	line-height: 1.2;
}

.autocomplete-item-actions .btn-sm {
	padding: 4px 10px;
	font-size: 11px;
}

.autocomplete-item-actions .btn i {
	vertical-align: middle;
}

.autocomplete-item-actions .btn.in-cart {
	background-color: transparent;
	border-color: #28a745;
	color: #28a745;
}

.autocomplete-item-actions .btn.in-cart:hover {
	background-color: #28a745;
	border-color: #28a745;
	color: #fff;
}

.autocomplete-item.product-item {
	padding: 10px 15px;
}

.autocomplete-item.product-item:hover .btn-primary {
	background: #0891d1;
	border-color: #0891d1;
}

.autocomplete-empty {
	padding: 20px;
	text-align: center;
	color: #9da9b9;
}

.autocomplete-footer {
	padding: 10px 15px;
	background: #f8f9fa;
	border-top: 1px solid #e1e7ec;
	text-align: center;
}

.autocomplete-footer a {
	color: #0da9ef;
	text-decoration: none;
	font-weight: 500;
	font-size: 13px;
	display: inline-flex;
	align-items: center;
	gap: 5px;
}

.autocomplete-footer a:hover {
	text-decoration: underline;
}

/* Scrollbar styling */
.autocomplete-dropdown::-webkit-scrollbar {
	width: 8px;
}

.autocomplete-dropdown::-webkit-scrollbar-track {
	background: #f1f1f1;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb {
	background: #0da9ef;
	border-radius: 4px;
}

.autocomplete-dropdown::-webkit-scrollbar-thumb:hover {
	background: #0891d1;
}

/* Keyboard navigation highlight */
.autocomplete-item.keyboard-active {
	background: #e3f2fd;
	border-left: 3px solid #0da9ef;
	padding-left: 12px;
}

/* Loading state */
.autocomplete-loading {
	padding: 20px;
	text-align: center;
	color: #9da9b9;
}

.autocomplete-loading .spinner-border {
	width: 24px;
	height: 24px;
	border-width: 3px;
}

/* Spinner animace ve vyhledávacím poli */
.toolbar-search-form.loading .search-btn i {
	display: none;
}

.toolbar-search-form.loading .search-btn::after {
	content: '';
	display: inline-block;
	width: 18px;
	height: 18px;
	border: 2px solid #e1e7ec;
	border-top-color: #0da9ef;
	border-radius: 50%;
	animation: spinner-rotate 0.6s linear infinite;
}

@keyframes spinner-rotate {
	from {
		transform: rotate(0deg);
	}
	to {
		transform: rotate(360deg);
	}
}

/* Produktové položky s tlačítkem vpravo */
.autocomplete-item.product-item {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 12px 15px;
}

.autocomplete-item.product-item .autocomplete-item-actions {
	margin-left: auto;
	padding-left: 15px;
}

/* Responsive */
@media (max-width: 768px) {
	.autocomplete-dropdown {
		max-height: 400px;
	}
}

@media (max-width: 576px) {
	.autocomplete-dropdown {
		max-height: 350px;
		border-radius: 0 0 8px 8px;
	}
	
	.autocomplete-item {
		padding: 10px 12px;
	}
	
	.autocomplete-item-icon {
		width: 50px;
		height: 50px;
	}
	
	.autocomplete-item-title {
		font-size: 13px;
	}
	
	.autocomplete-item-actions .btn {
		font-size: 11px;
		padding: 5px 10px;
	}
}
