/*!
 * viste-prime-ux 1.2.7 - Prime Pharmacy (theme "prime", OpenCart 3.0.2.0)
 * Visible search, sticky header, sticky add-to-cart, compact mobile delivery note.
 * All selectors are scoped to body.viste-prime-ux (added by the viste_prime_ux_v1 OCMOD)
 * or to new .viste-prime-ux-* classes.
 *
 * z-index scale used here (Bootstrap 3 modals stay above: backdrop 1040, modal 1050):
 *   1019 sticky add-to-cart bar
 *   1020 sticky header (desktop: header row only; tablet/mobile: header row + collapsible menu)
 *   iSearch dropdown keeps its configured z-index (999999).
 */

/* ------------------------------------------------------------------
 * 1. Sticky header
 *    The OCMOD closes .main-top right after the menu, so .main-top
 *    holds only <header> + menu and is a direct child of <body>.
 * ------------------------------------------------------------------ */
/* notifywhenavailable.css sets "html,body { overflow: auto !important }" for
   phone/tablet device widths. With both set, <body> becomes a scroll container
   and position: sticky never engages. The viewport scroll is driven by <html>,
   so keeping <body> non-scrolling changes nothing else. */
html body.viste-prime-ux {
	overflow: visible !important;
}

body.viste-prime-ux > .main-top {
	position: -webkit-sticky;
	position: sticky;
	top: 0;
	z-index: 1020;
	background: #fff;
}

body.viste-prime-ux.viste-prime-ux-is-stuck > .main-top {
	box-shadow: 0 2px 10px rgba(0, 16, 65, 0.08);
}

/* Desktop (horizontal category menu): only the header row is sticky, the
   menu scrolls away with the page. .main-top stops generating a box so the
   <header> is sticky against <body> for the whole page. */
@media (min-width: 1024px) {
	body.viste-prime-ux > .main-top {
		display: contents;
	}

	body.viste-prime-ux > .main-top > header {
		position: -webkit-sticky;
		position: sticky;
		top: 0;
		z-index: 1020;
		background: #fff;
	}

	body.viste-prime-ux.viste-prime-ux-is-stuck > .main-top > header {
		box-shadow: 0 2px 10px rgba(0, 16, 65, 0.08);
	}

	/* Left button (same look as the tablet menu button) appears once the menu
	   has scrolled out of view; it takes the visitor back to the top/menu. */
	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .custom_mobile_menu_trigger {
		display: block !important;
		margin: 0 20px 0 10px;
	}

	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .custom_mobile_menu_trigger .btn-navbar {
		background: #498ed4;
		color: #fff;
		border: none;
		box-shadow: none;
	}

	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .custom_mobile_menu_trigger .btn-navbar .fa {
		font-size: 19px;
	}

	/* Compact sticky header: no Facebook / Instagram, wishlist as an icon
	   (the link keeps its title, so it still has an accessible name). */
	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .header-contacts .fb_holder,
	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .header-contacts .instagram_holder {
		display: none !important;
	}

	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .header-contacts .wishlist_holder #wishlist-total > span {
		display: none !important;
	}

	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .header-contacts .wishlist_holder {
		width: 40px;
		height: 40px;
		justify-content: center;
		border-radius: 50%;
	}

	/* No empty gaps: the search takes the free width, contacts + cart sit
	   right after it (the theme gives .header-contacts a fixed width with
	   centered content and the row uses space-between). */
	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .row > .search-div {
		flex: 1 1 auto;
		width: auto !important;
		min-width: 0;
		margin-left: 10px !important;
		margin-right: 20px !important;
	}

	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .row > .search-div #search {
		width: 100% !important;
	}

	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .row > .header-contacts {
		flex: 0 0 auto;
		width: auto !important;
		justify-content: flex-end;
	}

	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .row > .cart-div {
		margin-left: 10px !important;
		margin-right: 10px !important;
	}

	body.viste-prime-ux.viste-prime-ux-menu-away > .main-top > header .header-contacts .wishlist_holder #wishlist-total {
		display: inline-flex;
		align-items: center;
		justify-content: center;
		width: 100%;
		height: 100%;
		padding: 0;
	}
}

