/**
 * Archive / Shop - Trang danh mục sản phẩm (SMT)
 * ----------------------------------------------
 * CSS cho trang danh mục: header, chips danh mục con, toolbar,
 * chế độ Lưới/Danh sách. Markup tương ứng: inc/archive-product.php
 *
 * Tiền tố class: .smt-archive-*, .smt-shop-*, .smt-view-*
 * Tái dùng card sản phẩm hiện có (.smt-pcard) cho lưới.
 */

/* ============ Token ============ */
:root {
	--smt-shop-primary: #1e73be;
	--smt-shop-text: #2a2a2a;
	--smt-shop-muted: #6b7280;
	--smt-shop-border: #e5e7eb;
	--smt-shop-bg-soft: #f7f8fa;
	--smt-shop-radius: 12px;
	--smt-shop-transition: 0.25s cubic-bezier(0.25, 0.8, 0.25, 1);
}

/* ============================================================
 * HEADER DANH MỤC (BANNER)
 * ------------------------------------------------------------
 * Bọc tiêu đề + breadcrumb + mô tả trong một "banner" gradient mềm,
 * có dải nhấn màu primary bên trái cho chuyên nghiệp.
 * ============================================================ */
.smt-archive-head {
	position: relative;
	margin: 0 0 28px;
	padding: 26px 28px;
	background:
		radial-gradient(120% 140% at 0% 0%, rgba(30, 115, 190, 0.10), transparent 60%),
		linear-gradient(135deg, #eef4fb 0%, #f7fafd 60%, #ffffff 100%);
	border: 1px solid var(--smt-shop-border);
	border-radius: var(--smt-shop-radius);
	overflow: hidden;
}

/* Dải nhấn màu primary bên trái */
.smt-archive-head::before {
	content: "";
	position: absolute;
	top: 0;
	left: 0;
	width: 5px;
	height: 100%;
	background: linear-gradient(180deg, var(--smt-shop-primary), #4aa3e8);
}

.smt-archive-head__breadcrumb {
	margin-bottom: 12px;
}


.smt-breadcrumb {
	font-size: 13px;
	color: var(--smt-shop-muted);
}

.smt-breadcrumb a {
	color: var(--smt-shop-muted);
	transition: color var(--smt-shop-transition);
}

.smt-breadcrumb a:hover {
	color: var(--smt-shop-primary);
}

.smt-breadcrumb__sep {
	margin: 0 8px;
	color: #c4c9d1;
}

.smt-archive-head__title {
	font-size: 28px;
	line-height: 1.2;
	font-weight: 700;
	color: var(--smt-shop-text);
	margin: 0 0 6px;
}

.smt-archive-head__count {
	font-size: 14px;
	color: var(--smt-shop-muted);
	margin: 0 0 10px;
}

.smt-archive-head__desc {
	font-size: 15px;
	line-height: 1.65;
	color: #4b5563;
	max-width: 820px;
}

.smt-archive-head__desc p:last-child {
	margin-bottom: 0;
}

/* Header có ảnh đại diện danh mục -> bố cục 2 cột */
.smt-archive-head--has-media .smt-archive-head__media {
	float: none;
	margin: 0 0 16px;
}

.smt-archive-head__img {
	display: block;
	width: 100%;
	max-width: 320px;
	height: auto;
	border-radius: var(--smt-shop-radius);
}

@media only screen and (min-width: 850px) {
	.smt-archive-head--has-media {
		display: grid;
		grid-template-columns: 300px 1fr;
		grid-template-areas:
			"bc   bc"
			"media text"
			"chips chips";
		gap: 8px 28px;
		align-items: center;
	}

	.smt-archive-head--has-media .smt-archive-head__breadcrumb {
		grid-area: bc;
	}

	.smt-archive-head--has-media .smt-archive-head__media {
		grid-area: media;
		margin: 0;
	}

	.smt-archive-head--has-media .smt-archive-head__text {
		grid-area: text;
	}

	.smt-archive-head--has-media .smt-archive-chips {
		grid-area: chips;
	}

	.smt-archive-head__img {
		max-width: 300px;
	}
}

/* ============================================================
 * CHIPS DANH MỤC CON
 * ============================================================ */
.smt-archive-chips {
	margin-top: 16px;
}

.smt-archive-chips__list {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.smt-archive-chips__item {
	margin: 0;
	list-style: none;
}

.smt-archive-chips__link {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 6px 14px;
	font-size: 13px;
	font-weight: 500;
	line-height: 1.4;
	color: var(--smt-shop-text);
	background: var(--smt-shop-bg-soft);
	border: 1px solid var(--smt-shop-border);
	border-radius: 999px;
	transition: all var(--smt-shop-transition);
}

.smt-archive-chips__link:hover {
	color: #fff;
	background: var(--smt-shop-primary);
	border-color: var(--smt-shop-primary);
}

.smt-archive-chips__count {
	font-size: 11px;
	font-weight: 600;
	color: var(--smt-shop-muted);
	background: #fff;
	border-radius: 999px;
	padding: 1px 7px;
	transition: all var(--smt-shop-transition);
}

.smt-archive-chips__link:hover .smt-archive-chips__count {
	color: var(--smt-shop-primary);
	background: #fff;
}

/* ============================================================
 * TOOLBAR (result count + view toggle + ordering)
 * ============================================================ */
.smt-shop-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	flex-wrap: wrap;
	gap: 12px;
	padding: 12px 0;
	margin-bottom: 20px;
	border-top: 1px solid var(--smt-shop-border);
	border-bottom: 1px solid var(--smt-shop-border);
}

.smt-shop-toolbar__left,
.smt-shop-toolbar__right {
	display: flex;
	align-items: center;
	gap: 14px;
}

/* WooCommerce result count nằm trong toolbar -> reset margin */
.smt-shop-toolbar .woocommerce-result-count {
	margin: 0;
	font-size: 14px;
	color: var(--smt-shop-muted);
	float: none;
}

/* WooCommerce ordering select */
.smt-shop-toolbar .woocommerce-ordering {
	margin: 0;
	float: none;
}

.smt-shop-toolbar .woocommerce-ordering select {
	height: 40px;
	border-radius: 8px;
	border: 1px solid var(--smt-shop-border);
	padding: 0 34px 0 12px;
	font-size: 14px;
	color: var(--smt-shop-text);
	background-color: #fff;
}

/* ---- View toggle (Grid / List) ---- */
.smt-view-toggle {
	display: inline-flex;
	border: 1px solid var(--smt-shop-border);
	border-radius: 8px;
	overflow: hidden;
}

.smt-view-toggle__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	padding: 0;
	margin: 0;
	border: 0;
	background: #fff;
	cursor: pointer;
	transition: background var(--smt-shop-transition);
}

.smt-view-toggle__btn + .smt-view-toggle__btn {
	border-left: 1px solid var(--smt-shop-border);
}

.smt-view-toggle__btn:hover {
	background: var(--smt-shop-bg-soft);
}

.smt-view-toggle__btn.is-active {
	background: var(--smt-shop-primary);
}

/* Icon vẽ bằng CSS (không cần ảnh) */
.smt-view-toggle__icon {
	display: block;
	width: 16px;
	height: 16px;
	position: relative;
}

.smt-view-toggle__icon--grid {
	background:
		linear-gradient(currentColor, currentColor) 0 0 / 6px 6px no-repeat,
		linear-gradient(currentColor, currentColor) 10px 0 / 6px 6px no-repeat,
		linear-gradient(currentColor, currentColor) 0 10px / 6px 6px no-repeat,
		linear-gradient(currentColor, currentColor) 10px 10px / 6px 6px no-repeat;
	color: var(--smt-shop-text);
}

.smt-view-toggle__icon--list {
	background:
		linear-gradient(currentColor, currentColor) 0 1px / 16px 3px no-repeat,
		linear-gradient(currentColor, currentColor) 0 7px / 16px 3px no-repeat,
		linear-gradient(currentColor, currentColor) 0 13px / 16px 3px no-repeat;
	color: var(--smt-shop-text);
}

.smt-view-toggle__btn.is-active .smt-view-toggle__icon {
	color: #fff;
}

/* ============================================================
 * CHẾ ĐỘ DANH SÁCH (LIST VIEW)
 * Card chuyển sang ngang: ảnh trái, nội dung phải.
 * ============================================================ */
.smt-products--list .smt-pcard,
.smt-view-list ul.products .smt-pcard {
	width: 100% !important;
	max-width: 100% !important;
	flex: 0 0 100% !important;
}

.smt-products--list .smt-pcard__inner {
	flex-direction: row;
	align-items: stretch;
}

.smt-products--list .smt-pcard__media {
	flex: 0 0 220px;
	max-width: 220px;
}

.smt-products--list .smt-pcard__image-link {
	width: 100%;
	min-height: 180px;
	aspect-ratio: auto;
	height: 100%;
}

.smt-products--list .smt-pcard__body {
	align-items: flex-start;
	text-align: left;
	justify-content: center;
	padding: 18px 22px;
}

.smt-products--list .smt-pcard__title {
	font-size: 18px;
	-webkit-line-clamp: 3;
}

.smt-products--list .smt-pcard__rating,
.smt-products--list .smt-pcard__price {
	justify-content: flex-start;
}

/* Trong list view hiện luôn nút action (không cần hover) */
.smt-products--list .smt-pcard__action {
	max-height: 60px;
	opacity: 1;
	margin-top: 12px;
	max-width: 240px;
}

@media only screen and (max-width: 549px) {
	.smt-products--list .smt-pcard__media {
		flex-basis: 120px;
		max-width: 120px;
	}

	.smt-products--list .smt-pcard__image-link {
		min-height: 120px;
	}

	.smt-products--list .smt-pcard__title {
		font-size: 15px;
	}
}

/* ============================================================
 * SIDEBAR SHOP (Search + Product Categories) - làm đẹp widget
 * ------------------------------------------------------------
 * Flatsome đặt sidebar trong #shop-sidebar. Mặc định ô search và
 * danh sách danh mục khá thô -> bo góc, thêm khoảng thở, hover mượt.
 * ============================================================ */
#shop-sidebar .widget {
	margin-bottom: 28px;
}

