/* RTL (Right-to-Left) Stylesheet for Persian Language Support */

.rtl {
    direction: rtl;
    text-align: right;
}

/* Bootstrap Overrides for RTL */
.rtl .container,
.rtl .container-fluid {
    text-align: right;
}

.rtl .row {
    direction: rtl;
}

.rtl .col,
.rtl .col-1, .rtl .col-2, .rtl .col-3, .rtl .col-4, .rtl .col-5, .rtl .col-6,
.rtl .col-7, .rtl .col-8, .rtl .col-9, .rtl .col-10, .rtl .col-11, .rtl .col-12,
.rtl .col-md, .rtl .col-md-1, .rtl .col-md-2, .rtl .col-md-3, .rtl .col-md-4,
.rtl .col-md-5, .rtl .col-md-6, .rtl .col-md-7, .rtl .col-md-8, .rtl .col-md-9,
.rtl .col-md-10, .rtl .col-md-11, .rtl .col-md-12 {
    text-align: right;
}

/* Navigation */
.rtl .navbar-brand {
    margin-right: 0;
    margin-left: 1rem;
}

.rtl .navbar-nav {
    text-align: right;
}

.rtl .navbar-nav .nav-link {
    text-align: right;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
}

.rtl .dropdown-menu {
    text-align: right;
    right: 0;
    left: auto;
}

.rtl .dropdown-item {
    text-align: right;
}

/* Sidebar */
.rtl .sidebar {
    text-align: right;
    border-right: none;
    border-left: 1px solid #dee2e6;
}

.rtl .sidebar .nav-link {
    text-align: right;
    padding-right: 1rem;
    padding-left: 0.5rem;
}

.rtl .sidebar .nav-link i {
    margin-left: 0.5rem;
    margin-right: 0;
}

.rtl .sidebar-heading {
    text-align: right;
    padding-right: 0.75rem;
    padding-left: 0.75rem;
}

/* Forms */
.rtl .form-control,
.rtl .form-select,
.rtl textarea,
.rtl input[type="text"],
.rtl input[type="email"],
.rtl input[type="password"],
.rtl input[type="date"],
.rtl input[type="file"] {
    text-align: right;
    direction: rtl;
}

.rtl .form-label {
    text-align: right;
}

.rtl .form-text {
    text-align: right;
}

.rtl .input-group .form-control {
    border-radius: 0 0.375rem 0.375rem 0;
}

.rtl .input-group-text {
    border-radius: 0.375rem 0 0 0.375rem;
}

/* Cards */
.rtl .card-header,
.rtl .card-body,
.rtl .card-footer {
    text-align: right;
}

.rtl .card-title {
    text-align: right;
}

.rtl .card-text {
    text-align: right;
}

/* Buttons and Button Groups */
.rtl .btn {
    text-align: center;
}

.rtl .btn-group {
    direction: ltr; /* Keep button groups LTR for better UX */
}

.rtl .btn-group .btn {
    text-align: center;
}

/* Badges and Labels */
.rtl .badge {
    margin-left: 0.25rem;
    margin-right: 0;
}

/* Tables */
.rtl .table {
    text-align: right;
}

.rtl .table th,
.rtl .table td {
    text-align: right;
}

/* Modals */
.rtl .modal-header {
    text-align: right;
}

.rtl .modal-body {
    text-align: right;
}

.rtl .modal-footer {
    text-align: right;
    justify-content: flex-start;
}

.rtl .modal-title {
    text-align: right;
}

/* Alerts */
.rtl .alert {
    text-align: right;
}

/* List Groups */
.rtl .list-group-item {
    text-align: right;
}

/* Progress Bars */
.rtl .progress {
    direction: ltr; /* Keep progress bars LTR */
}

/* Breadcrumbs */
.rtl .breadcrumb {
    text-align: right;
    flex-direction: row-reverse;
}

.rtl .breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-left: 0;
    padding-right: 0.5rem;
    content: "‹"; /* Use left-pointing chevron for RTL */
}

/* Tabs */
.rtl .nav-tabs {
    direction: rtl;
}

.rtl .nav-tabs .nav-link {
    text-align: right;
}

/* Workflow-specific RTL styles */
.rtl .work-card {
    border-right: 4px solid transparent;
    border-left: none;
}

