/* =============================================================================
   Custom Mega Menu — Global / Light DOM Styles
   ============================================================================= */

custom-mega-menu {
	display: block;
	position: relative;
	z-index: 9999;
}

/* =============================================================================
   Search Form (light DOM — slotted into nav bar)
   ============================================================================= */

.cmm-search-slot {
	position: relative;
	width: 100%;
}

.cmm-search-form {
	display: flex;
	align-items: center;
	background: rgba(0, 0, 0, 0.05);
	border: 1px solid #e5e5e5;
	border-radius: 6px;
	transition: border-color 0.15s ease, background 0.15s ease;
}

.cmm-search-form:focus-within {
	background: #ffffff;
	border-color: #0066cc;
}

.cmm-search-input {
	flex: 1;
	border: none;
	background: transparent;
	padding: 8px 10px;
	font-size: 16px !important; /* Must be exactly 16px to prevent iOS Safari zoom */
	color: inherit;
	outline: none;
	min-width: 0;
	font-family: inherit;
	appearance: none;
	-webkit-appearance: none;
}

/* Also target the Miva native mm_searchfield input to prevent iOS zoom */
[data-mm_searchfield] {
	font-size: 16px !important;
}

.cmm-search-input::placeholder { opacity: 0.5; }

.cmm-search-input::-webkit-search-cancel-button,
.cmm-search-input::-webkit-search-decoration { display: none; }

.cmm-search-btn {
	background: none;
	border: none;
	cursor: pointer;
	padding: 8px 10px;
	opacity: 0.55;
	display: flex;
	align-items: center;
	flex-shrink: 0;
	transition: opacity 0.15s ease, color 0.15s ease;
	color: inherit;
}

.cmm-search-btn:hover { opacity: 1; color: #0066cc; }
.cmm-search-icon { width: 16px; height: 16px; display: block; }

/* =============================================================================
   Miva Search Preview Dropdown — container
   ============================================================================= */

.cmm-search-menu,
[data-mm_searchfield_menu] {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 2px);
	z-index: 9999;
	background: #ffffff;
	border: 1px solid #e5e5e5;
	border-radius: 0 0 8px 8px;
	box-shadow: 0 8px 32px rgba(0, 0, 0, 0.14);
	max-height: 440px;
	overflow-y: auto;
	font-family: inherit;
	font-size: 0.875rem;
}

/* Mobile drawer: inline, not absolute */
.cmm-mobile-search .cmm-search-menu,
.cmm-mobile-search [data-mm_searchfield_menu] {
	position: static;
	border-radius: 0 0 6px 6px;
	border-top: none;
	box-shadow: none;
}

/* =============================================================================
   Miva Search Preview — result rows
   
   Actual HTML structure from DevTools:
   
   [data-mm_searchfield_menu]
     <span class="mm_searchfield_menuitem_selected">   ← outer row wrapper
       <div class="mm_searchfield_menuitem">           ← inner flex row
         <span class="mm_searchfield_menuitem_image_container">
           <img class="mm_searchfield_menuitem_image" />
         </span>
         <span class="mm_searchfield_menuitem_title_container">
           <span class="mm_searchfield_menuitem_name">…</span>
           <span class="mm_searchfield_menuitem_price">…</span>
         </span>
       </div>
     </span>
     <div class="mm_searchfield_menuitem mm_searchfield_menuitem_storesearch">
       …view all…
     </div>
   ============================================================================= */

/* Row separator */
.mm_searchfield_menuitem_selected {
	display: block;
	border-bottom: 1px solid #f0f0f0;
}

.mm_searchfield_menuitem_selected:last-of-type {
	border-bottom: none;
}

/* Hover state on the outer wrapper */
.mm_searchfield_menuitem_selected:hover {
	background: rgba(0, 102, 204, 0.05);
}

/* ---- Inner row: image LEFT, text RIGHT ---- */
.mm_searchfield_menuitem {
	display: flex !important;
	flex-direction: row !important;
	align-items: center !important;
	gap: 12px;
	padding: 10px 14px;
	cursor: pointer;
	text-decoration: none;
	color: #111111;
}

/* ---- Image container — fixed left column ---- */
.mm_searchfield_menuitem_image_container {
	flex: 0 0 72px;
	width: 72px;
	height: 72px;
	display: block;
	border-radius: 6px;
	overflow: hidden;
	background: transparent;
}

