.edr2-paynow-unified-container,
.edr2-paynow-container,
.edr2-paynow-wc-container {
    border: 1px solid #ddd;
    padding: 20px;
    width: 100%;
    max-width: 500px;
    margin: 20px auto; /* Center on page */
    font-family: sans-serif;
    background: #f9f9f9;
    border-radius: 8px;
    box-sizing: border-box; /* Include padding in width */
}

.edr2-paynow-qr-wrapper {
    text-align: center;
    margin: 20px 0;
    background: white;
    padding: 15px;
    display: block; /* Ensure it takes full width of container */
    width: 100%;
    box-sizing: border-box;
    border: 1px solid #eee;
    border-radius: 4px;
}

.edr2-paynow-qr-code {
    max-width: 100%;
    overflow: hidden; /* Prevent overflow */
}

.edr2-paynow-qr-code canvas,
.edr2-paynow-qr-code img {
    margin: 0 auto;
    max-width: 100%;
    height: auto !important; /* Maintain aspect ratio */
}

.edr2-paynow-qr-placeholder {
    width: 100%;
    max-width: 256px;
    height: auto;
    aspect-ratio: 1/1; /* Square aspect ratio */
    background: #f8f9fa;
    border: 3px dashed #dc3545;
    display: flex;
    align-items: center;
    justify-content: center;
    color: #dc3545;
    font-weight: bold;
    font-size: 24px;
    flex-direction: column;
    margin: 0 auto;
    text-transform: uppercase;
    box-sizing: border-box;
}

.edr2-paynow-qr-placeholder span:last-child {
    font-size: 14px;
    margin-top: 10px;
    color: #6c757d;
    text-transform: none;
    text-align: center;
    padding: 0 5px;
}

.edr2-paynow-details-table {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
    table-layout: fixed; /* Fix layout for better control */
}

.edr2-paynow-details-table th {
    text-align: left;
    padding: 8px;
    border-bottom: 1px solid #eee;
    width: 30%;
    color: #666;
    vertical-align: top;
}

.edr2-paynow-details-table td {
    padding: 8px;
    border-bottom: 1px solid #eee;
    word-wrap: break-word; /* Wrap long text */
}

.edr2-paynow-ref-text {
    font-family: monospace;
    background: #eee;
    padding: 3px 6px;
    font-weight: bold;
    border-radius: 3px;
    display: inline-block; /* Allow wrapping */
}

.edr2-paynow-copy {
    padding: 4px 10px;
    font-size: 12px;
    cursor: pointer;
    background: #f0f0f0;
    border: 1px solid #ccc;
    border-radius: 3px;
    margin-left: 10px;
    white-space: nowrap; /* Keep button text on one line */
}

.edr2-paynow-copy:hover {
    background: #e0e0e0;
}

.edr2-paynow-upload-section {
    margin-top: 20px;
    border-top: 2px solid #71149e;
    padding-top: 15px;
}

.edr2-paynow-upload-section input[type="file"] {
    max-width: 100%; /* Prevent file input overflow */
    box-sizing: border-box;
}

.edr2-paynow-upload-msg {
    margin-top: 10px;
    font-size: 14px;
}

.edr2-paynow-status-section {
    margin-top: 15px;
    padding: 10px;
    background: #e7f3ff;
    border-radius: 4px;
    color: #004085;
}

.edr2-paynow-instructions {
    margin-bottom: 15px;
    line-height: 1.5;
}

/* PayNow Verification Modal */
.edr2-paynow-modal-overlay {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    width: 100% !important;
    height: 100% !important;
    background: rgba(0, 0, 0, 0.8) !important;
    display: none;
    align-items: center;
    justify-content: center;
    z-index: 9999999 !important;
}

.edr2-paynow-modal {
    background: white;
    padding: 30px;
    border-radius: 12px;
    max-width: 450px;
    width: 90%;
    text-align: center;
    box-shadow: 0 10px 25px rgba(0,0,0,0.2);
    position: relative;
    animation: edr2-fade-in 0.3s ease-out;
}

@keyframes edr2-fade-in {
    from { opacity: 0; transform: translateY(-20px); }
    to { opacity: 1; transform: translateY(0); }
}

.edr2-paynow-modal h2 {
    color: #28a745;
    margin-top: 0;
    font-size: 24px;
}

.edr2-paynow-modal p {
    font-size: 16px;
    line-height: 1.5;
    color: #333;
    margin: 20px 0;
}

.edr2-paynow-modal .button {
    background-color: #007bff;
    color: white;
    padding: 10px 30px;
    border: none;
    border-radius: 6px;
    font-weight: bold;
    cursor: pointer;
    font-size: 16px;
    transition: background 0.2s;
}

.edr2-paynow-modal .button:hover {
    background-color: #0056b3;
}

.edr2-paynow-modal-icon {
    font-size: 50px;
    margin-bottom: 15px;
    display: block;
}

/* Media Queries for Responsive Design */
@media screen and (max-width: 480px) {
    .edr2-paynow-unified-container,
    .edr2-paynow-container,
    .edr2-paynow-wc-container {
        padding: 15px;
        margin: 10px auto;
    }

    .edr2-paynow-qr-placeholder {
        width: 100%;
        max-width: 200px; /* Smaller placeholder on mobile */
        font-size: 20px;
    }

    .edr2-paynow-details-table th,
    .edr2-paynow-details-table td {
        display: block; /* Stack table cells */
        width: 100%;
        box-sizing: border-box;
    }

    .edr2-paynow-details-table th {
        border-bottom: none; /* Remove border when stacked */
        padding-bottom: 0;
        margin-top: 10px;
        color: #333; /* Darker text for headers when stacked */
    }

    .edr2-paynow-details-table td {
        padding-top: 5px;
        padding-left: 15px; /* Indent data slightly */
    }

    .edr2-paynow-copy {
        display: inline-block;
        margin-top: 5px;
        margin-left: 0;
    }
    
    .edr2-paynow-upload-btn {
        width: 100%; /* Full width button on mobile */
        margin-top: 10px;
    }
}