.rtl .work-card.priority-high { 
    border-right-color: #dc3545; 
}

.rtl .work-card.priority-medium { 
    border-right-color: #ffc107; 
}

.rtl .work-card.priority-low { 
    border-right-color: #28a745; 
}

.rtl .created-work-card {
    border-right: 4px solid;
    border-left: none;
}

.rtl .notification-item {
    text-align: right;
    border-right: 3px solid #007bff;
    border-left: none;
}

.rtl .notification-item.unread {
    border-right-color: #dc3545;
}

.rtl .stats-card {
    text-align: center; /* Keep stats centered */
}

.rtl .stats-card .card-body {
    text-align: center;
}

/* Icon positioning for RTL */
.rtl i.fas,
.rtl i.far,
.rtl i.fab {
    margin-left: 0.25rem;
    margin-right: 0;
}

.rtl .nav-link i {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Text utilities for RTL */
.rtl .text-left {
    text-align: right !important;
}

.rtl .text-right {
    text-align: left !important;
}

.rtl .float-left {
    float: right !important;
}

.rtl .float-right {
    float: left !important;
}

/* Margin and padding adjustments */
.rtl .me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}

.rtl .ms-2 {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}

.rtl .me-3 {
    margin-left: 1rem !important;
    margin-right: 0 !important;
}

.rtl .ms-3 {
    margin-right: 1rem !important;
    margin-left: 0 !important;
}

.rtl .pe-2 {
    padding-left: 0.5rem !important;
    padding-right: 0 !important;
}

.rtl .ps-2 {
    padding-right: 0.5rem !important;
    padding-left: 0 !important;
}

.rtl .pe-3 {
    padding-left: 1rem !important;
    padding-right: 0 !important;
}

.rtl .ps-3 {
    padding-right: 1rem !important;
    padding-left: 0 !important;
}

/* Calendar-specific RTL styles */
.rtl .calendar-day {
    text-align: right;
}

.rtl .calendar-day-header {
    text-align: right;
}

/* Communications/CRM RTL styles */
.rtl .table-responsive {
    direction: rtl;
}

.rtl .table-responsive .table {
    text-align: right;
}

/* Workflow specific RTL adjustments */
.rtl .priority-high {
    border-right: 4px solid #dc3545;
    border-left: none;
}

.rtl .priority-medium {
    border-right: 4px solid #ffc107;
    border-left: none;
}

.rtl .priority-low {
    border-right: 4px solid #28a745;
    border-left: none;
}

.rtl .assignment-card {
    text-align: right;
}

/* Button group adjustments for RTL */
.rtl .btn-toolbar {
    justify-content: flex-start;
}

/* Filter forms RTL */
.rtl .row.g-3 {
    text-align: right;
}

/* Pagination RTL */
.rtl .pagination {
    direction: ltr; /* Keep pagination LTR for better UX */
}

/* Tooltip and popover RTL */
.rtl .tooltip {
    text-align: right;
}

.rtl .popover {
    text-align: right;
}

/* Select2 and other third-party components RTL */
.rtl .select2-container {
    text-align: right;
}

.rtl .select2-selection {
    text-align: right;
}

/* File upload RTL */
.rtl .form-control[type="file"] {
    direction: ltr; /* File inputs work better LTR */
}

/* Checkbox and radio RTL */
.rtl .form-check {
    text-align: right;
    direction: rtl;
}

.rtl .form-check-input {
    margin-left: 0.25rem;
    margin-right: 0;
}

/* Timeline/Activity feed RTL */
.rtl .timeline {
    direction: rtl;
}

.rtl .timeline-item {
    text-align: right;
}

/* Code/pre blocks RTL override */
.rtl pre {
    direction: ltr; /* Code should remain LTR */
    text-align: left;
}

.rtl code {
    direction: ltr;
}

/* Chart/graph containers RTL */
.rtl .chart-container {
    direction: ltr; /* Charts work better LTR */
}

/* Date picker RTL */
.rtl .datepicker {
    text-align: right;
}

.rtl .datepicker-dropdown {
    right: 0;
    left: auto;
}

/* Search input RTL */
.rtl .search-input {
    text-align: right;
}

/* Status indicators RTL */
.rtl .status-indicator {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Avatar/profile image RTL */
.rtl .avatar {
    margin-left: 0.5rem;
    margin-right: 0;
}
