/**
 * MNC Products Listing (L246) — styles
 * Source: davinci mnc-products-mockup.html (approved 2026-08-31)
 * Scoped: page-hero / products-page / product-card / brand-strip are
 * page-scoped classes that only exist on listing pages.
 */
:root {
	--c-navy:       #1E2640;
	--c-navy-light: #2d3a5c;
	--c-orange:     #FFA500;
	--c-yellow:     #FCD116;
	--c-accent:     #F59E0B;
	--c-border:     #E5E5E5;
	--c-bg:         #f5f5f8;
	--c-text:       #333333;
	--c-text-light: #666666;
	--font-thai:    'IBM Plex Sans Thai', sans-serif;
	--font-inter:   'Inter', sans-serif;
	--radius-md:    8px;
	--radius-lg:    16px;
	--radius-full:  9999px;
	--shadow-sm:    0 1px 3px rgba(0,0,0,0.08);
	--shadow-md:    0 4px 12px rgba(0,0,0,0.1);
	--t:            150ms ease;
}

/* Page background only on listing pages */
.page-hero ~ .products-page,
.products-page { background: transparent; }
body:has(.products-page) { background: var(--c-bg); }

/* ── BREADCRUMB ── */
.breadcrumb-bar { background: #fff; border-bottom: 1px solid var(--c-border); }
.breadcrumb-inner {
	max-width: 1280px; margin: 0 auto; padding: 12px 20px;
	display: flex; align-items: center; gap: 8px; font-size: 12px; color: var(--c-text-light);
	font-family: var(--font-thai);
}
.breadcrumb-inner a { color: var(--c-text-light); transition: color var(--t); }
.breadcrumb-inner a:hover { color: var(--c-orange); }
.breadcrumb-inner i { font-size: 10px; color: #ccc; }

/* ── PAGE HERO ── */
.page-hero { background: linear-gradient(135deg, var(--c-navy) 0%, var(--c-navy-light) 100%); padding: 40px 20px; }
.page-hero-inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; justify-content: space-between; gap: 24px; flex-wrap: wrap; }
.page-hero-text h1 { font-family: var(--font-inter); font-size: 30px; font-weight: 800; color: #fff; margin: 0 0 6px; }
.page-hero-text p { font-size: 14px; color: rgba(255,255,255,0.6); margin: 0; }
.page-hero-stats { display: flex; gap: 28px; }
.page-hero-stat { text-align: center; }
.page-hero-stat .num { font-family: var(--font-inter); font-size: 28px; font-weight: 800; color: var(--c-yellow); }
.page-hero-stat .label { font-size: 11px; color: rgba(255,255,255,0.5); margin-top: 2px; }

/* ── PRODUCTS LAYOUT ── */
.products-page {
	max-width: 1280px; margin: 0 auto; padding: 28px 20px 60px;
	display: grid; grid-template-columns: 260px 1fr; gap: 28px;
	font-family: var(--font-thai); color: var(--c-text);
}
.products-page a { text-decoration: none; color: inherit; }

/* ── SIDEBAR FILTERS ── */
.filter-sidebar { position: sticky; top: 128px; height: fit-content; align-self: start; }
.filter-card { background: #fff; border-radius: var(--radius-lg); padding: 20px; box-shadow: var(--shadow-sm); }
.filter-section { margin-bottom: 24px; }
.filter-section:last-child { margin-bottom: 0; }
.filter-title {
	font-size: 13px; font-weight: 700; color: var(--c-navy); margin-bottom: 12px; padding-bottom: 8px;
	border-bottom: 1px solid var(--c-border); display: flex; align-items: center; gap: 6px;
}
.filter-title i { color: var(--c-orange); font-size: 12px; }

.cat-tree { display: flex; flex-direction: column; gap: 2px; }
.cat-item {
	display: flex; align-items: center; gap: 8px; padding: 8px 10px; border-radius: var(--radius-md);
	cursor: pointer; transition: all var(--t); font-size: 13px; color: var(--c-text);
}
.cat-item:hover { background: #f5f5f5; }
.cat-item.active { background: rgba(255,165,0,0.1); color: var(--c-orange); font-weight: 600; }
.cat-item .cat-icon { margin-right: 4px; }
.cat-item .cat-name { flex: 1; }
.cat-count { font-size: 10px; font-weight: 600; color: var(--c-text-light); background: #f0f0f0; padding: 2px 7px; border-radius: 10px; }
.cat-children { margin-left: 20px; flex-direction: column; gap: 2px; }
.cat-child { font-size: 12px; padding: 6px 10px; }

.brand-list { display: flex; flex-direction: column; gap: 6px; }
.brand-item {
	display: flex; align-items: center; gap: 10px; padding: 8px 10px; border-radius: var(--radius-md);
	cursor: pointer; transition: all var(--t); font-size: 13px;
}
.brand-item:hover { background: #f5f5f5; }
.brand-item.active { background: rgba(255,165,0,0.1); font-weight: 600; }
.brand-item.active .brand-check { background: var(--c-orange); border-color: var(--c-orange); }
.brand-item.active .brand-check i { display: block; }
.brand-check {
	width: 18px; height: 18px; border: 2px solid var(--c-border); border-radius: 4px;
	display: flex; align-items: center; justify-content: center; transition: all var(--t); flex-shrink: 0;
}
.brand-check i { font-size: 10px; color: #fff; display: none; }
.brand-name { flex: 1; }
.brand-badge { font-size: 10px; font-weight: 700; color: var(--c-orange); background: rgba(255,165,0,0.12); padding: 2px 8px; border-radius: 10px; }

.price-inputs { display: flex; gap: 8px; align-items: center; }
.price-inputs input {
	width: 100%; height: 36px; padding: 0 10px; border: 1.5px solid var(--c-border); border-radius: var(--radius-md);
	font-size: 12px; font-family: var(--font-thai); text-align: center; outline: none; transition: border-color var(--t);
	background: #fff; color: var(--c-text);
}
.price-inputs input:focus { border-color: var(--c-orange); }
.price-inputs span { color: var(--c-text-light); font-size: 12px; flex-shrink: 0; }
.price-filter-btn {
	width: 100%; height: 36px; margin-top: 12px; background: var(--c-orange); border: none; border-radius: var(--radius-md);
	color: #fff; font-size: 13px; font-weight: 600; cursor: pointer; transition: background var(--t); font-family: var(--font-thai);
}
.price-filter-btn:hover { background: #e69500; }

.clear-filters {
	display: flex; align-items: center; justify-content: center; gap: 6px; width: 100%; padding: 10px; margin-top: 8px;
	background: transparent; border: 1.5px solid var(--c-border); border-radius: var(--radius-md);
	font-size: 12px; font-weight: 600; color: var(--c-text-light); cursor: pointer; transition: all var(--t);
	font-family: var(--font-thai);
}
.clear-filters:hover { border-color: var(--c-orange); color: var(--c-orange); }

/* ── SORT BAR ── */
.sort-bar {
	display: flex; align-items: center; justify-content: space-between;
	background: #fff; border-radius: var(--radius-lg); padding: 14px 18px; box-shadow: var(--shadow-sm); margin-bottom: 20px;
}
.sort-left { display: flex; align-items: center; gap: 12px; }
.sort-left span { font-size: 13px; color: var(--c-text-light); }
.sort-left strong { color: var(--c-navy); font-size: 14px; }
.sort-right { display: flex; align-items: center; gap: 12px; }
.sort-select {
	height: 36px; padding: 0 32px 0 12px; border: 1.5px solid var(--c-border); border-radius: var(--radius-md);
	font-size: 13px; font-family: var(--font-thai); background: #fff; appearance: none; cursor: pointer;
	outline: none; transition: border-color var(--t); color: var(--c-text);
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' fill='%23666' viewBox='0 0 16 16'%3E%3Cpath d='M8 11L3 6h10z'/%3E%3C/svg%3E");
	background-repeat: no-repeat; background-position: right 10px center;
}
.sort-select:focus { border-color: var(--c-orange); }
.view-toggle { display: flex; gap: 4px; flex-shrink: 0; }
.view-btn {
	box-sizing: border-box; padding: 0; flex: 0 0 auto;
	width: 36px; height: 36px; border: 1.5px solid var(--c-border); border-radius: var(--radius-md); background: #fff;
	cursor: pointer; display: flex; align-items: center; justify-content: center; transition: all var(--t); color: var(--c-text-light);
}
.view-btn.active { background: var(--c-orange); border-color: var(--c-orange); color: #fff; }
.view-btn i { font-size: 14px; line-height: 1; display: block; }

/* ── PRODUCT GRID ── */
.products-grid { display: grid; grid-template-columns: repeat(3, 1fr); gap: 18px; }
.product-card {
	background: #fff; border-radius: var(--radius-lg); overflow: hidden; box-shadow: var(--shadow-sm);
	transition: all var(--t); position: relative; display: flex; flex-direction: column;
}
.product-card:hover { box-shadow: var(--shadow-md); transform: translateY(-3px); }

.product-badge-overlay { position: absolute; top: 12px; left: 12px; z-index: 2; display: flex; flex-direction: column; gap: 4px; }
.badge-tag { display: inline-flex; align-items: center; gap: 4px; padding: 4px 10px; border-radius: var(--radius-full); font-size: 10px; font-weight: 700; }
.badge-new { background: var(--c-orange); color: #fff; }
.badge-best { background: var(--c-navy); color: var(--c-yellow); }
.badge-sale { background: #e74c3c; color: #fff; }

.product-img {
	height: 180px; background: #f8f9fa; display: flex; align-items: center; justify-content: center;
	position: relative; overflow: hidden;
}
.product-img img { max-height: 160px; max-width: 90%; object-fit: contain; transition: transform var(--t); }
.product-card:hover .product-img img { transform: scale(1.04); }
.mncpl-noimg { font-size: 42px; color: #d5d8e0; }

.product-body { padding: 14px 16px 16px; display: flex; flex-direction: column; flex: 1; }
.product-brand { font-size: 10px; font-weight: 700; color: var(--c-orange); text-transform: uppercase; letter-spacing: 1px; margin-bottom: 4px; display: inline-block; }
.product-brand:hover { text-decoration: underline; }
.product-name {
	font-size: 14px; font-weight: 600; color: var(--c-navy); line-height: 1.4; margin-bottom: 8px;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.product-name:hover { color: var(--c-orange); }
.product-specs { display: flex; flex-wrap: wrap; gap: 4px; margin-bottom: 12px; }
.spec-tag { font-size: 10px; color: var(--c-text-light); background: #f0f0f5; padding: 3px 8px; border-radius: var(--radius-full); }

.product-price-row { display: flex; align-items: flex-end; justify-content: space-between; gap: 8px; margin-top: auto; }
.product-price { font-family: var(--font-inter); font-size: 16px; font-weight: 800; color: var(--c-navy); }
.product-price del { font-size: 12px; font-weight: 400; color: var(--c-text-light); }
.product-price ins { text-decoration: none; }
.product-price .woocommerce-Price-currencySymbol { font-size: 12px; font-weight: 400; color: var(--c-text-light); }
.product-stock { display: flex; align-items: center; gap: 4px; font-size: 11px; color: #27ae60; font-weight: 600; white-space: nowrap; }
.product-stock i { font-size: 9px; }
.product-stock.mncpl-out { color: #c0392b; }

.product-cta { display: flex; gap: 8px; margin-top: 12px; }
.product-cta a {
	flex: 1; height: 36px; border-radius: var(--radius-md); font-size: 12px; font-weight: 600;
	cursor: pointer; transition: all var(--t); font-family: var(--font-thai);
	display: inline-flex; align-items: center; justify-content: center; gap: 5px; text-align: center;
}
.btn-add-cart { background: var(--c-orange); color: #fff; }
.btn-add-cart:hover { background: #e69500; color: #fff; }
.btn-quote { background: transparent; border: 1.5px solid var(--c-navy); color: var(--c-navy); }
.btn-quote:hover { background: var(--c-navy); color: #fff; }

/* List view */
.products-grid.mncpl-list-view { grid-template-columns: 1fr; }
.products-grid.mncpl-list-view .product-card { display: grid; grid-template-columns: 200px 1fr; }
.products-grid.mncpl-list-view .product-img { height: 100%; min-height: 160px; }
.products-grid.mncpl-list-view .product-badge-overlay { top: 12px; left: 212px; }

/* Empty state */
.mncpl-empty { text-align: center; padding: 60px 20px; color: var(--c-text-light); }
.mncpl-empty i { font-size: 48px; color: #d5d8e0; margin-bottom: 16px; }
.mncpl-empty .clear-filters { display: inline-flex; width: auto; padding: 10px 24px; margin-top: 12px; }

/* ── PAGINATION ── */
.pagination { display: flex; align-items: center; justify-content: center; gap: 6px; margin-top: 32px; flex-wrap: wrap; }
.pagination .page-numbers {
	min-width: 38px; height: 38px; padding: 0 12px; border: 1.5px solid var(--c-border); border-radius: var(--radius-md);
	background: #fff; font-size: 13px; font-weight: 600; cursor: pointer; transition: all var(--t);
	display: flex; align-items: center; justify-content: center; font-family: var(--font-thai); color: var(--c-text);
	text-decoration: none;
}
.pagination .page-numbers:hover { border-color: var(--c-orange); color: var(--c-orange); }
.pagination .page-numbers.current { background: var(--c-orange); border-color: var(--c-orange); color: #fff; }
.pagination .page-numbers.dots { border: none; background: transparent; cursor: default; }

/* ── BRAND STRIP ── */
.brand-strip { background: var(--c-navy); padding: 24px 20px; }
.brand-strip-inner { max-width: 1280px; margin: 0 auto; display: flex; align-items: center; gap: 32px; }
.brand-strip-label {
	font-size: 12px; font-weight: 700; color: rgba(255,255,255,0.5); text-transform: uppercase;
	letter-spacing: 1px; white-space: nowrap; font-family: var(--font-inter);
}
.brand-logos { display: flex; gap: 32px; align-items: center; flex: 1; overflow-x: auto; scrollbar-width: none; }
.brand-logos::-webkit-scrollbar { display: none; }
.brand-logo-item {
	font-family: var(--font-inter); font-size: 16px; font-weight: 700; color: rgba(255,255,255,0.6);
	white-space: nowrap; transition: color var(--t);
}
.brand-logo-item:hover { color: var(--c-yellow); }

/* ── RESPONSIVE ── */
@media (max-width: 1200px) {
	.page-hero-inner { flex-wrap: wrap; }
	.page-hero-stats { flex-wrap: wrap; }
	.sort-bar { flex-wrap: wrap; gap: 10px; }
	.sort-right { flex-wrap: wrap; }
	.sort-select { max-width: 100%; }
}
@media (max-width: 1024px) {
	.products-grid { grid-template-columns: repeat(2, 1fr); }
	.products-page { grid-template-columns: 1fr; }
	.filter-sidebar { position: static; }
	.products-grid.mncpl-list-view .product-card { grid-template-columns: 160px 1fr; }
	.products-grid.mncpl-list-view .product-badge-overlay { left: 172px; }
}
@media (max-width: 768px) {
	.products-grid { grid-template-columns: repeat(2, 1fr); gap: 12px; }
	.page-hero-stats { display: none; }
	.sort-bar { flex-wrap: wrap; gap: 10px; }
	.products-grid.mncpl-list-view .product-card { grid-template-columns: 1fr; }
	.products-grid.mncpl-list-view .product-badge-overlay { left: 12px; }
}
@media (max-width: 480px) {
	.products-grid { grid-template-columns: 1fr; }
	.page-hero-text h1 { font-size: 24px; }
}

/* ── Pagination overflow fix (L246b) — parent theme interference guard ── */
.products-page .pagination,
.products-main { min-width: 0; }
.products-main .pagination {
	display: flex;
	clear: both;
	position: static;
	flex-wrap: wrap;
	justify-content: center;
	width: 100%;
	max-width: 100%;
	overflow: hidden;
}
.products-page .pagination .page-numbers,
.products-main .pagination .page-numbers {
	position: static !important;
	float: none !important;
	margin: 0 !important;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

/* ── L246c: long brand/category names must not push badges out of the card ── */
.filter-card { overflow: hidden; }
.brand-item, .cat-item { min-width: 0; }
.brand-item .brand-name,
.cat-item .cat-name {
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
	min-width: 0;
	flex: 1 1 auto;
}
.brand-badge, .cat-count { flex-shrink: 0; }
.brand-check { flex-shrink: 0; }

/* ── L246d: price inputs must shrink inside the flex row ── */
.price-inputs input {
	flex: 1 1 0;
	min-width: 0;
	width: auto;
	max-width: 100%;
}
.price-inputs span { flex-shrink: 0; }
