/**
 * IEP Shop Builder — stili base del widget Cart Panel.
 *
 * Regole di default sobrie: colori, tipografia, dimensioni ecc. vengono
 * sovrascritti dai controlli Stile del pannello Elementor ({{WRAPPER}}).
 */

.iep-cart-panel-widget {
	--iep-cp-accent: #ffb6b7;
	--iep-cp-panel-width: 420px;
	--iep-cp-duration: 350ms;
	--iep-cp-easing: cubic-bezier(0.22, 1, 0.36, 1);
	--iep-cp-overlay-opacity: 1;
	--iep-cp-radius: 5px;
	font-family: 'Roboto', sans-serif;
	display: inline-block;
}

.iep-cart-panel-widget .iep-icon {
	display: inline-block;
	vertical-align: middle;
	flex-shrink: 0;
}

/* =========================================================
   Trigger
   ========================================================= */

.iep-cart-panel-trigger {
	position: relative;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	gap: 8px;
	appearance: none;
	background: transparent;
	border: 0;
	padding: 4px;
	margin: 0;
	cursor: pointer;
	color: inherit;
	line-height: 0;
}

.iep-cart-panel-trigger__label {
	line-height: 1.2;
	font-size: 13px;
	font-weight: 500;
	white-space: nowrap;
}

.iep-cart-panel-badge {
	position: absolute;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 16px;
	height: 16px;
	padding: 0 4px;
	border-radius: 999px;
	background: #d32f2f;
	color: #fff;
	font-size: 10px;
	font-weight: 700;
	line-height: 1;
	pointer-events: none;
}

/* Posizione badge: la classe è aggiunta dal controllo Elementor
   "prefix_class" (badge_position) sul contenitore del widget. */
.iep-cart-panel-widget .iep-cart-panel-badge {
	top: -4px;
	right: -6px;
}
.iep-cp-badge-pos-top-left .iep-cart-panel-badge {
	top: -4px;
	right: auto;
	left: -6px;
}
.iep-cp-badge-pos-bottom-right .iep-cart-panel-badge {
	top: auto;
	bottom: -4px;
	right: -6px;
}
.iep-cp-badge-pos-bottom-left .iep-cart-panel-badge {
	top: auto;
	bottom: -4px;
	right: auto;
	left: -6px;
}

/* =========================================================
   Overlay
   ========================================================= */

.iep-cart-panel__overlay {
	position: fixed;
	inset: 0;
	background: rgba(20, 20, 20, 0.55);
	opacity: 0;
	visibility: hidden;
	pointer-events: none;
	backdrop-filter: blur(2px);
	-webkit-backdrop-filter: blur(2px);
	transition: opacity var(--iep-cp-duration) var(--iep-cp-easing), visibility 0s linear var(--iep-cp-duration);
	z-index: 100000;
}

.iep-cart-panel-widget.is-open .iep-cart-panel__overlay {
	opacity: var(--iep-cp-overlay-opacity);
	visibility: visible;
	pointer-events: auto;
	transition-delay: 0s;
}

/* =========================================================
   Pannello
   ========================================================= */

.iep-cart-panel {
	position: fixed;
	top: 0;
	bottom: 0;
	width: var(--iep-cp-panel-width);
	max-width: 100vw;
	background: #fff;
	display: flex;
	flex-direction: column;
	z-index: 100001;
	box-shadow: 0 0 48px rgba(0, 0, 0, 0.18);
	transition: transform var(--iep-cp-duration) var(--iep-cp-easing), visibility 0s linear var(--iep-cp-duration);
	visibility: hidden;
}

.iep-cart-panel[data-side="right"] {
	right: 0;
	transform: translateX(100%);
	border-radius: var(--iep-cp-radius) 0 0 var(--iep-cp-radius);
}

.iep-cart-panel[data-side="left"] {
	left: 0;
	transform: translateX(-100%);
	border-radius: 0 var(--iep-cp-radius) var(--iep-cp-radius) 0;
}

/* La toolbar admin di WordPress (per gli utenti loggati) è anch'essa
   position:fixed in cima allo schermo: senza questo, il nostro pannello
   partirebbe comunque da y:0 e ci finirebbe sotto/sopra in modo scomodo.
   WordPress aggiunge da solo la classe "admin-bar" al <body>, con altezza
   nota (32px da desktop, 46px sotto i 782px, stessa soglia usata dal core). */
