/**
 * Product Archive Page Styles
 * 
 * 产品归档页样式
 * 包含：产品卡片、筛选器、分页等
 * 
 * @package Kadence_Child
 * @since 1.0.0
 */

/* ========================================
   Archive Page Container
   ======================================== */

/**
 * 分类页面容器背景色
 */
.product-archive-content {
	background-color: #ffffff;
}

/* ========================================
   Breadcrumb Navigation
   ======================================== */

/**
 * 面包屑导航样式
 * 横向排列，使用分隔符分隔
 * 位于产品卡片区域上方
 */
.breadcrumb-nav {
	padding-bottom: 1rem;
	margin-bottom: 0;
}

.product-archive-main > .breadcrumb-nav {
	margin-bottom: 1rem;
}

.breadcrumb-list {
	display: flex;
	flex-wrap: wrap;
	align-items: center;
	list-style: none;
	margin: 0;
	padding: 0;
	font-size: 0.875rem; /* 14px */
	line-height: 1.6;
}

.breadcrumb-item {
	display: flex;
	align-items: center;
	margin: 0;
	padding: 0;
}

/* 分隔符 - 在每个项目后添加（除了最后一个） */
.breadcrumb-item:not(:last-child)::after {
	content: '/';
	margin: 0 0.5rem;
	color: #999;
	font-weight: normal;
}

.breadcrumb-item a {
	color: #0073aa;
	text-decoration: none;
	transition: color 0.3s ease;
}

.breadcrumb-item a:hover,
.breadcrumb-item a:focus {
	color: #005177;
	text-decoration: none; /* 悬停时无下划线 */
}

/* 当前页项目 - 不显示链接，使用深色文字 */
.breadcrumb-item.breadcrumb-current {
	color: #333;
	font-weight: 500;
}

.breadcrumb-item.breadcrumb-current a {
	color: #333;
	text-decoration: none;
	cursor: default;
	pointer-events: none;
}

/* ========================================
   Product Card Styles
   ======================================== */

/**
 * 产品卡片样式
 * 显示：缩略图、产品标题、产品描述、详情按钮
 */
.product-card {
	display: flex;
	flex-direction: column;
	background-color: #ffffff;
	border: 1px solid #e5e5e5;
	border-radius: 8px;
	overflow: hidden;
	height: 100%;
}

.product-card__image {
	position: relative;
	width: 100%;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background-color: #f5f5f5;
}

.product-card__image-link {
	display: block;
	width: 100%;
	height: 100%;
	text-decoration: none;
}

.product-card__thumbnail {
	width: 100%;
	height: 100%;
	object-fit: cover;
	object-position: center;
	display: block;
}

.product-card__image--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	background-color: #f0f0f0;
}

.product-card__placeholder-text {
	color: #999;
	font-size: 0.875rem;
}

.product-card__content {
	flex: 1;
	display: flex;
	flex-direction: column;
	padding: 1.25rem;
}

.product-card__title {
	margin: 0 0 0.75rem 0;
	font-size: 0.875rem; /* 14px */
	font-weight: 600;
	line-height: 1.4;
	color: #1a1a1a;
}

.product-card__title-link {
	color: inherit;
	text-decoration: none;
}

.product-card__description {
	margin: 0 0 1rem 0;
	font-size: 0.875rem;
	line-height: 1.6;
	color: #666;
	flex: 1;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	text-overflow: ellipsis;
}

.product-card__actions {
	margin-top: auto;
	padding-top: 1rem;
	text-align: center;
}

.product-card__button {
	display: block;
	width: 100%;
	padding: 0.625rem 1.5rem;
	font-size: 0.875rem;
	font-weight: 500;
	line-height: 1.5;
	color: #ffffff;
	background-color: #ff8c00;
	border-radius: 4px;
	text-decoration: none;
	text-align: center;
}

.product-card__button:hover,
.product-card__button:focus {
	background-color: #e67a00; /* 悬停时背景色变深 */
	color: #ffffff;
	text-decoration: none;
}

/* ========================================
   Archive Layout
   ======================================== */

/**
 * 归档页布局：左侧分类目录 + 右侧产品列表
 */
