/**
 * Фінальні override для [atsp_search] — панелі в body (portal), завантажується після Elementor.
 * Inline embed: бар + порталені панелі. Завантажується останнім після Elementor.
 */

body.atsp-embed-active > .anex-panel-portal.anex-panel[hidden],
body.atsp-embed-active > .anex-panel-portal.anex-panel-backdrop[hidden] {
  display: none !important;
  visibility: hidden !important;
  pointer-events: none !important;
  opacity: 0 !important;
}

/* Elementor: зняти overflow/transform з предків віджета */
.elementor-section:has(#atsp-embed-search),
.elementor-element:has(#atsp-embed-search),
.elementor-element:has(#atsp-embed-search) .e-con,
.elementor-element:has(#atsp-embed-search) .e-con-inner,
.e-con:has(#atsp-embed-search),
.e-con:has(#atsp-embed-search) .e-con-inner,
.elementor-widget-shortcode:has(#atsp-embed-search),
.elementor-widget-shortcode:has(#atsp-embed-search) .elementor-widget-container {
  overflow: visible !important;
  --overflow: visible !important;
}

.elementor-widget-shortcode:has(#atsp-embed-search) .elementor-widget-container {
  margin-left: 0 !important;
  margin-right: 0 !important;
}

.elementor-element.e-transform:has(#atsp-embed-search),
.elementor-element.e-transform:has(#atsp-embed-search) .e-con,
.elementor-element:has(> .elementor-widget-shortcode #atsp-embed-search),
.elementor-element:has(#atsp-embed-search) .e-transform {
  transform: none !important;
  --e-transform-rotateZ: 0deg !important;
  --e-transform-translateX: 0px !important;
  --e-transform-translateY: 0px !important;
}

/* ── Desktop bar (як /poshuk-pro/) ── */
@media (min-width: 769px) {
  #atsp-embed-search .anex-search-bar {
    display: flex !important;
    flex-direction: row !important;
    align-items: stretch !important;
    flex-wrap: nowrap !important;
    height: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;
  }

  #atsp-embed-search .anex-search-bar > .anex-search-segment,
  #atsp-embed-search .anex-search-bar > .anex-search-segment--country-edit,
  #atsp-embed-search .anex-search-bar > .ps-submit,
  #atsp-embed-search .anex-search-bar > button.ps-submit {
    height: 68px !important;
    min-height: 68px !important;
    max-height: 68px !important;
    box-sizing: border-box !important;
  }

  /* Країна: input на desktop, не mobile-кнопка */
  #atsp-embed-search #ps-country-segment.anex-search-segment--country-btn {
    display: none !important;
    visibility: hidden !important;
    position: absolute !important;
    width: 0 !important;
    height: 0 !important;
    overflow: hidden !important;
    pointer-events: none !important;
  }

  #atsp-embed-search #ps-country-segment-desk.anex-search-segment--country-edit {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    visibility: visible !important;
    position: relative !important;
    width: auto !important;
    height: 68px !important;
    pointer-events: auto !important;
  }

  #atsp-embed-search .anex-search-bar button.anex-search-segment {
    display: flex !important;
    flex-direction: column !important;
    justify-content: center !important;
    align-items: flex-start !important;
    gap: 2px !important;
    padding: 12px 18px !important;
    border: 0 !important;
    border-right: 1px solid #e8ecf2 !important;
    border-radius: 0 !important;
    background: transparent !important;
    background-color: transparent !important;
    background-image: none !important;
    color: #1a2233 !important;
    -webkit-text-fill-color: #1a2233 !important;
    box-shadow: none !important;
    font-family: inherit !important;
    font-size: inherit !important;
    font-weight: inherit !important;
    line-height: 1.25 !important;
    text-transform: none !important;
    letter-spacing: normal !important;
    white-space: nowrap !important;
    overflow: hidden !important;
    cursor: pointer !important;
  }

  #atsp-embed-search .anex-search-bar button.anex-search-segment:hover,
  #atsp-embed-search .anex-search-bar button.anex-search-segment.is-open,
  #atsp-embed-search .anex-search-bar button.anex-search-segment:focus,
  #atsp-embed-search .anex-search-bar button.anex-search-segment:focus-visible {
    background: #f8fafc !important;
    background-color: #f8fafc !important;
    color: #1a2233 !important;
    -webkit-text-fill-color: #1a2233 !important;
    outline: none !important;
    outline-offset: 0 !important;
    box-shadow: none !important;
    border-top: 0 !important;
    border-bottom: 0 !important;
    border-left: 0 !important;
    border-right: 1px solid #e8ecf2 !important;
  }

  #atsp-embed-search .anex-search-segment--country-edit.is-open,
  #atsp-embed-search .anex-search-segment--country-edit:focus-within {
    outline: none !important;
    box-shadow: none !important;
    background: #f8fafc !important;
    border-right: 1px solid #e8ecf2 !important;
  }

  #atsp-embed-search .anex-search-bar .ps-submit,
  #atsp-embed-search .anex-search-bar button.ps-submit,
  .elementor-kit-5 #atsp-embed-search .anex-search-bar .ps-submit,
  [class*="elementor-kit-"] #atsp-embed-search .anex-search-bar button.ps-submit {
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
    flex: 0 0 132px !important;
    width: auto !important;
    min-width: 132px !important;
    padding: 0 28px !important;
    margin: 0 !important;
    border: 0 !important;
    border-radius: 0 14px 14px 0 !important;
    background: #f31624 !important;
    background-color: #f31624 !important;
    background-image: none !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    font-family: "Montserrat", system-ui, sans-serif !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    box-shadow: none !important;
    transform: none !important;
    cursor: pointer !important;
  }

  #atsp-embed-search .anex-search-bar .ps-submit:hover,
  .elementor-kit-5 #atsp-embed-search .anex-search-bar .ps-submit:hover,
  [class*="elementor-kit-"] #atsp-embed-search .anex-search-bar button.ps-submit:hover {
    background: #de0f1c !important;
    background-color: #de0f1c !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
  }

  #atsp-embed-search .anex-segment-label {
    display: block !important;
    font-size: 11px !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    color: #8b95a8 !important;
    -webkit-text-fill-color: #8b95a8 !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #atsp-embed-search .anex-segment-value {
    display: block !important;
    font-size: 16px !important;
    font-weight: 700 !important;
    line-height: 1.25 !important;
    color: #1a2233 !important;
    -webkit-text-fill-color: #1a2233 !important;
    overflow: hidden !important;
    text-overflow: ellipsis !important;
    white-space: nowrap !important;
    max-width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
  }

  #atsp-embed-search .anex-segment-value.is-placeholder {
    color: #9aa3b5 !important;
    -webkit-text-fill-color: #9aa3b5 !important;
    font-weight: 600 !important;
  }

  #atsp-embed-search .anex-search-mode-btn,
  .elementor-kit-5 #atsp-embed-search .anex-search-mode-btn,
  [class*="elementor-kit-"] #atsp-embed-search .anex-search-mode-btn {
    background: #fff !important;
    background-color: #fff !important;
    color: #1a2233 !important;
    -webkit-text-fill-color: #1a2233 !important;
  }
}

