/**
 * Timss — Акція 3+1
 *
 * Світла тема під стиль сайту. Патерни взято з наявних блоків Kallyas-child:
 *   .bulk-price     — background #e9eaea, color #282828, Montserrat, radius 3px
 *   .free-shipping  — рядок «іконка 24px + 10px відступу + текст 14px»
 * Акцент #cd2122 — той самий, що в акційних цінах товарів.
 */

:root {
	--tp-accent: #cd2122;
	--tp-gold: #ee9e00;
	--tp-ink: #282828;
	--tp-muted: #767676;
	--tp-line: #e9eaea;
	--tp-bg: #ffffff;
	--tp-radius: 3px;
	--tp-font: "Montserrat", Helvetica, Arial, sans-serif;
}

.tp-ico {
	display: block;
	width: 1em;
	height: 1em;
}

/* ------------------------------------------------------------------ *
 * Бейдж «3+1»
 * ------------------------------------------------------------------ */

.tp-badge {
	display: inline-flex;
	align-items: center;
	gap: 5px;
	padding: 5px 12px 5px 9px;
	font-family: var(--tp-font);
	font-size: 11px;
	font-weight: 700;
	line-height: 1;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: #fff;
	background: var(--tp-accent);
	border-radius: var(--tp-radius);
	white-space: nowrap;
	pointer-events: none;
}

.tp-badge__gift {
	display: block;
	font-size: 13px;
	opacity: .95;
}

/**
 * Каталог. Зверху картки тема тримає власні плашки «НОВИНКА» та
 * «РЕКОМЕНДУЄМО», тому наш бейдж стоїть у потоці під ціною —
 * нічого не перекриває й не залежить від пропорцій зображення.
 */
/**
 * Бейдж виводиться прямим нащадком посилання картки, вже поза блоком
 * з назвою й ціною, тому вирівнювання тексту звідти не успадковується —
 * центруємо самі через auto-поля.
 */
.tp-badge--loop {
	position: relative;
	display: flex;
	width: -moz-fit-content;
	width: fit-content;
	margin: 8px auto 4px;
}

/**
 * Сторінка товару. Шаблон Kallyas кастомний (single-product-style3.php),
 * тому бейдж — рядком під заголовком, а не абсолютом над галереєю.
 */
.tp-badge--single {
	display: flex;
	width: -moz-fit-content;
	width: fit-content;
	position: relative;
	margin: 0 0 14px;
	font-size: 12px;
	padding: 8px 15px 8px 12px;
}

/**
 * На звичайних товарах бейдж — перший елемент блоку, і верхній відступ там
 * зайвий. На преміальних над ним стоять плашки теми («НОВИНКА»,
 * «РЕКОМЕНДУЄМО»), до яких він притискався впритул. Відступ додаємо лише
 * тоді, коли зверху справді щось є.
 */
* + .tp-badge--single {
	margin-top: 16px;
}

.tp-badge--single::after {
	content: attr(title);
	margin-left: 9px;
	padding-left: 9px;
	font-weight: 500;
	letter-spacing: .02em;
	text-transform: none;
	border-left: 1px solid rgba(255, 255, 255, .35);
}

@media (max-width: 480px) {
	.tp-badge--single::after {
		display: none;
	}

	.tp-badge--loop {
		padding: 4px 9px 4px 7px;
		font-size: 10px;
	}
}

/* ------------------------------------------------------------------ *
 * Блок акції
 * ------------------------------------------------------------------ */

.tp-progress {
	position: relative;
	box-sizing: border-box;
	margin: 0 0 20px;
	padding: 16px 18px;
	font-family: var(--tp-font);
	color: var(--tp-ink);
	background: var(--tp-bg);
	border: 1px solid var(--tp-line);
	border-radius: var(--tp-radius);
}

.tp-progress * {
	box-sizing: border-box;
}

.tp-progress.tp-is-hidden {
	display: none;
}

.tp-progress__toggle {
	display: none;
}

/* --- шапка --- */

