/* ============================================================
   css/modal-contact.css — ПОЛНЫЙ ФАЙЛ (компактная версия)
   ============================================================ */

.modal {
    position: fixed;
    inset: 0;
    z-index: 2000;
    display: none;
    align-items: center;
    justify-content: center;
    padding: 20px;
}
.modal.active { display: flex; }

.modal__overlay {
    position: absolute;
    inset: 0;
    background: rgba(62, 31, 50, .55);
    backdrop-filter: blur(4px);
    animation: modalFadeIn .3s ease;
}

.modal__container {
    position: relative;
    z-index: 1;
    width: 100%;
    max-width: 460px;
    max-height: 86vh;
    overflow-y: auto;
    background: var(--color-white);
    border-radius: var(--radius-md);
    box-shadow: var(--shadow-card-hover);
    animation: modalSlideUp .35s cubic-bezier(.2,.8,.2,1);
}

@keyframes modalFadeIn { from { opacity: 0; } to { opacity: 1; } }
@keyframes modalSlideUp {
    from { opacity: 0; transform: translateY(24px) scale(.98); }
    to   { opacity: 1; transform: translateY(0) scale(1); }
}

.modal__container::-webkit-scrollbar { width: 5px; }
.modal__container::-webkit-scrollbar-thumb { background: var(--color-border); border-radius: 999px; }

.modal__header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 12px;
    padding: 18px 22px 12px;
    border-bottom: 1px solid var(--color-border);
    position: sticky;
    top: 0;
    background: var(--color-white);
    z-index: 2;
}

.modal__title { font-size: 17px; color: var(--color-plum-dark); margin: 0; }

.modal__close {
    flex: 0 0 auto;
    width: 30px; height: 30px;
    border-radius: 50%;
    border: none;
    background: var(--color-plum-soft);
    color: var(--color-plum);
    display: flex; align-items: center; justify-content: center;
    cursor: pointer;
    transition: background .25s ease, color .25s ease, transform .25s ease;
}
.modal__close:hover { background: var(--color-plum); color: var(--color-white); transform: rotate(90deg); }
.modal__close svg { width: 15px; height: 15px; }

.modal__body { padding: 18px 22px 22px; }

.contact-form__form {
    display: grid;
    grid-template-columns: 1fr;
    gap: 13px;
}

.form-group { display: flex; flex-direction: column; gap: 5px; }
.form-group--full { grid-column: 1 / -1; }

.form-label { font-size: 12.5px; font-weight: 600; color: var(--color-plum-dark); }
.form-label .required { color: var(--color-pink-dark); }
.form-label .optional { font-weight: 400; color: var(--color-text-muted); font-size: 11.5px; }

.form-input-wrapper { position: relative; }

.form-icon {
    position: absolute;
    left: 13px; top: 50%;
    transform: translateY(-50%);
    width: 16px; height: 16px;
    color: var(--color-text-muted);
    pointer-events: none;
    transition: color .25s ease;
}
.form-icon--textarea { top: 15px; transform: none; }

.form-input {
    width: 100%;
    padding: 10px 14px 10px 38px;
    border: 1.5px solid var(--color-border);
    border-radius: var(--radius-sm);
    font-family: var(--font-main);
    font-size: 13.5px;
    color: var(--color-text);
    background: var(--color-cream);
    transition: border-color .25s ease, background .25s ease, box-shadow .25s ease;
}
.form-input::placeholder { color: var(--color-text-muted); font-size: 13px; }

.form-input:focus {
    outline: none;
    border-color: var(--color-plum);
    background: var(--color-white);
    box-shadow: 0 0 0 3px var(--color-plum-soft);
}
.form-input-wrapper:focus-within .form-icon { color: var(--color-plum); }

.form-input--textarea {
    resize: vertical;
    min-height: 76px;
    padding-top: 11px;
}

