/*
 * Product page lead forms and the video tour banner (enqueued on product pages,
 * php/add_scripts_styles.php).
 *
 * - .video-tour-banner          template-parts/product-video-tour-banner.php
 * - .price-track                template-parts/product-price-track.php
 * - .lead-form (in .modal--request)
 *     forms/templates/modal--request-video-tour (date + time picker)
 *     forms/templates/modal--request-prices
 *
 * Pixso: "Video tour banner", "Хочу видеоэкскурсию" (+ calendar open, date
 * selected, success), "Получить цены" (+ success). Breakpoints: 360-639,
 * 640-959, 960+.
 */

/* ======================= Video tour banner ======================= */

.video-tour-banner {
  position: relative;
  overflow: hidden;
  margin: 60px 0 80px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.07);
  font-family: "Inter", sans-serif;
  color: #fff;
}

.video-tour-banner__image {
  position: absolute;
  inset: 0 0 0 auto;
  width: 62%;
  pointer-events: none;
  -webkit-mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
          mask-image: linear-gradient(90deg, transparent 0%, #000 45%);
}

.video-tour-banner__image img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  object-position: center;
  opacity: 0.85;
}

.video-tour-banner__overlay {
  position: absolute;
  inset: 0 0 0 auto;
  width: 100%;
  pointer-events: none;
  background: linear-gradient(90deg, #202224 0%, rgba(32, 34, 36, 0.1) 70%),
    linear-gradient(180deg, #202224 0%, rgba(32, 34, 36, 0.1) 70%),
    linear-gradient(114.22deg, #202224 0%, rgba(32, 34, 36, 0.1) 70%);
}

.video-tour-banner__content {
  position: relative;
  padding: 44px 48px 48px 50px;
  max-width: 600px;
}

.video-tour-banner__title {
  position: relative;
  margin: 0 0 32px;
  max-width: 540px;
  font-family: inherit;
  font-size: 30px;
  font-weight: 600;
  line-height: 1.2;
  color: #fff;
}

/* "Live" dot */
.video-tour-banner__title::before {
  content: "";
  position: absolute;
  top: 0.5em;
  left: -22px;
  width: 8px;
  height: 8px;
  margin-top: -4px;
  border-radius: 50%;
  background: #ff3b30;
  box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.6);
  animation: video-tour-live 2s infinite;
}

@keyframes video-tour-live {
  0% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0.6); }
  70% { box-shadow: 0 0 0 8px rgba(255, 59, 48, 0); }
  100% { box-shadow: 0 0 0 0 rgba(255, 59, 48, 0); }
}

@media (prefers-reduced-motion: reduce) {
  .video-tour-banner__title::before {
    animation: none;
  }
}

.video-tour-banner__langs-title {
  margin-bottom: 12px;
  font-size: 15px;
  line-height: 1.4;
  color: rgba(255, 255, 255, 0.9);
}

.video-tour-banner__langs-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px 22px;
  margin: 0;
  padding: 0;
  list-style: none;
}

.video-tour-banner__langs-list li {
  display: flex;
  align-items: center;
  gap: 12px;
  margin: 0;
  font-size: 15px;
  line-height: 1.4;
}

.video-tour-banner__langs-list img {
  width: 24px;
  height: 16px;
  object-fit: cover;
}

.video-tour-banner__actions {
  display: flex;
  flex-direction: column;
  align-items: flex-start;
  gap: 12px;
  margin-top: 36px;
}

.video-tour-banner__btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  min-width: 300px;
  height: 48px;
  padding: 0 20px;
  border: 0;
  border-radius: 8px;
  font-family: inherit;
  font-size: 15px;
  font-weight: 500;
  line-height: 1;
  cursor: pointer;
  transition: background-color 0.2s, filter 0.2s;
}

.video-tour-banner__btn--primary {
  background: #ffdead;
  color: #191926;
}

.video-tour-banner__btn--primary:hover {
  filter: brightness(90%);
}

.video-tour-banner__btn--video {
  justify-content: flex-start;
  min-width: 0;
  background: rgba(255, 255, 255, 0.07);
  color: #fff;
  -webkit-backdrop-filter: blur(8px);
          backdrop-filter: blur(8px);
}

.video-tour-banner__btn--video:hover {
  background: rgba(255, 255, 255, 0.14);
}

