/**
 * Claritas Surtido — estilos del frontend.
 *
 * Todas las clases van con prefijo `cs-` para no chocar con las `wd-` del tema.
 *
 * Los colores y tipografías se toman de las variables CSS de Woodmart cuando
 * existen, pero **cada propiedad lleva su propio valor de respaldo**: si una
 * variable cambia de nombre en una actualización del tema, el modal se sigue
 * viendo bien en lugar de quedarse sin estilo.
 *
 * Los nombres de variable de Woodmart están pendientes de confirmar en el
 * staging (Fase 0). Hasta entonces, los respaldos son los que mandan.
 */

.cs-surtido-wrap {
	margin: 12px 0 0;
}

.cs-surtido-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 13px 20px;
	border: 1px solid transparent;
	cursor: pointer;
	font-family: var(--wd-text-font, inherit);
	font-size: 14px;
	font-weight: 600;
	letter-spacing: .06em;
	text-transform: uppercase;
	line-height: 1.2;
	color: #fff;
	background-color: var(--wd-primary-color, #9b2247);
	border-radius: var(--btn-default-brd-radius, 4px);
	transition: opacity .18s ease;
}

.cs-surtido-btn:hover,
.cs-surtido-btn:focus-visible {
	opacity: .88;
	color: #fff;
}

/* ---------- modal ---------- */

.cs-modal[hidden] {
	display: none;
}

.cs-modal {
	position: fixed;
	inset: 0;
	/* Por encima de la cabecera fija, el carrito lateral y los overlays del
	   tema y de FunnelKit. */
	z-index: 100000;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 16px;
}

.cs-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(20, 14, 17, .55);
}

.cs-modal__dialog {
	position: relative;
	display: flex;
	flex-direction: column;
	width: 100%;
	max-width: 520px;
	max-height: calc(100vh - 32px);
	overflow: hidden;
	background: #fff;
	color: #241a20;
	border-radius: var(--wd-brd-radius, 8px);
	box-shadow: 0 24px 60px -20px rgba(20, 14, 17, .5);
	font-family: var(--wd-text-font, inherit);
	animation: cs-in .18s ease-out;
}

@keyframes cs-in {
	from { opacity: 0; transform: translateY(8px); }
	to   { opacity: 1; transform: none; }
}

.cs-modal__head {
	display: flex;
	align-items: flex-start;
	justify-content: space-between;
	gap: 12px;
	padding: 20px 22px 16px;
	border-bottom: 1px solid #e7dbdf;
}

.cs-modal__title {
	margin: 0;
	font-size: 20px;
	line-height: 1.25;
	font-weight: 700;
}

.cs-modal__subtitle {
	margin: 4px 0 0;
	font-size: 13px;
	line-height: 1.45;
	color: #6b5c64;
}

.cs-modal__close {
	flex: none;
	width: 32px;
	height: 32px;
	display: grid;
	place-items: center;
	font-size: 22px;
	line-height: 1;
	color: #6b5c64;
	background: none;
	border: 0;
	cursor: pointer;
	border-radius: 4px;
}

.cs-modal__close:hover {
	color: #241a20;
}

.cs-modal__bar {
	display: flex;
	align-items: center;
	flex-wrap: wrap;
	gap: 8px;
	padding: 14px 22px;
	background: #f5eef0;
	border-bottom: 1px solid #e7dbdf;
}

.cs-modal__bar-label {
	font-size: 13px;
	font-weight: 600;
}

.cs-modal__total {
	width: 78px;
	padding: 7px 9px;
	font-size: 14px;
	color: #241a20;
	background: #fff;
	border: 1px solid #d6c6cc;
	border-radius: 4px;
}

.cs-modal__body {
	flex: 1 1 auto;
	min-height: 80px;
	/* El scroll vive dentro del modal, nunca en el body. */
	overflow-y: auto;
	-webkit-overflow-scrolling: touch;
}

.cs-modal__foot {
	padding: 16px 22px 20px;
	background: #f5eef0;
	border-top: 1px solid #e7dbdf;
}

/* ---------- filas ---------- */

.cs-row {
	display: flex;
	align-items: center;
	gap: 12px;
	padding: 11px 22px;
	border-bottom: 1px solid #e7dbdf;
	border-left: 3px solid transparent;
}

.cs-row:last-child {
	border-bottom: 0;
}

