/* Modal Container (hidden by default) */
.cashfree-modal {
    display: none;
    position: fixed;
    z-index: 99999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    overflow: auto;
    background-color: rgba(0,0,0,0.4);
}

/* Active modal state - added as separate class */
.cashfree-modal.active {
    display: flex;
    align-items: center;
    justify-content: center;
}

/* Modal Content */
.cashfree-modal-content {
    background-color: #fefefe;
    padding: 0;
    border-radius: 8px;
    max-width: 500px;
    width: 90%;
    box-shadow: 0 4px 8px rgba(0,0,0,0.1);
    box-sizing: border-box;
    margin: 20px auto; /* Provides fallback spacing */
}

/* Modal Header */
.cashfree-modal-header {
    background-color: #f4f7fb;
    /* CHANGE 1: Increase right padding to make definite space for the close button */
    padding: 20px 60px 20px 20px; /* Top, Right, Bottom, Left. Right is now 60px */
    color: #444;
    border-bottom: 1px solid #e3ebf6;
    position: relative;
    border-radius: 8px 8px 0 0;
    /* CHANGE 2: Add min-height to ensure there's always vertical space if content is short */
    min-height: 70px; /* Example: adjust based on logo and text height */
    display: flex; /* Makes alignment of content inside easier */
    align-items: center; /* Vertically centers header content */
}
.cashfree-header-content {
    position: relative;
    padding-left: 70px;
    flex-grow: 1;
}

.cashfree-logo {
    position: absolute;
    left: 20px;
    top: 20px;
    width: 50px;
    height: 50px;
    border-radius: 4px;
}

/* Close Button */
.cashfree-close {
    position: absolute;
    right: 15px;
    top: 50%;
    transform: translateY(-50%);
    color: #aaa;
    font-size: 28px;
    font-weight: bold;
    cursor: pointer;
    width: 40px; /* Give it a dedicated clickable area */
    height: 40px; /* Give it a dedicated clickable area */
    display: flex; /* Use flexbox to center the 'X' character */
    align-items: center;
    justify-content: center;
    line-height: 1; /* Helps vertical alignment of the 'X' symbol itself */
    z-index: 100000; /* Ensure it's on top of everything */
}

.cashfree-close:hover {
    color: #333;
}

/* Modal Body */
.cashfree-modal-body {
    padding: 20px;
    box-sizing: border-box;
}

/* Form Elements */
.cashfree-input-group {
    margin-bottom: 20px;
    width: 100%;
    box-sizing: border-box;
}

.cashfree-input-group label {
    display: block;
    margin-bottom: 8px;
    font-weight: 500;
    color: #555;
}

.cashfree-input-group input {
    width: 100%;
    padding: 12px 15px;
    border: 2px solid #e3ebf6;
    border-radius: 6px;
    font-size: 16px;
    background-color: #f4f7fb;
    transition: border-color 0.3s;
    box-sizing: border-box;
    display: block;
}

.cashfree-input-group input:focus {
    border-color: #672fd8;
    outline: none;
    background-color: #fff;
}

/* Modal Footer */
.cashfree-modal-footer {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    margin-top: 20px;
    flex-wrap: wrap;
    padding: 20px;
    border-top: 1px solid #e3ebf6;
    border-radius: 0 0 8px 8px;
    background-color: #f4f7fb;
}

/* Buttons */
.cashfree-btn {
    padding: 12px 24px;
    border-radius: 6px;
    font-size: 16px;
    cursor: pointer;
    transition: all 0.3s;
    box-sizing: border-box;
    min-width: 120px;
    text-align: center;
}

.cashfree-btn-cancel {
    background-color: #fff;
    color: #333;
    border: 1px solid #ddd;
}

.cashfree-btn-cancel:hover {
    background-color: #f5f5f5;
}

.cashfree-btn-submit {
    background-color: #672fd8;
    color: white;
    border: none;
}

.cashfree-btn-submit:hover {
    background-color: #5a29c2;
}

/* Validation Styles */
.was-validated input:invalid {
    border-color: #dc3545;
}

.was-validated input:valid {
    border-color: #28a745;
}

/* Responsive Styles */
@media (max-width: 600px) {
    .cashfree-modal-content {
        margin: 10% auto;
        width: 95%;
    }
    .cashfree-modal-header {
        /* Ensure padding is still sufficient on smaller screens */
        padding: 15px 50px 15px 15px; /* Smaller padding, but still explicit space on right */
        min-height: 100px; /* May need more height if content wraps */
        flex-direction: column; /* Stack items for mobile */
        align-items: flex-start; /* Align content to the left when stacked */
    }
    .cashfree-header-content {
         padding-left: 0; /* No need for left padding if logo is centered above */
        padding-top: 60px; /* Ensure space below logo */
        text-align: center; /* Center header text */
    }
    
    .cashfree-logo {
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
    }
    .cashfree-close {
        /* Keep it absolute, but perhaps adjust its position relative to the new header layout */
        right: 15px;
        top: 15px; /* Adjust top if needed for better mobile placement */
        transform: none; /* Remove transform if no longer centering */
    }
    .cashfree-modal-footer {
        justify-content: center;
    }
    
    .cashfree-btn {
        width: 100%;
    }
}