/**
 * BK Product Widget Stylesheet
 * Plugin: BK Tech (Author: Bùi Đức Hạnh - https://buhaweb.com/)
 * Kit 4 Global Design System Compliant (Tông Xanh Lá Chủ Đạo)
 * Zero-CLS, Low INP, High LCP Core Web Vitals (CrUX)
 */

/* ====================================================
   GRID CONTAINER (Zero-CLS & Responsive)
   ==================================================== */
.bdh-bk-product-grid {
	--bdh-bk-product-columns: 4;
	display: grid;
	grid-template-columns: repeat(var(--bdh-bk-product-columns, 4), 1fr);
	gap: 24px;
	width: 100%;
	box-sizing: border-box;
	contain: layout style;
}

/* ====================================================
   PRODUCT CARD
   ==================================================== */
.bdh-bk-product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	background-color: var(--e-global-color-8d5d81d, #FFFFFF);
	border: 1px solid var(--e-global-color-fcc82ce, #E5E7EB);
	border-radius: 12px;
	overflow: hidden;
	transition: border-color 0.3s ease, box-shadow 0.3s ease;
	box-sizing: border-box;
	height: 100%;
}

.bdh-bk-product-card:hover {
	border-color: var(--e-global-color-1070229, #2CAC55);
	box-shadow: 0 10px 25px rgba(0, 0, 0, 0.08);
}

/* ====================================================
   PRODUCT IMAGE & HOVER SCALE
   ==================================================== */
.bdh-bk-product-card__image-wrap {
	position: relative;
	width: 100%;
	overflow: hidden;
	background-color: var(--e-global-color-14ec4f2, #F8F9FA);
	border-top-left-radius: inherit;
	border-top-right-radius: inherit;
	line-height: 0;
}

.bdh-bk-product-card__thumb-link {
	display: block;
	width: 100%;
	height: 100%;
	line-height: 0;
	text-decoration: none;
}

.bdh-bk-product-card__thumb-box {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
}

.bdh-bk-product-card__thumb-box--1-1 { aspect-ratio: 1 / 1; }
.bdh-bk-product-card__thumb-box--4-3 { aspect-ratio: 4 / 3; }
.bdh-bk-product-card__thumb-box--3-4 { aspect-ratio: 3 / 4; }

.bdh-bk-product-card__img {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	transition: transform 0.45s cubic-bezier(0.25, 1, 0.5, 1);
	will-change: transform;
	transform: scale(1) translateZ(0);
	backface-visibility: hidden;
	pointer-events: none;
}

.bdh-bk-product-card:hover .bdh-bk-product-card__img {
	transform: scale(1.08) translateZ(0);
}

/* Sale Badge (Kit 4 Red Exception) */
.bdh-bk-product-card__badge-sale {
	position: absolute;
	top: 10px;
	left: 10px;
	z-index: 5;
	background-color: var(--e-global-color-d0d47e8, #EE3338);
	color: var(--e-global-color-8d5d81d, #FFFFFF);
	font-size: 11px;
	font-weight: 700;
	padding: 4px 10px;
	border-radius: 20px;
	line-height: 1;
	box-shadow: 0 2px 6px rgba(238, 51, 56, 0.35);
	text-transform: uppercase;
	letter-spacing: 0.5px;
}

/* ====================================================
   PRODUCT BODY CONTENT
   ==================================================== */
.bdh-bk-product-card__body {
	display: flex;
	flex-direction: column;
	flex-grow: 1;
	padding: 16px 16px 18px;
	box-sizing: border-box;
}

/* Meta: Category & SKU */
.bdh-bk-product-card__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 8px;
	margin-bottom: 8px;
	font-size: 12px;
	line-height: 1.4;
}

.bdh-bk-product-card__category {
	color: var(--e-global-color-97923db, #1E6B3A);
	text-decoration: none;
	font-weight: 600;
	transition: color 0.2s ease;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
}

.bdh-bk-product-card__category:hover {
	color: var(--e-global-color-938e6c1, #2A9150);
}

.bdh-bk-product-card__sku {
	color: var(--e-global-color-47f60d3, #9CA3AF);
	font-size: 11px;
	white-space: nowrap;
}

/* Title */
.bdh-bk-product-card__title {
	margin: 0 0 10px;
	font-size: var(--e-global-typography-fc3ef67-font-size, 18px);
	font-weight: var(--e-global-typography-fc3ef67-font-weight, 600);
	line-height: var(--e-global-typography-fc3ef67-line-height, 1.4em);
	color: var(--e-global-color-d27c3cc, #1F2328);
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	min-height: 2.8em;
	transition: color 0.25s ease;
}

.bdh-bk-product-card__title a {
	color: inherit;
	text-decoration: none;
	transition: color 0.25s ease;
}

.bdh-bk-product-card:hover .bdh-bk-product-card__title a,
.bdh-bk-product-card__title a:hover {
	color: var(--e-global-color-938e6c1, #2A9150);
}

/* Price */
.bdh-bk-product-card__price-wrap {
	margin-bottom: 14px;
	display: flex;
	align-items: baseline;
	justify-content: flex-start;
	gap: 8px;
	flex-wrap: wrap;
	width: 100%;
}

.bdh-bk-product-card__price {
	font-size: var(--e-global-typography-455dcfb-font-size, 18px);
	font-weight: var(--e-global-typography-455dcfb-font-weight, 700);
	color: var(--e-global-color-97923db, #1E6B3A);
	line-height: 1.2;
}

.bdh-bk-product-card__price .woocommerce-Price-amount {
	color: inherit;
	font-size: inherit;
	font-weight: inherit;
}

/* Regular price when on sale (struck through) */
.bdh-bk-product-card__price del {
	font-size: 0.78em;
	color: var(--e-global-color-47f60d3, #9CA3AF);
	font-weight: 400;
	margin-right: 4px;
}

/* Sale price: Kit 4 Red exception */
.bdh-bk-product-card__price ins {
	text-decoration: none;
	color: var(--e-global-color-d0d47e8, #EE3338);
	font-weight: 700;
	font-size: inherit;
}

/* Contact price text if 0 đ */
.bdh-bk-product-card__price-contact {
	font-size: inherit;
	font-weight: inherit;
	color: var(--e-global-color-938e6c1, #2A9150);
	line-height: inherit;
}

/* ====================================================
   BUTTON (THÊM VÀO GIỎ / XEM CHI TIẾT)
   ==================================================== */
.bdh-bk-product-card__actions {
	margin-top: auto;
	padding-top: 8px;
	width: 100%;
}

.bdh-bk-product-card__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	width: 100%;
	padding: 10px 18px;
	border-radius: 45px;
	font-size: var(--e-global-typography-79e5d5b-font-size, 14px);
	font-weight: var(--e-global-typography-79e5d5b-font-weight, 600);
	line-height: var(--e-global-typography-79e5d5b-line-height, 1.5em);
	text-decoration: none;
	cursor: pointer;
	border: 1px solid var(--e-global-color-938e6c1, #2A9150);
	background-color: var(--e-global-color-938e6c1, #2A9150);
	color: var(--e-global-color-8d5d81d, #FFFFFF);
	transition: all 0.25s ease;
	box-sizing: border-box;
}

/* NỀN XANH CHỮ PHẢI TRẮNG (SKILL.md) */
.bdh-bk-product-card__btn:hover,
.bdh-bk-product-card:hover .bdh-bk-product-card__btn {
	background-color: var(--e-global-color-97923db, #1E6B3A);
	border-color: var(--e-global-color-97923db, #1E6B3A);
	color: var(--e-global-color-8d5d81d, #FFFFFF);
}

.bdh-bk-product-card__btn i,
.bdh-bk-product-card__btn svg {
	font-size: 14px;
	transition: transform 0.25s ease;
}

.bdh-bk-product-card__btn:hover i,
.bdh-bk-product-card__btn:hover svg {
	transform: scale(1.15);
}

/* ====================================================
   SLIDER / CAROUSEL MODE (SWIPER)
   ==================================================== */
.bdh-bk-product-slider-wrap {
	position: relative;
	width: 100%;
	box-sizing: border-box;
}

.bdh-bk-product-slider-wrap--arrows-outside {
	padding: 0 20px;
}

.bdh-bk-product-slider-wrap--arrows-inside {
	padding: 0;
}

.bdh-bk-product-slider {
	position: relative;
	width: 100%;
	overflow: hidden;
	padding: 10px 4px 30px;
	box-sizing: border-box;
}

.bdh-bk-product-slider .swiper-slide {
	height: auto;
	display: flex;
}

.bdh-bk-product-slider .swiper-slide .bdh-bk-product-card {
	width: 100%;
}

/* Slider Navigation Arrows */
.bdh-bk-product-arrow {
	position: absolute;
	top: 45%;
	z-index: 10;
	width: 40px;
	height: 40px;
	border-radius: 50%;
	background-color: var(--e-global-color-8d5d81d, #FFFFFF);
	color: var(--e-global-color-d27c3cc, #1F2328);
	border: 1px solid var(--e-global-color-fcc82ce, #E5E7EB);
	box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	transform: translateY(-50%);
	transition: all 0.25s ease;
}

.bdh-bk-product-arrow:hover {
	background-color: var(--e-global-color-938e6c1, #2A9150);
	border-color: var(--e-global-color-938e6c1, #2A9150);
	color: var(--e-global-color-8d5d81d, #FFFFFF);
	transform: translateY(-50%) scale(1.08);
}

.bdh-bk-product-arrow--prev { left: 10px; }
.bdh-bk-product-arrow--next { right: 10px; }

/* Outside arrows placement */
.bdh-bk-product-slider-wrap--arrows-outside .bdh-bk-product-arrow--prev { left: -16px; }
.bdh-bk-product-slider-wrap--arrows-outside .bdh-bk-product-arrow--next { right: -16px; }

/* Inside arrows placement */
.bdh-bk-product-slider-wrap--arrows-inside .bdh-bk-product-arrow--prev { left: 12px; }
.bdh-bk-product-slider-wrap--arrows-inside .bdh-bk-product-arrow--next { right: 12px; }

.bdh-bk-product-arrow.swiper-button-disabled {
	opacity: 0.3;
	cursor: not-allowed;
	pointer-events: none;
}

/* Slider Pagination Dots */
.bdh-bk-product-slider .swiper-pagination {
	position: relative;
	bottom: 0;
	margin-top: 20px;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
}

.bdh-bk-product-slider .swiper-pagination-bullet {
	width: 10px;
	height: 10px;
	background-color: var(--e-global-color-fcc82ce, #E5E7EB);
	border-radius: 20px;
	transition: all 0.3s ease;
	opacity: 1;
	cursor: pointer;
	margin: 0 !important;
}

.bdh-bk-product-slider .swiper-pagination-bullet-active {
	width: 26px;
	background-color: var(--e-global-color-1070229, #2CAC55);
}

/* ====================================================
   PAGINATION (ARCHIVE & GRID)
   ==================================================== */
.bdh-bk-product-pagination {
	margin-top: 36px;
	display: flex;
	justify-content: center;
	align-items: center;
	width: 100%;
}

.bdh-bk-product-pagination ul.page-numbers {
	display: flex;
	align-items: center;
	gap: 8px;
	list-style: none;
	margin: 0;
	padding: 0;
	flex-wrap: wrap;
}

.bdh-bk-product-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 14px;
	border-radius: 8px;
	background-color: var(--e-global-color-8d5d81d, #FFFFFF);
	border: 1px solid var(--e-global-color-fcc82ce, #E5E7EB);
	color: var(--e-global-color-d27c3cc, #1F2328);
	text-decoration: none;
	font-size: var(--e-global-typography-79e5d5b-font-size, 14px);
	font-weight: 600;
	transition: all 0.25s ease;
	box-sizing: border-box;
}

.bdh-bk-product-pagination a.page-numbers:hover {
	background-color: var(--e-global-color-d9c2012, #E8F6EC);
	border-color: var(--e-global-color-938e6c1, #2A9150);
	color: var(--e-global-color-97923db, #1E6B3A);
}

/* NỀN XANH CHỮ TRẮNG (SKILL.md) */
.bdh-bk-product-pagination span.page-numbers.current {
	background-color: var(--e-global-color-938e6c1, #2A9150);
	border-color: var(--e-global-color-938e6c1, #2A9150);
	color: var(--e-global-color-8d5d81d, #FFFFFF);
	box-shadow: 0 3px 10px rgba(42, 145, 80, 0.25);
}

.bdh-bk-product-pagination .page-numbers.dots {
	background: transparent;
	border: none;
	min-width: 24px;
	color: var(--e-global-color-76ff1c6, #4B5563);
}

/* ====================================================
   SORTING TOOLBAR (Archive / Grid)
   ==================================================== */
.bdh-bk-product-widget-container {
	position: relative;
	width: 100%;
	box-sizing: border-box;
}

.bdh-bk-product-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 16px;
	margin-bottom: 24px;
	padding: 12px 16px;
	background-color: var(--e-global-color-14ec4f2, #F8F9FA);
	border: 1px solid var(--e-global-color-fcc82ce, #E5E7EB);
	border-radius: 8px;
	box-sizing: border-box;
}

.bdh-bk-product-count {
	font-size: var(--e-global-typography-79e5d5b-font-size, 14px);
	color: var(--e-global-color-76ff1c6, #4B5563);
	font-weight: 400;
}

.bdh-bk-product-count strong {
	color: var(--e-global-color-d27c3cc, #1F2328);
	font-weight: 600;
}

.bdh-bk-product-sort {
	display: inline-flex;
	align-items: center;
	gap: 10px;
	margin-left: auto;
}

.bdh-bk-product-sort__label {
	font-size: var(--e-global-typography-79e5d5b-font-size, 14px);
	color: var(--e-global-color-76ff1c6, #4B5563);
	font-weight: 500;
	margin: 0;
	white-space: nowrap;
}

.bdh-bk-product-sort__select-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
}

.bdh-bk-product-sort__select {
	appearance: none;
	-webkit-appearance: none;
	-moz-appearance: none;
	background-color: var(--e-global-color-8d5d81d, #FFFFFF);
	color: var(--e-global-color-d27c3cc, #1F2328);
	border: 1px solid var(--e-global-color-fcc82ce, #E5E7EB);
	border-radius: 6px;
	padding: 8px 36px 8px 14px;
	font-size: 14px;
	line-height: 1.4;
	font-weight: 500;
	cursor: pointer;
	outline: none;
	transition: border-color 0.25s ease, box-shadow 0.25s ease;
	min-width: 175px;
}

.bdh-bk-product-sort__select:hover {
	border-color: var(--e-global-color-1070229, #2CAC55);
}

.bdh-bk-product-sort__select:focus {
	border-color: var(--e-global-color-1070229, #2CAC55);
	box-shadow: 0 0 0 3px rgba(44, 172, 85, 0.15);
}

.bdh-bk-product-sort__arrow {
	position: absolute;
	right: 12px;
	pointer-events: none;
	font-size: 11px;
	color: var(--e-global-color-47f60d3, #9CA3AF);
	transition: transform 0.2s ease;
}

/* Loading state for AJAX */
.bdh-bk-product-grid-container {
	position: relative;
	width: 100%;
	min-height: 80px;
}

.bdh-bk-product-grid-container.is-loading .bdh-bk-product-grid {
	opacity: 0.35;
	pointer-events: none;
	transition: opacity 0.25s ease;
}

.bdh-bk-product-grid-loader {
	position: absolute;
	inset: 0;
	display: none;
	align-items: center;
	justify-content: center;
	z-index: 10;
	background: rgba(255, 255, 255, 0.45);
	backdrop-filter: blur(2px);
	border-radius: 12px;
}

.bdh-bk-product-grid-container.is-loading .bdh-bk-product-grid-loader {
	display: flex;
}

.bdh-bk-product-spinner {
	width: 38px;
	height: 38px;
	border: 3px solid rgba(44, 172, 85, 0.2);
	border-top-color: var(--e-global-color-1070229, #2CAC55);
	border-radius: 50%;
	animation: bdh-bk-spin 0.75s linear infinite;
}

@keyframes bdh-bk-spin {
	to { transform: rotate(360deg); }
}

/* ====================================================
   RESPONSIVE BREAKPOINTS (KIT 4: TABLET <= 1024px, MOBILE <= 767px)
   ==================================================== */
@media (max-width: 1024px) {
	.bdh-bk-product-grid {
		gap: 20px;
	}
}

@media (max-width: 767px) {
	.bdh-bk-product-grid {
		gap: 16px;
	}

	.bdh-bk-product-card__body {
		padding: 14px 12px 14px;
	}

	.bdh-bk-product-card__title {
		font-size: 15px;
	}

	.bdh-bk-product-arrow {
		width: 34px;
		height: 34px;
		font-size: 12px;
	}

	.bdh-bk-product-toolbar {
		flex-direction: column;
		align-items: stretch;
		gap: 12px;
	}

	.bdh-bk-product-sort {
		margin-left: 0;
		width: 100%;
		justify-content: space-between;
	}

	.bdh-bk-product-sort__select-wrap {
		flex: 1;
	}

	.bdh-bk-product-sort__select {
		width: 100%;
	}
}
