/* ==========================================================================
   Модалка «Вказати адресу» (inc/woocommerce/delivery-modal.php, assets/js/delivery-modal.js)
   Комп'ютер: карта ліворуч, сайдбар праворуч. Телефон: карта на весь екран, сайдбар — нижня шторка.
   Кнопки — стандарт сайту (.theme-btn, buttons.css).
   ========================================================================== */

.delivery-modal{
	--dm-side:   400px;                     /* ← ПРОЄКТ ширина сайдбара */
	--dm-radius: 24px;                      /* ← ПРОЄКТ скруглення вікна */
	--dm-pad:    24px;
	--dm-field:  52px;                      /* висота полів */
	--dm-pin:    var(--theme-text-strong);  /* ← ПРОЄКТ колір піна */
	position:fixed;inset:0;z-index:100000;
	display:flex;align-items:center;justify-content:center;
	padding:24px;
	color:var(--theme-text);
	font-family:var(--theme-font), sans-serif;
}
.delivery-modal[hidden]{display:none}
.delivery-modal__overlay{
	position:absolute;inset:0;
	background:var(--theme-overlay);backdrop-filter:blur(var(--theme-overlay-blur));
	opacity:0;transition:opacity .25s ease;
}
.delivery-modal__box{
	position:relative;
	display:flex;
	width:min(1280px, 100%);height:min(720px, 100%);
	overflow:hidden;
	border-radius:var(--dm-radius);
	background:var(--theme-bg);
	box-shadow:0 24px 64px rgba(0, 0, 0, .18);
	opacity:0;transform:translateY(12px) scale(.98);
	transition:opacity .25s ease,transform .25s ease;
}
.delivery-modal.is-open .delivery-modal__overlay{opacity:1}
.delivery-modal.is-open .delivery-modal__box{opacity:1;transform:none}
html.delivery-modal-open,
html.delivery-modal-open body{overflow:hidden}

/* без карти — лише сайдбар */
.delivery-modal--nomap .delivery-modal__box{width:min(var(--dm-side), 100%);height:auto;max-height:min(720px, 100%)}
.delivery-modal--nomap .delivery-modal__map{display:none}

/* ---------- карта ---------- */
.delivery-modal__map{position:relative;flex:1 1 auto;min-width:0;margin:8px 0 8px 8px;overflow:hidden;border-radius:calc(var(--dm-radius) - 8px);background:var(--theme-surface)}
.delivery-modal__canvas{position:absolute;inset:0}
.delivery-modal__pin{
	position:absolute;left:50%;top:50%;z-index:2;
	width:40px;height:52px;margin:-52px 0 0 -20px; /* кінчик піна — точно в центрі */
	color:var(--dm-pin);pointer-events:none;
	filter:drop-shadow(0 4px 6px rgba(0, 0, 0, .25));
	transition:transform .15s ease;
}
.delivery-modal.is-dragging .delivery-modal__pin{transform:translateY(-8px)}
.delivery-modal.is-pickup .delivery-modal__pin{display:none}
.delivery-modal button.delivery-modal__locate{ /* скид стилів кнопок Kit */
	position:absolute;right:16px;bottom:24px;z-index:2;
	display:grid;place-items:center;width:44px;height:44px;padding:0 !important;
	border:0 !important;border-radius:50% !important;
	background:var(--theme-bg) !important;color:var(--theme-text-strong) !important;
	box-shadow:var(--theme-shadow), 0 2px 8px rgba(0, 0, 0, .12) !important;
	cursor:pointer;
}

