/*
 * Díxome Carta · panel de personalización (inferior en móvil, centrado en escritorio) y confirmación.
 * Colores y radios: variables --dxc-* (WooCommerce → Díxome Carta · Apariencia).
 */
.dxc-panel,
.dxc-toast {
	--dxc-accent: #1f2937;
	--dxc-accent-text: #ffffff;
	--dxc-text: #1f2937;
	--dxc-muted: #6b7280;
	--dxc-border: #e5e7eb;
	--dxc-surface: #ffffff;
	--dxc-error: #b42318;
	--dxc-radius: 12px;
}

html.dxc-panel-open {
	overflow: hidden;
}

/* ---------- Contenedor ---------- */

.dxc-panel {
	position: fixed;
	inset: auto 0 0 0;
	width: 100%;
	max-width: 100%;
	max-height: 92dvh;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 22px 22px 0 0;
	background: var(--dxc-surface);
	color: var(--dxc-text);
	box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.22);
	overflow: hidden;
}

.dxc-panel[open] {
	display: flex;
	flex-direction: column;
	animation: dxc-sheet-in 0.26s cubic-bezier(0.2, 0.8, 0.2, 1);
}

.dxc-panel.is-closing {
	animation: dxc-sheet-out 0.18s ease-in forwards;
}

.dxc-panel::backdrop {
	background: rgba(17, 24, 20, 0.5);
	animation: dxc-fade-in 0.2s ease;
}

@keyframes dxc-sheet-in {
	from { transform: translateY(100%); }
	to { transform: translateY(0); }
}

@keyframes dxc-sheet-out {
	from { transform: translateY(0); }
	to { transform: translateY(100%); }
}

@keyframes dxc-fade-in {
	from { opacity: 0; }
	to { opacity: 1; }
}

