/* UG Carrito WhatsApp */

.ugwc-cart,
.ugwc-portal {
	--_font: var(--ugwc-font, inherit);
	--_bg: var(--ugwc-panel-bg, #ffffff);
	--_text: var(--ugwc-text, #111111);
	--_muted: var(--ugwc-muted, #6b7280);
	--_line: var(--ugwc-line, #e5e7eb);
	--_accent: var(--ugwc-btn-bg, #111111);
	--_btn-color: var(--ugwc-btn-color, #ffffff);
	--_wa-bg: var(--ugwc-wa-bg, #ecfdf3);
	--_wa-border: var(--ugwc-wa-border, #86efac);
	--_wa-color: var(--ugwc-wa-color, #111111);
	--_green: var(--ugwc-green, #22c55e);
	--_radius: var(--ugwc-radius, 14px);
}

.ugwc-lock,
.ugwc-lock body {
	overflow: hidden;
}

/* ---------- Agregar al carrito ---------- */

.ugwc-add {
	display: flex;
	flex-direction: column;
	gap: 12px;
	align-items: var(--ugwc-align, flex-start);
}

.ugwc-add__price {
	font-size: 1.25em;
	font-weight: 700;
}

.ugwc-add__options {
	display: flex;
	flex-direction: column;
	gap: 14px;
	width: 100%;
	align-items: var(--ugwc-align, flex-start);
}

.ugwc-add__option {
	display: flex;
	flex-direction: column;
	gap: 8px;
	margin: 0;
	padding: 2px;
	border-radius: 8px;
	align-items: inherit;
}

.ugwc-add__option.is-invalid {
	outline: 2px solid #e11d48;
	outline-offset: 4px;
}

.ugwc-add__option-label {
	font-weight: 600;
	font-size: .9em;
	margin: 0;
}

.ugwc-add__selected {
	font-weight: 400;
}

.ugwc-add__option select {
	min-width: 160px;
	padding: 8px 10px;
	border: 1px solid var(--ugwc-field-border, #d0d7de);
	border-radius: 8px;
	background: #fff;
	font: inherit;
}

.ugwc-swatches {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.ugwc-swatch {
	min-width: 44px;
	height: 38px;
	padding: 0 14px;
	border: 1px solid var(--ugwc-field-border, #d0d7de);
	border-radius: 8px;
	background: #fff;
	color: #1f2328;
	font: inherit;
	font-size: .9em;
	line-height: 1;
	cursor: pointer;
	transition: border-color .15s, box-shadow .15s;
}

.ugwc-swatch:hover {
	border-color: var(--ugwc-active, #111);
}

.ugwc-swatch[aria-checked="true"] {
	border-color: var(--ugwc-active, #111);
	box-shadow: inset 0 0 0 1px var(--ugwc-active, #111);
	font-weight: 600;
}

.ugwc-swatches--color .ugwc-swatch {
	width: var(--ugwc-swatch, 32px);
	height: var(--ugwc-swatch, 32px);
	min-width: 0;
	padding: 0;
	border: 2px solid #fff;
	border-radius: 50%;
	background: var(--ugwc-sw, #ccc);
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .25);
}

.ugwc-swatches--color .ugwc-swatch[aria-checked="true"] {
	box-shadow: 0 0 0 2px var(--ugwc-active, #111);
}

.ugwc-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	overflow: hidden;
	clip: rect(0 0 0 0);
	white-space: nowrap;
}

/* Precio por unidad / por docena */
.ugwc-tiers {
	display: grid;
	grid-template-columns: repeat(auto-fit, minmax(150px, 1fr));
	gap: 8px;
	width: 100%;
	max-width: 420px;
}

.ugwc-tier {
	display: flex;
	flex-direction: column;
	align-items: flex-start;
	gap: 2px;
	margin: 0;
	padding: 10px 14px;
	border: 1px solid var(--ugwc-tier-border, #e5e7eb);
	border-radius: 10px;
	background: var(--ugwc-tier-bg, #fff);
	color: #1f2328;
	font: inherit;
	text-align: left;
	line-height: 1.3;
	transition: border-color .15s, background-color .15s, box-shadow .15s;
}

button.ugwc-tier {
	cursor: pointer;
}

.ugwc-tier.is-active {
	border-color: var(--ugwc-tier-active-border, #16a34a);
	background: var(--ugwc-tier-active-bg, #f0fdf4);
	box-shadow: inset 0 0 0 1px var(--ugwc-tier-active-border, #16a34a);
}

.ugwc-tier__label {
	font-size: 12.5px;
	color: #4b5563;
}

.ugwc-tier__label small {
	display: block;
	font-size: 11.5px;
	color: #6b7280;
}

.ugwc-tier__price {
	font-size: 17px;
	font-weight: 800;
}

.ugwc-tier__hint {
	grid-column: 1 / -1;
	font-size: 12.5px;
	color: var(--ugwc-tier-hint, #b45309);
}

.ugwc-tier__hint.is-applied {
	color: var(--ugwc-tier-active-border, #16a34a);
	font-weight: 600;
}

.ugwc-tier__hint:empty {
	display: none;
}

.ugwc-add__error {
	color: #e11d48;
	font-size: .9em;
}

.ugwc-add__error[hidden] {
	display: none;
}

/* Aviso solo en el editor */
.ugwc-detect {
	display: flex;
	flex-wrap: wrap;
	gap: 4px 12px;
	width: 100%;
	padding: 8px 10px;
	border: 1px dashed #93003c;
	border-radius: 6px;
	background: #fdf2f7;
	color: #3b0a20;
	font-size: 12px;
	line-height: 1.4;
}

.ugwc-detect strong,
.ugwc-detect em {
	flex-basis: 100%;
}

.ugwc-detect .is-missing {
	color: #c00;
}

.ugwc-add__row {
	display: flex;
	gap: 10px;
	align-items: stretch;
	flex-wrap: wrap;
	width: 100%;
	justify-content: var(--ugwc-align, flex-start);
}

.ugwc-add__btn {
	flex-grow: var(--ugwc-grow, 0);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 12px 22px;
	border: 0;
	border-radius: 8px;
	background: #111;
	color: #fff;
	font: inherit;
	font-weight: 600;
	line-height: 1.2;
	cursor: pointer;
	transition: background-color .2s, color .2s, transform .1s;
}

.ugwc-add__btn:active {
	transform: scale(.98);
}

.ugwc-add__btn.is-added {
	background: #1f9d55;
}

.ugwc-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid var(--ugwc-field-border, #d0d7de);
	border-radius: 8px;
	overflow: hidden;
	background: #fff;
	color: #1f2328;
}

.ugwc-qty button {
	width: 38px;
	align-self: stretch;
	border: 0;
	background: transparent;
	color: inherit;
	font-size: 18px;
	line-height: 1;
	cursor: pointer;
	padding: 0;
}

.ugwc-qty button:hover {
	background: rgba(0, 0, 0, .06);
}

.ugwc-qty input {
	width: 44px;
	border: 0;
	text-align: center;
	font: inherit;
	padding: 10px 0;
	background: transparent;
	color: inherit;
	-moz-appearance: textfield;
}

.ugwc-qty input::-webkit-outer-spin-button,
.ugwc-qty input::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

/* ---------- Botón del carrito ---------- */

.ugwc-toggle {
	--ugwc-icon-size: 22px;
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 10px;
	padding: 8px;
	border: 0;
	background: transparent;
	color: inherit;
	font: inherit;
	cursor: pointer;
	line-height: 1;
}

.ugwc-toggle__icon {
	position: relative;
	display: inline-flex;
	font-size: var(--ugwc-icon-size);
}

.ugwc-toggle__icon svg {
	width: var(--ugwc-icon-size);
	height: var(--ugwc-icon-size);
	fill: currentColor;
}

.ugwc-badge {
	position: absolute;
	top: -8px;
	right: -10px;
	min-width: 19px;
	height: 19px;
	padding: 0 5px;
	border-radius: 999px;
	background: #e11d48;
	color: #fff;
	font-size: 11px;
	font-weight: 700;
	line-height: 19px;
	text-align: center;
	box-sizing: border-box;
	transition: transform .2s;
}

.ugwc-badge.is-empty {
	transform: scale(0);
}

.ugwc-cart--floating .ugwc-toggle {
	position: fixed;
	z-index: 99990;
	bottom: var(--ugwc-offset-y, 24px);
	right: var(--ugwc-offset-x, 24px);
	padding: 18px;
	border-radius: 999px;
	background: var(--_accent);
	color: #fff;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .22);
}

.ugwc-cart--floating.ugwc-side--left .ugwc-toggle {
	right: auto;
	left: var(--ugwc-offset-x, 24px);
}

.ugwc-cart--floating.is-hidden .ugwc-toggle {
	display: none;
}

/* ---------- Panel ---------- */

.ugwc-panel {
	display: flex;
	flex-direction: column;
	background: var(--_bg);
	color: var(--_text);
	font-family: var(--_font);
	box-sizing: border-box;
	-webkit-font-smoothing: antialiased;
}

.ugwc-panel *,
.ugwc-panel *::before,
.ugwc-panel *::after {
	box-sizing: border-box;
}

.ugwc-panel svg {
	display: block;
	flex: 0 0 auto;
}

.ugwc-panel button,
.ugwc-panel input,
.ugwc-panel textarea {
	font-family: inherit;
}

/* Panel lateral (flotante / header) */
.ugwc-cart--floating .ugwc-panel,
.ugwc-cart--inline .ugwc-panel,
.ugwc-panel.ugwc-portal {
	position: fixed;
	z-index: 99999;
	top: 0;
	right: 0;
	bottom: 0;
	width: min(var(--ugwc-panel-width, 450px), 100vw);
	overflow-y: auto;
	overscroll-behavior: contain;
	box-shadow: -12px 0 40px rgba(0, 0, 0, .16);
	transform: translateX(100%);
	transition: transform .32s cubic-bezier(.4, 0, .2, 1);
}

.ugwc-panel.is-open {
	transform: translateX(0);
}

.ugwc-panel[hidden],
.ugwc-overlay[hidden],
.ugwc-panel [hidden] {
	display: none !important;
}

.ugwc-overlay {
	position: fixed;
	inset: 0;
	z-index: 99998;
	background: rgba(17, 17, 17, .45);
	opacity: 0;
	transition: opacity .32s ease;
}

.ugwc-overlay.is-open {
	opacity: 1;
}

/* Lista dentro de la página */
.ugwc-cart--page .ugwc-panel {
	border: 1px solid var(--_line);
	border-radius: var(--_radius);
	min-height: 420px;
}

/* Cabecera */
.ugwc-head {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 18px 24px;
}

.ugwc-head__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 38px;
	height: 38px;
	border-radius: 50%;
	background: var(--ugwc-head-icon-bg, #f1f1f1);
	color: var(--ugwc-head-icon-color, var(--_text));
}

.ugwc-head__icon svg {
	width: 18px;
	height: 18px;
}

.ugwc-head__text {
	flex: 1;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.ugwc-head__title {
	margin: 0;
	padding: 0;
	font-family: inherit;
	font-size: 17px;
	font-weight: 700;
	line-height: 1.25;
	letter-spacing: 0;
	text-transform: none;
	color: var(--_text);
}

.ugwc-head__count {
	font-size: 13px;
	color: var(--_muted);
	line-height: 1.3;
}

.ugwc-head__count:empty {
	display: none;
}

.ugwc-head__close {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--ugwc-close-size, 36px);
	height: var(--ugwc-close-size, 36px);
	margin-right: -8px;
	padding: 0;
	border: 1px solid var(--ugwc-close-border, transparent);
	border-radius: 50%;
	background: var(--ugwc-close-bg, transparent);
	color: var(--ugwc-close-color, #4b5563);
	cursor: pointer;
	transition: background-color .15s, color .15s, border-color .15s;
}

.ugwc-head__close:hover {
	background: var(--ugwc-close-hover-bg, #f3f4f6);
	color: var(--ugwc-close-hover-color, var(--ugwc-close-color, #4b5563));
	border-color: var(--ugwc-close-hover-border, var(--ugwc-close-border, transparent));
}

.ugwc-head__close:focus {
	outline: none;
}

.ugwc-head__close:focus-visible {
	outline: 2px solid var(--_line);
	outline-offset: 1px;
}

.ugwc-head__close svg {
	width: 20px;
	height: 20px;
}

/* Lista */
/* En pantallas bajas la lista conserva un mínimo y el panel completo pasa a desplazarse. */
.ugwc-panel__body {
	flex: 1 1 auto;
	min-height: 170px;
	overflow-y: auto;
	padding: 8px 24px 16px;
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.ugwc-item {
	position: relative;
	display: flex;
	gap: 14px;
	padding: 16px;
	border: 1px solid var(--_line);
	border-radius: var(--_radius);
	background: var(--_bg);
}

.ugwc-item__img {
	width: 76px;
	height: 76px;
	flex: 0 0 76px;
	object-fit: contain;
	border-radius: 8px;
	background: #fff;
}

.ugwc-item__info {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 4px;
	padding-right: 18px;
}

.ugwc-item__name {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.ugwc-item__meta,
.ugwc-item__unit {
	font-size: 12.5px;
	color: var(--_muted);
	line-height: 1.35;
}

.ugwc-item__badge {
	align-self: flex-start;
	padding: 2px 8px;
	border-radius: 999px;
	background: #dcfce7;
	color: #15803d;
	font-size: 11px;
	font-weight: 700;
}

.ugwc-item__hint {
	font-size: 12px;
	color: #b45309;
	line-height: 1.35;
}

.ugwc-item__bottom {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	margin-top: 6px;
	padding-right: 0;
	margin-right: -18px;
}

.ugwc-item__total {
	font-size: 15px;
	font-weight: 800;
	white-space: nowrap;
}

.ugwc-item__remove {
	position: absolute;
	top: 12px;
	right: 10px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: transparent;
	color: #9ca3af;
	cursor: pointer;
	transition: color .15s, background-color .15s;
}

.ugwc-item__remove:hover {
	color: #e11d48;
	background: #fff1f2;
}

.ugwc-item__remove svg {
	width: 16px;
	height: 16px;
}

.ugwc-qty--pill {
	border: 1px solid var(--_line);
	border-radius: 999px;
	background: transparent;
	color: var(--_text);
}

.ugwc-qty--pill button {
	width: 32px;
	height: 30px;
	font-size: 16px;
	color: #6b7280;
	border-radius: 999px;
}

.ugwc-qty--pill button:hover {
	background: #f3f4f6;
	color: var(--_text);
}

.ugwc-qty--pill span {
	min-width: 26px;
	text-align: center;
	font-size: 14px;
	font-weight: 600;
}

/* Carrito vacío */
.ugwc-empty {
	flex: 1;
	display: flex;
	flex-direction: column;
	align-items: center;
	padding: 72px 32px 40px;
	text-align: center;
}

.ugwc-empty__icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 96px;
	height: 96px;
	margin-bottom: 22px;
	border-radius: 50%;
	background: linear-gradient(145deg, #f5f5f5, #e9e9e9);
	color: #374151;
}

.ugwc-empty__icon svg {
	width: 38px;
	height: 38px;
}

.ugwc-empty__title {
	margin: 0 0 6px;
	font-size: 18px;
	font-weight: 700;
	color: var(--_text);
}

.ugwc-empty__text {
	margin: 0 0 22px;
	font-size: 14px;
	color: var(--_muted);
}

/* Pie */
.ugwc-panel__foot {
	display: flex;
	flex-direction: column;
	gap: 10px;
	padding: 18px 24px 18px;
	border-top: 1px solid var(--_line);
}

.ugwc-row {
	display: flex;
	justify-content: space-between;
	align-items: baseline;
	gap: 12px;
}

.ugwc-row--sub {
	font-size: 14px;
	color: var(--_muted);
}

.ugwc-row--total span {
	font-size: 16px;
	font-weight: 700;
}

.ugwc-row--total strong {
	font-size: 24px;
	font-weight: 800;
	letter-spacing: -.01em;
}

.ugwc-note {
	margin: 0 0 6px;
	font-size: 12px;
	color: var(--_muted);
}

.ugwc-field {
	width: 100%;
	padding: 11px 14px;
	border: 1px solid var(--_line);
	border-radius: 12px;
	background: transparent;
	color: inherit;
	font: inherit;
	font-size: 14px;
	resize: vertical;
}

.ugwc-field:focus {
	outline: 2px solid var(--_accent);
	outline-offset: 1px;
}

.ugwc-field.is-invalid {
	border-color: #e11d48;
	outline-color: #e11d48;
}

.ugwc-actions {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.ugwc-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 48px;
	padding: 12px 22px;
	border: 1px solid transparent;
	border-radius: 999px;
	font: inherit;
	font-size: 15px;
	font-weight: 700;
	line-height: 1.2;
	text-decoration: none !important;
	cursor: pointer;
	transition: filter .15s, transform .1s, background-color .15s;
}

.ugwc-btn:active {
	transform: scale(.99);
}

.ugwc-btn svg {
	width: 18px;
	height: 18px;
}

.ugwc-btn--auto {
	width: auto;
	min-height: 44px;
	padding: 10px 28px;
	font-weight: 500;
}

.ugwc-btn--dark,
.ugwc-btn--dark:visited {
	background: var(--_accent);
	border-color: var(--ugwc-btn-border, transparent);
	color: var(--_btn-color) !important;
}

/* Sin colores de hover elegidos se aclara el color normal; al elegirlos, el filtro se anula. */
.ugwc-btn--dark:hover,
.ugwc-btn--dark:focus-visible {
	background: var(--ugwc-btn-hover-bg, var(--_accent));
	border-color: var(--ugwc-btn-hover-border, var(--ugwc-btn-border, transparent));
	color: var(--ugwc-btn-hover-color, var(--_btn-color)) !important;
	filter: var(--ugwc-btn-hover-filter, brightness(1.35));
}

.ugwc-btn--wa {
	background: var(--_wa-bg);
	border-color: var(--_wa-border);
	color: var(--_wa-color);
	font-size: 14.5px;
	min-height: 44px;
}

.ugwc-btn--wa:hover,
.ugwc-btn--wa:focus-visible {
	background: var(--ugwc-wa-hover-bg, var(--_wa-bg));
	border-color: var(--ugwc-wa-hover-border, var(--_wa-border));
	color: var(--ugwc-wa-hover-color, var(--_wa-color));
	filter: var(--ugwc-wa-hover-filter, brightness(.97));
}

.ugwc-btn__wa-icon {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 22px;
	height: 22px;
	border-radius: 50%;
	background: var(--_green);
	color: #fff;
}

.ugwc-btn__wa-icon svg {
	width: 15px;
	height: 15px;
}

.ugwc-link {
	align-self: center;
	padding: 4px 8px;
	border: 0;
	background: transparent;
	color: var(--ugwc-link-color, #4b5563) !important;
	font: inherit;
	font-size: 14px;
	font-weight: 500;
	text-decoration: none !important;
	cursor: pointer;
}

.ugwc-link:hover {
	color: var(--ugwc-link-hover-color, var(--_text)) !important;
	text-decoration: underline !important;
}

.ugwc-badges {
	display: flex;
	justify-content: center;
	flex-wrap: wrap;
	gap: 8px 22px;
	margin-top: 4px;
	padding-top: 14px;
	border-top: 1px solid var(--_line);
	font-size: 12px;
	color: var(--_muted);
}

.ugwc-badges span {
	display: inline-flex;
	align-items: center;
	gap: 6px;
}

.ugwc-badges svg {
	width: 15px;
	height: 15px;
	color: var(--_green);
}

@media (max-width: 480px) {
	.ugwc-head,
	.ugwc-panel__foot {
		padding-left: 18px;
		padding-right: 18px;
	}

	.ugwc-panel__body {
		padding-left: 18px;
		padding-right: 18px;
	}

	.ugwc-item__img {
		width: 64px;
		height: 64px;
		flex-basis: 64px;
	}
}

/* ---------- Toast ---------- */

.ugwc-toast {
	position: fixed;
	z-index: 100000;
	left: 50%;
	bottom: 24px;
	transform: translate(-50%, 20px);
	padding: 10px 18px;
	border-radius: 999px;
	background: #1f2328;
	color: #fff;
	font-size: 14px;
	opacity: 0;
	pointer-events: none;
	transition: opacity .25s, transform .25s;
}

.ugwc-toast.is-visible {
	opacity: 1;
	transform: translate(-50%, 0);
}

@media (prefers-reduced-motion: reduce) {
	.ugwc-panel,
	.ugwc-overlay,
	.ugwc-toast,
	.ugwc-badge {
		transition: none;
	}
}
