/* --- КНОПКА (ТРИГЕР) У ХЕДЕРІ --- */
.wfh-el-cart a.wfh-cart-trigger { 
	display: inline-flex; 
	align-items: center; 
	text-decoration: none; 
	font-size: var(--wfh-cart-fs-d, 14px); 
	color: var(--wfh-cart-text-color, #333); 
	transition: all 0.3s ease;
}

/* Окремо обгортка для іконки */
.wfh-cart-icon-wrap { 
	position: relative; 
	display: flex; 
	align-items: center;
    justify-content: center;
	margin-right: 0; 
	font-size: var(--wfh-cart-ic-size, 24px); 
	color: var(--wfh-cart-ic-color, #333); 
    transition: all 0.3s ease;
}

/* Іконка або завантажена картинка */
.wfh-cart-icon-wrap .dashicons { font-size: inherit; width: 1em; height: 1em; }
.wfh-cart-icon-img { width: 1em; height: 1em; object-fit: contain; display: inline-block; }

/* КЛАС МАСКИ ДЛЯ КАСТОМНИХ ІКОНОК (КОШИК) */
.wfh-cart-icon-img.wfh-icon-mask {
    background-color: var(--wfh-cart-ic-color, #333);
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
}

/* ДИЗАЙНИ (SOLID / OUTLINE) ТЕПЕР ЗАСТОСОВУЮТЬСЯ ДО ВСЬОГО ПОСИЛАННЯ <a> */
.wfh-el-cart[data-design="solid"] a.wfh-cart-trigger {
    background-color: var(--wfh-cart-wrap-bg, #f5f5f5);
    border: var(--wfh-cart-wrap-bw, 0px) solid var(--wfh-cart-wrap-border, transparent);
    border-radius: var(--wfh-cart-wrap-br, 50px);
    padding: var(--wfh-cart-wrap-pad, 8px 16px);
}
.wfh-el-cart[data-design="outline"] a.wfh-cart-trigger {
    background-color: transparent;
    border: var(--wfh-cart-wrap-bw, 2px) solid var(--wfh-cart-wrap-border, #e0e0e0);
    border-radius: var(--wfh-cart-wrap-br, 50px);
    padding: var(--wfh-cart-wrap-pad, 8px 16px);
}

/* Круглий бейдж (Кількість) */
.wfh-cart-count { 
	position: absolute; top: -6px; right: -10px; 
	background: var(--wfh-cart-badge-bg, #2271b1); color: #fff; 
	font-size: 11px; font-weight: bold; border-radius: 50%; 
	padding: 2px 5px; line-height: 1; min-width: 16px; text-align: center;
}

/* Текст ціни */
.wfh-cart-total { font-weight: bold; margin-left: 15px; transition: all 0.3s ease; }

/* ЛОГІКА: Ховаємо текст ціни, якщо вибрано "Icon Only" */
.wfh-el-cart[data-display="icon"] .wfh-cart-total { display: none !important; }

/* --- ОВЕРЛЕЙ --- */
.wfh-cart-sidebar-overlay { 
	position: fixed; top: 0; left: 0; width: 100vw; 
	height: 100vh; /* Фолбек */
	height: 100dvh; /* Сучасний варіант */
	background: rgba(0,0,0,0.3) !important; z-index: 99999; 
	opacity: 0; visibility: hidden; transition: all 0.3s ease; 
}
.wfh-cart-sidebar-overlay.active { opacity: 1; visibility: visible; }

/* --- БОКОВА ПАНЕЛЬ (FLEX СТРУКТУРА) --- */
.wfh-cart-sidebar { 
	position: fixed; top: 0; right: 0; width: 360px; max-width: 100%; 
	height: 100vh;
	height: 100dvh;
	background: var(--wfh-sb-bg, #ffffff); color: var(--wfh-sb-text, #333333); 
	z-index: 99999; display: flex; flex-direction: column; box-shadow: -5px 0 25px rgba(0,0,0,0.15); 
	
	/* Нова плавна анімація через відеокарту */
	transform: translateX(100%);
	transition: transform 0.35s cubic-bezier(0.25, 0.8, 0.25, 1);
	will-change: transform;
}
.wfh-cart-sidebar.open { 
	transform: translateX(0); 
}
.wfh-cart-sidebar-header { 
	display: flex; justify-content: space-between; align-items: center; 
	padding: 20px 25px; border-bottom: 1px solid rgba(0,0,0,0.05); flex-shrink: 0;
}

/* СТИЛІ ЗАГОЛОВКУ (ТИПОГРАФІКА) */
.wfh-cart-sidebar-title {
    font-family: var(--wfh-sb-title-ff, inherit);
    font-weight: var(--wfh-sb-title-fw, 600);
    font-size: var(--wfh-sb-title-fs, 16px) !important;
    text-transform: var(--wfh-sb-title-tt, uppercase) !important;
    margin: 0;
    color: var(--wfh-sb-text, #333333);
}

/* НОВІ СТИЛІ КНОПКИ ЗАКРИВАННЯ */
.wfh-cart-sidebar-close { 
	background: var(--wfh-sb-close-bg, transparent); 
	border: none; 
	font-size: var(--wfh-sb-close-size, 20px); 
	cursor: pointer; 
	color: var(--wfh-sb-close-color, inherit); 
	padding: 8px; 
    border-radius: var(--wfh-sb-close-br, 4px);
	display: flex; align-items: center; justify-content: center;
    transition: all 0.2s ease;
}
.wfh-cart-sidebar-close:hover { 
    background: var(--wfh-sb-close-bg-h, rgba(0,0,0,0.05)); 
    color: var(--wfh-sb-close-color, inherit); 
}

.wfh-cart-sidebar-body { 
	display: flex; flex-direction: column; flex-grow: 1; overflow: hidden; position: relative;
	min-height: 0; 
}

/* --- ПРОГРЕС-БАР (ГНУЧКІ СТИЛІ) --- */
.wfh-free-shipping-wrapper { 
	margin: 20px 20px 0; padding: 15px; 
    background: var(--wfh-fs-bg, rgba(0,0,0,0.03)); 
    border: var(--wfh-fs-b-width, 0px) var(--wfh-fs-b-style, none) var(--wfh-fs-b-color, transparent);
    border-radius: var(--wfh-fs-b-rad, 6px); 
    flex-shrink: 0;
}
.wfh-fs-message { 
    font-size: var(--wfh-fs-t-fs, 14px); 
    font-family: var(--wfh-fs-t-ff, inherit);
    color: var(--wfh-fs-text-c, #333);
    margin-bottom: 12px; display: flex; align-items: center; gap: 8px; line-height: 1.3; 
}

.wfh-fs-message .dashicons { 
    color: var(--wfh-fs-ic-c, #77a464); 
    font-size: var(--wfh-fs-ic-size, 20px);
    width: var(--wfh-fs-ic-size, 20px);
    height: var(--wfh-fs-ic-size, 20px);
}

.wfh-fs-amount { 
    font-weight: bold; 
    color: var(--wfh-fs-amt-c, #77a464); 
    font-size: var(--wfh-fs-a-fs, 14px);
    font-family: var(--wfh-fs-a-ff, inherit);
}

/* Кастомна іконка авто */
.wfh-fs-custom-icon { 
    width: var(--wfh-fs-ic-size, 20px); 
    height: var(--wfh-fs-ic-size, 20px); 
    object-fit: contain; 
    display: inline-block; 
}
.wfh-fs-custom-icon.wfh-icon-mask {
    background-color: var(--wfh-fs-ic-c, #77a464);
    -webkit-mask-size: contain; mask-size: contain;
    -webkit-mask-repeat: no-repeat; mask-repeat: no-repeat;
    -webkit-mask-position: center; mask-position: center;
}

.wfh-fs-progress-bar { width: 100%; height: 6px; background: rgba(0,0,0,0.1); border-radius: 3px; overflow: hidden; }
.wfh-fs-progress-inner { height: 100%; background: var(--wfh-fs-prog, #77a464); transition: width 0.6s ease; }
.wfh-free-shipping-wrapper.wfh-fs-success .wfh-fs-message { font-weight: 500; }

/* --- ЗАХИСТ ВІД ТЕМИ WOODMART (СУВОРИЙ СКИДАННЯ) --- */
.wfh-cart-sidebar-content {
	display: flex; flex-direction: column; flex-grow: 1; overflow: hidden; margin-top: 15px; 
	min-height: 0; 
}
.wfh-cart-sidebar .widget_shopping_cart_content {
	display: flex !important; flex-direction: column !important; flex-grow: 1 !important; margin: 0 !important; padding: 0 !important;
	min-height: 0 !important; 
}
.wfh-cart-sidebar .woocommerce-mini-cart.cart_list {
	flex-grow: 1 !important; overflow-y: auto !important; overflow-x: hidden !important; 
	padding: 20px 25px 20px !important; margin: 0 !important; list-style: none !important;
	min-height: 0 !important; 
	-webkit-overflow-scrolling: touch !important; /* Робить скрол інерційним та плавним на iOS */
}
.wfh-cart-sidebar .woocommerce-mini-cart__empty-message { 
	padding: 20px !important; text-align: center !important; margin: auto !important; 
}

/* --- ДИЗАЙН ТОВАРІВ --- */
.wfh-cart-sidebar .woocommerce-mini-cart-item {
	display: flex !important; align-items: center !important; padding: 0 0 15px 0 !important; margin: 0 0 15px 0 !important;
	border-bottom: 1px solid rgba(0,0,0,0.05) !important; position: relative !important; text-align: left !important; flex-direction: row !important; align-content: space-around !important;
    flex-wrap: wrap;
}
.wfh-cart-sidebar .woocommerce-mini-cart-item img {
	width: 70px !important; height: auto !important; border-radius: 4px !important; margin: 0 15px 0 0 !important; float: none !important; box-shadow: none !important; padding: 4px !important; border: solid 1px #ededed !important;
}
.wfh-cart-sidebar .woocommerce-mini-cart-item a:not(.remove) {
	color: var(--wfh-cart-prod-t-c, #333) !important;
	font-family: var(--wfh-cart-prod-t-ff, inherit) !important;
	font-size: var(--wfh-cart-prod-t-fs, 14px) !important;
	font-weight: var(--wfh-cart-prod-t-fw, 500) !important;
	text-transform: var(--wfh-cart-prod-t-tt, none) !important;
	text-decoration: none !important; display: block !important; margin-bottom: 8px !important; padding-right: 25px !important; line-height: 1.3 !important; display: flex !important; align-items: flex-start !important;
}
/* --- ЗАПОБІГАННЯ БЛИМАННЮ (FOUC) --- */
.wfh-cart-sidebar .woocommerce-mini-cart-item .quantity {
	color: var(--wfh-cart-prod-p-c, #666) !important;
	font-family: var(--wfh-cart-prod-p-ff, inherit) !important;
	font-size: var(--wfh-cart-prod-p-fs, 14px) !important;
	font-weight: var(--wfh-cart-prod-p-fw, 500) !important;
	border: none !important; padding: 0 !important; margin: 0 !important;
	
	/* Ховаємо сирий текст, але утримуємо розмір блоку, щоб він не стрибав */
	opacity: 0 !important;
	visibility: hidden !important;
	min-height: 28px !important; /* Фіксуємо висоту на розмір наших кнопок */
	/* Ми ПРИБРАЛИ transition, щоб кнопки з'являлися без ефекту плавного вицвітання */
}

/* ПОКАЗУЄМО блок, коли JS додав кнопки та маркер wfh-qty-ready */
.wfh-cart-sidebar .woocommerce-mini-cart-item .quantity.wfh-qty-ready {
	opacity: 1 !important;
	visibility: visible !important;
	display: flex !important; 
	align-items: center !important;
	margin-top: 8px !important;
}
.wfh-cart-sidebar .woocommerce-mini-cart-item .quantity .amount {
	color: var(--wfh-cart-prod-p-c, #666) !important;
}
.wfh-cart-sidebar .wfh-mini-cart-price {
    font-weight: inherit !important; /* Перевизначаємо жорсткий inline-style з JS */
}
.wfh-cart-sidebar .woocommerce-mini-cart-item .remove {
	position: absolute !important; top: 0 !important; right: 0 !important; left: auto !important;
	
	/* Робимо розмір кнопки залежним від розміру іконки (додаємо +12px для комфортного кліку) */
	width: calc(var(--wfh-sb-close-size, 20px) + 5px) !important; 
	height: calc(var(--wfh-sb-close-size, 20px) + 5px) !important;
	display: flex !important; align-items: center !important; justify-content: center !important;
	
	/* Підтягуємо змінні з налаштувань Close Button (X) */
	border-radius: var(--wfh-sb-close-br, 4px) !important;
	background: var(--wfh-sb-close-bg, rgba(0,0,0,0.04)) !important;
	color: var(--wfh-sb-close-color, #333) !important;
	/*font-size: var(--wfh-sb-close-size, 16px) !important;*/
	font-size: 14px !important;
	font-weight: 600 !important;
	
	text-decoration: none !important; line-height: 1 !important; transition: all 0.2s ease !important; border: none !important;
}
.wfh-cart-sidebar .woocommerce-mini-cart-item .remove:hover { 
	background: var(--wfh-sb-close-bg-h, #e0e0e0) !important; 
	color: var(--wfh-sb-close-color, inherit) !important; 
}

/* --- КНОПКИ КІЛЬКОСТІ (+ / -) --- */
.wfh-cart-sidebar .wfh-qty-wrapper { 
	display: inline-flex !important; align-items: center !important; border: 1px solid rgba(0,0,0,0.1) !important; 
	border-radius: 4px !important; overflow: hidden !important; margin-right: 10px !important; background: #fff !important;
}
.wfh-cart-sidebar .wfh-qty-btn { 
	background: rgba(0,0,0,0.03) !important; border: none !important; width: 28px !important; height: 28px !important;
	cursor: pointer !important; font-size: 16px !important; display: flex !important; align-items: center !important; justify-content: center !important;
	color: inherit !important; transition: background 0.2s !important; padding: 0 !important; box-shadow: none !important;
}
.wfh-cart-sidebar .wfh-qty-btn:hover { background: rgba(0,0,0,0.08) !important; }
.wfh-cart-sidebar .wfh-qty-wrapper input.qty { 
	width: 35px !important; height: 28px !important; border: none !important; text-align: center !important; padding: 0 !important; margin: 0 !important;
	-moz-appearance: textfield !important; background: transparent !important; font-weight: 500 !important; color: inherit !important; box-shadow: none !important; font-size: 14px !important;
}
.wfh-cart-sidebar .wfh-qty-wrapper input.qty::-webkit-outer-spin-button, .wfh-cart-sidebar .wfh-qty-wrapper input.qty::-webkit-inner-spin-button { -webkit-appearance: none !important; margin: 0 !important; }
.wfh-cart-loading::after { content: '' !important; position: absolute !important; top: 0 !important; left: 0 !important; width: 100% !important; height: 100% !important; background: rgba(255,255,255,0.6) !important; z-index: 10 !important; }

/* --- ЗАКРІПЛЕНІ КНОПКИ ВНИЗУ --- */
.wfh-cart-sidebar .woocommerce-mini-cart__total {
	margin: 0 !important; 
	padding: 15px 25px !important; background: var(--wfh-sb-bg, #fff) !important;
	border-top: 1px solid rgba(0,0,0,0.05) !important; border-bottom: 1px solid rgba(0,0,0,0.05) !important;
	font-family: var(--wfh-cart-subt-t-ff, inherit) !important; 
	font-size: var(--wfh-cart-subt-t-fs, 16px) !important;
	font-weight: var(--wfh-cart-subt-t-fw, 600) !important;
	text-transform: var(--wfh-cart-subt-t-tt, uppercase) !important;
	color: var(--wfh-cart-subt-t-c, #333) !important;
	display: flex !important; justify-content: space-between !important; align-items: center !important;
	flex-shrink: 0 !important; 
}
.wfh-cart-sidebar .woocommerce-mini-cart__total strong { 
	font-weight: inherit !important; 
	color: inherit !important; 
}
.wfh-cart-sidebar .woocommerce-mini-cart__total .amount {
	font-family: var(--wfh-cart-subt-p-ff, inherit) !important; 
	font-size: var(--wfh-cart-subt-p-fs, 18px) !important;
	font-weight: var(--wfh-cart-subt-p-fw, 600) !important;
	color: var(--wfh-cart-subt-p-c, #2271b1) !important;
}

.wfh-cart-sidebar .woocommerce-mini-cart__buttons {
	padding: 15px 25px 20px !important; margin: 0 !important; display: flex !important; gap: 10px !important; background: var(--wfh-sb-bg, #fff) !important;
	flex-direction: var(--wfh-cart-btn-layout, row) !important; /* НОВЕ: Змінює напрямок залежно від налаштувань */
	flex-shrink: 0 !important; 
}
.wfh-cart-sidebar .woocommerce-mini-cart__buttons .button {
	flex: 1 !important; text-align: center !important; padding: 12px 15px !important; border-radius: 4px !important;
	text-decoration: none !important; display: block !important; font-weight: 600 !important; line-height: 1 !important; transition: all 0.3s ease !important; border: none !important; margin: 0 !important; font-size: 14px !important; min-height: 0 !important; box-shadow: none !important;
}
.wfh-cart-sidebar .woocommerce-mini-cart__buttons .button:not(.checkout) {
	background: var(--wfh-btn-vc-bg, #f0f0f0) !important;
	color: var(--wfh-btn-vc-color, #333) !important;
	font-family: var(--wfh-btn-vc-ff, inherit) !important;
	font-weight: var(--wfh-btn-vc-fw, 600) !important;
	font-size: var(--wfh-btn-vc-fs, 14px) !important;
	text-transform: var(--wfh-btn-vc-tt, none) !important;
}
.wfh-cart-sidebar .woocommerce-mini-cart__buttons .button:not(.checkout):hover {
	background: var(--wfh-btn-vc-bg-h, #e0e0e0) !important;
	color: var(--wfh-btn-vc-color-h, #333) !important;
}

.wfh-cart-sidebar .woocommerce-mini-cart__buttons .button.checkout {
	background: var(--wfh-btn-co-bg, #2271b1) !important;
	color: var(--wfh-btn-co-color, #fff) !important;
	font-family: var(--wfh-btn-co-ff, inherit) !important;
	font-weight: var(--wfh-btn-co-fw, 600) !important;
	font-size: var(--wfh-btn-co-fs, 14px) !important;
	text-transform: var(--wfh-btn-co-tt, none) !important;
}
.wfh-cart-sidebar .woocommerce-mini-cart__buttons .button.checkout:hover {
	background: var(--wfh-btn-co-bg-h, #135e96) !important;
	color: var(--wfh-btn-co-color-h, #fff) !important;
}