
/* Apply direction LTR to the table within the RTL container */
body.rtl div.xdsoft_calendar > table {
    width: 100%;
    border-collapse: collapse;
    direction: ltr; /* Ensures numbers display in left-to-right order */
}

/* Keep header text aligned to the right */
body.rtl div.xdsoft_calendar > table thead th {
    text-align: center; /* Right-aligns text in header for RTL */
}

/* Move the last <th> to appear as the first */
body.rtl div.xdsoft_calendar > table thead th:last-child {
    order: -1;
}

/* Reset table display for correct column structure */
body.rtl div.xdsoft_calendar > table {
    width: 100%;
    border-collapse: collapse;
}

/* Apply flex-like ordering while keeping table layout */
body.rtl div.xdsoft_calendar > table thead {
    margin-left: 35px;
    display: table-caption;
}

body.rtl div.xdsoft_calendar > table thead th {
    display: table-cell;
    text-align: center;
}

/* Move the last th to the first position */
body.rtl div.xdsoft_calendar > table thead th:last-child {
    position: relative;
    order: -1; /* This may not work with display: table-cell */
}

/* Specific solution to force the last column to appear first */
body.rtl div.xdsoft_calendar > table thead th:nth-child(7) {
    position: absolute;
    left: 16px;
}

/* Adjust the rest of the columns */
body.rtl div.xdsoft_calendar > table thead th:nth-child(n):not(:nth-child(7)) {
    margin-left: auto;
    width: 37px;
}
