/* Simple modal and backdrop blur */
.modal {
  position: fixed;
  inset: 0;
  display: none;
  align-items: center;
  justify-content: center;
  z-index: 1000;
  padding: env(safe-area-inset-top, 0) env(safe-area-inset-right, 0) env(safe-area-inset-bottom, 0) env(safe-area-inset-left, 0);
}
.modal.is-open {
  display: flex;
  animation: modalFadeIn 0.3s ease;
}

@keyframes modalFadeIn {
  from {
    opacity: 0;
  }
  to {
    opacity: 1;
  }
}
.modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(0, 0, 0, 0.6); /* затемнение без блюра */
}
.modal__dialog {
  position: relative;
  background: #fff;
  border-radius: 24px;
  box-shadow: 0 20px 80px rgba(0,0,0,.25);
  max-width: 980px;
  width: calc(100% - 32px);
  overflow: hidden;
  animation: modalSlideIn 0.3s ease;
  max-height: 90vh;
}

@keyframes modalSlideIn {
  from {
    transform: translateY(-20px);
    opacity: 0;
  }
  to {
    transform: translateY(0);
    opacity: 1;
  }
}

.modal__dialog--request {
  padding: 30px;
  background-color: #f4f6fa;
  overflow-y: auto;
  -webkit-overflow-scrolling: touch; /* Smooth scrolling on iOS */
}
.modal__content {
  display: flex;
    width: 100%;
    justify-content: center;
  gap: 16px;
  padding: 0px;
  background-color: #f4f6fa;
}

.modal--video {
    padding: 40px;
}

.modal__content video {
    width: 100%;
}
.modal__left {
  display: flex;
  align-items: center;
  justify-content: center;
  background: #F4F6FA;
}
.modal__illustration { max-width: 95%; height: 100%; width: 100%; object-fit: contain; }
.modal__right { display: flex; flex-direction: column; gap: 16px; }
.modal__title { font-size: 24px; margin: 12px 0 8px; font-weight: 600; }
.modal__card { box-shadow: none; background: transparent; padding: 0; }
.modal__close {
  position: absolute;
  top: 12px;
  right: 12px;
  background: transparent;
  border: 0;
  padding: 8px;
  cursor: pointer;
  z-index: 10;
  transition: transform 0.2s ease, opacity 0.2s ease;
  border-radius: 50%;
}

.modal__close:hover {
  transform: scale(1.1);
  background: rgba(0, 0, 0, 0.05);
}

