/**
 * INFAP — Preferiti corsi (stellina).
 *
 * Card: stella in alto a sinistra, visibile solo all’hover sulla card.
 * Attiva = giallo pieno; inattiva = bianca outline.
 * Categoria (course-level) a destra.
 */

:root {
	--infap-fav-yellow: #f5c518;
	--infap-fav-size: 36px;
}

.infap-fav-btn {
	position: absolute;
	top: 10px;
	left: 10px;
	right: auto;
	z-index: 6;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--infap-fav-size);
	height: var(--infap-fav-size);
	padding: 0;
	border: 0 !important;
	border-radius: 0 !important;
	background: transparent !important;
	background-color: transparent !important;
	box-shadow: none !important;
	cursor: pointer;
	color: #fff !important;
	opacity: 0;
	pointer-events: none;
	filter:
		drop-shadow(0 0 0.6px rgba(11, 52, 89, 0.95))
		drop-shadow(0 0 0.6px rgba(11, 52, 89, 0.95))
		drop-shadow(0 1px 2px rgba(0, 0, 0, 0.35));
	transition: color 0.15s ease, transform 0.15s ease, opacity 0.15s ease, filter 0.15s ease;
}

.thim-ekits-course__item:hover > .infap-fav-btn,
.thim-ekits-course__item:focus-within > .infap-fav-btn,
.learn-press-courses > .course-item:hover > .infap-fav-btn,
.learn-press-courses > .course-item:focus-within > .infap-fav-btn,
.thim-course-grid .course-item:hover > .infap-fav-btn,
.thim-course-grid .course-item:focus-within > .infap-fav-btn,
.infap-fav-card:hover > .infap-fav-btn,
.infap-fav-card:focus-within > .infap-fav-btn,
.infap-fav-host:hover > .infap-fav-btn,
.infap-fav-host:focus-within > .infap-fav-btn {
	opacity: 1;
	pointer-events: auto;
}

.infap-fav-btn:hover,
.infap-fav-btn:focus-visible {
	background: transparent !important;
	background-color: transparent !important;
	color: #fff !important;
	transform: scale(1.1);
	outline: none;
}

.infap-fav-btn.is-active,
.infap-fav-btn.is-active:hover,
.infap-fav-btn.is-active:focus-visible {
	color: var(--infap-fav-yellow) !important;
	background: transparent !important;
	background-color: transparent !important;
	filter:
		drop-shadow(0 0 0.5px rgba(11, 52, 89, 0.55))
		drop-shadow(0 1px 2px rgba(0, 0, 0, 0.3));
}

