/* Ghost Cart Drawer — scoped frontend styles */

.gcd-drawer {
	--gcd-overlay-bg: rgba(0, 0, 0, 0.55);
	--gcd-panel-bg: #111318;
	--gcd-panel-text: #f5f7fb;
	--gcd-muted: #a8b0bf;
	--gcd-border: rgba(255, 255, 255, 0.1);
	--gcd-accent: #5b8cff;
	--gcd-accent-hover: #4a79eb;
	--gcd-danger: #ff6b6b;
	--gcd-card-bg: rgba(255, 255, 255, 0.06);
	--gcd-card-border: rgba(255, 255, 255, 0.12);
	--gcd-shadow: 0 24px 80px rgba(0, 0, 0, 0.45);
	--gcd-width: min(420px, 100vw);
	position: fixed;
	inset: 0;
	z-index: 12000;
	pointer-events: none;
}

.gcd-drawer.is-open {
	pointer-events: auto;
}

.gcd-overlay {
	position: absolute;
	inset: 0;
	background: var(--gcd-overlay-bg);
	opacity: 0;
	transition: opacity 0.25s ease;
}

.gcd-drawer.is-open .gcd-overlay {
	opacity: 1;
}

.gcd-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	width: var(--gcd-width);
	max-width: 100%;
	height: 100%;
	background: var(--gcd-panel-bg);
	color: var(--gcd-panel-text);
	box-shadow: var(--gcd-shadow);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform 0.28s ease;
	outline: none;
	overflow: hidden;
}

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

.gcd-drawer__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 12px;
	padding: 20px 20px 18px;
	border-bottom: 1px solid var(--gcd-border);
	flex-shrink: 0;
}

.gcd-drawer__title {
	margin: 0;
	font-size: 1.25rem;
	font-weight: 700;
	line-height: 1.2;
}

.gcd-drawer__close {
	appearance: none;
	border: 0;
	background: transparent;
	color: var(--gcd-panel-text);
	width: 40px;
	height: 40px;
	border-radius: 999px;
	display: inline-flex;
	align-items: center;
	justify-content: center;
	font-size: 1.75rem;
	line-height: 1;
	cursor: pointer;
	transition: background 0.2s ease;
}

.gcd-drawer__close:hover,
.gcd-drawer__close:focus {
	background: rgba(255, 255, 255, 0.08);
	outline: none;
}

.gcd-drawer__content {
	flex: 1 1 auto;
	overflow: hidden;
	display: flex;
	flex-direction: column;
	min-height: 0;
	padding: 0;
}

.gcd-drawer__inner {
	display: flex;
	flex-direction: column;
	height: 100%;
	min-height: 0;
}

.gcd-drawer__badge {
	align-self: flex-start;
	margin: 20px 20px 0;
	padding: 4px 10px;
	border-radius: 999px;
	background: rgba(91, 140, 255, 0.15);
	color: #9ec0ff;
	font-size: 0.75rem;
	font-weight: 700;
	letter-spacing: 0.04em;
	text-transform: uppercase;
}

.gcd-drawer__badge--debug {
	background: rgba(255, 193, 7, 0.15);
	color: #ffd666;
}

.gcd-drawer__items {
	flex: 1 1 auto;
	overflow-x: hidden;
	overflow-y: auto;
	min-height: 0;
	display: grid;
	gap: 14px;
	padding: 20px 20px 12px;
	align-content: start;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
}

.gcd-drawer__footer {
	flex-shrink: 0;
	margin-top: auto;
	position: sticky;
	bottom: 0;
	z-index: 2;
	border-top: 1px solid var(--gcd-border);
	background: linear-gradient(180deg, rgba(17, 19, 24, 0.92) 0%, var(--gcd-panel-bg) 18%);
	box-shadow: 0 -16px 32px rgba(0, 0, 0, 0.28);
	padding: 18px 20px 20px;
}

.gcd-cart-item {
	display: grid;
	grid-template-columns: 64px minmax(0, 1fr) minmax(72px, max-content);
	gap: 12px;
	align-items: start;
	padding: 14px;
	border-radius: 14px;
	background: var(--gcd-card-bg);
	border: 1px solid var(--gcd-card-border);
	box-shadow: inset 0 1px 0 rgba(255, 255, 255, 0.04);
	max-width: 100%;
	overflow: hidden;
}

.gcd-cart-item__media {
	width: 64px;
	height: 64px;
	flex-shrink: 0;
}

.gcd-cart-item__image {
	width: 64px;
	height: 64px;
	object-fit: cover;
	border-radius: 12px;
	display: block;
	background: rgba(255, 255, 255, 0.08);
	border: 1px solid rgba(255, 255, 255, 0.06);
}

.gcd-cart-item__image--placeholder {
	display: flex;
	align-items: center;
	justify-content: center;
	color: var(--gcd-muted);
	font-size: 1.25rem;
	border: 1px solid rgba(255, 255, 255, 0.06);
}

.gcd-cart-item__body {
	min-width: 0;
	overflow: hidden;
	padding-right: 4px;
}

.gcd-cart-item__name {
	margin: 0 0 6px;
	font-size: 0.94rem;
	font-weight: 700;
	line-height: 1.35;
	overflow: hidden;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	word-break: break-word;
}