/* ---- Tiêu đề widget ---- */
#shop-sidebar .widget-title,
#shop-sidebar .widget-title-normal {
	position: relative;
	margin: 0 0 16px;
	padding-bottom: 10px;
	font-size: 14px;
	font-weight: 700;
	letter-spacing: 0.6px;
	text-transform: uppercase;
	color: var(--smt-shop-text);
}

/* Flatsome thêm sẵn 1 gạch '.is-divider' dưới tiêu đề widget.
 * Để tránh "2 gạch" chồng nhau, ẩn divider mặc định và chỉ dùng gạch ::after. */
#shop-sidebar .widget-title .is-divider,
#shop-sidebar .widget-title-normal .is-divider {
	display: none;
}

#shop-sidebar .widget-title::after {
	content: "";
	position: absolute;
	left: 0;
	bottom: 0;
	width: 40px;
	height: 3px;
	background: var(--smt-shop-primary);
	border-radius: 3px;
}


/* ---- Ô tìm kiếm sản phẩm ---- */
/* Flatsome render: form.searchform > .flex-row (ô input + nút) + .live-search-results
 * => form phải là container overflow:visible để dropdown live search thoát ra,
 *    còn kiểu "viên thuốc" đặt lên .flex-row. */
#shop-sidebar .widget_product_search form.searchform {
	position: relative;
	display: block;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: transparent;
	overflow: visible;
}

