/* ==========================================================
   Интерактив магазина (inc/shop.php, assets/js/shop.js)
   ========================================================== */

.btn--block { display: flex; width: 100%; justify-content: center; }

/* ---------- Загрузка на кнопках ---------- */

.is-loading { position: relative; pointer-events: none; }
.button.is-loading,
.btn.is-loading { color: transparent !important; }
.button.is-loading::after,
.btn.is-loading::after {
	content: "";
	position: absolute;
	inset: 0;
	width: 20px;
	height: 20px;
	margin: auto;
	border: 2px solid #fff;
	border-right-color: transparent;
	border-radius: 50%;
	animation: spin .7s linear infinite;
}
@keyframes spin { to { transform: rotate(360deg); } }

.woocommerce ul.products li.product .button.added { background: var(--ok); }
.woocommerce ul.products li.product .button .icon { width: 18px; height: 18px; }
.woocommerce a.button.added::after { display: none; }
.woocommerce ul.products li.product a.added_to_cart { display: none; }

/* ---------- Избранное ---------- */

.wish-btn {
	display: inline-grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: #fff;
	color: var(--ink);
	box-shadow: 0 2px 8px rgb(28 26 23 / .1);
	cursor: pointer;
	transition: color .2s, transform .2s;
}
.wish-btn .icon { width: 21px; height: 21px; transition: fill .2s; }
.wish-btn:hover,
.wish-btn.is-active { color: var(--accent); }
.wish-btn.is-active .icon { fill: currentColor; }
.wish-btn.is-pop .icon { animation: bump .4s cubic-bezier(.3, 1.6, .5, 1); }

.woocommerce ul.products li.product .wish-btn {
	position: absolute;
	top: 16px;
	right: 16px;
	z-index: 2;
}

/* На странице товара: круглая кнопка с обводкой, на телефоне — во всю ширину с подписью */
.wish-btn--label {
	flex: none;
	width: 52px;
	height: 52px;
	background: transparent;
	box-shadow: inset 0 0 0 1px var(--ink);
	font: 600 16px/1 var(--font);
}
.wish-btn--label .icon { width: 22px; height: 22px; }
.wish-btn--label .wish-text { display: none; }
@media (max-width: 560px) {
	.wish-btn--label { display: inline-flex; justify-content: center; gap: 10px; flex: 1 0 100%; width: auto; }
	.wish-btn--label .wish-text { display: inline; }
}

.wishlist.is-loading { min-height: 200px; opacity: .5; }
.woocommerce ul.products li.product.is-removing,
.cline.is-removing { opacity: 0; transform: scale(.96); transition: opacity .25s, transform .25s; }

/* ---------- Количество «− 1 +» ---------- */

.qty {
	display: inline-flex;
	align-items: center;
	border-radius: 999px;
	background: var(--surface);
	box-shadow: inset 0 0 0 1px var(--line);
}
.qty-btn {
	display: grid;
	place-items: center;
	width: 40px;
	height: 40px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ink);
	cursor: pointer;
}
.qty-btn:hover:not(:disabled) { background: var(--bg); }
.qty-btn:disabled { opacity: .3; cursor: default; }
.qty-btn .icon { width: 18px; height: 18px; }
.qty-val { min-width: 28px; text-align: center; font-weight: 600; }

.woocommerce div.product form.cart .quantity.qty { min-height: 52px; padding: 0 3px; background: transparent; box-shadow: inset 0 0 0 1px var(--ink); }
.woocommerce div.product form.cart .qty-btn { width: 44px; height: 44px; }
.woocommerce .quantity.qty .qty {
	width: 44px;
	min-height: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	box-shadow: none;
	font-weight: 600;
	-moz-appearance: textfield;
}
.woocommerce .quantity.qty .qty::-webkit-inner-spin-button,
.woocommerce .quantity.qty .qty::-webkit-outer-spin-button { -webkit-appearance: none; margin: 0; }

/* ---------- Страница товара ---------- */

@media (min-width: 861px) {
	.woocommerce div.product div.summary { position: sticky; top: calc(var(--header-h) + 24px); }
}

/* Панель покупки на телефоне */
.buy-bar {
	position: fixed;
	left: 0;
	right: 0;
	bottom: 0;
	z-index: 60;
	display: none;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	min-height: 68px;
	padding: 8px 16px calc(8px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--line);
	background: var(--surface);
	box-shadow: 0 12px 32px rgb(28 26 23 / .14);
	transform: translateY(110%);
	transition: transform .25s;
}
.buy-bar.is-shown { transform: none; }
.buy-bar-info { display: grid; min-width: 0; flex: 1; }
.buy-bar-name { overflow: hidden; color: var(--muted); font-size: 12px; line-height: 16px; white-space: nowrap; text-overflow: ellipsis; }
.buy-bar-price { font-size: 18px; font-weight: 700; line-height: 24px; }
.buy-bar-price del { color: var(--muted); font-size: 14px; font-weight: 400; }
.buy-bar-price ins { text-decoration: none; }
.buy-bar-btn { flex: none; min-height: 52px; padding: 0 32px; }
@media (max-width: 860px) {
	.buy-bar { display: flex; }
	.single-product .site-footer { padding-bottom: 72px; }
	.single-product .cookie-banner { bottom: 84px; }
}

