/**
 * Sticky add-to-cart bar — mobile single product page.
 *
 * @package Arsin_Storefront_Customizer
 */

@media (min-width: 769px) {
	#asc-product-sticky-cart {
		display: none !important;
	}
}

@media (max-width: 768px) {
	:root {
		--asc-product-sticky-cart-height: 0px;
	}

	body.single-product.asc-product-sticky-cart-visible {
		padding-bottom: calc(
			var(--asc-handheld-footer-height, 64px) + var(--asc-product-sticky-cart-height, 0px)
		);
	}

	#asc-product-sticky-cart {
		position: fixed;
		right: 0;
		left: 0;
		bottom: var(--asc-handheld-footer-height, 64px);
		z-index: 10055;
		background: var(--asc-color-surface, #fff);
		border-top: 1px solid var(--asc-color-border, rgba(0, 0, 0, 0.1));
		box-shadow: 0 -2px 12px rgba(0, 0, 0, 0.08);
		padding: 0.65rem 0.85rem;
		padding-bottom: calc(0.65rem + env(safe-area-inset-bottom, 0px));
		box-sizing: border-box;
		max-width: 100vw;
	}

	#asc-product-sticky-cart[data-layout="quote-contact"] {
		padding: 0.35rem 0.5rem;
		padding-bottom: calc(0.35rem + env(safe-area-inset-bottom, 0px));
		box-shadow: 0 -1px 8px rgba(0, 0, 0, 0.06);
	}

	#asc-product-sticky-cart[hidden] {
		display: none !important;
	}

	#asc-product-sticky-cart:not([hidden]) {
		display: block;
	}

	.asc-product-sticky-cart__inner[hidden] {
		display: none !important;
	}

	.asc-product-sticky-cart__inner--purchasable:not([hidden]) {
		display: flex;
		align-items: center;
		justify-content: space-between;
		gap: 0.65rem;
	}

	.asc-product-sticky-cart__price {
		flex: 1 1 auto;
		min-width: 0;
		font-size: 0.75rem;
		font-weight: 600;
		line-height: 1.35;
	}

	.asc-product-sticky-cart__price .price {
		margin: 0;
		font-size: inherit;
	}

	.asc-product-sticky-cart__price del {
		opacity: 0.65;
		font-size: 0.85em;
	}

	.asc-product-sticky-cart__price .asc-price-stale-days {
		display: block;
		margin-top: 0.15rem;
		font-size: 0.58rem;
		font-weight: 400;
		color: #94a3b8;
		line-height: 1.25;
		white-space: nowrap;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.asc-product-sticky-cart__actions {
		display: flex;
		align-items: center;
		gap: 0.5rem;
		flex-shrink: 0;
	}

	.asc-product-sticky-cart__qty {
		flex-shrink: 0;
	}

	.asc-product-sticky-cart__qty .quantity {
		margin: 0;
	}

	.asc-product-sticky-cart__qty .qty {
		width: 2.75rem;
		min-height: 2.25rem;
		padding: 0.25rem;
		text-align: center;
		font-family: var(--asc-font-family);
	}

	.asc-product-sticky-cart__cta {
		white-space: nowrap;
		font-family: var(--asc-font-family) !important;
		font-size: 0.85rem !important;
		padding: 0.55rem 0.85rem !important;
		margin: 0 !important;
		min-height: 2.25rem;
		line-height: 1.3 !important;
	}

	.asc-product-sticky-cart__cta:disabled {
		opacity: 0.65;
		cursor: not-allowed;
	}

	/* Quote-contact compact layout */
	.asc-product-sticky-cart__inner--quote-contact .asc-quote-contact-stock-wrapper {
		margin: 0 !important;
		padding: 0 !important;
		background: transparent !important;
		border: none !important;
		border-radius: 0 !important;
	}

	.asc-product-sticky-cart__inner--quote-contact .asc-quote-contact-stock {
		gap: 0.3rem;
		margin: 0 !important;
	}

	.asc-product-sticky-cart__inner--quote-contact .asc-quote-contact-text {
		font-size: 0.72rem;
		font-weight: 500;
		line-height: 1.35;
		margin: 0;
		display: -webkit-box;
		-webkit-line-clamp: 2;
		-webkit-box-orient: vertical;
		overflow: hidden;
	}

	.asc-product-sticky-cart__inner--quote-contact .asc-quote-contact-actions {
		display: flex;
		flex-direction: row;
		flex-wrap: nowrap;
		align-items: stretch;
		gap: 0.35rem;
		width: 100%;
		margin: 0;
	}

	.asc-product-sticky-cart__inner--quote-contact .asc-quote-contact-tel,
	.asc-product-sticky-cart__inner--quote-contact .asc-quote-contact-related-btn {
		flex: 1 1 0;
		min-width: 0;
		width: auto !important;
		max-width: none;
		text-align: center;
		font-size: 0.72rem !important;
		font-weight: 600;
		padding: 0.4rem 0.45rem !important;
		margin: 0 !important;
		min-height: 2rem;
		line-height: 1.25 !important;
		white-space: normal;
	}

	.asc-product-sticky-cart__inner--quote-contact .asc-quote-contact-visible-desktop-only {
		display: none !important;
	}

	.asc-product-sticky-cart__inner--quote-contact .asc-quote-contact-visible-mobile-only {
		display: inline-flex !important;
		align-items: center;
		justify-content: center;
	}

	.asc-product-sticky-cart__inner--quote-contact .asc-quote-contact-related-btn {
		font-family: var(--asc-font-family) !important;
		cursor: pointer;
	}

	/* Scroll targets — keep visible above sticky bar + footer */
	.single-product form.cart,
	.single-product .single_variation_wrap {
		scroll-margin-bottom: calc(
			var(--asc-handheld-footer-height, 64px) + var(--asc-product-sticky-cart-height, 56px) + 16px
		);
	}

	.single-product .asc-quote-contact-stock-wrapper {
		scroll-margin-bottom: calc(
			var(--asc-handheld-footer-height, 64px) + var(--asc-product-sticky-cart-height, 56px) + 16px
		);
	}

	.single-product .related.products.asc-related-products-carousel {
		scroll-margin-bottom: calc(
			var(--asc-handheld-footer-height, 64px) + var(--asc-product-sticky-cart-height, 56px) + 16px
		);
	}

	/* Categories panel sits above sticky cart when visible */
	.asc-handheld-categories {
		bottom: calc(
			var(--asc-handheld-footer-height, 64px) + var(--asc-product-sticky-cart-height, 0px)
		);
	}
}
