.cpmf-modal { 
    position: fixed; 
    inset: 0; 
    display: none; 
    z-index: 9999; 
    overflow-y: auto;
    padding: 20px;
    box-sizing: border-box;
}
.cpmf-modal[aria-hidden="false"] { 
    display: block !important; 
}
.cpmf-modal__overlay { 
    position: absolute; 
    inset: 0; 
    background: rgba(0,0,0,0.5); 
}
.cpmf-modal__dialog { 
    position: relative; 
    max-width: 520px; 
    width: 100%;
    margin: 20px auto; 
    background: #fff; 
    border-radius: 8px; 
    overflow: hidden; 
    box-shadow: 0 10px 30px rgba(0,0,0,0.2); 
    padding: 20px;
    box-sizing: border-box;
    min-height: auto;
    /* Ensure content fits viewport; body scrolls */
    max-height: calc(100vh - 40px);
    display: flex;
    flex-direction: column;
}
.cpmf-modal__title { 
    margin: 0 0 20px; 
    font-size: 20px; 
    padding-right: 30px;
}
.cpmf-modal__close { 
    position: absolute; 
    top: 12px; 
    right: 12px; 
    border: 0; 
    background: rgba(0,0,0,0.06) !important; 
    font-size: 22px; 
    line-height: 1; 
    cursor: pointer; 
    color: #111;
    width: 32px;
    height: 32px;
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
}
.cpmf-modal__close:hover { background: rgba(0,0,0,0.1); color: #000; }
body.cpmf-modal-open { overflow: hidden; }
.cpmf-row { margin-bottom: 15px; }
.cpmf-row label { 
    display: block; 
    margin-bottom: 6px; 
    font-weight: 600; 
    color: #333;
}
.cpmf-row input, .cpmf-row textarea { 
    width: 100%; 
    padding: 12px; 
    border: 1px solid #ddd; 
    border-radius: 4px; 
    font-size: 14px;
    box-sizing: border-box;
}
.cpmf-row input:focus, .cpmf-row textarea:focus {
    outline: none;
    border-color: #2271b1;
    box-shadow: 0 0 0 2px rgba(34, 113, 177, 0.1);
}
.cpmf-submit { 
    background: #2271b1; 
    color: #fff; 
    border: 0; 
    padding: 12px 24px; 
    border-radius: 4px; 
    cursor: pointer; 
    font-size: 16px;
    font-weight: 600;
    width: 100%;
    margin-top: 10px;
}
.cpmf-submit:hover { background: #1e5a96; }
.cpmf-status { 
    margin-top: 15px; 
    font-size: 14px; 
    padding: 10px;
    border-radius: 4px;
    min-height: 20px;
}

/* Scrollable modal body so the submit button is always reachable */
.cpmf-modal__body { 
    overflow-y: auto; 
    flex: 1 1 auto; 
    padding-bottom: 6px;
}

/* Mobile responsiveness */
@media (max-width: 768px) {
    .cpmf-modal {
        padding: 10px;
    }
    .cpmf-modal__dialog {
        margin: 10px auto;
        padding: 15px;
        max-height: calc(100vh - 20px);
    }
    .cpmf-modal__title {
        font-size: 18px;
        margin-bottom: 15px;
    }
    .cpmf-row {
        margin-bottom: 12px;
    }
    .cpmf-row input, .cpmf-row textarea {
        padding: 10px;
    }
}

@media (max-width: 480px) {
    .cpmf-modal {
        padding: 5px;
    }
    .cpmf-modal__dialog {
        margin: 5px auto;
        padding: 12px;
        max-height: calc(100vh - 10px);
    }
    .cpmf-modal__title {
        font-size: 16px;
    }
}