.product-archive-layout {
	display: flex;
	gap: 2rem;
	width: 100%;
	max-width: 1440px;
	margin: 0 auto;
	padding: 0 1.5rem;
	box-sizing: border-box;
}

/* ========================================
   Category Sidebar Styles
   ======================================== */

/**
 * 分类目录侧边栏样式
 */
.product-category-sidebar {
	flex: 0 0 280px;
	max-width: 280px;
	background-color: #ffffff;
	padding: 1.5rem 0;
	height: fit-content;
	position: sticky;
	top: 2rem;
}

/**
 * 产品搜索表单（侧边栏顶部）
 * 参考设计：图标在输入框内右侧，浅灰边框，无背景色，点击图标可搜索
 */
.product-search-form {
	margin-bottom: 1.25rem;
	padding-bottom: 1.25rem;
	border-bottom: 1px solid #e5e5e5;
}

.product-search-wrap {
	position: relative;
	display: flex;
	align-items: center;
	border: 1px solid #ddd;
	border-radius: 6px;
	background: transparent;
}

.product-search-wrap:focus-within {
	border-color: #bbb;
}

.product-search-input {
	flex: 1;
	min-width: 0;
	padding: 0.5rem 2.5rem 0.5rem 0.75rem;
	font-size: 0.9375rem;
	line-height: 1.5;
	border: none;
	background: transparent;
	transition: border-color 0.2s ease;
}

.product-search-input:focus {
	outline: none;
}

.product-search-input::placeholder {
	color: #999;
}

.product-search-submit {
	position: absolute;
	right: 0;
	top: 0;
	bottom: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.5rem;
	padding: 0;
	background: transparent;
	border: none;
	color: #999;
	cursor: pointer;
}

/* 覆盖全局 button:hover 的 transform: translateY(-1px)，避免图标凸起 */
.product-search-submit:hover,
.product-search-submit:active {
	transform: none;
}

.product-search-icon {
	flex-shrink: 0;
	display: block;
}

.category-sidebar__header {
	display: none; /* 桌面端隐藏（无标题） */
	margin-bottom: 1rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid #e5e5e5;
}

.category-sidebar__toggle {
	display: none; /* 桌面端隐藏 */
	background: none;
	border: none;
	cursor: pointer;
	padding: 0.25rem;
	font-size: 1.25rem;
	color: #666;
	line-height: 1;
	transition: color 0.3s ease;
}

.category-sidebar__toggle:hover {
	color: #1a1a1a;
}

.category-sidebar__toggle-icon {
	display: block;
	width: 1.5rem;
	height: 1.5rem;
	line-height: 1.5rem;
	text-align: center;
	font-weight: bold;
}

.category-sidebar__toggle-icon::before {
	content: "−";
}

.category-list {
	display: block;
}

.category-list__items {
	list-style: none;
	padding: 0;
	margin: 0;
}

.category-list__item {
	margin-bottom: 0.5rem; /* 保留行间距 */
	margin-left: 0;
	margin-right: 0;
}

/* 一级分类行：链接 + 展开按钮（箭头居右） */
.category-list__parent-row {
	display: flex;
	align-items: center;
	gap: 0.25rem;
	justify-content: space-between;
}

.category-list__parent-row .category-list__link {
	flex: 1;
	min-width: 0;
}

/* 展开/收起按钮（有子分类时显示，居右对齐） */
.category-list__expand-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	width: 1.5rem;
	height: 1.5rem;
	padding: 0;
	background: none;
	border: none;
	cursor: pointer;
	color: #666;
	transition: color 0.2s ease, transform 0.2s ease;
	margin-left: auto; /* 箭头居右 */
}

.category-list__expand-btn:hover {
	color: #1a1a1a;
}

.category-list__expand-btn:focus {
	outline: 1px solid #0073aa;
	outline-offset: 2px;
}

.category-list__expand-icon {
	display: block;
	width: 0.5rem;
	height: 0.5rem;
	border-right: 1.5px solid currentColor;
	border-bottom: 1.5px solid currentColor;
	transform: rotate(-45deg);
	transition: transform 0.2s ease;
}

