/* BG Couriers - checkout fields */
.bgc-fields { position: relative; margin: 10px 0; }
.bgc-fields { opacity: 0; transform: translateY(6px); transition: opacity .28s ease, transform .28s ease; }
.bgc-fields.bgc-ready { opacity: 1; transform: none; }
.bgc-fields, .bgc-fields * { box-sizing: border-box; }

.bgc-fields ul, .bgc-fields li, .bgc-fields p, .bgc-fields label, .bgc-fields .bgc-field { list-style: none !important; }
.bgc-fields p::before, .bgc-fields p::marker,
.bgc-fields label::before, .bgc-fields label::marker,
.bgc-fields .bgc-field::before, .bgc-fields .bgc-field::marker { content: none !important; display: none !important; }

.bgc-delivery-host:empty { display: none; }
.bgc-delivery-host { margin: 18px 0 6px; padding-top: 14px; border-top: 1px solid #e2e6ea; }
.bgc-delivery-host > ul#shipping_method { margin: 0; }
.bgc-delivery-host > .bgc-fields { margin: 0; }
tr.bgc-moved-away { display: none !important; }

html.bgc-relocating .woocommerce-checkout-review-order tr.bgc-allmap-open,
html.bgc-relocating .woocommerce-checkout-review-order tr.woocommerce-shipping-totals,
html.bgc-relocating .woocommerce-checkout-review-order tr.shipping { display: none !important; }

/* Delivery-type tabs */
.bgc-tabs { display: flex; gap: 8px; margin-bottom: 12px; flex-wrap: wrap; }
.bgc-tab { flex: 1 1 auto; min-width: 92px; padding: 9px 12px; border: 1px solid #e2e6ea; border-radius: 10px;
  background: #fff; color: #333; font-weight: 600; cursor: pointer; text-align: center;
  display: inline-flex; align-items: center; justify-content: center; gap: 7px;
  box-shadow: 0 1px 2px rgba(0,0,0,.06); transition: border-color .15s, box-shadow .15s, background .15s; }
.bgc-tab .bgc-mtype-ico { flex: 0 0 auto; }
.bgc-tab:hover { border-color: #b9c2cc; box-shadow: 0 2px 6px rgba(0,0,0,.10); }
.bgc-tab.active { border-color: #2271b1; color: #2271b1; background: #f3f8fd; box-shadow: 0 3px 10px rgba(34,113,177,.18); }
.bgc-tab.bgc-tab-na { background: #f3f4f5; color: #a7aaad; border-color: #e2e6ea; cursor: not-allowed;
  box-shadow: none; opacity: .7; text-decoration: line-through; pointer-events: none; }

.bgc-nocod, .bgc-street-note { margin: -4px 0 10px; padding: 8px 11px; border: 1px solid #f0d9a8; border-radius: 8px;
  background: #fdf6e6; color: #6b5314; font-size: 13px; line-height: 1.45; }
.bgc-street-note { margin-top: 6px; }

.bgc-field.bgc-invalid > label { color: #b32d2e; }
.bgc-field.bgc-invalid input,
.bgc-field.bgc-invalid .select2-selection { border-color: #b32d2e !important; box-shadow: 0 0 0 3px rgba(179,45,46,.14); }

.bgc-panel { display: flex; flex-direction: column; gap: 10px; }
.bgc-address-rows { display: flex; flex-direction: column; gap: 10px; }
.bgc-field { display: flex; flex-direction: column; min-width: 0; }
.bgc-field > label { font-size: 12px; font-weight: 600; color: #555; margin: 0 0 3px; }
.bgc-field input { width: 100%; height: 38px; padding: 6px 10px; border: 1px solid #d8dde3; border-radius: 8px; }
.bgc-grid { display: grid; grid-template-columns: 1fr 110px; gap: 10px; }
.bgc-grid-4 { grid-template-columns: repeat(4, 1fr); }
.bgc-grid-map { grid-template-columns: 1fr 84px 46px; }
.bgc-addr-map-cell { justify-content: flex-end; }
.bgc-addr-map-icon { width: 100%; height: 38px; padding: 0; display: inline-flex; align-items: center; justify-content: center;
  border: 1px solid #d8dde3; border-radius: 8px; background: #fff; color: #2271b1; cursor: pointer; }
.bgc-addr-map-icon:hover { border-color: #2271b1; background: #f3f8fd; }

.bgc-fields .select2-container { width: 100% !important; }
.bgc-fields select:not(.select2-hidden-accessible) { width: 0; min-width: 100%; }
.bgc-fields .select2-selection { min-height: 38px !important; border: 1px solid #d8dde3 !important; border-radius: 8px !important; display: flex; align-items: center; }
/* width: 0 + min-width: 100% is load-bearing: it keeps this checkout on a phone */
.bgc-fields .select2-selection__rendered { line-height: 36px !important; padding-left: 8px !important; overflow: hidden; text-overflow: ellipsis; white-space: nowrap; width: 0; min-width: 100%; }
.bgc-fields .select2-selection__arrow { height: 36px !important; }
.select2-container--open .bgc-drop .select2-search--dropdown { padding: 8px; }
.select2-container--open .bgc-drop .select2-search--dropdown .select2-search__field {
  height: 38px; min-height: 38px; box-sizing: border-box; padding: 0 10px;
  border: 1px solid #d8dde3; border-radius: 8px; font-size: 15px; line-height: 36px; }
.select2-container--open .bgc-drop .select2-search--dropdown .select2-search__field:focus {
  border-color: #2271b1; outline: none; }
.select2-container--open .bgc-drop .select2-results__option { padding: 9px 10px; }

.bgc-loader { display: none; }
/* no CSS filter: it creates a containing block */
.bgc-fields.bgc-loading .bgc-panel, .bgc-fields.bgc-loading .bgc-tabs { opacity: .5; pointer-events: none; }

label.bgc-rate-inactive, label.bgc-rate-inactive .amount, label.bgc-rate-inactive .woocommerce-Price-amount { color: #9aa0a6 !important; }
.bgc-spinner { width: 26px; height: 26px; border: 3px solid #cfd8e3; border-top-color: #2271b1; border-radius: 50%; animation: bgc-spin .7s linear infinite; }
@keyframes bgc-spin { to { transform: rotate(360deg); } }

/* Emergency help modal */
.bgc-emerg-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2147483647; display: flex; align-items: center; justify-content: center; padding: 16px; }
.bgc-emerg-box { position: relative; background: #fff; border-radius: 12px; max-width: 420px; width: 100%; padding: 28px 26px; box-shadow: 0 12px 40px rgba(0,0,0,.25); text-align: center; }
.bgc-emerg-close { position: absolute; top: 8px; right: 12px; border: 0; background: none; font-size: 26px; line-height: 1; color: #888; cursor: pointer; }
.bgc-emerg-msg { font-size: 16px; line-height: 1.5; margin: 4px 0 18px; color: #222; }
.bgc-emerg-tel { display: inline-block; font-size: 22px; font-weight: 700; text-decoration: none; padding: 12px 22px; border-radius: 10px; background: #2271b1; color: #fff !important; }
.bgc-emerg-tel:hover { background: #135e96; }

.bgc-ship-logo { width: 16px; height: 16px; object-fit: contain; vertical-align: -3px; margin-right: 5px; display: inline-block; }
.bgc-free-notice * { color: inherit !important; }

/* Office / APS map picker (Leaflet) */
.bgc-office-pick { display: flex; gap: 6px; align-items: stretch; max-width: 100%; }
.bgc-office-pick .bgc-office:not(.select2-hidden-accessible) { flex: 1 1 auto; min-width: 0; }
.bgc-office-pick .select2-container { flex: 1 1 auto; min-width: 0; width: auto !important; }
.bgc-map-btn { flex: 0 0 auto; white-space: nowrap; display: inline-flex; align-items: center; gap: 6px;
  box-sizing: border-box; height: 38px; padding: 0 12px;
  background: transparent; color: inherit; font: inherit; line-height: 1;
  border: 1px solid currentColor; border-radius: 8px; opacity: .6;
  cursor: pointer; box-shadow: none; transition: opacity .15s ease, background-color .15s ease; }
.bgc-map-btn:hover { opacity: 1; background: rgba(128,128,128,.10); }
.bgc-map-btn:focus-visible { opacity: 1; outline: 2px solid currentColor; outline-offset: 1px; }
.bgc-map-btn:disabled { opacity: .3; cursor: default; background: transparent; }
/* a long office name wraps the field to three lines: the button follows its height (themes pull the field up with a negative margin) */
.bgc-office-pick .bgc-map-btn { height: auto; }
.bgc-office-pick .select2-container .select2-selection { margin-bottom: 0; }
.bgc-map-btn .bgc-map-ico { flex: 0 0 auto; display: block; }
.bgc-map-overlay { position: fixed; inset: 0; background: rgba(0,0,0,.5); z-index: 2147483647; display: flex; align-items: center; justify-content: center; padding: 16px; }
.bgc-map-box { background: #fff; border-radius: 10px; width: min(860px, 96vw); max-height: 92vh; display: flex; flex-direction: column; overflow: hidden; box-shadow: 0 12px 40px rgba(0,0,0,.3); }
.bgc-map-head { display: flex; align-items: center; justify-content: space-between; padding: 10px 14px; border-bottom: 1px solid #e5e7eb; }
.bgc-map-close { border: 0; background: none; font-size: 24px; line-height: 1; cursor: pointer; color: #6b7280; }
.bgc-map-canvas { flex: 1 1 auto; height: 62vh; min-height: 300px; width: 100%; }
.bgc-map-actions { display: flex; align-items: center; gap: 10px; padding: 10px 14px; border-top: 1px solid #e5e7eb; }
.bgc-map-hint { color: #6b7280; font-size: .92em; }
.bgc-map-pop { text-align: center; min-width: 150px; }
.bgc-map-pop .bgc-map-choose { margin-top: 6px; }
.leaflet-container { font: inherit; }
.bgc-map-actions .bgc-map-hint { flex: 1 1 auto; }
.bgc-map-actions .bgc-addr-use { flex: 0 0 auto; }
.bgc-map-box-wide { width: min(1060px, 96vw); }
.bgc-map-body { display: flex; height: 64vh; min-height: 340px; }
.bgc-map-side { width: 360px; max-width: 46%; display: flex; flex-direction: column; background: #fafbfc; border-right: 1px solid #e5e7eb; }
.bgc-map-searchrow { display: flex; align-items: center; gap: 8px; margin: 12px; }
.bgc-map-side .bgc-map-searchrow .bgc-map-search { flex: 1 1 auto; min-width: 0; margin: 0 !important;
  box-sizing: border-box !important; padding: 10px 12px 10px 38px !important; height: auto !important; }
.bgc-map-searchrow .bgc-map-locate,
.bgc-allmap-searchrow .bgc-map-locate { flex: 0 0 auto; width: 38px; height: 38px; padding: 0; border: 1px solid #d8dde3;
  border-radius: 10px; background: #fff no-repeat center / 18px 18px; cursor: pointer; position: relative;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='none' stroke='%232271b1' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='12' cy='12' r='3'/%3E%3Cpath d='M12 2v3M12 19v3M2 12h3M19 12h3'/%3E%3Ccircle cx='12' cy='12' r='8'/%3E%3C/svg%3E"); }
.bgc-map-searchrow .bgc-map-locate:hover,
.bgc-allmap-searchrow .bgc-map-locate:hover { border-color: #2271b1; box-shadow: 0 0 0 3px rgba(34,113,177,.15); }
.bgc-map-search { margin: 12px; padding: 10px 12px 10px 38px; border: 1px solid #d8dde3; border-radius: 10px; font: inherit; background-color: #fff;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='16' height='16' viewBox='0 0 24 24' fill='none' stroke='%236b7280' stroke-width='2' stroke-linecap='round' stroke-linejoin='round'%3E%3Ccircle cx='11' cy='11' r='8'/%3E%3Cpath d='m21 21-4.3-4.3'/%3E%3C/svg%3E");
  background-repeat: no-repeat; background-position: 13px center; transition: border-color .15s, box-shadow .15s; }
.bgc-map-search:focus { outline: none; border-color: #2271b1; box-shadow: 0 0 0 3px rgba(34,113,177,.15); }
.bgc-map-list { flex: 1 1 auto; overflow-y: auto; margin: 0; padding: 0; list-style: none; }
.bgc-map-item { padding: 11px 14px; border-bottom: 1px solid #eceef0; border-left: 3px solid transparent; cursor: pointer; display: flex; flex-direction: column; gap: 3px; transition: background .12s, border-color .12s; }
.bgc-map-item strong { font-weight: 600; line-height: 1.25; }
.bgc-map-item:hover { background: #f0f5fb; }
.bgc-map-item.active { background: #eaf3fc; border-left-color: #2271b1; }
.bgc-map-item span { color: #6b7280; font-size: .86em; line-height: 1.3; }
.bgc-map-body .bgc-map-canvas { flex: 1 1 auto; height: 100%; min-height: 0; }
@media (max-width: 680px) {
  .bgc-map-body { flex-direction: column; height: auto; }
  .bgc-map-side { width: auto; max-width: none; max-height: 28vh; border-right: 0; border-bottom: 1px solid #e5e7eb; }
  .bgc-map-body .bgc-map-canvas { height: 46vh; }
  .bgc-map-actions { flex-wrap: wrap; flex-shrink: 0; }
  .bgc-map-actions .bgc-map-hint { flex: 1 1 100%; order: -1; }
  .bgc-map-actions .bgc-map-locate, .bgc-map-actions .bgc-addr-use { flex: 1 1 auto; }
  .bgc-map-box { width: min(860px, 100vw - 24px); }
  .bgc-map-canvas { height: 42vh; min-height: 180px; }
  .bgc-map-box { overflow-y: auto; }
}

.bgc-fields .select2-container--default .select2-selection--single { position: relative; }
.bgc-fields .select2-container--default .select2-selection--single .select2-selection__clear {
  position: absolute; right: 26px; top: 50%; transform: translateY(-50%); margin: 0;
  float: none; padding: 0 4px; font-size: 18px; line-height: 1; color: #6b7280; }
.bgc-fields .select2-container--default .select2-selection--single .select2-selection__clear:hover { color: #1d2327; }
.bgc-fields .select2-container--default .select2-selection--single .select2-selection__rendered { padding-right: 48px; }

/* Narrow screens, and narrow columns */
@supports (container-type: inline-size) {
  .bgc-fields { container-type: inline-size; container-name: bgcfields; }
}

.bgc-fields .bgc-office-row .select2-selection__rendered { white-space: normal; line-height: 1.3 !important;
  display: -webkit-box; -webkit-line-clamp: 3; -webkit-box-orient: vertical; }
.bgc-fields .bgc-office-row .select2-selection--single { height: auto !important; padding-top: 6px; padding-bottom: 6px; }
.bgc-fields .bgc-office-row .select2-selection__arrow { top: 0; bottom: 0; height: auto !important; }
.select2-container--open .select2-dropdown.bgc-drop { box-sizing: border-box; min-width: 100%; }

@container bgcfields (max-width: 360px) {
  .bgc-tabs { gap: 6px; }
  .bgc-tab { min-width: 0; padding: 10px 8px; }
  .bgc-office-pick .bgc-map-btn { width: 44px; padding: 0; justify-content: center; }
  .bgc-office-pick .bgc-map-btn span { position: absolute; width: 1px; height: 1px; margin: -1px; padding: 0;
    overflow: hidden; clip: rect(0 0 0 0); clip-path: inset(50%); white-space: nowrap; }
  .bgc-grid { grid-template-columns: minmax(0, 1fr); }
  .bgc-grid-map { grid-template-columns: minmax(0, 1fr) 44px; }
  .bgc-grid-map > .bgc-street-field { grid-column: 1; grid-row: 1; }
  .bgc-grid-map > .bgc-addr-map-cell { grid-column: 2; grid-row: 1; }
  .bgc-grid-map > .bgc-streetno-field { grid-column: 1 / -1; grid-row: 2; max-width: 120px; }
  .bgc-grid-4 { grid-template-columns: repeat(2, minmax(0, 1fr)); }
}

/* Touch: sizes here are about the finger, not the column */
@media (pointer: coarse) {
  /* 16px: below it iOS zooms the page when a field is focused */
  .bgc-fields input,
  .bgc-fields .select2-selection__rendered,
  .select2-container--open .bgc-drop .select2-search--dropdown .select2-search__field { font-size: 16px; }
  .bgc-fields input { min-height: 44px; }
  .bgc-fields .select2-selection { min-height: 44px !important; }
  .bgc-fields .select2-selection__rendered { line-height: 42px !important; }
  .bgc-fields .select2-selection__arrow { height: 42px !important; }
  .bgc-fields .bgc-office-row .select2-selection__rendered { line-height: 1.3 !important; }
  .bgc-fields .bgc-office-row .select2-selection__arrow { height: auto !important; }
  .select2-container--open .bgc-drop .select2-search--dropdown .select2-search__field { height: 44px; min-height: 44px; line-height: 42px; }
  .select2-container--open .bgc-drop .select2-results__option { padding: 12px 10px; }
  .bgc-tab, .bgc-map-btn, .bgc-addr-map-icon { min-height: 44px; }
  .bgc-map-actions .button { min-height: 44px; }
}
