/* WC Enhanced - Frontend styles
 * Version: 0.2.0
 */

/* Basic Side Cart widget trigger */
.wce-side-cart {
	display: inline-block;
	line-height: 1;
}

.wce-side-cart button:hover{
	background:transparent;
}

.wce-side-cart__button svg {
	fill: currentColor;
	stroke: currentColor;
}

.wce-side-cart__button {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	border: 0;
	background: transparent;
	padding: 0;
	cursor: pointer;
}

.wce-side-cart__icon-wrap {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
}

.wce-side-cart__icon-wrap svg {
	width: 1em;
	height: 1em;
	display: block;
	position: relative;
}

.wce-side-cart__badge {
	position: absolute;
	min-width: 1.6em;
	height: 1.6em;
	border-radius: 100%;
	display: block;
	font-size: 10px;
	line-height: 1.5em;
	text-align: center;
	background-color: #111;
	color: #fff;
	top: -.7em;
	inset-inline-end: -.7em;
}

.wce-side-cart__badge.is-hidden {
	display: none;
}

/* Body lock when drawer is open */
body.wce-side-cart-open {
	overflow: hidden;
}

/* Overlay */
.wce-side-cart__overlay {
	position: fixed;
	inset: 0;
	background: rgba(0, 0, 0, 0.45);
	opacity: 0;
	pointer-events: none;
	transition: opacity 220ms ease;
	z-index: 9998;
}

.wce-side-cart.is-open .wce-side-cart__overlay {
	opacity: 1;
	pointer-events: auto;
}

/* Drawer */
.wce-side-cart__drawer {
	position: fixed;
	top: 0;
	bottom: 0;
	width: min(420px, 92vw);
	background: #fff;
	z-index: 9999;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.18);
	display: flex;
	flex-direction: column;
	outline: none;
	transition: transform 260ms ease;
}

/* Right drawer */
.wce-side-cart__drawer--right {
	right: 0;
	transform: translateX(100%);
}

/* Left drawer */
.wce-side-cart__drawer--left {
	left: 0;
	transform: translateX(-100%);
}

.wce-side-cart.is-open .wce-side-cart__drawer--right,
.wce-side-cart.is-open .wce-side-cart__drawer--left {
	transform: translateX(0);
}

/* Header */
.wce-side-cart__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 18px 18px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
}

.wce-side-cart__header--close-left {
	flex-direction: row-reverse;
	justify-content: flex-end;
}

.wce-side-cart__title,
.wce-side-cart-title {
	margin: 0;
	align-self: center;
	font-size: 22px;
	line-height: 1.2;
	font-weight: 500;
}

.wce-side-cart__close,
.wce-side-cart-close {
	border: 0;
	background: transparent;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	padding: 0;
}

.wce-side-cart__close-default {
	font-size: 22px;
	line-height: 1;
	display: inline-block;
}

/* Body (scrollable) */
.wce-side-cart__body {
	padding: 16px 18px;
	overflow: auto;
	flex: 1 1 auto;
}