/* бульбашка над піном: визначена адреса + «Підтвердити» */
.delivery-modal__bubble{
	position:absolute;left:50%;bottom:calc(50% + 62px);z-index:3;
	display:flex;align-items:center;gap:12px;max-width:min(360px, calc(100% - 32px));
	padding:10px 10px 10px 16px;box-sizing:border-box;
	border-radius:var(--theme-radius-lg);background:var(--theme-bg);color:var(--theme-text-strong);
	box-shadow:0 8px 24px rgba(0, 0, 0, .16);
	font-size:14px;font-weight:500;line-height:1.3;white-space:nowrap;
	transform:translateX(-50%);transition:opacity .15s ease,transform .15s ease;
}
.delivery-modal__bubble[hidden]{display:none}
.delivery-modal__bubble::after{ /* хвостик до піна */
	content:"";position:absolute;left:50%;top:100%;margin-left:-7px;
	border:7px solid transparent;border-top-color:var(--theme-bg);
}
.delivery-modal__bubble-text{overflow:hidden;text-overflow:ellipsis}
.delivery-modal__bubble[data-state="wait"],
.delivery-modal__bubble[data-state="warn"]{padding:12px 16px;color:var(--theme-text-muted);font-weight:400}
.delivery-modal__bubble[data-state="warn"]{white-space:normal;text-align:center}
.delivery-modal .delivery-modal__bubble-ok{flex:0 0 auto;padding:11px 16px}
.delivery-modal .delivery-modal__bubble-ok[hidden]{display:none}
.delivery-modal.is-dragging .delivery-modal__bubble{opacity:0}
.delivery-modal.is-pickup .delivery-modal__bubble{display:none}

/* ---------- сайдбар ---------- */
.delivery-modal__side{
	flex:0 0 var(--dm-side);max-width:100%;
	display:flex;flex-direction:column;min-height:0;
	padding:var(--dm-pad);box-sizing:border-box;
}
.delivery-modal__head{display:flex;align-items:center;gap:12px;margin-bottom:28px}
.delivery-modal__tabs{
	flex:1 1 auto;display:flex;gap:4px;padding:4px;
	border-radius:var(--theme-button-radius);background:var(--theme-surface-alt);
}
.delivery-modal button.delivery-modal__tab{ /* скид стилів кнопок Kit */
	flex:1 1 0;display:inline-flex;align-items:center;justify-content:center;gap:6px;
	min-height:0;margin:0;padding:12px 14px !important;
	border:0 !important;border-radius:var(--theme-button-radius) !important;
	background:transparent !important;color:var(--theme-text-strong) !important;box-shadow:none !important;
	font-family:var(--theme-button-font), sans-serif;font-size:var(--theme-button-size);font-weight:var(--theme-button-weight);
	letter-spacing:var(--theme-button-spacing);line-height:var(--theme-button-line);
	cursor:pointer;transition:background .2s ease,color .2s ease;
}
.delivery-modal button.delivery-modal__tab.is-active{background:var(--theme-button-bg) !important;color:var(--theme-button-color) !important}
.delivery-modal__badge{font-weight:600}
.delivery-modal button.delivery-modal__close{
	flex:0 0 auto;display:grid;place-items:center;width:44px;height:44px;padding:0 !important;
	border:0 !important;border-radius:50% !important;background:transparent !important;color:var(--theme-text-strong) !important;box-shadow:none !important;cursor:pointer;
}
.delivery-modal button.delivery-modal__close:hover{background:var(--theme-surface-alt) !important}

.delivery-modal__body{flex:1 1 auto;min-height:0;overflow:auto;overscroll-behavior:contain;margin:0 calc(var(--dm-pad) * -1);padding:0 var(--dm-pad) 16px}
.delivery-modal__panel[hidden],
.delivery-modal__mode[hidden]{display:none}
.delivery-modal__title{margin:0 0 16px;font-size:16px;font-weight:600;line-height:1.25;color:var(--theme-text-strong)}
.delivery-modal__city{margin-left:4px;color:var(--theme-text-muted);font-weight:500}

/* перемикач «Збережені / Нова» */
.delivery-modal__seg{display:flex;gap:4px;margin:0 0 20px;padding:4px;border-radius:var(--theme-radius-lg);background:var(--theme-surface-alt)}
.delivery-modal__seg[hidden]{display:none}
.delivery-modal button.delivery-modal__seg-btn{
	flex:1 1 0;min-height:0;margin:0;padding:12px 10px !important;
	border:0 !important;border-radius:calc(var(--theme-radius-lg) - 4px) !important;
	background:transparent !important;color:var(--theme-text) !important;box-shadow:none !important;
	font:400 15px/1.2 var(--theme-font), sans-serif;letter-spacing:0;cursor:pointer;
}
.delivery-modal button.delivery-modal__seg-btn.is-active{background:var(--theme-bg) !important;color:var(--theme-text-strong) !important;box-shadow:var(--theme-shadow) !important;font-weight:500}