body.admin-bar .iep-cart-panel {
	top: 32px;
}

@media (max-width: 782px) {
	body.admin-bar .iep-cart-panel {
		top: 46px;
	}
}

.iep-cart-panel-widget.is-open .iep-cart-panel {
	transform: translateX(0);
	visibility: visible;
	transition-delay: 0s;
}

/* =========================================================
   Header
   ========================================================= */

.iep-cart-panel__header {
	display: flex;
	align-items: center;
	min-height: 64px;
	gap: 12px;
	padding: 20px 16px 20px 24px;
	border-bottom: 1px solid rgba(0, 0, 0, 0.08);
	flex-shrink: 0;
	box-sizing: border-box;
}

/* Il titolo occupa sempre lo spazio residuo: stessa tecnica di
   .iep-hb-menu__title, per un allineamento identico tra i due widget. */
.iep-cart-panel__title {
	flex: 1 1 auto;
	margin: 0;
	font-size: 16px;
	font-weight: 600;
	line-height: 1.3;
	overflow-wrap: break-word;
	min-width: 0;
}

.iep-cart-panel__close {
	appearance: none;
	background: transparent;
	border: 0;
	border-radius: 50%;
	width: 36px;
	height: 36px;
	padding: 0;
	margin: 0;
	cursor: pointer;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	flex-shrink: 0;
	color: inherit;
	transition: background-color 0.2s ease;
}

.iep-cart-panel__close:focus-visible {
	outline: 2px solid currentColor;
	outline-offset: 2px;
}

/* =========================================================
   Contenuto (body + footer), sostituito via AJAX ad ogni modifica
   ========================================================= */

.iep-cart-panel__content {
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
}

.iep-cart-panel__body {
	flex: 1 1 auto;
	overflow-y: auto;
	padding: 8px 24px;
}

/* ---- Stato vuoto ---- */

.iep-cart-panel__empty {
	width: 100%;
	height: 100%;
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	gap: 14px;
	padding: 40px 16px;
	box-sizing: border-box;
}

.iep-cart-panel__empty-icon,
.iep-cart-panel__empty-image {
	opacity: 0.4;
}

.iep-cart-panel__empty-image {
	max-width: 120px;
	height: auto;
}

.iep-cart-panel__empty-text {
	margin: 0;
	font-size: 14px;
	color: inherit;
}

.iep-cart-panel__empty-btn {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	padding: 12px 24px;
	background: var(--iep-cp-accent);
	color: #fff;
	border: 1px solid var(--iep-cp-accent);
	border-radius: 4px;
	font-size: 13px;
	font-weight: 600;
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	box-sizing: border-box;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease;
}

.iep-cart-panel__empty-btn:hover {
	background: #fff;
	color: #7a7a7a;
	border-color: #7a7a7a;
}

/* ---- Righe carrello ---- */

.iep-cart-panel__items {
	list-style: none;
	margin: 0;
	padding: 0;
}

.iep-cart-panel__item {
	display: grid;
	grid-template-columns: auto 1fr auto;
	gap: 14px;
	align-items: flex-start;
	padding: 16px 0;
	border-bottom: 1px solid rgba(0, 0, 0, 0.06);
	transition: opacity 0.2s ease, transform 0.2s ease;
}

.iep-cart-panel__item.is-removing {
	opacity: 0;
	transform: translateX(12px);
}

.iep-cart-panel__item-image {
	width: 72px;
	height: 72px;
	border-radius: 4px;
	overflow: hidden;
	background: rgba(0, 0, 0, 0.04);
	flex-shrink: 0;
}

.iep-cart-panel__item-image img {
	width: 100%;
	height: 100%;
	object-fit: cover;
	display: block;
}

.iep-cart-panel__item-name {
	margin: 0 0 4px;
	font-size: 14px;
	font-weight: 600;
	line-height: 1.3;
}

.iep-cart-panel__item-name a {
	color: inherit;
	text-decoration: none;
}

.iep-cart-panel__item-name a:hover {
	text-decoration: underline;
}

