/**
 * Cart drawer styles.
 *
 * Off-canvas right-side panel. Uses CSS variables shared with configurator.
 *
 * @package ConveyCraft\Conveyors
 */

.ccc-cart-drawer {
	--ccc-accent: var(--cc-accent, #0f172a);

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

.ccc-cart-drawer.is-open {
	pointer-events: auto;
	visibility: visible;
}

.ccc-cart-drawer__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(15, 23, 42, 0.5);
	opacity: 0;
	transition: opacity 0.2s ease;
}

.ccc-cart-drawer.is-open .ccc-cart-drawer__backdrop {
	opacity: 1;
}

.ccc-cart-drawer__panel {
	position: absolute;
	inset: 0 0 0 auto;
	width: min(420px, 100%);
	background: var(--ccc-surface, Canvas);
	color: CanvasText;
	display: grid;
	grid-template-rows: auto 1fr auto;
	transform: translateX(100%);
	transition: transform 0.25s ease;
	box-shadow: -8px 0 32px rgba(15, 23, 42, 0.15);
}

.ccc-cart-drawer.is-open .ccc-cart-drawer__panel {
	transform: translateX(0);
}

.admin-bar .ccc-cart-drawer__panel {
	top: 32px;
	height: calc(100% - 32px);
}
.ccc-cart-drawer__header {
	display: flex;
	justify-content: space-between;
	align-items: center;
	padding: 1.25rem 1.25rem 0.75rem;
	border-bottom: 1px solid color-mix(in srgb, currentColor 12%, transparent);
}

.ccc-cart-drawer__title {
	display: flex;
	align-items: center;
	gap: 0.6rem;
	margin: 0;
	font-size: 1.15rem;
	font-weight: 700;
}

.ccc-cart-drawer__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	min-width: 1.5em;
	height: 1.5em;
	padding: 0 0.4em;
	border-radius: 999px;
	background: var(--ccc-accent);
	color: #fff;
	font-size: 0.7rem;
	font-weight: 700;
}

.ccc-cart-drawer__close {
	width: 2rem;
	height: 2rem;
	border: 0;
	background: transparent;
	color: inherit;
	font-size: 1.5rem;
	font-weight: 400;
	line-height: 1;
	cursor: pointer;
	border-radius: 0.25rem;
	transition: background 0.12s ease;
}

.ccc-cart-drawer__close:hover {
	background: color-mix(in srgb, currentColor 8%, transparent);
}

.ccc-cart-drawer__body {
	overflow-y: auto;
	padding: 1rem 1.25rem;
}

.ccc-cart-drawer__empty {
	text-align: center;
	padding: 3rem 1rem;
	color: #6b7280;
}

.ccc-cart-drawer__item {
	display: grid;
	grid-template-columns: 1fr auto;
	gap: 0.75rem;
	padding: 0.85rem 0;
	border-bottom: 1px solid color-mix(in srgb, currentColor 8%, transparent);
}

.ccc-cart-drawer__item-title {
	margin: 0;
	font-size: 0.95rem;
	font-weight: 600;
	line-height: 1.3;
}

.ccc-cart-drawer__item-sku {
	font-size: 0.7rem;
	opacity: 0.5;
	font-family: ui-monospace, SFMono-Regular, Menlo, Consolas, monospace;
	margin-top: 0.15rem;
}

.ccc-cart-drawer__item-lines {
	margin: 0.4rem 0 0;
	padding: 0;
	list-style: none;
	font-size: 0.82rem;
	color: #4b5563;
}

.ccc-cart-drawer__item-lines li {
	padding: 0.05rem 0;
}

.ccc-cart-drawer__item-side {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	gap: 0.4rem;
}

.ccc-cart-drawer__item-price {
	font-weight: 700;
	font-size: 0.95rem;
	font-variant-numeric: tabular-nums;
}

.ccc-cart-drawer__item-remove {
	border: 0;
	background: transparent;
	color: #9ca3af;
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	padding: 0.25rem 0.5rem;
	border-radius: 0.25rem;
	transition: color 0.12s ease, background 0.12s ease;
}

.ccc-cart-drawer__item-remove:hover {
	color: #dc2626;
	background: #fef2f2;
}

.ccc-cart-drawer__footer {
	padding: 1rem 1.25rem 1.25rem;
	border-top: 1px solid color-mix(in srgb, currentColor 12%, transparent);
	background: color-mix(in srgb, currentColor 2%, transparent);
}

.ccc-cart-drawer__total {
	font-weight: 700;
	font-size: 1.05rem;
	font-variant-numeric: tabular-nums;
	margin-bottom: 0.75rem;
}

.ccc-cart-drawer__cta {
	display: block;
	width: 100%;
	padding: 0.85rem 1rem;
	background: var(--ccc-accent);
	color: #fff;
	border: 0;
	border-radius: 0.5rem;
	font-weight: 600;
	font-size: 0.95rem;
	text-align: center;
	text-decoration: none;
	cursor: pointer;
	transition: background 0.15s ease;
}

.ccc-cart-drawer__cta:hover {
	background: color-mix(in srgb, var(--ccc-accent) 85%, #fff);
	color: #fff;
}

.ccc-cart-drawer__secondary {
	display: block;
	width: 100%;
	margin-top: 0.5rem;
	padding: 0.5rem 1rem;
	background: transparent;
	color: #6b7280;
	border: 0;
	font-size: 0.8rem;
	cursor: pointer;
	text-align: center;
}

.ccc-cart-drawer__secondary:hover {
	color: #dc2626;
}

/* Prevent body scroll when drawer is open. */
body.ccc-cart-drawer-open {
	overflow: hidden;
}

.ccc-cart-drawer__item {
	display: flex;
	gap: 12px;
	align-items: flex-start;
}
.ccc-cart-drawer__item-img {
	width: 56px;
	height: 56px;
	object-fit: cover;
	border-radius: 4px;
	flex-shrink: 0;
	background: #f5f5f5;
}

.ccc-cart-drawer__item {
	display: flex;
	justify-content: space-between;
	align-items: flex-start;
	gap: 10px;
	padding: 12px 0;
	border-bottom: 1px solid var(--ccc-border, #f0edea);
}
.ccc-cart-drawer__item-main {
	display: flex;
	align-items: center;
	gap: 10px;
	flex: 1;
	min-width: 0;
}
.ccc-cart-drawer__item-img {
	width: 48px;
	height: 48px;
	object-fit: contain;
	border-radius: 4px;
	flex-shrink: 0;
	background: #f5f5f5 url('data:image/svg+xml,<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 48 48" fill="none"><rect width="48" height="48" fill="%23f5f5f5"/><path d="M16 32l6-8 4 5 6-7 6 10H10z" fill="%23ddd"/><circle cx="18" cy="20" r="3" fill="%23ddd"/></svg>') center/contain no-repeat;
}
.ccc-cart-drawer__item-img[src]:not([src=""]) {
	background: #f5f5f5;
}

.ccc-cart-drawer__item-title a,
.ccc-quote-item__title a {
	color: inherit;
	text-decoration: none;
}
.ccc-cart-drawer__item-title a:hover,
.ccc-quote-item__title a:hover {
	color: var(--rust);
}