/* Products list */
.wce-side-cart-products {
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.wce-side-cart-empty {
	margin: 0;
	padding: 12px 0;
	opacity: 0.75;
}

/* Product row */
.wce-side-cart-product {
	display: flex;
	gap: 12px;
	align-items: center;
}

.wce-side-cart-img {
	flex: 0 0 72px;
	width: 72px;
}

.wce-side-cart-img__img {
	width: 72px;
	height: 72px;
	object-fit: cover;
	border-radius: 8px;
	display: block;
}

.wce-side-cart-sum {
	flex: 1 1 auto;
	display: flex;
	justify-content: space-between;
	gap: 10px;
	min-width: 0;
}

.wce-side-cart-sum__info {
	min-width: 0;
}

.wce-side-cart-product__name {
	display: inline-block;
	text-decoration: none;
	font-size: 14px;
	line-height: 1.25;
	font-weight: 500;
	color: #111;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 220px;
}

.wce-side-cart-product__meta {
	margin-top: 4px;
	font-size: 12px;
	opacity: 0.75;
	white-space: nowrap;
	overflow: hidden;
	text-overflow: ellipsis;
	max-width: 220px;
}

.wce-side-cart-product__price-row {
	margin-top: 8px;
	display: flex;
	align-items: baseline;
	gap: 10px;
}

.wce-side-cart-product__qty {
	font-size: 12px;
	opacity: 0.75;
}

.wce-side-cart-product__price {
	font-size: 14px;
	font-weight: 600;
}

.wce-side-cart-remove {
	display: flex;
	align-items: center;
	justify-content: center;
	align-self: center;
}

.wce-side-cart-remove__link {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 34px;
	height: 34px;
	border-radius: 8px;
	text-decoration: none;
	color: #111;
	opacity: 0.8;
}

.wce-side-cart .wce-side-cart-remove__link.remove {
	display: inline-flex;
	width: 34px;
	height: 34px;
	line-height: 1;
	font-size: inherit;
	border: 0;
	border-radius: 8px;
	color: var(--wc-red, #cc1818);
	background: transparent;
	transition: background-color 0.2s ease, color 0.2s ease, opacity 0.2s ease;
}

.wce-side-cart-remove__link:hover {
	opacity: 1;
}

.wce-side-cart .wce-side-cart-remove__link.remove:hover,
.wce-side-cart .wce-side-cart-remove__link.remove:focus-visible {
	background: var(--wc-red, #cc1818);
	color: #fff;
}

.wce-side-cart-remove__icon {
	display: block;
	width: 18px;
	height: 18px;
	fill: currentColor;
}

/* Footer fixed (drawer bottom) */
.wce-side-cart__footer {
	flex: 0 0 auto;
	display: grid;
	grid-template-columns: 1fr;
	gap: 12px;
	padding: 16px 18px 18px;
	border-top: 1px solid rgba(0, 0, 0, 0.08);
	background: #fff;
}

/* Totals */
.wce-side-cart-totals {
	display: flex;
	flex-direction: column;
	gap: 8px;
}

.wce-side-cart-totals__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	font-size: 14px;
}

.wce-side-cart-totals__row--total {
	font-weight: 700;
}

/* Buttons */
.wce-side-cart-buttons {
	display: grid;
	grid-template-columns: 1fr;
	gap: 10px;
}

.wce-side-cart__btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	text-decoration: none;
	padding: 12px 14px;
	font-size: 14px;
	border-radius: 8px;
	border: 1px solid #111;
	color: #111;
	background: #fff;
	transition: opacity 160ms ease;
}

.wce-side-cart__btn:hover {
	opacity: 0.9;
}

.wce-side-cart__btn--checkout {
	background: #111;
	color: #fff;
}

/* Admin bar offset */
:root {
	--wce-admin-bar-offset: 0px;
}

body.admin-bar {
	--wce-admin-bar-offset: var(--wp-admin--admin-bar--height, 32px);
}

@media screen and (max-width: 782px) {
	body.admin-bar {
		--wce-admin-bar-offset: var(--wp-admin--admin-bar--height, 46px);
	}
}

body.admin-bar .wce-side-cart__drawer {
	top: var(--wce-admin-bar-offset);
	bottom: 0;
	height: calc(100vh - var(--wce-admin-bar-offset));
	height: calc(100dvh - var(--wce-admin-bar-offset));
}

/* Cart widget */
.wce-cart {
	display: flex;
	flex-direction: column;
	gap: 22px;
	width: 100%;
}

.wce-cart__header {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 180px 120px;
	align-items: center;
	gap: 24px;
	font-size: 15px;
	font-weight: 600;
	color: #333;
	padding-bottom: 12px;
}

.wce-cart__heading--quantity {
	text-align: center;
}

.wce-cart__heading--total {
	text-align: right;
}

.wce-cart-products {
	display: flex;
	flex-direction: column;
	gap: 22px;
}

.wce-cart-empty {
	margin: 0;
	padding: 12px 0;
	opacity: 0.75;
}

.wce-cart-product {
	display: grid;
	grid-template-columns: minmax(0, 1fr) 180px 120px;
	align-items: center;
	gap: 24px;
	padding-bottom: 16px;
}

.wce-cart-product__info {
	display: flex;
	align-items: center;
	gap: 14px;
	min-width: 0;
}

.wce-cart-product__thumb {
	flex: 0 0 96px;
	width: 96px;
}

.wce-cart-product__thumb-link {
	display: block;
}

.wce-cart-product__img {
	display: block;
	width: 100%;
	aspect-ratio: 2 / 3;
	object-fit: cover;
	border-radius: 6px;
}

.wce-cart-product__summary {
	display: flex;
	flex-direction: column;
	gap: 6px;
	min-width: 0;
}

.wce-cart-product__name {
	text-decoration: none;
	color: #111;
	font-size: 14px;
	font-weight: 500;
}

.wce-cart-product__subtotal {
	font-size: 14px;
	font-weight: 600;
	color: #111;
}

.wce-cart-product__meta {
	font-size: 12px;
	color: #666;
}

.wce-cart-product__quantity {
	display: flex;
	flex-direction: column;
	align-items: center;
	gap: 8px;
}

.wce-cart-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid #c8c8c8;
	border-radius: 6px;
	overflow: hidden;
}

