/* ===========================================
   MODAL — Форма записи на приём
   =========================================== */

.modal {
  position: fixed;
  inset: 0;
  z-index: var(--z-modal);
  display: flex;
  align-items: flex-end;
  justify-content: center;
  pointer-events: none;
  opacity: 0;
  transition: opacity var(--t-base) var(--ease-smooth);
}

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

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

.modal__content {
  position: relative;
  width: 100%;
  max-width: 860px;
  background: var(--white);
  border-radius: var(--radius-xl) var(--radius-xl) 0 0;
  padding: var(--sp-10) var(--sp-10) var(--sp-8);
  transform: translateY(100%);
  transition: transform var(--t-slow) var(--ease-spring);
  max-height: 90vh;
  overflow-y: auto;
}

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

/* ─── Close Button ─── */
.modal__close {
  position: absolute;
  top: var(--sp-5);
  right: var(--sp-5);
  width: 40px;
  height: 40px;
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--slate-pale);
  transition: all var(--t-fast);
  background: var(--bg-section);
}

.modal__close:hover {
  background: var(--slate);
  color: var(--white);
  transform: rotate(90deg);
}

.modal__close svg {
  width: 20px;
  height: 20px;
}

/* ─── Modal Header ─── */
.modal__header {
  margin-bottom: var(--sp-6);
}

.modal__service-label {
  display: inline-block;
  padding: 4px 14px;
  background: var(--mode-primary);
  color: var(--white);
  font-size: 11px;
  font-weight: 700;
  letter-spacing: 0.1em;
  text-transform: uppercase;
  border-radius: var(--radius-pill);
  margin-bottom: var(--sp-3);
  transition: background var(--t-base);
}

.modal__title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-2xl);
  color: var(--slate);
}

.modal__subtitle {
  font-size: var(--text-sm);
  color: var(--slate-pale);
  margin-top: var(--sp-1);
}

/* ─── Phone row in modal ─── */
.modal__phones {
  display: flex;
  gap: var(--sp-6);
  margin-bottom: var(--sp-6);
  padding: var(--sp-4) var(--sp-5);
  background: var(--bg-section);
  border-radius: var(--radius-md);
}

.modal__phone-item {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
}

.modal__phone-icon {
  width: 32px;
  height: 32px;
  border-radius: 50%;
  background: var(--cyan-pale);
  display: flex;
  align-items: center;
  justify-content: center;
}

.modal__phone-icon svg {
  width: 14px;
  height: 14px;
  color: var(--cyan-dark);
}

.modal__phone-label {
  font-size: var(--text-xs);
  color: var(--slate-pale);
}

.modal__phone-number {
  font-weight: 700;
  font-size: var(--text-md);
  color: var(--slate);
}

/* ─── Form ─── */
.modal__form {
  display: flex;
  flex-direction: column;
  gap: var(--sp-5);
}

.form-row {
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: var(--sp-4);
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: var(--sp-1);
}

.form-group--full {
  grid-column: 1 / -1;
}

.form-label {
  font-size: var(--text-xs);
  font-weight: 500;
  color: var(--slate-light);
}

.form-input {
  height: 48px;
  padding: 0 var(--sp-4);
  background: var(--white);
  border: 1.5px solid var(--border);
  border-radius: var(--radius-sm);
  font-size: var(--text-base);
  color: var(--slate);
  transition: all var(--t-fast) var(--ease-out);
}

.form-input::placeholder {
  color: var(--slate-pale);
  font-size: var(--text-sm);
}

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

.form-textarea {
  min-height: 80px;
  padding: var(--sp-3) var(--sp-4);
  resize: vertical;
  line-height: 1.5;
}

/* ─── Checkbox ─── */
.form-checkbox {
  display: flex;
  align-items: center;
  gap: var(--sp-3);
  cursor: pointer;
}

.form-checkbox input {
  display: none;
}

.form-checkbox__box {
  width: 20px;
  height: 20px;
  border: 1.5px solid var(--border);
  border-radius: var(--radius-xs);
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  transition: all var(--t-fast);
}

.form-checkbox input:checked + .form-checkbox__box {
  background: var(--cyan);
  border-color: var(--cyan);
}

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

.form-checkbox__box svg {
  width: 12px;
  height: 12px;
  color: var(--white);
  opacity: 0;
  transition: opacity var(--t-fast);
}

.form-checkbox__text {
  font-size: var(--text-sm);
  color: var(--slate-light);
}

/* ─── Form footer ─── */
.modal__footer {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-top: var(--sp-2);
}

/* ─── Cabinet message (for ДМС/Платно) ─── */
.modal__cabinet {
  text-align: center;
  padding: var(--sp-10) var(--sp-6);
}

.modal__cabinet-icon {
  width: 64px;
  height: 64px;
  border-radius: 50%;
  background: var(--cyan-pale);
  display: flex;
  align-items: center;
  justify-content: center;
  margin: 0 auto var(--sp-5);
}

.modal__cabinet-icon svg {
  width: 28px;
  height: 28px;
  color: var(--cyan);
}

.modal__cabinet-title {
  font-family: var(--font-heading);
  font-weight: 700;
  font-size: var(--text-xl);
  color: var(--slate);
  margin-bottom: var(--sp-2);
}

.modal__cabinet-text {
  font-size: var(--text-base);
  color: var(--slate-pale);
  margin-bottom: var(--sp-6);
}

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

/* Статус отправки заявки */
.modal__form-status {
  margin: 0 0 var(--sp-2);
  font-size: var(--text-sm);
  line-height: 1.4;
  min-height: 1.2em;
  color: var(--slate);
}
.modal__form-status--ok { color: #1a7f4b; font-weight: 600; }
.modal__form-status--error { color: #c62828; font-weight: 600; }

/* ── Лекало телефона ──
   Подсказка лежит поверх поля, но набранная часть в ней невидима
   (visibility:hidden) - видно только серый «хвост» лекала после курсора.
   Само поле остаётся обычным input, ввод ничем не ограничен. */
.phone-mask { position: relative; display: block; }
.phone-mask__ghost {
  position: absolute;
  inset: 0;
  z-index: 2;
  display: flex;
  align-items: center;
  padding: 0 var(--sp-4);
  font-family: inherit;
  font-size: var(--text-base);
  white-space: pre;
  pointer-events: none;
  color: var(--slate-pale);
}
.phone-mask__typed { visibility: hidden; }
