/* ===================================
   WEBUP SEARCH - BASE STYLES
   =================================== */

.webup-search-wrapper {
	position: relative;
	width: 100%;
	max-width: 600px;
}

.webup-search-form {
	position: relative;
	width: 100%;
}

.webup-search-container {
	position: relative;
	display: block;
	width: 100%;
}

/* ===================================
   SEARCH INPUT
   =================================== */

.webup-search-input {
	width: 100%;
	padding: 12px 50px 12px 15px;
	border: 2px solid #e0e0e0;
	border-radius: 25px;
	font-size: 16px;
	line-height: 1.5;
	transition: all 0.3s ease;
	box-sizing: border-box;
	outline: none;
}

.webup-search-input:focus {
	border-color: #4CAF50;
	box-shadow: 0 2px 8px rgba(76, 175, 80, 0.15);
}

.webup-search-input::placeholder {
	color: #999;
}

/* ===================================
   SEARCH ICON
   =================================== */

.webup-search-icon {
	position: absolute;
	top: 50%;
	right: 15px;
	transform: translateY(-50%);
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: all 0.3s ease;
	z-index: 10;
	line-height: 0;
}

.webup-search-icon:hover {
	transform: translateY(-50%) scale(1.1);
}

.webup-search-icon:focus {
	outline: 2px solid #4CAF50;
	outline-offset: 2px;
	border-radius: 4px;
}

.webup-search-icon svg {
	display: block;
}

/* ===================================
   COLLAPSIBLE STYLES
   =================================== */

