/**
 * Rotitoo Cart Sheet — bottom drawer (replaces Woodmart side cart)
 */

/* Hide Woodmart side cart — keep DOM for WC fragments */
body.rotitoo-app-shell .cart-widget-side,
body.rotitoo-app-shell .wd-close-side {
	display: none !important;
	visibility: hidden !important;
	pointer-events: none !important;
}

body.rotitoo-cart-open .rotitoo-toast {
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
	z-index: 100001;
}

/* ─── Overlay ───────────────────────────────────────────────── */
.rotitoo-cart-overlay {
	position: fixed;
	inset: 0;
	z-index: 99990;
	background: rgba(20, 16, 14, 0.48);
	backdrop-filter: blur(4px);
	-webkit-backdrop-filter: blur(4px);
	opacity: 0;
	transition: opacity 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

.rotitoo-cart-overlay.is-open {
	opacity: 1;
}

/* ─── Bottom sheet ──────────────────────────────────────────── */
.rotitoo-cart-sheet {
	position: fixed;
	inset-inline: 0;
	bottom: 0;
	z-index: 99995;
	max-height: min(92vh, 780px);
	background: #fff;
	border-radius: 20px 20px 0 0;
	box-shadow: 0 -8px 48px rgba(30, 20, 15, 0.16);
	display: flex;
	flex-direction: column;
	transform: translateY(100%);
	transition: transform 0.42s cubic-bezier(0.32, 0.72, 0, 1);
	padding-bottom: env(safe-area-inset-bottom, 0px);
}

.rotitoo-cart-sheet.is-open {
	transform: translateY(0);
}

.rotitoo-cart-sheet.is-dragging {
	transition: none !important;
	transform: translateY(var(--drag-y, 0));
}

.rotitoo-cart-sheet.is-open.is-dragging {
	transform: translateY(var(--drag-y, 0));
}

.rotitoo-cart-sheet__handle {
	width: 40px;
	height: 4px;
	border-radius: 999px;
	background: rgba(180, 150, 135, 0.45);
	margin: 10px auto 4px;
	flex-shrink: 0;
	cursor: grab;
	touch-action: none;
}

.rotitoo-cart-sheet.is-dragging .rotitoo-cart-sheet__handle {
	cursor: grabbing;
}

.rotitoo-delivery-toggle {
	display: flex;
	align-items: center;
	gap: 10px;
	width: calc(100% - 40px);
	margin: 12px 20px 0;
	padding: 12px 14px;
	border: 1px solid rgba(215, 185, 165, 0.45);
	border-radius: 12px;
	background: #fdfbf9;
	font-size: 0.8rem;
	color: #3d3530;
	cursor: pointer;
	text-align: start;
}

.rotitoo-delivery-toggle__icon {
	font-size: 1rem;
}

.rotitoo-cart-items:not([hidden])::before {
	content: attr(data-title);
	display: block;
	padding: 14px 20px 6px;
	font-size: 0.78rem;
	font-weight: 700;
	letter-spacing: 0.06em;
	text-transform: uppercase;
	color: #9a8580;
}

.rotitoo-cart-sheet__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 12px 20px 14px;
	border-bottom: 1px solid rgba(230, 215, 205, 0.55);
	flex-shrink: 0;
}

.rotitoo-cart-sheet__title {
	font-size: 1rem;
	font-weight: 700;
	color: #2c2420;
	margin: 0;
	letter-spacing: 0.02em;
}

.rotitoo-cart-sheet__count {
	font-weight: 500;
	color: #b85c4a;
	margin-inline-start: 6px;
}

.rotitoo-cart-sheet__close {
	width: 36px;
	height: 36px;
	border: 1px solid rgba(215, 185, 165, 0.4);
	border-radius: 50%;
	background: #f8f4f1;
	font-size: 1.4rem;
	line-height: 1;
	color: #5a4a42;
	cursor: pointer;
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 0;
}

.rotitoo-cart-sheet__body {
	flex: 1;
	overflow-y: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
	padding: 0 0 8px;
}

.rotitoo-cart-sheet__loading {
	text-align: center;
	padding: 24px;
	color: #9a8580;
	font-size: 0.85rem;
}

/* ─── Empty state ───────────────────────────────────────────── */
.rotitoo-cart-empty {
	text-align: center;
	padding: 40px 24px 32px;
}

