/**
 * Spiridea – vlastné štýly témy (jediný CSS súbor pre všetky úpravy).
 * Načítava sa na každej stránke cez functions.php (sp_enqueue_theme_css).
 *
 * Sekcie:
 *   1. Live search (hlavička, desktop + mobil)
 *   2. Odporúčania lekárov (sekcia pod galériou produktu + lightbox)
 *   3. Produktová karta – hover/tap popis ikoniek problémov
 *   4. Popis kategórie pod výpisom – zbaliteľný (gradient + tlačidlo so šípkou)
 */

/* =========================================================================
 * 1. Live search
 * ====================================================================== */

/* Zoznam ------------------------------------------------------------------ */

.sp-header__search .sp-live-search-results {
	overflow: hidden;
}

.sp-header__search .sp-live-search-results__list {
	list-style: none;
	margin: 0;
	padding: 6px 0;
}

.sp-header__search .sp-live-search-results__item {
	margin: 0;
	border-top: 1px solid #eef0f5;
}

.sp-header__search .sp-live-search-results__item:first-child {
	border-top: 0;
}

.sp-header__search .sp-live-search-results__item a.sp-live-search-results__link {
	display: flex;
	align-items: center;
	gap: 14px;
	padding: 10px 16px;
	color: #403A60;
	text-decoration: none;
	transition: background-color 0.15s ease;
}

.sp-header__search .sp-live-search-results__item a.sp-live-search-results__link:hover,
.sp-header__search .sp-live-search-results__item a.sp-live-search-results__link:focus {
	background-color: #f4f3f9;
	text-decoration: none;
}

.sp-header__search .sp-live-search-results__image {
	flex: 0 0 56px;
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 8px;
	background: #f6f6f8;
}

/* Názov + cena: cena má pevnú šírku vpravo, názov zaberá zvyšok. */
.sp-header__search .sp-live-search-results__content {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	flex: 1 1 auto;
	width: auto;
	min-width: 0;
}

.sp-header__search .sp-live-search-results__title {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 14px;
	line-height: 1.35;
	font-weight: 500;
}

.sp-header__search .sp-live-search-results__price {
	flex: 0 0 84px;
	width: 84px;
	min-width: 84px;
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: center;
	text-align: right;
	line-height: 1.25;
	white-space: nowrap;
	font-size: 14px;
	font-weight: 700;
}

.sp-header__search .sp-live-search-results__price del {
	font-size: 12px;
	font-weight: 400;
	color: #8d8a9e;
	text-decoration: line-through;
}

.sp-header__search .sp-live-search-results__price ins {
	text-decoration: none;
}

.sp-header__search .sp-live-search-results__price .woocommerce-Price-amount {
	white-space: nowrap;
}

.sp-header__search .sp-live-search-results__message {
	padding: 18px 16px;
	text-align: center;
	font-size: 14px;
	color: #6f6c84;
}

/* Mobil ------------------------------------------------------------------- */

@media (max-width: 767px) {
	/* 16px zabráni automatickému zoomu Safari/Chrome pri fokuse na políčko. */
	.sp-header__search .search-field,
	.sp-header__search .woocommerce-product-search input[type="search"] {
		font-size: 16px !important;
	}

	/* Otvorené vyhľadávanie: plné biele pozadie namiesto blur efektu. */
	#masthead .sp-header__search.is-mobile-open {
		background: #fff;
		-webkit-backdrop-filter: none;
		backdrop-filter: none;
	}

	/* Výsledky na celú šírku obrazovky tesne pod bielou lištou, bez zaoblenia,
	   oddelené linkou a jemným tieňom. */
	#masthead .sp-header__search.is-mobile-open .sp-live-search-results {
		top: 100%;
		left: 0;
		width: 100vw;
		padding-top: 0;
		border-radius: 0;
		border-top: 1px solid #e6e4ef;
		box-shadow: 0 12px 24px rgba(64, 58, 96, 0.14);
		max-height: calc(100vh - 170px);
		max-height: calc(100dvh - 170px);
		overflow-y: auto;
		-webkit-overflow-scrolling: touch;
	}

	.sp-header__search .sp-live-search-results__item a.sp-live-search-results__link {
		padding: 10px 14px;
		gap: 12px;
	}

	.sp-header__search .sp-live-search-results__image {
		flex-basis: 50px;
		width: 50px;
		height: 50px;
	}

	.sp-header__search .sp-live-search-results__price {
		flex-basis: 78px;
		width: 78px;
		min-width: 78px;
	}
}

/* =========================================================================
 * 2. Odporúčania lekárov
 * ====================================================================== */