.gcd-cart-item__variant,
.gcd-cart-item__qty {
	margin: 0;
	color: var(--gcd-muted);
	font-size: 0.82rem;
	line-height: 1.45;
	overflow: hidden;
	text-overflow: ellipsis;
	white-space: nowrap;
}

.gcd-cart-item__variant {
	margin-bottom: 2px;
}

.gcd-cart-item__meta {
	display: flex;
	flex-direction: column;
	align-items: flex-end;
	justify-content: flex-start;
	flex-shrink: 0;
	min-width: 72px;
	padding-left: 6px;
}

.gcd-cart-item__price {
	font-weight: 700;
	font-size: 0.94rem;
	line-height: 1.3;
	text-align: right;
	white-space: nowrap;
	color: var(--gcd-panel-text);
}

.gcd-cart-item__remove {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 28px;
	height: 28px;
	margin-top: 6px;
	padding: 0;
	border: 0;
	border-radius: 999px;
	background: transparent;
	color: var(--gcd-muted-text);
	font-size: 1.25rem;
	line-height: 1;
	cursor: pointer;
	transition: color 0.15s ease, background-color 0.15s ease;
}

.gcd-cart-item__remove:hover:not(:disabled),
.gcd-cart-item__remove:focus-visible {
	color: var(--gcd-panel-text);
	background: rgba(255, 255, 255, 0.08);
}

.gcd-cart-item__remove:disabled {
	opacity: 0.55;
	cursor: wait;
}

.gcd-cart-item--removing {
	opacity: 0.55;
	pointer-events: none;
}

.gcd-cart-item__error {
	grid-column: 1 / -1;
	margin: 8px 0 0;
	padding: 8px 10px;
	border-radius: 8px;
	background: rgba(220, 53, 69, 0.12);
	color: #ffb4bc;
	font-size: 0.82rem;
	line-height: 1.45;
}

.gcd-cart-item__error a {
	color: inherit;
	text-decoration: underline;
}

.gcd-cart-summary {
	display: grid;
	gap: 10px;
	margin-bottom: 16px;
}

.gcd-cart-summary__row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
	font-size: 0.95rem;
}

.gcd-cart-summary__row--total {
	padding-top: 10px;
	border-top: 1px solid var(--gcd-border);
	font-size: 1rem;
}

.gcd-cart-summary__label {
	color: var(--gcd-muted);
}

.gcd-cart-summary__value {
	font-size: 1rem;
	font-weight: 700;
	text-align: right;
	white-space: nowrap;
	flex-shrink: 0;
}

.gcd-cart-summary__row--total .gcd-cart-summary__value {
	font-size: 1.14rem;
	font-weight: 800;
}

.gcd-drawer__actions {
	display: grid;
	gap: 12px;
}

.gcd-checkout-button {
	background: var(--gcd-accent) !important;
	border-color: var(--gcd-accent) !important;
	font-weight: 700;
}

.gcd-checkout-button:hover {
	background: var(--gcd-accent-hover) !important;
	border-color: var(--gcd-accent-hover) !important;
}

.gcd-continue-button {
	background: rgba(255, 255, 255, 0.06) !important;
	border-color: var(--gcd-border) !important;
	color: var(--gcd-panel-text) !important;
}

.gcd-trust-line {
	margin: 4px 0 0;
	text-align: center;
	color: var(--gcd-muted);
	font-size: 0.76rem;
	line-height: 1.5;
}

.gcd-loading,
.gcd-empty,
.gcd-error {
	display: flex;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	text-align: center;
	min-height: 240px;
	padding: 28px 20px;
}

.gcd-loading__spinner {
	width: 36px;
	height: 36px;
	border-radius: 50%;
	border: 3px solid rgba(255, 255, 255, 0.15);
	border-top-color: var(--gcd-accent);
	animation: gcd-spin 0.8s linear infinite;
}

.gcd-loading__text,
.gcd-empty__message,
.gcd-error__message {
	color: var(--gcd-muted);
	margin: 12px 0 0;
}

.gcd-empty__title,
.gcd-error__title {
	margin: 12px 0 0;
	font-size: 1.05rem;
}

@keyframes gcd-spin {
	to {
		transform: rotate(360deg);
	}
}

html.gcd-drawer-open {
	overflow: hidden;
}

@media (max-width: 767px) {
	.gcd-drawer {
		--gcd-width: 100vw;
	}

	.gcd-drawer__header {
		padding: 18px 16px 16px;
	}

	.gcd-drawer__items {
		gap: 12px;
		padding: 18px 16px 10px;
	}

	.gcd-drawer__footer {
		padding: 16px 16px calc(16px + env(safe-area-inset-bottom, 0px));
	}

	.gcd-drawer__badge {
		margin: 16px 16px 0;
	}

	.gcd-cart-item {
		grid-template-columns: 56px minmax(0, 1fr) minmax(68px, max-content);
		gap: 10px;
		padding: 12px;
	}

	.gcd-cart-item__media,
	.gcd-cart-item__image {
		width: 56px;
		height: 56px;
	}

	.gcd-cart-item__meta {
		min-width: 68px;
	}

	.gcd-cart-item__price {
		font-size: 0.9rem;
	}

	.gcd-drawer__actions {
		gap: 10px;
	}
}