.rotitoo-cart-empty__icon {
	font-size: 2.5rem;
	margin-bottom: 12px;
	opacity: 0.7;
}

.rotitoo-cart-empty p {
	color: #6a5a52;
	margin-bottom: 20px;
	font-size: 0.95rem;
}

/* ─── Cart items (cart-page style) ────────────────────────────── */
.rotitoo-cart-items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.rotitoo-cart-item {
	display: grid;
	grid-template-columns: 80px 1fr 32px;
	gap: 12px;
	padding: 16px 20px;
	border-bottom: 1px solid rgba(230, 215, 205, 0.45);
	align-items: start;
}

.rotitoo-cart-item__image {
	display: block;
	width: 80px;
	height: 80px;
	border-radius: 12px;
	overflow: hidden;
	border: 1px solid rgba(215, 185, 165, 0.35);
	background: #fff;
}

.rotitoo-cart-item__image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.rotitoo-cart-item__name {
	font-size: 0.88rem;
	font-weight: 600;
	color: #2c2420;
	text-decoration: none;
	line-height: 1.35;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.rotitoo-cart-item__variation {
	display: block;
	font-size: 0.72rem;
	color: #9a8580;
	margin-top: 4px;
}

.rotitoo-cart-item__meta {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 10px;
	gap: 8px;
}

.rotitoo-cart-item__price {
	font-size: 0.88rem;
	font-weight: 700;
	color: #b85c4a;
	white-space: nowrap;
}

.rotitoo-cart-item__remove {
	width: 28px;
	height: 28px;
	border: none;
	background: #f5efeb;
	border-radius: 50%;
	color: #9a8580;
	font-size: 1.1rem;
	cursor: pointer;
	line-height: 1;
	padding: 0;
}

.rotitoo-cart-item__remove:hover {
	background: #fde8e4;
	color: #b85c4a;
}

/* Qty stepper */
.rotitoo-qty {
	display: inline-flex;
	align-items: center;
	border: 1px solid rgba(215, 185, 165, 0.45);
	border-radius: 999px;
	overflow: hidden;
	background: #fdfbf9;
}

.rotitoo-qty__btn {
	width: 30px;
	height: 30px;
	border: none;
	background: transparent;
	font-size: 1rem;
	color: #5a4a42;
	cursor: pointer;
	padding: 0;
}

.rotitoo-qty__val {
	min-width: 24px;
	text-align: center;
	font-size: 0.82rem;
	font-weight: 600;
}

/* ─── Address panel ─────────────────────────────────────────── */
.rotitoo-address-panel {
	padding: 20px;
	border-top: 8px solid #f8f4f1;
}

.rotitoo-address-summary {
	display: flex;
	align-items: flex-start;
	gap: 12px;
	padding: 14px 16px;
	background: linear-gradient(135deg, #fdf8f5 0%, #f5efe9 100%);
	border: 1px solid rgba(215, 185, 165, 0.4);
	border-radius: 14px;
	margin-bottom: 4px;
}

.rotitoo-address-summary__icon {
	font-size: 1.2rem;
	flex-shrink: 0;
}

.rotitoo-address-summary__text {
	flex: 1;
	font-size: 0.82rem;
	line-height: 1.5;
	color: #3d3530;
}

.rotitoo-address-summary__edit {
	border: none;
	background: none;
	color: #b85c4a;
	font-size: 0.78rem;
	font-weight: 600;
	cursor: pointer;
	white-space: nowrap;
	padding: 0;
}

.rotitoo-address-form.is-collapsed {
	display: none;
}

.rotitoo-address-form__title {
	font-size: 0.92rem;
	font-weight: 700;
	color: #2c2420;
	margin: 0 0 8px;
}

.rotitoo-map-hint {
	font-size: 0.75rem;
	color: #9a8580;
	line-height: 1.45;
	margin: 0 0 12px;
}

.rotitoo-map-wrap {
	position: relative;
	margin-bottom: 14px;
	border-radius: 14px;
	overflow: hidden;
	border: 1px solid rgba(215, 185, 165, 0.4);
}

.rotitoo-delivery-map {
	height: 180px;
	width: 100%;
	background: #e8e0da;
	z-index: 1;
}

.rotitoo-gps-btn {
	position: absolute;
	bottom: 10px;
	inset-inline-end: 10px;
	z-index: 500;
	display: inline-flex;
	align-items: center;
	gap: 6px;
	padding: 8px 14px;
	border: none;
	border-radius: 999px;
	background: #fff;
	box-shadow: 0 4px 16px rgba(30, 20, 15, 0.15);
	font-size: 0.75rem;
	font-weight: 600;
	color: #2c2420;
	cursor: pointer;
}

.rotitoo-gps-btn.is-loading {
	opacity: 0.7;
	pointer-events: none;
}

.rotitoo-gps-btn__icon {
	color: #b85c4a;
	font-size: 0.9rem;
}

.rotitoo-address-fields {
	display: flex;
	flex-direction: column;
	gap: 10px;
	margin-bottom: 14px;
}

.rotitoo-field {
	display: flex;
	flex-direction: column;
	gap: 4px;
}

.rotitoo-field span {
	font-size: 0.72rem;
	font-weight: 600;
	color: #6a5a52;
}

.rotitoo-field input {
	border: 1px solid rgba(215, 185, 165, 0.5);
	border-radius: 10px;
	padding: 11px 14px;
	font-size: 0.88rem;
	color: #2c2420;
	background: #fff;
}

.rotitoo-field input:focus {
	outline: none;
	border-color: #b85c4a;
	box-shadow: 0 0 0 3px rgba(184, 92, 74, 0.12);
}

/* ─── Footer ────────────────────────────────────────────────── */
.rotitoo-cart-sheet__footer {
	flex-shrink: 0;
	padding: 16px 20px calc(16px + env(safe-area-inset-bottom, 0px));
	border-top: 1px solid rgba(230, 215, 205, 0.55);
	background: #fff;
	box-shadow: 0 -4px 20px rgba(200, 160, 140, 0.08);
}

.rotitoo-cart-total {
	display: flex;
	justify-content: space-between;
	align-items: center;
	margin-bottom: 12px;
	font-size: 0.88rem;
	color: #5a4a42;
}

.rotitoo-cart-total__amount {
	font-size: 1.15rem;
	font-weight: 700;
	color: #b85c4a;
}

.rotitoo-cart-full-link {
	display: block;
	text-align: center;
	margin-top: 10px;
	font-size: 0.78rem;
	color: #9a8580;
	text-decoration: underline;
}

/* ─── Buttons ───────────────────────────────────────────────── */
.rotitoo-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 100%;
	padding: 14px 20px;
	border-radius: 999px;
	font-size: 0.88rem;
	font-weight: 700;
	letter-spacing: 0.03em;
	border: none;
	cursor: pointer;
	text-decoration: none;
	transition: opacity 0.2s ease, transform 0.15s ease;
}

.rotitoo-btn:active {
	transform: scale(0.98);
}

.rotitoo-btn--dark {
	background: #2c2420;
	color: #fff;
}

.rotitoo-btn--dark:disabled {
	opacity: 0.45;
	cursor: not-allowed;
}

.rotitoo-btn--accent {
	background: #b85c4a;
	color: #fff;
}

.rotitoo-btn--outline {
	background: transparent;
	border: 1.5px solid rgba(215, 185, 165, 0.55);
	color: #2c2420;
	width: auto;
	padding: 12px 28px;
}

@media (min-width: 600px) {
	.rotitoo-cart-sheet {
		inset-inline: auto;
		left: 50%;
		right: auto;
		transform: translate(-50%, 100%);
		width: min(480px, 100vw);
		border-radius: 20px 20px 0 0;
	}

	.rotitoo-cart-sheet.is-open {
		transform: translate(-50%, 0);
	}

	.rotitoo-cart-sheet.is-open.is-dragging,
	.rotitoo-cart-sheet.is-dragging {
		transform: translate(-50%, var(--drag-y, 0));
	}

	.rotitoo-delivery-map {
		height: 200px;
	}
}

@media (prefers-reduced-motion: reduce) {
	.rotitoo-cart-sheet,
	.rotitoo-cart-overlay {
		transition-duration: 0.15s;
	}
}

/* Leaflet z-index fix inside sheet */
.rotitoo-delivery-map .leaflet-pane {
	z-index: 2;
}

.rotitoo-delivery-map .leaflet-top,
.rotitoo-delivery-map .leaflet-bottom {
	z-index: 3;
}
