/* ESP-i Catalog — right-side fly-in cart drawer.
   Self-contained, injected site-wide, backed by the WooCommerce Store API.
   Scoped under .espi-cart-drawer / .espi-cart-overlay. */

.espi-cart-overlay {
	position: fixed;
	inset: 0;
	background: rgba(15, 23, 42, .55);
	opacity: 0;
	visibility: hidden;
	transition: opacity .3s ease, visibility .3s ease;
	z-index: 100000;
}
.espi-cart-overlay.is-open { opacity: 1; visibility: visible; }

.espi-cart-drawer {
	position: fixed;
	top: 0;
	right: 0;
	height: 100%;
	width: 400px;
	max-width: 92vw;
	background: #fff;
	box-shadow: -12px 0 40px rgba(0, 0, 0, .18);
	transform: translateX(100%);
	transition: transform .32s cubic-bezier(.4, 0, .2, 1);
	z-index: 100001;
	display: flex;
	flex-direction: column;
	font-size: 14px;
	color: #1f2a37;
}
.espi-cart-drawer.is-open { transform: translateX(0); }
.espi-cart-drawer *, .espi-cart-drawer *::before, .espi-cart-drawer *::after { box-sizing: border-box; }

/* Lock background scroll while the drawer is open. */
html.espi-cart-locked, html.espi-cart-locked body { overflow: hidden; }

/* ---- Header ---- */
.espi-cart-head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 18px 20px;
	background: #222;
	color: #fff;
	flex: 0 0 auto;
}
.espi-cart-title { font-size: 16px; font-weight: 700; margin: 0; }
.espi-cart-title .espi-cart-count { opacity: .7; font-weight: 500; }
.espi-cart-close {
	width: 34px; height: 34px;
	border: 0; background: transparent; color: #fff;
	font-size: 26px; line-height: 1; cursor: pointer; border-radius: 8px;
	display: inline-flex; align-items: center; justify-content: center;
	transition: background .15s;
}
.espi-cart-close:hover { background: rgba(255, 255, 255, .15); }

/* ---- Body ---- */
.espi-cart-body { flex: 1 1 auto; overflow-y: auto; padding: 8px 20px; }
.espi-cart-empty { text-align: center; color: #64748b; padding: 60px 20px; }
.espi-cart-empty .espi-cart-empty-ico { font-size: 40px; display: block; margin-bottom: 12px; opacity: .5; }

.espi-cart-item {
	display: grid;
	grid-template-columns: 64px 1fr auto;
	gap: 14px;
	align-items: start;
	padding: 16px 0;
	border-bottom: 1px solid #eef1f6;
}
.espi-cart-thumb {
	width: 64px; height: 64px; object-fit: contain;
	border: 1px solid #eef1f6; border-radius: 8px; background: #fff;
}
.espi-cart-item-info { min-width: 0; }
.espi-cart-item-name {
	display: block; font-weight: 600; color: #1f2a37; font-size: 13.5px;
	line-height: 1.35; text-decoration: none; margin-bottom: 6px;
}
.espi-cart-item-name:hover { color: var(--rio-primary-color, #2f7de1); }
.espi-cart-item-price { color: #64748b; font-size: 12.5px; margin-bottom: 8px; }

.espi-cart-qty { display: inline-flex; align-items: center; border: 1px solid #e5e9f0; border-radius: 8px; overflow: hidden; }
.espi-cart-qty button {
	width: 30px; height: 30px; border: 0; background: #f3f6fb; color: #1f2a37;
	font-size: 16px; line-height: 1; cursor: pointer;
}
.espi-cart-qty button:hover { background: #e8eefb; }
.espi-cart-qty button:disabled { opacity: .4; cursor: default; }
.espi-cart-qty-input {
	width: 40px; height: 30px; border: 0; text-align: center; font-size: 13px;
	-moz-appearance: textfield; background: #fff; color: #1f2a37;
}
.espi-cart-qty-input::-webkit-outer-spin-button,
.espi-cart-qty-input::-webkit-inner-spin-button { -webkit-appearance: none; margin: 0; }

.espi-cart-item-right { display: flex; flex-direction: column; align-items: flex-end; gap: 10px; }
.espi-cart-line-total { font-weight: 700; font-size: 13.5px; white-space: nowrap; }
.espi-cart-remove {
	border: 0; background: transparent; color: #94a3b8; cursor: pointer;
	font-size: 12px; padding: 2px; text-decoration: underline;
}
.espi-cart-remove:hover { color: #b91c1c; }

.espi-cart-item.is-busy { opacity: .5; pointer-events: none; }

/* ---- Footer ---- */
.espi-cart-foot { flex: 0 0 auto; border-top: 1px solid #eef1f6; padding: 18px 20px; background: #fff; }
.espi-cart-subtotal { display: flex; align-items: baseline; justify-content: space-between; margin-bottom: 14px; }
.espi-cart-subtotal span { color: #64748b; font-size: 14px; }
.espi-cart-subtotal strong { font-size: 20px; font-weight: 800; }
.espi-cart-foot .espi-cart-actions { display: flex; flex-direction: column; gap: 10px; }
/* The buttons reuse the theme's .btn classes; only flow tweaks live here. */
.espi-cart-foot .btn { width: 100%; height: auto !important; min-height: 0; white-space: normal; }
.espi-cart-note { margin: 12px 0 0; font-size: 12px; color: #94a3b8; text-align: center; }

.espi-cart-drawer .espi-cart-loading { text-align: center; color: #64748b; padding: 40px 20px; }

@media (max-width: 480px) {
	.espi-cart-drawer { width: 100%; max-width: 100%; }
}