.wce-cart-qty__btn {
	width: 32px;
	height: 32px;
	padding: 0;
	border: 0;
	background: transparent;
	cursor: pointer;
	font-size: 16px;
	font-weight: 700;
	color: #000;
	line-height: 1;
}

.wce-cart-qty__btn:hover {
	background-color:transparent;
	color: #000;
}

.wce-cart .wce-cart-qty__input {
	width: 36px;
	height: 32px;
	border: 0;
	padding: 0;
	text-align: center;
	font-size: 14px;
	font-weight: 700;
	outline: none;
	background: transparent;
	appearance: textfield;
}

.wce-cart-qty__input::-webkit-outer-spin-button,
.wce-cart-qty__input::-webkit-inner-spin-button {
	appearance: none;
	margin: 0;
}

.wce-cart .wce-cart-remove__link {
	font-size: 12px;
	color: #111;
	text-decoration: underline;
}

.wce-cart-product__price {
	text-align: right;
	font-size: 14px;
	font-weight: 600;
	color: #111;
}

.wce-cart__actions {
	margin-top: 12px;
}

.wce-cart__update-button {
	border: 1px solid #111;
	background: #fff;
	color: #111;
	padding: 10px 16px;
	font-size: 14px;
	cursor: pointer;
}

.wce-cart-totals {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 6px;
}

.wce-cart-totals__row {
	display: flex;
	gap: 8px;
	font-size: 15px;
	font-weight: 600;
}

.wce-cart-totals__note {
	margin: 0;
	font-size: 12px;
	color: #777;
	text-align: right;
	max-width: 320px;
}

.wce-cart__checkout {
	display: flex;
	justify-content: flex-end;
}

.wce-cart__checkout-button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 18px;
	background: #111;
	color: #fff;
	text-decoration: none;
	font-size: 14px;
	letter-spacing: 0.2px;
}

.wce-cart__checkout-button:hover {
	color: #fff;
}

/* -----------------------------
 * Mobile Cart layout overrides
 * ----------------------------- */
@media (max-width: 768px) {
	/* Hide "Producto / Cantidad / Total" titles */
	.wce-cart__header {
		display: none;
	}

	/* Mobile grid: [thumb | summary | total] and quantity under summary */
	.wce-cart-product {
		display: grid;
		grid-template-columns: 96px minmax(0, 1fr) auto;
		grid-template-rows: auto auto;
		column-gap: 14px;
		row-gap: 10px;
		align-items: start;
		padding-bottom: 16px;
	}

	/* Flatten info wrapper so thumb + summary can be placed in the grid */
	.wce-cart-product__info {
		display: contents;
	}

	.wce-cart-product__thumb {
		grid-column: 1;
		grid-row: 1 / 3;
		width: 96px;
	}

	.wce-cart-product__summary {
		grid-column: 2;
		grid-row: 1;
	}

	/* Quantity below summary */
	.wce-cart-product__quantity {
		grid-column: 2;
		grid-row: 2;
		align-items: flex-start;
	}

	/* Total on the right, vertically centered */
	.wce-cart-product__price {
		grid-column: 3;
		grid-row: 1 / 3;
		align-self: center;
		text-align: right;
	}

	/* Stretched checkout button */
	.wce-cart__checkout {
		justify-content: stretch;
	}

	.wce-cart__checkout-button {
		width: 100%;
	}
}
