/* ============================================================
   PRODUCT CARD — diseño moderno claro (terracota)
   Se aplica a .product-card en inicio, tienda y productos
   relacionados (item-detalle). Respeta las clases obligatorias
   usadas por public/js/main.js.
   ============================================================ */

.product-card {
	position: relative;
	display: flex;
	flex-direction: column;
	height: 100%;
	background: #ffffff;
	border: 1px solid #ece5db;
	border-radius: 24px;
	overflow: hidden;
	margin-bottom: 18px;
	transition: box-shadow 0.25s ease, transform 0.25s ease, border-color 0.25s ease;
	box-shadow: 0 6px 22px rgba(80, 60, 30, 0.06);
}

.product-card:hover {
	transform: translateY(-4px);
	box-shadow: 0 18px 40px rgba(80, 60, 30, 0.12);
	border-color: #e3d5c3;
}

/* ---- Media (imagen) sobre degradé beige/arena ---- */
.product-card__media {
	position: relative;
	display: flex;
	align-items: center;
	justify-content: center;
	overflow: hidden;
	background: linear-gradient(160deg, #f4ece1, #e6d9c5);
	text-decoration: none;
	aspect-ratio: 3 / 4;
	width: 100%;
}

.product-card__media picture,
.product-card__media svg {
	display: flex;
	width: 100%;
	height: 100%;
}

.product-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
	transition: transform 0.4s ease;
	filter: drop-shadow(0 10px 18px rgba(96, 70, 40, 0.18));
}

.product-card:hover .product-card__media img {
	transform: scale(1.05);
}

.product-card__media svg {
	width: 74px;
	height: 74px;
	opacity: 0.6;
	color: #1c1912;
}

/* Slides de imagen para rotación mobile y hover desktop.
   Todas las imágenes apiladas, solo .active es visible. */
.product-card__media-slide {
	position: absolute;
	inset: 0;
	width: 100%;
	height: 100%;
	object-fit: cover;
	opacity: 0;
	transition: opacity 1.8s cubic-bezier(0.25, 0.1, 0.25, 1);
	will-change: opacity;
	pointer-events: none;
}
.product-card__media-slide.active {
	opacity: 1;
}

/* Desktop hover: muestra la segunda imagen */
@media (hover: hover) and (pointer: fine) {
	.product-card:hover .product-card__media-slide.active {
		opacity: 0;
	}
	.product-card:hover .product-card__media-slide--hover {
		opacity: 1;
	}
}

/* ---- Cartel OFERTA (terracota, solo si hay oferta) ---- */
.product-card__badge {
	position: absolute;
	top: 16px;
	left: 16px;
	z-index: 3;
	background: linear-gradient(135deg, #e0774d, #c95d35);
	color: #fff;
	font-family: var(--e404-font-sans, 'Poppins'), sans-serif;
	font-size: 11px;
	font-weight: 700;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	padding: 6px 12px;
	border-radius: 999px;
	box-shadow: 0 6px 16px rgba(201, 93, 53, 0.35);
}

/* ---- Botón de favoritos (corazón) flotante vidrio ---- */
.product-card__fav {
	position: absolute;
	top: 14px;
	right: 14px;
	z-index: 4;
	width: 42px;
	height: 42px;
	border-radius: 50%;
	display: flex;
	align-items: center;
	justify-content: center;
	background: rgba(255, 255, 255, 0.72);
	-webkit-backdrop-filter: blur(8px);
	backdrop-filter: blur(8px);
	border: 1px solid rgba(255, 255, 255, 0.85);
	box-shadow: 0 6px 18px rgba(80, 60, 30, 0.14);
	color: #b8a88c;
	text-decoration: none;
	font-size: 20px;
	line-height: 1;
	transition: color 0.2s ease, transform 0.2s ease, box-shadow 0.2s ease;
}

.product-card__fav:hover {
	color: #e02b3c;
	transform: scale(1.08);
}

.product-card__fav .heart-icon {
	position: relative;
	display: inline-flex;
	width: 21px;
	height: 21px;
}

.product-card__fav .heart-icon i {
	position: absolute;
	inset: 0;
	display: flex;
	align-items: center;
	justify-content: center;
	font-style: normal;
	line-height: 1;
	transition: opacity 0.22s ease, transform 0.28s cubic-bezier(0.34, 1.56, 0.64, 1);
}

.product-card__fav .product-card__heart-full {
	opacity: 0;
	transform: scale(0.35) rotate(-12deg);
	color: #e02b3c;
}

.product-card__fav .product-card__heart-empty {
	opacity: 1;
	transform: scale(1) rotate(0);
}

.product-card__fav.product__card__fav--active .product-card__heart-full {
	opacity: 1;
	transform: scale(1) rotate(0);
	color: #e02b3c !important;
}

.product-card__fav.product__card__fav--active .product-card__heart-empty {
	opacity: 0;
	transform: scale(0.35);
}

/* Mini "pop" al hacer click en favoritos (clase añadida por JS) */
.product-card__fav .heart-icon.product__card__fav--added {
	animation: productCardHeartPop 0.5s cubic-bezier(0.34, 1.56, 0.64, 1);
}

@keyframes productCardHeartPop {
	0%   { transform: scale(0.7); }
	45%  { transform: scale(1.4); }
	70%  { transform: scale(0.88); }
	100% { transform: scale(1); }
}

/* ---- Cuerpo ---- */
.product-card__body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding: 16px 18px 6px;
	flex: 1 1 auto;
}

