/**
 * Search Dropdown Styles
 *
 * @package Plastpro
 * @since 1.0.0
 */

/* Search Dropdown Base Styles */
.search-dropdown-wrapper {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	width: 100%;
	pointer-events: none;
	z-index: 1002; /* Higher than mega menu z-index: 1001 */
	opacity: 0;
	visibility: hidden;
	transition: opacity 0.5s ease-in-out, visibility 0.5s ease-in-out;
	overflow: visible;
}

/* Invisible bridge area to prevent hover loss when moving from search icon to panel */
.search-dropdown-wrapper::before {
	content: '';
	position: absolute;
	top: -20px;
	left: 0;
	width: 100%;
	height: 20px;
	pointer-events: auto;
	background: transparent;
	z-index: 1;
}

.search-dropdown-wrapper.active {
	opacity: 1;
	visibility: visible;
	pointer-events: auto;
}

.search-dropdown-panel {
	background-color: #F5F5F5;
	box-shadow: 8px 8px 8px rgba(0, 0, 0, 0.15);
	border-top: 1px solid #DDE1E6;
	padding: 20px 40px 40px 40px;
	max-width: 100%;
	margin: 0;
	box-sizing: border-box;
	overflow: hidden;
	max-height: 0;
	transition: max-height 0.5s ease-in-out;
}

.search-dropdown-wrapper.active .search-dropdown-panel {
	max-height: 1000px;
}

.search-dropdown-content {
	width: 100%;
	position: relative;
}

/* Search Form Styles */
.search-dropdown-form {
	margin-bottom: 40px;
	display: flex;
	justify-content: center;
}

.search-form-wrapper {
	display: flex;
	align-items: center;
	gap: 12px;
	max-width: 800px;
	width: 100%;
}

.search-input-wrapper {
	display: flex;
	align-items: center;
	background-color: #FFFFFF;
	border: 1px solid #DDE1E6;
	border-radius: 4px;
	padding: 0;
	flex: 1;
	overflow: hidden;
}

.search-dropdown-input {
	flex: 1;
	border: none;
	background: transparent;
	font-family: 'Montserrat', sans-serif;
	font-size: 16px;
	font-weight: 400;
	color: #1D252D;
	outline: none;
	padding: 12px 16px;
}

.search-dropdown-input::placeholder {
	color: #7C878E;
}

.search-dropdown-submit {
	background-color: #7C878E;
	border: none;
	padding: 10px 32px;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex-shrink: 0;
	transition: background-color 0.3s ease;
	border-radius: 50px;
	min-width: 140px;
}

.search-dropdown-submit:hover {
	background-color: #6a747b;
}

/* Close Button */
.search-dropdown-close {
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	flex-shrink: 0;
	transition: opacity 0.3s ease;
}

.search-dropdown-close:hover {
	opacity: 0.7;
}

.search-dropdown-close svg {
	width: 100%;
	height: 100%;
}

.search-button-text {
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 700;
	text-transform: uppercase;
	color: #FFFFFF;
	line-height: 1;
}

.search-dropdown-submit svg {
	width: 20px;
	height: 20px;
	flex-shrink: 0;
}

/* Search Results Container */
.search-results-container {
	margin-top: 0;
}

.search-results-columns {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	column-gap: 40px;
	align-items: stretch;
}

/* Search Column Styles */
.search-results-column {
	display: flex;
	flex-direction: column;
	position: relative;
	height: 100%;
}

/* Add separator line between columns (except first) */
.search-results-column:not(:first-child)::before {
	content: '';
	position: absolute;
	left: -20px;
	top: 0;
	bottom: 0;
	width: 1px;
	background-color: #DDE1E6;
	height: 100%;
}

.search-column-title {
	font-family: 'Montserrat', sans-serif;
	font-size: 18px;
	font-weight: 700;
	line-height: 22px;
	color: #000000;
	margin: 0 0 20px 0;
	padding-bottom: 0;
}

.search-column-content {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 100px;
}

/* Search Results List */
.search-results-list {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

/* Search Result Card */
.search-result-card {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	text-decoration: none;
	color: #1D252D;
	transition: opacity 0.3s ease;
	padding: 0;
}

.search-result-card:hover {
	opacity: 0.8;
}

/* Search Result Image */
.search-result-image {
	width: 60px;
	height: 60px;
	flex-shrink: 0;
	position: relative;
	overflow: hidden;
	background-color: #E5E5E5;
}

.search-result-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 1;
}

/* Door/Product images - show full image with gray background */
.search-result-card-door .search-result-image {
	background-color: #E5E5E5;
}

.search-result-card-door .search-result-image img {
	object-fit: contain;
}

/* Other content types - cover fill */
.search-result-image-placeholder {
	width: 100%;
	height: 100%;
	background-color: #E5E5E5;
	display: block;
	position: absolute;
	top: 0;
	left: 0;
	z-index: 0;
}