.form-group.error .form-input { border-color: #C0526A; background: rgba(192, 82, 106, .05); }
.form-group.error .form-icon { color: #C0526A; }
.form-group.success .form-input { border-color: rgba(92, 48, 74, .35); }
.form-group.success .form-icon { color: var(--color-plum); }

.form-input:disabled,
input[type="checkbox"]:disabled ~ .form-checkbox__custom { opacity: .55; cursor: not-allowed; }

.form-error { font-size: 11.5px; color: #C0526A; min-height: 14px; display: block; }
.form-hint { font-size: 11px; color: var(--color-text-muted); text-align: right; }
.form-hint strong { font-weight: 700; }

.form-realtime-hint {
    font-size: 11.5px;
    color: var(--color-plum);
    background: var(--color-plum-soft);
    border-radius: 7px;
    padding: 5px 9px;
    display: none;
}

.paste-warning {
    font-size: 11.5px;
    color: #A15A1E;
    background: rgba(201, 137, 30, .1);
    border-radius: 7px;
    padding: 5px 9px;
    opacity: 0;
    max-height: 0;
    overflow: hidden;
    transition: opacity .3s ease, max-height .3s ease, margin .3s ease;
}
.paste-warning.active { opacity: 1; max-height: 36px; margin-bottom: 4px; }

.form-group--checkbox { gap: 4px; }

.form-checkbox { display: flex; align-items: flex-start; gap: 10px; cursor: pointer; user-select: none; }
.form-checkbox input { position: absolute; opacity: 0; width: 0; height: 0; }

.form-checkbox__custom {
    flex: 0 0 auto;
    width: 18px; height: 18px;
    margin-top: 1px;
    border: 1.5px solid var(--color-border);
    border-radius: 5px;
    background: var(--color-cream);
    position: relative;
    transition: all .25s ease;
}
.form-checkbox__custom::after {
    content: '';
    position: absolute;
    left: 5px; top: 1px;
    width: 5px; height: 9px;
    border: solid var(--color-white);
    border-width: 0 2px 2px 0;
    transform: rotate(45deg);
    opacity: 0;
    transition: opacity .2s ease;
}
.form-checkbox input:checked ~ .form-checkbox__custom { background: var(--color-plum); border-color: var(--color-plum); }
.form-checkbox input:checked ~ .form-checkbox__custom::after { opacity: 1; }
.form-checkbox input:focus-visible ~ .form-checkbox__custom { outline: 2px solid var(--color-plum); outline-offset: 2px; }
.form-group--checkbox.error .form-checkbox__custom { border-color: #C0526A; }

.form-checkbox__label { font-size: 12.5px; color: var(--color-text-muted); line-height: 1.4; }

.form-group--submit { margin-top: 2px; }

.form-submit {
    position: relative;
    background: var(--gradient-btn);
    border-color: transparent;
    color: var(--color-white);
    padding: 12px 24px;
    font-size: 14px;
}
.form-submit:hover { filter: brightness(1.08); }
.form-submit:disabled { cursor: not-allowed; opacity: .85; }

.form-submit__loader {
    display: none;
    width: 15px; height: 15px;
    border: 2px solid rgba(255, 255, 255, .4);
    border-top-color: var(--color-white);
    border-radius: 50%;
    animation: spin .8s linear infinite;
}
.form-submit.loading .form-submit__text { opacity: 0; }
.form-submit.loading .form-submit__loader {
    display: block;
    position: absolute;
    left: 50%; top: 50%;
    margin: -7.5px 0 0 -7.5px;
}

.form-message {
    display: none;
    align-items: flex-start;
    gap: 10px;
    grid-column: 1 / -1;
    padding: 12px 14px;
    border-radius: var(--radius-sm);
    font-size: 13px;
    line-height: 1.45;
}
.form-message.active { display: flex; }

.form-message--success {
    background: rgba(92, 48, 74, .06);
    color: var(--color-plum-dark);
    border: 1px solid rgba(92, 48, 74, .15);
}
.form-message--success svg { flex: 0 0 auto; color: #4C8C6B; width: 18px; height: 18px; }

.form-message--error {
    background: rgba(192, 82, 106, .06);
    color: #A13E52;
    border: 1px solid rgba(192, 82, 106, .18);
}
.form-message--error svg { flex: 0 0 auto; color: #C0526A; width: 18px; height: 18px; }

@media (max-width: 560px) {
    .modal {
        padding: 10px;
        align-items: center;           /* по центру, а не прижато к низу */
    }
    .modal__container {
        max-height: calc(100vh - 20px);   /* фолбэк для старых браузеров */
        max-height: calc(100dvh - 20px);  /* реальная видимая высота на мобильных */
        border-radius: var(--radius-md);  /* скругление со всех сторон */
    }
    .modal__header { padding: 16px 18px 12px; }
    .modal__body { padding: 16px 18px 20px; }
}