/**
 * WooCommerce 产品筛选器样式 - 横向布局
 */

/* ==================== 分类页容器 ==================== */
.woocommerce-archive-wrapper {
	width: 100%;
	margin: 0 auto;
}

/* ==================== 顶部筛选器区域 ==================== */
.product-filter-top {
	width: 100%;
	margin-bottom: 30px;
}

.product-filters-horizontal {
	background: transparent;
	border-radius: 0;
	padding: 25px 0;
	box-shadow: none;
	position: relative;
}

/* 重置按钮放在右上角 */
.filter-actions-top {
	position: absolute;
	top: 0;
	right: 0;
	z-index: 10;
}

.filter-actions-top .filter-reset-btn {
	padding: 8px 20px;
	background: #ff6b35;
	color: #fff;
	border: none;
	border-radius: 6px;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.3s ease;
}

.filter-actions-top .filter-reset-btn:hover {
	background: #e55a2b;
	transform: translateY(-1px);
	box-shadow: 0 2px 8px rgba(255, 107, 53, 0.3);
}

.product-archive-container {
	width: 100%;
}

/* ==================== 手机端切换按钮 ==================== */
.filter-toggle-mobile {
	display: none;
	width: 100%;
	padding: 12px 20px;
	background: #ff6b35;
	color: #fff;
	border: none;
	border-radius: 8px;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	margin-bottom: 15px;
	align-items: center;
	justify-content: space-between;
	transition: background 0.3s ease;
}

.filter-toggle-mobile:hover {
	background: #e55a2b;
}

.filter-toggle-icon {
	transition: transform 0.3s ease;
	font-size: 14px;
}

.product-filters-horizontal.collapsed .filter-toggle-icon {
	transform: rotate(180deg);
}

.product-filters-horizontal.collapsed .product-filters-content {
	display: none;
}

.product-filters-horizontal.collapsed .filter-actions-top {
	display: none;
}

/* ==================== 筛选组 - 左右布局 ==================== */
.filter-group {
	display: flex;
	align-items: center;
	margin-bottom: 15px;
	padding-bottom: 15px;
	border-bottom: 1px solid #e0e0e0;
	gap: 20px;
}

.filter-group:last-child {
	margin-bottom: 0;
	border-bottom: none;
	padding-bottom: 0;
}

/* 品牌筛选组特殊布局 */
.brand-filter-group {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 15px;
}

.brand-filter-group .filter-group-title {
	width: auto;
}

.filter-group-title {
	flex-shrink: 0;
	width: 140px;  /* 固定宽度确保对齐 */
	font-size: 14px;
	font-weight: 700;
	color: #333;
	text-transform: uppercase;
	letter-spacing: 0.5px;
	margin: 0;
}

/* ==================== 筛选选项 - 横向排列 ==================== */
.filter-options-horizontal {
	display: flex;
	flex-wrap: wrap;
	gap: 15px;
	flex: 1;
}

.filter-option-btn {
	display: inline-flex !important;
	align-items: center;
	justify-content: center;
	padding: 4px 12px !important;
	margin: 0 !important;
	margin-bottom: 0 !important;
	background: transparent;
	border: none;
	cursor: pointer;
	transition: all 0.2s ease;
	user-select: none;
}

.filter-option-btn:hover {
	color: #ff6b35;
	background: rgba(255, 107, 53, 0.1);
}

.filter-option-btn.active {
	color: #fff;
	background: #ff6b35;
	font-weight: 600;
}

/* 隐藏原生单选按钮 */
.filter-option-btn input[type="radio"] {
	display: none;
}

.filter-option-btn .filter-label {
	font-size: 14px;
	font-weight: 400;
	white-space: nowrap;
}

.filter-option-btn.active .filter-label {
	color: #fff;
	font-weight: 600;
}

/* ==================== 品牌筛选 - 字母索引 ==================== */
/* 品牌筛选组 - 左右布局（和普通属性一致） */
.brand-filter-group {
	display: flex;
	align-items: flex-start;
	margin-bottom: 15px;
	gap: 20px;
}

.brand-filter-group .filter-group-title {
	width: 120px;
	flex-shrink: 0;
	text-align: left;
	padding-top: 4px;
}

