/* ========================================
Find Supplier Modal - Two-Path System
======================================== */

/* P-shaped styles */
.modal-search-section,
.modal-browse-section {
	border-radius: 1rem 1rem 1rem 0;
}
button.suggestion-button.nectar-button.button-secondary-outline.button-small.text-white,
.modal-browse-container,
.modal-search-section[data-state="expanded"] .modal-search-content {
	border-radius: 2rem 2rem 2rem 0 !important;
}

/* Modal Container Adjustments */
.find-supplier-modal .modal-container {
	max-width: 70rem;
	margin-top: 4rem;
}
.modal-outer.modal-template-outer.find-supplier-modal.active[data-mode="search"] .modal-container {
	max-width: 50rem;
}

.find-supplier-modal .modal-message-outer {
	margin: 2rem 0 4rem;
}

/* Modal Form Outer - Sections Container */
.find-supplier-modal .modal-form-outer {
	display: flex;
	flex-direction: column;
	gap: 2rem;
}

/* ========================================
Section Base Styles
======================================== */

.modal-search-section,
.modal-browse-section {
	overflow: hidden;
	transition:
	opacity 0.3s ease,
	max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1),
	padding 0.4s cubic-bezier(0.4, 0, 0.2, 1),
	margin 0.4s cubic-bezier(0.4, 0, 0.2, 1),
	transform 0.4s cubic-bezier(0.4, 0, 0.2, 1);
}

/* ========================================
Expanded State
======================================== */

.modal-search-section[data-state="expanded"],
.modal-browse-section[data-state="expanded"] {
	opacity: 1;
	order: 1; /* Expanded section always on top */
}

/* Collapsing state - fade out and shrink before moving */
.modal-search-section[data-state="collapsing"],
.modal-browse-section[data-state="collapsing"] {
	opacity: 0;
	order: 1; /* Stay on top while collapsing */
	max-height: 0;
	margin-bottom: 0;
	pointer-events: none;
}

/* Show header when expanded, but hide the button */
.modal-search-section[data-state="expanded"] .modal-search-header {
	display: flex;
	margin-bottom: 4rem;
}

.modal-browse-section[data-state="expanded"] .modal-browse-header {
	display: flex;
	margin-bottom: 2rem;
}

.modal-search-section[data-state="expanded"] .modal-section-expand-button,
.modal-browse-section[data-state="expanded"] .modal-section-expand-button {
	display: none;
}

/* Make title bigger when expanded */
.modal-search-section[data-state="expanded"] .modal-section-title,
.modal-browse-section[data-state="expanded"] .modal-section-title {
	font-size: 3rem;
	line-height: 5.5rem;
}

/* Show content when expanded */
.modal-search-section[data-state="expanded"] .modal-search-content,
.modal-browse-section[data-state="expanded"] .modal-browse-content {
	display: block;
	opacity: 1;
}

/* ========================================
Minimized State (Promo Box)
======================================== */

.modal-search-section[data-state="minimized"],
.modal-browse-section[data-state="minimized"] {
	background: rgba(255, 255, 255, 0.05);
	padding: 2rem;
	cursor: pointer;
	opacity: 0.85;
	order: 2; /* Minimized section always below */
	max-height: 300px;
}

.find-supplier-modal[data-mode="browse"] .modal-search-section[data-state="minimized"] {
	max-width: 40rem !important;
	margin: 0 auto;
}

/* Expanding state - start minimized at bottom, then grow */
.modal-search-section[data-state="expanding"],
.modal-browse-section[data-state="expanding"] {
	opacity: 1;
	order: 1; /* Move to top immediately */
	max-height: 100vh;
	/* Keep minimized styling initially but remove background/border during transition */
	background: transparent;
	border: none;
	padding: 0;
}

.modal-search-section[data-state="minimized"]:hover,
.modal-browse-section[data-state="minimized"]:hover {
	background: rgba(255, 255, 255, 0.08);
	border-color: rgba(255, 255, 255, 0.25);
	transform: translateY(-2px);
	opacity: 1;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.1);
}

/* Hide content when minimized */
.modal-search-section[data-state="minimized"] .modal-search-content,
.modal-browse-section[data-state="minimized"] .modal-browse-content {
	display: none;
}

/* Show header when minimized */
.modal-search-section[data-state="minimized"] .modal-search-header,
.modal-browse-section[data-state="minimized"] .modal-browse-header {
	display: flex;
}

/* ========================================
Promo Box Header Styles
======================================== */

.modal-search-header,
.modal-browse-header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2rem;
}

.modal-section-text {
	flex: 1;
}

