/* =========================================
   Global helpers
   ========================================= */

/* Lock page scroll while modal is open */
.bc-scroll-locked {
	overflow: hidden;
}


/* =========================================
   Modal: base layout and visibility
   ========================================= */

:root {
	--bc-atc-open: 200ms;
	--bc-atc-close: 150ms;
	--bc-atc-ease: linear;
}

/* Layer is always in the DOM, initially hidden and non-interactive */
.bc-atc-modal {
	position: fixed;
	inset: 0;
	z-index: 9999;
	visibility: hidden;
	pointer-events: none;
}

/* Open state: layer is visible and interactive */
.bc-atc-modal.is-open {
	visibility: visible;
	pointer-events: auto;
}

/* Closing phase: layer stays visible while slide-out runs */
.bc-atc-modal.is-closing {
	visibility: visible;
	pointer-events: auto;
}

/* Overlay covers the page and fades with opacity */
.bc-atc-modal__overlay {
	position: absolute;
	inset: 0;
	background-color: rgba(15, 15, 15, 0);
	pointer-events: none;
	touch-action: none;
	transition: background-color var(--bc-atc-close) var(--bc-atc-ease);
	z-index: 1;
}

/* Overlay fade-in when open */
.bc-atc-modal.is-open .bc-atc-modal__overlay {
	background-color: rgba(15, 15, 15, .3);
	pointer-events: auto;
	transition: background-color var(--bc-atc-open) var(--bc-atc-ease);
}

/* Overlay fade-out on closing */
.bc-atc-modal.is-closing .bc-atc-modal__overlay {
	pointer-events: none;
}

/* Drawer panel */
.bc-atc-modal__dialog {
	position: fixed;
	inset-block: 0;
	inset-inline-end: 0;
	width: min(32rem, 100vw);
	max-width: 100vw;
	height: 100svh;
	height: 100dvh;
	height: var(--vvh, 100vh);
	max-height: 100svh;
	max-height: 100dvh;
	max-height: var(--vvh, 100vh);
	background: #fff;
	box-shadow: 0 0 0 1px rgba(0, 0, 0, .05), 0 24px 48px rgba(0, 0, 0, .2);
	display: flex;
	border-top-left-radius: 8px;
	border-top-right-radius: 0;
	border-bottom-right-radius: 0;
	border-bottom-left-radius: 8px;
	flex-direction: column;
	/* Closed baseline: off-canvas on the right */
	transform: translateX(100%);
	transition: transform var(--bc-atc-open) var(--bc-atc-ease);
	will-change: transform;
	z-index: 2;
}

/* Panel open: either via layer state or panel state class */
.bc-atc-modal.is-open .bc-atc-modal__dialog,
.bc-atc-modal__dialog.is-open {
	transform: translateX(0);
}

/* Panel closing slide-out */
.bc-atc-modal__dialog.is-closing,
.bc-atc-modal.is-closing .bc-atc-modal__dialog {
	transform: translateX(100%);
	transition-duration: var(--bc-atc-close);
}

.bc-atc-modal.is-closing .bc-atc-modal__overlay {
	transition-duration: var(--bc-atc-close);
}

/* Respect reduced motion */
@media (prefers-reduced-motion: reduce) {

	.bc-atc-modal__overlay,
	.bc-atc-modal__dialog {
		transition: none;
	}
}


/* Optional variant: make only the body area scrollable
   Note: add this class in HTML only if needed */
.bc-atc-modal__body__ {
	max-height: calc(90dvh - 48px);
	/* adjust for header and paddings */
	overflow: auto;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}


/* =========================================
   Modal: header, body, close
   ========================================= */

.bc-atc-modal__header__REMOVE {
	display: flex;
	align-items: center;
	justify-content: space-between;
	gap: 20px;
	width: 100%;
	padding-top: 14px;
	padding-bottom: 14px;
	padding-left: 24px;
	padding-right: 45px;
	margin-bottom: 24px;
	border-bottom: 1px solid var(--separator-color);
	position: relative;
}

.bc-atc-modal__body {
	display: flex;
	flex-direction: column;
	/* justify-content: space-between; */
	flex: 1;
	min-height: 0;
	/* required so inner overflow can scroll */
	width: 100%;
}

.bc-atc__content {
	display: flex;
	flex-direction: column;
	flex: 1;
	min-height: 0;
	/* required so .bc-atc__lines can scroll */
}

/* Summary must be the flexible area above actions */
.bc-atc__summary {
	display: flex;
	flex-direction: column;
	/* flex: 1;
	min-height: 0; */
	overflow: hidden;
	/* important: prevents summary from expanding forever */
}

.bc-atc-modal__close {
	background: transparent;
	border-radius: 50%;
	border: 0;
	width: 40px;
	height: 40px;
	padding: 0;
	font-size: 30px;
	font-family: Arial, Helvetica, sans-serif;
	line-height: 1;
	cursor: pointer;
	position: absolute;
	right: 20px;
	top: 6px;
	z-index: 10;
}

