/**
 * Página de Productos - Safety Garage
 * Diseño visual con categorías y soporte para video
 */

/* ========== HERO DE PRODUCTOS ========== */
.products-hero {
	position: relative;
	min-height: 400px;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background: var(--sg-dark, #122d5c);
	margin-top: -1px; /* Pegar al header */
}

.products-hero__bg {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	z-index: 0;
}

.products-hero__video,
.products-hero__image {
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.products-hero__overlay {
	position: absolute;
	top: 0;
	left: 0;
	width: 100%;
	height: 100%;
	background: linear-gradient(135deg, rgba(18, 45, 92, 0.85) 0%, rgba(18, 45, 92, 0.7) 100%);
	z-index: 1;
}

.products-hero__content {
	position: relative;
	z-index: 2;
	width: 100%;
	padding: 4rem 1.5rem;
	text-align: center;
}

.products-hero__container {
	max-width: 800px;
	margin: 0 auto;
}

.products-hero__breadcrumb {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.7);
	margin-bottom: 1rem;
}

.products-hero__breadcrumb a {
	color: rgba(255, 255, 255, 0.7);
	text-decoration: none;
	transition: color 0.3s ease;
}

.products-hero__breadcrumb a:hover {
	color: #fff;
}

.products-hero__breadcrumb svg {
	opacity: 0.5;
}

.products-hero__title {
	font-size: clamp(2rem, 5vw, 3rem);
	font-weight: 700;
	color: #fff;
	margin: 0 0 1rem;
	line-height: 1.2;
}

.products-hero__desc {
	font-size: 1.1rem;
	color: rgba(255, 255, 255, 0.85);
	margin: 0;
	line-height: 1.6;
	max-width: 600px;
	margin: 0 auto;
}

/* ========== CATEGORÍAS DE PRODUCTOS ========== */
.products-categories {
	padding: 5rem 0;
	background: #f8fafc;
	width: 100%;
}

.products-categories__container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 1.5rem;
}

.products-categories__header {
	text-align: center;
	margin-bottom: 3rem;
}

.products-categories__title {
	font-size: clamp(1.75rem, 4vw, 2.25rem);
	font-weight: 700;
	color: var(--sg-dark, #122d5c);
	margin: 0 0 1rem;
}

.products-categories__subtitle {
	font-size: 1.05rem;
	color: #5a6a7a;
	margin: 0;
	max-width: 600px;
	margin: 0 auto;
	line-height: 1.6;
}

.products-categories__grid {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(350px, 1fr));
	gap: 2rem;
}

/* Grid principal de categorías - más grande */
.products-categories__grid--main {
	grid-template-columns: repeat(3, 1fr);
	gap: 1.5rem;
}

.products-categories__grid--main .category-card__media {
	height: 320px;
}

/* Grid de subcategorías - 2 columnas con descripción */
.products-categories__grid--subcats {
	grid-template-columns: repeat(2, 1fr);
	gap: 2rem;
	max-width: 900px;
	margin: 0 auto;
}

.products-categories__grid--subcats .category-card__media {
	height: 280px;
}

.products-categories__grid--subcats .category-card__desc {
	font-size: 0.9rem;
	color: #64748b;
	margin: 0.25rem 0 0.75rem;
}

/* ========== TARJETA DE CATEGORÍA ========== */
.category-card {
	position: relative;
	border-radius: 16px;
	overflow: hidden;
	background: #fff;
	box-shadow: 0 4px 20px rgba(18, 45, 92, 0.08);
	transition: all 0.4s ease;
}

.category-card:hover {
	transform: translateY(-8px);
	box-shadow: 0 12px 40px rgba(18, 45, 92, 0.15);
}

.category-card__link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.category-card__media {
	position: relative;
	height: 280px;
	overflow: hidden;
}

.category-card__video,
.category-card__image,
.category-card__poster {
	width: 100%;
	height: 100%;
	object-fit: cover;
	transition: transform 0.6s ease;
}

.category-card__video {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 2;
	opacity: 1;
}

.category-card__poster {
	position: absolute;
	top: 0;
	left: 0;
	z-index: 3;
	transition: opacity 0.5s ease;
}

.category-card:hover .category-card__image {
	transform: scale(1.05);
}

.category-card__overlay {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	height: 60%;
	background: linear-gradient(to top, rgba(18, 45, 92, 0.9) 0%, transparent 100%);
	z-index: 3;
	pointer-events: none;
}