@media (max-width: 959px) {
  .video-tour-banner {
    margin: 40px 0 40px;
  }

  .video-tour-banner__image {
    display: none;
  }

  .video-tour-banner__content {
    max-width: none;
    padding: 20px 12px 24px 30px;
  }

  .video-tour-banner__title {
    margin-bottom: 24px;
    font-size: 22px;
  }

  .video-tour-banner__title::before {
    left: -18px;
  }

  .video-tour-banner__actions {
    margin-top: 24px;
  }
}

@media (max-width: 639px) {
  .video-tour-banner {
    margin: 0 0 40px;
  }

  .video-tour-banner__content {
    padding-right: 12px;
  }

  .video-tour-banner__langs-list {
    flex-direction: column;
    gap: 10px;
  }

  .video-tour-banner__actions {
    align-items: stretch;
    margin-left: -18px; /* buttons span the whole card, under the dot too */
  }

  .video-tour-banner__btn {
    min-width: 0;
    width: 100%;
  }

  .video-tour-banner__btn--video {
    justify-content: flex-start;
  }
}

/* ======================= "Отслеживать цену" ======================= */

.price-track {
  display: none;
  align-items: center;
  justify-content: center;
  gap: 8px;
  width: calc(100% - 48px);
  margin: 0 auto 0;
  border: 0;
  border-radius: 8px;
  height: 48px;
  font-family: "Inter", sans-serif;
  font-size: 15px;
  font-weight: 500;
  line-height: 1.3;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.2s, opacity 0.2s;
}

/* Under the sidebar card (the card itself is sticky, the link moves with it) */
@media (min-width: 1200px) {
  .price-track--sidebar {
    display: flex;
    position: absolute;
    top: calc(100% + 24px);
    left: 0;
    right: 0;
    padding: 8px;
    background: none;
  }

  .price-track--sidebar:hover {
    background: #FFFFFF12;
  }
}

/* Under the gallery: the sidebar is the docked booking bar below 1200px */
@media (max-width: 1199px) {
  .price-track--mobile {
    display: flex;
    /* Above the overlays that would take its taps: ".intro::after" (a full-size
       layer over the title block, where the button sits < 640px; the block's own
       content uses the same z-index, see ".intro .container" in common.css) and
       the hero background (.background_investment) */
    position: relative;
    z-index: 1;
    width: calc(100% - 24px);
    margin: 28px auto 28px;
    padding: 0 20px;
    border-radius: 8px;
    background: rgba(255, 255, 255, 0.07);
  }

  .price-track--mobile:hover {
    background: rgba(255, 255, 255, 0.14);
  }

  /* < 640px: moved to the top of the title block (template-parts/product-mobile-order.php) */
  .intro > .price-track--mobile {
    margin: 0 auto 28px;
  }
}

/* ======================= Modals: common ======================= */
/* The forms are loaded into the shared .modal--request (footer.php) */

.modal--request:has(.lead-form) .modal__container {
  position: relative;
  max-width: 800px;
  /* Own entrance animation: the shared fadeIn keeps transform: scale(1)
     (animation-fill-mode: forwards), which would break the fixed bottom sheet */
  animation: lead-modal-in 0.3s ease-out;
}

@keyframes lead-modal-in {
  from { opacity: 0; transform: translateY(16px); }
  to { opacity: 1; transform: none; }
}

@keyframes lead-sheet-in {
  from { opacity: 0; transform: translateY(40px); }
  to { opacity: 1; transform: none; }
}

/* Generic agreement and success block of the shared modal: these forms have their own */
.modal--request:has(.lead-form) .col-60 > .input__hint.agreement,
.modal--request:has(.lead-form) .col-60 > .success_block {
  display: none !important;
}

.modal--request:has(.lead-form) .modal__close {
  width: 40px;
  height: 40px;
  top: 12px;
  right: 12px;
  z-index: 3;
  border-radius: 8px;
  background: rgba(255, 255, 255, 0.1) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath d='M6 6l12 12M18 6 6 18' stroke='%23fff' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E") no-repeat center / 24px;
}

.lead-form,
.lead-form * {
  box-sizing: border-box;
}

.modal .lead-form,
.modal .lead-form *,
.modal--request .lead-form .apartment .content .apartment_name,
.modal--request .lead-form .apartment .content #price_apartment {
  font-family: "Inter", sans-serif;
}

/* common.css: ".modal__container span { text-align: center; display: block }",
   "div[aria-label] span { width: 52px }" (the calendar dialog has an aria-label) */
.modal__container .lead-form span {
  width: auto;
  font-size: inherit;
  line-height: inherit;
  text-align: inherit;
}

.lead-form [hidden] {
  display: none !important;
}

.lead-form .what_interesting {
  margin-bottom: 12px;
}