/* ---------- Категории в каталоге ---------- */

.cat-chips { display: flex; flex-wrap: wrap; gap: 8px; margin: 0 0 32px; }
.chip {
	display: inline-flex;
	align-items: center;
	gap: 8px;
	min-height: 44px;
	padding: 0 22px;
	border: 1px solid var(--line-strong);
	border-radius: 999px;
	background: var(--surface);
	color: var(--ink);
	font-size: 15px;
	font-weight: 500;
	text-decoration: none;
	white-space: nowrap;
	transition: border-color .2s, background-color .2s, color .2s;
}
.chip:hover { border-color: var(--ink); color: var(--ink); }
.chip.is-active { border-color: var(--ink); background: var(--ink); color: #fff; font-weight: 600; }
.chip--soon { padding-right: 14px; border-style: dashed; background: transparent; color: #8a8278; }
.chip-soon {
	display: inline-flex;
	align-items: center;
	height: 20px;
	padding: 0 8px;
	border-radius: 999px;
	background: var(--sand);
	color: var(--muted);
	font-size: 11px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
}
.chip.is-active .chip-soon { background: var(--dark-line); color: var(--dark-ink); }
@media (max-width: 560px) {
	.cat-chips { flex-wrap: nowrap; overflow-x: auto; margin: 0 calc(var(--gutter) * -1) 20px; padding-inline: var(--gutter); scrollbar-width: none; }
	.cat-chips::-webkit-scrollbar { display: none; }
	.chip { padding: 0 20px; }
	.chip--soon { padding-right: 12px; }
}

/* ---------- Панель корзины ---------- */

.drawer { position: fixed; inset: 0; z-index: 100; }
.drawer[hidden] { display: none; }
.drawer-open { overflow: hidden; }
.drawer-overlay {
	position: absolute;
	inset: 0;
	background: rgb(20 18 15 / .45);
	opacity: 0;
	transition: opacity .25s;
}
.drawer-panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: min(440px, calc(100% - 32px));
	background: var(--surface);
	box-shadow: 0 12px 32px rgb(28 26 23 / .14);
	transform: translateX(100%);
	transition: transform .3s cubic-bezier(.2, .8, .2, 1);
}
.drawer.is-open .drawer-overlay { opacity: 1; }
.drawer.is-open .drawer-panel { transform: none; }

.drawer-head {
	display: flex;
	flex: none;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	min-height: 64px;
	padding: 0 10px 0 20px;
	border-bottom: 1px solid var(--line);
}
.drawer-title { display: flex; align-items: baseline; gap: 10px; margin: 0; font: 600 20px/26px var(--font-display); }
.drawer-count { color: var(--muted); font: 400 14px/20px var(--font); }
.drawer-close {
	display: grid;
	place-items: center;
	width: 44px;
	height: 44px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--ink);
	cursor: pointer;
}
.drawer-close:hover { background: var(--bg); }
.drawer-body { flex: 1; min-height: 0; overflow: hidden auto; padding: 20px; overscroll-behavior: contain; }
.drawer.is-loading .drawer-body { opacity: .5; }
.drawer-empty { padding: 48px 0; text-align: center; color: var(--muted); }

.drawer-foot {
	display: grid;
	flex: none;
	gap: 12px;
	padding: 16px 20px calc(24px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--line);
	background: var(--surface);
}
.drawer-foot[hidden] { display: none; }
.drawer-total { display: flex; justify-content: space-between; align-items: baseline; color: var(--muted); font-size: 16px; line-height: 24px; }
.drawer-total strong { color: var(--ink); font: 700 20px/28px var(--font); }
.drawer-note { margin: 0; color: var(--muted); font-size: 13px; line-height: 18px; text-align: center; }

/* ---------- Строка товара в корзине (панель и мини-корзина) ---------- */

