/* ── Блокировка скролла страницы ──
   Скроллится не body (у него overflow: hidden из sidebar.css), а .main —
   его и нужно блокировать, иначе фон уезжает под открытой модалкой */
body.owl-modal-open { overflow: hidden; }
body.owl-modal-open .main { overflow: hidden; }

/* ── Оверлей ── */
.owl-modal {
    position: fixed;
    inset: 0;
    z-index: 9000;
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 16px;
}
.owl-modal[hidden] { display: none; }

.owl-modal__backdrop {
    position: absolute;
    inset: 0;
    background: rgba(10, 14, 33, 0.88);
    backdrop-filter: blur(6px);
    -webkit-backdrop-filter: blur(6px);
}

/* ── Окно ── */
.owl-modal__window {
    position: relative;
    width: 100%;
    max-width: 480px;
    max-height: 90vh;
    overflow-y: auto;
    background: linear-gradient(160deg, #1c2451 0%, #12172b 55%, #1a1134 100%);
    border: 1px solid rgba(212, 168, 67, 0.35);
    border-radius: 24px;
    padding: 36px 32px 32px;
    color: #e8e0f0;
    animation: owlModalIn 0.38s cubic-bezier(0.22, 1, 0.36, 1) both;
    scrollbar-width: thin;
    scrollbar-color: rgba(212,168,67,0.3) transparent;
}
.owl-modal__window::-webkit-scrollbar { width: 4px; }
.owl-modal__window::-webkit-scrollbar-thumb { background: rgba(212,168,67,0.3); border-radius: 2px; }

/* ── Звёзды ── */
.owl-modal__stars {
    position: absolute;
    inset: 0;
    border-radius: 24px;
    overflow: hidden;
    pointer-events: none;
}
.owl-modal__stars span {
    position: absolute;
    width: 2px;
    height: 2px;
    border-radius: 50%;
    background: #fff;
    opacity: 0;
    animation: twinkle var(--d, 3s) var(--delay, 0s) infinite ease-in-out;
}

/* ── Кнопка закрытия ── */
.owl-modal__close {
    position: absolute;
    top: 14px;
    right: 16px;
    background: none;
    border: none;
    color: rgba(255,255,255,0.45);
    font-size: 22px;
    line-height: 1;
    cursor: pointer;
    padding: 4px 8px;
    border-radius: 6px;
    transition: color 0.2s, background 0.2s;
}
.owl-modal__close:hover { color: #fff; background: rgba(255,255,255,0.08); }

/* ── Заголовок ── */
.owl-modal__header { text-align: center; margin-bottom: 24px; }

.owl-modal__owl-wrap {
    display: inline-block;
    animation: owlFloat 4s ease-in-out infinite;
    margin-bottom: 10px;
}
.owl-modal__owl {
    width: 64px;
    height: 64px;
    filter: drop-shadow(0 0 12px rgba(212, 168, 67, 0.6));
}

.owl-modal__title {
    font-size: 1.45rem;
    font-weight: 700;
    color: #e8c46a;
    margin: 0 0 6px;
    letter-spacing: 0.01em;
}
.owl-modal__subtitle {
    font-size: 0.9rem;
    color: rgba(232, 224, 240, 0.6);
    margin: 0;
}

/* ── Форма ── */
.owl-modal__form { display: flex; flex-direction: column; gap: 14px; }

.owl-modal__input {
    width: 100%;
    background: rgba(255,255,255,0.07);
    border: 1px solid rgba(255,255,255,0.15);
    border-radius: 10px;
    padding: 11px 14px;
    color: #e8e0f0;
    font-size: 0.95rem;
    outline: none;
    transition: border-color 0.2s, box-shadow 0.2s;
    box-sizing: border-box;
}
.owl-modal__input::placeholder { color: rgba(232,224,240,0.38); }
.owl-modal__input:focus {
    border-color: rgba(212, 168, 67, 0.6);
    box-shadow: 0 0 0 3px rgba(212, 168, 67, 0.12);
}
textarea.owl-modal__input { resize: vertical; min-height: 90px; }

/* ── Капча ── */
.owl-modal__captcha-row {
    display: flex;
    align-items: center;
    gap: 12px;
}
.owl-modal__captcha-img {
    height: 46px;
    border-radius: 8px;
    border: 1px solid rgba(255,255,255,0.15);
    flex-shrink: 0;
    cursor: pointer;
}
.owl-modal__captcha-row .owl-modal__input { flex: 1; }

/* ── Согласие ── */
.owl-modal__consent {
    display: flex;
    align-items: flex-start;
    gap: 10px;
    font-size: 0.82rem;
    color: rgba(232,224,240,0.55);
}
.owl-modal__consent input[type="checkbox"] { margin-top: 2px; flex-shrink: 0; accent-color: #e8c46a; }
.owl-modal__consent a { color: rgba(212,168,67,0.8); text-decoration: underline; }
.owl-modal__consent a:hover { color: #e8c46a; }

/* ── Кнопка отправки ── */
.owl-modal__submit {
    width: 100%;
    padding: 13px;
    background: linear-gradient(135deg, #c9913a, #e8c46a);
    border: none;
    border-radius: 12px;
    color: #1a1134;
    font-size: 1rem;
    font-weight: 700;
    cursor: pointer;
    transition: transform 0.2s, box-shadow 0.2s, opacity 0.2s;
    letter-spacing: 0.02em;
}
.owl-modal__submit:hover:not(:disabled) {
    transform: translateY(-3px);
    box-shadow: 0 8px 24px rgba(212, 168, 67, 0.4);
}
.owl-modal__submit:disabled { opacity: 0.6; cursor: not-allowed; }

/* ── Алерт ── */
.owl-modal__alert {
    background: rgba(220, 60, 60, 0.18);
    border: 1px solid rgba(220, 60, 60, 0.4);
    border-radius: 10px;
    padding: 10px 14px;
    font-size: 0.9rem;
    color: #f8a0a0;
    margin-bottom: 4px;
}
.owl-modal__alert[hidden] { display: none; }

/* ── Экран успеха ── */
.owl-modal__success {
    text-align: center;
    padding: 20px 0 8px;
}
.owl-modal__success[hidden] { display: none; }
.owl-modal__success-owl { font-size: 3.5rem; margin-bottom: 12px; }
.owl-modal__success h3 {
    font-size: 1.35rem;
    color: #e8c46a;
    margin: 0 0 8px;
}
.owl-modal__success p {
    color: rgba(232,224,240,0.65);
    font-size: 0.95rem;
    margin: 0;
}

/* ── Анимации ── */
@keyframes owlModalIn {
    from { opacity: 0; transform: translateY(40px) scale(0.96); }
    to   { opacity: 1; transform: translateY(0)   scale(1); }
}

@keyframes owlFloat {
    0%, 100% { transform: translateY(0); }
    50%       { transform: translateY(-6px); }
}

@keyframes twinkle {
    0%, 100% { opacity: 0; }
    50%       { opacity: var(--max-opacity, 0.8); }
}

/* ── Адаптив ── */
@media (max-width: 560px) {
    .owl-modal { padding: 12px; }

    .owl-modal__window {
        max-height: calc(100vh - 24px);
        max-height: calc(100dvh - 24px);
        padding: 28px 18px 22px;
        border-radius: 18px;
    }

    .owl-modal__stars { border-radius: 18px; }

    .owl-modal__header { margin-bottom: 18px; }
    .owl-modal__owl { width: 52px; height: 52px; }
    .owl-modal__title { font-size: 1.2rem; }
    .owl-modal__subtitle { font-size: 0.88rem; }

    /* 16px — ниже этого размера iOS Safari зумит страницу при фокусе инпута */
    .owl-modal__input {
        font-size: 16px;
        padding: 12px 14px;
    }

    textarea.owl-modal__input { min-height: 84px; }

    .owl-modal__captcha-row { gap: 10px; }
    .owl-modal__captcha-img { height: 44px; }

    .owl-modal__consent { font-size: 0.85rem; }

    .owl-modal__close {
        top: 8px;
        right: 8px;
        font-size: 26px;
        padding: 6px 12px;
    }

    .owl-modal__success-owl { font-size: 3rem; }
}

/* ---- Небольшие телефоны (≤400px) ---- */
@media (max-width: 400px) {
    .owl-modal { padding: 8px; }

    .owl-modal__window {
        max-height: calc(100vh - 16px);
        max-height: calc(100dvh - 16px);
        padding: 24px 14px 18px;
        border-radius: 16px;
    }

    .owl-modal__stars { border-radius: 16px; }

    .owl-modal__owl { width: 46px; height: 46px; }
    .owl-modal__title { font-size: 1.1rem; }
    .owl-modal__header { margin-bottom: 15px; }
    .owl-modal__form { gap: 11px; }
}

@media (hover: none) {
    .owl-modal__submit:hover:not(:disabled) {
        transform: none;
        box-shadow: none;
    }
}