.dxc-panel__inner {
	flex: 1 1 auto;
	min-height: 0;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

.dxc-panel__grabber {
	position: absolute;
	top: 8px;
	left: 50%;
	z-index: 3;
	width: 42px;
	height: 5px;
	border-radius: 999px;
	background: rgba(255, 255, 255, 0.9);
	box-shadow: 0 1px 4px rgba(0, 0, 0, 0.25);
	transform: translateX(-50%);
}

/* Selector reforzado frente a estilos globales de <button> del tema. */
.dxc-panel button.dxc-panel__close {
	position: absolute;
	top: 12px;
	right: 12px;
	z-index: 4;
	display: grid;
	place-items: center;
	width: 42px;
	height: 42px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: rgba(255, 255, 255, 0.95);
	color: var(--dxc-text);
	box-shadow: 0 2px 10px rgba(0, 0, 0, 0.18);
	font-size: 26px;
	line-height: 1;
	cursor: pointer;
}

.dxc-panel button.dxc-panel__close:hover,
.dxc-panel button.dxc-panel__close:focus-visible {
	background: #ffffff;
	color: var(--dxc-text);
	outline: 2px solid var(--dxc-accent);
	outline-offset: 2px;
}

.dxc-panel__loading,
.dxc-panel__error {
	margin: 0;
	padding: 64px 24px;
	color: var(--dxc-muted);
	text-align: center;
}

.dxc-panel__messages {
	margin: 64px 18px 0;
	padding: 12px 14px;
	border-radius: var(--dxc-radius);
	background: color-mix(in srgb, var(--dxc-error) 10%, var(--dxc-surface));
	color: var(--dxc-error);
	font-weight: 600;
}

.dxc-panel__messages p {
	margin: 0;
}

/* ---------- Producto ---------- */

.dxc-panel__media {
	background: color-mix(in srgb, var(--dxc-text) 6%, var(--dxc-surface));
}

.dxc-panel__image {
	display: block;
	width: 100%;
	height: auto;
	max-height: 34vh;
	aspect-ratio: 16 / 10;
	object-fit: cover;
}

.dxc-panel__body {
	padding: 18px 18px 0;
}

.dxc-panel .dxc-panel__title {
	margin: 0 0 6px;
	color: var(--dxc-text);
	font-size: 1.5rem;
	line-height: 1.15;
	outline: none;
}

.dxc-panel__description {
	color: var(--dxc-muted);
	font-size: 0.95rem;
	line-height: 1.45;
}

.dxc-panel__description p {
	margin: 0 0 6px;
}

.dxc-panel .dxc-panel__price {
	margin: 4px 0 16px;
	color: var(--dxc-text);
	font-size: 1.1rem;
	font-weight: 700;
}

.dxc-panel .dxc-panel__price del {
	color: var(--dxc-muted);
	font-weight: 400;
}

.dxc-panel form.cart {
	margin: 0;
	padding: 0;
}

/* El total va dentro del botón; no hace falta el resumen ni el precio de la variación. */
.dxc-panel .dxc-summary,
.dxc-panel .woocommerce-variation-price,
.dxc-panel .reset_variations {
	display: none !important;
}

.dxc-panel .woocommerce-variation-availability p {
	margin: 0 0 10px;
	color: var(--dxc-muted);
	font-size: 0.9rem;
}

/* ---------- Tamaños (variaciones) ---------- */

.dxc-panel table.variations {
	width: 100%;
	margin: 0 0 18px;
	border: 0;
	background: none;
}

.dxc-panel table.variations tr,
.dxc-panel table.variations th,
.dxc-panel table.variations td {
	display: block;
	padding: 0;
	border: 0;
	background: none;
	text-align: start;
}

.dxc-panel table.variations th label {
	display: block;
	margin: 0 0 10px;
	color: var(--dxc-text);
	font-size: 1.05rem;
	font-weight: 700;
}

.dxc-panel .dxc-has-pills select {
	position: absolute;
	width: 1px;
	height: 1px;
	opacity: 0;
	pointer-events: none;
}

.dxc-pills {
	display: flex;
	flex-wrap: wrap;
	gap: 8px;
}

.dxc-pill {
	position: relative;
	display: flex;
	flex: 1 1 0;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 2px;
	min-width: 120px;
	min-height: 60px;
	margin: 0;
	padding: 8px 12px;
	border: 1.5px solid var(--dxc-border);
	border-radius: var(--dxc-radius);
	background: var(--dxc-surface);
	color: var(--dxc-text);
	cursor: pointer;
	text-align: center;
	-webkit-tap-highlight-color: transparent;
}

.dxc-pill input {
	position: absolute;
	opacity: 0;
	pointer-events: none;
}

.dxc-pill__name {
	font-weight: 700;
}

.dxc-pill__price {
	color: var(--dxc-muted);
	font-size: 0.9rem;
}

.dxc-pill:has(input:checked) {
	border-color: var(--dxc-accent);
	background: color-mix(in srgb, var(--dxc-accent) 8%, var(--dxc-surface));
}

.dxc-pill:has(input:focus-visible) {
	outline: 2px solid var(--dxc-accent);
	outline-offset: 2px;
}

/* ---------- Barra de cantidad y botón ---------- */

.dxc-panel .dxc-form {
	margin-bottom: 8px;
}

.dxc-panel .dxc-panel__actions {
	position: sticky;
	bottom: 0;
	z-index: 2;
	display: flex;
	flex: 1 1 100%;
	align-items: stretch;
	gap: 10px;
	margin: 8px -18px 0;
	padding: 12px 18px calc(12px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--dxc-border);
	background: var(--dxc-surface);
	box-shadow: 0 -6px 18px rgba(0, 0, 0, 0.06);
}

.dxc-panel .quantity {
	display: flex;
	flex-shrink: 0;
	align-items: center;
	margin: 0;
	border: 1.5px solid var(--dxc-border);
	border-radius: var(--dxc-radius);
	background: var(--dxc-surface);
	overflow: hidden;
}

.dxc-panel .quantity .qty {
	width: 44px;
	height: 52px;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--dxc-text);
	font-size: 18px;
	font-weight: 700;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.dxc-panel .quantity .qty::-webkit-outer-spin-button,
.dxc-panel .quantity .qty::-webkit-inner-spin-button {
	-webkit-appearance: none;
	margin: 0;
}

.dxc-panel .quantity button.dxc-step {
	width: 42px;
	min-width: 42px;
	height: 52px;
	min-height: 0;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 0;
	box-shadow: none;
	background: transparent;
	color: var(--dxc-text);
	font-family: inherit;
	font-size: 22px;
	font-weight: 700;
	line-height: 1;
	cursor: pointer;
}

.dxc-panel .dxc-panel__actions .single_add_to_cart_button {
	display: flex;
	flex: 1 1 auto;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	min-height: 52px;
	margin: 0;
	padding: 12px 18px;
	border: 0;
	border-radius: var(--dxc-radius);
	background: var(--dxc-accent);
	color: var(--dxc-accent-text);
	font-family: inherit;
	font-size: 1rem;
	font-weight: 700;
	line-height: 1.2;
	cursor: pointer;
}

.dxc-panel .dxc-panel__actions .single_add_to_cart_button:only-child {
	justify-content: center;
}

.dxc-panel .dxc-panel__actions .single_add_to_cart_button:hover {
	background: color-mix(in srgb, var(--dxc-accent) 85%, #000000);
	color: var(--dxc-accent-text);
}

.dxc-panel .dxc-panel__actions .single_add_to_cart_button.disabled,
.dxc-panel .dxc-panel__actions .single_add_to_cart_button:disabled {
	opacity: 0.55;
	cursor: not-allowed;
}

.dxc-panel .dxc-panel__total {
	white-space: nowrap;
}

.dxc-is-busy {
	opacity: 0.65;
	pointer-events: none;
}

/* ---------- Escritorio: ventana centrada ---------- */

@media (min-width: 768px) {
	.dxc-panel {
		inset: 0;
		width: min(940px, 92vw);
		height: fit-content;
		max-height: min(88vh, 800px);
		margin: auto;
		border-radius: 22px;
		box-shadow: 0 24px 64px rgba(0, 0, 0, 0.28);
	}

	.dxc-panel[open] {
		animation: dxc-pop-in 0.22s cubic-bezier(0.2, 0.8, 0.2, 1);
	}

	.dxc-panel.is-closing {
		animation: dxc-pop-out 0.16s ease-in forwards;
	}

	.dxc-panel__grabber {
		display: none;
	}

	.dxc-panel__product {
		display: grid;
		grid-template-columns: minmax(0, 42%) minmax(0, 1fr);
		align-items: start;
	}

	.dxc-panel__media {
		position: sticky;
		top: 0;
		height: 100%;
	}

	.dxc-panel__image {
		max-height: none;
		height: 100%;
		min-height: 420px;
		aspect-ratio: auto;
	}

	.dxc-panel__body {
		padding: 28px 28px 0;
	}

	.dxc-panel .dxc-panel__title {
		padding-right: 48px;
		font-size: 1.75rem;
	}

	.dxc-panel .dxc-panel__actions {
		margin: 8px -28px 0;
		padding: 14px 28px 16px;
	}

	.dxc-panel__messages {
		margin: 18px 28px 0;
	}
}

@keyframes dxc-pop-in {
	from { opacity: 0; transform: translateY(12px) scale(0.98); }
	to { opacity: 1; transform: none; }
}

@keyframes dxc-pop-out {
	from { opacity: 1; transform: none; }
	to { opacity: 0; transform: translateY(8px) scale(0.98); }
}

/* ---------- Confirmación ---------- */

.dxc-toast {
	position: fixed;
	top: 12px;
	right: 0;
	left: 0;
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 14px;
	width: max-content;
	max-width: calc(100vw - 24px);
	margin-inline: auto;
	box-sizing: border-box;
	padding: 12px 16px;
	border-radius: 14px;
	background: var(--dxc-text);
	color: #ffffff;
	box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
	font-size: 0.95rem;
	font-weight: 600;
	opacity: 0;
	transform: translateY(-150%);
	transition: transform 0.25s ease, opacity 0.25s ease;
	pointer-events: none;
}

.dxc-toast.is-visible {
	opacity: 1;
	transform: translateY(0);
	pointer-events: auto;
}

.dxc-toast.is-error {
	background: var(--dxc-error);
}

.dxc-toast a {
	color: #ffffff;
	font-weight: 700;
	text-decoration: underline;
	white-space: nowrap;
}

@media (min-width: 768px) {
	.dxc-toast {
		top: auto;
		right: 24px;
		bottom: 24px;
		left: auto;
		margin: 0;
		transform: translateY(150%);
	}

	.dxc-toast.is-visible {
		transform: translateY(0);
	}
}

@media (prefers-reduced-motion: reduce) {
	.dxc-panel[open],
	.dxc-panel.is-closing,
	.dxc-panel::backdrop {
		animation: none;
	}

	.dxc-toast {
		transition: none;
	}
}
