/* ============================================================
 * Profmed forms — собственный слой стилей для форм заявок.
 * Не ломает базовый CSS клиники, использует префикс .pm-form.
 * ============================================================ */

.pm-form {
    --pm-accent: #1e87fa;
    --pm-accent-dark: #1a75d9;
    --pm-text: #102e5d;
    --pm-text-muted: #6b7a91;
    --pm-border: #d9e2ee;
    --pm-border-focus: #1e87fa;
    --pm-bg: #fff;
    --pm-bg-soft: #f3f7fd;
    --pm-error: #d92c2c;
    --pm-success: #1aa260;
    --pm-radius: 12px;
    --pm-radius-input: 10px;
    --pm-font: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;

    font-family: var(--pm-font);
    color: var(--pm-text);
    box-sizing: border-box;
    width: 100%;
    max-width: 480px;
}
.pm-form *,
.pm-form *::before,
.pm-form *::after { box-sizing: inherit; }

/* honeypot — невидимый антиспам-инпут */
.pm-form__hp {
    position: absolute !important;
    left: -10000px !important;
    width: 1px; height: 1px;
    overflow: hidden;
}

/* ---------- Заголовок ---------- */
.pm-form__head {
    margin-bottom: 18px;
}
.pm-form__title {
    margin: 0 0 6px;
    font-size: clamp(20px, 2.2vw, 26px);
    font-weight: 700;
    line-height: 1.25;
    color: var(--pm-text);
}
.pm-form__subtitle {
    margin: 0;
    font-size: 15px;
    line-height: 1.5;
    color: var(--pm-text-muted);
}

/* ---------- Поле ---------- */
.pm-field {
    position: relative;
    margin-bottom: 14px;
}
.pm-field__label {
    display: block;
    margin-bottom: 6px;
    font-size: 13px;
    font-weight: 500;
    line-height: 1.3;
    color: var(--pm-text-muted);
}
.pm-field__optional {
    color: var(--pm-text-muted);
    font-weight: 400;
}
.pm-field__input {
    display: block;
    width: 100%;
    min-height: 48px;            /* доступный tap-target */
    padding: 12px 14px;
    font-family: inherit;
    font-size: 16px;             /* 16px — iOS не зумит при фокусе */
    line-height: 1.4;
    color: var(--pm-text);
    background: var(--pm-bg);
    border: 1.5px solid var(--pm-border);
    border-radius: var(--pm-radius-input);
    transition: border-color .15s ease, box-shadow .15s ease, background-color .15s ease;
    -webkit-appearance: none;
    appearance: none;
}
.pm-field__input::placeholder {
    color: #a8b3c4;
}
.pm-field__input:hover:not(:focus):not([disabled]) {
    border-color: #b7c5dc;
}
.pm-field__input:focus {
    outline: none;
    border-color: var(--pm-border-focus);
    box-shadow: 0 0 0 3px rgba(30, 135, 250, .18);
}
.pm-field__input--textarea {
    min-height: 120px;
    resize: vertical;
}

/* состояния */
.pm-field.is-invalid .pm-field__input {
    border-color: var(--pm-error);
    background: #fef5f5;
}
.pm-field.is-invalid .pm-field__input:focus {
    box-shadow: 0 0 0 3px rgba(217, 44, 44, .15);
}
.pm-field.is-valid .pm-field__input {
    border-color: #b6dabd;
}

.pm-field__error {
    margin: 6px 0 0;
    min-height: 1em;
    font-size: 13px;
    line-height: 1.35;
    color: var(--pm-error);
}
.pm-field__error:empty {
    margin: 0;
    min-height: 0;
}

/* ---------- Сабмит ---------- */
.pm-form__submit {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 10px;
    width: 100%;
    min-height: 52px;
    padding: 14px 24px;
    margin-top: 4px;
    font-family: inherit;
    font-size: 16px;
    font-weight: 700;
    color: #fff;
    background: var(--pm-accent);
    border: none;
    border-radius: var(--pm-radius-input);
    cursor: pointer;
    transition: background-color .15s ease, transform .1s ease, box-shadow .15s ease;
    box-shadow: 0 4px 14px rgba(30, 135, 250, .25);
}
.pm-form__submit:hover:not(:disabled) {
    background: var(--pm-accent-dark);
}
.pm-form__submit:active:not(:disabled) {
    transform: translateY(1px);
    box-shadow: 0 2px 8px rgba(30, 135, 250, .25);
}
.pm-form__submit:focus-visible {
    outline: 3px solid #ffd54a;
    outline-offset: 2px;
}
.pm-form__submit:disabled {
    opacity: .7;
    cursor: not-allowed;
}

.pm-form__submit-loader {
    display: none;
    width: 18px; height: 18px;
    border: 2.5px solid rgba(255,255,255,.45);
    border-top-color: #fff;
    border-radius: 50%;
    animation: pm-spin .8s linear infinite;
}
@keyframes pm-spin { to { transform: rotate(360deg); } }

