/* ==========================================================================
   Paastell Side Cart
   ========================================================================== */

/* Variables */
:root {
	--psc-dark:       #333132;
	--psc-light:      #ffffff;
	--psc-dark-25:    #D1D1D1;
	--psc-dark-15:    #F6F6F6;
	--psc-panel-width: 480px;
	--psc-z-index:    10001;
	--psc-transition: 0.35s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Overlay */
.paastell-side-cart__overlay {
	position: fixed;
	inset: 0;
	background-color: rgba(0, 0, 0, 0.45);
	z-index: var(--psc-z-index);
	opacity: 0;
	pointer-events: none;
	transition: opacity var(--psc-transition);
}

/* Wrapper (open state toggled via JS) */
.paastell-side-cart.is-open .paastell-side-cart__overlay {
	opacity: 1;
	pointer-events: auto;
}

/* Panel */
.paastell-side-cart__panel {
	position: fixed;
	top: 0;
	right: 0;
	height: 100vh;
	height: 100dvh;
	width: var(--psc-panel-width);
	max-width: 100vw;
	background-color: var(--psc-light);
	z-index: calc(var(--psc-z-index) + 1);
	display: flex;
	flex-direction: column;
	transform: translateX(100%);
	transition: transform var(--psc-transition);
	box-sizing: border-box;
}

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

/* Header */
.paastell-side-cart__header {
	display: flex;
	align-items: center;
	justify-content: space-between;
	padding: 20px 24px;
	border-bottom: 1px solid var(--psc-dark-25);
	flex-shrink: 0;
}

.paastell-side-cart__title {
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: 1rem;
	font-weight: 500;
	line-height: 1;
	margin: 0;
	display: flex;
	align-items: center;
	gap: 10px;
}

.paastell-side-cart__count {
	display: inline-flex;
	align-items: center;
	justify-content: center;
	width: 24px;
	height: 24px;
	border-radius: 50%;
	background-color: var(--psc-dark);
	color: var(--psc-light);
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: 12px;
	font-weight: 500;
}

.paastell-side-cart__close {
	background: none;
	border: none;
	cursor: pointer;
	padding: 4px;
	color: var(--psc-dark);
	line-height: 0;
	transition: opacity 0.2s ease;
}

.paastell-side-cart__close:hover {
	opacity: 0.6;
}

/* Body (scrollable item list) */
.paastell-side-cart__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	padding: 16px 24px;
}

/* Empty state */
.paastell-side-cart__empty {
	text-align: center;
	color: var(--psc-dark);
	opacity: 0.5;
	padding: 40px 0;
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: var(--wp--preset--font-size--body, 1rem);
	margin: 0;
}

/* Item list */
.paastell-side-cart__items {
	list-style: none;
	margin: 0;
	padding: 0;
	display: flex;
	flex-direction: column;
	gap: 20px;
}

/* Single item */
.paastell-side-cart__item {
	display: flex;
	align-items: flex-start;
	gap: 16px;
	position: relative;
	padding-bottom: 20px;
	border-bottom: 1px solid var(--psc-dark-15);
}

.paastell-side-cart__item:last-child {
	border-bottom: none;
	padding-bottom: 0;
}

/* Product image */
.paastell-side-cart__item-image {
	flex-shrink: 0;
	width: 80px;
	height: 80px;
	border-radius: 8px;
	overflow: hidden;
	background-color: var(--psc-dark-15);
	display: block;
}

.paastell-side-cart__item-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

/* Item details */
.paastell-side-cart__item-details {
	flex: 1;
	min-width: 0;
	display: flex;
	flex-direction: column;
	gap: 6px;
}

.paastell-side-cart__item-name {
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: var(--wp--preset--font-size--body-small, 0.9rem);
	font-weight: 500;
	color: var(--psc-dark);
	text-decoration: none;
	line-height: 1.3;
	display: block;
}

.paastell-side-cart__item-name:hover {
	text-decoration: underline;
}

.paastell-side-cart__item-meta {
	font-size: 13px;
	color: var(--psc-dark);
	opacity: 0.6;
	display: block;
}

/* Qty + price row */
.paastell-side-cart__item-row {
	display: flex;
	align-items: center;
	justify-content: space-between;
	margin-top: 4px;
}

/* Quantity control */
.paastell-side-cart__item-qty {
	display: flex;
	align-items: center;
	gap: 8px;
	border: 1px solid var(--psc-dark-25);
	border-radius: 6px;
	padding: 4px 8px;
}