.sp-doctor-videos {
	margin: 30px 0 0;
	padding: 32px;
	background: #fff;
	border-radius: 16px;
}

.sp-doctor-videos__title {
	margin: 0 0 24px;
	font-size: 32px;
	font-weight: 600;
	line-height: 1.2;
	color: #403A60;
	text-align: center;
}

/* 3 stĺpce po 1/3; položka má vnútorné odsadenie, aby texty neboli až po okraj stĺpca. */
.sp-doctor-videos__list {
	display: grid;
	grid-template-columns: repeat(3, minmax(0, 1fr));
	gap: 28px 0;
}

.sp-doctor-videos__item {
	display: flex;
	flex-direction: column;
	align-items: center;
	min-width: 0;
	padding: 0 12px;
	box-sizing: border-box;
}

/* Thumb button – reset Storefront button styles (vrátane sivého hover pozadia). */
.sp-doctor-videos__thumb,
.sp-doctor-videos__thumb:hover,
.sp-doctor-videos__thumb:focus,
.sp-doctor-videos__thumb:active {
	display: block;
	padding: 0;
	margin: 0;
	border: 0;
	background: transparent;
	background-color: transparent;
	box-shadow: none;
	outline: none;
	cursor: pointer;
	line-height: 0;
	color: inherit;
}

.sp-doctor-videos__thumb:focus-visible .sp-doctor-videos__ring {
	outline: 2px solid #403A60;
	outline-offset: 3px;
}

/* Fialový rámik (farba webu) okolo kruhovej fotky, max 100px. */
.sp-doctor-videos__ring {
	position: relative;
	display: block;
	width: 100px;
	height: 100px;
	max-width: 100%;
	padding: 3px;
	border-radius: 50%;
	background: #403A60;
	transition: transform 0.2s ease;
	box-sizing: border-box;
}

.sp-doctor-videos__thumb:hover .sp-doctor-videos__ring {
	transform: scale(1.05);
}

.sp-doctor-videos__preview {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	overflow: hidden;
	background: #E0E5EE;
	border: 2px solid #fff;
	box-sizing: border-box;
}

.sp-doctor-videos__item--video .sp-doctor-videos__preview {
	background: #111;
}

.sp-doctor-videos__preview img,
.sp-doctor-videos__preview video {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
	pointer-events: none;
}

.sp-doctor-videos__icon {
	position: absolute;
	top: 50%;
	left: 50%;
	width: 36px;
	height: 36px;
	transform: translate(-50%, -50%);
	pointer-events: none;
}

.sp-doctor-videos__icon svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: #fff;
	filter: drop-shadow(0 1px 4px rgba(0, 0, 0, 0.7));
}

.sp-doctor-videos__meta {
	padding: 10px 0 0;
	text-align: center;
	width: 100%;
	max-width: 220px;
}

/* Povolanie (zobrazuje sa namiesto Instagramu). */
.sp-doctor-videos__profession {
	margin-top: 3px;
	font-size: 12px;
	line-height: 1.3;
	color: #6f6c84;
}

/* Odznak s bublinou na fotke textového testimonialu. */
.sp-doctor-videos__badge {
	position: absolute;
	right: -2px;
	bottom: -2px;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	background: #403A60;
	border: 2px solid #fff;
	box-sizing: border-box;
	pointer-events: none;
}

.sp-doctor-videos__badge svg {
	display: block;
	width: 16px;
	height: 16px;
}

.sp-doctor-videos__name {
	font-weight: 700;
	font-size: 13px;
	line-height: 1.3;
	letter-spacing: 0.04em;
	text-transform: uppercase;
	color: #403A60;
}

.sp-doctor-videos__links {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 2px;
	margin-top: 4px;
	font-size: 12px;
	line-height: 1.3;
}

.sp-doctor-videos__link {
	display: block;
	max-width: 100%;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	color: #403A60;
	text-decoration: none;
}

.sp-doctor-videos__link:hover,
.sp-doctor-videos__link:focus {
	text-decoration: underline;
	color: #403A60;
}

/* ---------------------------------------------------------------------
 * Lightbox
 * ------------------------------------------------------------------ */

.sp-doctor-videos-lightbox {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
}

.sp-doctor-videos-lightbox[hidden] {
	display: none;
}

/* Len minimálne stmavenie + jemný blur – stránka pod tým ostáva čitateľná. */
.sp-doctor-videos-lightbox__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.18);
	-webkit-backdrop-filter: blur(2px);
	backdrop-filter: blur(2px);
}

