/* ===========================================================
   Запись на приём из карточки врача (default-doctor.php).
   Копия вида модалки нового дизайна (cassiopeia_v2/css/modal.css),
   но самодостаточная: карточка врача живёт в старом шаблоне и в
   ml=1-айфрейме, где нет CSS-переменных нового дизайна. Классы с
   префиксом dappt-, чтобы не пересекаться со стилями старого сайта
   и RL Modals (.modal, .btn заняты).
   =========================================================== */

/* Кнопка "Записаться" в конце анкеты врача */
.dappt {
  margin-top: 22px;
}

.dappt-open {
  display: inline-block;
  padding: 13px 44px;
  background: #244c8a;
  color: #ffffff;
  font-family: Avenir, Helvetica, Arial, sans-serif;
  font-size: 16px;
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.dappt-open:hover {
  background: #1a3666;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(36, 76, 138, 0.3);
}

/* ─── Модалка ─── */
.dappt-modal {
  position: fixed;
  inset: 0;
  z-index: 100000;
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity 300ms cubic-bezier(0.4, 0, 0.2, 1);
  font-family: Avenir, Helvetica, Arial, sans-serif;
}

.dappt-modal--open {
  pointer-events: auto;
  opacity: 1;
}

.dappt-modal__overlay {
  position: absolute;
  inset: 0;
  background: rgba(36, 47, 57, 0.6);
  backdrop-filter: blur(8px);
  -webkit-backdrop-filter: blur(8px);
}

.dappt-modal__content {
  position: relative;
  width: 100%;
  max-width: 860px;
  background: #ffffff;
  border-radius: 24px 24px 0 0;
  padding: 40px 40px 32px;
  transform: translateY(100%);
  transition: transform 500ms cubic-bezier(0.34, 1.56, 0.64, 1);
  max-height: 90vh;
  overflow-y: auto;
  box-sizing: border-box;
  text-align: left;
}

.dappt-modal--open .dappt-modal__content {
  transform: translateY(0);
}

.dappt-modal__content * {
  box-sizing: border-box;
}

.dappt-modal__close {
  position: absolute;
  top: 20px;
  right: 20px;
  width: 40px;
  height: 40px;
  border: none;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: #8b91a0;
  background: #f6f7fb;
  cursor: pointer;
  transition: all 150ms ease;
}

.dappt-modal__close:hover {
  background: #404757;
  color: #ffffff;
  transform: rotate(90deg);
}

.dappt-modal__close svg {
  width: 20px;
  height: 20px;
  display: block;
}

.dappt-modal__header {
  margin-bottom: 24px;
}

.dappt-modal__service-label {
  display: inline-block;
  padding: 4px 14px;
  background: #244c8a;
  color: #ffffff;
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: 9999px;
  margin-bottom: 12px;
}

.dappt-modal__title {
  font-weight: 700;
  font-size: 24px;
  color: #404757;
  margin: 0;
  padding: 0;
  border: none;
}

.dappt-modal__subtitle {
  font-size: 13px;
  color: #8b91a0;
  margin: 4px 0 0;
}

/* ─── Телефоны ─── */
.dappt-modal__phones {
  display: flex;
  flex-wrap: wrap;
  gap: 24px;
  margin-bottom: 24px;
  padding: 16px 20px;
  background: #f6f7fb;
  border-radius: 10px;
}

.dappt-modal__phone-item {
  display: flex;
  align-items: center;
  gap: 12px;
}

.dappt-modal__phone-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: #e6f6fb;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
}

.dappt-modal__phone-icon svg {
  width: 14px;
  height: 14px;
  color: #148ba8;
  display: block;
}

.dappt-modal__phone-label {
  font-size: 12px;
  color: #8b91a0;
}

.dappt-modal__phone-number {
  font-weight: 700;
  font-size: 16px;
  color: #404757 !important;
  text-decoration: none;
}

/* ─── Форма ─── */
.dappt-modal__form {
  display: flex;
  flex-direction: column;
  gap: 20px;
  margin: 0;
}

.dappt-form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 16px;
}