/* 收起状态：箭头朝右 */
.category-list__item--collapsed .category-list__expand-icon {
	transform: rotate(-90deg);
}

/* 展开状态：箭头朝下 */
.category-list__item--expanded .category-list__expand-icon {
	transform: rotate(-45deg);
}

/* 一级分类收起时隐藏二级分类；展开时显示（PC 与移动端通用） */
.category-list__item--collapsed .category-list__subitems {
	display: none;
}

.category-list__item--expanded .category-list__subitems {
	display: block;
}

/* 无子分类时链接占满整行 */
.category-list__item:not(.category-list__item--has-children) .category-list__parent-row {
	display: block;
}

.category-list__link {
	display: block;
	padding: 0.625rem 0.75rem;
	font-size: 0.9375rem;
	line-height: 1.5;
	color: #333;
	text-decoration: none;
	border-radius: 4px;
	border: none;
	border-bottom: none;
	transition: background-color 0.3s ease, color 0.3s ease;
}

.category-list__link:hover {
	text-decoration: none;
}

.category-list__link--heading {
	font-weight: 700;
	color: #1A2534;
	font-size: 1rem;
}

.category-list__link--active {
	font-weight: 700;
}

.category-list__link--active:hover {
	text-decoration: none;
}

.category-list__count {
	font-size: 0.875rem;
	color: #999;
	margin-left: 0.25rem;
}

.category-list__subitems {
	list-style: none;
	padding: 0;
	margin: 0 0 0 1rem;
}

.category-list__subitem {
	margin-bottom: 0.375rem; /* 保留行间距 */
	margin-left: 0;
	margin-right: 0;
}

.category-list__sublink {
	display: block;
	padding: 0.5rem 0.75rem;
	font-size: 0.875rem;
	line-height: 1.5;
	color: #666;
	text-decoration: none;
	border-radius: 4px;
	border: none;
	border-bottom: none;
	transition: background-color 0.3s ease, color 0.3s ease;
}

.category-list__sublink:hover {
	text-decoration: none;
}

.category-list__sublink--active {
	font-weight: 700;
}

.category-list__sublink--active:hover {
	text-decoration: none;
}

/* ========================================
   Page Header Styles
   ======================================== */

/**
 * 分类页面头部样式
 * 全屏宽度，移出内容容器
 */
.product-archive-header {
	background-color: #192333;
	padding: 2rem 1.5rem;
	text-align: center;
	width: 100%;
	box-sizing: border-box;
}

.product-archive-header .page-title {
	margin: 0 0 1rem 0;
	text-align: center;
	color: #ff8c00;
}

.product-archive-header .archive-description {
	text-align: center;
	margin: 0 auto;
	max-width: 1440px;
	color: #ffffff;
}

/* ========================================
   Product Archive Main Content
   ======================================== */

.product-archive-main {
	flex: 1;
	min-width: 0;
	padding-top: 1.5rem; /* 与侧边栏顶部对齐（搜索框） */
}

/* ========================================
   Pagination Styles
   ======================================== */

.product-pagination {
	margin-top: 2rem;
	padding-top: 2rem;
	border-top: 1px solid #e5e5e5;
}

.product-pagination .page-numbers {
	display: flex;
	flex-wrap: wrap;
	justify-content: center;
	align-items: center;
	gap: 0.5rem;
	list-style: none;
	padding: 0;
	margin: 0;
}

.product-pagination .page-numbers li {
	margin: 0;
}

.product-pagination .page-numbers a,
.product-pagination .page-numbers span {
	display: inline-block;
	padding: 0.5rem 0.875rem;
	font-size: 0.875rem;
	line-height: 1.5;
	color: #333;
	text-decoration: none;
	border: 1px solid #e5e5e5;
	border-radius: 4px;
	transition: background-color 0.3s ease, color 0.3s ease, border-color 0.3s ease;
}

.product-pagination .page-numbers a:hover {
	background-color: #f9f9f9;
	color: #003d82;
	border-color: #003d82;
}

.product-pagination .page-numbers .current {
	background-color: #003d82;
	color: #ffffff;
	border-color: #003d82;
	font-weight: 500;
}

.product-pagination .page-numbers .dots {
	border: none;
	cursor: default;
}

