/* RTL Fixes for Hebrew Interface */
/* AID Enterprise System - Bilingual Support */

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

/* Grid RTL Support */
.rtl .grid,
[dir="rtl"] .grid {
    direction: rtl;
}

/* Flexbox RTL Support */
.rtl .flex,
[dir="rtl"] .flex {
    direction: rtl;
}

.rtl .flex-row-reverse,
[dir="rtl"] .flex-row-reverse {
    flex-direction: row-reverse !important;
}

/* Form Elements RTL */
.rtl input[type="text"],
.rtl input[type="email"],
.rtl input[type="password"],
.rtl input[type="number"],
.rtl input[type="tel"],
.rtl textarea,
.rtl select,
[dir="rtl"] input[type="text"],
[dir="rtl"] input[type="email"],
[dir="rtl"] input[type="password"],
[dir="rtl"] input[type="number"],
[dir="rtl"] input[type="tel"],
[dir="rtl"] textarea,
[dir="rtl"] select {
    text-align: right;
    direction: rtl;
}

/* Table RTL Support */
.rtl table,
[dir="rtl"] table {
    direction: rtl;
}

.rtl th,
.rtl td,
[dir="rtl"] th,
[dir="rtl"] td {
    text-align: right;
}

/* Button Groups RTL */
.rtl .btn-group,
[dir="rtl"] .btn-group {
    direction: rtl;
}

/* Modal RTL Alignment */
.rtl .modal-header,
.rtl .modal-body,
.rtl .modal-footer,
[dir="rtl"] .modal-header,
[dir="rtl"] .modal-body,
[dir="rtl"] .modal-footer {
    text-align: right;
    direction: rtl;
}

/* Navigation RTL */
.rtl nav,
[dir="rtl"] nav {
    direction: rtl;
}

.rtl .nav-tabs,
[dir="rtl"] .nav-tabs {
    flex-direction: row-reverse;
}

/* Dropdown RTL */
.rtl .dropdown-menu,
[dir="rtl"] .dropdown-menu {
    text-align: right;
    right: 0 !important;
    left: auto !important;
}

/* Icons and Spacing RTL */
.rtl .icon-left,
[dir="rtl"] .icon-left {
    margin-left: 0;
    margin-right: 0.5rem;
}

.rtl .icon-right,
[dir="rtl"] .icon-right {
    margin-right: 0;
    margin-left: 0.5rem;
}

/* Space utilities RTL */
.rtl .space-x-2 > * + *,
[dir="rtl"] .space-x-2 > * + * {
    margin-left: 0;
    margin-right: 0.5rem;
}

.rtl .space-x-4 > * + *,
[dir="rtl"] .space-x-4 > * + * {
    margin-left: 0;
    margin-right: 1rem;
}

/* Hebrew Font */
.hebrew-font {
    font-family: 'Noto Sans Hebrew', 'Segoe UI', Tahoma, sans-serif;
}

/* English Font */
.english-font {
    font-family: 'Inter', 'Segoe UI', Tahoma, sans-serif;
}

/* Quick Actions Grid RTL */
.rtl .quick-actions-grid {
    display: grid;
    direction: rtl;
}

/* Form Label-Input Alignment for RTL */
.rtl .form-row,
[dir="rtl"] .form-row {
    display: flex;
    flex-direction: row-reverse;
    gap: 1rem;
    align-items: center;
}

.rtl .form-label,
[dir="rtl"] .form-label {
    text-align: right;
    min-width: 150px;
}

/* Modal Buttons RTL Order */
.rtl .modal-footer,
[dir="rtl"] .modal-footer {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-start;
    gap: 0.5rem;
}

/* Tab Navigation RTL */
.rtl .tab-navigation,
[dir="rtl"] .tab-navigation {
    display: flex;
    flex-direction: row-reverse;
    justify-content: flex-start;
}

/* Breadcrumb RTL */
.rtl .breadcrumb,
[dir="rtl"] .breadcrumb {
    direction: rtl;
}

.rtl .breadcrumb-item + .breadcrumb-item::before,
[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    content: "/";
    transform: rotate(180deg);
}

/* Card RTL Support */
.rtl .card,
[dir="rtl"] .card {
    text-align: right;
}

.rtl .card-header,
.rtl .card-body,
.rtl .card-footer,
[dir="rtl"] .card-header,
[dir="rtl"] .card-body,
[dir="rtl"] .card-footer {
    text-align: right;
}

/* Alert RTL Support */
.rtl .alert,
[dir="rtl"] .alert {
    text-align: right;
    direction: rtl;
}

/* List RTL Support */
.rtl ul,
.rtl ol,
[dir="rtl"] ul,
[dir="rtl"] ol {
    padding-right: 2rem;
    padding-left: 0;
}

/* Pagination RTL */
.rtl .pagination,
[dir="rtl"] .pagination {
    direction: rtl;
}

/* Badge RTL Position */
.rtl .badge,
[dir="rtl"] .badge {
    margin-left: 0.25rem;
    margin-right: 0;
}

/* Tooltip RTL */
.rtl .tooltip,
[dir="rtl"] .tooltip {
    text-align: right;
}

/* Progress Bar RTL */
.rtl .progress,
[dir="rtl"] .progress {
    direction: rtl;
}

/* Sidebar RTL */
.rtl .sidebar,
[dir="rtl"] .sidebar {
    text-align: right;
    direction: rtl;
}

/* Utility Classes */
.text-right-rtl {
    text-align: right !important;
}

.text-left-ltr {
    text-align: left !important;
}

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

.float-left-ltr {
    float: left !important;
}