#shop-sidebar .widget_product_search .searchform .flex-row,
#shop-sidebar .widget_product_search .woocommerce-product-search {
	position: relative;
	display: flex;
	align-items: stretch;
	gap: 0;
	border: 1px solid var(--smt-shop-border);
	border-radius: 999px;
	overflow: hidden;
	background: #fff;
	transition: border-color var(--smt-shop-transition), box-shadow var(--smt-shop-transition);
}

#shop-sidebar .widget_product_search .searchform .flex-row:focus-within,
#shop-sidebar .widget_product_search .woocommerce-product-search:focus-within {
	border-color: var(--smt-shop-primary);
	box-shadow: 0 0 0 3px rgba(30, 115, 190, 0.12);
}

/* Bỏ margin/padding mặc định của các cột flex bao quanh ô input & nút */
#shop-sidebar .widget_product_search .searchform .flex-col {
	margin: 0 !important;
	padding: 0 !important;
}

#shop-sidebar .widget_product_search .searchform .flex-col.flex-grow {
	flex: 1 1 auto;
	min-width: 0;
}

#shop-sidebar .widget_product_search input[type="search"],
#shop-sidebar .widget_product_search input.search-field {
	flex: 1 1 auto;
	min-width: 0;
	height: 46px;
	margin: 0;
	padding: 0 16px;
	border: 0;
	border-radius: 0;
	background: transparent;
	font-size: 14px;
	color: var(--smt-shop-text);
	box-shadow: none;
}

