/* =========================================================
   Carta Digital para WooCommerce
   Paleta: rojo tomate (acciones/CTA), tinta cálida casi negra
   (titulares), fondo blanco con bordes cálidos suaves.
   Tipografía: pila de fuentes del sistema (sin cargar fuentes
   externas de Google, evita avisos de privacidad/RGPD y no
   depende de la conexión). El "display" usa ui-rounded en
   dispositivos Apple para un tono más cercano y amigable.
   ========================================================= */

.cdw-wrapper,
.cdw-cart-fab,
.cdw-cart-bar,
.cdw-drawer,
.cdw-variation-modal {
	--cdw-red: #b0201f;
	--cdw-red-dark: #841818;
	--cdw-ink: #2b211c;
	--cdw-ink-soft: #6b5f57;
	--cdw-border: #ede6dd;
	--cdw-gold: #e7a33e;
	--cdw-bg: #ffffff;
	--cdw-mist: #f6f1ea;
	--cdw-radius-card: 18px;
	--cdw-radius-pill: 999px;
	--cdw-font-display: ui-rounded, "SF Pro Rounded", system-ui, -apple-system, "Segoe UI", sans-serif;
	--cdw-font-body: system-ui, -apple-system, "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
	box-sizing: border-box;
}

.cdw-wrapper *,
.cdw-cart-fab *,
.cdw-cart-bar *,
.cdw-drawer *,
.cdw-variation-modal * {
	box-sizing: border-box;
}

/* ---------- Contenedor y título ---------- */

.cdw-wrapper {
	max-width: 1180px;
	margin: 0 auto;
	padding: 24px 16px 48px;
	font-family: var(--cdw-font-body);
	color: var(--cdw-ink);
}

.cdw-title {
	font-family: var(--cdw-font-display);
	font-size: clamp(24px, 4vw, 32px);
	font-weight: 800;
	letter-spacing: -0.01em;
	margin: 0 0 18px;
	color: var(--cdw-ink);
}

/* ---------- Pestañas de categoría ---------- */

.cdw-tabs-wrap {
	position: sticky;
	top: var(--wp-admin--admin-bar--height, 0px);
	z-index: 40;
	margin: 0 0 20px;
	padding: 10px 0;
	background: rgba(255, 255, 255, 0.88);
	backdrop-filter: blur(10px);
	-webkit-backdrop-filter: blur(10px);
}

.cdw-tabs {
	display: flex;
	align-items: center;
	gap: 4px;
	overflow-x: auto;
	padding: 5px;
	background: var(--cdw-mist);
	border-radius: var(--cdw-radius-pill);
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
}

.cdw-tabs::-webkit-scrollbar {
	display: none;
}

.cdw-tab {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	flex: 0 0 auto;
	font-family: var(--cdw-font-body);
	font-size: 14px;
	font-weight: 600;
	line-height: 1;
	color: var(--cdw-ink-soft);
	background: transparent;
	border: none;
	border-radius: var(--cdw-radius-pill);
	padding: 9px 16px;
	cursor: pointer;
	transition: background-color 0.18s ease, color 0.18s ease, box-shadow 0.18s ease, transform 0.12s ease;
	white-space: nowrap;
}

.cdw-tab__icon {
	font-size: 15px;
	line-height: 1;
}

.cdw-tab:hover {
	background: rgba(176, 32, 31, 0.08);
	color: var(--cdw-red);
}

.cdw-tab.is-active {
	background: var(--cdw-red);
	color: #fff;
	box-shadow: 0 6px 16px rgba(176, 32, 31, 0.32);
	transform: translateY(-1px);
}

.cdw-tab:active {
	transform: scale(0.97);
}

/* ---------- Grid de productos ---------- */

.cdw-grid {
	display: flex;
	flex-direction: column;
	gap: 12px;
}

.cdw-empty {
	color: var(--cdw-ink-soft);
	padding: 32px 0;
}

.cdw-card {
	display: flex;
	flex-direction: row;
	background: var(--cdw-bg);
	border: 1px solid var(--cdw-border);
	border-radius: var(--cdw-radius-card);
	overflow: hidden;
}

.cdw-card__media {
	position: relative;
	flex: 0 0 108px;
	width: 108px;
}