.cs-row.is-active {
	border-left-color: var(--wd-primary-color, #9b2247);
	background: #fbf7f8;
}

.cs-row.is-disabled {
	opacity: .5;
}

.cs-row__thumb {
	flex: none;
	width: 34px;
	height: 34px;
	object-fit: cover;
	border-radius: 4px;
}

.cs-row__info {
	flex: 1 1 auto;
	min-width: 0;
}

.cs-row__name {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
}

.cs-row__meta {
	font-size: 12px;
	line-height: 1.4;
	color: #96858d;
	font-variant-numeric: tabular-nums;
}

.cs-row__badge {
	flex: none;
	padding: 3px 8px;
	font-size: 11px;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #96858d;
	border: 1px solid #d6c6cc;
	border-radius: 999px;
}

/* ---------- selector de cantidad ---------- */

.cs-stepper {
	display: flex;
	flex: none;
	align-items: center;
}

.cs-stepper button {
	width: 30px;
	height: 30px;
	display: grid;
	place-items: center;
	font-size: 16px;
	line-height: 1;
	color: #6b5c64;
	background: #fff;
	border: 1px solid #d6c6cc;
	cursor: pointer;
	padding: 0;
}

.cs-stepper button:first-child { border-radius: 4px 0 0 4px; }
.cs-stepper button:last-child  { border-radius: 0 4px 4px 0; }

.cs-stepper button:hover:not(:disabled) {
	border-color: var(--wd-primary-color, #9b2247);
	color: var(--wd-primary-color, #9b2247);
}

.cs-stepper button:disabled {
	opacity: .35;
	cursor: not-allowed;
}

.cs-stepper__value {
	width: 40px;
	height: 30px;
	display: grid;
	place-items: center;
	font-size: 14px;
	font-variant-numeric: tabular-nums;
	background: #fff;
	border-top: 1px solid #d6c6cc;
	border-bottom: 1px solid #d6c6cc;
}

/* ---------- pie ---------- */

.cs-tally {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 10px;
	margin-bottom: 6px;
}

.cs-tally__count {
	font-size: 14px;
	font-weight: 600;
}

.cs-tally__sum {
	font-size: 16px;
	font-variant-numeric: tabular-nums;
}

.cs-hint {
	margin: 0 0 12px;
	min-height: 18px;
	font-size: 12px;
	line-height: 1.45;
	color: #96858d;
}

.cs-hint.is-error {
	color: #9b2247;
	font-weight: 600;
}

/* ---------- botones ---------- */

.cs-btn {
	font-family: inherit;
	font-size: 13px;
	font-weight: 600;
	padding: 8px 14px;
	border: 1px solid #d6c6cc;
	border-radius: 4px;
	background: #fff;
	color: #241a20;
	cursor: pointer;
}

.cs-btn:hover:not(:disabled) {
	border-color: var(--wd-primary-color, #9b2247);
	color: var(--wd-primary-color, #9b2247);
}

.cs-btn--primary {
	width: 100%;
	padding: 13px;
	font-size: 14px;
	letter-spacing: .06em;
	text-transform: uppercase;
	color: #fff;
	background: var(--wd-primary-color, #9b2247);
	border-color: var(--wd-primary-color, #9b2247);
}

.cs-btn--primary:hover:not(:disabled) {
	color: #fff;
	opacity: .9;
}

.cs-btn:disabled {
	opacity: .45;
	cursor: not-allowed;
}

/* ---------- estados ---------- */

.cs-state {
	padding: 28px 22px;
	text-align: center;
	font-size: 14px;
	color: #6b5c64;
}

.cs-state.is-error {
	color: #9b2247;
}

/* Bloqueo de scroll del documento mientras el modal está abierto. */
body.cs-modal-open {
	overflow: hidden;
}

/* ---------- móvil ---------- */

@media (max-width: 600px) {
	.cs-modal {
		padding: 0;
		align-items: flex-end;
	}

	.cs-modal__dialog {
		max-width: none;
		max-height: 92vh;
		border-radius: 12px 12px 0 0;
	}

	.cs-row,
	.cs-modal__head,
	.cs-modal__bar,
	.cs-modal__foot {
		padding-left: 16px;
		padding-right: 16px;
	}
}

/* ---------- accesibilidad ---------- */

.cs-modal :focus-visible,
.cs-surtido-btn:focus-visible {
	outline: 2px solid var(--wd-primary-color, #9b2247);
	outline-offset: 2px;
}

@media (prefers-reduced-motion: reduce) {
	.cs-modal__dialog {
		animation: none;
	}

	.cs-surtido-btn {
		transition: none;
	}
}
