/**
 * Archive/Category Product Page Styles - Sidebar layout
 *
 * @package UnDetalle
 * @since 1.1.0
 */

:root {
	--undetalle-primary: #EC5970;
	--undetalle-primary-hover: #e94562;
	--undetalle-primary-dark: #d63851;
	--undetalle-text: #2a2a2a;
	--undetalle-text-light: #666;
	--undetalle-text-muted: #9c9c9c;
	--undetalle-border: #e6e6e6;
	--undetalle-bg-light: #f9f9f9;
	--undetalle-white: #ffffff;
	--undetalle-shadow: 0 18px 45px rgba(23, 26, 31, 0.08);
}

/* ========================================
   BANNER FULL WIDTH
   ======================================== */
.category-banner-fullwidth {
	width: 100%;
	height: 350px;
	border-radius: 0 0 26px 26px;
	background-size: cover;
	background-position: center;
	position: relative;
	overflow: hidden;
	box-shadow: var(--undetalle-shadow);
	display: flex;
	align-items: flex-end;
	padding: 0;
	margin-top: -130px;
}

.category-banner-fullwidth::after {
	content: "";
	position: absolute;
	inset: 0;
	background: linear-gradient(155deg, rgba(0, 0, 0, 0.7) 0%, rgba(0, 0, 0, 0.25) 70%);
}

.category-banner-fullwidth .banner-content-inner {
	color: #fff;
	z-index: 2;
	width: 100%;
	/* max-width inyectado dinámicamente desde functions.php */
	margin: 0 auto;
	padding: 50px 20px;
	position: relative;
}

.category-banner-fullwidth h1 {
	margin: 0;
	font-size: clamp(2.5rem, 6vw, 4.375rem);
	letter-spacing: 1px;
	text-transform: uppercase;
	color: #ffffff;
}

.category-banner-fullwidth .category-description {
	margin-top: 10px;
	font-size: 1.1rem;
	max-width: 480px;
}

.category-banner-fullwidth .banner-breadcrumb {
	margin-bottom: 10px;
	font-size: 0.95rem;
	text-transform: uppercase;
	letter-spacing: 0.2em;
	color: rgba(255, 255, 255, 0.9);
}

.category-banner-fullwidth .banner-breadcrumb .woocommerce-breadcrumb {
	color: rgba(255, 255, 255, 0.9);
}

.category-banner-fullwidth .banner-breadcrumb a {
	color: rgba(255, 255, 255, 0.95);
	text-decoration: none;
	transition: all 0.2s ease;
	display: inline-block;
	font-weight: 500;
}

.category-banner-fullwidth .banner-breadcrumb a:hover {
	color: #ffffff;
	text-decoration: underline;
	text-underline-offset: 3px;
}

.category-banner-fullwidth .banner-breadcrumb span {
	color: #fff;
	font-weight: 600;
}

.category-banner-fullwidth.no-image {
	background: linear-gradient(135deg, #f0526c 0%, #ff8db0 100%);
}

/* ========================================
   CONTENEDOR CON ANCHO MÁXIMO
   (El ancho máximo se inyecta dinámicamente desde functions.php)
   ======================================== */
.archive-product-wrapper {
	margin: 0 auto;
	padding: 0 20px 80px;
}

.page-title {
	font-size: 3rem;
	font-weight: 700;
	margin-bottom: 25px;
	color: var(--undetalle-text);
}

.archive-page-top {
	display: flex;
	align-items: center;
	justify-content: flex-end;
	gap: 20px;
	margin-bottom: 30px;
}

.archive-breadcrumb {
	font-size: 0.95rem;
	color: var(--undetalle-text-muted);
}

.archive-breadcrumb a {
	color: inherit;
	text-decoration: none;
	position: relative;
	padding-right: 12px;
	margin-right: 12px;
}

.archive-breadcrumb a::after {
	content: "/";
	position: absolute;
	right: 0;
	top: 0;
	color: var(--undetalle-text-muted);
}

.archive-breadcrumb span {
	color: var(--undetalle-primary);
	font-weight: 600;
}

.archive-sidebar-toggle {
	display: none;
	align-items: center;
	gap: 6px;
	padding: 10px 20px;
	border-radius: 999px;
	border: 1px solid var(--undetalle-border);
	background: var(--undetalle-white);
	color: var(--undetalle-text);
	font-weight: 600;
	cursor: pointer;
	transition: all 0.25s ease;
}

.archive-sidebar-toggle:hover {
	border-color: var(--undetalle-primary);
	color: var(--undetalle-primary);
	box-shadow: 0 12px 25px rgba(236, 89, 112, 0.15);
}

.archive-layout {
	display: grid;
	grid-template-columns: 320px minmax(0, 1fr);
	gap: 40px;
	align-items: start;
}

.archive-sidebar {
	background: var(--undetalle-white);
	border-radius: 24px;
	padding: 28px 26px;
	box-shadow: var(--undetalle-shadow);
	position: sticky;
	top: 120px;
	height: fit-content;
}

.archive-sidebar-close {
	display: none;
	position: absolute;
	top: 18px;
	right: 18px;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--undetalle-bg-light);
	border: none;
	cursor: pointer;
	font-size: 1.5rem;
	line-height: 1;
}

