/* "حدد موقعك" bottom sheet — opens *over* the Cart page, never as its own
   screen. Pure presentation around the same Leaflet map, the same
   reverse-geocode REST route and the same yef_save_location endpoint the
   checkout's map panel has always used. */

.yef-sheet { position: fixed; inset: 0; z-index: 400; }
.yef-sheet[hidden] { display: none; }

.yef-sheet__scrim {
	position: absolute; inset: 0;
	background: rgba(17, 17, 17, .38);
	animation: yef-sheet-fade .22s ease both;
}

.yef-sheet__panel {
	position: absolute; inset-inline: 0; bottom: 0;
	display: flex; flex-direction: column;
	height: 78vh; height: 78dvh; max-height: 78vh; max-height: 78dvh;
	background: #fff;
	border-radius: 28px 28px 0 0;
	max-width: 520px; margin-inline: auto;
	box-shadow: 0 -8px 32px rgba(0, 0, 0, .16);
	animation: yef-sheet-up .26s cubic-bezier(.2, .8, .25, 1) both;
	overflow: hidden;
}

@keyframes yef-sheet-fade { from { opacity: 0; } to { opacity: 1; } }
@keyframes yef-sheet-up { from { transform: translateY(16px); opacity: .6; } to { transform: none; opacity: 1; } }
@media (prefers-reduced-motion: reduce) {
	.yef-sheet__scrim, .yef-sheet__panel { animation: none; }
}

/* Drag handle — a real button so it is reachable by keyboard and screen
   readers, not just a decorative bar. */
.yef-sheet__handle {
	flex: none; display: block; width: 100%; padding: 10px 0 2px;
	border: 0; background: none; cursor: grab; touch-action: none;
}
.yef-sheet__handle::before {
	content: ""; display: block; width: 44px; height: 5px; margin: 0 auto;
	border-radius: 999px; background: #DADADA;
}
.yef-sheet.is-dragging .yef-sheet__panel { transition: none; }