/* Mini cart can be longer than the space under a sticky header. */
body.viste-prime-ux > .main-top header #cart .dropdown-menu {
	max-height: calc(100vh - var(--viste-prime-ux-header-h, 0px) - 16px);
	overflow-y: auto;
}

@media (max-width: 1023px) {
	/* Opened mobile/tablet menu scrolls inside the sticky header. */
	body.viste-prime-ux > .main-top .navbar-ex1-collapse.in {
		max-height: calc(100vh - var(--viste-prime-ux-headrow-h, 0px));
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
		overscroll-behavior: contain;
	}

	/* The closed menu container has height 0 / opacity 0; keep its
	   invisible content from capturing taps under the sticky header. */
	body.viste-prime-ux > .main-top .container.menu-container:not(.menu-open-custom) {
		overflow: hidden;
		pointer-events: none;
	}
}

@supports (height: 100dvh) {
	body.viste-prime-ux > .main-top header #cart .dropdown-menu {
		max-height: calc(100dvh - var(--viste-prime-ux-header-h, 0px) - 16px);
	}

	@media (max-width: 1023px) {
		body.viste-prime-ux > .main-top .navbar-ex1-collapse.in {
			max-height: calc(100dvh - var(--viste-prime-ux-headrow-h, 0px));
		}
	}
}

/* ------------------------------------------------------------------
 * 2. Visible search on mobile: compact first row + full-width search row
 *    (desktop/tablet keep the current inline field)
 * ------------------------------------------------------------------ */
@media (max-width: 767px) {
	/* Row 1: menu | logo | profile + wishlist | cart | currency; row 2: search */
	body.viste-prime-ux > .main-top > header .row {
		display: grid !important;
		grid-template-columns: auto minmax(0, 1fr) auto auto auto;
		align-items: center;
		padding-top: 8px;
		padding-bottom: 10px;
	}

	body.viste-prime-ux > .main-top > header .row::before,
	body.viste-prime-ux > .main-top > header .row::after {
		display: none;
	}

	body.viste-prime-ux > .main-top > header .row > .custom_mobile_menu_trigger {
		grid-column: 1;
		grid-row: 1;
	}

	body.viste-prime-ux > .main-top > header .row > .logo-div {
		grid-column: 2;
		grid-row: 1;
		justify-self: start;
		min-width: 0;
		max-width: 100%;
	}

	body.viste-prime-ux > .main-top > header .row > .header-contacts {
		grid-column: 3;
		grid-row: 1;
	}

	body.viste-prime-ux > .main-top > header .row > .cart-div {
		grid-column: 4;
		grid-row: 1;
	}

	body.viste-prime-ux > .main-top > header .row > .currency-div {
		grid-column: 5;
		grid-row: 1;
	}

	body.viste-prime-ux > .main-top > header .row > .search-div {
		grid-column: 1 / -1;
		grid-row: 2;
		width: 100% !important;
		max-width: 100%;
		float: none;
		margin: 8px 0 0 !important;
		padding: 0 10px !important;
		background: transparent;
		border-radius: 0;
		line-height: normal;
	}

	body.viste-prime-ux > .main-top > header .search-div .mobile_search_trigger {
		display: none !important;
	}

	body.viste-prime-ux > .main-top > header .search-div #search {
		display: table;
		position: relative;
		top: auto;
		left: auto;
		width: 100% !important;
		max-height: none;
		opacity: 1;
		overflow: visible;
		padding: 0;
		background: transparent;
		z-index: auto;
		transition: none;
	}

	body.viste-prime-ux > .main-top > header .search-div #search .input-lg {
		width: 100%;
		min-width: 0;
		background: #f5faff;
		font-size: 16px; /* prevents iOS zoom on focus */
	}

	body.viste-prime-ux > .main-top > header .search-div #search .input-group-btn {
		width: 1%;
	}
}

/* ------------------------------------------------------------------
 * 3. iSearch dropdown follows the (sticky) field
 *    Positions come from viste-prime-ux.js (CSS variables). Active only
 *    when the script is running; otherwise iSearch keeps its own layout.
 * ------------------------------------------------------------------ */
