/**
 * CP — Drawer do orçamento
 *
 * As variáveis --rkscp-drawer-* são escritas pelos controls do widget do
 * botão. Os fallbacks apontam para os tokens do 00-core, que por sua vez
 * caem nos Globais do Elementor. Nenhuma cor nasce aqui.
 */

.rkscp-drawer {
	--rkscp-drawer-bg: var(--rkscp-white, #fff);
	--rkscp-drawer-fg: var(--rkscp-ink-900, #141414);
	--rkscp-drawer-cta-bg: var(--rkscp-ink-900, #141414);
	--rkscp-drawer-cta-fg: var(--rkscp-white, #fff);
	--rkscp-drawer-w: 420px;

	position: fixed;
	inset: 0;
	z-index: 99990;
	pointer-events: none;
	visibility: hidden;
}

.rkscp-drawer[data-state="open"] {
	pointer-events: auto;
	visibility: visible;
}

.rkscp-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, .45);
	opacity: 0;
	transition: opacity .25s var(--rkscp-ease, ease);
}

.rkscp-drawer[data-state="open"] .rkscp-drawer__backdrop {
	opacity: 1;
}

.rkscp-drawer__panel {
	position: absolute;
	top: 0;
	bottom: 0;
	right: 0;
	display: flex;
	flex-direction: column;
	width: min(var(--rkscp-drawer-w), 100vw);
	background: var(--rkscp-drawer-bg);
	color: var(--rkscp-drawer-fg);
	box-shadow: 0 0 40px rgba(0, 0, 0, .18);
	transform: translateX(100%);
	transition: transform .3s var(--rkscp-ease, cubic-bezier(.4, 0, .2, 1));
}

.rkscp-drawer--esquerda .rkscp-drawer__panel {
	right: auto;
	left: 0;
	transform: translateX(-100%);
}

.rkscp-drawer[data-state="open"] .rkscp-drawer__panel {
	transform: translateX(0);
}

body.rkscp-drawer-aberto {
	overflow: hidden;
}

/* ── Cabeçalho ─────────────────────────────────────────────── */

.rkscp-cesta__header {
	display: flex;
	align-items: center;
	gap: 10px;
	padding: 18px 20px;
	border-bottom: 1px solid var(--rkscp-line, #d9d9d9);
	flex-shrink: 0;
}

.rkscp-cesta__header-icon {
	display: inline-flex;
	flex-shrink: 0;
}

.rkscp-cesta__header-title {
	margin: 0;
	flex: 1;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
}

.rkscp-cesta__close,
.rkscp-cesta__item-remove,
.rkscp-cesta__qty-btn,
.rkscp-cesta__rec-add {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	background: none;
	border: 0;
	padding: 0;
	color: inherit;
	cursor: pointer;
	border-radius: var(--rkscp-radius, 4px);
	transition: opacity .15s ease, background-color .15s ease;
}

.rkscp-cesta__close {
	width: 32px;
	height: 32px;
	flex-shrink: 0;
}

.rkscp-cesta__close:hover,
.rkscp-cesta__item-remove:hover {
	opacity: .6;
}

/* ── Corpo ─────────────────────────────────────────────────── */

.rkscp-cesta__body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	padding: 4px 20px;
}

.rkscp-cesta__empty {
	display: flex;
	flex-direction: column;
	align-items: center;
	text-align: center;
	gap: 8px;
	padding: 48px 12px;
}

.rkscp-cesta__empty-icon {
	opacity: .35;
	transform: scale(1.8);
	margin-bottom: 12px;
}

.rkscp-cesta__empty-title {
	margin: 0;
	font-size: 16px;
	font-weight: 600;
}

.rkscp-cesta__empty-desc {
	margin: 0;
	font-size: 13px;
	color: var(--rkscp-ink-500, #6b6b6b);
	max-width: 30ch;
}

.rkscp-cesta__empty-cta {
	margin-top: 8px;
	padding: 10px 20px;
	border: 1px solid currentColor;
	border-radius: var(--rkscp-radius, 4px);
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	color: inherit;
}

/* ── Item ──────────────────────────────────────────────────── */

.rkscp-cesta__item {
	position: relative;
	display: grid;
	grid-template-columns: 64px 1fr 28px;
	gap: 12px;
	align-items: start;
	padding: 16px 0;
	border-bottom: 1px solid var(--rkscp-line, #d9d9d9);
	transition: opacity .2s ease;
}

.rkscp-cesta__item:last-child {
	border-bottom: 0;
}

.rkscp-cesta__item-thumb {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: var(--rkscp-radius, 4px);
	background: var(--rkscp-surface, #f5f5f5);
	display: block;
}

.rkscp-cesta__item-body {
	display: flex;
	flex-direction: column;
	gap: 4px;
	min-width: 0;
}

.rkscp-cesta__item-name {
	font-size: 14px;
	font-weight: 600;
	line-height: 1.35;
	color: inherit;
	text-decoration: none;
}

.rkscp-cesta__item-name:hover {
	text-decoration: underline;
}

.rkscp-cesta__item-variation,
.rkscp-cesta__item-sku {
	margin: 0;
	font-size: 12px;
	line-height: 1.4;
	color: var(--rkscp-ink-500, #6b6b6b);
}

.rkscp-cesta__item-sku {
	font-variant-numeric: tabular-nums;
}

.rkscp-cesta__item-qty {
	display: inline-flex;
	align-items: center;
	gap: 2px;
	margin-top: 6px;
	border: 1px solid var(--rkscp-line, #d9d9d9);
	border-radius: var(--rkscp-radius, 4px);
	width: fit-content;
}

.rkscp-cesta__qty-btn {
	width: 30px;
	height: 30px;
}

.rkscp-cesta__qty-btn:hover {
	background: var(--rkscp-surface, #f5f5f5);
}

.rkscp-cesta__qty-input {
	width: 34px;
	height: 30px;
	border: 0;
	background: none;
	text-align: center;
	font-size: 13px;
	font-weight: 600;
	color: inherit;
	font-variant-numeric: tabular-nums;
	pointer-events: none;
}

.rkscp-cesta__item-remove {
	width: 28px;
	height: 28px;
	color: var(--rkscp-ink-500, #6b6b6b);
}

.rkscp-cesta__item.is-loading {
	opacity: .5;
	pointer-events: none;
}

/* ── Recomendados ──────────────────────────────────────────── */

.rkscp-cesta__recs {
	border-top: 1px solid var(--rkscp-line, #d9d9d9);
	flex-shrink: 0;
}

.rkscp-cesta__rec-header {
	display: flex;
	align-items: center;
	gap: 8px;
	width: 100%;
	padding: 14px 20px;
	background: none;
	border: 0;
	color: inherit;
	font-size: 13px;
	font-weight: 600;
	cursor: pointer;
	text-align: left;
}

.rkscp-cesta__rec-title {
	flex: 1;
}

.rkscp-cesta__rec-chevron {
	transition: transform .25s var(--rkscp-ease, ease);
	flex-shrink: 0;
}

.rkscp-cesta__recs.is-open .rkscp-cesta__rec-chevron {
	transform: rotate(180deg);
}

/* grid-template-rows 0fr→1fr anima altura automática sem medir nada em JS */
.rkscp-cesta__rec-body {
	display: grid;
	grid-template-rows: 0fr;
	transition: grid-template-rows .28s var(--rkscp-ease, ease);
}

.rkscp-cesta__recs.is-open .rkscp-cesta__rec-body {
	grid-template-rows: 1fr;
}

.rkscp-cesta__rec-carousel {
	min-height: 0;
	overflow: hidden;
	padding: 0 20px;
}

.rkscp-cesta__rec-viewport {
	overflow: hidden;
	touch-action: pan-y;
}

.rkscp-cesta__rec-track {
	display: flex;
	transition: transform .3s var(--rkscp-ease, ease);
}

.rkscp-cesta__rec-slide {
	display: grid;
	grid-template-columns: 48px 1fr 28px;
	gap: 10px;
	align-items: center;
	flex: 0 0 100%;
	padding-bottom: 14px;
}

.rkscp-cesta__rec-thumb {
	width: 48px;
	height: 48px;
	object-fit: cover;
	border-radius: var(--rkscp-radius, 4px);
	background: var(--rkscp-surface, #f5f5f5);
	display: block;
}

.rkscp-cesta__rec-name {
	font-size: 13px;
	font-weight: 500;
	line-height: 1.35;
	color: inherit;
	text-decoration: none;
}

.rkscp-cesta__rec-add {
	width: 28px;
	height: 28px;
	border: 1px solid var(--rkscp-line, #d9d9d9);
}

.rkscp-cesta__rec-add.is-loading {
	opacity: .4;
	pointer-events: none;
}

.rkscp-cesta__rec-dots {
	display: flex;
	justify-content: center;
	gap: 6px;
	padding-bottom: 14px;
}

.rkscp-cesta__rec-dot {
	width: 6px;
	height: 6px;
	padding: 0;
	border: 0;
	border-radius: 50%;
	background: var(--rkscp-line, #d9d9d9);
	cursor: pointer;
	transition: background-color .2s ease, transform .2s ease;
}

.rkscp-cesta__rec-dot.is-active {
	background: currentColor;
	transform: scale(1.3);
}

/* ── Rodapé ────────────────────────────────────────────────── */

.rkscp-cesta__footer {
	flex-shrink: 0;
	padding: 16px 20px calc(16px + env(safe-area-inset-bottom));
	border-top: 1px solid var(--rkscp-line, #d9d9d9);
	display: flex;
	flex-direction: column;
	gap: 10px;
}

.rkscp-cesta__count-row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	font-size: 13px;
}

.rkscp-cesta__count-label {
	color: var(--rkscp-ink-500, #6b6b6b);
}

.rkscp-cesta__count-value {
	font-size: 18px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.rkscp-cesta__submit {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 14px 20px;
	border-radius: var(--rkscp-radius, 4px);
	background: var(--rkscp-drawer-cta-bg);
	color: var(--rkscp-drawer-cta-fg);
	font-size: 14px;
	font-weight: 600;
	text-decoration: none;
	transition: opacity .15s ease;
}

.rkscp-cesta__submit:hover {
	opacity: .88;
	color: var(--rkscp-drawer-cta-fg);
}

.rkscp-cesta__continue {
	background: none;
	border: 0;
	padding: 4px;
	font-size: 13px;
	color: var(--rkscp-ink-500, #6b6b6b);
	cursor: pointer;
	text-decoration: underline;
}

/* ── Botão que abre ────────────────────────────────────────── */

.rkscp-trigger {
	position: relative;
	display: inline-flex;
	align-items: center;
	gap: 8px;
	background: none;
	border: 0;
	padding: 4px;
	color: var(--rkscp-ink-900, #141414);
	cursor: pointer;
	line-height: 1;
}

.rkscp-trigger__icon {
	display: inline-flex;
	font-size: 24px;
}

.rkscp-trigger__icon svg {
	width: 1em;
	height: 1em;
	fill: currentColor;
}

.rkscp-trigger__text {
	font-size: 14px;
	font-weight: 600;
}

.rkscp-trigger__badge {
	position: absolute;
	top: -4px;
	right: -6px;
	min-width: 18px;
	height: 18px;
	padding: 0 5px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	border-radius: 9px;
	background: var(--rkscp-accent, #141414);
	color: var(--rkscp-white, #fff);
	font-size: 11px;
	font-weight: 700;
	font-variant-numeric: tabular-nums;
}

.rkscp-trigger__badge[hidden] {
	display: none;
}

/* ── Mobile: vira bottom sheet ─────────────────────────────── */

@media (max-width: 768px) {
	.rkscp-drawer__panel,
	.rkscp-drawer--esquerda .rkscp-drawer__panel {
		top: auto;
		left: 0;
		right: 0;
		width: 100%;
		max-height: 92vh;
		border-radius: 16px 16px 0 0;
		transform: translateY(100%);
	}

	.rkscp-drawer[data-state="open"] .rkscp-drawer__panel {
		transform: translateY(0);
	}

	/* Alça visual do sheet */
	.rkscp-cesta__header::before {
		content: "";
		position: absolute;
		top: 7px;
		left: 50%;
		width: 36px;
		height: 4px;
		border-radius: 2px;
		background: var(--rkscp-line, #d9d9d9);
		transform: translateX(-50%);
	}

	.rkscp-cesta__header {
		position: relative;
		padding-top: 22px;
	}

	/* Durante o arraste o transform vem do JS, então a transição sai do
	   caminho — senão o painel persegue o dedo com atraso. */
	.rkscp-drawer[data-dragging] .rkscp-drawer__panel {
		transition: none;
		transform: translateY(var(--rkscp-drag-y, 0px));
	}

	.rkscp-drawer[data-dragging="closing"] .rkscp-drawer__panel {
		transition: transform .2s ease-in;
		transform: translateY(100%);
	}
}

@media (prefers-reduced-motion: reduce) {
	.rkscp-drawer__panel,
	.rkscp-drawer__backdrop,
	.rkscp-cesta__rec-track,
	.rkscp-cesta__rec-body {
		transition-duration: .01ms;
	}
}