.modal__close:active {
  transform: scale(0.95);
}
.modal__dialog--video { background: #000; max-width: 95vw; max-height: 100%; }
.modal__close-icon { display: block; }
.modal__close:hover .modal__close-icon path { stroke: #1B2838; }

/* Визуал полей и кнопки внутри модалки */
.modal__card .contacts__fields { gap: 14px; }
.modal__card .contacts__field .contacts__input {
  height: 56px;
  border-radius: 28px;
  background: #F7FBFF;
  border: 1px solid #E6EEF7;
  padding: 0 20px 0 20px;
  font-size: 16px;
}

.modal__content--video { display: block; padding: 0; }
.modal__video { display: block; width: 100%; height: auto; max-height: 80vh; }

.modal__card .contacts__phone .contacts__input {
  padding-left: 56px; /* место под флаг intl-tel-input */
}
.modal__card .contacts__submit {
  height: 64px;
  border-radius: 40px;
  background: #2DBE6C; /* ближе к button--primary */
  color: #fff;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 12px;
  font-weight: 700;
  text-transform: uppercase;
  letter-spacing: .02em;
  box-shadow: 0 12px 28px rgba(45, 190, 108, 0.4);
  transition: transform .08s ease, box-shadow .2s ease, background .2s ease;
}
.modal__card .contacts__submit:hover { transform: translateY(-1px); }
.modal__card .contacts__submit:active { transform: translateY(0); box-shadow: 0 6px 16px rgba(39, 174, 96, 0.35); }
.modal__card .contacts__agree { color: #9AA6B2; font-size: 12px; line-height: 1.3; }

/* Подгонка intl-tel-input высоты под дизайн */
.modal__card .iti { width: 100%; }
.modal__card .iti .iti__selected-country { height: 56px; border-top-left-radius: 28px; border-bottom-left-radius: 28px; }
.modal__card .iti input[type=tel] { height: 56px; border-radius: 28px; }

.requestModalTitle {
    font-size: 20px;
    font-weight: normal;
}

.modal--request .modal__right {
    width: 50%;
}

/* ========================================
   RESPONSIVE STYLES
   ======================================== */

/* Large Desktop (1400px+) - Optimal viewing */
@media (min-width: 1400px) {
  .modal__dialog {
    max-width: 60vw;
  }
  
  .modal__title {
    font-size: 1.3vw;
  }

  .modal__card .contacts__field .contacts__input, .modal__card .iti input[type=tel] {
    height: 10vh;
    font-size: 1vw;
  }

  .modal__content {
    justify-content: space-around;
  }

  .modal__left {
    width: 20vw;
  }

  .modal__card .iti .iti__selected-country {
    height: 10vh;
  }

  .modal__close {
    font-size: 0.8vw;
  }

  .modal__card .contacts__agree {
    font-size: 1vw;
  }

  .reviews__arrow {
    width: 5vw;
    height: 5vw;
    border-radius: 5vw;
  }

}

/* Desktop (1024px - 1399px) - Standard */
@media (max-width: 1399px) {
  .modal__dialog {
    max-width: 960px;
  }
}

/* Tablet Landscape (768px - 1023px) */
@media (max-width: 1023px) {
  .modal__dialog {
    max-width: 720px;
    width: calc(100% - 40px);
  }
  
  .modal__content {
    gap: 20px;
  }
  
  .modal__left {
    max-width: 300px;
  }
  
  .modal__title {
    font-size: 20px;
    line-height: 1.4;
  }
  
  .modal--request .modal__right {
    width: 55%;
  }
}

/* Tablet Portrait (640px - 767px) */
@media (max-width: 767px) {
  .modal__dialog {
    max-width: 90%;
    width: calc(100% - 32px);
    border-radius: 20px;
  }
  
  .modal__dialog--request {
    padding: 24px;
  }
  
  .modal__content {
    flex-direction: column;
    padding: 24px;
    gap: 24px;
  }
  
  .modal__left {
    display: none; /* Скрываем иллюстрацию на планшетах */
  }
  
  .modal--request .modal__right {
    width: 100%;
  }
  
  .modal__title {
    font-size: 20px;
    margin: 0 0 12px;
    line-height: 1.4;
  }
  
  .modal__title br {
    display: none; /* Убираем перенос строки */
  }
  
  .modal__close {
    top: 16px;
    right: 16px;
  }
  
  .modal__card .contacts__fields {
    gap: 16px;
  }
  
  .modal__card .contacts__field .contacts__input {
    height: 52px;
    font-size: 16px;
  }
  
  .modal__card .contacts__submit {
    height: 56px;
    font-size: 14px;
  }
  
  .modal__card .iti .iti__selected-country {
    height: 52px;
  }
  
  .modal__card .iti input[type=tel] {
    height: 52px;
  }
}

/* Mobile Large (480px - 639px) */
@media (max-width: 639px) {
  .modal__dialog {
    width: calc(100% - 24px);
    border-radius: 16px;
  }
  
  .modal__dialog--request {
    padding: 20px;
  }
  
  .modal__content {
    padding: 20px;
    gap: 20px;
  }
  
  .modal__title {
    font-size: 18px;
    margin: 0 0 16px;
  }
  
  .modal__close {
    top: 12px;
    right: 12px;
    padding: 6px;
  }
  
  .modal__close-icon {
    width: 20px;
    height: 20px;
  }
}

/* Mobile Small (320px - 479px) */
@media (max-width: 479px) {
  .modal__dialog {
    width: calc(100% - 16px);
    border-radius: 12px;
    max-height: 95vh;
    overflow-y: auto;
  }
  
  .modal__dialog--request {
    padding: 16px;
  }
  
  .modal__content {
    padding: 16px;
    gap: 16px;
  }
  
  .modal__title {
    font-size: 16px;
    line-height: 1.35;
    margin: 0 0 12px;
  }
  
  .modal__card .contacts__fields {
    gap: 12px;
  }
  
  .modal__card .contacts__field .contacts__input {
    height: 48px;
    border-radius: 24px;
    padding: 0 16px;
    font-size: 14px;
  }
  
  .modal__card .contacts__phone .contacts__input {
    padding-left: 52px;
  }
  
  .modal__card .contacts__submit {
    height: 52px;
    border-radius: 26px;
    font-size: 13px;
    gap: 8px;
    margin: 0 auto;
  }
  
  .modal__card .contacts__submit img {
    width: 18px;
    height: 18px;
  }
  
  .modal__card .contacts__agree {
    font-size: 11px;
    line-height: 1.4;
  }
  
  .modal__card .iti .iti__selected-country {
    height: 48px;
    border-top-left-radius: 24px;
    border-bottom-left-radius: 24px;
  }
  
  .modal__card .iti input[type=tel] {
    height: 48px;
    border-radius: 24px;
  }
  
  .modal__close {
    top: 8px;
    right: 8px;
    padding: 4px;
  }
  
  .modal__close-icon {
    width: 18px;
    height: 18px;
  }
}

/* Extra Small Mobile (< 360px) */
@media (max-width: 359px) {
  .modal__dialog {
    width: calc(100% - 8px);
    max-height: 98vh;
  }
  
  .modal__dialog--request {
    padding: 12px;
  }
  
  .modal__content {
    padding: 12px;
  }
  
  .modal__title {
    font-size: 15px;
  }
  
  .modal__card .contacts__field .contacts__input {
    height: 44px;
    font-size: 13px;
    padding: 0 14px;
  }
  
  .modal__card .contacts__submit {
    height: 48px;
    font-size: 12px;
  }
}

/* ========================================
   LANDSCAPE ORIENTATION OPTIMIZATIONS
   ======================================== */

/* Mobile Landscape */
@media (max-height: 600px) and (orientation: landscape) {
  .modal__dialog {
    max-height: 98vh;
    overflow-y: auto;
  }
  
  .modal__dialog--request {
    padding: 16px 24px;
  }
  
  .modal__content {
    padding: 12px;
    gap: 12px;
  }
  
  .modal__title {
    font-size: 16px;
    margin: 0 0 8px;
  }
  
  .modal__title br {
    display: none;
  }
  
  .modal__card .contacts__fields {
    gap: 10px;
  }
  
  .modal__card .contacts__field .contacts__input {
    height: 44px;
    font-size: 14px;
  }
  
  .modal__card .contacts__submit {
    height: 48px;
  }
  
  .modal__card .contacts__agree {
    font-size: 11px;
    margin-top: -4px;
  }
  
  .modal__card .iti .iti__selected-country {
    height: 44px;
  }
  
  .modal__card .iti input[type=tel] {
    height: 44px;
  }
}

/* ========================================
   ACCESSIBILITY & FOCUS STATES
   ======================================== */

/* Focus visible для keyboard navigation */
.modal__close:focus-visible {
  outline: 2px solid #5A9AF0;
  outline-offset: 2px;
}

.modal__card .contacts__input:focus {
  border-color: #5A9AF0;
  box-shadow: 0 0 0 3px rgba(90, 154, 240, 0.1);
}

/* Touch target optimization для мобильных */
@media (hover: none) and (pointer: coarse) {
  .modal__close {
    min-width: 44px;
    min-height: 44px;
    display: flex;
    align-items: center;
    justify-content: center;
  }
  
  .modal__card .contacts__submit {
    min-height: 52px;
    touch-action: manipulation;
  }
}