/* поля з плаваючим підписом */
.delivery-modal__field{position:relative;margin:0 0 12px}
.delivery-modal__field[hidden]{display:none}
.delivery-modal input.delivery-modal__input{
	/* !important — інакше перемагають поля з Kit Elementor (.elementor-kit-N input…: квадратні, 12px, сірий текст) */
	box-sizing:border-box !important;width:100% !important;height:var(--dm-field) !important;margin:0 !important;padding:20px 16px 6px !important;
	border:1px solid var(--theme-line) !important;border-radius:var(--theme-radius-lg) !important;
	background:var(--theme-light) !important;color:var(--theme-text) !important;
	font:400 16px/1.2 var(--theme-font), sans-serif !important;letter-spacing:0 !important;
	box-shadow:none !important;-webkit-appearance:none;appearance:none;
}
.delivery-modal input.delivery-modal__input:focus{border-color:var(--theme-text-strong) !important;outline:none}
.delivery-modal input.delivery-modal__input::-webkit-search-cancel-button{-webkit-appearance:none}
.delivery-modal input.delivery-modal__input::placeholder{color:var(--theme-text-muted);opacity:1}
.delivery-modal__label{
	position:absolute;left:17px;top:50%;transform:translateY(-50%);
	color:var(--theme-text-muted);font-size:15px;line-height:1;pointer-events:none;
	transition:top .15s ease,font-size .15s ease,transform .15s ease;
}
.delivery-modal__input:focus + .delivery-modal__label,
.delivery-modal__input:not(:placeholder-shown) + .delivery-modal__label{top:12px;transform:none;font-size:11px}
/* поле з іконкою: відступ під іконку (селектор сильніший за загальний .delivery-modal input.delivery-modal__input) */
.delivery-modal .delivery-modal__field--search input.delivery-modal__input,
.delivery-modal .delivery-modal__field--find input.delivery-modal__input{padding-left:48px !important;padding-right:44px !important}
.delivery-modal .delivery-modal__field--search .delivery-modal__label{left:49px}
.delivery-modal .delivery-modal__field--find input.delivery-modal__input{padding-top:6px !important}
.delivery-modal__field-icon{position:absolute;left:14px;top:14px;z-index:1;color:var(--theme-text-muted);pointer-events:none}
.delivery-modal__field-icon svg{display:block;width:24px;height:24px}
.delivery-modal button.delivery-modal__clear{
	position:absolute;right:8px;top:8px;display:grid;place-items:center;width:36px;height:36px;padding:0 !important;
	border:0 !important;border-radius:50% !important;background:transparent !important;color:var(--theme-text-muted) !important;box-shadow:none !important;cursor:pointer;
}
.delivery-modal button.delivery-modal__clear[hidden]{display:none}
.delivery-modal__clear svg{width:20px;height:20px}
.delivery-modal__pair{display:grid;grid-template-columns:minmax(0, 1fr) 110px;gap:12px}
.delivery-modal__pair[hidden]{display:none}

/* підказки адрес */
.delivery-modal__suggest{
	position:absolute;left:0;right:0;top:calc(100% + 6px);z-index:3;
	max-height:280px;overflow:auto;overscroll-behavior:contain;padding:6px;
	border-radius:var(--theme-radius-lg);background:var(--theme-bg);
	box-shadow:0 12px 32px rgba(0, 0, 0, .14);
}
.delivery-modal__suggest[hidden]{display:none}
.delivery-modal button.delivery-modal__suggest-item{
	display:flex;flex-direction:column;align-items:flex-start;gap:2px;width:100%;
	margin:0;padding:10px 12px !important;text-align:left;
	border:0 !important;border-radius:var(--theme-radius) !important;
	background:transparent !important;color:var(--theme-text) !important;box-shadow:none !important;
	font:400 15px/1.3 var(--theme-font), sans-serif;letter-spacing:0;cursor:pointer;
}
.delivery-modal button.delivery-modal__suggest-item:is(:hover, :focus){background:var(--theme-surface-alt) !important;outline:none}
.delivery-modal__suggest-sub{font-size:13px;color:var(--theme-text-muted)}
.delivery-modal__suggest-empty{margin:0;padding:12px;color:var(--theme-text-muted);font-size:14px}

