.popup-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.6);
    backdrop-filter: blur(5px);
    z-index: 9998;
    opacity: 1;
    display: none;
}

/* Main Popup Box */
.popup-box {
    position: fixed;
    top: 50%;
    left: 50%;
    /* ✅ CLS FIX: transform stays here permanently — never removed/added by JS */
    transform: translate(-50%, -50%);
    width: 90%;
    max-width: 750px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 20px 50px rgba(0, 0, 0, 0.25);
    z-index: 9999;
    overflow: hidden;
    display: none;
    animation: popupSlideIn 0.4s ease-out;
    /* ✅ CLS FIX: isolate popup from page layout */
    will-change: opacity;
    contain: layout style;
}


@keyframes popupSlideIn {
    from {
        opacity: 0;
        transform: translate(-50%, -45%);
    }

    to {
        opacity: 1;
        transform: translate(-50%, -50%);
    }
}

/* Flex Container */
.popup-flex-container {
    display: flex;
    position: relative;
    min-height: 480px;
}

/* Left — Form */
.popup-form-section {
    flex: 1.2;
    padding: 35px 30px;
    background: linear-gradient(135deg, #f8f9fa 0%, #ffffff 100%);
    min-width: 0;
}

/* Right — Image */
.popup-image-section {
    flex: 0.8;
    background: linear-gradient(135deg, #1e3c72 0%, #3b82f6 100%);
    position: relative;
    overflow: hidden;
    min-width: 240px;
    width: 240px;
    flex-shrink: 0;
}

.popup-image-section img {
    width: 100%;
    height: 100%;
    object-fit: cover;
    display: block;
}

/* Heading */
.popup-heading {
    font-size: 22px;
    font-weight: 700;
    color: #1e293b;
    margin-bottom: 18px;
    line-height: 1.3;
    background: linear-gradient(135deg, #1e3c72 0%, #3b82f6 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    background-clip: text;
    font-family: "Bricolage Grotesque", sans-serif;
}

/* WhatsApp Button */
.popup-whatsapp-wrapper {
    margin-bottom: 20px;
}

.popup-whatsapp-btn {
    display: inline-flex;
    align-items: center;
    gap: 10px;
    padding: 12px 24px;
    background: linear-gradient(135deg, #25D366 0%, #128C7E 100%);
    color: #ffffff;
    text-decoration: none;
    border-radius: 50px;
    font-size: 15px;
    font-weight: 600;
    transition: all 0.3s ease;
    box-shadow: 0 4px 15px rgba(37, 211, 102, 0.4);
}

.popup-whatsapp-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(37, 211, 102, 0.5);
    background: linear-gradient(135deg, #128C7E 0%, #075E54 100%);
    color: #ffffff;
}

.popup-whatsapp-btn i {
    font-size: 18px;
}

/* Form */
.popup-form {
    margin-top: 20px;
    font-family: "Outfit", sans-serif !important;
}

.popup-form-row {
    display: flex;
    gap: 12px;
    margin-bottom: 12px;
}

.popup-form-col {
    flex: 1;
}

/* Inputs */
.popup-input,
.popup-textarea,
.popup-select {
    width: 100%;
    padding: 10px 14px;
    border: 2px solid #e2e8f0;
    border-radius: 8px;
    font-size: 14px;
    color: #334155;
    background: #ffffff;
    transition: all 0.3s ease;
    font-family: "Outfit", sans-serif !important;
    /* ✅ CLS FIX: prevent size changes from affecting layout */
    box-sizing: border-box;
}

.popup-input:focus,
.popup-textarea:focus,
.popup-select:focus {
    outline: none;
    border-color: #3b82f6;
    box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.1);
}

.popup-input::placeholder,
.popup-textarea::placeholder {
    color: #94a3b8;
}

/* Select */
.popup-select {
    cursor: pointer;
    margin-bottom: 12px;
    appearance: none;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%23334155' d='M6 9L1 4h10z'/%3E%3C/svg%3E");
    background-repeat: no-repeat;
    background-position: right 12px center;
    padding-right: 35px;
}

/* Textarea */
.popup-textarea {
    /* ✅ CLS FIX: fixed height prevents reflow on first render */
    height: 80px;
    min-height: 80px;
    resize: vertical;
    margin-bottom: 12px;
}

/* Submit Button */
.popup-submit-btn {
    width: 100%;
    padding: 12px 24px;
    background: linear-gradient(135deg, #3b82f6 0%, #2563eb 100%);
    color: #ffffff;
    border: none;
    border-radius: 8px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 3px 12px rgba(59, 130, 246, 0.3);
    text-transform: uppercase;
    letter-spacing: 0.5px;
    /* ✅ CLS FIX: explicit sizing */
    box-sizing: border-box;
    display: block;
}

.popup-submit-btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 5px 16px rgba(59, 130, 246, 0.4);
    background: linear-gradient(135deg, #2563eb 0%, #1d4ed8 100%);
}

.popup-submit-btn:active {
    transform: translateY(0);
}

/* Close Button */
.popup-close {
    position: absolute;
    top: 15px;
    right: 15px;
    width: 36px;
    height: 36px;
    background: rgba(255, 255, 255, 0.95);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: all 0.3s ease;
    z-index: 10;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
    border: none;
}

.popup-close:hover {
    background: #ef4444;
    transform: rotate(90deg);
}

.popup-close i {
    font-size: 18px;
    color: #1e293b;
    transition: color 0.3s ease;
}

.popup-close:hover i {
    color: #ffffff;
}

/* Responsive */
@media (max-width: 768px) {
    .popup-flex-container {
        flex-direction: column;
        min-height: auto;
    }

    .popup-image-section {
        display: none;
    }

    .popup-form-section {
        padding: 25px 20px;
    }

    .popup-heading {
        font-size: 19px;
    }

    .popup-box {
        width: 95%;
        max-height: 90vh;
        overflow-y: auto;
    }

    .popup-close {
        display: none;
    }
}

@media (max-width: 576px) {
    .popup-form-row {
        flex-direction: column;
    }

    .popup-heading {
        font-size: 18px;
    }

    .popup-whatsapp-btn {
        font-size: 14px;
        padding: 10px 20px;
    }

    .popup-input,
    .popup-textarea,
    .popup-select {
        padding: 9px 12px;
        font-size: 13px;
    }

    .popup-box {
        max-width: 100%;
        border-radius: 12px;
    }
}
