/**
 * RTL (Right-to-Left) Support for Arabic Language
 * OtiPlan - Education Tracking and Management System
 */

/* Base RTL Direction */
html[dir="rtl"],
body.rtl {
    direction: rtl;
    text-align: right;
}

/* Sidebar RTL */
.rtl .deznav {
    right: 0;
    left: auto;
}

.rtl .content-body {
    margin-right: 16.25rem;
    margin-left: 0;
}

.rtl .nav-header {
    right: 0;
    left: auto;
}

/* Header RTL */
.rtl .header {
    padding-right: 16.25rem;
    padding-left: 0;
}

.rtl .header-right {
    float: left;
}

.rtl .header-left {
    float: right;
}

/* Navigation Menu RTL */
.rtl .metismenu li>a {
    padding-right: 1.5rem;
    padding-left: 0;
}

.rtl .metismenu li>a svg,
.rtl .metismenu li>a i {
    margin-left: 0.75rem;
    margin-right: 0;
}

.rtl .metismenu .has-arrow::after {
    right: auto;
    left: 1.5rem;
    transform: rotate(135deg);
}

.rtl .metismenu .mm-active>.has-arrow::after {
    transform: rotate(-45deg);
}

/* Dropdown RTL */
.rtl .dropdown-menu {
    text-align: right;
    right: 0;
    left: auto;
}

.rtl .dropdown-menu-end {
    right: auto;
    left: 0;
}

/* Forms RTL */
.rtl .form-control,
.rtl .form-select {
    text-align: right;
}

.rtl .input-group>.form-control,
.rtl .input-group>.form-select {
    border-radius: 0 0.375rem 0.375rem 0;
}

.rtl .input-group>.input-group-text:first-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

.rtl .form-check {
    padding-right: 1.5em;
    padding-left: 0;
}

.rtl .form-check-input {
    float: right;
    margin-right: -1.5em;
    margin-left: 0;
}

/* Tables RTL */
.rtl .table th,
.rtl .table td {
    text-align: right;
}

.rtl .dataTables_wrapper .dataTables_filter {
    float: left;
}

.rtl .dataTables_wrapper .dataTables_length {
    float: right;
}

.rtl .dataTables_wrapper .dataTables_info {
    float: right;
}

.rtl .dataTables_wrapper .dataTables_paginate {
    float: left;
}

/* Buttons RTL */
.rtl .btn-group>.btn:first-child {
    border-radius: 0 0.375rem 0.375rem 0;
}

.rtl .btn-group>.btn:last-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

