/**
 * Autocomplete Search Styles
 * Location search with tree dropdown - desktop and mobile layouts
 *
 * @package Astra_Child_Main
 * @since 1.0.0
 *
 * Uses html[data-device] from device-detection.js for responsive layouts
 * All classes prefixed with acs- to avoid conflicts
 */

/* ============================================
   Section Container
   ============================================ */

.acs-section {
	;
}

.acs-container {
	max-width: 800px;
	margin: 0 auto;
	padding: 0;
	position: relative;
}

/* ============================================
   Search Input Wrapper
   ============================================ */

.acs-search-wrapper {
	display: flex;
	align-items: stretch;
	background: #fff;
	border: 2px solid #dee2e6;
	border-radius: 8px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	overflow: hidden;
}

.acs-search-wrapper:focus-within {
	border-color: #667eea;
	box-shadow: 0 0 0 3px rgb(102 126 234 / 15%);
}

.acs-search-wrapper.acs-open {
	border-radius: 8px 8px 0 0;
	border-bottom-color: #e9ecef;
}

/* ============================================
   Search Input
   ============================================ */

.acs-search-input {
	flex: 1;
	padding: 14px 16px;
	font-size: 1rem;
	border: none !important;
	background: transparent;
	outline: none;
	color: #333;
	line-height: 1.4;
	min-width: 0;
}

.acs-search-input::placeholder {
	color: #0274be;
	font-weight: 400;
}

/* ============================================
   Dropdown Toggle Button
   ============================================ */

.acs-dropdown-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 48px;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	color: #666;
	transition: color 0.2s ease, background-color 0.2s ease;
	flex-shrink: 0;
	border-left: 1px solid #e9ecef;
}

.acs-dropdown-toggle:hover {
	background: #f0f0f0;
	color: #333;
}

.acs-dropdown-toggle[aria-expanded="true"] {
	background: #f0f0f0;
	color: #667eea;
}

.acs-chevron-icon {
	transition: transform 0.2s ease;
}

.acs-dropdown-toggle[aria-expanded="true"] .acs-chevron-icon {
	transform: rotate(180deg);
}

/* ============================================
   Tree Dropdown
   ============================================ */

.acs-tree-dropdown {
	position: absolute;
	top: 100%;
	left: 20px;
	right: 20px;
	background: #fff;
	border: 2px solid #667eea;
	border-top: none;
	border-radius: 0 0 8px 8px;
	box-shadow: 0 8px 24px rgb(0 0 0 / 12%);
	z-index: 9999;
	max-height: 360px;
	overflow-y: auto;
	overflow-x: hidden;
	animation: acs-slide-down 0.2s ease;
}

.acs-tree-content {
	padding: 4px 0;
}

/* ============================================
   Tree Items
   ============================================ */

.acs-tree-item {
	display: flex;
	align-items: center;
	padding: 10px 16px;
	cursor: pointer;
	transition: background-color 0.15s ease;
	text-decoration: none;
	color: #0274be;
	font-size: 0.95rem;
	line-height: 1.3;
	border-bottom: 1px solid #f5f5f5;
}

.acs-tree-item:last-child {
	border-bottom: none;
}

.acs-tree-item:hover,
.acs-tree-item.acs-active {
	background: #f0f4ff;
}

/* Indent levels for tree hierarchy */
.acs-tree-item[data-level="0"] {
	padding-left: 16px;
}

.acs-tree-item[data-level="1"] {
	padding-left: 32px;
}

.acs-tree-item[data-level="2"] {
	padding-left: 48px;
}

.acs-tree-item[data-level="3"] {
	padding-left: 64px;
}

/* ============================================
   Tree Item Icons
   ============================================ */

.acs-item-icon {
	flex-shrink: 0;
	width: 20px;
	height: 20px;
	margin-right: 10px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: #999;
}

.acs-tree-item.acs-condo .acs-item-icon {
	color: #0274be;
}

.acs-item-icon svg {
	width: 16px;
	height: 16px;
}

/* ============================================
   Tree Item Text
   ============================================ */