.webup-search-wrapper.collapsible {
	width: 50px;
	max-width: 50px;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.webup-search-wrapper.collapsible .webup-search-input {
	width: 100%;
	padding: 12px 50px 12px 15px;
	border-color: transparent;
	background: transparent;
	opacity: 0;
	pointer-events: none;
	transition: all 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

.webup-search-wrapper.collapsible .webup-search-icon {
	right: 0;
	background: #f5f5f5;
	border-radius: 50%;
	width: 44px;
	height: 44px;
}

.webup-search-wrapper.collapsible.expanded {
	width: 100%;
	max-width: 600px;
}

.webup-search-wrapper.collapsible.expanded .webup-search-input {
	border-color: #e0e0e0;
	background: #ffffff;
	opacity: 1;
	pointer-events: all;
}

.webup-search-wrapper.collapsible.expanded .webup-search-icon {
	background: none;
	border-radius: 0;
	width: auto;
	height: auto;
	right: 15px;
}

/* ===================================
   SEARCH RESULTS DROPDOWN
   =================================== */

.webup-search-results {
	position: absolute;
	top: calc(100% + 8px);
	left: 0;
	right: 0;
	background: #ffffff;
	border-radius: 12px;
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.12), 0 2px 6px rgba(0, 0, 0, 0.08);
	max-height: 480px;
	overflow-y: auto;
	z-index: 9999;
	display: none;
	border: 1px solid #e8e8e8;
}

.webup-search-results::-webkit-scrollbar {
	width: 8px;
}

.webup-search-results::-webkit-scrollbar-track {
	background: #f1f1f1;
	border-radius: 0 12px 12px 0;
}

.webup-search-results::-webkit-scrollbar-thumb {
	background: #c1c1c1;
	border-radius: 4px;
}

.webup-search-results::-webkit-scrollbar-thumb:hover {
	background: #a1a1a1;
}

/* ===================================
   RESULTS LIST
   =================================== */

.search-results-list {
	list-style: none;
	margin: 0;
	padding: 8px 0;
}

.search-result-item {
	border-bottom: 1px solid #f5f5f5;
	transition: background-color 0.15s ease;
}

.search-result-item:last-child {
	border-bottom: none;
}

.search-result-item a {
	display: flex;
	align-items: center;
	padding: 12px 16px;
	text-decoration: none;
	color: inherit;
	transition: background-color 0.15s ease;
	gap: 12px;
}

.search-result-item a:hover,
.search-result-item a.active {
	background-color: #f8f9fa;
}

/* ===================================
   RESULT ITEM - IMAGE
   =================================== */

.search-result-image {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 8px;
	flex-shrink: 0;
	background: #f5f5f5;
	border: 1px solid #e8e8e8;
}

/* ===================================
   RESULT ITEM - CONTENT
   =================================== */

.search-result-content {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0; /* For text truncation */
}

.search-result-title {
	font-weight: 600;
	font-size: 14px;
	line-height: 1.4;
	color: #1a1a1a;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

.search-result-type {
	font-size: 12px;
	color: #666;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	font-weight: 500;
}

.search-result-price {
	font-size: 15px;
	color: #4CAF50;
	font-weight: 700;
	margin-top: 2px;
}

.search-result-price del {
	color: #999;
	font-weight: 400;
	font-size: 13px;
	margin-right: 6px;
}

.search-result-stock {
	font-size: 11px;
	padding: 2px 8px;
	border-radius: 4px;
	display: inline-block;
	margin-top: 4px;
}

.search-result-stock.out-of-stock {
	background: #ffebee;
	color: #c62828;
}

/* ===================================
   VIEW ALL BUTTON
   =================================== */

.search-view-all {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 14px 20px;
	background: linear-gradient(180deg, #ffffff 0%, #f8f9fa 100%);
	color: #4CAF50;
	text-decoration: none;
	font-weight: 600;
	font-size: 14px;
	border-top: 1px solid #e8e8e8;
	border-radius: 0 0 12px 12px;
	transition: all 0.2s ease;
	gap: 6px;
}

.search-view-all:hover {
	background: #f8f9fa;
	color: #45a049;
}

/* ===================================
   LOADING & STATES
   =================================== */

.search-loading,
.search-no-results,
.search-error {
	padding: 32px 20px;
	text-align: center;
	color: #666;
	font-size: 14px;
}

.search-loading {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
}

.search-loading .spinner {
	width: 18px;
	height: 18px;
	border: 2px solid #f3f3f3;
	border-top: 2px solid #4CAF50;
	border-radius: 50%;
	animation: spin 0.8s linear infinite;
	display: inline-block;
}

@keyframes spin {
	0% { transform: rotate(0deg); }
	100% { transform: rotate(360deg); }
}

.search-no-results {
	color: #999;
	font-style: italic;
}

.search-error {
	color: #f44336;
	background: #ffebee;
	border-radius: 8px;
	margin: 8px;
}

/* ===================================
   MOBILE RESPONSIVE
   =================================== */

@media (max-width: 768px) {
	.webup-search-wrapper {
		max-width: 100%;
	}
	
	.webup-search-wrapper.collapsible.expanded {
		max-width: 100%;
	}
	
	.webup-search-input {
		font-size: 16px; /* Prevents zoom on iOS */
	}
	
	.webup-search-results {
		max-height: 60vh;
		border-radius: 8px;
	}
	
	.search-result-item a {
		padding: 10px 12px;
	}
	
	.search-result-image {
		width: 48px;
		height: 48px;
	}
	
	.search-result-title {
		font-size: 13px;
	}
	
	.search-result-type {
		font-size: 11px;
	}
}

@media (max-width: 480px) {
	.webup-search-results {
		left: -10px;
		right: -10px;
		width: calc(100% + 20px);
	}
	
	.webup-search-wrapper.collapsible {
		width: 44px;
	}
	
	.webup-search-wrapper.collapsible .webup-search-icon {
		width: 40px;
		height: 40px;
	}
}

/* ===================================
   ACCESSIBILITY
   =================================== */

.webup-search-input:focus-visible {
	outline: 2px solid #4CAF50;
	outline-offset: 2px;
}

.search-result-item a:focus-visible {
	outline: 2px solid #4CAF50;
	outline-offset: -2px;
}

/* High contrast mode support */
@media (prefers-contrast: high) {
	.webup-search-input {
		border-width: 3px;
	}
	
	.search-result-item a:hover,
	.search-result-item a.active {
		background-color: #e8e8e8;
	}
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {
	.webup-search-input,
	.webup-search-icon,
	.webup-search-wrapper.collapsible,
	.webup-search-wrapper.collapsible .webup-search-input,
	.search-result-item a {
		transition: none;
	}
	
	.search-loading .spinner {
		animation: none;
		border: 2px solid #4CAF50;
	}
}

/* ===================================
   PRINT STYLES
   =================================== */

@media print {
	.webup-search-wrapper {
		display: none;
	}
}