/**
 * Puntos Ya - Estilos de la tienda (shop)
 */

/* Animación de entrada (igual que página de producto individual) */
@keyframes puntos-ya-shop-fadeSlideUp {
	from {
		opacity: 0;
		transform: translateY(14px);
	}
	to {
		opacity: 1;
		transform: translateY(0);
	}
}

/* Contenedor: animación al cargar y tras cada filtro AJAX */
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate {
	animation: puntos-ya-shop-fadeSlideUp 0.5s var(--ease-out) backwards;
}

/* Productos del grid: entrada escalonada ligera */
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products.puntos-ya-products li.product,
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product {
	animation: puntos-ya-shop-fadeSlideUp 0.45s var(--ease-out) backwards;
}
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(1) { animation-delay: 0.05s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(2) { animation-delay: 0.09s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(3) { animation-delay: 0.13s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(4) { animation-delay: 0.17s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(5) { animation-delay: 0.21s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(6) { animation-delay: 0.25s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(7) { animation-delay: 0.29s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(8) { animation-delay: 0.33s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(9) { animation-delay: 0.37s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(10) { animation-delay: 0.41s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(11) { animation-delay: 0.45s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(12) { animation-delay: 0.49s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(13) { animation-delay: 0.53s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(14) { animation-delay: 0.57s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(15) { animation-delay: 0.61s; }
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate ul.products li.product:nth-child(16) { animation-delay: 0.65s; }

/* Bloque "no hay productos": misma animación */
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate .puntos-ya-no-products,
#puntos-ya-shop-ajax-content.puntos-ya-shop-animate .woocommerce-no-products-found {
	animation: puntos-ya-shop-fadeSlideUp 0.5s var(--ease-out) 0.08s backwards;
}

/* En la tienda (y categorías), no usar min-width para que el grid respete max-width y los productos no se estiren demasiado */
body.puntos-ya-shop .puntos-ya-main,
body.term-product_cat .puntos-ya-main,
body.term-product_tag .puntos-ya-main {
	min-width: 0;
}

/* ========== Layout: filtros izquierda + productos derecha ========== */
/* Contenedor más ancho que el carrito para que los productos se vean más grandes */
.puntos-ya-shop-layout {
	max-width: 1440px;
	margin: 0 auto;
	padding: 32px 24px 48px;
	display: flex;
	gap: 32px;
	align-items: flex-start;
}

.puntos-ya-shop-filters {
	flex-shrink: 0;
	width: 260px;
}

.puntos-ya-shop-filters-inner {
	padding: 0;
	position: sticky;
	top: 24px;
	/* Sin tarjeta: mismo fondo que la página */
	background: transparent;
}

.puntos-ya-shop-content {
	flex: 1;
	min-width: 0;
}

/* Search results: sin sidebar de filtros, grid más ancho */
.puntos-ya-shop-layout--search {
	max-width: 1280px;
}

.puntos-ya-shop-layout--search .puntos-ya-shop-content {
	width: 100%;
}

.puntos-ya-search-results-header {
	margin-bottom: 24px;
}

.puntos-ya-search-results-header p {
	font-size: 0.9375rem;
	color: var(--color-text-muted, #6b7280);
	margin: 0;
}

@media (max-width: 900px) {
	.puntos-ya-shop-layout {
		flex-direction: column;
		gap: 24px;
	}
	.puntos-ya-shop-filters {
		width: 100%;
	}
	.puntos-ya-shop-filters-inner {
		position: static;
	}
}

/* Base bloques y formulario (común) */
.puntos-ya-filter-block {
	margin-bottom: 24px;
}
.puntos-ya-filter-block:last-child {
	margin-bottom: 0;
}

.puntos-ya-filter-title {
	font-size: 0.875rem;
	font-weight: 600;
	text-transform: uppercase;
	letter-spacing: 0.03em;
	margin: 0 0 12px;
	padding-bottom: 8px;
}

.puntos-ya-filter-categories {
	list-style: none;
	margin: 0;
	padding: 0;
}

.puntos-ya-filter-categories li {
	margin: 0;
}

.puntos-ya-filter-categories a {
	display: block;
	padding: 8px 0;
	font-size: 0.9375rem;
	transition: color 0.25s var(--ease-out);
}

.puntos-ya-filter-count {
	font-size: 0.8125rem;
	font-weight: 400;
}

/* Subcategorías: dropdown bajo su categoría padre (cerrado por defecto) */
.puntos-ya-filter-cat-row {
	display: flex;
	align-items: center;
	gap: 6px;
}

.puntos-ya-filter-cat-row a {
	flex: 1;
	min-width: 0;
}

.puntos-ya-filter-cat-toggle {
	display: flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: none;
	padding: 6px;
	cursor: pointer;
	color: var(--color-text-muted);
	flex-shrink: 0;
	transition: transform 0.25s var(--ease-out), color 0.25s var(--ease-out);
}

.puntos-ya-filter-cat-toggle:hover {
	color: var(--color-orange);
}

.puntos-ya-filter-categories li.is-open > .puntos-ya-filter-cat-row .puntos-ya-filter-cat-toggle {
	transform: rotate(180deg);
}

.puntos-ya-filter-subcategories {
	list-style: none;
	margin: 0;
	padding: 0 0 0 16px;
	max-height: 0;
	overflow: hidden;
	transition: max-height 0.3s var(--ease-out);
}

.puntos-ya-filter-categories li.is-open > .puntos-ya-filter-subcategories {
	max-height: 800px;
}

.puntos-ya-filter-subcategories a {
	padding: 6px 0;
	font-size: 0.875rem;
}

.puntos-ya-price-filter-form {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

/* Slider de rango de precio (doble control) */
.puntos-ya-price-slider-wrap {
	margin-bottom: 4px;
}

.puntos-ya-price-slider-track {
	position: relative;
	height: 28px;
	display: flex;
	align-items: center;
}

.puntos-ya-price-slider-track::before {
	content: '';
	position: absolute;
	left: 0;
	right: 0;
	height: 6px;
	background: var(--color-border);
	border-radius: 3px;
	pointer-events: none;
}

/* Barra tomate entre los dos thumbs del slider */
.puntos-ya-price-slider-fill {
	position: absolute;
	top: 50%;
	transform: translateY(-50%);
	height: 6px;
	background: var(--color-orange);
	border-radius: 3px;
	pointer-events: none;
	transition: left 0.15s var(--ease-out), width 0.15s var(--ease-out);
	left: 0%;
	width: 100%;
}

.puntos-ya-price-range {
	position: absolute;
	left: 0;
	right: 0;
	width: 100%;
	height: 28px;
	margin: 0;
	background: transparent;
	-webkit-appearance: none;
	appearance: none;
	pointer-events: none;
}

.puntos-ya-price-range-min {
	z-index: 2;
}

.puntos-ya-price-range-max {
	z-index: 1;
}

.puntos-ya-price-range::-webkit-slider-thumb {
	-webkit-appearance: none;
	appearance: none;
	width: 18px;
	height: 18px;
	border-radius: 50%;
	background: var(--color-orange);
	cursor: pointer;
	pointer-events: auto;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
	transition: transform 0.2s var(--ease-out), box-shadow 0.2s var(--ease-out);
}

.puntos-ya-price-range::-webkit-slider-thumb:hover {
	transform: scale(1.1);
	box-shadow: 0 2px 8px rgba(232, 93, 4, 0.4);
}

.puntos-ya-price-range::-moz-range-thumb {
	width: 18px;
	height: 18px;
	border: none;
	border-radius: 50%;
	background: var(--color-orange);
	cursor: pointer;
	pointer-events: auto;
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.2);
}

.puntos-ya-price-range::-moz-range-thumb:hover {
	box-shadow: 0 2px 8px rgba(232, 93, 4, 0.4);
}

.puntos-ya-price-slider-labels {
	display: flex;
	justify-content: space-between;
	margin-top: 6px;
	font-size: 0.875rem;
	color: var(--color-text-muted);
}

/* Botón Quitar todos los filtros */
.puntos-ya-filter-clear-wrap {
	margin-top: 8px;
}
.puntos-ya-filter-clear-wrap.is-hidden {
	display: none;
}
.puntos-ya-filter-clear {
	display: inline-block;
	padding: 10px 0;
	font-size: 0.875rem;
	font-weight: 600;
	color: var(--color-orange);
	transition: color 0.2s var(--ease-out);
}
.puntos-ya-filter-clear:hover {
	color: var(--color-orange-dark);
}

/* Carga AJAX */
#puntos-ya-shop-ajax-content.puntos-ya-shop-loading {
	opacity: 0.6;
	pointer-events: none;
	transition: opacity 0.2s var(--ease-out);
}

/* Filtros integrados con el fondo (sin tarjeta): títulos y enlaces */
.puntos-ya-filter-title {
	color: var(--color-text);
	border-left: 4px solid var(--color-orange);
	padding-left: 10px;
	border-bottom: none;
}

.puntos-ya-filter-categories a {
	color: var(--color-text);
}

.puntos-ya-filter-categories a:hover,
.puntos-ya-filter-categories a.is-active {
	color: var(--color-orange);
}

.puntos-ya-filter-count {
	color: var(--color-text-muted);
}

.puntos-ya-page-title {
	font-size: 2rem;
	font-weight: 700;
	margin: 0 0 28px;
	letter-spacing: -0.02em;
}

/* Sin productos (filtros aplicados) */
.puntos-ya-no-products,
.woocommerce-no-products-found {
	margin: 32px 0;
	padding: 40px 24px;
	text-align: center;
	background: #fff;
	border: 1px solid var(--color-border);
	border-radius: 12px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
}
.puntos-ya-no-products-inner {
	max-width: 360px;
	margin: 0 auto;
}
.puntos-ya-no-products-text {
	font-size: 1.125rem;
	font-weight: 600;
	color: var(--color-text);
	margin: 0 0 8px;
}
.puntos-ya-no-products-hint {
	font-size: 0.9375rem;
	color: var(--color-text-muted);
	margin: 0;
}

/* Grid productos (ul de WooCommerce con clase puntos-ya-products) */
.puntos-ya-products,
ul.products.puntos-ya-products {
	display: grid;
	grid-template-columns: repeat(4, 1fr);
	gap: 24px;
	list-style: none;
	margin: 0;
	padding: 0;
}

@media (max-width: 1024px) {
	.puntos-ya-products,
	ul.products.puntos-ya-products {
		grid-template-columns: repeat(3, 1fr);
	}
}

@media (max-width: 768px) {
	.puntos-ya-products,
	ul.products.puntos-ya-products {
		grid-template-columns: repeat(2, 1fr);
		gap: 16px;
	}
}

/* En responsive no se muestra el botón "Añadir al carrito" (quick-add) */
@media (max-width: 1024px) {
	.puntos-ya-product-quick-add {
		display: none !important;
	}
}

/* Tarjeta (li o article con clase puntos-ya-product-card) */
.puntos-ya-product-card,
ul.products.puntos-ya-products li.product {
	display: flex;
	flex-direction: column;
	background: var(--color-bg);
	border: 1px solid var(--color-border);
	border-radius: 12px;
	overflow: hidden;
	transition: box-shadow 0.2s, border-color 0.2s;
	margin: 0;
	width: auto;
	cursor: pointer;
}

.puntos-ya-product-card:hover,
ul.products.puntos-ya-products li.product:hover {
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
	border-color: #d0d0d0;
}

/* Imagen cuadrada */
.puntos-ya-product-image-wrap {
	position: relative;
	width: 100%;
	aspect-ratio: 1;
	background: #f8f8f8;
	overflow: hidden;
}

.puntos-ya-product-image-wrap img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.4s ease;
}

.puntos-ya-product-card:hover .puntos-ya-product-image-wrap img,
ul.products.puntos-ya-products li.product:hover .puntos-ya-product-image-wrap img {
	transform: scale(1.08);
}

.puntos-ya-product-badge {
	position: absolute;
	top: 12px;
	left: 12px;
	background: var(--color-orange);
	color: #fff;
	font-size: 0.75rem;
	font-weight: 600;
	padding: 4px 10px;
	border-radius: 6px;
}

/* Botón "Añadir al carrito" visible solo en hover (Quick Add) */
.puntos-ya-product-quick-add {
	position: absolute;
	left: 12px;
	right: 12px;
	bottom: 12px;
	opacity: 0;
	transform: translateY(8px);
	transition: opacity 0.25s ease, transform 0.25s ease;
	pointer-events: none;
}

.puntos-ya-product-card:hover .puntos-ya-product-quick-add,
ul.products.puntos-ya-products li.product:hover .puntos-ya-product-quick-add {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.puntos-ya-product-quick-add .puntos-ya-add-to-cart {
	width: 100%;
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 16px;
	background: var(--color-orange);
	border: 1px solid var(--color-orange);
	border-radius: 10px;
	font-size: 0.9375rem;
	font-weight: 500;
	color: #fff;
	cursor: pointer;
	font-family: inherit;
	box-shadow: 0 2px 12px rgba(232, 93, 4, 0.25);
	transition: background 0.2s, box-shadow 0.2s, border-color 0.2s;
	text-decoration: none;
}

.puntos-ya-product-quick-add .puntos-ya-add-to-cart:hover {
	background: var(--color-orange-dark);
	border-color: var(--color-orange-dark);
	box-shadow: 0 4px 16px rgba(232, 93, 4, 0.35);
}

/* Estado "añadido": verde + animación, luego vuelve al original */
.puntos-ya-product-quick-add .puntos-ya-add-to-cart.puntos-ya-just-added {
	background: #16a34a;
	color: #fff;
	border-color: #16a34a;
	box-shadow: 0 4px 16px rgba(22, 163, 74, 0.4);
	animation: puntos-ya-added-pulse 0.6s ease-out;
}

@keyframes puntos-ya-added-pulse {
	0% { transform: scale(1); }
	25% { transform: scale(1.04); }
	50% { transform: scale(0.98); }
	75% { transform: scale(1.02); }
	100% { transform: scale(1); }
}

.puntos-ya-product-quick-add .puntos-ya-add-to-cart-disabled {
	cursor: not-allowed;
	opacity: 0.7;
}

.puntos-ya-product-quick-add .puntos-ya-icon {
	width: 18px;
	height: 18px;
	stroke: currentColor;
	fill: none;
	stroke-width: 2;
	stroke-linecap: round;
	stroke-linejoin: round;
	flex-shrink: 0;
}

.puntos-ya-product-body {
	padding: 16px;
	display: flex;
	flex-direction: column;
	flex: 1;
}

.puntos-ya-product-title {
	font-size: 1rem;
	font-weight: 600;
	margin: 0 0 8px;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.puntos-ya-product-title a {
	text-decoration: none;
	color: inherit;
}

.puntos-ya-product-title a:hover {
	color: var(--color-orange);
}

.puntos-ya-product-prices {
	display: flex;
	align-items: baseline;
	gap: 8px;
	flex-wrap: wrap;
	margin-bottom: 0;
}

.puntos-ya-product-price-old {
	font-size: 0.875rem;
	color: var(--color-text-muted);
	text-decoration: line-through;
}

.puntos-ya-product-price {
	font-size: 1.125rem;
	font-weight: 700;
}

/* Ocultar precio por defecto de WooCommerce si aparece */
ul.products.puntos-ya-products li.product > .price {
	display: none !important;
}

/* Ocultar enlace "View cart" que aparece al añadir al carrito */
.added_to_cart.wc-forward {
	display: none !important;
}

/* Notificaciones: ver woocommerce-notices.css (flotantes en esquina inferior derecha) */

/* ─── Paginación ────────────────────────────────────────────────────────────── */
.woocommerce-pagination {
	display: flex;
	justify-content: center;
	padding: 32px 0 16px;
}

.woocommerce-pagination ul.page-numbers {
	display: flex;
	align-items: center;
	gap: 6px;
	list-style: none;
	margin: 0;
	padding: 0;
}

.woocommerce-pagination ul.page-numbers li {
	margin: 0;
	padding: 0;
}

.woocommerce-pagination .page-numbers {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 12px;
	border-radius: 8px;
	font-size: 0.9rem;
	font-weight: 500;
	text-decoration: none;
	border: 1.5px solid var(--color-border, #e5e7eb);
	background: #fff;
	color: var(--color-text, #1a1a2e);
	transition: background 0.18s, color 0.18s, border-color 0.18s;
	cursor: pointer;
}

.woocommerce-pagination .page-numbers:hover {
	background: var(--color-orange-muted, #fff3ec);
	border-color: var(--color-orange, #E85D04);
	color: var(--color-orange, #E85D04);
}

.woocommerce-pagination .page-numbers.current {
	background: var(--color-orange, #E85D04);
	border-color: var(--color-orange, #E85D04);
	color: #fff;
	font-weight: 700;
	pointer-events: none;
}

.woocommerce-pagination .page-numbers.dots {
	border: none;
	background: none;
	color: var(--color-text-muted, #6b7280);
	pointer-events: none;
	min-width: 24px;
	padding: 0;
}

.woocommerce-pagination .prev.page-numbers,
.woocommerce-pagination .next.page-numbers {
	font-size: 1rem;
	font-weight: 600;
}

/* ─── Grid de categorías en la tienda principal ─── */
.puntos-ya-shop-cat-grid {
	display: grid;
	grid-template-columns: repeat(3, 1fr);
	gap: 16px;
	margin: 0 0 36px;
}

.puntos-ya-cat-grid-item {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 12px;
	padding: 22px 14px;
	background: #fff;
	border: 1px solid var(--color-border);
	border-radius: 12px;
	box-shadow: 0 2px 12px rgba(0, 0, 0, 0.04);
	text-decoration: none;
	text-align: center;
	color: var(--color-text);
	font-weight: 600;
	font-size: 0.95rem;
	line-height: 1.3;
	transition: box-shadow 0.2s var(--ease-out), border-color 0.2s var(--ease-out), transform 0.2s var(--ease-out);
}

.puntos-ya-cat-grid-item:hover,
.puntos-ya-cat-grid-item:focus-visible {
	border-color: var(--color-orange);
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.08);
	transform: translateY(-2px);
	color: var(--color-orange);
}

.puntos-ya-cat-grid-icon {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 56px;
	height: 56px;
	border-radius: 50%;
	background: rgba(232, 93, 4, 0.08);
	color: var(--color-orange);
	transition: background 0.2s var(--ease-out);
}

.puntos-ya-cat-grid-item:hover .puntos-ya-cat-grid-icon {
	background: rgba(232, 93, 4, 0.14);
}

.puntos-ya-cat-grid-icon svg {
	width: 28px;
	height: 28px;
}

@media (max-width: 900px) {
	.puntos-ya-shop-cat-grid {
		gap: 12px;
	}
}

@media (max-width: 600px) {
	.puntos-ya-shop-cat-grid {
		grid-template-columns: repeat(2, 1fr);
	}
	.puntos-ya-cat-grid-item {
		padding: 16px 10px;
		font-size: 0.85rem;
	}
	.puntos-ya-cat-grid-icon {
		width: 48px;
		height: 48px;
	}
	.puntos-ya-cat-grid-icon svg {
		width: 24px;
		height: 24px;
	}
}