/* Mobile embed: вміщення у viewport + одне поле країни */
@media (max-width: 768px) {
  #atsp-embed-search,
  #atsp-embed-search .atsp-embed-widget,
  #atsp-embed-search .proto-hero--embed,
  #atsp-embed-search .proto-page,
  #atsp-embed-search .hero-catalog-form {
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    box-sizing: border-box !important;
  }

  .elementor-section:has(#atsp-embed-search),
  .elementor-element:has(#atsp-embed-search),
  .elementor-widget-shortcode:has(#atsp-embed-search),
  .elementor-widget-shortcode:has(#atsp-embed-search) .elementor-widget-container {
    width: 100% !important;
    max-width: 100% !important;
    margin-left: 0 !important;
    margin-right: 0 !important;
    padding-left: 0 !important;
    padding-right: 0 !important;
  }

  #atsp-embed-search #ps-country-segment.anex-search-segment--country-btn {
    display: flex !important;
    visibility: visible !important;
    position: relative !important;
    width: 100% !important;
    height: auto !important;
    min-height: 52px !important;
    pointer-events: auto !important;
  }

  #atsp-embed-search #ps-country-segment-desk.anex-search-segment--country-edit,
  .atsp-embed-root .atsp-embed-widget .anex-search-segment--country-edit {
    display: none !important;
  }

  #atsp-embed-search .anex-search-bar {
    flex-direction: column !important;
    height: auto !important;
    max-height: none !important;
    min-height: 0 !important;
    width: 100% !important;
  }

  #atsp-embed-search .anex-search-mode-switch {
    width: 100% !important;
    max-width: 100% !important;
    flex-wrap: nowrap !important;
    overflow-x: auto !important;
    -webkit-overflow-scrolling: touch !important;
    scrollbar-width: none !important;
    gap: 8px !important;
    padding-bottom: 2px !important;
  }

  #atsp-embed-search .anex-search-mode-switch::-webkit-scrollbar {
    display: none !important;
  }

  #atsp-embed-search .anex-search-mode-btn {
    flex-shrink: 0 !important;
    padding: 9px 14px !important;
    font-size: 13px !important;
  }

  #atsp-embed-search .anex-search-segment {
    width: 100% !important;
    min-height: 52px !important;
    box-sizing: border-box !important;
  }

  #atsp-embed-search .anex-segment-label {
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #9aa3b5 !important;
    line-height: 1.25 !important;
  }

  #atsp-embed-search .anex-segment-value {
    font-size: 15px !important;
    font-weight: 700 !important;
    line-height: 1.3 !important;
  }

  .elementor-widget-shortcode.elementor-widget-mobile__width-initial:has(#atsp-embed-search),
  .elementor-element.elementor-widget-mobile__width-initial:has(#atsp-embed-search) {
    width: 100% !important;
    max-width: 100% !important;
    --width: 100% !important;
    --container-widget-width: 100% !important;
  }

  #atsp-embed-search button.ps-submit.ps-submit--mobile,
  .elementor-kit-5 #atsp-embed-search button.ps-submit.ps-submit--mobile,
  [class*="elementor-kit-"] #atsp-embed-search button.ps-submit.ps-submit--mobile {
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
    width: 100% !important;
    max-width: 100% !important;
    min-width: 0 !important;
    flex: none !important;
    margin: 10px 0 0 !important;
    padding: 0 16px !important;
    border: 0 !important;
    border-left: 0 !important;
    border-radius: 12px !important;
    outline: none !important;
    box-shadow: 0 8px 24px rgba(243, 22, 36, 0.28) !important;
    min-height: 50px !important;
    height: auto !important;
    align-self: stretch !important;
    box-sizing: border-box !important;
    position: relative !important;
    left: auto !important;
    right: auto !important;
    background: #f31624 !important;
    background-color: #f31624 !important;
    background-image: none !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    font-family: "Montserrat", system-ui, sans-serif !important;
    font-size: 16px !important;
    font-weight: 800 !important;
    line-height: 1 !important;
    transform: none !important;
    cursor: pointer !important;
    overflow: hidden !important;
    -webkit-appearance: none !important;
    appearance: none !important;
  }

  #atsp-embed-search button.ps-submit.ps-submit--mobile:hover,
  #atsp-embed-search button.ps-submit.ps-submit--mobile:focus,
  #atsp-embed-search button.ps-submit.ps-submit--mobile:focus-visible,
  .elementor-kit-5 #atsp-embed-search button.ps-submit.ps-submit--mobile:hover,
  [class*="elementor-kit-"] #atsp-embed-search button.ps-submit.ps-submit--mobile:focus {
    border: 0 !important;
    border-left: 0 !important;
    outline: none !important;
    background: #de0f1c !important;
    background-color: #de0f1c !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    box-shadow: 0 8px 24px rgba(243, 22, 36, 0.28) !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel-backdrop:not([hidden]) {
    z-index: 2147482999 !important;
    pointer-events: auto !important;
    background: rgba(11, 18, 34, 0.45) !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel:not([hidden]) {
    z-index: 2147483000 !important;
  }
}