.infap-fav-btn__icon {
	display: block;
	width: 22px;
	height: 22px;
	background-color: currentColor;
	/* Stella outline (non in preferiti) */
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M22 9.24l-7.19-.62L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21 12 17.27 18.18 21l-1.63-7.03L22 9.24zM12 15.4l-3.76 2.27 1-4.28-3.32-2.88 4.38-.38L12 6.1l1.71 4.04 4.38.38-3.32 2.88 1 4.28L12 15.4z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.infap-fav-btn.is-active .infap-fav-btn__icon {
	/* Stella piena (in preferiti) */
	-webkit-mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") center / contain no-repeat;
	mask: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24'%3E%3Cpath fill='%23000' d='M12 17.27L18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z'/%3E%3C/svg%3E") center / contain no-repeat;
}

.infap-fav-btn.is-busy {
	opacity: 0.65;
	pointer-events: none;
}

/* Touch / no-hover: stella sempre raggiungibile */
@media (hover: none) {
	.thim-ekits-course__item > .infap-fav-btn,
	.learn-press-courses > .course-item > .infap-fav-btn,
	.thim-course-grid .course-item > .infap-fav-btn,
	.infap-fav-card > .infap-fav-btn,
	.infap-fav-host > .infap-fav-btn {
		opacity: 1;
		pointer-events: auto;
	}
}

/* Related Soft lift: one star in hover panel meta row (left of badge) */
.elementor-widget-thim-ekits-course-related .infap-fav-btn {
	position: static !important;
	top: auto;
	left: auto;
	right: auto;
	order: 0;
	margin: 0 auto 0 0;
	flex-shrink: 0;
	align-self: center;
	width: 28px;
	height: 28px;
	opacity: 0;
	pointer-events: none;
	color: #152747 !important;
	filter: none;
	z-index: 4;
}

.elementor-widget-thim-ekits-course-related .infap-fav-btn__icon {
	width: 20px;
	height: 20px;
}

.elementor-widget-thim-ekits-course-related .infap-fav-btn.is-active,
.elementor-widget-thim-ekits-course-related .infap-fav-btn.is-active:hover,
.elementor-widget-thim-ekits-course-related .infap-fav-btn.is-active:focus-visible {
	color: var(--infap-fav-yellow) !important;
	filter: none;
}

.elementor-widget-thim-ekits-course-related .thim-ekits-course__item:hover .infap-fav-btn,
.elementor-widget-thim-ekits-course-related .thim-ekits-course__item:focus-within .infap-fav-btn {
	opacity: 1;
	pointer-events: auto;
}

/* Prefer star inside soft-lift panel; hide resting duplicates outside it.
 * Nested .e-con inside .content-hover must NOT match the hide rule. */
.elementor-widget-thim-ekits-course-related .thim-ekits-course__item .infap-fav-btn {
	display: none !important;
}
.elementor-widget-thim-ekits-course-related .thim-ekits-course__item .content-hover .infap-fav-btn {
	display: inline-flex !important;
}

@media (hover: none) {
	.elementor-widget-thim-ekits-course-related .content-hover .infap-fav-btn {
		opacity: 1;
		pointer-events: auto;
	}
}

/* Card host: relative + overflow visible so half-out badge is not clipped */
.thim-ekits-course__item,
.learn-press-courses > .course-item,
.thim-course-grid .course-item,
.infap-fav-card,
.infap-fav-host {
	position: relative;
	overflow: visible !important;
}

/* Elementor archive columns clip absolute children — open them for the badge */
body.post-type-archive-lp_course .e-con.e-parent:has(.thim-ekits-course__item),
body.post-type-archive-lp_course .e-con.e-parent:has(.learn-press-courses),
body.tax-course_category .e-con.e-parent:has(.thim-ekits-course__item),
body.tax-course_tag .e-con.e-parent:has(.thim-ekits-course__item),
.thim-ekits-archive-course,
.lp-archive-courses,
.elementor-widget-thim-ekits-archive-course,
.elementor-widget-thim-ekits-archive-course > .elementor-widget-container {
	overflow: visible !important;
}


/* Categoria (course-level) a destra; prezzo resta a sinistra */
.thim-ekits-course__item .e-con:has(.course-level):has(.course-price),
.thim-ekits-course__item .e-con:has(.elementor-widget-thim-loop-item-info):has(.elementor-widget-learnpress_course_price) {
	justify-content: space-between !important;
	flex-wrap: nowrap !important;
}

.thim-ekits-course__item .elementor-widget-thim-loop-item-info:has(.course-level) {
	margin-left: auto;
	order: 2;
	text-align: right;
}

.thim-ekits-course__item .elementor-widget-thim-loop-item-info:has(.course-level) .elementor-icon-list-items,
.thim-ekits-course__item .elementor-widget-thim-loop-item-info:has(.course-level) .elementor-align-left {
	justify-content: flex-end;
}

.thim-ekits-course__item .elementor-widget-learnpress_course_price {
	order: 1;
	margin-right: auto;
}

/* Classic Eduma / LP cards */
.course-item .course-content .course-meta,
.course-item .course-content .course-meta > *:has(.course-level),
.learn-press-courses .course-item .course-level {
	margin-left: auto;
}

.course-item .course-content .course-meta {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	justify-content: space-between;
	gap: 0.5rem;
}

.course-item .course-level {
	margin-left: auto;
}

/* Hide native LP wishlist on cards (INFAP bookmark replaces it) */
.thim-ekits-course__item .course-wishlist,
.course-item .course-wishlist,
.learn-press-courses .course-wishlist {
	display: none !important;
}

/* Single course: full-width text button (not the hover star) */
.infap-fav-single {
	display: block;
	width: 100%;
	margin: 0.75rem 0 1rem;
}

.infap-fav-single .infap-fav-btn--text {
	position: static;
	top: auto;
	left: auto;
	opacity: 1 !important;
	pointer-events: auto !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 0.5rem;
	width: 100%;
	min-height: 44px;
	padding: 0.7rem 1rem;
	border: 1px solid #0b3459 !important;
	border-radius: 0.5rem !important;
	background: #fff !important;
	background-color: #fff !important;
	box-shadow: none !important;
	color: #0b3459 !important;
	filter: none;
	font-family: inherit;
	font-size: 14px;
	font-weight: 500;
	line-height: 1.3;
	letter-spacing: 0.02em;
	text-transform: none;
	cursor: pointer;
	transform: none;
	transition: background 0.15s ease, border-color 0.15s ease, color 0.15s ease;
}

.infap-fav-single .infap-fav-btn--text:hover,
.infap-fav-single .infap-fav-btn--text:focus-visible {
	background: #f4f7fb !important;
	background-color: #f4f7fb !important;
	color: #0b3459 !important;
	transform: none;
	outline: none;
}

.infap-fav-single .infap-fav-btn--text.is-active,
.infap-fav-single .infap-fav-btn--text.is-active:hover,
.infap-fav-single .infap-fav-btn--text.is-active:focus-visible {
	background: #fff8e0 !important;
	background-color: #fff8e0 !important;
	border-color: var(--infap-fav-yellow) !important;
	color: #0b3459 !important;
	filter: none;
}

.infap-fav-single .infap-fav-btn--text .infap-fav-btn__icon {
	width: 18px;
	height: 18px;
	flex-shrink: 0;
	background-color: currentColor;
	color: inherit;
}

.infap-fav-single .infap-fav-btn--text.is-active .infap-fav-btn__icon {
	background-color: var(--infap-fav-yellow);
}

.infap-fav-single .infap-fav-btn__label {
	display: inline-block;
}

.infap-fav-page .infap-fav-btn {
	position: static;
	opacity: 1;
	pointer-events: auto;
	filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
	color: #0b3459 !important;
}

.infap-fav-page .infap-fav-card > .infap-fav-btn {
	position: absolute;
	top: 10px;
	left: 10px;
}

.infap-fav-page .infap-fav-btn.is-active {
	color: var(--infap-fav-yellow) !important;
}

/* Filter chip */
.infap-fav-filter-wrap {
	margin: 0 0 1rem;
}

.infap-fav-filter {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 0.75rem 1rem;
	margin: 0 0 1rem;
}

.infap-fav-filter__chip {
	display: inline-flex;
	align-items: center;
	padding: 0.45rem 0.9rem;
	border-radius: 0.5rem;
	background: #0b3459;
	color: #fff !important;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none !important;
	line-height: 1.3;
}

.infap-fav-filter.is-active .infap-fav-filter__chip {
	background: #153f63;
}

.infap-fav-filter__page {
	font-size: 14px;
	color: #0b3459;
	text-decoration: underline;
}

/* Preferiti page */
.infap-fav-page__toolbar {
	margin: 0 0 1.25rem;
}

.infap-fav-page__link {
	color: #0b3459;
	font-weight: 500;
}

.infap-fav-page__empty {
	padding: 1.25rem 1rem;
	background: #f4f6fa;
	border-radius: 0.5rem;
	color: #333;
}

.infap-fav-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
	gap: 1.25rem;
	list-style: none;
	margin: 0;
	padding: 0;
}