.lead-form .lead-form__title {
  max-width: 425px;
  margin: 0 0 12px;
  font-size: 24px;
  font-weight: 700;
  line-height: 1.2;
  color: #0f1113;
}

.lead-form--prices .lead-form__title {
  max-width: none;
}

.lead-form .lead-form__subtitle {
  max-width: 470px;
  margin: -4px 0 16px;
  font-size: 16px;
  line-height: 1.5;
  color: #3a3a44;
}

/* Property preview */
.modal--request .lead-form .apartment {
  grid-template-columns: 72px auto;
  gap: 20px;
}

.modal--request .lead-form .apartment .img {
  width: 72px;
  height: 72px;
  overflow: hidden;
  border-radius: 6px;
}

.modal--request .lead-form .apartment .img img {
  width: 100%;
  height: 100%;
  object-fit: cover;
  border-radius: 6px;
}

.modal--request .lead-form .apartment .content {
  gap: 8px;
}

.modal--request .lead-form .apartment .content .apartment_name,
.modal--request .lead-form .apartment .content #price_apartment,
.lead-form .lead-success__price {
  padding: 0;
  font-size: 16px;
  line-height: 1.3;
  color: #191926;
  background: none;
}

.modal--request .lead-form .apartment .content #price_apartment,
.lead-form .lead-success__price {
  height: auto;
  font-weight: 600;
  pointer-events: none;
}

/* Fields */
.lead-form .lead-form__row {
  display: flex;
  gap: 10px;
}

.lead-form .lead-form__field {
  flex: 1 1 auto;
  min-width: 0;
  margin-bottom: 10px;
}

.lead-form .lead-form__row .lead-form__field {
  margin-bottom: 0;
}

.lead-form .lead-form__input,
.lead-form .lead-form__textarea {
  display: block;
  width: 100%;
  margin: 0;
  border: 1px solid #d4d4d9;
  border-radius: 8px;
  background: #fff;
  font-size: 16px;
  line-height: 1.3;
  color: #191926;
  outline: none;
  transition: border-color 0.2s;
}

.lead-form .lead-form__input {
  height: 56px;
  padding: 0 12px;
}

.lead-form .lead-form__textarea {
  min-height: 100px;
  padding: 12px;
  resize: vertical;
  font-size: 15px;
  line-height: 1.4;
}

.lead-form .lead-form__input::placeholder,
.lead-form .lead-form__textarea::placeholder {
  color: #77778a;
}

.lead-form .lead-form__input:focus,
.lead-form .lead-form__textarea:focus {
  border-color: #191926;
}

/* "Как связаться" */
.lead-form .contacts_box {
  margin: 40px 0;
}

.lead-form--prices .contacts_box {
  margin-top: 40px;
}

.lead-form .contacts_box h3 {
  margin: 0 0 16px;
  font-size: 18px;
  font-weight: 500;
  line-height: 1.2;
  color: #0f1113;
}

.lead-form .contacts_box .checkboxs {
  flex-wrap: wrap;
}

.lead-form .contacts_box .checkboxs .checkbox label {
  font-size: 15px;
}

/* Submit */
.lead-form .btn_submit input[type="submit"] {
  display: block;
  width: 100%;
  height: 48px;
  margin: 0;
  border: 0;
  border-radius: 8px;
  background: #ffdead;
  font-size: 16px;
  font-weight: 500;
  color: #191926;
  cursor: pointer;
}

.lead-form .btn_submit input[type="submit"]:disabled {
  opacity: 0.6;
  cursor: progress;
}

.lead-form .lead-form__agreement {
  margin: 15px auto 0;
  max-width: 470px;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  color: #8a8a99;
}

.lead-form .lead-form__agreement a {
  color: #4d4d5c;
  text-decoration: underline;
  text-underline-offset: 2px;
}

.lead-form .smart-captcha,
.lead-form .g-recaptcha {
  margin-top: 12px;
}

/* Success state (main.js adds .success to the form) */
.lead-form .lead-success {
  display: none;
}

.lead-form form.success ~ .lead-success {
  display: flex;
  flex-direction: column;
}

.lead-form .lead-success .lead-form__title {
  max-width: none;
  margin-bottom: 12px;
}

.lead-form .lead-success__apartment {
  margin-bottom: 16px;
}

.lead-form .lead-success__text {
  margin: 0;
  font-size: 16px;
  line-height: 1.5;
  color: #3a3a44;
}

.lead-form .lead-success__close {
  width: 100%;
  height: 48px;
  margin-top: 32px;
  border: 0;
  border-radius: 8px;
  background: #ffdead;
  font-size: 16px;
  font-weight: 500;
  color: #191926;
  cursor: pointer;
}

