/* All styles scoped to #contactOverlay to prevent global conflicts */
#contactOverlay {
    display: none; 
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    z-index: 9999;
    align-items: center;
    justify-content: center;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    /* Added padding so the modal doesn't touch the edges of the viewport */
    padding: 20px;
    box-sizing: border-box;
}

/* Toggled by jQuery to show the overlay using flexbox for exact centering */
#contactOverlay.active {
    display: flex;
}

#contactOverlay .overlay-backdrop {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.65);
    backdrop-filter: blur(4px);
    cursor: pointer;
}
 
#contactOverlay .overlay-modal {
    position: relative;
    background: #ffffff;
    width: 100%;
    max-width: 550px;
    /* Added max-height and overflow to allow internal scrolling on small devices */
    max-height: 90vh;
    overflow-y: auto;
    border-radius: 8px;
    box-shadow: 0 15px 30px rgba(0, 0, 0, 0.3);
    padding: 35px;
    z-index: 10000;
    box-sizing: border-box;
    animation: modalFadeIn 0.3s ease-out;
}

@keyframes modalFadeIn {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

#contactOverlay h2 {
    margin-top: 0;
    margin-bottom: 25px;
    color: #2c3e50;
    font-size: 26px;
    font-weight: 600;
}

#contactOverlay .form-row {
    display: flex;
    gap: 15px;
}

#contactOverlay .form-group {
    margin-bottom: 18px;
    flex: 1;
    display: flex;
    flex-direction: column;
}

#contactOverlay label {
    margin-bottom: 6px;
    font-size: 14px;
    color: #4a5568;
    font-weight: 600;
}

#contactOverlay input[type="text"],
#contactOverlay input[type="email"],
#contactOverlay input[type="tel"],
#contactOverlay textarea {
    padding: 10px 14px;
    border: 1px solid #cbd5e0;
    border-radius: 5px;
    font-size: 15px;
    transition: border-color 0.2s, box-shadow 0.2s;
    font-family: inherit;
    background-color: #f8fafc;
}

#contactOverlay input:focus,
#contactOverlay textarea:focus {
    border-color: #3182ce;
    outline: none;
    box-shadow: 0 0 0 3px rgba(49, 130, 206, 0.15);
    background-color: #ffffff;
}

#contactOverlay .checkbox-options {
    display: flex;
    gap: 15px;
    flex-wrap: wrap;
    margin-top: 5px;
}

#contactOverlay .checkbox-options label {
    display: flex;
    align-items: center;
    font-weight: 400;
    cursor: pointer;
    color: #4a5568;
}

#contactOverlay .checkbox-options input[type="checkbox"] {
    margin-right: 8px;
    width: 16px;
    height: 16px;
    cursor: pointer;
}

#contactOverlay .form-actions {
    display: flex;
    justify-content: flex-end;
    gap: 12px;
    margin-top: 30px;
    padding-top: 20px;
    border-top: 1px solid #e2e8f0;
}

#contactOverlay button {
    padding: 10px 24px;
    border: none;
    border-radius: 5px;
    font-size: 15px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s;
}

#contactOverlay .btn-cancel {
    background-color: transparent;
    color: #4a5568;
    border: 1px solid #cbd5e0;
}

#contactOverlay .btn-cancel:hover {
    background-color: #f1f5f9;
}

#contactOverlay .btn-save {
    background-color: #3182ce;
    color: white;
    box-shadow: 0 2px 4px rgba(49, 130, 206, 0.3);
}

#contactOverlay .btn-save:hover {
    background-color: #2b6cb0;
    box-shadow: 0 4px 6px rgba(49, 130, 206, 0.4);
}


/* Additions for errors and disclaimers */
#contactOverlay .disclaimer-red {
    color: red;
    font-style: italic;
    font-size: 13px;
    margin-top: 15px;
    text-align: center;
    line-height: 1.4;
}

#contactOverlay .error-border {
    border-color: red !important;
    box-shadow: 0 0 0 3px rgba(255, 0, 0, 0.15) !important;
}

#contactOverlay .error-text {
    color: red;
    background-color: #fff5f5;
    border: 1px solid #feb2b2;
    padding: 10px;
    border-radius: 5px;
    font-size: 14px;
    margin-bottom: 15px;
}

#contactOverlay .sms-label {
    display: flex;
    display:block;
    align-items: flex-start;
    font-weight: 400;
    cursor: pointer;
    font-size: 14px;
    line-height: 1.4;
}

#contactOverlay .sms-label input {
    margin-top: 3px;
    margin-right: 8px;
}



@media (max-width: 749px) {
    #contactOverlay {
        /* Push the modal closer to the top instead of perfectly centered */
        align-items: flex-start;
        /* Adjust top spacing */
        padding-top: 20px; 
    }

    #contactOverlay .overlay-modal {
        /* Reduce padding slightly on smaller screens to save space */
        padding: 25px 20px;
    }

    /* Stack the First Name and Last Name fields vertically */
    #contactOverlay .form-row {
        flex-direction: column;
        gap: 0;
    }
}