.modal-section-title {
	font-size: 1.5rem;
	color: var(--color-white);
	margin: 0 0 0.5rem 0;
	line-height: 1.3;
}

.modal-section-description {
	font-size: 0.95rem;
	color: #e2fff6c4;
	margin: 0;
	padding: 0;
	line-height: 1.5;
}

.modal-section-expand-button {
	display: inline-flex;
}

button.modal-section-expand-button.modal-browse-expand-button.nectar-button.button-small.button-secondary.text-white,
button.modal-section-expand-button.modal-browse-expand-button.nectar-button.button-small.button-secondary.text-white:hover,
button.modal-section-expand-button.modal-browse-expand-button.nectar-button.button-small.button-secondary.text-white:focus {
	color: var(--color-white) !important;
}

/* ========================================
Search Section Specific Styles
======================================== */
.find-supplier-modal .ai-input-outer.light-theme .ai-input-form,
.find-supplier-modal .ai-input-outer.light-theme .modal-form .ai-input-form-inner,
.find-supplier-modal .ai-input-outer.light-theme .modal-form .ai-input-form-inner:hover,
.find-supplier-modal .ai-input-outer.light-theme .modal-form .ai-input-form-inner:focus,
.find-supplier-modal .ai-input-outer.light-theme .modal-form-outer.active .modal-form input.input-text,
.find-supplier-modal .ai-input-outer.light-theme .ai-input-form-outer.active .ai-input-form input.input-text {
	background-color: #ffffff !important;
}
.modal-search-section[data-state="expanded"] .modal-search-content {
	padding: 1rem;
	background: rgb(255 255 255 / 95%) !important;
}
.find-supplier-modal .ai-input-outer.light-theme .ai-input-form {
	background: rgb(241 251 247 / 60%) !important;
	box-shadow: 0 0 36px #24433a1f;
}
.find-supplier-modal .ai-input-outer.light-theme.active .ai-input-form {
	background: rgb(241 251 247 / 60%) !important;
	box-shadow: 0 0 30px #24433a30;
}
.find-supplier-modal .ai-input-outer.light-theme .ai-input-data-item,
.find-supplier-modal .ai-input-outer.light-theme .ai-input-progress-relevance {
	color: var(--text-dark) !important;
}
.find-supplier-modal .ai-input-outer.light-theme .ai-input::placeholder,
.find-supplier-modal .ai-input-outer.light-theme .ai-inline-suggestion {
	color: #acc4bd !important;
}
.find-supplier-modal .ai-input-outer.light-theme .tab-hint {
	color: #0a221bb8;
	background: #c9e6dc;
}
.find-supplier-modal .ai-input-outer.light-theme .ai-input-progress-context.success .ai-input-progress-context-count {
	background: #3c7564 !important;
}
.find-supplier-modal .ai-input-outer.light-theme .ai-input-progress-context-message {
	color: #24433a !important;
}
.find-supplier-modal .ai-input-outer.light-theme .ai-input-data-item::before {
	background-image: url(/wp-content/uploads/2025/05/icon-star-filled-g.svg);
}
@media only screen and (max-width: 640px) {
	.find-supplier-modal .ai-input-form .ai-input-form-inner a.ai-input-voice-button,
	.find-supplier-modal .ai-input-outer.light-theme .ai-input-form .ai-input-form-inner a.ai-input-voice-button {
		margin-right: 0 !important;
	}
	.find-supplier-modal .ai-input-form-inner {
		padding: 0 0.4rem 0 0.9rem;
	}
	.find-supplier-modal input.input-text.ai-input.ai-search-input.strong {
		padding-right: 0 !important;
		min-height: 50px !important;
	}
}

/* Search Suggestions */
.modal-search-suggestions {
	margin-top: 1rem;
	padding: 0 0.5rem 0.5rem;
}
p.suggestions-label {
	font-size: 0.9rem;
	color: #5f766d;
	padding: 0 0 0.8rem;
}
.suggestions-buttons {
	display: flex;
	flex-wrap: wrap;
	gap: 0.75rem;
}

.suggestion-button {
	display: inline-flex !important;
}
button.suggestion-button.nectar-button.button-secondary-outline.button-small.text-white {
	color: #5f776e !important;
	font-size: 0.8rem !important;
	padding: 0.6rem 0.9rem !important;
	height: auto !important;
	border-color: #4b60583b !important;
	text-align: left !important;
	max-width: 70ch;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	display: block !important;
	box-sizing: border-box;
}
button.suggestion-button.nectar-button.button-secondary-outline.button-small.text-white:hover {
	color: var(--text-dark) !important;
	border-color: #4b605866 !important;
}
.find-supplier-modal .modal-form-outer.ai-input-outer.ai-search-outer.ai-input-outer.header-ai-search {
	max-height: none !important;
	transition: all 0.3s ease !important;
}