.clines { margin: 0; padding: 0; list-style: none; }
.cline { display: flex; align-items: flex-start; gap: 12px; transition: opacity .2s, transform .2s; }
.cline + .cline { margin-top: 20px; padding-top: 20px; border-top: 1px solid var(--line); }
.cline.is-busy { opacity: .5; pointer-events: none; }
.cline-thumb { flex: none; }
.cline-thumb img { width: 72px; height: 72px; border-radius: var(--radius-sm); object-fit: cover; background: var(--sand); }
.cline-body { flex: 1; min-width: 0; display: grid; gap: 8px; }
.cline-top { display: flex; align-items: flex-start; justify-content: space-between; gap: 4px; }
.cline-info { display: grid; gap: 2px; min-width: 0; }
.cline-name { font-size: 15px; font-weight: 600; line-height: 20px; text-decoration: none; }
.cline-meta { color: var(--muted); font-size: 14px; line-height: 20px; }
.cline-remove {
	display: grid;
	flex: none;
	place-items: center;
	width: 44px;
	height: 44px;
	margin: -10px -12px 0 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: var(--muted);
	cursor: pointer;
}
.cline-remove:hover { color: var(--error); background: var(--bg); }
.cline-remove .icon { width: 18px; height: 18px; }
.cline-row { display: flex; align-items: center; justify-content: space-between; gap: 8px; }
.cline-row .qty { background: transparent; box-shadow: inset 0 0 0 1px var(--line-strong); }
.cline-row .qty-btn { width: 44px; height: 44px; }
.cline-row .qty-val { min-width: 24px; font-size: 16px; }
.cline-total { font-size: 17px; font-weight: 700; line-height: 24px; white-space: nowrap; }

/* ---------- Уведомления ---------- */

.toasts {
	position: fixed;
	left: 50%;
	bottom: 20px;
	z-index: 110;
	display: grid;
	gap: 8px;
	width: min(420px, calc(100% - 32px));
	transform: translateX(-50%);
	pointer-events: none;
}
.toast {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	padding: 14px 18px;
	border-radius: var(--radius-sm);
	background: var(--ink);
	color: #fff;
	box-shadow: 0 10px 30px rgb(0 0 0 / .2);
	font-size: 15px;
	opacity: 0;
	transform: translateY(12px);
	transition: opacity .25s, transform .25s;
	pointer-events: auto;
}
.toast.is-shown { opacity: 1; transform: none; }
.toast--error { background: var(--error); }
.toast a { color: #ffb68f; font-weight: 600; white-space: nowrap; text-decoration: none; }
@media (max-width: 860px) {
	.single-product .toasts { bottom: 90px; }
}

@media (prefers-reduced-motion: reduce) {
	.drawer-panel, .drawer-overlay, .toast, .buy-bar { transition: none; }
	.badge.is-bump, .wish-btn.is-pop .icon { animation: none; }
}

/* ---------- Мини-корзина под шапкой (компьютер) ---------- */

.hcart { position: relative; display: flex; align-items: stretch; }

.minicart {
	position: absolute;
	top: calc(100% + 1px);
	right: 24px;
	z-index: 60;
	display: flex;
	flex-direction: column;
	gap: 20px;
	width: 420px;
	max-height: min(76vh, 640px);
	padding: 24px;
	border-radius: var(--radius);
	background: var(--surface);
	box-shadow: 0 12px 32px rgb(28 26 23 / .14);
	opacity: 0;
	transform: translateY(-6px);
	transition: opacity .18s, transform .18s;
	cursor: auto;
}
.minicart.is-open { opacity: 1; transform: none; }
.minicart.is-loading .minicart-body { opacity: .5; }
.minicart-head { display: flex; align-items: baseline; justify-content: space-between; }
.minicart-head strong { font: 600 18px/24px var(--font-display); }
.minicart-count { color: var(--muted); font-size: 14px; line-height: 20px; }
.minicart-body { min-height: 0; overflow: hidden auto; overscroll-behavior: contain; }
.minicart .cline-row .qty-btn { width: 36px; height: 36px; }
.minicart .cline-row .qty-val { min-width: 28px; font-size: 15px; }
.minicart .cline-remove { width: 36px; height: 36px; margin: -8px -8px 0 0; }
.minicart .cline-total { font-size: 16px; }
.minicart-more { margin: 16px 0 0; color: var(--muted); font-size: 13px; text-align: center; }
.minicart-empty { margin: 0; padding: 12px 0; color: var(--muted); font-size: 15px; text-align: center; }
.minicart-empty a { color: var(--accent-hover); font-weight: 600; }

.minicart-foot { display: grid; gap: 4px; padding-top: 20px; border-top: 1px solid var(--line); }
.minicart-foot[hidden] { display: none; }
.minicart-total { display: flex; justify-content: space-between; align-items: baseline; margin-bottom: 16px; color: var(--muted); font-size: 16px; line-height: 24px; }
.minicart-total strong { color: var(--ink); font: 700 20px/28px var(--font); }
.minicart-cart {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 44px;
	color: var(--accent-hover);
	font-size: 15px;
	font-weight: 600;
	text-underline-offset: 4px;
}

@media (max-width: 1080px) {
	.minicart { display: none !important; }
}
