/**
 * Autocomplete Search Styles - Sticky Hero Version
 * Uses acs-s- prefix, completely independent from content (acs-) and mobile (acs-m-) versions
 *
 * @package Astra_Child_Main
 * @since 1.0.0
 */

/* ============================================
   Section Container (inside sticky hero)
   ============================================ */

.acs-s-section {
	flex: 1 1 200px;
	min-width: 0;
	overflow: visible;
	padding: 0;
	background: transparent;
	border-bottom: none;
}

.acs-s-container {
	max-width: none;
	padding: 0;
	position: relative;
}

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

.acs-s-search-wrapper {
	display: flex;
	align-items: stretch;
	background: rgb(255 255 255 / 15%);
	border: 2px solid rgb(255 255 255 / 40%);
	border-radius: 8px;
	transition: border-color 0.2s ease, box-shadow 0.2s ease;
	overflow: hidden;
}

.acs-s-search-wrapper:focus-within {
	border-color: rgb(255 255 255 / 80%);
	box-shadow: 0 0 0 3px rgb(255 255 255 / 15%);
}

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

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

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

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

.acs-s-dropdown-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	padding: 0;
	border: none;
	background: transparent;
	cursor: pointer;
	color: rgb(255 255 255 / 70%);
	transition: color 0.2s ease, background-color 0.2s ease;
	flex-shrink: 0;
	border-left: 1px solid rgb(255 255 255 / 20%);
}

.acs-s-dropdown-toggle:hover {
	background: rgb(255 255 255 / 15%);
	color: #fff;
}

.acs-s-dropdown-toggle[aria-expanded="true"] {
	background: rgb(255 255 255 / 15%);
	color: #fff;
}

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

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

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

.acs-s-tree-dropdown {
	position: absolute;
	top: 100%;
	left: 0;
	right: 0;
	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: 10000;
	max-height: 420px;
	overflow-y: auto;
	overflow-x: hidden;
	animation: acs-s-slide-down 0.2s ease;
}

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

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

.acs-s-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-s-tree-item:last-child {
	border-bottom: none;
}

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

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

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

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

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

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

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

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

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

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

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

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

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

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

.acs-s-current-term {
	background: #e8f4fd;
	border-left: 3px solid #4a90d9;
	font-weight: 600;
}

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

/* ============================================
   Active Item (keyboard navigation)
   ============================================ */

.acs-s-tree-item.acs-s-active-item {
	background: #e8eaff;
}

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

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

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

.acs-s-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-s-branch-toggle:hover {
	color: #667eea;
}

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

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

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

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

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

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

/* ============================================
   Hide sticky search on mobile (mobile uses acs-m-)
   ============================================ */

html[data-device="mobile"] .acs-s-section {
	display: none;
}

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

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

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