/*
 * Make-Up Show — side cart (drawer from the right).
 *
 * Author: Bilal Yasin — https://bilalyasindev.com
 */

.ms-cart {
	position: fixed;
	inset: 0;
	z-index: 100;
}

.ms-cart[hidden] {
	display: block;
	visibility: hidden;
	pointer-events: none;
}

.ms-cart__overlay {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0.5);
	opacity: 0;
	transition: opacity 0.3s ease;
}

.ms-cart__panel {
	position: absolute;
	top: 0;
	right: 0;
	bottom: 0;
	display: flex;
	flex-direction: column;
	width: min(26rem, 100vw);
	background: var(--ms-white);
	box-shadow: -20px 0 40px -20px rgba(0, 0, 0, 0.35);
	transform: translateX(100%);
	transition: transform 0.3s ease;
	outline: none;
}

.ms-cart.is-open .ms-cart__overlay {
	opacity: 1;
}

.ms-cart.is-open .ms-cart__panel {
	transform: translateX(0);
}

body.ms-cart-open {
	overflow: hidden;
}

.ms-cart__content {
	display: flex;
	flex: 1;
	flex-direction: column;
	min-height: 0;
	overflow-y: auto;
	font-size: 0.875rem;
	line-height: 1.25rem;
	transition: opacity 0.15s ease;
}

.ms-cart.is-busy .ms-cart__content {
	opacity: 0.55;
	pointer-events: none;
}

.ms-cart p,
.ms-cart ul,
.ms-cart h2 {
	margin: 0;
}

.ms-cart ul {
	padding: 0;
	list-style: none;
}

.ms-cart button {
	font: inherit;
}

/* ---------- Head ---------- */
.ms-cart__head {
	position: sticky;
	top: 0;
	z-index: 2;
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 4rem;
	padding: 0 0.75rem 0 1.25rem;
	background: var(--ms-white);
	border-bottom: 1px solid var(--ms-border);
}

.ms-cart__title {
	font-family: var(--ms-font-serif);
	font-size: 1.375rem;
	font-weight: 400;
	line-height: 1.75rem;
}

.ms-cart__close {
	display: flex;
	align-items: center;
	justify-content: center;
	width: 2.75rem;
	height: 2.75rem;
	padding: 0;
	color: inherit;
	background: none;
	border: 0;
	cursor: pointer;
}

/* ---------- Message (added / error) ---------- */
.ms-cart__message {
	padding: 0.75rem 1.25rem;
	font-size: 0.8rem;
	background: var(--ms-blush);
	border-bottom: 1px solid var(--ms-border);
}

.ms-cart__message:empty {
	display: none;
}

.ms-cart__message--error {
	color: #d01d21;
	background: #ffe2de;
}

/* ---------- Items ---------- */
.ms-cart .ms-cart__items {
	flex: 1 0 auto;
	padding: 0 1.25rem;
}

.ms-cart-item {
	position: relative;
	display: grid;
	grid-template-columns: 4.5rem 1fr auto;
	gap: 1rem;
	align-items: start;
	padding: 1.25rem 0;
	border-bottom: 1px solid var(--ms-border);
}

.ms-cart-item:last-child {
	border-bottom: 0;
}

.ms-cart-item__remove {
	position: absolute;
	top: 0.75rem;
	left: -0.5rem;
	z-index: 1;
	display: flex;
	align-items: center;
	justify-content: center;
	width: 1.5rem;
	height: 1.5rem;
	padding: 0;
	color: var(--ms-ink);
	background: var(--ms-white);
	border: 1px solid var(--ms-border);
	border-radius: 50%;
	cursor: pointer;
}

.ms-cart-item__remove:hover {
	color: var(--ms-white);
	background: var(--ms-ink);
	border-color: var(--ms-ink);
}

.ms-cart-item__image {
	display: block;
	aspect-ratio: 1 / 1;
	overflow: hidden;
	background: var(--ms-ink);
	border: 1px solid var(--ms-border);
}

.ms-cart-item__image img {
	display: block;
	width: 100%;
	height: 100%;
	object-fit: cover;
}