.tp-progress__head {
	display: flex;
	align-items: flex-start;
	gap: 10px;
	margin-bottom: 12px;
}

.tp-progress__icon {
	flex: 0 0 auto;
	width: 24px;
	height: 24px;
	font-size: 24px;
	line-height: 1;
	color: var(--tp-accent);
}

.tp-progress__titles {
	display: block;
	min-width: 0;
}

.tp-progress__title {
	display: block;
	margin-bottom: 2px;
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	color: var(--tp-accent);
}

.tp-progress__message {
	display: block;
	font-size: 15px;
	font-weight: 400;
	line-height: 1.45;
	color: var(--tp-ink);
}

/* --- смуга --- */

.tp-progress__bar {
	display: flex;
	align-items: center;
	gap: 10px;
	max-width: 420px;
	margin-left: 34px;
}

.tp-progress__segs {
	display: flex;
	flex: 1 1 auto;
	gap: 4px;
	min-width: 0;
}

.tp-seg {
	flex: 1 1 0;
	height: 4px;
	background: var(--tp-line);
	border-radius: 999px;
	transition: background .4s ease;
}

.tp-seg.is-done {
	background: var(--tp-accent);
}

.tp-seg--gift.is-done {
	background: var(--tp-accent);
}

/* --- умови виконані: смуга заповнюється повністю, з анімацією --- */

.tp-progress__bar.is-complete .tp-seg {
	background: var(--tp-accent);
	transform-origin: left center;
	animation: tp-fill .4s cubic-bezier(.3, .8, .4, 1) both;
}

.tp-progress__bar.is-complete .tp-seg:nth-child(1) { animation-delay: .05s; }
.tp-progress__bar.is-complete .tp-seg:nth-child(2) { animation-delay: .13s; }
.tp-progress__bar.is-complete .tp-seg:nth-child(3) { animation-delay: .21s; }
.tp-progress__bar.is-complete .tp-seg:nth-child(4) { animation-delay: .29s; }
.tp-progress__bar.is-complete .tp-seg:nth-child(5) { animation-delay: .37s; }
.tp-progress__bar.is-complete .tp-seg:nth-child(6) { animation-delay: .45s; }

@keyframes tp-fill {
	from { transform: scaleX(0); }
	to   { transform: scaleX(1); }
}

.tp-progress__goal {
	flex: 0 0 auto;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	font-size: 13px;
	color: var(--tp-muted);
	border: 1px solid var(--tp-line);
	border-radius: 50%;
	transition: color .3s ease, background .3s ease, border-color .3s ease;
}

.tp-progress__goal.is-unlocked {
	color: #fff;
	background: var(--tp-accent);
	border-color: var(--tp-accent);
}

.tp-progress__bar.is-complete .tp-progress__goal {
	animation: tp-pop .5s cubic-bezier(.2, 1.45, .4, 1) .42s both;
}

.tp-progress__bar.is-complete .tp-progress__count {
	color: var(--tp-accent);
	font-weight: 700;
}

.tp-progress__count {
	flex: 0 0 auto;
	font-size: 12px;
	font-weight: 600;
	color: var(--tp-muted);
	font-variant-numeric: tabular-nums;
}

@keyframes tp-pop {
	0%   { transform: scale(.75); }
	60%  { transform: scale(1.12); }
	100% { transform: scale(1); }
}

/* --- підвал --- */

.tp-progress__foot {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	gap: 8px;
	margin: 14px 0 0 34px;
	padding-top: 12px;
	font-size: 14px;
	border-top: 1px solid var(--tp-line);
}

.tp-progress__giftlabel {
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: var(--tp-muted);
}

.tp-progress__giftname {
	font-weight: 500;
	color: var(--tp-ink);
}

.tp-progress__giftprice {
	margin-left: auto;
	padding: 4px 10px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #fff;
	background: var(--tp-accent);
	border-radius: var(--tp-radius);
}

/* --- стан «подарунок отримано» --- */