.infap-fav-card {
	list-style: none;
	background: #fff;
	border-radius: 0.5rem;
	overflow: visible;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.06);
}

.infap-fav-card .course-thumbnail {
	position: relative;
	overflow: hidden;
	border-radius: 0.5rem 0.5rem 0 0;
}

.infap-fav-card .course-title {
	margin: 0;
	padding: 0.75rem 1rem 1rem;
	font-size: 1rem;
	line-height: 1.35;
}

.infap-fav-card .course-title a {
	color: #0b3459;
	text-decoration: none;
}

.infap-fav-card__placeholder {
	display: block;
	width: 100%;
	aspect-ratio: 16 / 9;
	background: #e8edf2;
}

/* Client-side filter on Elementor grids */
.infap-fav-filter-mode .thim-ekits-course__item:not(.infap-fav-match),
.infap-fav-filter-mode .learn-press-courses > .course-item:not(.infap-fav-match) {
	display: none !important;
}

/*
 * Sidebar «Corsi popolari» (Thim widget_courses / list-sidebar):
 * Eduma floats thumbnail + content with overflow:hidden → titles clipped.
 */
.widget_courses .thim-course-list-sidebar .lpr_course,
.thim-widget-courses .thim-course-list-sidebar .lpr_course {
	display: flex !important;
	align-items: flex-start;
	gap: 0.75rem;
	overflow: visible !important;
	margin: 0 0 1.1rem !important;
	padding: 0 !important;
	min-height: 0;
}