.cdw-card__media img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.cdw-card__badge {
	position: absolute;
	top: 8px;
	left: 8px;
	background: var(--cdw-gold);
	color: var(--cdw-ink);
	font-size: 11px;
	font-weight: 700;
	padding: 3px 8px;
	border-radius: var(--cdw-radius-pill);
}

.cdw-card__badge--sale {
	left: 8px;
}

/* ---------- Tarjeta destacada (p. ej. "Al gusto") ---------- */

.cdw-card--featured {
	border: 2px solid var(--cdw-gold);
	box-shadow: 0 10px 24px rgba(231, 163, 62, 0.28);
}

.cdw-card__body {
	flex: 1 1 auto;
	padding: 12px 14px;
	display: flex;
	flex-direction: column;
	min-width: 0;
}

.cdw-card__name {
	font-family: var(--cdw-font-display);
	font-size: 16px;
	font-weight: 700;
	margin: 0 0 4px;
	line-height: 1.25;
}

.cdw-card__desc {
	font-size: 13px;
	color: var(--cdw-ink-soft);
	margin: 0 0 10px;
	line-height: 1.4;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.cdw-card__footer {
	margin-top: auto;
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
}

.cdw-card__price {
	font-family: var(--cdw-font-display);
	font-weight: 800;
	font-size: 16px;
	color: var(--cdw-red);
	white-space: nowrap;
}

.cdw-card__price .woocommerce-Price-amount {
	color: inherit;
}

.cdw-out-of-stock {
	font-size: 12.5px;
	color: var(--cdw-ink-soft);
	font-weight: 600;
}

/* ---------- Botón añadir ---------- */

.cdw-add-btn {
	display: inline-flex;
	align-items: center;
	gap: 6px;
	background: var(--cdw-red);
	color: #fff;
	border: none;
	border-radius: var(--cdw-radius-pill);
	padding: 9px 16px;
	font-family: var(--cdw-font-body);
	font-size: 13.5px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease, transform 0.1s ease;
	white-space: nowrap;
}

.cdw-add-btn:hover {
	background: var(--cdw-red-dark);
}

.cdw-add-btn:active {
	transform: scale(0.96);
}

.cdw-add-btn.is-loading {
	opacity: 0.6;
	pointer-events: none;
}

.cdw-add-btn.is-added {
	background: var(--cdw-ink);
}

.cdw-add-btn__icon {
	font-size: 15px;
	line-height: 1;
}

/* ---------- Carrito flotante (escritorio) ---------- */

.cdw-cart-fab {
	position: fixed;
	right: 24px;
	bottom: 24px;
	z-index: 9990;
	display: none;
	align-items: center;
	justify-content: center;
	width: 60px;
	height: 60px;
	border-radius: 50%;
	background: var(--cdw-red);
	color: #fff;
	border: none;
	cursor: pointer;
	box-shadow: 0 10px 24px rgba(176, 32, 31, 0.35);
}

.cdw-cart-fab__icon {
	font-size: 24px;
}

.cdw-cart-fab__count {
	position: absolute;
	top: -4px;
	right: -4px;
	min-width: 22px;
	height: 22px;
	padding: 0 5px;
	border-radius: var(--cdw-radius-pill);
	background: var(--cdw-ink);
	color: #fff;
	font-size: 12px;
	font-weight: 800;
	display: flex;
	align-items: center;
	justify-content: center;
}

/* ---------- Barra de carrito (móvil) ---------- */

.cdw-cart-bar {
	position: fixed;
	left: 12px;
	right: 12px;
	bottom: 12px;
	z-index: 9990;
	display: none;
	align-items: center;
	justify-content: space-between;
	gap: 10px;
	background: var(--cdw-red);
	color: #fff;
	border: none;
	border-radius: var(--cdw-radius-pill);
	padding: 14px 18px;
	font-family: var(--cdw-font-body);
	cursor: pointer;
	box-shadow: 0 10px 24px rgba(176, 32, 31, 0.35);
}

.cdw-cart-bar.is-visible {
	display: flex;
}

.cdw-cart-bar__count {
	font-weight: 700;
	font-size: 14px;
}

.cdw-cart-bar__total {
	font-weight: 800;
	font-size: 14px;
}

.cdw-cart-bar__total .woocommerce-Price-amount {
	color: inherit;
}

.cdw-cart-bar__cta {
	font-weight: 700;
	font-size: 13.5px;
	text-decoration: underline;
	white-space: nowrap;
}

@keyframes cdwBump {
	0% {
		transform: scale(1);
	}
	30% {
		transform: scale(1.1);
	}
	60% {
		transform: scale(0.96);
	}
	100% {
		transform: scale(1);
	}
}

.cdw-bump {
	animation: cdwBump 0.4s ease;
}

/* ---------- Panel de carrito (drawer) ---------- */

.cdw-drawer {
	position: fixed;
	inset: 0;
	z-index: 9995;
	visibility: hidden;
}

.cdw-drawer.is-open {
	visibility: visible;
}

.cdw-drawer__overlay {
	position: absolute;
	inset: 0;
	background: rgba(20, 14, 12, 0.5);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.cdw-drawer.is-open .cdw-drawer__overlay {
	opacity: 1;
}

.cdw-drawer__panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 85vh;
	background: var(--cdw-bg);
	border-radius: 20px 20px 0 0;
	display: flex;
	flex-direction: column;
	transform: translateY(100%);
	transition: transform 0.3s ease;
}

.cdw-drawer.is-open .cdw-drawer__panel {
	transform: translateY(0);
}

.cdw-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 18px 12px;
	border-bottom: 1px solid var(--cdw-border);
}