.sp-doctor-videos-lightbox__dialog {
	position: relative;
	z-index: 1;
	max-width: min(92vw, 480px);
	max-height: 88vh;
	border-radius: 14px;
	overflow: hidden;
	background: #000;
	box-shadow: 0 20px 60px rgba(0, 0, 0, 0.35);
}

.sp-doctor-videos-lightbox__video {
	display: block;
	max-width: 100%;
	max-height: 88vh;
	width: auto;
	height: auto;
	background: #000;
}

/* Režimy: video vs. text – nepoužitý obsah je skrytý. */
.sp-doctor-videos-lightbox__text {
	display: none;
}

.sp-doctor-videos-lightbox--text .sp-doctor-videos-lightbox__video {
	display: none;
}

.sp-doctor-videos-lightbox--text .sp-doctor-videos-lightbox__dialog {
	width: min(92vw, 560px);
	max-width: none;
	background: #fff;
	overflow: auto;
}

.sp-doctor-videos-lightbox--text .sp-doctor-videos-lightbox__text {
	display: block;
	position: relative;
	padding: 56px 36px 32px;
	color: #403A60;
}

/* Úvodzovky vpravo od fotky, ktorá trčí z ľavého horného rohu. */
.sp-doctor-videos-lightbox__quote {
	position: absolute;
	top: 16px;
	left: 64px;
	width: 40px;
	height: 40px;
	opacity: 0.18;
}

.sp-doctor-videos-lightbox__quote svg {
	display: block;
	width: 100%;
	height: 100%;
	fill: #403A60;
}

/* Fotka lekára trčí z ľavého horného rohu karty von, text má celú šírku. */
.sp-doctor-videos-lightbox__photo {
	position: absolute;
	top: -28px;
	left: -24px;
	width: 80px;
	height: 80px;
	border-radius: 50%;
	padding: 3px;
	background: #403A60;
	box-sizing: border-box;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.18);
}

.sp-doctor-videos-lightbox__photo img {
	display: block;
	width: 100%;
	height: 100%;
	border-radius: 50%;
	object-fit: cover;
	border: 2px solid #fff;
	box-sizing: border-box;
}

.sp-doctor-videos-lightbox--no-photo .sp-doctor-videos-lightbox__photo {
	display: none;
}

.sp-doctor-videos-lightbox__body {
	font-size: 17px;
	line-height: 1.6;
	font-style: italic;
	min-height: 60px;
}

/* Bez fotky: úvodzovky na začiatku. */
.sp-doctor-videos-lightbox--no-photo .sp-doctor-videos-lightbox__quote {
	left: 28px;
}

.sp-doctor-videos-lightbox__body p {
	margin: 0 0 1em;
}

.sp-doctor-videos-lightbox__body p:last-child {
	margin-bottom: 0;
}