.rtl .btn i,
.rtl .btn svg {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Cards RTL */
.rtl .card-header {
    text-align: right;
}

.rtl .card-title {
    text-align: right;
}

/* Alerts RTL */
.rtl .alert {
    text-align: right;
}

.rtl .alert-dismissible {
    padding-right: 1rem;
    padding-left: 3rem;
}

.rtl .alert-dismissible .btn-close {
    right: auto;
    left: 0;
}

/* Breadcrumb RTL */
.rtl .breadcrumb {
    flex-direction: row-reverse;
}

.rtl .breadcrumb-item+.breadcrumb-item::before {
    float: right;
    padding-left: 0.5rem;
    padding-right: 0;
}

/* Modal RTL */
.rtl .modal-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

/* List Group RTL */
.rtl .list-group {
    padding-right: 0;
}

/* Pagination RTL */
.rtl .pagination {
    flex-direction: row-reverse;
}

/* Badge RTL */
.rtl .badge {
    margin-left: 0;
    margin-right: 0.25rem;
}

/* Toast RTL */
.rtl .toast {
    text-align: right;
}

/* Tooltip RTL */
.rtl .tooltip {
    text-align: right;
}

/* Progress RTL */
.rtl .progress-bar {
    float: right;
}

/* Accordion RTL */
.rtl .accordion-button::after {
    margin-right: auto;
    margin-left: 0;
}

/* Tabs RTL */
.rtl .nav-tabs,
.rtl .nav-pills {
    flex-direction: row-reverse;
}

/* Calendar RTL (FullCalendar) */
.rtl .fc {
    direction: rtl;
}

.rtl .fc-toolbar {
    flex-direction: row-reverse;
}

/* Chart RTL */
.rtl .chart-legend {
    text-align: right;
}

/* Custom Components RTL */
.rtl .widget-stat .media-body {
    text-align: right;
}

.rtl .activity-timeline::before {
    right: 1.5rem;
    left: auto;
}

.rtl .activity-timeline li {
    padding-right: 3rem;
    padding-left: 0;
}

/* Sidebar Toggle RTL */
.rtl.menu-toggle .deznav {
    right: -16.25rem;
}

.rtl.menu-toggle .content-body {
    margin-right: 0;
}

.rtl.menu-toggle .header {
    padding-right: 0;
}

/* Responsive RTL */
@media (max-width: 991.98px) {
    .rtl .content-body {
        margin-right: 0;
    }

    .rtl .header {
        padding-right: 0;
    }

    .rtl .deznav {
        right: -16.25rem;
    }

    .rtl.menu-toggle .deznav {
        right: 0;
    }
}

/* Language Switcher RTL */
.rtl .language-switcher .dropdown-menu {
    text-align: right;
}

.rtl .language-switcher .dropdown-item img {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Notification RTL */
.rtl .notification-list li {
    text-align: right;
}

/* Search RTL */
.rtl .search-area .form-control {
    padding-right: 2.5rem;
    padding-left: 1rem;
}

.rtl .search-area .input-group-text {
    right: 0;
    left: auto;
}

/* Footer RTL */
.rtl .footer {
    text-align: right;
}

/* Misc RTL Fixes */
.rtl .me-1,
.rtl .me-2,
.rtl .me-3,
.rtl .me-4,
.rtl .me-5 {
    margin-right: 0 !important;
}

.rtl .ms-1,
.rtl .ms-2,
.rtl .ms-3,
.rtl .ms-4,
.rtl .ms-5 {
    margin-left: 0 !important;
}

.rtl .me-1 {
    margin-left: 0.25rem !important;
}

.rtl .me-2 {
    margin-left: 0.5rem !important;
}

.rtl .me-3 {
    margin-left: 1rem !important;
}

.rtl .me-4 {
    margin-left: 1.5rem !important;
}

.rtl .me-5 {
    margin-left: 3rem !important;
}

.rtl .ms-1 {
    margin-right: 0.25rem !important;
}

.rtl .ms-2 {
    margin-right: 0.5rem !important;
}

.rtl .ms-3 {
    margin-right: 1rem !important;
}

.rtl .ms-4 {
    margin-right: 1.5rem !important;
}

.rtl .ms-5 {
    margin-right: 3rem !important;
}

.rtl .pe-1,
.rtl .pe-2,
.rtl .pe-3,
.rtl .pe-4,
.rtl .pe-5 {
    padding-right: 0 !important;
}

.rtl .ps-1,
.rtl .ps-2,
.rtl .ps-3,
.rtl .ps-4,
.rtl .ps-5 {
    padding-left: 0 !important;
}

.rtl .pe-1 {
    padding-left: 0.25rem !important;
}

.rtl .pe-2 {
    padding-left: 0.5rem !important;
}

.rtl .pe-3 {
    padding-left: 1rem !important;
}

.rtl .pe-4 {
    padding-left: 1.5rem !important;
}

.rtl .pe-5 {
    padding-left: 3rem !important;
}

.rtl .ps-1 {
    padding-right: 0.25rem !important;
}

.rtl .ps-2 {
    padding-right: 0.5rem !important;
}

.rtl .ps-3 {
    padding-right: 1rem !important;
}

.rtl .ps-4 {
    padding-right: 1.5rem !important;
}

.rtl .ps-5 {
    padding-right: 3rem !important;
}

.rtl .text-start {
    text-align: right !important;
}

.rtl .text-end {
    text-align: left !important;
}

.rtl .float-start {
    float: right !important;
}

.rtl .float-end {
    float: left !important;
}


/* ═══════════════════════════════════════ */
/* Mercury / Tailwind RTL Overrides       */
/* ═══════════════════════════════════════ */

/* Sidebar RTL: anchor right, slide from right */
.rtl aside[class*="fixed"][class*="start-0"] {
    right: 0;
    left: auto;
}

/* Content body RTL: margin-right instead of margin-left */
.rtl .content-body {
    margin-left: 0;
}

/* Nav header RTL: anchor right */
.rtl div[class*="fixed"][class*="start-0"][class*="w-sidebar"] {
    right: 0;
    left: auto;
}

/* Header RTL: inset-inline-start mirror */
.rtl header[class*="fixed"][class*="start-0"] {
    left: 0;
    right: 0;
}

/* Hamburger menu RTL: flip margin */
.rtl .lg\\:hidden[class*="ml-auto"] {
    margin-left: 0;
    margin-right: auto;
}