.iep-cart-panel__item-price {
	font-size: 13px;
	opacity: 0.75;
	margin-bottom: 10px;
}

.iep-cart-panel__item-qty {
	display: inline-flex;
	align-items: center;
	gap: 1px;
	background: rgba(0, 0, 0, 0.04);
	border-radius: 999px;
	padding: 2px;
	width: max-content;
}

.iep-cart-panel__qty-btn {
	appearance: none;
	background: transparent;
	border: 0;
	border-radius: 50%;
	width: 20px;
	height: 20px;
	padding: 0;
	margin: 0;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	cursor: pointer;
	color: inherit;
	transition: background-color 0.2s ease;
}

.iep-cart-panel__qty-btn:hover {
	background: rgba(0, 0, 0, 0.08);
}

.iep-cart-panel__qty-input {
	width: 26px;
	border: 0;
	background: transparent;
	text-align: center;
	font-size: 12px;
	color: inherit;
	appearance: textfield;
	-moz-appearance: textfield;
}

.iep-cart-panel__qty-input::-webkit-outer-spin-button,
.iep-cart-panel__qty-input::-webkit-inner-spin-button {
	appearance: none;
	margin: 0;
}

.iep-cart-panel__item-side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: space-between;
	height: 100%;
	gap: 10px;
	text-align: right;
}

.iep-cart-panel__item-subtotal {
	font-size: 13px;
	font-weight: 600;
	white-space: nowrap;
}

.iep-cart-panel__remove {
	appearance: none;
	background: transparent;
	border: 0;
	padding: 0;
	margin: 0;
	cursor: pointer;
	color: inherit;
	opacity: 0.6;
	font-size: 12px;
	text-decoration: underline;
	text-underline-offset: 2px;
	white-space: nowrap;
	transition: opacity 0.2s ease;
}

.iep-cart-panel__remove:hover {
	opacity: 1;
}

/* =========================================================
   Divisore + footer
   ========================================================= */

.iep-cart-panel__divider {
	height: 1px;
	margin: 0 24px;
	background: rgba(0, 0, 0, 0.08);
	flex-shrink: 0;
}

.iep-cart-panel__footer {
	flex-shrink: 0;
	padding: 20px 24px 24px;
	display: flex;
	flex-direction: column;
	gap: 14px;
}

.iep-cart-panel__subtotal {
	display: flex;
	align-items: center;
	justify-content: space-between;
	font-size: 15px;
}

.iep-cart-panel__subtotal-label {
	font-weight: 600;
}

.iep-cart-panel__subtotal-value {
	font-weight: 700;
}

/* Bordo rosa forzato con !important: su questo sito il widget ha un
   border-color già salvato collegato a un Colore Globale di Elementor
   (var(--e-global-color-secondary), scuro) con selettore
   ".elementor-{page} .elementor-element-{id} ..." — più specifico di
   qualunque nostra regola normale. Senza !important quel valore salvato
   vince sempre, a prescindere dal default impostato lato PHP. */
.iep-cart-panel__checkout-btn {
	display: flex;
	align-items: center;
	justify-content: center;
	padding: 14px 20px;
	background: var(--iep-cp-accent);
	color: #fff;
	border: 2px solid #ffb6b7 !important;
	border-radius: 4px;
	font-size: 14px;
	font-weight: 600;
	text-align: center;
	text-decoration: none;
	text-transform: uppercase;
	letter-spacing: 0.04em;
	transition: background-color 0.2s ease, color 0.2s ease, border-color 0.2s ease, opacity 0.2s ease;
}

.iep-cart-panel__checkout-btn:hover {
	border-color: #7a7a7a !important;
}

.iep-cart-panel__continue {
	appearance: none;
	background: transparent;
	border: 0;
	padding: 0;
	margin: 0 auto;
	cursor: pointer;
	font-size: 13px;
	text-decoration: underline;
	color: inherit;
	text-align: center;
}

/* =========================================================
   Mobile
   ========================================================= */

@media (max-width: 480px) {
	.iep-cart-panel {
		width: 100%;
		max-width: 100vw;
		border-radius: 0;
	}
}

/* Blocco scroll body mentre il pannello è aperto (classe aggiunta da iep-cart-panel.js). */
body.iep-cart-panel-open {
	overflow: hidden;
}