.sidebar-card + .sidebar-card {
	margin-top: 28px;
	border-top: 1px solid var(--undetalle-border);
	padding-top: 28px;
}

.sidebar-card {
	position: relative;
}

.sidebar-card-header h3 {
	margin: 0 0 18px 0;
	font-size: 1.1rem;
	color: var(--undetalle-text);
}

.price-range {
	position: relative;
	margin-bottom: 20px;
}

.price-range-track {
	height: 6px;
	background: #ececec;
	border-radius: 999px;
	position: relative;
}

.price-range-progress {
	position: absolute;
	height: 100%;
	left: 0;
	right: 0;
	border-radius: 999px;
	background: linear-gradient(135deg, #EC5970 0%, #e94562 100%);
}

.range-inputs {
	position: relative;
	margin-top: 18px;
	height: 30px;
}

.range-inputs input[type="range"] {
	position: absolute;
	width: 100%;
	height: 4px;
	-webkit-appearance: none;
	background: none;
	pointer-events: none;
}

.range-inputs input[type="range"]::-webkit-slider-thumb {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--undetalle-white);
	border: 3px solid var(--undetalle-primary);
	box-shadow: 0 6px 12px rgba(236, 89, 112, 0.2);
	pointer-events: auto;
	-webkit-appearance: none;
}

.range-inputs input[type="range"]::-moz-range-thumb {
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--undetalle-white);
	border: 3px solid var(--undetalle-primary);
	box-shadow: 0 6px 12px rgba(236, 89, 112, 0.2);
	pointer-events: auto;
}

.price-values {
	display: flex;
	gap: 16px;
}

.price-input {
	flex: 1;
}

.price-input label {
	display: block;
	font-size: 0.85rem;
	color: var(--undetalle-text-muted);
	margin-bottom: 6px;
}

.price-input-field {
	display: flex;
	align-items: center;
	border: 1px solid var(--undetalle-border);
	border-radius: 14px;
	background: var(--undetalle-bg-light);
	padding: 6px 12px;
	gap: 6px;
}

.price-input-field span {
	color: var(--undetalle-text-muted);
	font-weight: 600;
}

.price-input-field input {
	border: none;
	background: transparent;
	width: 100%;
	font-weight: 600;
	color: var(--undetalle-text);
}

.price-input-field input:focus {
	outline: none;
}

.sidebar-actions {
	display: flex;
	gap: 12px;
	margin-top: 20px;
}

.sidebar-card .button {
	flex: 0.5;
	padding: 12px !important;
	border-radius: 999px;
	border: none;
	font-weight: 600;
	cursor: pointer;
	transition: all 0.25s ease;
}