.lead-form--video-tour .lead-success__close {
  margin-top: 144px;
}

.lead-form .lead-success__close:hover,
.lead-form .btn_submit input[type="submit"]:hover {
  filter: brightness(90%);
}

/* ======================= Price Drop Alert ======================= */
/* forms/templates/modal--request-price-alert ("Отслеживать цену") */

.lead-form--price-alert .lead-form__title {
  max-width: none;
}

.lead-form .lead-form__subtitle--after {
  max-width: 470px;
  margin: 16px 0 12px;
}

.lead-form .lead-form__error {
  margin-top: 6px;
  font-size: 14px;
  line-height: 1.3;
  color: #e5372b;
}

.lead-form--price-alert .lead-success__text {
  max-width: 440px;
}

.lead-form--price-alert .lead-success__close {
  margin-top: 40px;
}

.lead-form .lead-success__note {
  max-width: 320px;
  margin: 20px auto 0;
  font-size: 14px;
  line-height: 1.4;
  text-align: center;
  color: #8a8a99;
}

.lead-form form.is-sending input[type="submit"] {
  opacity: 0.6;
  cursor: progress;
}

/* ======================= Date + time picker ======================= */

.lead-date {
  flex: 0 0 180px;
}

.lead-date__toggle {
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  height: 56px;
  padding: 0 12px;
  border: 0;
  border-radius: 8px;
  background: #ededed;
  font-size: 16px;
  line-height: 1.2;
  color: #191926;
  cursor: pointer;
  transition: background-color 0.2s;
}

.lead-date__toggle:hover,
.lead-date.is-open .lead-date__toggle {
  background: #e2e2e4;
}

.lead-date__toggle svg {
  flex-shrink: 0;
}

.modal__container .lead-date__label {
  display: inline;
  text-align: left;
  white-space: nowrap;
}

.lead-calendar {
  position: absolute;
  z-index: 5;
  width: 360px;
  max-height: calc(100vh - 16px);
  overflow-y: auto;
  overscroll-behavior: contain;
  padding: 16px;
  border: 1px solid rgba(255, 255, 255, 0.12);
  border-radius: 16px;
  background: #25242f;
  box-shadow: 0 12px 32px rgba(0, 0, 0, 0.35);
  color: #fff;
}

.lead-calendar__backdrop {
  display: none;
}

.lead-calendar__handle {
  display: none;
}

.lead-calendar__head {
  display: grid;
  grid-template-columns: 32px 1fr 32px;
  align-items: center;
  margin: 8px 0 14px;
}

.lead-calendar__month {
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
}

.lead-calendar__nav {
  display: flex;
  align-items: center;
  justify-content: center;
  width: 32px;
  height: 32px;
  padding: 0;
  border: 0;
  border-radius: 8px;
  background: none;
  color: #fff;
  cursor: pointer;
}

.lead-calendar__nav:hover {
  background: rgba(255, 255, 255, 0.08);
}

.lead-calendar__nav:disabled {
  visibility: hidden;
}

.lead-calendar__weekdays,
.lead-calendar__grid {
  display: grid;
  grid-template-columns: repeat(7, 1fr);
}

.modal__container .lead-calendar__weekdays span {
  display: block;
  padding: 6px 0 10px;
  font-size: 14px;
  font-weight: 600;
  line-height: 1.3;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
}

.lead-calendar__grid {
  row-gap: 0;
}

.lead-calendar__day {
  display: flex;
  align-items: center;
  justify-content: center;
  height: 44px;
  margin: 0 auto;
  width: 44px;
  padding: 0;
  border: 1px solid transparent;
  border-radius: 8px;
  background: none;
  font-size: 15px;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s;
}

.lead-calendar__day:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.1);
}

.lead-calendar__day.is-today:not(.is-selected) {
  text-decoration: underline;
  text-underline-offset: 4px;
}

.lead-calendar__day:disabled {
  color: rgba(255, 255, 255, 0.3);
  cursor: default;
}

.lead-calendar__day.is-selected {
  border-color: rgba(255, 255, 255, 0.3);
  background: #4a4955;
  font-weight: 700;
}

/* Time slots, shown once a date is selected */
.lead-calendar__times {
  margin-top: 10px;
  padding-top: 14px;
  border-top: 1px solid rgba(255, 255, 255, 0.1);
}

.lead-calendar__times-title {
  margin-bottom: 10px;
  font-size: 14px;
  line-height: 1.3;
  text-align: center;
  color: rgba(255, 255, 255, 0.75);
}

