/* ══════════════════════════════════════════
   EF-MODAL — Unified modal / bottom-sheet
   Desktop = center modal, Mobile = bottom sheet
   Height: svh (stable viewport), Animation: transform only
   ══════════════════════════════════════════ */

/* ── Wrapper ── */
.ef-modal {
	display: none;
	position: fixed;
	inset: 0;
	z-index: 9999;
	justify-content: center;
	align-items: center;
}
.ef-modal.is-open {
	display: flex;
}
/* ── Content layout (was in everfox-v2.css, now here) ── */

/* Drawer content = flex column, constrained height, scroll on .everfox-popup-cart */
.ef-modal .drawer-content {
	position: relative;
	flex: 1 1 auto;
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	padding: 0;
}

/* Mini cart refresh — flex column, passes height constraint down */
.ef-modal .base-mini-cart-refresh,
.ef-modal .everfox-added-cart-refresh {
	position: relative;
	display: flex;
	flex-direction: column;
	min-height: 0;
	overflow: hidden;
	flex: 1 1 0%;
	padding: 8px;
	width: 100%;
	max-width: 100%;
	box-sizing: border-box;
}

/* ── Backdrop ── */
.ef-modal__backdrop {
	position: absolute;
	inset: 0;
	background: rgba(0, 0, 0, 0);
	transition: background-color 0.35s ease-out;
}
.ef-modal.is-visible .ef-modal__backdrop {
	background: rgba(0, 0, 0, 0.12);
}

/* ── Sheet panel ── */
.ef-modal__sheet {
	position: relative;
	z-index: 1;
	display: flex;
	flex-direction: column;
	background: var(--EF-Color-Surface, #fff);
	color: var(--EF-Color-Text, #1F2631);
	overflow: hidden;
	overscroll-behavior: none;
	will-change: transform, opacity;
}

/* ── Header ── */
.ef-modal__header {
	flex-shrink: 0;
	position: relative;
	padding: 0;
	overflow: visible;
}
.ef-modal__title {
	display: block;
	margin: 0;
	padding: 15px;
	font-size: 20px;
	font-weight: 400;
	line-height: 22px;
	color: var(--EF-Color-Text);
	background: var(--EF-Color-Surface-2);
	border-bottom: 1px solid var(--EF-Color-Border-Light);
}
.ef-modal__close {
	position: absolute;
	top: 0;
	right: 10px;
	z-index: 1;
	padding: 15px;
	border: none;
	background: transparent;
	cursor: pointer;
	color: var(--EF-Color-Text);
}
.ef-modal__close svg,
.ef-modal__close .base-svg-iconset {
	width: 22px;
	height: 22px;
	display: block;
}
.ef-modal__close svg path {
	stroke: currentColor;
	stroke-width: 1.5;
	stroke-linecap: round;
	stroke-linejoin: round;
}

/* ── Body: only scrollable zone ── */
.ef-modal__body {
	flex: 1;
	min-height: 0;
	overflow-y: auto;
	overflow-x: hidden;
	-webkit-overflow-scrolling: touch;
	overscroll-behavior-y: contain;
}

/* ── Footer (optional, sticky CTA) ── */
.ef-modal__footer {
	flex-shrink: 0;
}

/* ── Drag handle (visual + touch zone) ── */
.ef-modal__drag-handle {
	display: none;
}

/* ── Body scroll lock ── */
body.ef-modal-open {
	overflow: hidden;
	overscroll-behavior: none;
}


/* ══════════════════════════════════════════
   DESKTOP: center modal (≥720px)
   ══════════════════════════════════════════ */
@media (min-width: 720px) {
	.ef-modal__sheet {
		width: 720px;
		max-width: 85vw;
		max-height: 80vh;
		max-height: 80svh;
		border-radius: var(--everfox-radius, 8px);
		transform: scale(0.95);
		opacity: 0;
		transition: transform 0.35s ease-out, opacity 0.35s ease-out;
	}
	.ef-modal.is-visible .ef-modal__sheet {
		transform: scale(1);
		opacity: 1;
	}
}


/* ══════════════════════════════════════════
   MOBILE: bottom sheet (<720px)
   ══════════════════════════════════════════ */
@media (max-width: 719px) {
	.ef-modal {
		align-items: flex-end;
	}
	.ef-modal__sheet {
		width: 100%;
		max-height: calc(100svh - 16px - env(safe-area-inset-top, 0px));
		border-radius: 16px 16px 0 0;
		border: 1px solid var(--EF-Color-Border-Medium, #DFE1E3);
		border-bottom: none;
		box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.12);
		transform: translateY(100%);
		transition: transform 0.35s cubic-bezier(0.2, 0, 0, 1);
		padding-bottom: env(safe-area-inset-bottom, 0);
	}
	.ef-modal.is-visible .ef-modal__sheet {
		transform: translateY(0);
	}

	/* Added-drawer: stable height during AJAX content swap */
	#added-drawer .ef-modal__sheet {
		min-height: 545px;
	}

	/* Drag handle */
	.ef-modal__drag-handle {
		display: block;
		position: absolute;
		top: 4px;
		left: 50%;
		width: 40px;
		height: 4px;
		border-radius: 2px;
		background: var(--EF-Color-Border-Strong, #D4D6D8);
		transform: translateX(-50%);
		z-index: 2;
	}

	/* Header: smaller on mobile */
	.ef-modal__title {
		padding: 10px 15px 8px;
		font-size: 16px;
	}
	.ef-modal__close {
		right: 0;
		padding: 9px 15px;
	}
	.ef-modal__close svg,
	.ef-modal__close .base-svg-iconset {
		width: 20px;
		height: 20px;
	}
}

/* ══════════════════════════════════════════
   CHECKOUT / ACCOUNT BOTTOM SHEET overrides
   ══════════════════════════════════════════ */
.ef-bs-sheet .ef-modal__title {
	font-weight: 500;
}