html.viste-prime-ux-js body.viste-prime-ux .isearch-container[role^="isearch-container-"] {
	position: fixed !important;
	top: var(--viste-prime-ux-search-top, 0px) !important;
	left: var(--viste-prime-ux-search-left, 0px) !important;
	max-width: calc(100vw - var(--viste-prime-ux-search-left, 0px) - 8px) !important;
	max-height: calc(100vh - var(--viste-prime-ux-search-top, 0px) - 8px) !important;
	overflow-x: hidden !important;
	overflow-y: auto !important;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	/* z-index stays iSearch's own setting (999999): above the sticky header as before. */
}

@media (max-width: 767px) {
	html.viste-prime-ux-js body.viste-prime-ux .isearch-container[role^="isearch-container-"] {
		left: 8px !important;
		right: 8px !important;
		width: auto !important;
		min-width: 0 !important;
		max-width: none !important;
	}
}

@supports (height: 100dvh) {
	html.viste-prime-ux-js body.viste-prime-ux .isearch-container[role^="isearch-container-"] {
		max-height: calc(100dvh - var(--viste-prime-ux-search-top, 0px) - 8px) !important;
	}
}

/* ------------------------------------------------------------------
 * 4. Sticky add-to-cart bar (product page)
 * ------------------------------------------------------------------ */
.viste-prime-ux-atc {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 1019;
	padding: 10px 0;
	padding-bottom: calc(10px + env(safe-area-inset-bottom, 0px));
	background: #fff;
	border-top: 1px solid #e4f0f8;
	box-shadow: 0 -4px 16px rgba(0, 16, 65, 0.08);
	visibility: hidden;
	opacity: 0;
	transform: translateY(100%);
	transition: transform 0.2s ease, opacity 0.2s ease, visibility 0s linear 0.2s;
}

.viste-prime-ux-atc.is-visible {
	visibility: visible;
	opacity: 1;
	transform: none;
	transition: transform 0.2s ease, opacity 0.2s ease, visibility 0s linear 0s;
}

/* Modals (popup add cart, notify-when-available, etc.) stay on top. */
body.modal-open .viste-prime-ux-atc {
	visibility: hidden !important;
}

.viste-prime-ux-atc__inner {
	display: flex;
	align-items: center;
	gap: 16px;
}

.viste-prime-ux-atc__thumb {
	flex: 0 0 auto;
	width: 48px;
	height: 48px;
	object-fit: contain;
}

.viste-prime-ux-atc__name {
	flex: 1 1 auto;
	min-width: 0;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	font-size: 15px;
	color: #444;
}

.viste-prime-ux-atc__meta {
	flex: 0 0 auto;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	line-height: 1.2;
}

.viste-prime-ux-atc__price {
	font-size: 22px;
	color: #d2307e;
	white-space: nowrap;
}

.viste-prime-ux-atc__price:empty {
	display: none;
}

.viste-prime-ux-atc__qty {
	font-size: 12px;
	color: #777;
	white-space: nowrap;
}

.viste-prime-ux-atc__button,
.viste-prime-ux-atc__button:focus {
	flex: 0 0 auto;
	min-height: 44px;
	min-width: 220px;
	padding: 10px 20px;
	border: 0;
	border-radius: 0;
	background: #25e3d0;
	color: #fff;
	font-size: 14px;
	text-transform: uppercase;
	white-space: nowrap;
	box-shadow: none;
}

.viste-prime-ux-atc__button:hover,
.viste-prime-ux-atc__button:active {
	background: #0dd2be;
	color: #fff;
}

.viste-prime-ux-atc__button:focus-visible {
	outline: 2px solid #09638e;
	outline-offset: 2px;
}

.viste-prime-ux-atc__button[disabled] {
	opacity: 0.65;
	cursor: progress;
}

/* Keep the end of the page readable and the "back to top" button reachable. */
body.viste-prime-ux-atc-visible {
	padding-bottom: var(--viste-prime-ux-atc-h, 0px);
}

body.viste-prime-ux-atc-visible .scrollToTop {
	bottom: calc(var(--viste-prime-ux-atc-h, 0px) + 15px);
}

