/**
 * Full-screen search modal styles matching Figma design specs.
 *
 * Scoped entirely under #search-modal / .cnstrc-modal-* so nothing here
 * leaks into the rest of the page. Markup is in templates/search-modal.php,
 * behavior in assets/js/search-modal.js.
 */

/* Ensure hidden attribute is always respected. */
#search-modal [hidden],
.cnstrc-modal__body[hidden] {
	display: none !important;
	visibility: hidden !important;
	height: 0 !important;
	width: 0 !important;
	margin: 0 !important;
	padding: 0 !important;
	overflow: hidden !important;
	border: 0 !important;
	pointer-events: none !important;
}

.cnstrc-modal__body[hidden] > * {
	display: none !important;
}

/* ---------------------------------------------------------------------------
   Overlay + backdrop
--------------------------------------------------------------------------- */
.cnstrc-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 10000;
	align-items: flex-start;
	justify-content: center;
}

.cnstrc-modal.cnstrc-modal--open {
	display: flex;
}

body.cnstrc-modal-open {
	overflow: hidden;
}

.cnstrc-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba( 0, 0, 0, 0.5 );
	opacity: 0;
	transition: opacity 0.2s ease-in-out;
}

.cnstrc-modal--open .cnstrc-modal__backdrop {
	opacity: 1;
}

/* ---------------------------------------------------------------------------
   Panel
--------------------------------------------------------------------------- */
.cnstrc-modal__panel {
	position: relative;
	width: 100%;
	max-width: 780px;
	margin: 6vh 20px 0;
	padding: 14px 28px 14px;
	background: #fff;
	border-radius: 20px;
	box-shadow: 0 16px 48px rgba( 0, 0, 0, 0.16 );
	overflow: hidden;
	opacity: 0;
	transform: translateY( -10px ) scale( 0.99 );
	transition: opacity 0.2s ease-in-out, transform 0.2s ease-in-out;
	max-height: 86vh;
	display: flex;
	flex-direction: column;
	box-sizing: border-box;
}

.cnstrc-modal--open .cnstrc-modal__panel {
	opacity: 1;
	transform: translateY( 0 ) scale( 1 );
}

@media ( max-width: 782px ) {
	.cnstrc-modal__panel {
		max-width: 100%;
		margin: 0;
		max-height: 100vh;
		height: 100%;
		border-radius: 0;
		padding: 20px 18px;
	}
}

/* ---------------------------------------------------------------------------
   Header (input + action icons)
--------------------------------------------------------------------------- */
.cnstrc-modal__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	padding: 0;
	border-bottom: none;
}

.cnstrc-modal__input {
	flex: 1 1 auto;
	border: none;
	outline: none;
	font-size: 16px;
	line-height: 1.4;
	color: #111;
	font-weight: 500;
	background: transparent;
	padding: 0;
	margin: 0;
}

.cnstrc-modal__input::placeholder {
	color: #767676;
	font-weight: 400;
}

@media ( max-width: 782px ) {
	.cnstrc-modal__header {
		min-height: 40px;
		padding-bottom: 12px;
		border-bottom: 1px solid #eaeaea;
	}

	.cnstrc-modal__input {
		font-size: 18px;
		font-weight: 400;
		height: 40px;
	}
}

.cnstrc-modal__header-actions {
	display: flex;
	align-items: center;
	gap: 12px;
	flex: 0 0 auto;
}

.cnstrc-modal__submit,
.cnstrc-modal__clear {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	padding: 0;
	border: none;
	background: transparent;
	color: #111;
	cursor: pointer;
	transition: opacity 0.15s ease;
	margin: 0;
}

.cnstrc-modal__submit:hover,
.cnstrc-modal__clear:hover {
	opacity: 0.6;
}

/* ---------------------------------------------------------------------------
   Body (columns layout)
--------------------------------------------------------------------------- */
.cnstrc-modal__body {
	display: grid;
	grid-template-columns: 44% 56%;
	gap: 0;
	padding: 8px 0 0;
	overflow-y: auto;
}

@media ( max-width: 782px ) {
	/* Single column, and the columns dissolve so their children can be
	   re-ordered independently: suggestions → products → expert advice. */
	.cnstrc-modal__body {
		display: flex;
		flex-direction: column;
		padding-top: 12px;
	}

	.cnstrc-modal__col--suggestions {
		display: contents;
	}

	.cnstrc-modal__suggestions {
		order: 1;
	}

	.cnstrc-modal__col--products {
		order: 2;
	}

	.cnstrc-modal__expert-advice {
		order: 3;
	}
}