#shop-sidebar .widget_product_search input[type="search"]:focus {
	box-shadow: none;
	outline: none;
}

#shop-sidebar .widget_product_search button,
#shop-sidebar .widget_product_search button[type="submit"] {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 0 0 auto;
	width: 46px;
	height: 46px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	background: var(--smt-shop-primary);
	color: #fff;
	font-size: 0; /* ẩn chữ "Search" nếu theme in ra, chỉ giữ icon */
	line-height: 1;
	cursor: pointer;
	transition: filter var(--smt-shop-transition);
}

#shop-sidebar .widget_product_search button:hover {
	filter: brightness(0.92);
}

/* Icon kính lúp bên trong nút: căn giữa, kích thước vừa phải */
#shop-sidebar .widget_product_search button i,
#shop-sidebar .widget_product_search button .icon-search,
#shop-sidebar .widget_product_search button svg {
	margin: 0;
	font-size: 16px;
	line-height: 1;
	color: #fff;
}

/* Nếu nút chỉ có chữ (không icon), hiện lại chữ với cỡ hợp lý */
#shop-sidebar .widget_product_search button:not(:has(i)):not(:has(svg)) {
	font-size: 13px;
	font-weight: 600;
	width: auto;
	padding: 0 18px;
}

/* ---- Dropdown live search trong sidebar ---- */
#shop-sidebar .widget_product_search .live-search-results {
	position: absolute;
	left: 0;
	right: 0;
	top: calc(100% + 8px);
	z-index: 60;
	background: transparent;
	border: 0;
	box-shadow: none;
	overflow: visible;
}

#shop-sidebar .widget_product_search .live-search-results .autocomplete-suggestions {
	position: static !important;
	left: auto !important;
	top: auto !important;
	width: 100% !important;
	max-height: min(60vh, 420px);
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
	background: #fff;
	border: 1px solid var(--smt-shop-border);
	border-radius: 12px;
	box-shadow: 0 12px 32px rgba(15, 23, 42, 0.12);
}

#shop-sidebar .widget_product_search .live-search-results .autocomplete-suggestion {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 10px 12px;
	border-bottom: 1px solid rgba(15, 23, 42, 0.06);
	cursor: pointer;
}

#shop-sidebar .widget_product_search .live-search-results .autocomplete-suggestion:last-child {
	border-bottom: 0;
}

#shop-sidebar .widget_product_search .live-search-results .autocomplete-suggestion:hover,
#shop-sidebar .widget_product_search .live-search-results .autocomplete-selected {
	background: rgba(30, 115, 190, 0.08);
}

#shop-sidebar .widget_product_search .live-search-results .autocomplete-suggestion img,
#shop-sidebar .widget_product_search .live-search-results .search-image {
	flex: 0 0 auto;
	width: 40px;
	height: 40px;
	border-radius: 999px;
	object-fit: cover;
}

#shop-sidebar .widget_product_search .live-search-results .search-name {
	flex: 1 1 auto;
	min-width: 0;
	font-size: 14px;
	line-height: 1.35;
	color: var(--smt-shop-text);
}

#shop-sidebar .widget_product_search .live-search-results .search-price {
	flex: 0 0 auto;
	font-size: 12px;
	font-weight: 700;
	color: var(--smt-shop-primary);
}

#shop-sidebar .widget_product_search .live-search-results .autocomplete-no-suggestion {
	padding: 12px 14px;
	font-size: 13px;
	color: #6b7280;
	background: #fff;
	border: 1px solid var(--smt-shop-border);
	border-radius: 12px;
}

/* ---- Danh sách danh mục sản phẩm ---- */
#shop-sidebar .widget_product_categories ul,
#shop-sidebar .widget_product_categories ul.product-categories {
	margin: 0;
	padding: 0;
	list-style: none;
}