.ms-cart-item__name {
	display: block;
	font-family: var(--ms-font-serif);
	font-size: 1rem;
	line-height: 1.35;
	text-decoration: none;
}

.ms-cart-item__name:hover {
	color: var(--ms-fuchsia);
}

.ms-cart-item__meta {
	margin-top: 0.25rem !important;
	font-size: 0.75rem;
	color: var(--ms-text-muted);
}

.ms-cart-item .ms-qty {
	display: inline-flex;
	margin-top: 0.75rem;
}

.ms-qty--small .ms-qty__btn {
	width: 2rem;
	height: 2rem;
}

.ms-qty__value {
	min-width: 1.75rem;
	line-height: 2rem;
	text-align: center;
}

.ms-cart-item__price {
	display: grid;
	justify-items: end;
	gap: 0.125rem;
	font-weight: 600;
	white-space: nowrap;
}

.ms-cart-item__price del {
	font-weight: 400;
	color: var(--ms-text-muted);
}

.ms-cart-item__save {
	font-size: 0.7rem;
	font-weight: 600;
	color: var(--ms-fuchsia);
}

/* ---------- Coupon ---------- */
.ms-cart__coupon {
	border-top: 1px solid var(--ms-border);
	border-bottom: 1px solid var(--ms-border);
}

.ms-cart__coupon summary {
	display: flex;
	align-items: center;
	justify-content: space-between;
	min-height: 3.25rem;
	padding: 0 1.25rem;
	font-weight: 500;
	cursor: pointer;
	list-style: none;
}

.ms-cart__coupon summary::-webkit-details-marker {
	display: none;
}

.ms-cart__coupon-chevron {
	transition: transform 0.2s ease;
}

.ms-cart__coupon[open] .ms-cart__coupon-chevron {
	transform: rotate(180deg);
}

.ms-cart__coupon-form {
	display: flex;
	gap: 0.5rem;
	padding: 0 1.25rem 1rem;
}

.ms-cart__coupon-form .ms-field {
	flex: 1;
	min-width: 0;
	text-transform: uppercase;
}

.ms-cart__coupon-form .ms-btn {
	padding-inline: 1rem;
}

.ms-cart__coupon-applied {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin: 0 1.25rem 1rem !important;
	padding: 0.5rem 0.75rem;
	font-weight: 600;
	background: var(--ms-blush);
}

.ms-cart__coupon-applied small {
	font-weight: 400;
	color: var(--ms-fuchsia);
}

.ms-cart__coupon-applied button {
	padding: 0;
	font-size: 0.75rem;
	text-decoration: underline;
	color: inherit;
	background: none;
	border: 0;
	cursor: pointer;
}

/* ---------- Footer ---------- */
.ms-cart__foot {
	position: sticky;
	bottom: 0;
	z-index: 2;
	margin-top: auto;
	padding: 1rem 1.25rem 1.25rem;
	background: var(--ms-white);
	border-top: 1px solid var(--ms-border);
}

.ms-cart__row {
	display: flex;
	justify-content: space-between;
	gap: 1rem;
}

.ms-cart__row--total {
	font-size: 1rem;
	font-weight: 600;
}

.ms-cart__row--discount {
	margin-bottom: 0.25rem !important;
	color: var(--ms-fuchsia);
}

.ms-cart__note {
	margin-top: 0.25rem !important;
	font-size: 0.75rem;
	color: var(--ms-text-muted);
}

.ms-cart__checkout {
	width: 100%;
	margin-top: 1rem;
}

.ms-cart__view {
	display: block;
	margin-top: 0.75rem;
	font-size: 0.7rem;
	font-weight: 600;
	letter-spacing: 0.14em;
	text-align: center;
	text-transform: uppercase;
	text-decoration: underline;
	text-underline-offset: 3px;
}

/* ---------- Empty ---------- */
.ms-cart__empty {
	display: grid;
	flex: 1;
	align-content: center;
	justify-items: center;
	gap: 1rem;
	padding: 2rem 1.25rem;
	text-align: center;
	color: var(--ms-text-muted);
}

.ms-cart__empty .ms-icon {
	width: 2.5rem;
	height: 2.5rem;
	color: var(--ms-fuchsia);
}