.product-card__cat {
	font-family: var(--e404-font-sans, 'Poppins'), sans-serif;
	font-size: 11px;
	letter-spacing: 0.08em;
	text-transform: uppercase;
	color: #a99a86;
}

.product-card__name {
	font-family: var(--e404-font-sans, 'Poppins'), sans-serif;
	font-weight: 700;
	font-size: 15.5px;
	line-height: 1.4;
	color: #2e2a25;
	text-decoration: none;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
	height: calc(1.4em * 2);
	transition: color 0.2s ease;
}

.product-card__name:hover {
	color: #c95d35;
}

/* ---- Precio ---- */
.product-card__price {
	display: flex;
	align-items: baseline;
	flex-wrap: wrap;
	gap: 8px;
	margin-top: 6px;
}

.product-card__price-actual {
	font-family: var(--e404-font-mono, 'Space Mono'), monospace;
	font-weight: 700;
	font-size: 20px;
	color: #c95d35;
	line-height: 1.1;
}

.product-card__price-anterior {
	font-family: var(--e404-font-mono, 'Space Mono'), monospace;
	font-size: 13.5px;
	color: #bbb0a1;
	text-decoration: line-through;
}

/* ---- Acciones ---- */
.product-card__actions {
	padding: 8px 18px 18px;
	margin-top: auto;
}

.product-card__actions-row {
	display: flex;
	align-items: center;
	gap: 10px;
}

/* Selector de cantidad píldora */
.product-card__qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid #e7dfd3;
	border-radius: 999px;
	padding: 3px;
	background: #fff;
	flex-shrink: 0;
}

.product-card__qty .qtybtn {
	width: 30px;
	height: 30px;
	display: flex;
	align-items: center;
	justify-content: center;
	border-radius: 50%;
	color: #8a7a66;
	font-size: 16px;
	font-weight: 600;
	cursor: pointer;
	user-select: none;
	transition: background 0.2s ease, color 0.2s ease;
}

.product-card__qty .qtybtn:hover {
	background: #f3ece1;
	color: #c95d35;
}

.product-card__qty input {
	width: 34px;
	text-align: center;
	border: none;
	background: transparent;
	font-family: var(--e404-font-sans, 'Poppins'), sans-serif;
	font-size: 14px;
	font-weight: 600;
	color: #2e2a25;
	outline: none;
}

