/**
 * Global contact modal (CF7) — premium, RTL, accessible focus.
 *
 * @package yRealestate
 */

#yreModalBackdrop {
    display: none;
    position: fixed;
    inset: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.62);
    backdrop-filter: blur(10px);
    -webkit-backdrop-filter: blur(10px);
    z-index: 2147483640;
}

#yreGlobalModal {
    display: none;
    position: fixed;
    inset: 0;
    width: min(100%, 480px);
    max-width: 92vw;
    max-height: min(92vh, 720px);
    margin: auto;
    padding: clamp(2.25rem, 4.5vw, 2.8rem) clamp(1.25rem, 3.6vw, 2.05rem) clamp(1.5rem, 3vw, 2.05rem);
    background: #ffffff;
    border-radius: 20px;
    z-index: 2147483647;
    overflow-y: auto;
    box-shadow: 0 28px 64px -16px rgba(0, 0, 0, 0.45);
    box-sizing: border-box;
    direction: inherit;
    /* let the document (html[dir]) decide RTL/LTR (fallback) */
    text-align: start;
    animation: yreModalIn 0.28s ease-out;
    max-height: max-content;
}

html[dir="rtl"] #yreGlobalModal {
    direction: rtl;
    text-align: start;
}

html[dir="ltr"] #yreGlobalModal {
    direction: ltr;
    text-align: start;
}

@keyframes yreModalIn {
    from {
        opacity: 0;
        transform: scale(0.96) translateY(8px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

body.dark-mode #yreGlobalModal {
    background: #12121e;
    border: 1px solid rgba(255, 255, 255, 0.1);
    color: #f3f4f6;
}

#yreGlobalModal .yre-modal-close {
    position: absolute;
    top: 14px;
    inset-inline-start: 14px;
    width: 44px;
    height: 44px;
    padding: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    border: none;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.06);
    color: #333;
    cursor: pointer;
    transition: background 0.2s ease, transform 0.2s ease;
    z-index: 10;
}

#yreGlobalModal .yre-modal-close:hover {
    background: rgba(0, 0, 0, 0.1);
}

#yreGlobalModal .yre-modal-close:focus-visible {
    outline: 3px solid var(--color-secondary, #c9a227);
    outline-offset: 2px;
}

body.dark-mode #yreGlobalModal .yre-modal-close {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
}

#yreGlobalModal .yre-modal-header {
    text-align: center;
    margin-bottom: clamp(1.25rem, 3vw, 1.75rem);
}

#yreGlobalModal .yre-modal-title {
    margin: 0 0 0.35rem;
    font-size: clamp(1.25rem, 3vw, 1.6rem);
    font-weight: 800;
    color: #111;
    line-height: 1.25;
}

body.dark-mode #yreGlobalModal .yre-modal-title {
    color: #fff;
}

#yreGlobalModal .yre-modal-subtitle {
    margin: 0;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #5c6570;
}

body.dark-mode #yreGlobalModal .yre-modal-subtitle {
    color: rgba(255, 255, 255, 0.65);
}

#yreGlobalModal .wpcf7-form {
    --yre-cf7-radius: 14px;
    text-align: start;
    direction: inherit;
}

#yreGlobalModal .wpcf7-form,
#yreGlobalModal .wpcf7-form .wpcf7-form-control-wrap,
#yreGlobalModal .wpcf7-form p {
    box-sizing: border-box;
}


/* CF7 usually wraps each control in <p>. Normalize spacing and use a single gap system. */

#yreGlobalModal .wpcf7-form p {
    margin: 0;
}

#yreGlobalModal .wpcf7-form-control-wrap {
    width: 100%;
    margin: 0;
}

#yreGlobalModal .wpcf7-form {
    display: flex;
    flex-direction: column;
    gap: 0.95rem;
}

#yreGlobalModal .wpcf7-form-control:not(.wpcf7-submit) {
    width: 100%;
    box-sizing: border-box;
    min-height: 48px;
    border-radius: 14px;
    padding-block: 0.875rem;
    padding-inline: 1.125rem;
    border: 1px solid rgba(15, 20, 25, 0.12);
    background: #f8f9fb;
    color: #0f1419;
    font-size: 1rem;
    font-family: inherit;
    margin-bottom: 0;
    transition: border-color 0.2s ease, box-shadow 0.2s ease;
    text-align: start;
    direction: inherit;
}

html[dir="rtl"] #yreGlobalModal .wpcf7-form-control:not(.wpcf7-submit) {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="ltr"] #yreGlobalModal .wpcf7-form-control:not(.wpcf7-submit) {
    text-align: left !important;
    direction: ltr !important;
}

#yreGlobalModal .wpcf7-form-control:not(.wpcf7-submit)::placeholder {
    color: rgba(15, 20, 25, 0.55);
}

html[dir="rtl"] #yreGlobalModal .wpcf7-form-control:not(.wpcf7-submit)::placeholder {
    text-align: right !important;
}

html[dir="ltr"] #yreGlobalModal .wpcf7-form-control:not(.wpcf7-submit)::placeholder {
    text-align: left !important;
}

body.dark-mode #yreGlobalModal .wpcf7-form-control:not(.wpcf7-submit) {
    background: rgba(255, 255, 255, 0.06);
    border-color: rgba(255, 255, 255, 0.14);
    color: #fff;
}

body.dark-mode #yreGlobalModal .wpcf7-form-control:not(.wpcf7-submit)::placeholder {
    color: rgba(255, 255, 255, 0.6);
}

#yreGlobalModal .wpcf7-form textarea.wpcf7-textarea {
    min-height: 8.5rem;
    resize: vertical;
    text-align: start;
    direction: inherit;
}

html[dir="rtl"] #yreGlobalModal .wpcf7-form textarea.wpcf7-textarea {
    text-align: right !important;
    direction: rtl !important;
}

html[dir="ltr"] #yreGlobalModal .wpcf7-form textarea.wpcf7-textarea {
    text-align: left !important;
    direction: ltr !important;
}

#yreGlobalModal .wpcf7-form-control:not(.wpcf7-submit):focus-visible {
    outline: none;
    border-color: var(--color-secondary, #c9a227);
    box-shadow: 0 0 0 4px rgba(201, 162, 39, 0.22);
}

#yreGlobalModal .wpcf7-submit {
    width: 100%;
    min-height: 48px;
    margin-top: 0;
    padding-block: 0.875rem;
    padding-inline: 1.25rem;
    border: none;
    border-radius: 999px;
    background: linear-gradient(135deg, var(--color-secondary, #e07a2c) 0%, color-mix(in srgb, var(--color-secondary, #e07a2c) 85%, #000) 100%);
    color: #fff !important;
    font-weight: 700;
    font-size: 1rem;
    cursor: pointer;
    box-sizing: border-box;
    box-shadow: 0 12px 28px rgba(224, 122, 44, 0.28);
    transition: filter 0.2s ease, transform 0.2s ease;
    text-align: center;
    direction: inherit;
}

#yreGlobalModal .wpcf7-submit:hover {
    filter: brightness(1.06);
    transform: translateY(-1px);
}

#yreGlobalModal .wpcf7-form .wpcf7-response-output {
    border-radius: 12px;
    margin-top: 0;
}

@media (prefers-reduced-motion: reduce) {
    #yreGlobalModal {
        animation: none;
    }
    #yreGlobalModal .wpcf7-submit:hover {
        transform: none;
    }
}