.yef-sheet__head {
	flex: none; position: relative;
	display: flex; align-items: center; justify-content: center;
	padding: 6px 56px 12px; min-height: 44px;
}
.yef-sheet__head h2 { margin: 0; font-size: 1.125rem; font-weight: 800; line-height: 1.3; }
.yef-sheet__close {
	position: absolute; inset-inline-start: 12px; top: 0;
	width: 44px; height: 44px; display: inline-flex; align-items: center; justify-content: center;
	border: 0; background: none; padding: 0; cursor: pointer; color: var(--yef-ink, #111);
	border-radius: 50%;
}
.yef-sheet__close:hover { background: var(--yef-sand, #FAFAF9); }

.yef-sheet__body {
	flex: 1 1 auto; min-height: 0;
	display: flex; flex-direction: column; gap: 14px;
	padding: 0 var(--yef-gap, 16px) 8px;
	overflow-y: auto; -webkit-overflow-scrolling: touch; overscroll-behavior: contain;
}

.yef-sheet__foot {
	flex: none;
	padding: 12px var(--yef-gap, 16px) calc(12px + env(safe-area-inset-bottom, 0px));
	background: #fff;
	border-top: 1px solid var(--yef-line, #EAEAEA);
}

/* ---- search ---- */
.yef-loc-search { position: relative; flex: none; }
.yef-loc-search__icon {
	position: absolute; inset-inline-start: 16px; top: 50%; transform: translateY(-50%);
	color: var(--yef-muted, #6E6E6E); display: flex; pointer-events: none;
}
.yef-loc-search input {
	width: 100%; box-sizing: border-box;
	height: var(--yef-tap, 56px);
	border: 1px solid var(--yef-line, #EAEAEA); border-radius: var(--yef-radius, 16px);
	padding: 0 48px 0 16px; font: inherit; font-size: 1rem; background: #fff; color: var(--yef-ink, #111);
	-webkit-appearance: none; appearance: none;
}
.yef-loc-search input::-webkit-search-cancel-button { -webkit-appearance: none; }
.yef-loc-search input:focus {
	outline: none; border-color: var(--yef-accent, #66c7cc);
	box-shadow: 0 0 0 3px color-mix(in srgb, var(--yef-accent, #66c7cc) 22%, transparent);
}
.yef-loc-search__results {
	position: absolute; inset-inline: 0; top: calc(100% + 6px); z-index: 5;
	background: #fff; border-radius: var(--yef-radius, 16px); overflow: hidden;
	box-shadow: 0 8px 24px rgba(0, 0, 0, .14); max-height: 220px; overflow-y: auto;
}
.yef-loc-search__results[hidden] { display: none; }
.yef-loc-search__results button {
	display: block; width: 100%; text-align: start; padding: 12px 16px;
	border: 0; background: none; font: inherit; font-size: .875rem; line-height: 1.45;
	border-bottom: 1px solid var(--yef-line, #EAEAEA); cursor: pointer; color: var(--yef-ink, #111);
}
.yef-loc-search__results button:last-child { border-bottom: 0; }
.yef-loc-search__results button:hover { background: var(--yef-sand, #FAFAF9); }

/* ---- map ---- */
.yef-loc-map-wrap {
	position: relative; flex: 1 1 auto; min-height: 190px;
	border-radius: var(--yef-radius-lg, 20px); overflow: hidden;
	background: var(--yef-sand, #FAFAF9);
	border: 1px solid var(--yef-line, #EAEAEA);
}
.yef-loc-map { position: absolute; inset: 0; }
.yef-loc-map .leaflet-control-attribution { font-size: 9px; }

.yef-loc-pin {
	position: absolute; top: 50%; left: 50%; transform: translate(-50%, -100%);
	z-index: 500; pointer-events: none;
	filter: drop-shadow(0 4px 6px rgba(0, 0, 0, .25));
	transition: transform .18s ease;
}
.yef-loc-map-wrap.is-moving .yef-loc-pin { transform: translate(-50%, calc(-100% - 6px)); }

.yef-loc-locate {
	position: absolute; z-index: 500; inset-inline-start: 12px; bottom: 12px;
	width: 44px; height: 44px; border-radius: 50%;
	display: inline-flex; align-items: center; justify-content: center;
	background: #fff; border: 1px solid var(--yef-line, #EAEAEA);
	box-shadow: 0 4px 14px rgba(0, 0, 0, .14); cursor: pointer; color: var(--yef-ink, #111);
}

.yef-loc-use-current {
	flex: none; align-self: flex-start;
	display: inline-flex; align-items: center; gap: 8px;
	background: color-mix(in srgb, var(--yef-accent, #66c7cc) 12%, #fff);
	color: var(--yef-ink, #111);
	border: 0; border-radius: 999px; padding: 10px 16px; min-height: 44px;
	font: inherit; font-size: .875rem; font-weight: 700; cursor: pointer;
}
.yef-loc-use-current svg { color: var(--yef-accent, #66c7cc); }

/* ---- chosen address ---- */
.yef-loc-address {
	flex: none;
	background: var(--yef-sand, #FAFAF9);
	border-radius: var(--yef-radius, 16px);
	padding: 14px 16px;
}
.yef-loc-address__label { font-size: .75rem; font-weight: 700; color: var(--yef-muted, #6E6E6E); }
.yef-loc-address__text {
	margin: 4px 0 0; font-size: .9375rem; font-weight: 600; line-height: 1.5;
	/* Reserves two lines up front so a slow reverse-geocode swaps text in
	   without the confirm button jumping. */
	min-height: 2.8em;
	display: -webkit-box; -webkit-line-clamp: 2; -webkit-box-orient: vertical; overflow: hidden;
}
.yef-loc-address.is-error .yef-loc-address__text { color: var(--yef-danger, #d92d20); font-weight: 700; }
.yef-loc-address.is-loading .yef-loc-address__text { color: var(--yef-muted, #6E6E6E); }

body.yef-sheet-open { overflow: hidden; }

@media (min-width: 782px) {
	.yef-sheet__panel { height: 640px; max-height: 86vh; border-radius: 28px; bottom: 5vh; }
}
