/* Floaty Cart — frontend */
.fcart {
	--fc-primary: #55604b;
	--fc-btn-text: #fff;
	--fc-badge-bg: #d6453d;
	--fc-badge-text: #fff;
	--fc-btn-radius: 14px;
	--fc-popup-radius: 24px;
	--fc-size: 60px;
	--fc-z: 9999;
	--fc-ink: #111;
	--fc-muted: #6b7280;
	--fc-line: #e5e7eb;
	--fc-soft: #f1f1f0;
}

.fcart,
.fcart *,
.fcart *::before,
.fcart *::after {
	box-sizing: border-box;
}

.fcart [hidden] {
	display: none !important;
}

/* ---- Pulsante fluttuante ---- */
.fcart .fcart-toggle {
	position: fixed;
	z-index: var(--fc-z);
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: var(--fc-size);
	height: var(--fc-size);
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: min(var(--fc-btn-radius), 50%);
	background: var(--fc-primary);
	color: var(--fc-btn-text);
	box-shadow: 0 8px 24px rgba(0, 0, 0, 0.22);
	cursor: pointer;
	line-height: 1;
	transition: transform 0.18s ease, box-shadow 0.18s ease;
	-webkit-appearance: none;
	appearance: none;
}

.fcart .fcart-toggle:hover {
	transform: translateY(-2px);
	box-shadow: 0 12px 28px rgba(0, 0, 0, 0.26);
	background: var(--fc-primary);
	color: var(--fc-btn-text);
}

.fcart .fcart-toggle:focus-visible,
.fcart .fcart-close:focus-visible,
.fcart .fcart-qty-btn:focus-visible,
.fcart .fcart-remove:focus-visible,
.fcart .fcart-btn:focus-visible {
	outline: 3px solid var(--fc-primary);
	outline-offset: 2px;
}

.fcart .fcart-toggle:focus-visible {
	outline-color: var(--fc-ink);
	outline-offset: 3px;
}

.fcart .fcart-toggle-icon {
	display: inline-flex;
}

.fcart .fcart-toggle-icon svg {
	width: calc(var(--fc-size) * 0.45);
	height: calc(var(--fc-size) * 0.45);
}