.lead-calendar__slots {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 6px;
}

.lead-calendar__slot {
  height: 36px;
  padding: 0;
  border: 1px solid rgba(255, 255, 255, 0.15);
  border-radius: 8px;
  background: none;
  font-size: 14px;
  line-height: 1;
  color: #fff;
  cursor: pointer;
  transition: background-color 0.15s;
}

.lead-calendar__slot:not(:disabled):hover {
  background: rgba(255, 255, 255, 0.1);
}

.lead-calendar__slot:disabled {
  border-color: rgba(255, 255, 255, 0.06);
  color: rgba(255, 255, 255, 0.25);
  text-decoration: line-through;
  cursor: default;
}

.lead-calendar__slot.is-selected {
  border-color: #ffdead;
  background: #ffdead;
  color: #191926;
  font-weight: 600;
}

/* Business hours */
.lead-calendar__schedule {
  margin-top: 14px;
  padding: 12px 12px 10px;
  border-radius: 12px;
  background: rgba(255, 255, 255, 0.05);
  font-size: 15px;
  line-height: 1.3;
}

.lead-calendar__tz {
  margin-bottom: 12px;
  text-align: center;
  color: rgba(255, 255, 255, 0.85);
}

.lead-calendar__hours {
  display: flex;
  align-items: center;
  gap: 8px;
  margin-top: 8px;
}

.modal__container .lead-calendar__hours span {
  display: block;
  flex-shrink: 0;
  text-align: left;
  white-space: nowrap;
  color: #FFFFFFB2;
}

.lead-calendar__hours i {
  flex: 1;
  height: 0;
  border-top: 1px dashed rgba(255, 255, 255, 0.25);
}

/* ======================= Modals: 640–959 ======================= */

@media (max-width: 959px) {
  .modal--request:has(.lead-form) .modal__container {
    max-width: 550px;
    margin: auto;
    padding: 24px;
    border-radius: 24px;
  }

  .modal--request:has(.lead-form) .modal__container .d-flex .col-60 {
    width: 100%;
  }

  .modal--request:has(.lead-form) .right {
    display: none;
  }

  .modal--request:has(.lead-form) .modal__close {
    background-color: #efeff0;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='24' height='24' fill='none'%3E%3Cpath d='M6 6l12 12M18 6 6 18' stroke='%23191926' stroke-width='1.8' stroke-linecap='round'/%3E%3C/svg%3E");
  }

}

/* ======================= Modals: 360–639, bottom sheets ======================= */

@media (max-width: 639px) {
  .modal--request:has(.lead-form) {
    top: 0;
    height: 100%;
    align-items: flex-end;
  }

  .modal--request:has(.lead-form) .modal__container {
    width: 100%;
    max-width: none;
    height: auto;
    max-height: calc(100% - 40px);
    margin: 0;
    padding: 16px 16px 24px;
    overflow-y: auto;
    border-radius: 24px 24px 0 0;
    animation-name: lead-sheet-in;
  }

  .lead-form .lead-form__title {
    padding-right: 44px; /* close button */
    font-size: 20px;
  }

  .lead-form .lead-form__row {
    flex-direction: column;
    gap: 8px;
  }

  .lead-form .contacts_box {
    margin: 32px 0;
  }

  .lead-form .lead-form__agreement {
    max-width: 300px;
  }

  .lead-form--video-tour .lead-success__close {
    margin-top: 64px;
  }

  .lead-date {
    flex-basis: auto;
  }

  /* Calendar: bottom sheet over the dimmed form */
  .lead-calendar__backdrop {
    display: block;
    position: fixed;
    inset: 0;
    z-index: 4;
    background: rgba(15, 17, 19, 0.6);
  }

  .lead-calendar {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    width: auto;
    max-height: calc(100% - 40px);
    overflow-y: auto;
    padding: 12px 16px 16px;
    border: 0;
    border-radius: 24px 24px 0 0;
    animation: lead-sheet-in 0.25s ease-out;
  }

  .lead-calendar__handle {
    display: block;
    width: 48px;
    height: 16px;
    margin: 0 auto 4px;
    padding: 0;
    border: 0;
    background: none;
    cursor: pointer;
  }

  .lead-calendar__handle::before {
    content: "";
    display: block;
    width: 48px;
    height: 4px;
    margin: 6px auto;
    border-radius: 2px;
    background: rgba(255, 255, 255, 0.3);
  }

  .lead-calendar__day {
    width: 100%;
    max-width: 48px;
    height: 44px;
  }
}
