/* Overlay */
#booking-form-overlay {
  position: fixed;
  inset: 0;
  background: rgba(0, 0, 0, 0.45);
  display: none; /* скрыт по умолчанию */
  z-index: 100000; /* поверх темы/хедера */
}

/* Modal */
#booking-form-wrapper {
  position: fixed;
  left: 50%;
  transform: translateX(-50%);
  top: 6vh;
  width: min(640px, 92vw);
  max-height: 88vh;
  overflow: auto;
  -webkit-overflow-scrolling: touch;
  overscroll-behavior: contain;
  background: #fff;
  border-radius: 10px;
  padding: 14px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.25);
  display: none; /* <-- ВАЖНО: скрываем по умолчанию */
  z-index: 100001; /* выше оверлея/хедера */
}

/* Гриды */
.bf-grid {
  display: grid;
  gap: 10px;
}
.bf-grid-2 {
  grid-template-columns: 1fr 1fr;
}
.bf-grid-3 {
  grid-template-columns: repeat(3, 1fr);
}

/* Админ-бар */
.admin-bar #booking-form-wrapper {
  max-height: calc(100vh - 80px);
}

/* Блокируем прокрутку фона когда модалка открыта */
body.booking-modal-open {
  overflow: hidden;
}

/* Нормальный размер инпутов/кнопок внутри формы (не наследуем огромные стили темы) */
#booking-form label {
  font-size: 14px;
  color: #444;
}
#booking-form input,
#booking-form button {
  width: 100%;
  box-sizing: border-box;
  font-size: 16px;
  line-height: 1.2;
  padding: 10px 14px;
  text-transform: none;
  letter-spacing: 0;
}

/* Канвас подписи */
#sig-pad,
.bf-canvas {
  width: 100%;
  height: 160px;
  border: 1px solid #000;
  border-radius: 6px;
  touch-action: none;
}

@media (max-width: 640px) {
  .bf-grid-2,
  .bf-grid-3 {
    grid-template-columns: 1fr;
  }
  #booking-form-wrapper {
    top: 2vh;
    width: 94vw;
    max-height: 96vh;
  }
}

/* ====== Модалка всегда выше плавающих кнопок темы ====== */
#booking-form-overlay {
  z-index: 2147483000;
}
#booking-form-wrapper {
  z-index: 2147483001;
  padding-bottom: max(14px, env(safe-area-inset-bottom, 14px));
}

/* ====== Нормализуем инпуты дат на iOS/Android ====== */
#booking-form input[type="date"] {
  -webkit-appearance: none;
  appearance: none;
  background: #fff;
  font-size: 16px;
  line-height: 1.2;
  padding: 12px 14px;
  text-transform: none;
  letter-spacing: 0;
}
#booking-form input[type="date"]::-webkit-date-and-time-value {
  text-align: left;
}
#booking-form input[type="date"]::-webkit-calendar-picker-indicator {
  opacity: 1;
  filter: invert(0.4);
}

#sig-pad {
  width: 100%;
  height: 180px;
  border: 1px solid #000;
  border-radius: 6px;
  touch-action: none;
  background: #fff;
}

.bf-actions {
  position: sticky;
  bottom: 0;
  background: #fff;
  padding: 10px 0;
  margin-top: 12px;
  display: flex;
  gap: 10px;
  border-top: 1px solid #eee;
  z-index: 2;
  margin-bottom: 80px;
}

@media (max-width: 480px) {
  .bf-actions {
    flex-direction: column;
    margin-bottom: 100px;
  }
}