.paastell-side-cart__qty-btn {
	background: none;
	border: none;
	cursor: pointer;
	font-size: 16px;
	line-height: 1;
	color: var(--psc-dark);
	padding: 0 2px;
	transition: opacity 0.2s ease;
}

.paastell-side-cart__qty-btn:hover {
	opacity: 0.6;
}

.paastell-side-cart__qty-value {
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: 14px;
	font-weight: 500;
	min-width: 18px;
	text-align: center;
}

/* Item price */
.paastell-side-cart__item-price {
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: var(--wp--preset--font-size--body-small, 0.9rem);
	font-weight: 500;
}

/* Remove button */
.paastell-side-cart__remove {
	background: none;
	border: none;
	cursor: pointer;
	color: var(--psc-dark);
	opacity: 0.4;
	padding: 2px;
	line-height: 0;
	flex-shrink: 0;
	transition: opacity 0.2s ease;
	align-self: flex-start;
}

.paastell-side-cart__remove:hover {
	opacity: 1;
}

/* Footer */
.paastell-side-cart__footer {
	padding: 20px 24px;
	border-top: 1px solid var(--psc-dark-25);
	display: flex;
	flex-direction: column;
	gap: 12px;
	flex-shrink: 0;
}

/* Subtotal row */
.paastell-side-cart__subtotal {
	display: flex;
	justify-content: space-between;
	align-items: center;
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: 1rem;
	font-weight: 700;
	text-align: center;
	justify-content: center;
	align-items: baseline;
	gap: 0.5rem;
}