.product-pagination .page-numbers .dots:hover {
	background-color: transparent;
	color: #333;
}

/* ========================================
   Product Grid Layout
   ======================================== */

.product-grid {
	display: grid;
	grid-template-columns: repeat(4, 1fr); /* 四列布局 */
	gap: 1.5rem;
	width: 100%;
}

/* ========================================
   Responsive: Product Archive
   ======================================== */

/**
 * 平板设备（768px - 1023px）
 */
@media screen and (min-width: 768px) and (max-width: 1023px) {
	.product-archive-layout {
		gap: 1.5rem;
		padding: 0 1rem;
	}
	
	.product-category-sidebar {
		flex: 0 0 240px;
		max-width: 240px;
		padding: 1.25rem 0;
	}
	
	.product-archive-main {
		padding-top: 1.25rem;
	}
	
	.product-grid {
		grid-template-columns: repeat(3, 1fr); /* 三列布局 */
		gap: 1.25rem;
	}
	
	.product-card__content {
		padding: 1rem;
	}
	
	.product-card__title {
		font-size: 1rem;
	}
}

/**
 * 手机设备（最大 767px）
 */
@media screen and (max-width: 767px) {
	.breadcrumb-nav {
		padding-bottom: 0.75rem;
	}
	
	.breadcrumb-list {
		font-size: 0.8125rem; /* 13px */
	}
	
	.breadcrumb-item:not(:last-child)::after {
		margin: 0 0.375rem;
	}
	
	.product-archive-header {
		padding: 1.5rem 1rem;
	}
	
	.product-archive-layout {
		flex-direction: column;
		gap: 1rem;
		padding: 0 1rem;
	}
	
	.product-category-sidebar {
		flex: 0 0 auto;
		max-width: 100%;
		position: relative;
		top: 0;
		padding: 1rem 0;
		border-radius: 8px;
	}
	
	.category-sidebar__header {
		display: flex;
		justify-content: flex-end;
		align-items: center;
	}
	
	.category-sidebar__toggle {
		display: block; /* 手机端显示切换按钮 */
	}
	
	.category-list {
		display: none; /* 默认收缩 */
	}
	
	.category-list.category-list--expanded {
		display: block;
	}
	
	.category-sidebar__toggle[aria-expanded="true"] .category-sidebar__toggle-icon::before {
		content: "−";
	}
	
	.category-sidebar__toggle[aria-expanded="false"] .category-sidebar__toggle-icon::before {
		content: "+";
	}
	
	.category-list.category-list--expanded {
		display: block;
	}
	
	.product-archive-main {
		width: 100%;
		padding-top: 1rem;
	}
	
	.product-grid {
		grid-template-columns: repeat(2, 1fr); /* 两列布局 */
		gap: 1rem;
	}
	
	.product-card__content {
		padding: 1rem;
	}
	
	.product-card__title {
		font-size: 1rem;
		margin-bottom: 0.5rem;
	}
	
	.product-card__description {
		font-size: 0.8125rem;
		margin-bottom: 0.75rem;
	}
	
	.product-card__button {
		padding: 0.5rem 1.25rem;
		font-size: 0.8125rem;
		width: 100%;
	}
}

/**
 * 小屏手机设备（最大 480px）
 */
@media screen and (max-width: 480px) {
	.breadcrumb-nav {
		padding-bottom: 0.625rem;
	}
	
	.breadcrumb-list {
		font-size: 0.75rem; /* 12px */
		line-height: 1.5;
	}
	
	.product-archive-header {
		padding: 1.25rem 0.75rem;
	}
	
	.product-archive-layout {
		padding: 0 0.75rem;
	}
	
	.product-category-sidebar {
		padding: 0.875rem 0;
	}
	
	.product-archive-main {
		padding-top: 0.875rem;
	}
	
	.product-grid {
		grid-template-columns: 1fr; /* 单列布局 */
		gap: 0.875rem;
	}
	
	.product-card__content {
		padding: 0.875rem;
	}
	
	.product-card__title {
		font-size: 0.9375rem;
	}
	
	.product-card__description {
		font-size: 0.75rem;
	}
}
