/* ==================== АДАПТИВ (MOBILE) ==================== */

/* --- Hide working-hours on <=1280, переместить контактные ссылки над формой --- */
@media (max-width: 1280px) {
  .contact-page .working-hours {
    display: none !important;
  }

  .contact-page .contact-info.floating-left {
    position: static;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    margin: 0 auto 25px auto;
    padding: 15px var(--page-padding-x);
    width: 100%;
    max-width: var(--page-text-max-width);
    box-shadow: 0 0 10px rgba(0,191,255,0.2);
    backdrop-filter: blur(2px);
    z-index: 100;
  }

  h1 {
    font-size: 1.6em;
    padding-top: 20px;
  }

  .contact-page .contact-info.floating-left h3 {
    text-align: center;
    margin-bottom: 10px;
  }

  .contact-page .contact-info.floating-left .contact-links-row {
    justify-content: center;
    flex-wrap: wrap;
    gap: 25px;
  }

  .contact-page .contact-info.floating-left .contact-link img {
    width: 50px;
    height: 50px;
  }

  main {
    padding: 0 var(--page-padding-x);
  }

  /* гарантируем что контейнеры не ограничивают высоту */
  .contact-page,
  .contact-page main,
  .contact-page > div {
    height: auto !important;
    min-height: auto !important;
    overflow: visible !important;
  }
}

/* --- Планшеты и маленькие десктопы --- */
@media (max-width: 1024px) {
  .contact-form {
    width: 100%;
    max-width: var(--page-text-max-width);
    margin: 0 auto;
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .contact-form button {
    width: 100%;
  }
}

/* --- Мобильные телефоны --- */
@media (max-width: 600px) {
  html, body {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: 100%;
    -webkit-text-size-adjust: 100%;
  }

  body {
    display: flex;
    flex-direction: column;
    min-height: auto;
  }

  main {
    flex: 1 0 auto;
    padding-bottom: calc(var(--cookie-banner-height, 0px) + env(safe-area-inset-bottom, 0) + 24px);
  }

  h1 {
    font-size: 1.6em;
    padding-top: 20px;
  }

  .contact-page .contact-info.floating-left {
    padding: 10px var(--page-padding-x);
    max-width: 100%;
  }

  .contact-page .contact-info.floating-left .contact-links-row {
    gap: 20px;
  }

  .contact-page .contact-info.floating-left .contact-link span {
    font-size: 0.9em;
  }

  .form-row input,
  .contact-form select,
  textarea {
    font-size: 16px !important; /* предотвращаем масштабирование iOS */
    line-height: 1.5;
    padding: 10px 12px;
    box-sizing: border-box;
    width: 100%;
    display: block;
  }

  /* ✅ Отступы между инпутами и текстовыми полями только на мобильных */
  input,
  textarea,
  select {
    margin-bottom: 1px;
  }

  /* Обертка для select с кастомной стрелкой */
  .contact-form .select-arrow-wrapper {
    position: relative;
    display: inline-block;
    width: 100%;
  }
  
  .contact-form select {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    background-image: none;
    padding-right: 30px;
    position: relative;
    width: 100%;
  }
  
  /* Кастомная стрелка через псевдоэлемент обертки */
  .contact-form .select-arrow-wrapper::after {
    content: '';
    position: absolute;
    right: 10px;
    top: 50%;
    transform: translateY(-50%);
    width: 16px;
    height: 16px;
    background-image: url("../../icons/list/arrow-down.png");
    background-size: contain;
    background-repeat: no-repeat;
    pointer-events: none;
    z-index: 10;
    transition: transform 0.2s ease;
  }
  
  /* Переворот стрелки при открытом списке */
  .contact-form .select-arrow-wrapper.select-open::after {
    transform: translateY(-50%) rotate(180deg);
  }
  
  .contact-form .select-arrow-wrapper select {
    background-image: none;
    padding-right: 30px;
    width: 100%;
  }

  textarea {
    height: 120px;
  }

  .char-counter {
    font-size: 0.75em;
  }
}

/* --- Очень маленькие экраны --- */
@media (max-width: 400px) {
  h1 {
    font-size: 1.4em;
    padding-top: 20px;
  }

  .contact-page .contact-info.floating-left .contact-link img {
    width: 40px;
    height: 40px;
  }

  .contact-page .contact-info.floating-left .contact-link span {
    font-size: 0.8em;
  }

  .form-row input,
  .contact-form select,
  textarea {
    font-size: 0.85em;
  }

  .contact-form button {
    font-size: 0.9em;
    padding: 8px 12px;
  }
}

/* ==================== Защитные мелочи и скролл ==================== */
html, body {
  overflow-y: auto !important;
  overflow-x: hidden !important;
  min-height: auto;
  height: auto !important;
}

body {
  display: flex;
  flex-direction: column;
}

main {
  flex: 1 0 auto;
  overflow: visible !important;
  padding-bottom: 40px; /* добавляем запас, чтобы кнопка не обрезалась */
}

* {
  -webkit-overflow-scrolling: touch;
  box-sizing: border-box;
}

/* ==================== Фокус и курсор ==================== */
input:focus, textarea:focus, select:focus {
  outline: none;
  border-color: var(--accent);
  box-shadow: 0 0 12px rgba(0,255,255,.4);
}

/* ==================== КАСТОМНЫЙ ЧЕКБОКС С SVG ==================== */
.form-row.privacy-policy {
  display: flex;
  align-items: center;
  gap: 6px;
  margin-top: 5px;
}

.form-row.privacy-policy input[type="checkbox"] {
  -webkit-appearance: none;
  appearance: none;
  width: 18px;
  height: 18px;
  border: 2px solid var(--accent, #00bfff);
  border-radius: 4px;
  cursor: pointer;
  position: relative;
  flex-shrink: 0;
  transition: all 0.2s ease;
  box-sizing: border-box;
  display: inline-block;
  vertical-align: middle;
}

/* SVG-галочка через background-image */
.form-row.privacy-policy input[type="checkbox"]:checked {
  background-color: var(--accent, #00bfff);
  border-color: var(--accent, #00bfff);
  background-position: center;
  background-size: 80%;
}

.form-row.privacy-policy label {
  cursor: pointer;
  user-select: none;
  font-size: 0.85em;
  line-height: 1.2;
}

/* === Мобильная версия (до 600px) — тот же чекбокс === */
@media (max-width: 600px) {
  .form-row.privacy-policy input[type="checkbox"] {
    width: 18px !important;
    height: 18px !important;
    border-width: 2px;
    background-size: 80%;
  }
}