.tp-progress.tp-tone-done .tp-progress__title,
.tp-progress.tp-tone-done .tp-progress__icon {
	color: var(--tp-ink);
}

/* --- стан «діють оптові ціни» --- */

.tp-progress.tp-tone-bulk {
	background: #e9eaea;
	border-color: #e9eaea;
}

.tp-progress.tp-tone-bulk .tp-progress__title,
.tp-progress.tp-tone-bulk .tp-progress__icon {
	color: var(--tp-ink);
}

/* Прогрес тут не має сенсу — досить заголовка й суми вигоди. */
.tp-progress.tp-tone-bulk .tp-progress__bar {
	display: none;
}

.tp-progress.tp-tone-bulk .tp-progress__foot {
	border-top-color: #d8d9d9;
}

.tp-progress__giftprice--bulk {
	background: var(--tp-ink);
}

/* --- стан «заблоковано промокодом» --- */

.tp-progress.tp-tone-blocked .tp-progress__title,
.tp-progress.tp-tone-blocked .tp-progress__icon {
	color: var(--tp-muted);
}

.tp-progress.tp-tone-blocked .tp-progress__bar {
	opacity: .5;
}

/* --- підказка про наближення до оптових цін --- */

.tp-progress__hint {
	margin: 12px 0 0 34px;
	padding: 8px 10px;
	font-size: 13px;
	line-height: 1.4;
	color: var(--tp-ink);
	background: #e9eaea;
	border-radius: var(--tp-radius);
}

.tp-progress--float .tp-progress__hint,
.widget_shopping_cart_content .tp-progress__hint {
	display: none;
}

/* ------------------------------------------------------------------ *
 * Варіанти розміщення
 * ------------------------------------------------------------------ */

/* Міні-кошик у шапці — компактніше. */
.widget_shopping_cart_content .tp-progress,
.woocommerce-mini-cart__wrapper .tp-progress {
	margin-bottom: 14px;
	padding: 12px 14px;
}

.widget_shopping_cart_content .tp-progress__foot {
	display: none;
}

.widget_shopping_cart_content .tp-progress__bar {
	margin-left: 0;
}

/* Плаваюча панель. */
.tp-progress--float {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 9998;
	width: 340px;
	max-width: calc(100vw - 32px);
	margin: 0;
	box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .28);
	animation: tp-slide-in .4s cubic-bezier(.2, .9, .3, 1);
}

.tp-progress--float .tp-progress__bar,
.tp-progress--float .tp-progress__foot {
	max-width: none;
	margin-left: 0;
}

@keyframes tp-slide-in {
	from { opacity: 0; transform: translateY(14px); }
	to   { opacity: 1; transform: translateY(0); }
}

.tp-progress--float .tp-progress__toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	position: absolute;
	top: 6px;
	right: 6px;
	width: 24px;
	height: 24px;
	padding: 0;
	font-size: 18px;
	line-height: 1;
	color: var(--tp-muted);
	background: none;
	border: 0;
	cursor: pointer;
	transition: color .2s ease;
}

.tp-progress--float .tp-progress__toggle:hover {
	color: var(--tp-ink);
}

body.tp-float-dismissed .tp-progress--float {
	display: none;
}

/* ------------------------------------------------------------------ *
 * Поп-ап
 * ------------------------------------------------------------------ */

.tp-modal {
	position: fixed;
	inset: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 20px;
	font-family: var(--tp-font);
}

.tp-modal[hidden] {
	display: none;
}

.tp-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .55);
	animation: tp-fade .25s ease;
}

@keyframes tp-fade {
	from { opacity: 0; }
	to   { opacity: 1; }
}

.tp-modal__box {
	position: relative;
	width: 100%;
	max-width: 400px;
	padding: 38px 32px 28px;
	text-align: center;
	color: var(--tp-ink);
	background: var(--tp-bg);
	border-radius: var(--tp-radius);
	box-shadow: 0 24px 60px -24px rgba(0, 0, 0, .5);
	overflow: hidden;
	animation: tp-zoom .35s cubic-bezier(.2, 1.15, .35, 1);
}