.cdw-drawer__header h3 {
	font-family: var(--cdw-font-display);
	font-size: 18px;
	font-weight: 800;
	margin: 0;
}

.cdw-drawer__close,
.cdw-variation-modal__close {
	background: none;
	border: none;
	font-size: 24px;
	line-height: 1;
	color: var(--cdw-ink-soft);
	cursor: pointer;
	padding: 4px 8px;
}

.cdw-drawer__items {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 12px 18px;
}

.cdw-drawer__empty {
	color: var(--cdw-ink-soft);
	text-align: center;
	padding: 32px 12px;
}

.cdw-drawer-item {
	display: flex;
	gap: 12px;
	padding: 12px 0;
	border-bottom: 1px solid var(--cdw-border);
}

.cdw-drawer-item:last-child {
	border-bottom: none;
}

.cdw-drawer-item__img {
	width: 56px;
	height: 56px;
	border-radius: 12px;
	object-fit: cover;
	flex: 0 0 56px;
}

.cdw-drawer-item__info {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.cdw-drawer-item__name {
	font-weight: 700;
	font-size: 14px;
}

.cdw-drawer-item__extras {
	font-size: 12px;
	color: var(--cdw-ink-soft);
	line-height: 1.35;
}

.cdw-drawer-item__price {
	font-size: 13px;
	color: var(--cdw-red);
	font-weight: 700;
}

.cdw-drawer-item__price .woocommerce-Price-amount {
	color: inherit;
}

.cdw-drawer-item__qty {
	display: flex;
	align-items: center;
	gap: 8px;
	margin-top: 2px;
}

.cdw-qty-btn {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	border: 1.5px solid var(--cdw-border);
	background: var(--cdw-bg);
	color: var(--cdw-ink);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cdw-qty-btn:hover {
	border-color: var(--cdw-red);
	color: var(--cdw-red);
}

.cdw-qty-value {
	font-weight: 700;
	font-size: 13.5px;
	min-width: 16px;
	text-align: center;
}

.cdw-qty-remove {
	margin-left: auto;
	background: none;
	border: none;
	cursor: pointer;
	font-size: 14px;
	opacity: 0.6;
}

.cdw-qty-remove:hover {
	opacity: 1;
}

.cdw-drawer__footer {
	padding: 14px 18px 18px;
	border-top: 1px solid var(--cdw-border);
}

.cdw-drawer__subtotal {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 14px;
	margin-bottom: 12px;
}

.cdw-drawer__subtotal-amount {
	font-family: var(--cdw-font-display);
	font-weight: 800;
	font-size: 18px;
	color: var(--cdw-red);
}

.cdw-drawer__subtotal-amount .woocommerce-Price-amount {
	color: inherit;
}

.cdw-drawer__checkout {
	display: block;
	text-align: center;
	background: var(--cdw-red);
	color: #fff;
	font-weight: 700;
	font-size: 15px;
	text-decoration: none;
	border-radius: var(--cdw-radius-pill);
	padding: 14px;
	transition: background-color 0.15s ease;
}

.cdw-drawer__checkout:hover {
	background: var(--cdw-red-dark);
	color: #fff;
}

/* ---------- Modal de variaciones (tamaños) ---------- */

.cdw-variation-modal {
	position: fixed;
	inset: 0;
	z-index: 9998;
	visibility: hidden;
}

.cdw-variation-modal.is-open {
	visibility: visible;
}

.cdw-variation-modal__overlay {
	position: absolute;
	inset: 0;
	background: rgba(20, 14, 12, 0.5);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.cdw-variation-modal.is-open .cdw-variation-modal__overlay {
	opacity: 1;
}

.cdw-variation-modal__panel {
	position: absolute;
	left: 0;
	right: 0;
	bottom: 0;
	max-height: 80vh;
	overflow-y: auto;
	background: var(--cdw-bg);
	border-radius: 20px 20px 0 0;
	padding: 20px 18px 24px;
	transform: translateY(100%);
	transition: transform 0.3s ease;
}

.cdw-variation-modal.is-open .cdw-variation-modal__panel {
	transform: translateY(0);
}

.cdw-variation__title {
	font-family: var(--cdw-font-display);
	font-size: 18px;
	font-weight: 800;
	margin: 0 0 2px;
	padding-right: 30px;
}

.cdw-variation__subtitle {
	font-size: 13.5px;
	color: var(--cdw-ink-soft);
	margin: 0 0 14px;
}

.cdw-variation__loading {
	color: var(--cdw-ink-soft);
	padding: 20px 0;
}

.cdw-variation__options {
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.cdw-variation__option {
	display: flex;
	align-items: center;
	justify-content: space-between;
	width: 100%;
	background: var(--cdw-bg);
	border: 1.5px solid var(--cdw-border);
	border-radius: 14px;
	padding: 14px 16px;
	font-family: var(--cdw-font-body);
	cursor: pointer;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cdw-variation__option:hover {
	border-color: var(--cdw-red);
	background: #fdf4f5;
}

.cdw-variation__option-label {
	font-weight: 700;
	font-size: 14.5px;
	color: var(--cdw-ink);
}

.cdw-variation__option-price {
	font-family: var(--cdw-font-display);
	font-weight: 800;
	font-size: 14.5px;
	color: var(--cdw-red);
}

.cdw-variation__option-price .woocommerce-Price-amount {
	color: inherit;
}

/* ---------- Selector de ingredientes extra (paso 2 del modal) ---------- */

.cdw-extras__back {
	display: inline-flex;
	align-items: center;
	gap: 4px;
	background: none;
	border: none;
	color: var(--cdw-ink-soft);
	font-family: var(--cdw-font-body);
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	padding: 0 0 14px;
}

.cdw-extras__back:hover {
	color: var(--cdw-red);
}

.cdw-extras__list {
	display: flex;
	flex-direction: column;
	gap: 8px;
	max-height: 48vh;
	overflow-y: auto;
	margin-bottom: 16px;
}

.cdw-extras__item {
	display: flex;
	align-items: center;
	gap: 10px;
	border: 1.5px solid var(--cdw-border);
	border-radius: 14px;
	padding: 11px 14px;
	transition: border-color 0.15s ease, background-color 0.15s ease;
}

.cdw-extras__item.has-qty {
	border-color: var(--cdw-red);
	background: #fdf4f5;
}

.cdw-extras__label {
	flex: 1 1 auto;
	font-size: 14px;
	font-weight: 600;
	color: var(--cdw-ink);
}

.cdw-extras__unit-price {
	display: block;
	margin-top: 4px;
	font-family: var(--cdw-font-display);
	font-weight: 700;
	font-size: 18px;
	color: var(--cdw-red);
}

.cdw-extras__unit-price .woocommerce-Price-amount {
	color: inherit;
}

.cdw-extras__stepper {
	display: flex;
	align-items: center;
	gap: 8px;
	flex: 0 0 auto;
}

.cdw-extras__stepper-btn {
	width: 26px;
	height: 26px;
	border-radius: 50%;
	border: 1.5px solid var(--cdw-border);
	background: var(--cdw-bg);
	color: var(--cdw-ink);
	font-size: 15px;
	line-height: 1;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
}

.cdw-extras__stepper-btn:hover:not(:disabled) {
	border-color: var(--cdw-red);
	color: var(--cdw-red);
}

.cdw-extras__stepper-btn:disabled {
	opacity: 0.35;
	cursor: default;
}

.cdw-extras__stepper-value {
	font-weight: 700;
	font-size: 13.5px;
	min-width: 14px;
	text-align: center;
}

.cdw-extras__footer {
	position: sticky;
	bottom: 0;
	background: var(--cdw-bg);
	padding-top: 6px;
}

.cdw-extras__summary {
	display: block;
	text-align: center;
	font-size: 13px;
	color: var(--cdw-ink-soft);
	margin-bottom: 10px;
}

.cdw-extras__submit {
	display: block;
	width: 100%;
	background: var(--cdw-red);
	color: #fff;
	border: none;
	border-radius: var(--cdw-radius-pill);
	padding: 14px;
	font-family: var(--cdw-font-body);
	font-size: 15px;
	font-weight: 700;
	cursor: pointer;
	transition: background-color 0.15s ease;
}

.cdw-extras__submit:hover {
	background: var(--cdw-red-dark);
}

.cdw-extras__submit-total {
	font-family: var(--cdw-font-display);
}

.cdw-extras__submit-total .woocommerce-Price-amount {
	color: inherit;
}

body.cdw-no-scroll {
	overflow: hidden;
}

/* ---------- Accesibilidad ---------- */

.cdw-wrapper button:focus-visible,
.cdw-cart-fab:focus-visible,
.cdw-cart-bar:focus-visible,
.cdw-drawer button:focus-visible,
.cdw-drawer a:focus-visible,
.cdw-variation-modal button:focus-visible {
	outline: 3px solid var(--cdw-ink);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.cdw-bump,
	.cdw-drawer__panel,
	.cdw-drawer__overlay,
	.cdw-variation-modal__panel,
	.cdw-variation-modal__overlay,
	.cdw-add-btn,
	.cdw-tab {
		animation: none !important;
		transition: none !important;
	}
}

/* =========================================================
   Punto de ruptura: tablet / escritorio (>= 768px)
   Las tarjetas pasan de fila horizontal a tarjeta vertical
   en cuadrícula, y el carrito flotante sustituye a la barra.
   ========================================================= */

@media (min-width: 768px) {
	.cdw-grid {
		display: grid;
		grid-template-columns: repeat(var(--cdw-cols, 3), 1fr);
		gap: 22px;
	}

	.cdw-card {
		flex-direction: column;
	}

	.cdw-card__media {
		width: 100%;
		flex-basis: auto;
		aspect-ratio: 4 / 3;
	}

	.cdw-card__body {
		padding: 16px 18px 18px;
	}

	.cdw-card__name {
		font-size: 17px;
	}

	.cdw-cart-fab {
		display: flex;
	}

	.cdw-cart-fab.has-items {
		display: flex;
	}

	.cdw-cart-bar {
		display: none !important;
	}

	.cdw-drawer__panel {
		left: auto;
		top: 0;
		right: 0;
		bottom: 0;
		width: 420px;
		max-width: 92vw;
		max-height: none;
		border-radius: 0;
		transform: translateX(100%);
	}

	.cdw-drawer.is-open .cdw-drawer__panel {
		transform: translateX(0);
	}

	.cdw-variation-modal__panel {
		left: 50%;
		bottom: auto;
		top: 50%;
		width: 420px;
		max-width: 92vw;
		border-radius: 20px;
		transform: translate(-50%, -46%);
		opacity: 0;
		transition: transform 0.25s ease, opacity 0.25s ease;
	}

	.cdw-variation-modal.is-open .cdw-variation-modal__panel {
		transform: translate(-50%, -50%);
		opacity: 1;
	}

	.cdw-extras__list {
		display: grid;
		grid-template-columns: 1fr 1fr;
		gap: 8px 10px;
	}
}

@media (max-width: 767.98px) {
	.cdw-cart-fab {
		display: none !important;
	}
}