.mm_searchfield_menuitem_image {
	width: 100% !important;
	height: 100% !important;
	object-fit: contain;
	
	display: block;
}

/* ---- Text container — fills remaining width ---- */
.mm_searchfield_menuitem_title_container {
	flex: 1;
	min-width: 0;
	display: flex !important;
	flex-direction: column !important;
	gap: 3px;
}

/* Product name */
.mm_searchfield_menuitem_name {
	display: block;
	font-size: 0.875rem;
	font-weight: 600;
	color: #111111;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	line-height: 1.3;
}

/* Price */
.mm_searchfield_menuitem_price {
	display: block;
	font-size: 0.8125rem;
	font-weight: 500;
	color: #555555;
	line-height: 1.3;
}

/* ---- "View all / Store search" footer row ---- */
.mm_searchfield_menuitem_storesearch,
.mm_searchfield_menuitem_storesearch .mm_searchfield_menuitem {
	display: block !important;
	text-align: center;
	padding: 10px 14px;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #0066cc;
	background: #f8f9fa;
	border-top: 1px solid #e5e5e5;
	cursor: pointer;
	transition: background 0.12s ease, color 0.12s ease;
}

.mm_searchfield_menuitem_storesearch:hover,
.mm_searchfield_menuitem_storesearch:hover .mm_searchfield_menuitem {
	background: #eef2f8;
	color: #0044aa;
}

/* Also handle Shadows extension class names just in case */
.x-search-preview__view-all {
	display: block;
	text-align: center;
	padding: 10px 14px;
	font-size: 0.8125rem;
	font-weight: 600;
	color: #0066cc;
	background: #f8f9fa;
	border-top: 1px solid #e5e5e5;
	text-decoration: none;
	transition: background 0.12s ease;
}

.x-search-preview__view-all:hover {
	background: #eef2f8;
}

/* =============================================================================
   Responsive
   ============================================================================= */
@media (max-width: 959px) {
	custom-mega-menu .cmm-search-slot:not([slot="mobile-search"]) {
		display: none;
	}
}

/* =============================================================================
   Print
   ============================================================================= */
@media print {
	custom-mega-menu,
	.cmm-search-menu,
	[data-mm_searchfield_menu] { display: none !important; }
}

/* =============================================================================
   Override existing Bootstrap/theme navbar stacking context so the custom
   mega menu drawer and dropdowns render above it.
   The existing .navbar-static-top uses z-index: 1000 from bootstrap.min.css.
   ============================================================================= */
.navbar-static-top,
.navbar-default {
	z-index: 100 !important;
}

/* =============================================================================
   Cart Button (light DOM — slotted into .cmm-cart)
   ============================================================================= */

.cmm-cart-btn {
	display: flex;
	align-items: center;
	gap: 6px;
	text-decoration: none;
	color: inherit;
	padding: 6px 8px;
	border-radius: 6px;
	transition: opacity 0.15s ease;
	position: relative;
	flex-shrink: 0;
}

.cmm-cart-btn:hover { opacity: 0.7; }

.cmm-cart-icon {
	width: 22px;
	height: 22px;
	display: block;
	flex-shrink: 0;
}

.cmm-cart-count {
	font-size: 0.875rem;
	font-weight: 700;
	min-width: 18px;
	height: 18px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #0066cc;
	color: #ffffff;
	border-radius: 9px;
	padding: 0 5px;
	line-height: 1;
}

/* Hide count badge when 0 */
.cmm-cart-btn [data-hook="mini-basket-count"]:empty,
.cmm-cart-count:empty { display: none; }

/* =============================================================================
   Top Bar Logos (light DOM — slotted into .cmm-topbar)
   ============================================================================= */

.cmm-topbar-logos {
	display: flex;
	align-items: center;
	gap: 20px;
	height: 100%;
}

.cmm-topbar-logo-link {
	display: flex;
	align-items: center;
	opacity: 0.75;
	transition: opacity 0.15s ease;
}

.cmm-topbar-logo-link:hover { opacity: 1; }

.cmm-topbar-logo-img {
	display: block;
	height: 24px;
	width: auto;
	object-fit: contain;
}
