.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;
}

/* Drag and Drop Zone */
.edr2-paynow-dropzone {
    border: 2px dashed #71149e;
    border-radius: 8px;
    padding: 25px 15px;
    text-align: center;
    background: #fbf6ff;
    cursor: pointer;
    transition: all 0.3s ease;
    margin-bottom: 15px;
    position: relative;
}

.edr2-paynow-dropzone:hover,
.edr2-paynow-dropzone.edr2-dragover {
    background: #f3e6ff;
    border-color: #9b26d8;
    box-shadow: 0 4px 12px rgba(113, 20, 158, 0.1);
}

.edr2-paynow-dropzone-inner {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
}

.edr2-paynow-dropzone-icon {
    font-size: 32px;
    margin-bottom: 5px;
}

.edr2-paynow-dropzone-text {
    font-size: 14px;
    color: #555;
    margin: 0;
    font-weight: 500;
}

.edr2-paynow-dropzone-file-info {
    font-size: 12px;
    color: #666;
    margin: 5px 0 0 0;
    font-style: italic;
}

.edr2-paynow-thumbnail-preview {
    max-width: 120px;
    max-height: 120px;
    border-radius: 6px;
    border: 1px solid #ddd;
    margin-top: 10px;
    object-fit: contain;
    background: #fff;
    padding: 2px;
}

/* Upload Options Buttons */
.edr2-paynow-upload-options {
    display: flex;
    gap: 10px;
    margin-bottom: 15px;
}

.edr2-paynow-option-btn {
    flex: 1;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 6px;
    padding: 10px 12px;
    font-size: 13px !important;
    font-weight: 600;
    border-radius: 6px;
    border: 1px solid #ddd;
    background: #fff;
    color: #333;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edr2-paynow-option-btn:hover {
    background: #f5f5f5;
    border-color: #bbb;
    transform: translateY(-1px);
}

.edr2-paynow-option-btn:active {
    transform: translateY(0);
}

/* Action button container */
.edr2-paynow-upload-actions-wrapper {
    display: flex;
    gap: 10px;
    margin-top: 10px;
}

.edr2-paynow-upload-btn {
    background-color: #71149e !important;
    color: white !important;
    border: none !important;
    padding: 12px 24px !important;
    font-size: 15px !important;
    font-weight: bold !important;
    border-radius: 6px !important;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 5px rgba(0,0,0,0.1);
}

.edr2-paynow-upload-btn:hover:not(:disabled) {
    background-color: #580c7d !important;
    transform: translateY(-1px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.15);
}

.edr2-paynow-upload-btn:disabled {
    background-color: #ccc !important;
    cursor: not-allowed;
    box-shadow: none;
}

.edr2-paynow-cancel-file-btn {
    background-color: #f8f9fa !important;
    color: #dc3545 !important;
    border: 1px solid #dc3545 !important;
    padding: 12px 18px !important;
    font-size: 14px !important;
    font-weight: bold !important;
    border-radius: 6px !important;
    cursor: pointer;
    transition: all 0.2s ease;
}

.edr2-paynow-cancel-file-btn:hover {
    background-color: #dc3545 !important;
    color: white !important;
}

.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;
}

/* Error modal overrides */
.edr2-paynow-modal.error h2 {
    color: #dc3545;
}

.edr2-paynow-modal.error .button {
    background-color: #6c757d;
}

.edr2-paynow-modal.error .button:hover {
    background-color: #5a6268;
}

/* QR Trigger Button */
.edr2-paynow-show-qr-btn {
    background-color: #71149e !important;
    color: white !important;
    border: none !important;
    padding: 12px 30px !important;
    font-size: 16px !important;
    font-weight: bold !important;
    border-radius: 6px !important;
    cursor: pointer;
    transition: all 0.3s ease;
    box-shadow: 0 4px 6px rgba(113, 20, 158, 0.2);
}

.edr2-paynow-show-qr-btn:hover {
    background-color: #580c7d !important;
    transform: translateY(-2px);
    box-shadow: 0 6px 12px rgba(113, 20, 158, 0.3);
}

.edr2-paynow-show-qr-btn:active {
    transform: translateY(0);
}

.edr2-paynow-show-qr-btn:disabled {
    background-color: #ccc !important;
    cursor: not-allowed;
    box-shadow: none;
}

/* QR Code Modal Overlay */
.edr2-paynow-qr-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: 99999999 !important;
}

/* QR Code Modal Box */
.edr2-paynow-qr-modal {
    background: white;
    padding: 25px 30px;
    border-radius: 12px;
    max-width: 420px;
    width: 90%;
    text-align: center;
    box-shadow: 0 15px 35px rgba(0,0,0,0.3);
    position: relative;
    animation: edr2-fade-in 0.3s ease-out;
}

.edr2-paynow-qr-modal h3 {
    margin-top: 0;
    font-size: 20px;
    color: #333;
    font-weight: bold;
    margin-bottom: 5px;
}

.edr2-paynow-qr-modal-desc {
    font-size: 13px;
    color: #666;
    margin-bottom: 20px;
    line-height: 1.4;
}

/* QR Code Render Wrapper */
.edr2-paynow-qr-modal-render-wrapper {
    background: white;
    padding: 15px;
    display: inline-block;
    border: 1px solid #eee;
    border-radius: 8px;
    margin-bottom: 20px;
}

.edr2-paynow-qr-modal-render canvas,
.edr2-paynow-qr-modal-render img {
    margin: 0 auto;
    max-width: 100%;
    height: auto !important;
}

/* QR Modal Details Table */
.edr2-paynow-qr-modal-details {
    background: #f8f9fa;
    border-radius: 6px;
    padding: 12px 15px;
    margin-bottom: 20px;
}

.edr2-paynow-qr-modal-table {
    width: 100%;
    border-collapse: collapse;
    margin: 0;
}

.edr2-paynow-qr-modal-table th,
.edr2-paynow-qr-modal-table td {
    padding: 5px;
    font-size: 13px;
    text-align: left;
    border: none;
}

.edr2-paynow-qr-modal-table th {
    width: 30%;
    color: #555;
    font-weight: 600;
    text-align: left;
}

.edr2-paynow-qr-modal-table td {
    color: #222;
    text-align: left;
}

.edr2-paynow-qr-modal-table code {
    background: #e9ecef;
    padding: 2px 5px;
    border-radius: 3px;
    font-family: monospace;
    font-size: 13px;
}

/* Close 'X' Button */
.edr2-paynow-qr-modal-close-x {
    position: absolute;
    top: 15px;
    right: 15px;
    background: none;
    border: none;
    font-size: 24px;
    color: #aaa;
    cursor: pointer;
    line-height: 1;
    padding: 5px;
    transition: color 0.2s;
}

.edr2-paynow-qr-modal-close-x:hover {
    color: #555;
}

/* Close Button (Bottom) */
.edr2-paynow-qr-modal-close-btn {
    background-color: #6c757d !important;
    color: white !important;
    border: none !important;
    padding: 10px 30px !important;
    border-radius: 6px !important;
    font-size: 15px !important;
    font-weight: bold !important;
    cursor: pointer;
    transition: background-color 0.2s;
}

.edr2-paynow-qr-modal-close-btn:hover {
    background-color: #5a6268 !important;
}

/* Modal Actions layout */
.edr2-paynow-qr-modal-actions {
    margin-top: 15px;
}


/* 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;
    }
}