/* Shipping indicator */
.paastell-side-cart__shipping-indicator {
	font-size: 0.8rem;
	font-weight: 400;
	color: var(--wp--preset--color--burgunder, #7a1c2e);
}

.paastell-side-cart__shipping-indicator.is-free {
	color: #2e7a3a;
}

/* Buttons */
.paastell-side-cart__btn {
	display: block;
	width: 100%;
	box-sizing: border-box;
	text-align: center;
	text-decoration: none;
	padding: 16px 24px;
	border-radius: 0.25rem;
	font-family: var(--wp--preset--font-family--sans, sans-serif);
	font-size: var(--wp--preset--font-size--body-small, 0.9rem);
	font-weight: 600;
	line-height: 1;
	cursor: pointer;
	transition: opacity 0.2s ease;
}

.paastell-side-cart__btn:hover {
	opacity: 0.8;
	text-decoration: none;
}

.paastell-side-cart__btn--primary {
	background-color: var(--wp--preset--color--burgunder);
	color: var(--psc-light);
}

.paastell-side-cart__btn--secondary {
	background-color: transparent;
	color: var(--psc-dark);
	border: 1px solid var(--psc-dark-25);
}

/* ==========================================================================
   Upsells slider
   ========================================================================== */

.paastell-side-cart__upsells,
.paastell-side-cart__accessories {
	margin-top: 28px;
	padding-top: 24px;
	border-top: 1px solid var(--psc-dark-25);
}

.paastell-side-cart__upsells-title,
.paastell-side-cart__accessories-title {
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: 1rem;
	font-weight: 500;
	margin: 0 0 16px;
	line-height: 1;
}

/* Horizontal drag/snap track */
.paastell-side-cart__upsells-track {
	display: flex;
	gap: 12px;
	overflow-x: scroll;
	scroll-snap-type: x mandatory;
	scroll-behavior: smooth;
	-webkit-overflow-scrolling: touch;
	scrollbar-width: none;
	padding-bottom: 4px;
	cursor: grab;
	user-select: none;
}

.paastell-side-cart__upsells-track::-webkit-scrollbar {
	display: none;
}

.paastell-side-cart__upsells-track.is-dragging {
	cursor: grabbing;
	scroll-snap-type: none;
	scroll-behavior: auto;
}

/* Individual card */
.paastell-side-cart__upsell-card {
	flex: 0 0 160px;
	scroll-snap-align: start;
	display: flex;
	flex-direction: column;
	border-radius: 8px;
	overflow: hidden;
	background-color: var(--psc-light);
}

.paastell-side-cart__upsell-image {
	display: block;
	aspect-ratio: 1 / 1;
	background-color: var(--psc-dark-15);
	overflow: hidden;
}

.paastell-side-cart__upsell-image img {
	width: 100%;
	height: 100%;
	object-fit: contain;
	display: block;
}

.paastell-side-cart__upsell-body {
	display: flex;
	flex-direction: column;
	gap: 6px;
	padding: 10px 0;
	flex: 1;
}

.paastell-side-cart__upsell-name {
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: 13px;
	font-weight: 500;
	color: var(--psc-dark);
	text-decoration: none;
	line-height: 1.3;
	display: -webkit-box;
	-webkit-line-clamp: 2;
	-webkit-box-orient: vertical;
	overflow: hidden;
}

.paastell-side-cart__upsell-name:hover {
	text-decoration: underline;
}

.paastell-side-cart__upsell-rating .star-rating {
	font-size: 11px;
}

.paastell-side-cart__upsell-price {
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: 13px;
	font-weight: 500;
	margin-top: auto;
}

.paastell-side-cart__upsell-variation {
	width: 100%;
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: 12px;
	padding: 5px 6px;
	border: 1px solid var(--psc-dark-25);
	border-radius: 6px;
	background-color: var(--psc-light);
	color: var(--psc-dark);
	cursor: pointer;
	appearance: auto;
	box-sizing: border-box;
}

.paastell-side-cart__upsell-btn {
	width: 100%;
	margin-top: 4px;
	padding: 8px 6px;
	border-radius: 6px;
	border: 1px solid var(--wp--preset--color--green);
	background-color: var(--wp--preset--color--green);
	color: #ffffff;
	font-family: var(--wp--preset--font-family--sans, "Montserrat", sans-serif);
	font-size: 12px;
	font-weight: 500;
	cursor: pointer;
	text-align: center;
	text-decoration: none;
	transition: opacity 0.2s ease;
	line-height: 1.3;
	display: block;
	box-sizing: border-box;
}

.paastell-side-cart__upsell-btn:hover {
	opacity: 0.8;
	text-decoration: none;
	color: #ffffff;
}

.paastell-side-cart__upsell-btn.loading,
.paastell-side-cart__upsell-btn.added {
	opacity: 0.6;
	pointer-events: none;
}

/* Payment icons */
.paastell-side-cart__payment-icons {
	display: flex;
	align-items: center;
	justify-content: center;
	gap: 10px;
	flex-wrap: wrap;
}

.paastell-side-cart__payment-icon {
	height: 24px;
	width: auto;
	display: block;
}

/* Suppress WooCommerce "View cart" notices inside the panel */
.paastell-side-cart__panel .woocommerce-notices-wrapper,
.paastell-side-cart__panel .woocommerce-message,
.paastell-side-cart__panel .woocommerce-info,
.paastell-side-cart__panel .woocommerce-error {
	display: none !important;
}

/* Loading state */
.paastell-side-cart__body.is-loading {
	opacity: 0.5;
	filter: blur(2px);
	pointer-events: none;
	transition: opacity 0.2s ease, filter 0.2s ease;
}

/* Add-to-cart button loading state */
@keyframes psc-spin {
	to { transform: rotate(360deg); }
}

.add_to_cart_button.loading,
.single_add_to_cart_button.loading,
.paastell-side-cart__upsell-btn.loading {
	position: relative;
	pointer-events: none;
	opacity: 0.7;
	cursor: wait;
}

.add_to_cart_button.loading::after,
.single_add_to_cart_button.loading::after,
.paastell-side-cart__upsell-btn.loading::after {
	content: '';
	display: inline-block;
	width: 13px;
	height: 13px;
	border: 2px solid currentColor;
	border-top-color: transparent;
	border-radius: 50%;
	animation: psc-spin 0.6s linear infinite;
	margin-left: 8px;
	vertical-align: middle;
	flex-shrink: 0;
}

/* Uniform button radius */
#paastell-side-cart button,
#paastell-side-cart a.button,
#paastell-side-cart .paastell-side-cart__checkout-btn,
#paastell-side-cart .paastell-side-cart__upsell-btn,
#paastell-side-cart .paastell-side-cart__upsell-variation,
#paastell-side-cart .paastell-side-cart__qty-controls {
	border-radius: 0.25rem;
}


/* Override theme rule that hides footer elements on empty cart */
#paastell-side-cart .paastell-side-cart__subtotal,
#paastell-side-cart .paastell-side-cart__btn--primary,
#paastell-side-cart .paastell-side-cart__payment-icons {
	display: flex !important;
}

#paastell-side-cart .paastell-side-cart__btn--primary {
	display: block !important;
}

/* Mobile */
@media (max-width: 480px) {
	:root {
		--psc-panel-width: min(350px, 100vw);
	}
}