/* умови зони */
.delivery-modal__terms{margin:8px 0 0;text-align:center;font-size:14px;line-height:1.45;color:var(--theme-text-muted)}
.delivery-modal__terms[hidden]{display:none}
.delivery-modal__terms p{margin:0}
.delivery-modal__terms .delivery-modal__eta{
	margin:0 0 12px;padding:14px 16px;border-radius:var(--theme-radius-lg);
	background:var(--theme-surface-alt);color:var(--theme-text-strong);font-size:15px;font-weight:600;
}
.delivery-modal__hint{margin:8px 0 0;text-align:center;font-size:14px;line-height:1.4;color:var(--theme-text-muted)}
.delivery-modal__hint[hidden]{display:none}
.delivery-modal__error{margin:4px 0 0;font-size:14px;color:var(--theme-error)}
.delivery-modal__error[hidden]{display:none}

/* збережені адреси */
.delivery-modal__saved{display:flex;flex-direction:column;gap:10px;margin:0;padding:0;list-style:none}
.delivery-modal__saved li{position:relative;margin:0;padding:0}
.delivery-modal__saved li::before,.delivery-modal__saved li::marker{content:none}
.delivery-modal button.delivery-modal__saved-item{
	display:flex;align-items:center;gap:12px;width:100%;box-sizing:border-box;
	margin:0;padding:16px 48px 16px 16px !important;text-align:left;
	border:0 !important;border-radius:var(--theme-radius-lg) !important;
	background:var(--theme-light) !important;color:var(--theme-text) !important;
	box-shadow:inset 0 0 0 1px var(--theme-line) !important;
	font:400 15px/1.35 var(--theme-font), sans-serif;letter-spacing:0;cursor:pointer;
	transition:box-shadow .15s ease;
}
.delivery-modal button.delivery-modal__saved-item:hover{box-shadow:inset 0 0 0 1px var(--theme-text-muted) !important}
.delivery-modal button.delivery-modal__saved-item.is-active{box-shadow:inset 0 0 0 2px var(--theme-text-strong) !important}
.delivery-modal__radio{flex:0 0 auto;width:20px;height:20px;box-sizing:border-box;border:1.5px solid var(--theme-line);border-radius:50%;transition:all .15s ease}
.is-active > .delivery-modal__radio{border:6px solid var(--theme-text-strong)}
.delivery-modal button.delivery-modal__saved-del{
	position:absolute;right:8px;top:50%;transform:translateY(-50%);
	display:grid;place-items:center;width:36px;height:36px;padding:0 !important;
	border:0 !important;border-radius:50% !important;background:transparent !important;color:var(--theme-text-muted) !important;box-shadow:none !important;cursor:pointer;
}
.delivery-modal button.delivery-modal__saved-del:hover{color:var(--theme-accent) !important}
.delivery-modal__empty{padding:40px 8px 8px;text-align:center}
.delivery-modal__empty[hidden]{display:none}
.delivery-modal__empty p{margin:0 0 20px;font-size:15px;line-height:1.45;color:var(--theme-text)}
.delivery-modal .delivery-modal__add svg{width:18px;height:18px}