@media (max-width: 767px) {
	.viste-prime-ux-atc {
		padding-left: 0;
		padding-right: 0;
	}

	.viste-prime-ux-atc__inner {
		gap: 12px;
		padding-left: 12px;
		padding-right: 12px;
	}

	.viste-prime-ux-atc__thumb,
	.viste-prime-ux-atc__name {
		display: none;
	}

	.viste-prime-ux-atc__meta {
		align-items: flex-start;
	}

	.viste-prime-ux-atc__price {
		font-size: 20px;
	}

	.viste-prime-ux-atc__button,
	.viste-prime-ux-atc__button:focus {
		flex: 1 1 auto;
		min-width: 0;
		padding: 10px 12px;
		font-size: 13px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.viste-prime-ux-atc,
	.viste-prime-ux-atc.is-visible {
		transition: none;
	}
}

/* ------------------------------------------------------------------
 * 5. Product description block (tabs + content) as in the mockup:
 *    horizontal tabs with an underline, active tab in brand pink,
 *    full-width description on white. Markup and content unchanged.
 * ------------------------------------------------------------------ */
body.viste-prime-ux.product-page .product-info-holder {
	background: #fff;
	padding: 0 0 40px;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs {
	display: flex;
	flex-wrap: wrap;
	gap: 0 30px;
	float: none;
	width: auto;
	min-height: 0;
	margin: 24px 0 0;
	padding: 9px 0;
	border: 0;
	border-bottom: 1px solid #ddd;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs::before,
body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs::after {
	display: none;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs > li {
	float: none;
	width: auto;
	margin: 0;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs > li > a,
body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs > li > a:focus {
	margin: 0;
	padding: 6px 0;
	border: 0;
	background: none !important;
	color: #555 !important;
	font-size: 15px !important;
	font-weight: normal !important;
	line-height: 1.6;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs > li > a:hover,
body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs > li.active > a,
body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs > li.active > a:focus,
body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs > li.active > a:hover {
	padding-left: 0;
	color: #c52c83 !important;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs > li.active > a {
	font-weight: 500 !important;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs > li.active > a::before {
	display: none;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs > li > a:focus-visible {
	outline: 2px solid #09638e;
	outline-offset: 2px;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .tab-content {
	display: block;
	float: none;
	width: 100%;
	padding-top: 24px;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .tab-content #tab-description {
	max-width: 980px;
	font-size: 15px;
	line-height: 1.9;
	color: #555;
}

body.viste-prime-ux.product-page .product-info-holder .product-info .tab-content #tab-description h2 {
	font-size: 21px;
	font-weight: 500;
	color: #222;
}

@media (max-width: 767px) {
	body.viste-prime-ux.product-page .product-info-holder .product-info .nav-tabs {
		padding: 6px 0;
	}
	body.viste-prime-ux.product-page #cookiescript_badge {
	display: none !important;
}


	body.viste-prime-ux.product-page .product-info-holder .product-info .tab-content {
		padding-top: 18px;
	}

	body.viste-prime-ux.product-page .product-info-holder .product-info .tab-content #tab-description {
		font-size: 14px;
		line-height: 1.85;
	}

	body.viste-prime-ux.product-page .product-info-holder .product-info .tab-content #tab-description h2 {
		font-size: 19px;
	}
}

/* ------------------------------------------------------------------
 * 6. Delivery on mobile product pages
 *    Hides only SmartBar module #46 "Same Day Delivery For Varna"
 *    (the bar SmartBar fixes to the bottom of the screen on mobile).
 *    SmartBar derives the id from md5(module settings): if the module
 *    is edited in the admin, update the id below (see README).
 * ------------------------------------------------------------------ */
.viste-prime-ux-delivery {
	display: none;
}

@media (max-width: 767px) {
	body.viste-prime-ux.product-page > [id="smartbar_9b353689f97378e07dfd41ccc58af0fe"] {
		display: none !important;
	}

	.viste-prime-ux-delivery {
		display: block;
		clear: both;
		margin: 15px 0 0;
		padding: 10px 12px;
		border-left: 3px solid #8cbbd1;
		background: #f4fafc;
		font-size: 13px;
		line-height: 1.6;
		color: #555;
	}

	.viste-prime-ux-delivery__title {
		display: block;
		color: #333;
	}

	.viste-prime-ux-delivery a {
		color: #09638e;
		text-decoration: underline;
	}
}

/* ------------------------------------------------------------------
 * 7. Desktop category menu
 *    Pure CSS, correct from the first paint (no JS needed):
 *    - 1024-1439px: the items wrap to more rows at the theme size, but a
 *      label never breaks inside a word.
 *    - 1440px+: one row; 8px side padding and a font that scales with the
 *      viewport (calibrated on the current category names), max 15.5px
 *      (the container stops growing at 1920px).
 *    Safety net in the JS: if the labels change and no longer fit, it lowers
 *    --viste-prime-ux-menu-fs (min 11px) or, as a last resort, sets
 *    html.viste-prime-ux-menu-wrap. With the current menu it changes nothing.
 * ------------------------------------------------------------------ */
@media (min-width: 1024px) {
	body.viste-prime-ux #menu .navbar-nav {
		display: flex !important;
		flex-wrap: wrap;
		justify-content: center;
		float: none;
		width: 100%;
		margin: 0;
	}

	body.viste-prime-ux #menu .navbar-nav > li {
		float: none;
		flex: 0 0 auto;
	}

	body.viste-prime-ux #menu .navbar-nav > li > a {
		white-space: nowrap;
		/* The theme animates "all" on these links; size changes must apply at
		   once (resize, JS check), so only colors keep the hover transition. */
		transition-property: background-color, color !important;
	}
}

@media (min-width: 1440px) {
	html:not(.viste-prime-ux-menu-wrap) body.viste-prime-ux #menu .navbar-nav {
		flex-wrap: nowrap;
		justify-content: space-between;
	}

	html:not(.viste-prime-ux-menu-wrap) body.viste-prime-ux #menu .navbar-nav > li > a {
		font-size: var(--viste-prime-ux-menu-fs, clamp(11px, calc(0.97vw - 2.9px), 15.5px)) !important;
		padding-left: 8px !important;
		padding-right: 8px !important;
	}

	/* The "+" of the dropdown items follows the label instead of sitting in a
	   wide fixed right padding. */
	html:not(.viste-prime-ux-menu-wrap) body.viste-prime-ux #menu .navbar-nav > li.dropdown > a::after {
		position: static;
		display: inline-block;
		margin-left: 0.25em;
	}
}