@keyframes tp-zoom {
	from { opacity: 0; transform: translateY(12px) scale(.97); }
	to   { opacity: 1; transform: translateY(0) scale(1); }
}

.tp-modal__close {
	position: absolute;
	top: 10px;
	right: 12px;
	width: 30px;
	height: 30px;
	font-size: 22px;
	line-height: 1;
	color: var(--tp-muted);
	background: none;
	border: 0;
	cursor: pointer;
	transition: color .2s ease;
}

.tp-modal__close:hover {
	color: var(--tp-ink);
}

.tp-modal__icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 52px;
	height: 52px;
	margin: 0 auto 16px;
	font-size: 26px;
	color: #fff;
	background: var(--tp-accent);
	border-radius: 50%;
	animation: tp-pop .5s cubic-bezier(.2, 1.35, .4, 1) .05s both;
}

.tp-modal__title {
	margin: 0 0 8px;
	font-size: 20px;
	font-weight: 600;
	line-height: 1.3;
	color: var(--tp-ink);
}

.tp-modal__text {
	margin: 0 0 22px;
	font-size: 15px;
	line-height: 1.5;
	color: var(--tp-muted);
}

.tp-modal__actions {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.tp-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 13px 22px;
	font-family: var(--tp-font);
	font-size: 12px;
	font-weight: 700;
	letter-spacing: .1em;
	text-transform: uppercase;
	text-decoration: none;
	border: 1px solid transparent;
	border-radius: var(--tp-radius);
	cursor: pointer;
	transition: background .2s ease, color .2s ease, border-color .2s ease;
}

/* Основна кнопка — чорна, як «Переглянути кошик» на сайті. */
.tp-btn--primary {
	color: #fff;
	background: #000;
}

.tp-btn--primary:hover,
.tp-btn--primary:focus {
	color: #fff;
	background: var(--tp-accent);
}

.tp-btn--ghost {
	color: var(--tp-muted);
	background: none;
	border-color: var(--tp-line);
}

.tp-btn--ghost:hover {
	color: var(--tp-ink);
	border-color: var(--tp-ink);
}

/* Конфеті — чистий CSS, без бібліотек. */
.tp-modal__confetti {
	position: absolute;
	inset: 0;
	pointer-events: none;
	overflow: hidden;
}

.tp-modal__confetti i {
	position: absolute;
	top: -12px;
	width: 6px;
	height: 10px;
	opacity: 0;
	animation: tp-confetti 2.6s linear infinite;
}