.sidebar-card .button-primary {
	background: linear-gradient(135deg, #EC5970 0%, #e94562 100%);
	color: #fff;
	box-shadow: 0 12px 25px rgba(236, 89, 112, 0.25);
}

.sidebar-card .button-primary:hover {
	transform: translateY(-2px);
	box-shadow: 0 16px 30px rgba(236, 89, 112, 0.35);
}

.button-link {
	background: transparent;
	color: var(--undetalle-text);
	border: 1px solid var(--undetalle-border);
	flex: 0.5;
}

.category-list ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

/* ========================================
   CATEGORÍAS CON ACORDEÓN (PADRE-HIJO)
   ======================================== */
.category-accordion-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.category-parent-item {
	border-radius: 14px;
	overflow: hidden;
	transition: all 0.25s ease;
}

.category-parent {
	display: flex;
	align-items: stretch;
	gap: 0;
	background: var(--undetalle-bg-light);
	border: 1px solid transparent;
	border-radius: 14px;
	transition: all 0.2s ease;
	overflow: hidden;
}

.category-parent-link {
	flex: 1;
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 14px;
	text-decoration: none;
	color: var(--undetalle-text);
	font-weight: 600;
	font-size: 0.95rem;
	transition: all 0.2s ease;
	min-width: 0;
}

.category-parent-link:hover,
.category-parent-link.active {
	color: var(--undetalle-primary);
}

.category-parent-link.active {
	background: #fff0f3;
}

.category-parent:has(.category-parent-link.active) {
	border-color: var(--undetalle-primary);
}

.category-parent-item.no-children .category-parent-link {
	border-radius: 14px;
}

.category-toggle {
	flex-shrink: 0;
	width: 44px;
	display: flex;
	align-items: center;
	justify-content: center;
	background: transparent;
	border: none;
	border-left: 1px solid rgba(0, 0, 0, 0.08);
	cursor: pointer;
	color: var(--undetalle-text-muted);
	transition: all 0.3s ease;
	padding: 0;
}

.category-toggle:hover {
	background: rgba(236, 89, 112, 0.1);
	color: var(--undetalle-primary);
}

.category-toggle svg {
	transition: transform 0.3s ease;
}

.category-parent-item.expanded .category-toggle svg {
	transform: rotate(180deg);
}

.category-children {
	list-style: none;
	margin: 0;
	padding: 0;
	max-height: 0;
	overflow: hidden;
	opacity: 0;
	transition: max-height 0.4s cubic-bezier(0.4, 0, 0.2, 1), 
				opacity 0.3s ease,
				padding 0.3s ease;
}

.category-parent-item.expanded .category-children {
	max-height: 1000px; /* Altura suficiente para todas las subcategorías */
	opacity: 1;
	padding: 8px 0 8px 14px;
}

.category-children li {
	margin-bottom: 6px;
}

.category-children li:last-child {
	margin-bottom: 0;
}

.category-children li a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	border-radius: 12px;
	text-decoration: none;
	color: var(--undetalle-text);
	font-weight: 500;
	font-size: 0.9rem;
	transition: all 0.2s ease;
	background: var(--undetalle-white);
	border: 1px solid var(--undetalle-border);
	position: relative;
	padding-left: 28px;
}

.category-children li a::before {
	content: "└";
	position: absolute;
	left: 10px;
	color: var(--undetalle-text-muted);
	font-size: 0.8rem;
}

.category-children li.active a,
.category-children li a:hover {
	border-color: var(--undetalle-primary);
	color: var(--undetalle-primary);
	background: #fff0f3;
	padding-left: 32px;
}

.category-children li.active a::before,
.category-children li a:hover::before {
	color: var(--undetalle-primary);
	font-weight: 700;
}

.category-name {
	flex: 1;
}

.category-count {
	font-size: 0.8rem;
	color: var(--undetalle-text-muted);
	font-weight: 600;
	background: rgba(0, 0, 0, 0.05);
	padding: 2px 8px;
	border-radius: 999px;
	min-width: 28px;
	text-align: center;
}

.category-parent-link.active .category-count,
.category-children li.active a .category-count {
	background: rgba(236, 89, 112, 0.15);
	color: var(--undetalle-primary);
}