.fcart--bottom-right .fcart-toggle {
	right: calc(24px + env(safe-area-inset-right, 0px));
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.fcart--bottom-left .fcart-toggle {
	left: calc(24px + env(safe-area-inset-left, 0px));
	bottom: calc(24px + env(safe-area-inset-bottom, 0px));
}

.fcart--top-right .fcart-toggle {
	right: calc(24px + env(safe-area-inset-right, 0px));
	top: calc(24px + env(safe-area-inset-top, 0px));
}

.fcart--top-left .fcart-toggle {
	left: calc(24px + env(safe-area-inset-left, 0px));
	top: calc(24px + env(safe-area-inset-top, 0px));
}

.fcart.fcart--hide-empty[data-count="0"] .fcart-toggle {
	display: none;
}

/* Badge */
.fcart .fcart-badge {
	position: absolute;
	top: -6px;
	right: -6px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 22px;
	height: 22px;
	padding: 0 6px;
	border-radius: 999px;
	background: var(--fc-badge-bg);
	color: var(--fc-badge-text);
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	box-shadow: 0 0 0 2px #fff;
}

.fcart .fcart-badge[data-count="0"] {
	display: none;
}

.fcart .fcart-sr {
	position: absolute !important;
	width: 1px;
	height: 1px;
	margin: -1px;
	padding: 0;
	overflow: hidden;
	clip: rect(0, 0, 0, 0);
	white-space: nowrap;
	border: 0;
}

/* ---- Overlay + popup ---- */
.fcart .fcart-overlay {
	position: fixed;
	inset: 0;
	z-index: var(--fc-z);
	background: var(--fc-overlay, rgba(17, 24, 17, 0.5));
	opacity: 0;
	transition: opacity 0.22s ease;
}

.fcart .fcart-dialog {
	position: fixed;
	z-index: calc(var(--fc-z) + 1);
	top: 50%;
	left: 50%;
	display: flex;
	flex-direction: column;
	width: min(440px, calc(100vw - 24px));
	max-height: calc(100vh - 24px);
	max-height: calc(100dvh - 24px);
	overflow: hidden;
	border-radius: var(--fc-popup-radius);
	background: #fff;
	color: var(--fc-ink);
	font-size: 14px;
	line-height: 1.35;
	box-shadow: 0 24px 60px rgba(0, 0, 0, 0.3);
	opacity: 0;
	transform: translate(-50%, -47%) scale(0.97);
	transition: opacity 0.22s ease, transform 0.22s ease;
	outline: 0;
}

.fcart.is-open .fcart-overlay {
	opacity: 1;
}

.fcart.is-open .fcart-dialog {
	opacity: 1;
	transform: translate(-50%, -50%) scale(1);
}

/* ---- Popup sopra il pulsante ---- */
.fcart.fcart--popup-above .fcart-toggle {
	z-index: calc(var(--fc-z) + 2);
}

.fcart.fcart--popup-above .fcart-dialog {
	top: auto;
	right: auto;
	bottom: auto;
	left: auto;
	max-height: calc(100vh - var(--fc-size) - 72px);
	max-height: calc(100dvh - var(--fc-size) - 72px);
	transform: translateY(10px) scale(0.97);
}

.fcart.fcart--popup-above.is-open .fcart-dialog {
	transform: none;
}

.fcart.fcart--popup-above.fcart--bottom-right .fcart-dialog {
	right: calc(24px + env(safe-area-inset-right, 0px));
	bottom: calc(24px + var(--fc-size) + 20px + env(safe-area-inset-bottom, 0px));
	transform-origin: bottom right;
}

.fcart.fcart--popup-above.fcart--bottom-left .fcart-dialog {
	left: calc(24px + env(safe-area-inset-left, 0px));
	bottom: calc(24px + var(--fc-size) + 20px + env(safe-area-inset-bottom, 0px));
	transform-origin: bottom left;
}

.fcart.fcart--popup-above.fcart--top-right .fcart-dialog {
	right: calc(24px + env(safe-area-inset-right, 0px));
	top: calc(24px + var(--fc-size) + 20px + env(safe-area-inset-top, 0px));
	transform-origin: top right;
}

.fcart.fcart--popup-above.fcart--top-left .fcart-dialog {
	left: calc(24px + env(safe-area-inset-left, 0px));
	top: calc(24px + var(--fc-size) + 20px + env(safe-area-inset-top, 0px));
	transform-origin: top left;
}

.fcart.fcart--popup-above.fcart--top-right .fcart-dialog,
.fcart.fcart--popup-above.fcart--top-left .fcart-dialog {
	transform: translateY(-10px) scale(0.97);
}

.fcart.fcart--popup-above.is-open.fcart--top-right .fcart-dialog,
.fcart.fcart--popup-above.is-open.fcart--top-left .fcart-dialog {
	transform: none;
}

html.fcart-lock {
	overflow: hidden;
}

.fcart .fcart-notice {
	margin: 12px 24px 0;
	padding: 10px 14px;
	border-radius: 10px;
	background: #fdecea;
	color: #8a1f17;
	font-size: 12px;
}

.fcart .fcart-content {
	display: flex;
	flex: 1 1 auto;
	flex-direction: column;
	min-height: 0;
	transition: opacity 0.15s ease;
}

.fcart .fcart-dialog.is-loading .fcart-content {
	opacity: 0.55;
	pointer-events: none;
}

/* Header */
.fcart .fcart-header {
	display: flex;
	align-items: flex-start;
	gap: 18px;
	padding: 26px 24px 8px;
}

.fcart .fcart-header-icon {
	display: inline-flex;
	flex: 0 0 auto;
	padding-top: 2px;
	color: var(--fc-ink);
}

.fcart .fcart-header-text {
	flex: 1 1 auto;
	min-width: 0;
}

.fcart .fcart-title {
	margin: 0;
	padding: 0;
	color: var(--fc-ink);
	font-size: 24px;
	font-weight: 700;
	line-height: 1.2;
	letter-spacing: 0;
	text-transform: none;
}

.fcart .fcart-count {
	margin: 4px 0 0;
	color: var(--fc-muted);
	font-size: 15px;
}

.fcart .fcart-close {
	display: inline-flex;
	flex: 0 0 auto;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--fc-ink);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.fcart .fcart-close:hover {
	background: var(--fc-soft);
	color: var(--fc-ink);
}

/* Righe prodotto */
.fcart .fcart-items {
	flex: 1 1 auto;
	min-height: 0;
	margin: 0;
	padding: 4px 24px 0;
	overflow-y: auto;
	list-style: none;
}

.fcart .fcart-item {
	display: grid;
	grid-template-columns: 96px minmax(0, 1fr);
	gap: 16px;
	margin: 0;
	padding: 16px 0;
	border-bottom: 1px solid var(--fc-line);
}

.fcart .fcart-item::before {
	content: none;
}

.fcart .fcart-item-thumb a {
	display: block;
}

.fcart .fcart-item-thumb img {
	display: block;
	width: 96px;
	height: 96px;
	margin: 0;
	border-radius: 16px;
	object-fit: cover;
	background: var(--fc-soft);
}

.fcart .fcart-item-info p {
	margin: 0;
}

.fcart .fcart-item-name,
.fcart .fcart-item-name a {
	color: var(--fc-ink);
	font-size: 15px;
	font-weight: 600;
	line-height: 1.25;
	text-decoration: none;
}

.fcart .fcart-item-meta {
	margin-top: 6px !important;
	color: var(--fc-muted);
	font-size: 12px;
}

.fcart .fcart-item-price {
	margin-top: 8px !important;
	color: var(--fc-ink);
	font-size: 15px;
	font-weight: 600;
}

.fcart .fcart-item-price del {
	color: var(--fc-muted);
	font-weight: 400;
}

.fcart .fcart-item-price ins {
	background: none;
	text-decoration: none;
}

.fcart .fcart-item-actions {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	margin-top: 10px;
}

.fcart .fcart-qty {
	display: inline-flex;
	align-items: stretch;
	overflow: hidden;
	border-radius: 9px;
	background: var(--fc-soft);
}

.fcart .fcart-qty-btn {
	width: 28px;
	height: 28px;
	margin: 0;
	padding: 0;
	border: 0;
	background: transparent;
	color: var(--fc-ink);
	font-size: 16px;
	line-height: 1;
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.fcart .fcart-qty-btn:hover:not(:disabled) {
	background: rgba(0, 0, 0, 0.06);
	color: var(--fc-ink);
}

.fcart .fcart-qty-btn:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.fcart .fcart-qty-value {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 28px;
	margin: 3px 0;
	background: #fff;
	font-size: 14px;
	font-weight: 600;
}

.fcart .fcart-qty-fixed {
	color: var(--fc-muted);
	font-size: 12px;
}

.fcart .fcart-remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 40px;
	margin: 0;
	padding: 0;
	border: 0;
	border-radius: 10px;
	background: transparent;
	color: var(--fc-muted);
	cursor: pointer;
	-webkit-appearance: none;
	appearance: none;
}

.fcart .fcart-remove:hover {
	background: var(--fc-soft);
	color: var(--fc-ink);
}

/* Footer */
.fcart .fcart-footer {
	flex: 0 0 auto;
	padding: 18px 24px 24px;
}

.fcart .fcart-subtotal {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 12px;
	color: var(--fc-ink);
	font-size: 17px;
	font-weight: 600;
}

.fcart .fcart-subtotal-value {
	font-size: 20px;
	font-weight: 700;
}

.fcart .fcart-shipping-note {
	margin: 10px 0 0;
	color: var(--fc-muted);
	font-size: 13px;
}

.fcart .fcart-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	width: 100%;
	min-height: 52px;
	margin: 0;
	padding: 12px 20px;
	border: 1.5px solid var(--fc-primary);
	border-radius: var(--fc-btn-radius);
	font-size: 16px;
	font-weight: 600;
	line-height: 1.2;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: filter 0.15s ease, background-color 0.15s ease;
}