.pm-form.is-loading .pm-form__submit-loader { display: inline-block; }
.pm-form.is-loading .pm-form__submit-text   { opacity: .85; }

/* ---------- Политика ---------- */
.pm-form__policy {
    margin: 12px 0 0;
    font-size: 12.5px;
    line-height: 1.45;
    color: var(--pm-text-muted);
    text-align: center;
}
.pm-form__policy a {
    color: var(--pm-accent);
    text-decoration: underline;
    text-underline-offset: 2px;
}
.pm-form__policy a:hover { color: var(--pm-accent-dark); }

/* ---------- Успех ---------- */
.pm-form__success {
    display: none;
    padding: 28px 16px;
    text-align: center;
    outline: none;
}
.pm-form.is-sent .pm-form__body { display: none; }
.pm-form.is-sent .pm-form__success { display: block; }
.pm-form__success-icon {
    width: 56px; height: 56px;
    margin: 0 auto 12px;
}
.pm-form__success-text {
    margin: 0;
    font-size: 16px;
    line-height: 1.5;
    color: var(--pm-text);
}

/* ---------- Сетевая ошибка ---------- */
.pm-form__network-error {
    margin: 10px 0 0;
    padding: 10px 12px;
    font-size: 14px;
    line-height: 1.4;
    color: var(--pm-error);
    background: #fef5f5;
    border: 1px solid #f5c2c2;
    border-radius: var(--pm-radius-input);
}

/* ---------- Варианты ---------- */

/* В модалке — без бордеров вокруг, центрированный, чуть крупнее */
.pm-form--modal {
    max-width: 100%;
}
.pm-form--modal .pm-form__head { text-align: center; }
.pm-form--modal .pm-form__title { font-size: clamp(22px, 2.4vw, 28px); }

/* В сайдбаре (узкий блок) — компактнее */
.pm-form--sidebar .pm-field { margin-bottom: 10px; }
.pm-form--sidebar .pm-field__input { min-height: 44px; padding: 10px 12px; font-size: 15px; }
.pm-form--sidebar .pm-form__submit { min-height: 46px; font-size: 15px; }

/* На странице контактов (рядом с картой) — белый фон, чуть плотнее */
.pm-form--map {
    background: var(--pm-bg);
    padding: 24px;
    border-radius: var(--pm-radius);
    box-shadow: 0 8px 24px rgba(16, 46, 93, .08);
}

/* ---------- Reduced motion ---------- */
@media (prefers-reduced-motion: reduce) {
    .pm-form__submit-loader { animation-duration: 1.6s; }
    .pm-form__submit,
    .pm-field__input {
        transition: none !important;
    }
    .pm-form__submit:active { transform: none !important; }
}

/* ---------- Adaptive ---------- */
@media (max-width: 480px) {
    .pm-form__title { font-size: 20px; }
    .pm-form__subtitle { font-size: 14px; }
    .pm-field__input { font-size: 16px; } /* iOS-zoom safety */
    .pm-form--map { padding: 18px; }
}

/* ── Мессенджеры под формой ──────────────────────────── */
.pm-form__messengers {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 10px;
    padding-top: 4px;
}

.pm-form__messengers-label {
    font-size: 12px;
    color: #8a99b3;
    font-family: 'Inter', -apple-system, sans-serif;
    text-align: center;
}

.pm-form__messengers-links {
    display: flex;
    gap: 10px;
    flex-wrap: wrap;
    justify-content: center;
}

.pm-form__messenger {
    display: inline-flex;
    align-items: center;
    gap: 7px;
    height: 40px;
    padding: 0 16px;
    border-radius: 20px;
    font-family: 'Inter', -apple-system, sans-serif;
    font-size: 13px;
    font-weight: 600;
    text-decoration: none;
    transition: opacity .18s, transform .15s;
    white-space: nowrap;
}

.pm-form__messenger:hover {
    opacity: .88;
    transform: translateY(-1px);
}

/* Telegram — фон нейтральный, логотип самодостаточен */
.pm-form__messenger--tg {
    background: #f0f8ff;
    color: #102e5d;
    border: 1px solid #dce8f5;
}

.pm-form__messenger--tg:hover {
    background: #e0f0ff;
    border-color: #26a4e0;
}

/* Max — фон нейтральный */
.pm-form__messenger--max {
    background: #f3f0ff;
    color: #102e5d;
    border: 1px solid #ddd6fe;
}

.pm-form__messenger--max:hover {
    background: #ebe5ff;
    border-color: #7c3aed;
}

/* На тёмных фонах (hero формы) */
.pm-srv-hero__form .pm-form__messengers-label,
.pm-cta-capture .pm-form__messengers-label {
    color: rgba(255,255,255,.6);
}

.pm-form__messenger img {
    width: 22px;
    height: 22px;
    border-radius: 5px;
    object-fit: contain;
    flex-shrink: 0;
}