.bc-atc-modal__close:hover {
	background-color: #e7e7e7;
}

.cart-is-empty .bc-atc__summary_intro,
.cart-is-empty .bc-atc__table_wrapper,
.cart-is-empty .bc-atc__actions {
	display: none;
}

/* =========================================
   Product block inside the modal
   ========================================= */

.bc-atc__added {
	border-bottom: 1px solid var(--separator-color);
	padding-top: 30px;
	padding-bottom: 10px;
	margin-left: 24px;
	margin-right: 24px;
	/* position: relative; */
}

/* .bc-atc__added:after {
	content: "";
	height: 1px;
	width: calc(100% - 48px);
	background-color: var(--separator-color);
	position: absolute;
	bottom: 0;
	left: 24px;
} */

.bc-atc__product {
	/* display: flex;
	gap: 20px;
	padding-bottom: 10px;
	position: relative; */

	display: none;
}

.bc-atc__media .bc-atc-img {
	display: block;
	max-width: 95px;
	border-radius: 8px;
}

.bc-atc-title {
	font-weight: bold;
}

.bc-atc-title-in-wrap {}

.bc-atc-item__meta {
	display: block;
	font-size: 15px;
	line-height: 1.2;
}

.bc-atc__variation {
	display: grid;
	grid-template-columns: auto 1fr;
	gap: 6px 12px;
	margin: 12px 0;
}

.bc-atc__variation[hidden] {
	display: none;
}

.bc-atc__actions {
	background: #fff;
	border-bottom-left-radius: 8px;
	padding-bottom: env(safe-area-inset-bottom, 0px);
	display: flex;
	flex: 0 0 auto;
	flex-wrap: wrap;
	gap: 10px;
	align-items: center;
	justify-content: space-between;
	padding-left: 24px;
	padding-right: 24px;
	padding-top: 24px;
	padding-bottom: 40px;
}

.bc-atc__actions .button {
	flex: 1;
	align-items: center;
	justify-content: center;
	text-decoration: none;
}

.bc-atc__product-data {
	display: flex;
	width: 100%;
	gap: 10px;
	justify-content: space-between;
	width: 100%;
}

.bc-atc-price {
	/* display: flex;
	flex-direction: column; */
	display: inline-flex;
}

/* =========================================
   Summary block
   ========================================= */

.bc-atc__summary_intro {
	border-bottom: 1px solid var(--separator-color);
	padding-top: 12px;
	padding-bottom: 12px;
	padding-right: 20px;
	margin-left: 24px;
	margin-right: 24px;
	font-size: 24px;
	font-weight: bold;
	line-height: 1.35;
}

#bc-atc-count,
#bc-atc-count-label {
	font-size: 18px;
	font-weight: normal;
}

.bc-atc__lines {
	padding-left: 24px;
	padding-right: 24px;
}

.bc-atc__table_wrapper {
	border-top: 1px solid var(--separator-color);
	padding-top: 20px;
	padding-left: 24px;
	padding-right: 24px;
}

.bc-atc__table {
	width: 100%;
	border-collapse: collapse;
	font-weight: bold;
}

.bc-atc__table #bc-atc-subtotal {
	font-size: 24px;
	font-weight: 900;
}

/* Scrollable list of summary lines with bottom fade using mask */
.bc-atc__lines {
	display: flex;
	overflow: auto;

	/* fade height at the bottom */
	--fade-size: 38px;

	/* extra space so last line does not hide under the fade */
	/* padding-bottom: calc(15px + var(--fade-size)); */
	padding-bottom: 10px;

	/* alpha mask, include -webkit prefix for Safari */
	-webkit-mask-image: linear-gradient(to bottom,
			rgba(0, 0, 0, 1) calc(100% - var(--fade-size)),
			rgba(0, 0, 0, 0) 100%);
	mask-image: linear-gradient(to bottom,
			rgba(0, 0, 0, 1) calc(100% - var(--fade-size)),
			rgba(0, 0, 0, 0) 100%);
}

/* ---------------------------
   Drawer modal helpers
--------------------------- */

/* Disable all transitions when prefers-reduced-motion or .no-anim is active */
.bc-atc-modal.no-anim *,
.bc-atc-modal.no-anim {
	transition: none !important;
	animation: none !important;
}

/* Empty state inside drawer */
.bc-atc__lines.is-empty {
	display: flex;
	align-items: center;
	justify-content: center;
	min-height: 120px;
	text-align: center;
	color: var(--text-muted, #777);
}

.bc-atc-empty {
	line-height: 1.4;
	padding: 1.5em;
}

/* Scrollable zones — stop iOS “rubber band” bounce */
.bc-mini-scroll,
.bc-atc__lines {
	/* flex: 1;
	min-height: 0; */
	overflow: auto;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior: contain;
	-webkit-overflow-scrolling: touch;
}

/* Hide or tone down badge when empty */
.bc-mini-badge[data-count="0"] {
	opacity: 0.5;
}

/* Optional: hide badge completely when empty */
.bc-mini-badge[data-count="0"].hide-when-empty {
	display: none;
}