/* Search Result Content */
.search-result-content {
	flex: 1;
	min-width: 0;
}

.search-result-title {
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 700;
	line-height: 1.4;
	color: #1D252D;
	margin: 0 0 4px 0;
}

.search-result-excerpt {
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 400;
	line-height: 1.3;
	color: #7C878E;
	margin: 0;
	display: -webkit-box;
	-webkit-line-clamp: 3;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

/* View All Link - pinned to bottom of column so all align across columns */
.search-view-all {
	display: inline-flex;
	align-items: center;
	justify-content: flex-end;
	gap: 4px;
	margin-top: auto;
	padding-top: 20px;
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 700;
	color: #E87722;
	text-decoration: none;
	text-align: right;
	width: 100%;
	transition: opacity 0.3s ease;
}

.search-view-all:hover {
	opacity: 0.8;
}

.view-all-arrow {
	flex-shrink: 0;
	width: 6px;
	height: 10px;
}

/* Loading and No Results States */
.search-loading,
.search-no-results {
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 400;
	color: #7C878E;
	text-align: center;
	padding: 20px 0;
}

/* Mobile Styles - Hide Desktop Search */
@media screen and (max-width: 768px) {
	/* Hide desktop search dropdown and toggle on mobile */
	.search-dropdown-wrapper {
		display: none;
	}
	
	.header-search {
		display: none;
	}
}

/* Mobile Search Overlay Styles */
.mobile-search-overlay {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	bottom: 0;
	background-color: #FFFFFF;
	display: none;
	flex-direction: column;
	overflow-y: auto;
	z-index: 10;
}

.mobile-menu-container.search-active .mobile-search-overlay {
	display: flex;
}

/* Hide normal menu content when search is active */
.mobile-menu-container.search-active .mobile-menu-header,
.mobile-menu-container.search-active .mobile-menu-navigation,
.mobile-menu-container.search-active .mobile-menu-divider,
.mobile-menu-container.search-active .mobile-menu-search,
.mobile-menu-container.search-active .mobile-menu-cta {
	display: none;
}

.mobile-search-header {
	padding: 20px;
	border-bottom: 1px solid #DDE1E6;
	flex-shrink: 0;
}

.mobile-search-close {
	background: none;
	border: none;
	padding: 0;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	transition: opacity 0.3s ease;
}

.mobile-search-close:hover {
	opacity: 0.7;
}

.mobile-search-content {
	flex: 1;
	padding: 20px;
	overflow-y: auto;
}

.mobile-search-form {
	margin-bottom: 32px;
}

.mobile-search-input-group {
	display: flex;
	align-items: center;
	gap: 12px;
	width: 100%;
}

.mobile-search-input-wrapper {
	flex: 1;
	display: flex;
	align-items: center;
	background-color: #FFFFFF;
	border: 1px solid #DDE1E6;
	border-radius: 4px;
	padding: 0;
	overflow: hidden;
}

.mobile-search-input {
	flex: 1;
	border: none;
	background: transparent;
	font-family: 'Montserrat', sans-serif;
	font-size: 16px;
	font-weight: 400;
	color: #1D252D;
	outline: none;
	padding: 10px 16px;
}

.mobile-search-submit {
	background-color: #7C878E;
	border: none;
	padding: 10px 24px;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	flex-shrink: 0;
	transition: background-color 0.3s ease;
	border-radius: 50px;
	min-width: 120px;
}

.mobile-search-submit:hover {
	background-color: #6a7379;
}

.mobile-search-button-text {
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 700;
	color: #FFFFFF;
}

.mobile-search-submit svg {
	flex-shrink: 0;
}

.mobile-search-results-container {
	margin-top: 0;
}

.mobile-search-results-section {
	display: flex;
	flex-direction: column;
	margin-bottom: 32px;
}

.mobile-search-results-section:last-child {
	margin-bottom: 0;
}

.mobile-search-section-title {
	font-family: 'Montserrat', sans-serif;
	font-size: 18px;
	font-weight: 400;
	line-height: 22px;
	color: #000000;
	margin: 0 0 16px 0;
}

.mobile-search-section-content {
	display: flex;
	flex-direction: column;
}

.mobile-search-results-items {
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.mobile-search-view-all {
	display: inline-flex;
	align-items: center;
	justify-content: flex-end;
	gap: 4px;
	margin-top: 16px;
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 700;
	color: #E87722;
	text-decoration: none;
	width: 100%;
	transition: opacity 0.3s ease;
}

.mobile-search-view-all:hover {
	opacity: 0.8;
}

.mobile-search-loading,
.mobile-search-no-results {
	font-family: 'Montserrat', sans-serif;
	font-size: 14px;
	font-weight: 400;
	color: #7C878E;
	text-align: center;
	padding: 20px 0;
}

/* Mobile search cards reuse desktop card styles */
.mobile-search-results-items .search-result-card {
	/* Cards will inherit from .search-result-card styles */
}