.acs-item-text {
	flex: 1;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.acs-tree-item.acs-condo .acs-item-text {
	font-weight: 600;
	color:#0274be;
}

.acs-tree-item.acs-branch .acs-item-text {
	font-weight: 500;
	color: #0274be;
}

/* Property count badge */
.acs-item-count {
	flex-shrink: 0;
	margin-left: 8px;
	padding: 2px 8px;
	background: #e9ecef;
	color: #666;
	font-size: 0.75rem;
	font-weight: 600;
	border-radius: 10px;
	line-height: 1.2;
}

.acs-tree-item.acs-condo .acs-item-count {
	background: #e8eaff;
	color: #0274be;
}

/* ============================================
   Search Highlight
   ============================================ */

/* Current term highlight (auto-scroll target) */
.acs-current-term {
	background: #e8f4fd;
	border-left: 3px solid #4a90d9;
	font-weight: 600;
}

.acs-highlight {
	background: #fff3cd;
	font-weight: 700;
	border-radius: 2px;
	padding: 0 1px;
}

/* ============================================
   No Results
   ============================================ */

.acs-no-results {
	padding: 20px 16px;
	text-align: center;
	color: #999;
	font-size: 0.9rem;
	font-style: italic;
}

/* ============================================
   Branch toggle (expand/collapse children)
   ============================================ */

.acs-branch-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 20px;
	height: 20px;
	margin-right: 4px;
	flex-shrink: 0;
	cursor: pointer;
	color: #999;
	transition: transform 0.2s ease, color 0.15s ease;
	border: none;
	background: none;
	padding: 0;
}

.acs-branch-toggle:hover {
	color: #667eea;
}

.acs-branch-toggle.acs-expanded {
	transform: rotate(90deg);
}

.acs-branch-toggle svg {
	width: 12px;
	height: 12px;
}

/* ============================================
   Scrollbar Styling
   ============================================ */

.acs-tree-dropdown::-webkit-scrollbar {
	width: 6px;
}

.acs-tree-dropdown::-webkit-scrollbar-track {
	background: #f8f9fa;
}

.acs-tree-dropdown::-webkit-scrollbar-thumb {
	background: #ced4da;
	border-radius: 3px;
}

.acs-tree-dropdown::-webkit-scrollbar-thumb:hover {
	background: #adb5bd;
}

/* ============================================
   Desktop Layout
   ============================================ */

html[data-device="desktop"] .acs-section {
	padding: 0;
}

html[data-device="desktop"] .acs-container {
	max-width: 800px;
}

html[data-device="desktop"] .acs-search-input {
	font-size: 1.05rem;
	padding-left: 6px;
}

html[data-device="desktop"] .acs-tree-dropdown {
	max-height: 420px;
}

/* ============================================
   Mobile Layout
   ============================================ */

html[data-device="mobile"] .acs-section {
	padding: 8px 0;
}

html[data-device="mobile"] .acs-container {
	padding: 0;
	max-width: 100%;
}

html[data-device="mobile"] .acs-search-input {
	font-size: 0.95rem;
	padding: 12px 14px;
}

html[data-device="mobile"] .acs-dropdown-toggle {
	width: 44px;
	min-height: 48px;
}

html[data-device="mobile"] .acs-tree-dropdown {
	left: 12px;
	right: 12px;
	max-height: 300px;
}

html[data-device="mobile"] .acs-tree-item {
	padding: 12px 14px;
	font-size: 0.9rem;
	min-height: 48px;
}

html[data-device="mobile"] .acs-tree-item[data-level="1"] {
	padding-left: 28px;
}

html[data-device="mobile"] .acs-tree-item[data-level="2"] {
	padding-left: 42px;
}

html[data-device="mobile"] .acs-tree-item[data-level="3"] {
	padding-left: 56px;
}

/* ============================================
   Hide desktop search on mobile for taxonomy-location & single-property
   (front-page.php uses different container classes, unaffected)
   ============================================ */

html[data-device="mobile"] .hp-sticky-hero-address-subtitle .acs-section,
html[data-device="mobile"] .sp-breadcrumb-navigation .acs-section {
	display: none;
}

/* ============================================
   Animation
   ============================================ */

@keyframes acs-slide-down {
	from {
		opacity: 0;
		transform: translateY(-4px);
	}

	to {
		opacity: 1;
		transform: translateY(0);
	}
}