/* точки самовивозу */
.delivery-modal__points{display:flex;flex-direction:column;gap:10px}
.delivery-modal button.delivery-modal__point{
	display:flex;flex-direction:column;align-items:flex-start;gap:8px;width:100%;box-sizing:border-box;
	margin:0;padding:16px !important;text-align:left;
	border:0 !important;border-radius:var(--theme-radius-lg) !important;
	background:var(--theme-light) !important;color:var(--theme-text) !important;
	box-shadow:inset 0 0 0 1px var(--theme-line) !important;
	font:400 14px/1.35 var(--theme-font), sans-serif;letter-spacing:0;cursor:pointer;
	transition:box-shadow .15s ease;
}
.delivery-modal button.delivery-modal__point[hidden]{display:none}
.delivery-modal button.delivery-modal__point:hover{box-shadow:inset 0 0 0 1px var(--theme-text-muted) !important}
.delivery-modal button.delivery-modal__point.is-active{box-shadow:inset 0 0 0 2px var(--theme-text-strong) !important}
.delivery-modal__point-title{font-size:15px;font-weight:600;color:var(--theme-text-strong)}
.delivery-modal__point-line{display:flex;align-items:center;gap:8px;color:var(--theme-text-muted)}
.delivery-modal__point-line svg{flex:0 0 auto;width:18px;height:18px}
.delivery-modal__tags{display:flex;flex-wrap:wrap;gap:6px;margin-top:4px}
.delivery-modal__tag{padding:6px 12px;border-radius:999px;background:var(--theme-surface-alt);font-size:13px;color:var(--theme-text)}

.delivery-modal__foot{padding-top:12px}
.delivery-modal .delivery-modal__confirm{width:100%}
/* адреса поза зоною доставки: кнопка-пояснення «За цією адресою доставка недоступна» — читабельна, не «вимкнена» */
body .delivery-modal .delivery-modal__confirm.is-unavailable:disabled{
	opacity:1;background:var(--theme-surface-alt) !important;background-image:none !important;
	color:var(--theme-text-muted) !important;border-color:transparent !important;
}

/* ---------- телефон: карта на весь екран, сайдбар — шторка ---------- */
@media (max-width:767px){
	.delivery-modal{padding:0;align-items:stretch}
	.delivery-modal__box{flex-direction:column;width:100%;height:100%;border-radius:0}
	.delivery-modal__map{flex:1 1 auto;margin:0;border-radius:0;min-height:36vh}
	.delivery-modal__side{
		flex:0 0 auto;max-height:64vh;margin-top:-20px;position:relative;z-index:3;
		padding:20px 16px calc(16px + env(safe-area-inset-bottom));
		border-radius:var(--dm-radius) var(--dm-radius) 0 0;background:var(--theme-bg);
		box-shadow:0 -8px 24px rgba(0, 0, 0, .1);
	}
	/* вкладки й хрестик — над картою, як на sushiicons */
	.delivery-modal__head{position:fixed;left:12px;right:12px;top:calc(12px + env(safe-area-inset-top));z-index:4;margin:0;padding:6px;border-radius:999px;background:var(--theme-bg);box-shadow:0 4px 16px rgba(0, 0, 0, .12)}
	.delivery-modal__body{margin:0 -16px;padding:0 16px 12px}
	.delivery-modal--nomap .delivery-modal__box{height:100%;max-height:none}
	.delivery-modal--nomap .delivery-modal__side{flex:1 1 auto;max-height:none;margin-top:0;padding-top:84px;border-radius:0;box-shadow:none}
	.delivery-modal button.delivery-modal__locate{bottom:36px}
}

/* ==========================================================================
   Підпис у кнопці шапки (віджет Button з класом header-delivery)
   ========================================================================== */
.header-delivery .elementor-button{max-width:100%;overflow:hidden;vertical-align:top} /* overflow:hidden переносить базову лінію inline-block на низ — без vertical-align під кнопкою зʼявляється «хвіст» ~7px */
.header-delivery .elementor-button-content-wrapper,
.header-delivery .elementor-button-text{min-width:0}
.header-delivery-label{display:flex;flex-direction:column;align-items:flex-start;gap:3px;min-width:0;text-align:left}
.header-delivery-label--empty{display:inline}
.header-delivery-label__main,
.header-delivery-label__sub{display:block;max-width:var(--header-delivery-max, 170px);overflow:hidden;white-space:nowrap;text-overflow:ellipsis} /* ← ПРОЄКТ ширина підпису */
.header-delivery-label__sub{font-size:11px;line-height:1.1;letter-spacing:0;opacity:.65}

@media (prefers-reduced-motion:reduce){
	.delivery-modal__overlay,.delivery-modal__box,.delivery-modal__pin{transition:none}
}