.dappt-form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.dappt-form-label {
  font-size: 12px;
  font-weight: 500;
  color: #5d6478;
  margin: 0;
}

.dappt-form-input {
  height: 48px;
  padding: 0 16px;
  background: #ffffff;
  border: 1.5px solid #e2e4ed;
  border-radius: 6px;
  font-family: inherit;
  font-size: 15px;
  color: #404757;
  outline: none;
  transition: border-color 150ms ease, box-shadow 150ms ease;
  width: 100%;
}

.dappt-form-input::placeholder {
  color: #8b91a0;
  font-size: 13px;
}

.dappt-form-input:focus {
  border-color: #1aacd1;
  box-shadow: 0 0 0 3px rgba(26, 172, 209, 0.1);
}

/* Поле "Врач" заполнено автоматически, только чтение */
.dappt-form-input--doctor {
  background: #f6f7fb;
  font-weight: 600;
  cursor: default;
}

.dappt-form-textarea {
  min-height: 80px;
  height: auto;
  padding: 12px 16px;
  resize: vertical;
  line-height: 1.5;
}

/* ─── Чекбокс согласия ─── */
.dappt-checkbox {
  display: flex;
  align-items: center;
  gap: 12px;
  cursor: pointer;
  margin: 0;
}

.dappt-checkbox input {
  display: none;
}

.dappt-checkbox__box {
  width: 20px;
  height: 20px;
  border: 1.5px solid #e2e4ed;
  border-radius: 4px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all 150ms ease;
}

.dappt-checkbox input:checked + .dappt-checkbox__box {
  background: #1aacd1;
  border-color: #1aacd1;
}

.dappt-checkbox input:checked + .dappt-checkbox__box svg {
  opacity: 1;
}

.dappt-checkbox__box svg {
  width: 12px;
  height: 12px;
  color: #ffffff;
  opacity: 0;
  transition: opacity 150ms ease;
  display: block;
}

.dappt-checkbox__text {
  font-size: 13px;
  color: #5d6478;
}

/* ─── Низ формы ─── */
.dappt-modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  margin-top: 8px;
  flex-wrap: wrap;
}

.dappt-submit {
  padding: 14px 36px;
  background: #f6107d;
  color: #ffffff;
  font-family: inherit;
  font-size: 15px;
  font-weight: 600;
  line-height: 1;
  border: none;
  border-radius: 9999px;
  cursor: pointer;
  transition: background 150ms ease, transform 150ms ease, box-shadow 150ms ease;
}

.dappt-submit:hover {
  background: #c40d64;
  transform: translateY(-1px);
  box-shadow: 0 6px 16px rgba(246, 16, 125, 0.3);
}

/* ─── Мобильные ─── */
@media (max-width: 720px) {
  .dappt-modal__content {
    padding: 28px 20px 24px;
    border-radius: 16px 16px 0 0;
  }

  .dappt-form-row {
    grid-template-columns: 1fr;
  }

  .dappt-modal__phones {
    flex-direction: column;
    gap: 12px;
  }

  .dappt-modal__footer {
    flex-direction: column;
    align-items: stretch;
  }

  .dappt-submit {
    width: 100%;
  }
}

/* Ловушка для ботов - человеку не видна и не таббится */
.dappt-hp {
    position: absolute;
    left: -9999px;
    width: 1px;
    height: 1px;
    overflow: hidden;
}

/* Статус отправки заявки */
.dappt-form-status {
    margin: 0 0 10px;
    font-size: 14px;
    line-height: 1.4;
    min-height: 1.2em;
    color: #404757;
}
.dappt-form-status--ok { color: #1a7f4b; font-weight: 600; }
.dappt-form-status--error { color: #c62828; font-weight: 600; }

/* ── Лекало телефона (см. js/phone-mask.js) ── */
.phone-mask { position: relative; display: block; }
.phone-mask__ghost {
    position: absolute;
    inset: 0;
    z-index: 2;
    display: flex;
    align-items: center;
    padding: 0 16px;
    font-family: inherit;
    font-size: 15px;
    white-space: pre;
    pointer-events: none;
    color: #9aa3b5;
}
.phone-mask__typed { visibility: hidden; }