#shop-sidebar .widget_product_categories li {
	position: relative;
	margin: 0;
	list-style: none;
	border-bottom: 1px solid var(--smt-shop-border);
}

#shop-sidebar .widget_product_categories li:last-child {
	border-bottom: 0;
}

#shop-sidebar .widget_product_categories li a {
	display: block;
	padding: 11px 36px 11px 12px;
	font-size: 14px;
	line-height: 1.4;
	color: var(--smt-shop-text);
	border-radius: 8px;
	transition: background var(--smt-shop-transition), color var(--smt-shop-transition), padding var(--smt-shop-transition);
}

#shop-sidebar .widget_product_categories li a:hover {
	color: var(--smt-shop-primary);
	background: var(--smt-shop-bg-soft);
	padding-left: 18px;
}

/* Danh mục đang chọn */
#shop-sidebar .widget_product_categories li.current-cat > a,
#shop-sidebar .widget_product_categories li.current-cat-parent > a {
	color: var(--smt-shop-primary);
	font-weight: 600;
	background: var(--smt-shop-bg-soft);
}

/* Số lượng (count) dạng pill */
#shop-sidebar .widget_product_categories li .count {
	float: none;
	margin-left: 6px;
	padding: 1px 8px;
	font-size: 11px;
	font-weight: 600;
	color: var(--smt-shop-muted);
	background: var(--smt-shop-bg-soft);
	border: 1px solid var(--smt-shop-border);
	border-radius: 999px;
}

/* Mũi tên mở danh mục con (Flatsome dùng .toggle) */
#shop-sidebar .widget_product_categories .toggle {
	position: absolute;
	top: 6px;
	right: 0;
	width: 32px;
	height: 32px;
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--smt-shop-muted);
	border-radius: 8px;
	transition: background var(--smt-shop-transition), color var(--smt-shop-transition);
}

#shop-sidebar .widget_product_categories .toggle:hover {
	background: var(--smt-shop-bg-soft);
	color: var(--smt-shop-primary);
}

/* Danh mục con thụt vào, gạch dọc nhẹ */
#shop-sidebar .widget_product_categories ul.children {
	margin: 0 0 6px;
	padding-left: 12px;
	border-left: 2px solid var(--smt-shop-border);
}

#shop-sidebar .widget_product_categories ul.children li {
	border-bottom: 0;
}

#shop-sidebar .widget_product_categories ul.children li a {
	padding: 8px 12px;
	font-size: 13px;
	color: var(--smt-shop-muted);
}

#shop-sidebar .widget_product_categories ul.children li a:hover {
	color: var(--smt-shop-primary);
}

/* ============================================================
 * RESPONSIVE HEADER / TOOLBAR
 * ============================================================ */
@media only screen and (max-width: 849px) {
	.smt-archive-chips {
		margin-top: 12px;
	}

	.smt-archive-chips__list {
		flex-wrap: nowrap;
		overflow-x: auto;
		overflow-y: hidden;
		overscroll-behavior-x: contain;
		-webkit-overflow-scrolling: touch;
		scroll-snap-type: x proximity;
		gap: 8px;
		padding-bottom: 6px;
		scrollbar-width: thin;
		scrollbar-color: #8f9bab #dde3eb;
	}

	.smt-archive-chips__list::-webkit-scrollbar {
		height: 5px;
	}

	.smt-archive-chips__list::-webkit-scrollbar-track {
		background: #dde3eb;
		border-radius: 999px;
	}

	.smt-archive-chips__list::-webkit-scrollbar-thumb {
		background: #8f9bab;
		border-radius: 999px;
	}

	.smt-archive-chips__item {
		flex: 0 0 auto;
		scroll-snap-align: start;
	}

	.smt-archive-chips__link {
		white-space: nowrap;
	}
}

@media only screen and (max-width: 549px) {
	.smt-archive-head__title {
		font-size: 22px;
	}


	.smt-shop-toolbar {
		flex-direction: column;
		align-items: stretch;
	}

	.smt-shop-toolbar__left,
	.smt-shop-toolbar__right {
		justify-content: space-between;
	}

	.smt-shop-toolbar .woocommerce-ordering,
	.smt-shop-toolbar .woocommerce-ordering select {
		width: 100%;
	}
}
