/* RTL Support for Filament Admin Panel */

/* Import Cairo font */
@import url('https://fonts.googleapis.com/css2?family=Cairo:wght@300;400;500;600;700&display=swap');

/* Global RTL settings */
html[dir="rtl"] {
    direction: rtl;
}

html[dir="rtl"] body {
    font-family: 'Cairo', 'Segoe UI', 'Tahoma', 'Arial', sans-serif;
    direction: rtl;
}

/* Filament Layout RTL */
html[dir="rtl"] .fi-sidebar {
    right: 0;
    left: auto;
    border-right: 1px solid rgb(229 231 235);
    border-left: none;
}

html[dir="rtl"] .fi-main {
    margin-right: 0;
    margin-left: auto;
}

html[dir="rtl"] .fi-content {
    direction: rtl;
}

/* Navigation RTL */
html[dir="rtl"] .fi-sidebar-nav {
    direction: rtl;
}

html[dir="rtl"] .fi-sidebar-nav-item {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .fi-sidebar-nav-item-icon {
    margin-left: 0.75rem;
    margin-right: 0;
}

html[dir="rtl"] .fi-sidebar-nav-item-label {
    margin-left: 0.75rem;
    margin-right: 0;
}

/* Topbar RTL */
html[dir="rtl"] .fi-topbar {
    direction: rtl;
}

html[dir="rtl"] .fi-topbar-nav {
    direction: rtl;
}

/* Forms RTL */
html[dir="rtl"] .fi-form {
    direction: rtl;
}

html[dir="rtl"] .fi-form-label {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .fi-input {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .fi-select {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .fi-textarea {
    text-align: right;
    direction: rtl;
}

/* Buttons RTL */
html[dir="rtl"] .fi-btn {
    direction: rtl;
}

html[dir="rtl"] .fi-btn-group {
    direction: rtl;
}

/* Tables RTL */
html[dir="rtl"] .fi-table {
    direction: rtl;
}

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

html[dir="rtl"] .fi-table-actions {
    direction: rtl;
}

html[dir="rtl"] .fi-table-actions .fi-btn {
    margin-left: 0.25rem;
    margin-right: 0;
}

html[dir="rtl"] .fi-table-actions .fi-btn:first-child {
    margin-left: 0.25rem;
    margin-right: 0;
}

html[dir="rtl"] .fi-table-actions .fi-btn:last-child {
    margin-left: 0;
    margin-right: 0.25rem;
}

/* Modals RTL */
html[dir="rtl"] .fi-modal {
    direction: rtl;
}

html[dir="rtl"] .fi-modal-header {
    text-align: right;
}

html[dir="rtl"] .fi-modal-body {
    direction: rtl;
}

html[dir="rtl"] .fi-modal-footer {
    direction: rtl;
}

/* Dropdowns RTL */
html[dir="rtl"] .fi-dropdown {
    direction: rtl;
}

/* Breadcrumbs RTL */
html[dir="rtl"] .fi-breadcrumbs {
    direction: rtl;
}

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

/* Login page specific fixes */
html[dir="rtl"] .fi-simple-page {
    direction: rtl;
}

html[dir="rtl"] .fi-simple-page .fi-form {
    direction: rtl;
}

html[dir="rtl"] .fi-simple-page .fi-form-label {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .fi-simple-page .fi-input {
    text-align: right;
    direction: rtl;
}

html[dir="rtl"] .fi-simple-page .fi-checkbox {
    direction: rtl;
}

html[dir="rtl"] .fi-simple-page .fi-checkbox-label {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Fix for the large eye icon issue */
html[dir="rtl"] .fi-input-wrapper .fi-input-suffix {
    right: auto;
    left: 0.75rem;
}

html[dir="rtl"] .fi-input-wrapper .fi-input-prefix {
    left: auto;
    right: 0.75rem;
}

/* Ensure proper spacing and alignment */
html[dir="rtl"] .fi-form-field {
    direction: rtl;
}

html[dir="rtl"] .fi-form-field-label {
    text-align: right;
}

html[dir="rtl"] .fi-form-field-error {
    text-align: right;
}

/* Fix button alignment */
html[dir="rtl"] .fi-simple-page-actions {
    direction: rtl;
}

html[dir="rtl"] .fi-simple-page-actions .fi-btn {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .fi-simple-page-actions .fi-btn:first-child {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .fi-simple-page-actions .fi-btn:last-child {
    margin-left: 0;
    margin-right: 0;
}

/* Additional login page fixes */
html[dir="rtl"] .fi-simple-page-header {
    text-align: right;
}

html[dir="rtl"] .fi-simple-page-header .fi-heading {
    text-align: right;
}

/* Fix checkbox positioning */
html[dir="rtl"] .fi-checkbox {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .fi-checkbox-label {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Fix input icon sizing */
html[dir="rtl"] .fi-input-wrapper .fi-input-suffix svg {
    width: 1rem;
    height: 1rem;
}

/* Ensure proper form spacing */
html[dir="rtl"] .fi-form-field + .fi-form-field {
    margin-top: 1rem;
}

/* Fix form actions spacing */
html[dir="rtl"] .fi-form-actions {
    direction: rtl;
    text-align: right;
}

html[dir="rtl"] .fi-form-actions .fi-btn {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .fi-form-actions .fi-btn:first-child {
    margin-left: 0.5rem;
    margin-right: 0;
}

html[dir="rtl"] .fi-form-actions .fi-btn:last-child {
    margin-left: 0;
    margin-right: 0;
}

/* Hide guard name field in Shield role forms - Multiple selectors to ensure it's hidden */
input[name="guard_name"] {
    display: none !important;
}

.fi-input[name="guard_name"] {
    display: none !important;
}

.fi-form-field:has(input[name="guard_name"]) {
    display: none !important;
}

/* Hide the entire field wrapper for guard name */
.fi-form-field:has([name="guard_name"]) {
    display: none !important;
}

/* Alternative approach - hide by label text */
.fi-form-field:has(label:contains("اسم الحارس")) {
    display: none !important;
}

.fi-form-field:has(label:contains("Guard Name")) {
    display: none !important;
}

/* Hide the grid column containing guard name */
.fi-form-field:has(input[name="guard_name"]),
.fi-form-field:has([name="guard_name"]) {
    display: none !important;
}

/* More aggressive hiding - hide any field with guard name */
.fi-form-field {
    &:has(input[name="guard_name"]) {
        display: none !important;
    }
    &:has([name="guard_name"]) {
        display: none !important;
    }
}

/* Additional CSS to ensure guard name is hidden */
[data-field="guard_name"] {
    display: none !important;
}

.fi-form-field[data-field="guard_name"] {
    display: none !important;
}

/* Hide guard name column from roles table/list */
.fi-table th[data-column="guard_name"],
.fi-table td[data-column="guard_name"] {
    display: none !important;
}

/* Hide guard name column by header text */
.fi-table th:has-text("Guard Name"),
.fi-table th:has-text("اسم الحارس") {
    display: none !important;
}

/* Alternative approach - hide by column index or data attribute */
.fi-table thead th:nth-child(2),
.fi-table tbody td:nth-child(2) {
    display: none !important;
}

/* More specific selectors for Filament tables */
.fi-table .fi-table-header-cell:contains("Guard Name"),
.fi-table .fi-table-header-cell:contains("اسم الحارس") {
    display: none !important;
}

.fi-table .fi-table-cell:contains("admin"),
.fi-table .fi-table-cell:contains("web") {
    display: none !important;
}
