/* =========================================================
   asatoma-par.ru · yclients-modal.css
   ─────────────────────────────────────────────────────────
   Модалка онлайн-записи YClients (форма в <iframe> на сайте).
   Язык booking-modal.css: жемчужная карточка, сапфировый скрим
   с блюром; десктоп — центр, мобайл — bottom-sheet. Токены --aa-*.
   ========================================================= */

/* <dialog> в top-layer: растягиваем на весь вьюпорт, центрируем карточку */
.yc-modal {
  position: fixed;
  inset: 0;
  width: 100vw;
  height: 100vh;
  height: 100dvh;
  max-width: 100vw;
  max-height: 100vh;
  max-height: 100dvh;
  margin: 0;
  padding: 0;
  border: none;
  background: transparent;
  overflow: hidden;
}
.yc-modal[open] {
  display: flex;
  align-items: center;
  justify-content: center;
}
.yc-modal::backdrop {
  background: rgba(15, 30, 55, 0.48);
  -webkit-backdrop-filter: blur(8px);
  backdrop-filter: blur(8px);
  opacity: 0;
  transition: opacity 280ms ease;
}
.yc-modal.is-open::backdrop { opacity: 1; }

/* ─── Карточка ─── */
.yc-modal__panel {
  position: relative;
  display: flex;
  flex-direction: column;
  width: min(480px, calc(100vw - 40px));
  height: min(88vh, 820px);
  height: min(88dvh, 820px);
  background: var(--aa-pearl, #EFE7DA);
  border-radius: 18px;
  overflow: hidden;
  box-shadow: 0 32px 96px -32px rgba(15, 30, 55, 0.42);
  opacity: 0;
  transform: translateY(14px) scale(0.985);
  transition: opacity 320ms var(--aa-ease-out, cubic-bezier(0.16, 1, 0.3, 1)),
              transform 320ms var(--aa-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
}
.yc-modal.is-open .yc-modal__panel { opacity: 1; transform: none; }

/* ─── Шапка ─── */
.yc-modal__head {
  flex: none;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 12px;
  padding: 13px 12px 12px 20px;
  border-bottom: 1px solid var(--aa-hairline, rgba(43, 38, 32, 0.10));
  background: var(--aa-pearl, #EFE7DA);
}
.yc-modal__eyebrow {
  font-family: var(--aa-font-body, 'Manrope', sans-serif);
  font-size: 12px;
  font-weight: 600;
  letter-spacing: 0.16em;
  text-transform: uppercase;
  color: var(--aa-sapphire, #1E4A8C);
}
.yc-modal__close {
  flex: none;
  width: 38px; height: 38px;
  border: none;
  background: transparent;
  color: var(--aa-anthracite, #2B2620);
  border-radius: 10px;
  cursor: pointer;
  display: flex; align-items: center; justify-content: center;
  transition: background 180ms ease;
}
.yc-modal__close:hover { background: var(--aa-pearl-deep, #E5DBCB); }

/* ─── Тело: iframe + оверлей загрузки ─── */
.yc-modal__body {
  position: relative;
  flex: 1 1 auto;
  min-height: 0;
  background: #FFFFFF;
}
.yc-modal__frame {
  display: block;
  width: 100%;
  height: 100%;
  border: 0;
}
.yc-modal__loading {
  position: absolute;
  inset: 0;
  display: none;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 14px;
  padding: 28px;
  text-align: center;
  background: var(--aa-pearl, #EFE7DA);
  z-index: 2;
}
.yc-modal__loading.is-on { display: flex; }
.yc-modal__spinner {
  width: 30px; height: 30px;
  border-radius: 50%;
  border: 3px solid rgba(30, 74, 140, 0.18);
  border-top-color: var(--aa-sapphire, #1E4A8C);
  animation: yc-spin 720ms linear infinite;
}
@keyframes yc-spin { to { transform: rotate(360deg); } }
.yc-modal__loading-txt {
  font-family: var(--aa-font-body, 'Manrope', sans-serif);
  font-size: 14px;
  color: var(--aa-ink-mute, #4A4A47);
}
/* фолбэк-состояние (долго грузится) */
.yc-modal__fail { display: none; }
.yc-modal__loading.is-fail .yc-modal__spinner,
.yc-modal__loading.is-fail .yc-modal__loading-txt { display: none; }
.yc-modal__loading.is-fail .yc-modal__fail { display: block; }
.yc-modal__fail p {
  font-family: var(--aa-font-body, 'Manrope', sans-serif);
  font-size: 14px;
  color: var(--aa-ink-mute, #4A4A47);
  margin: 0 0 14px;
}
.yc-modal__failbtn {
  display: inline-flex; align-items: center; gap: 8px;
  padding: 13px 22px;
  border-radius: 12px;
  background: var(--aa-sapphire, #1E4A8C);
  color: #FFFFFF;
  text-decoration: none;
  font-family: var(--aa-font-body, 'Manrope', sans-serif);
  font-size: 14px; font-weight: 600;
  transition: background 180ms ease;
}
.yc-modal__failbtn:hover { background: var(--aa-sapphire-deep, #163866); }

/* ─── Подвал: тихая ссылка-эвакуация «в новом окне» ─── */
.yc-modal__foot {
  flex: none;
  padding: 10px 20px 12px;
  text-align: center;
  border-top: 1px solid var(--aa-hairline, rgba(43, 38, 32, 0.08));
  background: var(--aa-pearl, #EFE7DA);
}
.yc-modal__newwin {
  display: inline-flex; align-items: center; gap: 6px;
  font-family: var(--aa-font-body, 'Manrope', sans-serif);
  font-size: 12.5px;
  color: var(--aa-ink-soft, #6E675C);
  text-decoration: none;
  transition: color 160ms ease;
}
.yc-modal__newwin:hover { color: var(--aa-sapphire, #1E4A8C); }
.yc-modal__newwin svg { opacity: 0.7; }

/* блокируем скролл фона под модалкой */
html.yc-modal-open, html.yc-modal-open body { overflow: hidden; }

/* ─── Мобайл: bottom-sheet ─── */
@media (max-width: 767px) {
  .yc-modal[open] { align-items: flex-end; }
  .yc-modal__panel {
    width: 100vw;
    height: 94vh;
    height: 94dvh;
    border-radius: 20px 20px 0 0;
    transform: translateY(100%);
    transition: transform 340ms var(--aa-ease-out, cubic-bezier(0.16, 1, 0.3, 1));
  }
  .yc-modal.is-open .yc-modal__panel { transform: translateY(0); }
  /* грабер-полоска сверху sheet */
  .yc-modal__head { padding-top: 16px; }
  .yc-modal__head::before {
    content: '';
    position: absolute;
    top: 7px; left: 50%;
    width: 40px; height: 4px;
    margin-left: -20px;
    border-radius: 2px;
    background: var(--aa-hairline-strong, rgba(43, 38, 32, 0.18));
  }
}

@media (prefers-reduced-motion: reduce) {
  .yc-modal::backdrop,
  .yc-modal__panel { transition: none; }
  .yc-modal__panel { transform: none; }
}