.category-card__content {
	position: absolute;
	bottom: 0;
	left: 0;
	right: 0;
	padding: 1.5rem;
	z-index: 4;
}

.category-card__title {
	font-size: 1.5rem;
	font-weight: 700;
	color: #fff;
	margin: 0 0 0.5rem;
}

.category-card__desc {
	font-size: 0.9rem;
	color: rgba(255, 255, 255, 0.8);
	margin: 0 0 1rem;
	line-height: 1.5;
}

.category-card__cta {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	font-size: 0.9rem;
	font-weight: 600;
	color: #fff;
	transition: gap 0.3s ease;
}

.category-card:hover .category-card__cta {
	gap: 0.75rem;
}

.category-card__count {
	position: absolute;
	top: 1rem;
	right: 1rem;
	background: rgba(255, 255, 255, 0.95);
	color: var(--sg-dark, #122d5c);
	font-size: 0.75rem;
	font-weight: 600;
	padding: 0.35rem 0.75rem;
	border-radius: 20px;
	z-index: 5;
}

.category-card__play-hint {
	position: absolute;
	top: 50%;
	left: 50%;
	transform: translate(-50%, -50%);
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	color: var(--sg-dark, #122d5c);
	display: flex;
	align-items: center;
	justify-content: center;
	z-index: 5;
	opacity: 1;
	transition: opacity 0.5s ease;
	box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2);
	pointer-events: none;
}

.category-card__play-hint svg {
	margin-left: 4px;
}

/* ========== LISTADO DE PRODUCTOS ========== */
.products-listing {
	padding: 4rem 0;
	background: #fff;
	width: 100%;
}

.products-listing__container {
	max-width: 1200px;
	margin: 0 auto;
	padding: 0 1.5rem;
}

/* Wrapper para páginas de categoría */
body.tax-product_cat .site-main > *:not(.products-hero):not(.products-cta):not(.products-listing) {
	max-width: 1200px;
	margin-left: auto;
	margin-right: auto;
	padding-left: 1.5rem;
	padding-right: 1.5rem;
}

/* Contenedor global de WooCommerce - Full Width */
.woocommerce .woocommerce-products-header,
.woocommerce-page .woocommerce-products-header {
	display: none;
}

/* Reset del contenedor principal para WooCommerce */
body.woocommerce #content,
body.woocommerce-page #content,
body.woocommerce .site-main,
body.woocommerce-page .site-main {
	max-width: 100% !important;
	width: 100% !important;
	padding: 0 !important;
	margin: 0 !important;
}

body.woocommerce .site-container,
body.woocommerce-page .site-container {
	max-width: 100% !important;
	padding: 0 !important;
}

/* Grid de productos full width */
body.woocommerce ul.products,
body.woocommerce-page ul.products {
	display: grid !important;
	grid-template-columns: repeat(3, 1fr) !important;
	gap: 2rem !important;
	max-width: 1200px !important;
	margin: 0 auto !important;
	padding: 0 1.5rem !important;
}

.products-listing__header {
	text-align: center;
	margin-bottom: 2rem;
}

.products-listing__title {
	font-size: 1.75rem;
	font-weight: 700;
	color: var(--sg-dark, #122d5c);
	margin: 0;
}

/* Toolbar de productos */
.products-listing__toolbar {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 2rem;
	padding-bottom: 1rem;
	border-bottom: 1px solid #e2e8f0;
	flex-wrap: wrap;
	gap: 1rem;
}

.woocommerce-result-count {
	margin: 0;
	color: #5a6a7a;
	font-size: 0.9rem;
}

/* WooCommerce Ordering */
.woocommerce-ordering {
	margin: 0;
	display: flex;
}

.woocommerce-ordering select {
	padding: 0.75rem 2.5rem 0.75rem 1rem;
	border: 2px solid #e2e8f0;
	border-radius: 8px;
	font-size: 0.9rem;
	color: var(--sg-dark, #122d5c);
	background: #fff;
	cursor: pointer;
	appearance: none;
	background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' viewBox='0 0 24 24' fill='none' stroke='%23122d5c' stroke-width='2'%3E%3Cpolyline points='6 9 12 15 18 9'%3E%3C/polyline%3E%3C/svg%3E");
	background-repeat: no-repeat;
	background-position: right 0.75rem center;
	background-size: 16px;
}

/* Grid de productos - Forzar estilos */
.woocommerce ul.products,
.woocommerce-page ul.products,
.products-listing ul.products,
ul.products {
	display: grid !important;
	grid-template-columns: repeat(auto-fill, minmax(280px, 1fr)) !important;
	gap: 2rem !important;
	list-style: none !important;
	padding: 0 !important;
	margin: 0 !important;
	width: 100% !important;
}

.woocommerce ul.products::before,
.woocommerce ul.products::after {
	display: none !important;
}

/* Tarjeta de producto individual */
.woocommerce ul.products li.product,
.woocommerce-page ul.products li.product,
ul.products li.product {
	background: #fff !important;
	border-radius: 12px !important;
	overflow: hidden !important;
	box-shadow: 0 2px 12px rgba(18, 45, 92, 0.06) !important;
	transition: all 0.3s ease !important;
	border: 1px solid #f0f0f0 !important;
	margin: 0 !important;
	padding: 0 !important;
	width: 100% !important;
	float: none !important;
	clear: none !important;
}

.woocommerce ul.products li.product:hover,
ul.products li.product:hover {
	transform: translateY(-4px);
	box-shadow: 0 8px 24px rgba(18, 45, 92, 0.1) !important;
}

.woocommerce ul.products li.product a.woocommerce-LoopProduct-link,
ul.products li.product a.woocommerce-LoopProduct-link {
	display: block;
	text-decoration: none;
	color: inherit;
}

.woocommerce ul.products li.product a img,
ul.products li.product a img,
ul.products li.product img {
	width: 100% !important;
	height: 220px !important;
	object-fit: contain !important;
	transition: transform 0.4s ease !important;
	margin: 0 !important;
	padding: 1rem !important;
	background: #f8fafc;
}

.woocommerce ul.products li.product:hover img,
ul.products li.product:hover img {
	transform: scale(1.05);
}

.woocommerce ul.products li.product .woocommerce-loop-product__title,
ul.products li.product .woocommerce-loop-product__title,
ul.products li.product h2 {
	font-size: 1.1rem !important;
	font-weight: 600 !important;
	color: var(--sg-dark, #122d5c) !important;
	margin: 0 !important;
	padding: 1rem 1rem 0.5rem !important;
	line-height: 1.4 !important;
}

.woocommerce ul.products li.product .price,
ul.products li.product .price {
	display: block !important;
	font-size: 1.1rem !important;
	font-weight: 700 !important;
	color: var(--sg-red, #c01617) !important;
	margin: 0 !important;
	padding: 0 1rem 1rem !important;
}

.woocommerce ul.products li.product .price del {
	color: #94a3b8 !important;
	font-weight: 400 !important;
	font-size: 0.9rem !important;
}

.woocommerce ul.products li.product .price ins {
	text-decoration: none !important;
}

.woocommerce ul.products li.product .button,
.woocommerce ul.products li.product a.button,
ul.products li.product .button,
ul.products li.product a.button {
	display: block !important;
	width: calc(100% - 2rem) !important;
	margin: 0 1rem 1rem !important;
	padding: 0.75rem 1rem !important;
	background: var(--sg-dark, #122d5c) !important;
	color: #fff !important;
	font-size: 0.9rem !important;
	font-weight: 600 !important;
	text-align: center !important;
	text-decoration: none !important;
	border: none !important;
	border-radius: 8px !important;
	cursor: pointer !important;
	transition: all 0.3s ease !important;
	box-sizing: border-box !important;
}

.woocommerce ul.products li.product .button:hover,
ul.products li.product .button:hover {
	background: #0d2147 !important;
}

/* Producto vacío */
.products-listing__empty {
	text-align: center;
	padding: 4rem 2rem;
	color: #5a6a7a;
}

.products-listing__empty svg {
	color: #94a3b8;
	margin-bottom: 1.5rem;
}

.products-listing__empty h3 {
	font-size: 1.25rem;
	color: var(--sg-dark, #122d5c);
	margin: 0 0 0.5rem;
}

.products-listing__empty p {
	margin: 0 0 1.5rem;
}

.products-listing__back-btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 0.75rem 1.5rem;
	background: var(--sg-dark, #122d5c);
	color: #fff;
	text-decoration: none;
	border-radius: 8px;
	font-weight: 500;
	transition: all 0.3s ease;
}

.products-listing__back-btn:hover {
	background: #0d2147;
	transform: translateX(-4px);
}

/* Paginación */
.woocommerce-pagination {
	margin-top: 3rem;
	text-align: center;
}

.woocommerce-pagination ul {
	display: inline-flex;
	gap: 0.5rem;
	list-style: none;
	padding: 0;
	margin: 0;
}

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

.woocommerce-pagination ul li a,
.woocommerce-pagination ul li span {
	display: flex;
	align-items: center;
	justify-content: center;
	min-width: 40px;
	height: 40px;
	padding: 0 0.75rem;
	border-radius: 8px;
	font-size: 0.9rem;
	font-weight: 500;
	text-decoration: none;
	transition: all 0.3s ease;
}

.woocommerce-pagination ul li a {
	background: #f8fafc;
	color: var(--sg-dark, #122d5c);
	border: 1px solid #e2e8f0;
}

.woocommerce-pagination ul li a:hover {
	background: var(--sg-dark, #122d5c);
	color: #fff;
	border-color: var(--sg-dark, #122d5c);
}

.woocommerce-pagination ul li span.current {
	background: var(--sg-dark, #122d5c);
	color: #fff;
}

/* ========== CTA FINAL ========== */
.products-cta {
	padding: 4rem 0;
	background: linear-gradient(135deg, var(--sg-dark, #122d5c) 0%, #0d2147 100%);
	margin-bottom: 0;
	width: 100%;
}

/* Eliminar espacio entre CTA y footer */
.products-cta + .site-footer,
.woocommerce .products-cta ~ .site-footer {
	margin-top: 0;
}

.products-cta__container {
	max-width: 1000px;
	margin: 0 auto;
	padding: 0 1.5rem;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 2rem;
	flex-wrap: wrap;
}

.products-cta__content {
	flex: 1;
	min-width: 300px;
}

.products-cta__title {
	font-size: clamp(1.5rem, 3vw, 2rem);
	font-weight: 700;
	color: #fff;
	margin: 0 0 0.5rem;
}

.products-cta__desc {
	font-size: 1rem;
	color: rgba(255, 255, 255, 0.8);
	margin: 0;
}

.products-cta__actions {
	display: flex;
	gap: 1rem;
	flex-wrap: wrap;
}

.products-cta__btn {
	display: inline-flex;
	align-items: center;
	gap: 0.5rem;
	padding: 1rem 2rem;
	font-size: 0.95rem;
	font-weight: 600;
	text-decoration: none;
	border-radius: 10px;
	transition: all 0.3s ease;
}

.products-cta__btn--primary {
	background: #fff;
	color: var(--sg-dark, #122d5c);
}

.products-cta__btn--primary:hover {
	background: #f0f0f0;
	transform: translateY(-2px);
}

.products-cta__btn--whatsapp {
	background: #25d366;
	color: #fff;
}

.products-cta__btn--whatsapp:hover {
	background: #20bd5a;
	transform: translateY(-2px);
}

/* ========== RESPONSIVE ========== */
@media (max-width: 1024px) {
	.products-categories__grid--main {
		grid-template-columns: repeat(2, 1fr);
	}
	
	.products-categories__grid--subcats {
		grid-template-columns: repeat(2, 1fr);
		gap: 1.5rem;
	}
}

@media (max-width: 768px) {
	.products-hero {
		min-height: 300px;
	}

	.products-categories {
		padding: 3rem 0;
	}

	.products-categories__grid,
	.products-categories__grid--main {
		grid-template-columns: 1fr;
	}
	
	.products-categories__grid--subcats {
		grid-template-columns: 1fr;
		gap: 1.5rem;
	}

	.category-card__media,
	.products-categories__grid--main .category-card__media,
	.products-categories__grid--subcats .category-card__media {
		height: 240px;
	}
	
	.products-listing__toolbar {
		flex-direction: column;
		align-items: stretch;
		text-align: center;
	}

	.products-listing {
		padding: 3rem 0;
	}

	.products-listing ul.products {
		grid-template-columns: repeat(auto-fill, minmax(240px, 1fr));
		gap: 1.5rem;
	}

	.products-cta__container {
		flex-direction: column;
		text-align: center;
	}

	.products-cta__actions {
		justify-content: center;
	}
}

@media (max-width: 480px) {
	.products-listing ul.products {
		grid-template-columns: 1fr;
	}

	.products-cta__btn {
		width: 100%;
		justify-content: center;
	}
}