/* ------------------------------------------------------------------
 * 8. Product grids (category/search/special pages + related products)
 *    The theme floats the cards. Cards of different heights (2 vs 3 line
 *    names, promo vs regular price, image ratios) make the first card of the
 *    next row catch on a taller one ("staircase"); related products (6 per
 *    row, .col-sm-2) have no row-clearing rule at all at 1200px+.
 *    Flex rows: every row starts at the left, cards in a row are equally
 *    tall, price + buttons line up at the bottom, images sit in a square box.
 *    List view (.product-list) is not touched.
 * ------------------------------------------------------------------ */
body.viste-prime-ux #content .row:has(> .product-layout.product-grid),
body.viste-prime-ux .related-row {
	display: flex;
	flex-wrap: wrap;
}

body.viste-prime-ux #content .row:has(> .product-layout.product-grid)::before,
body.viste-prime-ux #content .row:has(> .product-layout.product-grid)::after,
body.viste-prime-ux .related-row::before,
body.viste-prime-ux .related-row::after {
	display: none;
}

body.viste-prime-ux #content .row > .product-layout.product-grid,
body.viste-prime-ux .related-row > [class*="col-"] {
	float: none;
	clear: none !important;
	display: flex;
	flex-direction: column;
}

body.viste-prime-ux #content .row > .product-layout.product-grid > .product-thumb,
body.viste-prime-ux .related-row > [class*="col-"] > .product-thumb {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
	width: 100%;
}

/* Category cards wrap caption + buttons in an extra <div>. */
body.viste-prime-ux #content .row > .product-layout.product-grid > .product-thumb > div:not(.image) {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
}

body.viste-prime-ux #content .row > .product-layout.product-grid .caption,
body.viste-prime-ux .related-row .product-thumb > .caption {
	display: flex;
	flex-direction: column;
	flex: 1 1 auto;
}

body.viste-prime-ux #content .row > .product-layout.product-grid .caption > .price,
body.viste-prime-ux .related-row .product-thumb > .caption > .price {
	margin-top: auto;
}

body.viste-prime-ux #content .row > .product-layout.product-grid .product-thumb > .image img,
body.viste-prime-ux .related-row .product-thumb > .image img {
	width: 100%;
	height: auto;
	aspect-ratio: 1 / 1;
	object-fit: contain;
}
