/* RTL & LTR Support Enhancements */

[dir="rtl"] {
    --text-align: right;
    --direction: rtl;
    --sidebar-pos: right;
    --sidebar-offset: left;
}

[dir="ltr"] {
    --text-align: left;
    --direction: ltr;
    --sidebar-pos: left;
    --sidebar-offset: right;
}

body {
    text-align: var(--text-align);
    direction: var(--direction);
}

[dir="rtl"] .sidebar {
    right: 0;
    left: auto;
}

[dir="ltr"] .sidebar {
    left: 0;
    right: auto;
}

.main-wrapper {
    transition: var(--transition);
}

[dir="rtl"] .main-wrapper {
    margin-right: 0 !important;
    margin-left: 0 !important;
}

[dir="ltr"] .main-wrapper {
    margin-left: 0 !important;
    margin-right: 0 !important;
}

[dir="rtl"] .main-content {
    margin-right: var(--sidebar-width);
}

[dir="ltr"] .main-content {
    margin-left: var(--sidebar-width);
}

@media (max-width: 992px) {
    .main-wrapper {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }

    [dir="rtl"] .main-content, [dir="ltr"] .main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
        width: 100% !important;
    }

    /* RTL: sidebar comes from the right */
    [dir="rtl"] .sidebar {
        transform: translateX(100%);
        right: 0;
        left: auto;
    }

    /* LTR: sidebar comes from the left */
    [dir="ltr"] .sidebar {
        transform: translateX(-100%);
        left: 0;
        right: auto;
    }

    .sidebar.show {
        transform: translateX(0) !important;
    }

    /* Top header bar: full width on mobile */
    [dir="rtl"] .top-header-bar,
    [dir="ltr"] .top-header-bar {
        right: 0 !important;
        left: 0 !important;
        width: 100% !important;
    }
}

.nav-item i {
    margin-inline-end: 12px;
    margin-inline-start: 0;
}

/* Language Switcher Position */
.language-switcher {
    position: fixed;
    top: 1.25rem;
    z-index: 1060;
}

[dir="rtl"] .language-switcher {
    left: 2rem;
    right: auto;
}

[dir="ltr"] .language-switcher {
    right: 2rem;
    left: auto;
}

/* Form Elements */
.form-check {
    padding-inline-start: 1.5em;
    padding-inline-end: 0;
}

.form-check-input {
    margin-inline-start: -1.5em;
    margin-inline-end: 0;
}

/* Tables */
.tickets-table th, .tickets-table td {
    text-align: var(--text-align);
}

/* Dropdowns */
.dropdown-menu {
    inset-inline-end: 0;
    inset-inline-start: auto;
    text-align: var(--text-align);
}

[dir="ltr"] .dropdown-menu {
    inset-inline-start: 0;
    inset-inline-end: auto;
}