.tp-modal__confetti i:nth-child(odd)  { background: var(--tp-accent); }
.tp-modal__confetti i:nth-child(even) { background: var(--tp-gold); }
.tp-modal__confetti i:nth-child(3n)   { background: #282828; }

.tp-modal__confetti i:nth-child(1)  { left: 6%;  animation-delay: .0s;  }
.tp-modal__confetti i:nth-child(2)  { left: 15%; animation-delay: .35s; }
.tp-modal__confetti i:nth-child(3)  { left: 24%; animation-delay: .7s;  }
.tp-modal__confetti i:nth-child(4)  { left: 33%; animation-delay: .15s; }
.tp-modal__confetti i:nth-child(5)  { left: 42%; animation-delay: .95s; }
.tp-modal__confetti i:nth-child(6)  { left: 51%; animation-delay: .5s;  }
.tp-modal__confetti i:nth-child(7)  { left: 60%; animation-delay: 1.2s; }
.tp-modal__confetti i:nth-child(8)  { left: 69%; animation-delay: .25s; }
.tp-modal__confetti i:nth-child(9)  { left: 78%; animation-delay: .8s;  }
.tp-modal__confetti i:nth-child(10) { left: 86%; animation-delay: .45s; }
.tp-modal__confetti i:nth-child(11) { left: 93%; animation-delay: 1.1s; }
.tp-modal__confetti i:nth-child(12) { left: 97%; animation-delay: .6s;  }

@keyframes tp-confetti {
	0%   { opacity: 0; transform: translateY(0) rotate(0deg); }
	10%  { opacity: 1; }
	100% { opacity: 0; transform: translateY(400px) rotate(540deg); }
}

/* ------------------------------------------------------------------ *
 * Тост «залишився 1 крок»
 * ------------------------------------------------------------------ */

.tp-toast {
	position: fixed;
	right: 20px;
	bottom: 20px;
	z-index: 99999;
	display: flex;
	align-items: flex-start;
	gap: 10px;
	width: 330px;
	max-width: calc(100vw - 32px);
	padding: 14px 16px;
	font-family: var(--tp-font);
	color: var(--tp-ink);
	background: var(--tp-bg);
	border: 1px solid var(--tp-line);
	border-left: 3px solid var(--tp-accent);
	border-radius: var(--tp-radius);
	box-shadow: 0 10px 30px -12px rgba(0, 0, 0, .28);
	animation: tp-slide-in .35s cubic-bezier(.2, .9, .3, 1);
}

.tp-toast[hidden] {
	display: none;
}

.tp-toast__icon {
	flex: 0 0 auto;
	font-size: 20px;
	color: var(--tp-accent);
}

.tp-toast__body {
	flex: 1 1 auto;
	min-width: 0;
}

.tp-toast__title {
	display: block;
	margin-bottom: 2px;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: .08em;
	text-transform: uppercase;
	color: var(--tp-accent);
}

.tp-toast__text {
	display: block;
	font-size: 14px;
	line-height: 1.45;
	color: var(--tp-ink);
}

.tp-toast__close {
	flex: 0 0 auto;
	width: 22px;
	height: 22px;
	padding: 0;
	font-size: 17px;
	line-height: 1;
	color: var(--tp-muted);
	background: none;
	border: 0;
	cursor: pointer;
}

.tp-toast__close:hover {
	color: var(--tp-ink);
}

/* Тост і плаваюча панель не мають накладатися. */
body.tp-toast-open .tp-progress--float {
	bottom: 110px;
}

/* ------------------------------------------------------------------ *
 * Рядок знижки в підсумках
 * ------------------------------------------------------------------ */

.tp-fee {
	font-weight: 700;
	color: var(--tp-accent);
}

/* ------------------------------------------------------------------ *
 * Мобільні
 * ------------------------------------------------------------------ */

@media (max-width: 782px) {
	.tp-progress {
		padding: 14px;
	}

	.tp-progress__bar,
	.tp-progress__foot,
	.tp-progress__hint {
		margin-left: 0;
	}

	.tp-progress__message {
		font-size: 14px;
	}

	.tp-progress--float {
		right: 10px;
		left: 10px;
		bottom: 10px;
		width: auto;
		max-width: none;
	}

	.tp-progress--float .tp-progress__foot {
		display: none;
	}

	.tp-toast {
		right: 10px;
		left: 10px;
		bottom: 10px;
		width: auto;
		max-width: none;
	}

	body.tp-toast-open .tp-progress--float {
		bottom: 104px;
	}

	.tp-modal__box {
		padding: 32px 22px 22px;
	}

	.tp-modal__title {
		font-size: 18px;
	}
}

/* ------------------------------------------------------------------ *
 * Доступність
 * ------------------------------------------------------------------ */

@media (prefers-reduced-motion: reduce) {
	.tp-seg,
	.tp-progress__goal,
	.tp-btn {
		transition: none;
	}

	.tp-modal__confetti i,
	.tp-modal__box,
	.tp-modal__icon,
	.tp-progress--float,
	.tp-toast,
	.tp-progress__bar.is-complete .tp-seg,
	.tp-progress__bar.is-complete .tp-progress__goal {
		animation: none;
	}

	.tp-modal__confetti {
		display: none;
	}
}

.tp-progress button:focus-visible,
.tp-modal button:focus-visible,
.tp-modal a:focus-visible,
.tp-toast button:focus-visible {
	outline: 2px solid var(--tp-accent);
	outline-offset: 2px;
}