/* ── Порталені панелі (body) — повна копія /poshuk-pro/ ── */
body.atsp-embed-active.atsp-panel-open > .anex-panel-portal.anex-panel:not([hidden]) {
  z-index: 2147483000 !important;
}

@media (min-width: 769px) {
  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-sheet-head,
  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-sheet-foot,
  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-sheet-search,
  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-sheet-back,
  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-sheet-foot--dest {
    display: none !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-sheet {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    max-height: inherit !important;
    height: 100% !important;
    background: #fff !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-sheet-body,
  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-sheet-body--flush {
    display: flex !important;
    flex-direction: column !important;
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow: hidden !important;
    padding: 0 !important;
    background: #fff !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-dest-picker-hint {
    flex-shrink: 0 !important;
    margin: 0 !important;
    padding: 8px 14px 6px !important;
    font-size: 12px !important;
    font-weight: 600 !important;
    color: #8b95a8 !important;
    background: #fff !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-dest-picker {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    display: flex !important;
    flex-direction: column !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-dest-browse {
    display: grid !important;
    grid-template-columns: 196px minmax(0, 1fr) !important;
    flex: 1 1 auto !important;
    min-height: 280px !important;
    max-height: 100% !important;
    height: auto !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-dest-col--countries {
    border-right: 1px solid #e8ecf2 !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    background: #fafbfd !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-dest-col--regions {
    display: flex !important;
    flex-direction: column !important;
    min-height: 0 !important;
    max-height: 100% !important;
    overflow: hidden !important;
    background: #fff !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-dest-regions {
    flex: 1 1 auto !important;
    min-height: 0 !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    padding: 8px 0 4px !important;
    background: #fff !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--destination .anex-dest-apply--desktop {
    display: block !important;
    flex-shrink: 0 !important;
    margin: 0 !important;
    width: 100% !important;
    min-height: 48px !important;
    border: 0 !important;
    border-top: 1px solid #e8ecf2 !important;
    border-radius: 0 !important;
    background: #f31624 !important;
    background-color: #f31624 !important;
    color: #fff !important;
    -webkit-text-fill-color: #fff !important;
    font-family: inherit !important;
    font-size: 15px !important;
    font-weight: 800 !important;
    box-shadow: 0 -4px 12px rgba(15, 23, 38, 0.06) !important;
    cursor: pointer !important;
  }
}

body.atsp-embed-active > .anex-panel-portal .anex-dest-countries,
body.atsp-embed-active > .anex-panel-portal .anex-dest-regions-list {
  list-style: none !important;
  margin: 0 !important;
  padding: 6px 0 !important;
}

body.atsp-embed-active > .anex-panel-portal .anex-dest-country,
body.atsp-embed-active > .anex-panel-portal .anex-dest-region-row,
[class*="elementor-kit-"] body.atsp-embed-active > .anex-panel-portal .anex-dest-country,
[class*="elementor-kit-"] body.atsp-embed-active > .anex-panel-portal .anex-dest-region-row {
  display: flex !important;
  align-items: center !important;
  gap: 10px !important;
  width: 100% !important;
  padding: 11px 14px !important;
  margin: 0 !important;
  border: 0 !important;
  border-radius: 0 !important;
  background: transparent !important;
  background-color: transparent !important;
  background-image: none !important;
  font-family: inherit !important;
  font-size: 14px !important;
  font-weight: 700 !important;
  color: #1a2233 !important;
  -webkit-text-fill-color: #1a2233 !important;
  text-align: left !important;
  box-shadow: none !important;
  cursor: pointer !important;
}

body.atsp-embed-active > .anex-panel-portal .anex-dest-country.is-active {
  background: #e8eef8 !important;
  background-color: #e8eef8 !important;
}

body.atsp-embed-active > .anex-panel-portal .anex-dest-region-row {
  padding: 10px 16px !important;
}

body.atsp-embed-active > .anex-panel-portal .anex-dest-check {
  width: 22px !important;
  height: 22px !important;
  flex-shrink: 0 !important;
  border: 2px solid #d2d8e4 !important;
  border-radius: 6px !important;
  background: #fff !important;
  position: relative !important;
}

body.atsp-embed-active > .anex-panel-portal .anex-dest-check.is-on {
  border-color: #f31624 !important;
  background: #f31624 !important;
}

body.atsp-embed-active > .anex-panel-portal .anex-dest-regions-empty {
  margin: 0 !important;
  padding: 20px 16px !important;
  font-size: 13px !important;
  font-weight: 600 !important;
  color: #8b95a8 !important;
  background: #fff !important;
}

body.atsp-embed-active > .anex-panel-portal .anex-dest-regions-section {
  padding: 12px 16px 4px !important;
  font-size: 11px !important;
  font-weight: 800 !important;
  letter-spacing: 0.04em !important;
  text-transform: uppercase !important;
  color: #8b95a8 !important;
  background: #fff !important;
}

/* ── Порталені панелі: ізоляція від Elementor Kit (як /poshuk-pro/) ── */
@media (min-width: 769px) {
  body.atsp-embed-active > .anex-panel-portal.anex-panel--guests:not([hidden]) {
    width: 300px !important;
    min-width: 300px !important;
    max-width: calc(100vw - 32px) !important;
    padding: 12px 16px !important;
    box-sizing: border-box !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--nights:not([hidden]) {
    width: 320px !important;
    min-width: 320px !important;
    max-width: calc(100vw - 32px) !important;
    padding: 0 0 12px !important;
    box-sizing: border-box !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--dates:not([hidden]) {
    width: max-content !important;
    min-width: 0 !important;
    max-width: calc(100vw - 32px) !important;
    padding: 16px 12px 18px !important;
    box-sizing: border-box !important;
  }

  body.atsp-embed-active > .anex-panel-portal.anex-panel--sheet:not(.anex-panel--destination) .anex-sheet-body {
    overflow: visible !important;
    padding: 0 !important;
    margin: 0 !important;
  }
}

[class*="elementor-kit-"] body.atsp-embed-active > .anex-panel-portal.anex-panel {
  font-family: "Montserrat", "Segoe UI", system-ui, -apple-system, sans-serif !important;
  font-size: 16px !important;
  font-weight: 400 !important;
  line-height: 1.4 !important;
  color: #1a2233 !important;
  -webkit-text-fill-color: initial !important;
}

[class*="elementor-kit-"] body.atsp-embed-active > .anex-panel-portal.anex-panel strong,
[class*="elementor-kit-"] body.atsp-embed-active > .anex-panel-portal.anex-panel b {
  color: #1a2233 !important;
  -webkit-text-fill-color: #1a2233 !important;
  font-weight: 700 !important;
}

[class*="elementor-kit-"] body.atsp-embed-active > .anex-panel-portal.anex-panel button {
  font-family: inherit !important;
  letter-spacing: normal !important;
  text-transform: none !important;
}

[class*="elementor-kit-"] body.atsp-embed-active > .anex-panel-portal .anex-stepper-row > div:first-child span {
  color: #8b95a8 !important;
  -webkit-text-fill-color: #8b95a8 !important;
  font-weight: 400 !important;
}