/* ========================================
Browse Section Specific Styles
======================================== */

.modal-browse-content {
	padding: 2rem 0 0;
}

.modal-browse-container {
	padding-bottom: 2rem;
	margin-bottom: 2rem;
	padding: 1rem;
	background: rgb(185 221 208 / 20%) !important;
}

/* Vertical Picker in Modal (Expanded Browse) */
.modal-browse-section[data-state="expanded"] .vertical-picker__item {
	padding: 0.6rem 0.8rem 0.7rem 1rem;
}

.modal-browse-section[data-state="expanded"] .vertical-picker__name {
	font-size: 0.85rem;
}

.modal-browse-section[data-state="expanded"] .vertical-picker__track {
	background-color: rgb(185 221 208 / 20%) !important;
}

.modal-browse-section[data-state="expanded"] .vertical-picker__indicator {
	background-color: rgb(185 221 208 / 31%) !important;
}

.modal-browse-section[data-state="expanded"] .vertical-picker__name {
	color: var(--text-white);
}

.modal-browse-section[data-state="expanded"] .vertical-picker__item.active .vertical-picker__count {
	background: #295b4c;
}

.modal-browse-section[data-state="expanded"] .vertical-picker__count {
	background: #344842;
}

/* ========================================
Responsive Design
======================================== */

@media only screen and (max-width: 768px) {
	.find-supplier-modal .modal-container {
		margin-top: 2rem;
	}
	
	.find-supplier-modal .modal-message-outer {
		margin: 1.5rem 0 3rem;
	}
	
	.find-supplier-modal .modal-form-outer {
		gap: 1.5rem;
	}
	
	.modal-search-section[data-state="minimized"],
	.modal-browse-section[data-state="minimized"] {
		padding: 1.5rem;
	}
	
	/* Stack header vertically on mobile */
	.modal-search-header,
	.modal-browse-header {
		flex-direction: column;
		align-items: flex-start;
		gap: 1rem;
	}
	
	.modal-section-title {
		font-size: 1.25rem;
	}
	
	/* Expanded title size on mobile */
	.modal-search-section[data-state="expanded"] .modal-section-title,
	.modal-browse-section[data-state="expanded"] .modal-section-title {
		font-size: 2rem;
		line-height: 3rem;
	}
	
	.modal-section-description {
		font-size: 0.9rem;
	}
	
	.modal-browse-content {
		padding: 1.5rem 0 0;
	}
}

/* Screen reader only text */
.sr-only {
	position: absolute;
	width: 1px;
	height: 1px;
	padding: 0;
	margin: -1px;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border-width: 0;
}

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