.sp-doctor-videos-lightbox__author {
	margin-top: 20px;
	font-weight: 700;
	font-size: 13px;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.sp-doctor-videos-lightbox__author:empty {
	display: none;
}

.sp-doctor-videos-lightbox__profession {
	margin-top: 2px;
	font-size: 13px;
	color: #6f6c84;
}

.sp-doctor-videos-lightbox__profession:empty {
	display: none;
}

.sp-doctor-videos-lightbox__close,
.sp-doctor-videos-lightbox__close:hover,
.sp-doctor-videos-lightbox__close:focus,
.sp-doctor-videos-lightbox__close:active {
	position: absolute;
	top: 8px;
	right: 8px;
	z-index: 2;
	width: 36px;
	height: 36px;
	padding: 0;
	margin: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(0, 0, 0, 0.55);
	color: #fff;
	font-size: 26px;
	line-height: 36px;
	text-align: center;
	cursor: pointer;
	box-shadow: none;
	outline: none;
}

.sp-doctor-videos-lightbox__close:hover {
	background: rgba(0, 0, 0, 0.8);
}

/* V textovom popupe je krížik fialový a nad fotkou v rohu. */
.sp-doctor-videos-lightbox--text .sp-doctor-videos-lightbox__close {
	top: -4px;
	right: -4px;
	width: 30px;
	height: 30px;
	line-height: 30px;
	font-size: 22px;
	background: #403A60;
	transform: translate(0, 0);
}

.sp-doctor-videos-lightbox--text .sp-doctor-videos-lightbox__dialog {
	overflow: visible;
}

.sp-doctor-videos-lightbox__close:focus-visible {
	outline: 2px solid #fff;
	outline-offset: 2px;
}

body.sp-doctor-videos-lightbox-open {
	overflow: hidden;
}

@media (max-width: 767px) {
	.sp-doctor-videos {
		padding: 20px;
		border-radius: 12px;
	}

	.sp-doctor-videos__title {
		font-size: 24px;
		margin-bottom: 18px;
	}

	/* Telefón: 2 vedľa seba. */
	.sp-doctor-videos__list {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 20px 0;
	}

	.sp-doctor-videos__item {
		padding: 0 6px;
	}

	.sp-doctor-videos__ring {
		width: 84px;
		height: 84px;
	}

	.sp-doctor-videos__icon {
		width: 30px;
		height: 30px;
	}

	.sp-doctor-videos__badge {
		width: 28px;
		height: 28px;
	}

	.sp-doctor-videos__badge svg {
		width: 14px;
		height: 14px;
	}

	.sp-doctor-videos-lightbox {
		padding: 12px;
	}

	/* Telefón: úvodzovky menšie a nad textom (text začína až pod nimi), aby ho neprekrývali. */
	.sp-doctor-videos-lightbox--text .sp-doctor-videos-lightbox__text {
		padding: 60px 22px 24px;
	}

	.sp-doctor-videos-lightbox__quote {
		top: 20px;
		left: 48px;
		width: 28px;
		height: 28px;
		opacity: 0.3;
	}

	.sp-doctor-videos-lightbox--no-photo .sp-doctor-videos-lightbox__quote {
		left: 20px;
	}

	.sp-doctor-videos-lightbox__photo {
		width: 60px;
		height: 60px;
		top: -22px;
		left: -12px;
	}

	.sp-doctor-videos-lightbox__body {
		font-size: 15px;
	}
}


/* =========================================================================
 * 3. Produktová karta – ikonky problémov: hover (desktop) / ťuknutie (mobil)
 * zobrazí popis ako "pill" s názvom problému vedľa zväčšenej ikonky.
 * Základné štýly (pozícia, veľkosť ikoniek, max 3) sú v Customizer CSS.
 * ====================================================================== */

/* Customizer: max-height 210px + overflow:hidden = zámerne max 4 ikonky.
   Overflow by ale orezal aj pill (kontajner je široký len 48px), preto rovnaký limit
   riešime skrytím 5. a ďalšej ikonky a kontajner necháme neorezaný. */
div.sp-product-card__problemy-labels {
	overflow: visible;
	max-height: none;
}

div.sp-product-card__problemy-labels > .sp-product-card__problemy-label:nth-child(n+5) {
	display: none;
}

/* Veľkosť labelu určuje obrázok (desktop 48px, mobil 35px z Customizer CSS) – nič pevné,
   inak by vznikli väčšie medzery medzi ikonkami. */
.sp-product-card__problemy-label {
	position: relative;
	display: block;
	width: max-content;
	height: auto;
	font-size: 0;
	line-height: 0;
	cursor: pointer;
}

.sp-product-card__problemy-label img.sp-product-card__problemy-label-img {
	position: relative;
	z-index: 2;
	display: block;
	transition: transform 0.2s ease;
	transform-origin: center;
	background: #fff;
}

.sp-product-card__problemy-item--icon svg {
	z-index: 3;
	transition: transform 0.2s ease;
}

/* Pill s názvom – skrytý, zobrazí sa pri hoveri / is-open. */
.sp-product-card__problemy-label-text {
	position: absolute;
	top: 50%;
	left: -4px;
	z-index: 1;
	display: inline-flex;
	align-items: center;
	width: max-content;
	max-width: 235px; /* karta má overflow:hidden – dlhší názov sa zalomí do 2 riadkov */
	min-height: 54px;
	padding: 8px 20px 8px 70px;
	box-sizing: border-box;
	transform: translateY(-50%);
	background: #fff;
	border: 1px solid #403A60;
	border-radius: 999px;
	box-shadow: 0 6px 18px rgba(64, 58, 96, 0.16);
	font-size: 15px;
	font-weight: 500;
	line-height: 1.2;
	color: #403A60;
	white-space: normal;
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	transition: opacity 0.15s ease, visibility 0.15s ease;
}

.sp-product-card__problemy-label.is-open {
	z-index: 20;
}

.sp-product-card__problemy-label.is-open img.sp-product-card__problemy-label-img {
	transform: scale(1.4);
}

.sp-product-card__problemy-label.is-open .sp-product-card__problemy-item--icon svg {
	transform: translate(4px, -4px);
}

.sp-product-card__problemy-label.is-open .sp-product-card__problemy-label-text {
	opacity: 1;
	visibility: visible;
}

@media (hover: hover) {
	.sp-product-card__problemy-label:hover {
		z-index: 20;
	}

	.sp-product-card__problemy-label:hover img.sp-product-card__problemy-label-img {
		transform: scale(1.4);
	}

	.sp-product-card__problemy-label:hover .sp-product-card__problemy-item--icon svg {
		transform: translate(4px, -4px);
	}

	.sp-product-card__problemy-label:hover .sp-product-card__problemy-label-text {
		opacity: 1;
		visibility: visible;
	}
}

@media (max-width: 767px) {
	/* Karta má na mobile ~163px a overflow:hidden; ikonka 35px, label začína 10px od okraja. */
	.sp-product-card__problemy-label-text {
		left: -3px;
		min-height: 40px;
		max-width: 150px;
		padding: 5px 10px 5px 46px;
		font-size: 12px;
		line-height: 1.15;
		letter-spacing: -0.01em;
	}

	.sp-product-card__problemy-label.is-open img.sp-product-card__problemy-label-img {
		transform: scale(1.25);
	}
}


/* =========================================================================
 * 4. Popis kategórie pod výpisom – zbaliteľný
 *    Základ boxu (.sp-archive-description-box) je v includes/archive-banner.php.
 * ====================================================================== */

.sp-archive-description-box--collapsible {
	position: relative;
	padding-bottom: 30px;
}

.sp-archive-description__content {
	position: relative;
	max-height: 170px;
	overflow: hidden;
	transition: max-height 0.3s ease;
}

/* Gradient do bielej (pozadie boxu je biele). */
.sp-archive-description__content::after {
	content: "";
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	height: 90px;
	background: linear-gradient(to bottom, rgba(255, 255, 255, 0) 0%, #fff 85%);
	pointer-events: none;
}

/* Okrúhle tlačidlo so šípkou, bez textu, v strede pod gradientom (reset Storefront buttonu). */
.sp-archive-description__toggle,
.sp-archive-description__toggle:hover,
.sp-archive-description__toggle:focus,
.sp-archive-description__toggle:active {
	position: absolute;
	left: 50%;
	bottom: -22px;
	z-index: 2;
	width: 44px !important;  /* globálne štýly buttonov ho inak rozťahujú na 50px */
	min-width: 0 !important;
	height: 44px !important;
	padding: 0 !important;  /* Elementor prepisuje padding a farby buttonov */
	margin: 0;
	border: 0 !important;
	border-radius: 50% !important;
	background: #403A60 !important;
	background-color: #403A60 !important;
	color: #fff !important;
	cursor: pointer;
	box-shadow: 0 4px 14px rgba(64, 58, 96, 0.3);
	outline: none;
	transform: translateX(-50%);
	display: flex;
	align-items: center;
	justify-content: center;
	transition: transform 0.2s ease, background-color 0.2s ease;
}

.sp-archive-description__toggle:hover {
	background: #2f2a4a !important;
	background-color: #2f2a4a !important;
	transform: translateX(-50%) scale(1.06);
}

.sp-archive-description__toggle:focus-visible {
	outline: 2px solid #403A60;
	outline-offset: 3px;
}

.sp-archive-description__toggle svg {
	display: block;
	width: 22px;
	height: 22px;
	color: #fff;
	transition: transform 0.25s ease;
}

/* Chevron biely vždy, nie len pri hoveri (globálne štýly menia farbu buttonu). */
.sp-archive-description__toggle svg path {
	stroke: #fff !important;
	fill: none !important;
}

/* Rozbalené: bez limitu, bez gradientu, šípka hore. */
.sp-archive-description-box--collapsible.is-expanded .sp-archive-description__content {
	max-height: none;
}

.sp-archive-description-box--collapsible.is-expanded .sp-archive-description__content::after {
	display: none;
}

.sp-archive-description-box--collapsible.is-expanded .sp-archive-description__toggle svg {
	transform: rotate(180deg);
}

/* Krátky popis (JS): nič nezbaľovať, žiadne tlačidlo. */
.sp-archive-description-box--collapsible.is-short {
	padding-bottom: 30px;
}

.sp-archive-description-box--collapsible.is-short .sp-archive-description__content {
	max-height: none;
}

.sp-archive-description-box--collapsible.is-short .sp-archive-description__content::after,
.sp-archive-description-box--collapsible.is-short .sp-archive-description__toggle {
	display: none;
}

@media (max-width: 767px) {
	.sp-archive-description__content {
		max-height: 150px;
	}

	.sp-archive-description-box--collapsible {
		padding-bottom: 20px;
	}

	.sp-archive-description__toggle,
	.sp-archive-description__toggle:hover {
		width: 40px !important;
		height: 40px !important;
		bottom: -20px;
	}
}