.cnstrc-modal__col--suggestions {
	padding-right: 24px;
	border-right: 1px solid #eaeaea;
}

.cnstrc-modal__col--products {
	padding-left: 28px;
}

@media ( max-width: 782px ) {
	.cnstrc-modal__col--suggestions {
		padding-right: 0;
		border-right: none;
	}

	.cnstrc-modal__suggestions {
		padding-bottom: 20px;
		margin-bottom: 24px;
		border-bottom: 1px solid #eaeaea;
	}

	.cnstrc-modal__col--products {
		padding-left: 0;
		margin-bottom: 28px;
	}

	.cnstrc-modal__expert-advice {
		margin-top: 0;
	}
}

.cnstrc-modal__section-title {
	font-size: 16px;
	font-weight: 700;
	color: #111;
	margin: 0 0 12px;
	text-transform: none;
	letter-spacing: normal;
	line-height: 1.3;
	font-family: "Supreme LL", sans-serif !important;
	font-weight: bold !important;
}

/* ---------------------------------------------------------------------------
   Search Suggestions
--------------------------------------------------------------------------- */
.cnstrc-modal__suggestions {
	display: flex;
	flex-direction: column;
	gap: 2px;
}

.cnstrc-modal-suggestion {
	display: block;
	width: 100%;
	text-align: left;
	padding: 5px 0;
	border: none;
	background: transparent;
	border-radius: 4px;
	cursor: pointer;
	font-size: 14px;
	line-height: 1.4;
	color: #111;
	white-space: normal;
	overflow-wrap: anywhere;
	margin: 0;
	margin-left: 1em;
	transition: opacity 0.15s ease;
}

.cnstrc-modal-suggestion:hover {
	opacity: 0.75;
}

@media ( max-width: 782px ) {
	.cnstrc-modal-suggestion {
		font-size: 16px;
		padding: 8px 0;
		margin-left: 0;
	}
}

.cnstrc-modal-suggestion__input {
	font-weight: 700;
	color: #111;
}

.cnstrc-modal-suggestion__suggested {
	font-weight: 400;
	color: #111;
}

/* ---------------------------------------------------------------------------
   Expert Advice
--------------------------------------------------------------------------- */
.cnstrc-modal__expert-advice {
	margin-top: 26px;
}

.cnstrc-modal-expert-advice__link {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	padding: 6px 0;
	font-size: 14px;
	font-weight: normal;
	color: #111;
	text-decoration: none;
	line-height: 1.35;
	margin-left: 1em;
}

.cnstrc-modal-expert-advice__link:hover {
	opacity: 0.75;
}

@media ( max-width: 782px ) {
	.cnstrc-modal-expert-advice__link {
		font-size: 16px;
		padding: 9px 0;
		margin-left: 0;
	}
}

.cnstrc-modal-expert-advice__arrow {
	flex: 0 0 auto;
	font-size: 14px;
	font-weight: 400;
	color: #111;
	opacity: 0.7;
}

/* ---------------------------------------------------------------------------
   Suggested Products
--------------------------------------------------------------------------- */
.cnstrc-modal__products {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.cnstrc-modal-product {
	display: flex;
	align-items: center;
	gap: 16px;
	padding: 2px 0;
	border-radius: 6px;
	text-decoration: none;
	color: inherit;
	transition: opacity 0.15s ease;
}

.cnstrc-modal-product:hover {
	opacity: 0.8;
}

.cnstrc-modal-product__image {
	flex: 0 0 80px;
	width: 80px;
	height: 80px;
	object-fit: contain;
	background: #fff;
	border-radius: 6px;
}

.cnstrc-modal-product__info {
	display: flex;
	flex-direction: column;
	gap: 2px;
	min-width: 0;
	flex: 1 1 auto;
}

.cnstrc-modal-product__title {
	font-size: 14px;
	font-weight: 600;
	color: #111;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cnstrc-modal-product__brand {
	font-size: 12px;
	color: #444;
	line-height: 1.3;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.cnstrc-modal-product__price {
	font-size: 14px;
	font-weight: 700;
	color: #111;
	line-height: 1.3;
	margin-top: 1px;
}

/* Cents render smaller and aligned at top of dollar amount. */
.cnstrc-modal-product__price sup {
	font-size: 0.65em;
	vertical-align: super;
	line-height: 0;
}