@keyframes fadeIn {
	from {
		opacity: 0;
	}
	to {
		opacity: 1;
	}
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

.modal-search-section[data-state="expanded"],
.modal-browse-section[data-state="expanded"] {
	animation: slideDown 0.3s ease;
	margin-top: 0 !important;
}

.find-supplier-modal .modal-form-outer > div:last-child {
	margin-top: 5rem;
}
@media only screen and (max-width: 640px) {
	.find-supplier-modal .modal-form-outer > div:last-child {
		margin-top: 2rem;
	}
}
.find-supplier-modal .modal-header,
.find-supplier-modal .modal-message-outer {
	display: none;
}

/* ========================================
Modal Category Cards Container
======================================== */

.modal-browse-container .vertical-picker {
	margin-bottom: 1rem !important;
}
.modal-category-cards-wrapper {
	max-height: 60vh;
	min-height: 18rem;
	overflow-y: auto;
	overflow-x: hidden;
	position: relative;
	height: auto;
	scrollbar-width: none; /* Firefox */
	-ms-overflow-style: none; /* IE and Edge */
	mask-image: linear-gradient(0deg, rgba(0, 0, 0, 0) 0%, rgba(0, 0, 0, 1) 3rem);
}
/* Hide scrollbar for Chrome, Safari and Opera */
.modal-category-cards-wrapper::-webkit-scrollbar {
	display: none;
	width: 0;
	height: 0;
}
.modal-category-cards-wrapper.vertical-scroll.has-expanded-card {
	mask-image: none;
	overflow-y: hidden;
	min-height: 30rem;
}
.modal-category-cards-wrapper.vertical-scroll.scrolling {
	mask-image: linear-gradient(0deg, rgba(0, 0, 0, 0) 0, rgba(0, 0, 0, 1) 1rem, rgba(0, 0, 0, 1) calc(100% - 1rem), rgba(0, 0, 0, 0) 100%);
}
.modal-category-cards-wrapper.vertical-scroll.bottom {
	mask-image: linear-gradient(0deg, rgba(0, 0, 0, 1) calc(100% - 2rem), rgba(0, 0, 0, 0) 100%);
}
.modal-category-cards-wrapper.vertical-scroll.small-vertical {
	mask-image: none;
}

.modal-category-cards {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	grid-auto-rows: min-content;
	align-items: start;
	height: auto;
	min-height: 0;
	margin: 0 !important;
}

@media only screen and (max-width: 1024px) {
	.modal-category-cards {
		grid-template-columns: repeat(2, 1fr);
		scrollbar-width: none; /* Firefox */
		-ms-overflow-style: none; /* IE and Edge */
	}
}

@media only screen and (max-width: 768px) {
	.modal-category-cards {
		grid-template-columns: 1fr;
	}
}

/* ========================================
Modal Category Card Styles
======================================== */

.modal-category-card {
	box-shadow: none !important;
	min-height: 8rem;
}

.modal-category-card--more {
	cursor: default;
	background: linear-gradient(135deg, #f5f7fa 0%, #e8ecf1 100%);
}

.modal-category-card--more:hover {
	transform: none;
}
.has-expanded-card .modal-category-card__content {
	max-width: 40rem;
	margin: 0 auto;
}

/* Card Header */
.modal-category-card__header {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	margin-bottom: 0;
}

.modal-category-card__header-left {
	flex: 1;
}

.modal-category-card__count {
	padding: 0 !important;
}

.modal-category-card__back-btn {
	display: none;
	margin-left: 2rem;
	flex-shrink: 0;
}
@media only screen and (max-width: 640px) {
	.modal-category-card {
		min-height: 5rem;
		margin-bottom: 0.5rem;
	}
}

/* Expanded Content (hidden by default) */
.modal-category-card__expanded-content {
	display: none;
	margin-top: 2rem;
}

.modal-category-card__description {
	font-size: 1rem;
	line-height: 1.7rem;
	color: var(--text-primary);
	margin-bottom: 0;
}

.modal-category-card__input {
	width: 100%;
	padding: 1.2rem;
	border: 1px solid #ddd;
	border-radius: 100px !important;
	font-size: 1.5rem;
	margin-bottom: 1.5rem;
	transition: border-color 0.3s ease;
}

.modal-category-card__input:focus {
	outline: none;
	border-color: #4A90E2;
}

.modal-category-card__create-btn {
	width: 100%;
}

/* ========================================
Card Expansion States
======================================== */

.modal-category-card--expanded {
	position: absolute;
	top: 0;
	left: 0;
	right: 0;
	width: 100% !important;
	min-height: 100%;
	height: auto;
	z-index: 100;
	cursor: default;
	box-shadow: 0 12px 40px rgba(0, 0, 0, 0.25);
	margin: 0.5rem;
	overflow-y: auto;
}

.modal-category-card--expanded:hover {
	transform: none;
}

.modal-category-card--expanded .modal-category-card__back-btn {
	display: block;
}

.modal-category-card--expanded .modal-category-card__expanded-content {
	display: block;
}

/* Fading sibling cards */
.modal-category-card--fading {
	opacity: 0;
	pointer-events: none;
	transition: opacity 0.3s ease;
}

@media only screen and (max-width: 768px) {
	.modal-category-card--expanded {
		grid-column: 1;
	}
}

/* ========================================
Search-Only Mode (No Browse Available)
======================================== */

/* When browse mode is not available, simplify the layout */
.find-supplier-modal.search-only .modal-container {
	max-width: 50rem;
}

.find-supplier-modal.search-only .modal-message-outer {
	margin-bottom: 2rem;
}

/* Hide expand button when search is the only option */
.find-supplier-modal.search-only .modal-search-expand-button {
	display: none;
}

/* Search section is always expanded in search-only mode */
.find-supplier-modal.search-only .modal-search-section {
	cursor: default;
}

.find-supplier-modal.search-only .modal-search-section[data-state="expanded"] {
	background: var(--extra-dark);
}

/* Adjust header text styling for search-only mode */
.find-supplier-modal.search-only .modal-search-header .modal-section-text {
	text-align: center;
	margin: 0 auto 1.5rem;
}

.find-supplier-modal.search-only .modal-search-header {
	justify-content: center;
}

/* Center the search content in search-only mode */
.find-supplier-modal.search-only .modal-search-content {
	max-width: 100%;
}