.widget_courses .thim-course-list-sidebar .lpr_course .course-thumbnail,
.thim-widget-courses .thim-course-list-sidebar .lpr_course .course-thumbnail {
	float: none !important;
	flex: 0 0 72px;
	width: 72px !important;
	height: 72px !important;
	margin: 0 !important;
	border-radius: 0.4rem;
	overflow: hidden;
}

.widget_courses .thim-course-list-sidebar .lpr_course .course-thumbnail img,
.thim-widget-courses .thim-course-list-sidebar .lpr_course .course-thumbnail img {
	display: block;
	width: 100% !important;
	height: 100% !important;
	object-fit: cover;
}

.widget_courses .thim-course-list-sidebar .lpr_course .thim-course-content,
.thim-widget-courses .thim-course-list-sidebar .lpr_course .thim-course-content {
	float: none !important;
	flex: 1 1 auto;
	width: auto !important;
	min-width: 0;
	overflow: visible !important;
}

.widget_courses .thim-course-list-sidebar .lpr_course .course-title,
.thim-widget-courses .thim-course-list-sidebar .lpr_course .course-title {
	display: block !important;
	overflow: visible !important;
	margin: 0 0 0.35em !important;
	padding: 0 !important;
	max-height: none !important;
	font-size: 14px !important;
	font-weight: 600 !important;
	line-height: 1.35 !important;
	-webkit-line-clamp: unset !important;
	line-clamp: unset !important;
}

.widget_courses .thim-course-list-sidebar .lpr_course .course-title a,
.thim-widget-courses .thim-course-list-sidebar .lpr_course .course-title a {
	display: inline !important;
	white-space: normal !important;
	overflow: visible !important;
	text-overflow: clip !important;
	word-break: break-word;
	overflow-wrap: anywhere;
	color: #152747 !important;
}

.widget_courses .thim-course-list-sidebar .course-price,
.thim-widget-courses .thim-course-list-sidebar .course-price,
.widget_courses .thim-course-list-sidebar .course-item-price,
.thim-widget-courses .thim-course-list-sidebar .course-item-price {
	display: inline-flex !important;
	flex-wrap: wrap;
	align-items: baseline;
	gap: 0.5em;
	margin: 0 !important;
	font-size: 13px !important;
	line-height: 1.3 !important;
}

.widget_courses .thim-course-list-sidebar .course-item-price .origin-price,
.thim-widget-courses .thim-course-list-sidebar .course-item-price .origin-price {
	font-weight: 400 !important;
	text-decoration: line-through !important;
	color: #94a3b8 !important;
}

.widget_courses .thim-course-list-sidebar .course-item-price .price,
.thim-widget-courses .thim-course-list-sidebar .course-item-price .price {
	font-weight: 700 !important;
	color: #152747 !important;
}