.fcart .fcart-btn + .fcart-btn,
.fcart .fcart-shipping-note + .fcart-btn,
.fcart .fcart-subtotal + .fcart-btn {
	margin-top: 14px;
}

.fcart .fcart-shipping-note + .fcart-btn {
	margin-top: 20px;
}

.fcart .fcart-btn--secondary {
	border-color: var(--fc-ink);
	background: #fff;
	color: var(--fc-ink);
}

.fcart .fcart-btn--secondary:hover {
	background: var(--fc-soft);
	color: var(--fc-ink);
}

.fcart .fcart-btn--primary {
	background: var(--fc-primary);
	color: var(--fc-btn-text);
}

.fcart .fcart-btn--primary:hover {
	filter: brightness(1.1);
	color: var(--fc-btn-text);
}

/* Carrello vuoto */
.fcart .fcart-empty {
	padding: 28px 24px 28px;
	text-align: center;
}

.fcart .fcart-empty-text {
	margin: 0 0 20px;
	color: var(--fc-muted);
	font-size: 15px;
}

/* Visibilità per dispositivo */
@media (max-width: 767px) {
	.fcart.fcart--hide-mobile {
		display: none !important;
	}
}

@media (min-width: 768px) {
	.fcart.fcart--hide-desktop {
		display: none !important;
	}
}

@media (max-width: 480px) {
	.fcart .fcart-header {
		padding: 20px 18px 4px;
		gap: 14px;
	}

	.fcart .fcart-title {
		font-size: 20px;
	}

	.fcart .fcart-items {
		padding: 4px 18px 0;
	}

	.fcart .fcart-item {
		grid-template-columns: 80px minmax(0, 1fr);
		gap: 14px;
	}

	.fcart .fcart-item-thumb img {
		width: 80px;
		height: 80px;
	}

	.fcart .fcart-footer {
		padding: 16px 18px 20px;
	}
}

/* Movimento ridotto */
@media (prefers-reduced-motion: reduce) {
	.fcart .fcart-toggle,
	.fcart .fcart-overlay,
	.fcart .fcart-dialog,
	.fcart .fcart-content,
	.fcart .fcart-btn {
		transition: none !important;
	}

	.fcart .fcart-toggle:hover {
		transform: none;
	}

	.fcart .fcart-dialog,
	.fcart.is-open .fcart-dialog {
		transform: translate(-50%, -50%);
	}

	.fcart.fcart--popup-above .fcart-dialog,
	.fcart.fcart--popup-above.is-open .fcart-dialog {
		transform: none;
	}
}
