/* 側邊滑出購物車 */

.ks-drawer {
	position: fixed;
	inset: 0;
	z-index: 1000;
	visibility: hidden;
	transition: visibility 0s 0.3s;
}

.ks-drawer.is-open {
	visibility: visible;
	transition: visibility 0s;
}

.ks-drawer__overlay {
	position: absolute;
	inset: 0;
	background: var(--ks-overlay);
	opacity: 0;
	transition: opacity 0.3s;
}

.ks-drawer.is-open .ks-drawer__overlay {
	opacity: 1;
}

.ks-drawer__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: min(480px, 100vw);
	background: var(--ks-panel);
	color: var(--ks-text);
	border-left: var(--ks-bw) solid var(--ks-line);
	transform: translateX(100%);
	transition: transform 0.3s cubic-bezier(0.2, 0.8, 0.2, 1);
	outline: none;
}

.ks-drawer.is-open .ks-drawer__panel {
	transform: none;
}

@media (prefers-reduced-motion: reduce) {
	.ks-drawer,
	.ks-drawer__overlay,
	.ks-drawer__panel {
		transition: none;
	}
}

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

.ks-drawer.is-busy .ks-drawer__inner {
	opacity: 0.6;
	pointer-events: none;
}

.ks-drawer__alert {
	margin: 16px 24px 0;
	padding: 12px 16px;
	border-left: var(--ks-bw) solid var(--ks-danger);
	border-radius: var(--ks-radius);
	background: var(--ks-surface);
	font-size: 0.875rem;
}

.ks-drawer__inner {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	padding: 24px 24px 20px;
	transition: opacity 0.15s;
}

.ks-drawer__head {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 16px;
}

.ks-drawer__title {
	margin: 0;
	font-size: 1.375rem;
	font-weight: 600;
}

.ks-drawer__head .ks-drawer__close {
	flex: none;
}

.ks-drawer__head .ks-drawer__close svg {
	display: block;
	width: 22px;
	height: 22px;
}

/* 免運進度 */

.ks-shipping-bar {
	margin-top: 24px;
}

.ks-shipping-bar__track {
	height: 6px;
	overflow: hidden;
	border-radius: 100px;
	background: var(--ks-line);
}

.ks-shipping-bar__track span {
	display: block;
	height: 100%;
	border-radius: inherit;
	background: var(--ks-text);
	transition: width 0.3s;
}

.ks-shipping-bar__text {
	margin: 12px 0 0;
}

/* 商品 */

.ks-cart-items {
	flex: 1;
	min-height: 0;
	margin: 24px -24px 0;
	padding: 0 24px;
	overflow-y: auto;
	list-style: none;
}

.ks-cart-item {
	display: grid;
	grid-template-columns: 112px minmax(0, 1fr) auto;
	gap: 0 20px;
	padding: 20px 0;
	border-bottom: var(--ks-bw) solid var(--ks-line);
}

.ks-cart-item:first-child {
	padding-top: 8px;
}

.ks-cart-item__media img {
	display: block;
	width: 100%;
	aspect-ratio: 1 / 1;
	border-radius: var(--ks-radius);
	object-fit: cover;
	background: var(--ks-surface);
}

.ks-cart-item__remove {
	margin-top: 12px;
	font-size: 0.9375rem;
}

.ks-cart-item__info p {
	margin: 0;
}

.ks-cart-item__name {
	display: -webkit-box;
	margin: 0 0 8px !important;
	overflow: hidden;
	font-size: 1.0625rem;
	font-weight: 600;
	line-height: 1.35;
	-webkit-box-orient: vertical;
	-webkit-line-clamp: 2;
	line-clamp: 2;
}

.ks-cart-item__name a {
	text-decoration: none;
}

.ks-cart-item__meta {
	color: var(--ks-muted);
	font-size: 0.875rem;
}

.ks-cart-item__price {
	margin: 0;
	font-size: 1.0625rem;
	font-weight: 600;
	text-align: right;
	white-space: nowrap;
}

.ks-qty {
	display: inline-flex;
	align-items: center;
	height: var(--ks-control-h);
	margin-top: 12px;
	border: var(--ks-bw) solid var(--ks-line);
	border-radius: var(--ks-radius);
}

.ks-qty button {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 40px;
	height: 100%;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	cursor: pointer;
}

.ks-qty button:disabled {
	opacity: 0.35;
	cursor: not-allowed;
}

.ks-qty input {
	width: 36px;
	height: 100%;
	padding: 0;
	border: 0;
	background: none;
	color: inherit;
	font: inherit;
	text-align: center;
	-moz-appearance: textfield;
	appearance: textfield;
}

.ks-qty input::-webkit-outer-spin-button,
.ks-qty input::-webkit-inner-spin-button {
	margin: 0;
	-webkit-appearance: none;
}

/* 手機版側邊購物車：數量控制小一點 */
@media (max-width: 600px) {
	.ks-qty {
		height: 38px;
		margin-top: 10px;
	}

	.ks-qty button {
		width: 32px;
	}

	.ks-qty button svg {
		width: 12px;
		height: 12px;
	}

	.ks-qty input {
		width: 28px;
		font-size: 0.9375rem;
	}
}

/* 空購物車 */

.ks-drawer__empty {
	display: flex;
	flex: 1;
	flex-direction: column;
	align-items: center;
	justify-content: center;
	gap: 8px;
	padding: 0 var(--ks-drawer-pad, 24px);
	text-align: center;
}

.ks-drawer__empty .ks-empty-icon {
	margin-bottom: 12px;
	color: var(--ks-muted);
}

.ks-drawer__empty-title {
	margin: 0 0 6px;
	font-size: 1.375rem;
}

.ks-drawer__empty-text {
	max-width: 280px;
	margin: 0 0 16px;
	color: var(--ks-muted);
}

.ks-drawer__empty .ks-btn {
	width: 100%;
	max-width: 280px;
}

/* 底部 */

.ks-drawer__foot {
	padding-top: 8px;
}

.ks-drawer__row {
	display: flex;
	align-items: baseline;
	justify-content: space-between;
	gap: 16px;
	padding: 20px 0;
	border-bottom: var(--ks-bw) solid var(--ks-line);
	font-size: 1.0625rem;
	font-weight: 600;
}

.ks-drawer__row--subtotal {
	font-size: 1.1875rem;
}

.ks-drawer__row small {
	color: var(--ks-muted);
	font-size: 0.75rem;
	font-weight: 500;
}

.ks-drawer__regular {
	margin-left: 6px;
	color: var(--ks-muted);
	font-size: 0.9375rem;
	font-weight: 500;
}

.ks-drawer__foot .ks-btn {
	height: var(--ks-control-h-lg);
}

.ks-drawer__note {
	margin: 16px 0;
	color: var(--ks-muted);
	font-size: 0.9375rem;
}


@media (max-width: 480px) {
	.ks-drawer__inner {
		padding: 20px 16px 16px;
	}

	.ks-cart-items {
		margin: 20px -16px 0;
		padding: 0 16px;
	}

	.ks-cart-item {
		grid-template-columns: 88px minmax(0, 1fr) auto;
		gap: 0 14px;
	}

	.ks-drawer__title {
		font-size: 1.25rem;
	}
}
