/**
 * FLZR RTL Custom Overrides
 * 
 * Bu dosya Metronic 8 RTL bundle'ı üzerine FLZR'a özgü RTL düzeltmelerini içerir.
 * Sadece is_rtl() true olduğunda yüklenir.
 * 
 * @version 1.0.0
 * @since 2025-01-26
 */

/* ==========================================================================
   1. GENERAL RTL FIXES
   ========================================================================== */

/* Text alignment overrides */
.text-start {
    text-align: right !important;
}

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

/* Float overrides */
.float-start {
    float: right !important;
}

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

/* ==========================================================================
   2. SIDEBAR / LEFT MENU RTL FIXES
   ========================================================================== */

/* Sidebar position */
.app-sidebar {
    right: 0;
    left: auto;
}

/* Sidebar toggle button */
.app-sidebar-toggle {
    left: -14px;
    right: auto;
}

/* Menu item icons */
.menu-item .menu-icon {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Menu arrows */
.menu-item .menu-arrow {
    transform: rotate(180deg);
}

.menu-item.show > .menu-link > .menu-arrow,
.menu-item.hover > .menu-link > .menu-arrow {
    transform: rotate(90deg);
}

/* Submenu positioning */
.menu-sub-dropdown {
    left: auto;
    right: 100%;
}

/* ==========================================================================
   3. HEADER RTL FIXES
   ========================================================================== */

/* Header navbar items */
.app-header .navbar-nav {
    flex-direction: row-reverse;
}

/* User profile dropdown */
.header-user-menu {
    left: 0;
    right: auto;
}

/* Search input */
.header-search .form-control {
    padding-right: 2.5rem;
    padding-left: 1rem;
}

.header-search .search-icon {
    right: 1rem;
    left: auto;
}

/* ==========================================================================
   4. FORM ELEMENTS RTL FIXES
   ========================================================================== */

/* Input groups */
.input-group > :not(:first-child):not(.dropdown-menu):not(.valid-tooltip):not(.valid-feedback):not(.invalid-tooltip):not(.invalid-feedback) {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: var(--bs-border-radius);
    border-bottom-left-radius: var(--bs-border-radius);
}

.input-group > :not(:last-child):not(.dropdown-toggle):not(.dropdown-menu):not(.form-floating) {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: var(--bs-border-radius);
    border-bottom-right-radius: var(--bs-border-radius);
}

/* Form check (checkbox/radio) */
.form-check {
    padding-right: 1.75em;
    padding-left: 0;
}

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

/* Form switch */
.form-switch {
    padding-right: 2.5em;
    padding-left: 0;
}

.form-switch .form-check-input {
    margin-right: -2.5em;
    margin-left: 0;
}

/* Select2 RTL */
.select2-container--bootstrap-5 .select2-selection--single .select2-selection__arrow {
    left: 1rem;
    right: auto;
}

.select2-container--bootstrap-5 .select2-selection--single .select2-selection__rendered {
    padding-right: 0.75rem;
    padding-left: 2rem;
}

/* ==========================================================================
   5. TABLES RTL FIXES
   ========================================================================== */

/* DataTables */
table.dataTable thead th,
table.dataTable thead td,
table.dataTable tbody th,
table.dataTable tbody td {
    text-align: right;
}

/* Sorting icons */
table.dataTable thead .sorting:before,
table.dataTable thead .sorting_asc:before,
table.dataTable thead .sorting_desc:before {
    left: 0.5rem;
    right: auto;
}

table.dataTable thead .sorting:after,
table.dataTable thead .sorting_asc:after,
table.dataTable thead .sorting_desc:after {
    left: 0;
    right: auto;
}

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

/* ==========================================================================
   6. CARDS RTL FIXES
   ========================================================================== */

/* Card header actions */
.card-header .card-toolbar {
    margin-right: auto;
    margin-left: 0;
}

/* Card with flush header */
.card.card-flush > .card-header {
    padding-right: 0;
    padding-left: 0;
}

/* ==========================================================================
   7. BUTTONS & ICONS RTL FIXES
   ========================================================================== */

/* Button with icon */
.btn .ki-outline,
.btn .ki-duotone,
.btn .ki-solid,
.btn i {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Icon only button - no margin needed */
.btn-icon .ki-outline,
.btn-icon .ki-duotone,
.btn-icon .ki-solid,
.btn-icon i {
    margin-left: 0;
    margin-right: 0;
}

/* ==========================================================================
   8. BADGES & LABELS RTL FIXES
   ========================================================================== */

/* Badge with close button */
.badge .btn-close {
    margin-right: 0.25rem;
    margin-left: -0.375rem;
}

/* ==========================================================================
   9. ALERTS & NOTIFICATIONS RTL FIXES
   ========================================================================== */

/* Alert icon */
.alert > .ki-outline:first-child,
.alert > .ki-duotone:first-child,
.alert > i:first-child {
    margin-left: 0.75rem;
    margin-right: 0;
}

/* Alert close button */
.alert .btn-close {
    left: 0;
    right: auto;
}

/* Toastr */
.toast-top-right {
    top: 12px;
    left: 12px;
    right: auto;
}

.toast-bottom-right {
    left: 12px;
    right: auto;
    bottom: 12px;
}

/* ==========================================================================
   10. MODALS & DRAWERS RTL FIXES
   ========================================================================== */

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

/* Drawer */
.drawer.drawer-end {
    left: 0;
    right: auto;
}

.drawer.drawer-start {
    right: 0;
    left: auto;
}

/* ==========================================================================
   11. TIMELINE RTL FIXES
   ========================================================================== */

/* Timeline line */
.timeline .timeline-line {
    right: 0;
    left: auto;
}

/* Timeline icon */
.timeline .timeline-icon {
    right: 0;
    left: auto;
}

/* Timeline content */
.timeline .timeline-content {
    padding-right: 3rem;
    padding-left: 0;
}

/* ==========================================================================
   12. BREADCRUMB RTL FIXES
   ========================================================================== */

/* Breadcrumb separator */
.breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-left: 0.5rem;
    padding-right: 0;
    content: "\\";
}

/* ==========================================================================
   13. DROPDOWN RTL FIXES
   ========================================================================== */

/* Dropdown menu positioning */
.dropdown-menu-end {
    --bs-position: start;
    left: 0;
    right: auto;
}

.dropdown-menu-start {
    --bs-position: end;
    right: 0;
    left: auto;
}

/* ==========================================================================
   14. FLZR SPECIFIC COMPONENT RTL FIXES
   ========================================================================== */

/* User profile card */
.user-profile-card .profile-avatar {
    margin-left: 1rem;
    margin-right: 0;
}

/* Task list items */
.task-list-item .task-checkbox {
    margin-left: 0.75rem;
    margin-right: 0;
}

/* Status badges */
.status-indicator {
    margin-left: 0.5rem;
    margin-right: 0;
}

/* Job cards */
.job-card .job-icon {
    margin-left: 1rem;
    margin-right: 0;
}

/* ==========================================================================
   15. KEENICONS RTL FIXES
   ========================================================================== */

/* Flip directional icons */
.ki-arrow-left:before {
    content: "\ea4e"; /* arrow-right */
}

.ki-arrow-right:before {
    content: "\ea4a"; /* arrow-left */
}

.ki-double-left:before {
    content: "\ea65"; /* double-right */
}

.ki-double-right:before {
    content: "\ea63"; /* double-left */
}

/* ==========================================================================
   16. SPACING UTILITIES RTL OVERRIDES
   ========================================================================== */

/* Margin start/end swap */
.ms-1 { margin-right: 0.25rem !important; margin-left: 0 !important; }
.ms-2 { margin-right: 0.5rem !important; margin-left: 0 !important; }
.ms-3 { margin-right: 1rem !important; margin-left: 0 !important; }
.ms-4 { margin-right: 1.5rem !important; margin-left: 0 !important; }
.ms-5 { margin-right: 3rem !important; margin-left: 0 !important; }
.ms-auto { margin-right: auto !important; margin-left: 0 !important; }

.me-1 { margin-left: 0.25rem !important; margin-right: 0 !important; }
.me-2 { margin-left: 0.5rem !important; margin-right: 0 !important; }
.me-3 { margin-left: 1rem !important; margin-right: 0 !important; }
.me-4 { margin-left: 1.5rem !important; margin-right: 0 !important; }
.me-5 { margin-left: 3rem !important; margin-right: 0 !important; }
.me-auto { margin-left: auto !important; margin-right: 0 !important; }

/* Padding start/end swap */
.ps-1 { padding-right: 0.25rem !important; padding-left: 0 !important; }
.ps-2 { padding-right: 0.5rem !important; padding-left: 0 !important; }
.ps-3 { padding-right: 1rem !important; padding-left: 0 !important; }
.ps-4 { padding-right: 1.5rem !important; padding-left: 0 !important; }
.ps-5 { padding-right: 3rem !important; padding-left: 0 !important; }

.pe-1 { padding-left: 0.25rem !important; padding-right: 0 !important; }
.pe-2 { padding-left: 0.5rem !important; padding-right: 0 !important; }
.pe-3 { padding-left: 1rem !important; padding-right: 0 !important; }
.pe-4 { padding-left: 1.5rem !important; padding-right: 0 !important; }
.pe-5 { padding-left: 3rem !important; padding-right: 0 !important; }

/* ==========================================================================
   17. PRINT STYLES RTL
   ========================================================================== */

@media print {
    body {
        direction: rtl;
    }
    
    .print-content {
        text-align: right;
    }
}
