body {
    font-family: 'Noto Sans Arabic', Arial, sans-serif; /* Added Arabic font */
    margin: 0;
    padding: 20px;
    background-color: #f4f4f4;
    direction: rtl; /* Ensure RTL for the entire page */
    text-align: right; /* Default text alignment to right */
}

.container {
    max-width: 800px;
    margin: 0 auto;
    background: white;
    padding: 20px;
    border-radius: 8px;
    box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
    text-align: right; /* Ensure container content aligns right */
}

h1, h2, h3 {
    color: #333;
    text-align: right; /* Headings aligned right */
}

button {
    padding: 10px 20px;
    background-color: #007bff;
    color: white;
    border: none;
    border-radius: 4px;
    cursor: pointer;
}

button:hover {
    background-color: #0056b3;
}

form {
    margin: 10px 0;
    text-align: right; /* Ensure form elements align right */
}

input, select {
    padding: 8px;
    margin-left: 10px; /* Changed from margin-right to margin-left for RTL */
    border: 1px solid #ddd;
    border-radius: 4px;
    direction: rtl; /* Ensure input and select fields are RTL */
    text-align: right; /* Text inside inputs/selects aligned right */
}

.role-section {
    margin-top: 20px;
    text-align: right; /* Ensure role sections align right */
}

ul {
    list-style-type: none;
    padding: 0;
    margin-right: 0; /* Reset padding/margin for RTL */
    margin-left: 20px; /* Add left margin for RTL bullet-like spacing if needed */
}

li {
    padding: 5px 0;
    text-align: right; /* List items aligned right */
}

.financial-summary-table {
    width: 100%;
    border-collapse: collapse;
    margin-bottom: 20px;
}

.financial-summary-table th, .financial-summary-table td {
    border: 1px solid #ddd;
    padding: 8px;
    text-align: right; /* Changed from left to right for RTL */
}

.financial-summary-table th {
    background-color: #f2f2f2;
}

.total-voucher-value {
    background-color: #e6f3ff;
    color: #004085;
}

.redeemed-voucher-value {
    background-color: #f8d7da;
    color: #721c24;
}

.total-payments {
    background-color: #d4edda;
    color: #155724;
}

.balance-positive {
    background-color: #ccffcc;
    color: #006600;
}

.balance-negative {
    background-color: #ffcccc;
    color: #660000;
}

/* Additional RTL Adjustments */
html {
    direction: rtl; /* Ensure RTL at the root level */
}

.action-buttons {
    text-align: right; /* Ensure action buttons align right */
}

#qr-print-area {
    position: fixed;
    top: 0;
    right: 0; /* Adjusted for RTL */
    left: auto;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.8);
    z-index: 1000;
    overflow-y: auto;
}

/* Ensure tables are fully RTL */
table th, table td {
    text-align: right;
}

/* Media Queries for Responsiveness (if needed) */
@media (max-width: 600px) {
    .container {
        padding: 10px;
    }
    input, select {
        margin-left: 5px; /* Adjusted for smaller screens */
        width: 100%; /* Full width for inputs on small screens */
        margin-bottom: 10px;
    }
    button {
        width: 100%; /* Full width buttons on small screens */
        margin-bottom: 10px;
    }
}