/* Botón Añadir terracota */
.product-card__add {
	flex: 1 1 auto;
	min-width: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 7px;
	padding: 11px 12px;
	border-radius: 999px;
	border: none;
	background: linear-gradient(135deg, #e0774d, #c95d35);
	color: #fff;
	font-family: var(--e404-font-sans, 'Poppins'), sans-serif;
	font-size: 13.5px;
	font-weight: 600;
	line-height: 1;
	white-space: nowrap;
	cursor: pointer;
	transition: transform 0.18s ease, box-shadow 0.18s ease, background 0.2s ease, opacity 0.2s ease;
	box-shadow: 0 6px 16px rgba(201, 93, 53, 0.3);
	min-height: 44px;
}

.product-card__add i {
	font-size: 15px;
}

.product-card__add:hover {
	transform: translateY(-2px);
	box-shadow: 0 10px 22px rgba(201, 93, 53, 0.38);
	background: linear-gradient(135deg, #e98a5f, #d2683e);
}

.product-card__add:active {
	transform: scale(0.96);
}

/* Estructura del check "Agregado ✓" (oculto por defecto) */
.product-card__add .product-card__add-check {
	display: none;
}

/* Micro-animación al agregar al carrito (añade clase desde JS) */
.product-card__add.product-card__add--added {
	background: #3f9d63;
	box-shadow: 0 6px 16px rgba(63, 157, 99, 0.32);
	animation: productCardAddPop 0.4s ease;
}

.product-card__add--added .product-card__add-label,
.product-card__add--added > i {
	display: none;
}

.product-card__add--added .product-card__add-check {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.product-card__add-check::before {
	content: '✓';
	font-weight: 700;
	line-height: 1;
}

@keyframes productCardAddPop {
	0%   { transform: scale(0.9); }
	50%  { transform: scale(1.06); }
	100% { transform: scale(1); }
}

/* Agotado */
.product-card__agotado,
.product-card .product__card__agotado {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex: 1 1 auto;
	min-height: 44px;
	padding: 11px 14px;
	border-radius: 999px;
	border: 1px solid #e7dfd3;
	background: #f7f3ec;
	color: #b0a391;
	font-family: var(--e404-font-sans, 'Poppins'), sans-serif;
	font-size: 13px;
	font-weight: 600;
	text-align: center;
}

/* Card en oferta: acento suave en el contorno */
.product-card:has(.product-card__badge) .product-card__media {
	background: linear-gradient(160deg, #f6e7da, #efd3bd);
}

/* ============================================================
   DARK MODE
   ============================================================ */
body.dark .product-card {
	background: #241f1c;
	border-color: #3a332e;
	box-shadow: 0 8px 26px rgba(0, 0, 0, 0.4);
}

body.dark .product-card:hover {
	border-color: #55483e;
	box-shadow: 0 18px 42px rgba(0, 0, 0, 0.55);
}

body.dark .product-card__media {
	background: linear-gradient(160deg, #2d2722, #241e19);
}

body.dark .product-card:has(.product-card__badge) .product-card__media {
	background: linear-gradient(160deg, #36271f, #2a1f19);
}

body.dark .product-card__cat { color: #8d7f6e; }
body.dark .product-card__name { color: #f0eae2; }
body.dark .product-card__name:hover { color: #e98a5f; }

body.dark .product-card__price-anterior { color: #6f6457; }

body.dark .product-card__qty {
	border-color: #3a332e;
	background: #2b2521;
}

body.dark .product-card__qty input { color: #f0eae2; }
body.dark .product-card__qty .qtybtn { color: #b7a995; }
body.dark .product-card__qty .qtybtn:hover { background: #3a332e; color: #e98a5f; }

body.dark .product-card__fav {
	background: rgba(43, 37, 33, 0.7);
	border-color: rgba(60, 52, 46, 0.8);
	color: #a99a86;
	box-shadow: 0 6px 18px rgba(0, 0, 0, 0.4);
}

body.dark .product-card__fav .product-card__heart-full {
	color: #ff5a5a;
}

body.dark .product-card__fav.product__card__fav--active .product-card__heart-full {
	color: #ff5a5a !important;
}

body.dark .product-card__agotado,
body.dark .product-card .product__card__agotado {
	background: #2b2521;
	border-color: #3a332e;
	color: #8d7f6e;
}

/* ============================================================
   RESPONSIVE — fila cantidad + botón Añadir
   Las columnas son col-6 col-md-4 col-lg-3. En grillas angostas
   (md y menores) el botón muestra solo el ícono del carrito para
   que nada se corte y ambos elementos compartan el ancho.
   ============================================================ */

/* Ancho medio (md-) y móvil: tarjetas angostas -> solo ícono del carrito */
@media (max-width: 991.98px) {

	.product-card__actions-row {
		gap: 8px;
	}

	.product-card__qty {
		flex-shrink: 0;
	}

	/* Oculto el texto "Añadir"; queda solo el ícono del carrito */
	.product-card__add .product-card__add-label {
		display: none;
	}

	.product-card__add {
		gap: 0;
		padding: 11px 10px;
	}

	/* En el estado "agregado" se muestra solo el "✓" */
	.product-card__add--added .product-card__add-check {
		font-size: 0;
		gap: 0;
	}

	.product-card__add--added .product-card__add-check::before {
		font-size: 16px;
		margin-right: 0;
	}

	/* Muy angosto: achico la píldora de cantidad */
	@media (max-width: 575.98px) {
		.product-card__qty .qtybtn {
			width: 27px;
			height: 27px;
		}

		.product-card__qty input {
			width: 28px;
			font-size: 13px;
		}
	}
}

/* ============================================================
   TIENDA GRID — fila inferior en dos filas
   Solo para la grilla de tienda (#tienda-productos-grid).
   Selector de cantidad en su propia fila (arriba, ancho de
   contenido) y botón "AÑADIR" al 100% del ancho debajo, con
   10px de separación entre filas. El resto del card no cambia.
   ============================================================ */

#tienda-productos-grid .product-card__actions-row {
	display: flex;
	flex-direction: column;
	align-items: stretch;
	gap: 10px;
}

#tienda-productos-grid .product-card__qty {
	align-self: flex-start;
	flex-shrink: 1;
}

#tienda-productos-grid .product-card__add {
	width: 100%;
	flex: 1 0 100%;
	gap: 7px;
	padding: 11px 12px;
}

#tienda-productos-grid .product-card__add-label {
	text-transform: uppercase;
	display: inline-flex;
}

#tienda-productos-grid .product-card__add--added .product-card__add-check {
	font-size: inherit;
	gap: 6px;
}

#tienda-productos-grid .product-card__add--added .product-card__add-check::before {
	font-size: inherit;
	margin-right: 0;
}

#tienda-productos-grid .product-card .product__card__agotado {
	width: 100%;
}