.brand-filter-container {
	flex: 1;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

/* 字母导航 */
.brand-alphabet-nav {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.brand-letter-btn {
	padding: 4px 10px;
	background: transparent;
	border: none;
	cursor: pointer;
	font-size: 14px;
	font-weight: 500;
	color: #666;
	transition: all 0.2s ease;
}

.brand-letter-btn:hover:not(.disabled) {
	color: #ff6b35;
	background: rgba(255, 107, 53, 0.1);
}

.brand-letter-btn.active {
	color: #fff;
	background: #ff6b35;
	font-weight: 600;
}

.brand-letter-btn.disabled {
	color: #ccc;
	cursor: not-allowed;
	opacity: 0.5;
}

/* 品牌列表容器 */
.brand-list-container {
	position: relative;
	min-height: 0;
	transition: min-height 0.3s ease;
}

.brand-list-container.has-active-list {
	min-height: 100px;
}

.brand-list {
	display: none;
	grid-template-columns: repeat(auto-fill, minmax(60px, 1fr));
	gap: 15px;
	animation: slideDown 0.3s ease;
}

.brand-list.active {
	display: grid;
}

@keyframes slideDown {
	from {
		opacity: 0;
		transform: translateY(-10px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* ==================== 图片筛选样式 ==================== */
.filter-group-with-images .filter-options-grid {
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
	gap: 15px !important;
}

.filter-option-image-wrapper {
	position: relative;
	width: 100%;
	height: auto;
	margin-bottom: 8px;
	border: none;
	border-radius: 0;
	overflow: hidden;
	background: transparent;
	display: flex;
	align-items: center;
	justify-content: center;
	transition: none;
}

.filter-option-image {
	width: 100%;
	height: auto;
	object-fit: contain;
	transition: opacity 0.3s ease;
	display: block;
}

.filter-option-hover-image {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: auto;
	object-fit: contain;
	opacity: 0;
	transition: opacity 0.3s ease;
}

/* 悬停时显示悬停图 */
.filter-option-btn:hover .filter-option-hover-image {
	opacity: 1;
}

/* 选中时也显示悬停图 */
.filter-option-btn.active .filter-option-hover-image {
	opacity: 1;
}

.filter-option-image-placeholder {
	width: 100%;
	height: 100px;
	display: flex;
	align-items: center;
	justify-content: center;
	font-size: 14px;
	font-weight: 600;
	color: #999;
	background: linear-gradient(135deg, #f5f5f5 0%, #e0e0e0 100%);
	text-transform: uppercase;
	border-radius: 8px;
}

.filter-group-with-images .filter-option-btn {
	flex-direction: column !important;
	align-items: center;
	text-align: center;
	padding: 8px !important;
	background: transparent !important;
	border: none !important;
}

/* 图片模式：悬停和选中都不显示背景和边框 */
.filter-group-with-images .filter-option-btn.active,
.filter-group-with-images .filter-option-btn:hover {
	background: transparent !important;
	border: none !important;
	box-shadow: none !important;
	transform: none !important;
	color: inherit !important; /* 保持文字原色 */
}

.filter-group-with-images .filter-label {
	font-size: 12px;
	line-height: 1.3;
	word-wrap: break-word;
	color: #333 !important; /* 确保文字始终为深色 */
}

/* ==================== 多选样式（复选框） ==================== */
.filter-group[data-allow-multiple="true"] .filter-option-btn input[type="checkbox"] {
	position: relative;
	width: 16px;
	height: 16px;
	margin-right: 6px;
	cursor: pointer;
}

/* 多选模式：选中后只改变字体颜色，不显示背景 */
.filter-group[data-allow-multiple="true"] .filter-option-btn.active {
	background: transparent !important;
}

.filter-group[data-allow-multiple="true"] .filter-option-btn.active .filter-label {
	color: #ff6b35 !important;
	font-weight: 600;
}

/* 多选模式：悬停效果也只改变字体颜色 */
.filter-group[data-allow-multiple="true"] .filter-option-btn:hover {
	background: transparent !important;
}

.filter-group[data-allow-multiple="true"] .filter-option-btn:hover .filter-label {
	color: #ff6b35 !important;
}

/* 品牌项 */
.brand-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
	padding: 10px;
	cursor: pointer;
	transition: all 0.2s ease;
	text-align: center;
}

.brand-item:hover {
	background: rgba(255, 107, 53, 0.05);
	border-radius: 8px;
}

.brand-item input[type="radio"] {
	display: none;
}

.brand-item input[type="radio"]:checked + .brand-icon {
	border-color: #ff6b35;
	background: rgba(255, 107, 53, 0.1);
}

.brand-item input[type="radio"]:checked ~ .brand-name {
	color: #ff6b35;
	font-weight: 600;
}

/* 品牌图标 */
.brand-icon {
	width: 28px;
	height: 28px;
	border-radius: 4px;
	border: 2px solid #e0e0e0;
	overflow: hidden;
	display: flex;
	align-items: center;
	justify-content: center;
	background: #fff;
	transition: all 0.2s ease;
}

.brand-icon img {
	width: 100%;
	height: 100%;
	object-fit: contain;
}

.brand-icon-placeholder {
	font-size: 14px;
	font-weight: 700;
	color: #999;
}

/* 品牌名称 */
.brand-name {
	font-size: 11px;
	color: #333;
	line-height: 1.2;
	word-break: break-word;
	transition: all 0.2s ease;
}


/* ==================== 产品列表主内容 ==================== */
.product-archive-main {
	width: 100%;
}

/* WooCommerce 产品列表 */
.woocommerce ul.products {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 20px;
	margin: 0;
	padding: 0;
	list-style: none;
}

.woocommerce ul.products li.product {
	margin: 0;
	padding: 0;
	width: 100%;
	min-width: 0;
}

/* 加载状态 */
.product-archive-main.loading {
	opacity: 0.5;
	pointer-events: none;
	position: relative;
}

.product-archive-main.loading::after {
	content: '';
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 50px;
	height: 50px;
	border: 4px solid #f3f3f3;
	border-top: 4px solid #ff6b35;
	border-radius: 50%;
	animation: spin 1s linear infinite;
}

@keyframes spin {
	0% { transform: translate(-50%, -50%) rotate(0deg); }
	100% { transform: translate(-50%, -50%) rotate(360deg); }
}

/* 无产品消息 */
.no-products-found {
	text-align: center;
	padding: 60px 20px;
	font-size: 18px;
	color: #999;
	background: #f8f9fa;
	border-radius: 12px;
}

/* ==================== 响应式 - 大屏 ==================== */
@media (min-width: 1400px) {
	.woocommerce ul.products {
		grid-template-columns: repeat(3, 1fr);
	}
}

/* ==================== 响应式 - 平板 ==================== */
@media (max-width: 1024px) {
	.product-filters-horizontal {
		padding: 20px 0;
	}
	
	.filter-actions-top {
		top: 0;
		right: 0;
	}
	
	.filter-group,
	.brand-filter-group {
		gap: 15px;
	}
	
	.filter-group-title,
	.brand-filter-group .filter-group-title {
		width: 100px;
		font-size: 13px;
	}
	
	.filter-options-horizontal {
		gap: 12px;
	}
	
	.filter-option-btn {
		padding: 3px 6px !important;
		margin: 0 !important;
	}
	
	.filter-option-btn .filter-label {
		font-size: 13px;
	}
	
	.woocommerce ul.products {
		grid-template-columns: repeat(2, 1fr);
		gap: 15px;
	}
}

/* ==================== 响应式 - 手机 ==================== */
@media (max-width: 768px) {
	.woocommerce-archive-wrapper {
		padding: 15px 10px;
	}
	
	.product-filter-top {
		margin-bottom: 20px;
	}
	
	.product-filters-horizontal {
		padding: 15px 0;
	}
	
	/* 显示手机端切换按钮 */
	.filter-toggle-mobile {
		display: flex;
	}
	
	.filter-actions-top {
		position: static;
		margin-top: 15px;
		padding-top: 15px;
		border-top: 1px solid #e0e0e0;
	}
	
	.filter-actions-top .filter-reset-btn {
		width: 100%;
		padding: 10px 20px;
	}
	
	/* 手机端筛选组改为纵向布局 */
	.filter-group,
	.brand-filter-group {
		flex-direction: column;
		align-items: flex-start;
		gap: 10px;
		margin-bottom: 15px;
		padding-bottom: 15px;
	}
	
	.filter-group-title,
	.brand-filter-group .filter-group-title {
		width: auto;
		font-size: 13px;
	}
	
	.filter-options-horizontal {
		gap: 6px;  /* 减小间距 */
	}
	
	/* 品牌字母导航 */
	.brand-alphabet-nav {
		gap: 5px;  /* 减小间距 */
	}
	
	.brand-letter-btn {
		padding: 5px 10px;  /* 稍微增加内边距 */
		font-size: 14px;  /* 增大字体 */
	}
	
	/* 品牌名称 */
	.brand-name {
		font-size: 12px;  /* 增大字体 */
	}
	
	/* 手机端图片筛选 - 横向滚动 */
	.filter-group-with-images .filter-options-grid {
		display: flex !important;
		flex-wrap: nowrap !important;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scroll-behavior: smooth;
		padding-bottom: 10px;
		gap: 12px !important;
	}
	
	.filter-group-with-images .filter-option-btn {
		flex-shrink: 0;
		min-width: 80px;
		max-width: 100px;
	}
	
	/* 手机端品牌列表 - 横向滚动 */
	.brand-list.active {
		display: flex !important;
		flex-wrap: nowrap !important;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scroll-behavior: smooth;
		padding-bottom: 10px;
		gap: 12px !important;
	}
	
	.brand-list.active .brand-item {
		flex-shrink: 0;
		min-width: 60px;
	}
	
	/* 滚动条样式 */
	.filter-group-with-images .filter-options-grid::-webkit-scrollbar,
	.brand-list.active::-webkit-scrollbar {
		height: 4px;
	}
	
	.filter-group-with-images .filter-options-grid::-webkit-scrollbar-track,
	.brand-list.active::-webkit-scrollbar-track {
		background: #f0f0f0;
		border-radius: 2px;
	}
	
	.filter-group-with-images .filter-options-grid::-webkit-scrollbar-thumb,
	.brand-list.active::-webkit-scrollbar-thumb {
		background: #ccc;
		border-radius: 2px;
	}
	
	.filter-group-with-images .filter-options-grid::-webkit-scrollbar-thumb:hover,
	.brand-list.active::-webkit-scrollbar-thumb:hover {
		background: #999;
	}
	
	.filter-option-btn {
		padding: 4px 8px !important;  /* 增加内边距，让按钮不那么拥挤 */
		margin: 0 !important;
	}
	
	.filter-option-btn .filter-label {
		font-size: 14px;  /* 增大字体 */
	}
	
	.woocommerce ul.products {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}
}

/* ==================== 响应式 - 小屏手机 ==================== */
@media (max-width: 480px) {
	.woocommerce-archive-wrapper {
		padding: 12px 8px;
	}
	
	.product-filters-horizontal {
		padding: 12px 0;
	}
	
	.filter-toggle-mobile {
		padding: 10px 15px;
		font-size: 14px;
	}
	
	.filter-group-title {
		font-size: 12px;
	}
	
	.filter-options-horizontal {
		gap: 5px;  /* 减小间距 */
	}
	
	/* 品牌字母导航 */
	.brand-alphabet-nav {
		gap: 4px;  /* 减小间距 */
	}
	
	.brand-letter-btn {
		padding: 4px 8px;  /* 稍微调整内边距 */
		font-size: 13px;  /* 调整字体 */
	}
	
	/* 小屏手机端图片筛选 - 横向滚动 */
	.filter-group-with-images .filter-options-grid {
		display: flex !important;
		flex-wrap: nowrap !important;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scroll-behavior: smooth;
		padding-bottom: 8px;
		gap: 10px !important;
	}
	
	.filter-group-with-images .filter-option-btn {
		flex-shrink: 0;
		min-width: 70px;
		max-width: 90px;
	}
	
	/* 小屏手机端品牌列表 - 横向滚动 */
	.brand-list.active {
		display: flex !important;
		flex-wrap: nowrap !important;
		overflow-x: auto;
		overflow-y: hidden;
		-webkit-overflow-scrolling: touch;
		scroll-behavior: smooth;
		padding-bottom: 8px;
		gap: 10px !important;
	}
	
	.brand-list.active .brand-item {
		flex-shrink: 0;
		min-width: 55px;
	}
	
	.filter-option-btn {
		padding: 4px 7px !important;  /* 稍微增加内边距 */
		margin: 0 !important;
	}
	
	.filter-option-btn .filter-label {
		font-size: 13px;  /* 增大字体 */
	}
	
	.woocommerce ul.products {
		grid-template-columns: repeat(2, 1fr);
		gap: 10px;
	}
}

/* ==================== WooCommerce 排序和结果计数调整 ==================== */
.woocommerce-notices-wrapper {
	margin-bottom: 20px;
}

.woocommerce-result-count {
	font-size: 14px;
	color: #666;
}

.woocommerce-ordering {
	margin-bottom: 20px;
}

/* ==================== 动画效果 ==================== */
.filter-option,
.filter-reset-btn {
	transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.product-archive-main {
	transition: opacity 0.3s ease;
}