/* Versión antigua (backup para categorías sin jerarquía) */
.category-list:not(.category-accordion) ul {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.category-list:not(.category-accordion) li a {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 10px 14px;
	border-radius: 14px;
	border: 1px solid transparent;
	text-decoration: none;
	color: var(--undetalle-text);
	font-weight: 500;
	transition: all 0.2s ease;
	background: var(--undetalle-bg-light);
}

.category-list:not(.category-accordion) li.active a,
.category-list:not(.category-accordion) li a:hover {
	border-color: var(--undetalle-primary);
	color: var(--undetalle-primary);
	background: #fff0f3;
}

.category-list:not(.category-accordion) small {
	font-size: 0.8rem;
	color: var(--undetalle-text-muted);
	font-weight: 600;
}

.best-sellers-list {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 16px;
}

.best-sellers-list li a {
	display: flex;
	align-items: center;
	gap: 14px;
	text-decoration: none;
	color: inherit;
}

.best-seller-thumb {
	width: 56px;
	height: 56px;
	border-radius: 50%;
	overflow: hidden;
	background: var(--undetalle-bg-light);
	flex-shrink: 0;
}

.best-seller-thumb img {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.best-seller-info .title {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
	color: var(--undetalle-text);
	line-height: 1.3;
}

.best-seller-info .price {
	font-size: 0.9rem;
	color: var(--undetalle-primary);
	font-weight: 700;
}

/* Estilos para precios en oferta en el sidebar */
.best-sellers-list .price del,
.best-seller-info .price del {
	color: #999;
	opacity: 0.7;
	text-decoration: line-through;
	font-weight: 400;
	font-size: 0.85rem;
}

.best-sellers-list .price ins,
.best-seller-info .price ins {
	text-decoration: none;
	color: var(--undetalle-primary);
	font-weight: 700;
}

.promo-card {
	border-radius: 22px;
	overflow: hidden;
	box-shadow: var(--undetalle-shadow);
	position: relative;
}

.promo-card-inner {
	display: block;
	color: #fff;
	text-decoration: none;
	min-height: 400px;
	background-size: cover;
	background-position: center;
	background-color: #1f1f1f;
	position: relative;
	border-radius: 20px;
}

.promo-card-overlay {
	position: absolute;
	inset: 0;
	background: linear-gradient(180deg, rgba(0, 0, 0, 0.2) 0%, rgba(0, 0, 0, 0.75) 100%);
	z-index: 1;
}

.promo-card-content {
	position: absolute;
	left: 20px;
	right: 20px;
	bottom: 20px;
	place-self: center;
	z-index: 2;
}

.promo-card-title {
	margin: 0;
	font-size: 1rem;
	font-weight: 700;
	letter-spacing: 0.15em;
	text-transform: uppercase;
}

.promo-card-text {
	margin: 8px 0 0 0;
	font-size: 0.95rem;
}

.promo-card-button {
	margin-top: 12px;
	display: inline-block;
	padding: 6px 14px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.15);
	color: #fff;
	font-weight: 600;
	font-size: 0.8rem;
	text-transform: uppercase;
	letter-spacing: 0.2em;
}

.archive-main {
	background: var(--undetalle-white);
	padding: 30px 34px;
	border-radius: 28px;
	box-shadow: var(--undetalle-shadow);
}

.archive-toolbar {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	flex-wrap: wrap;
	margin-bottom: 30px;
}

.results-count-text {
	margin: 0;
	color: var(--undetalle-text-light);
	font-weight: 500;
}

.results-count-text strong {
	color: var(--undetalle-primary);
}

.toolbar-actions {
	display: flex;
	align-items: center;
	gap: 20px;
}

.per-page-form {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 8px 12px;
	border-radius: 999px;
	background: var(--undetalle-bg-light);
}

.per-page-form label {
	font-weight: 600;
	font-size: 0.9rem;
	color: var(--undetalle-text);
}

.per-page-form select {
	border: none;
	background: transparent;
	font-weight: 600;
	color: var(--undetalle-primary);
	cursor: pointer;
}

.toolbar-ordering .woocommerce-ordering {
	margin: 0;
}

.toolbar-ordering select {
	padding: 10px 45px 10px 18px;
	border-radius: 999px;
	border: 1px solid var(--undetalle-border);
	font-weight: 600;
	color: var(--undetalle-text);
	cursor: pointer;
}

.products-grid {
	display: grid;
	grid-template-columns: repeat(auto-fill, minmax(260px, 1fr));
	gap: 28px;
}

.product-card {
	background: var(--undetalle-white);
	border-radius: 28px;
	overflow: hidden;
	border: 1px solid #f0f0f0;
	box-shadow: 0 18px 35px rgba(24, 31, 38, 0.08);
	display: flex;
	flex-direction: column;
	transition: transform 0.25s ease, box-shadow 0.25s ease;
}

.product-card:hover {
	transform: translateY(-6px);
	box-shadow: 0 30px 45px rgba(24, 31, 38, 0.12);
}

.product-card-image {
	position: relative;
	width: 100%;
	aspect-ratio: 5 / 7;
	overflow: hidden;
	background: var(--undetalle-bg-light);
}

.product-badge {
	position: absolute;
	top: 18px;
	right: 18px;
	padding: 6px 18px;
	border-radius: 999px;
	background: linear-gradient(135deg, #EC5970 0%, #e94562 100%);
	color: #fff;
	font-size: 0.8rem;
	font-weight: 700;
	box-shadow: 0 10px 25px rgba(236, 89, 112, 0.4);
}

.product-badge.out-of-stock {
	background: linear-gradient(135deg, #454849 0%, #5a5d5f 100%);
}

.product-badge.new {
	background: linear-gradient(135deg, #2ecc71 0%, #1abc9c 100%);
}

.product-card-content {
	padding: 22px 22px 24px;
	display: flex;
	flex-direction: column;
	gap: 4px;
	flex: 1;
}

.product-card-title {
	margin: 5px;
	font-size: 1.15rem;
	color: var(--undetalle-text);
	line-height: 1.3;
}

.product-card-price {
	font-size: 1.35rem;
	font-weight: 700;
	color: var(--undetalle-primary);
	margin: 0;
}

.product-card-price del {
	font-size: 0.9rem;
	color: var(--undetalle-text-muted);
	margin-right: 6px;
}

.product-card-price ins {
	text-decoration: none;
	color: inherit;
}

.woocommerce-pagination,
.woocommerce-pagination ul {
	margin-top: 40px;
	text-align: center;
}

.woocommerce-pagination ul li a,
.woocommerce-pagination ul li span {
	width: 48px;
	height: 48px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 999px;
	border: 1px solid var(--undetalle-border);
	margin: 0 5px;
	font-weight: 600;
	color: var(--undetalle-text);
	transition: all 0.2s ease;
}

.woocommerce-pagination ul li a:hover,
.woocommerce-pagination ul li span.current {
	border-color: var(--undetalle-primary);
	background: var(--undetalle-primary);
	color: #fff;
	box-shadow: 0 12px 30px rgba(236, 89, 112, 0.3);
}

.no-products-found {
	text-align: center;
	padding: 80px 40px;
	background: var(--undetalle-bg-light);
	border-radius: 26px;
	margin-top: 30px;
}

.no-products-found svg {
	width: 90px;
	height: 90px;
	margin-bottom: 20px;
}

.no-products-found h3 {
	font-size: 1.8rem;
	margin-bottom: 12px;
}

.archive-sidebar-overlay {
	display: none;
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	z-index: 999;
	opacity: 0;
	transition: opacity 0.2s ease;
}

body.sidebar-open .archive-sidebar-overlay {
	display: block;
	opacity: 1;
}

@media (max-width: 1200px) {
	.archive-layout {
		grid-template-columns: 280px minmax(0, 1fr);
	}
}

@media (max-width: 1024px) {
	.archive-main {
		padding: 24px;
	}

	.products-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 22px;
	}
}

@media (max-width: 992px) {
	.archive-product-wrapper {
		padding: 20px 12px 40px;
	}
	
	.category-banner-fullwidth {
		padding: 0;
		height: 300px;
	}
	
	.category-banner-fullwidth .banner-content-inner {
		padding: 40px 30px;
	}
	
	.archive-page-top {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.archive-sidebar-toggle {
		display: inline-flex;
	}
	
	.archive-layout {
		grid-template-columns: 1fr;
	}
	
	.archive-sidebar {
		position: fixed;
		top: 0;
		right: 0;
		width: 90%;
		max-width: 360px;
		height: 100vh;
		padding: 32px 26px;
		overflow-y: auto;
		transform: translateX(105%);
		transition: transform 0.25s ease;
		z-index: 1000;
		border-radius: 0;
	}
	
	body.sidebar-open .archive-sidebar {
		transform: translateX(0);
	}
	
	.archive-sidebar-close {
		display: inline-flex;
		align-items: center;
		justify-content: center;
	}
	
	.archive-main {
		padding: 20px;
	}
}

@media (max-width: 768px) {
	.archive-product-wrapper {
		padding: 16px 10px 32px;
	}
	
	.category-banner-fullwidth {
		height: 260px;
	}
	
	.category-banner-fullwidth .banner-content-inner {
		padding: 30px 20px;
	}
	
	.page-title,
	.category-banner-fullwidth h1 {
		font-size: 2rem;
	}
	
	.archive-toolbar {
		flex-direction: column;
		align-items: flex-start;
	}
	
	.toolbar-actions {
		width: 100%;
		flex-direction: column;
		align-items: stretch;
	}
	
	.per-page-form {
		width: 100%;
		justify-content: space-between;
	}
	
	.toolbar-ordering .woocommerce-ordering select {
		width: 100%;
	}
	
	.products-grid {
		grid-template-columns: repeat(2, minmax(0, 1fr));
		gap: 16px;
	}
	
	.product-card-title {
		min-height: auto;
	}
	
	.product-card-actions {
		grid-template-columns: 1fr;
	}
}

@media (max-width: 480px) {
	.archive-main {
		padding: 16px;
	}

	.products-grid {
		gap: 12px;
	}

	.product-card-content {
		padding: 16px;
	}
	
	.sidebar-card {
		padding-top: 10px;
	}
}
