/**
 * RTL (Right-to-Left) CSS Override for Admiro Admin Template
 * Arabic language support
 */

/* ===========================
   Base RTL Styles
   =========================== */

/* Set Arabic font family */
:root {
    --font-family-ar: "Cairo", sans-serif;
}

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

html[dir="rtl"] body,
html[dir="rtl"] * {
    font-family: var(--font-family-ar);
}

/* ===========================
   Layout RTL Overrides
   =========================== */

/* Page wrapper */
html[dir="rtl"] .page-wrapper.compact-wrapper .page-body-wrapper .page-body {
    margin-left: 0;
}

html[dir="rtl"]
    .page-wrapper.compact-wrapper
    .page-body-wrapper.sidebar-close
    .page-body {
    margin-right: 90px;
    margin-left: 0;
}

/* Sidebar */
html[dir="rtl"] .page-wrapper.compact-wrapper .sidebar-wrapper {
    left: auto;
    right: 0;
}

html[dir="rtl"] .page-wrapper.compact-wrapper .sidebar-wrapper .back-btn {
    left: auto;
    right: 10px;
}

html[dir="rtl"]
    .page-wrapper.compact-wrapper
    .sidebar-wrapper
    .sidebar-main
    .sidebar-links
    li:hover
    .nav-sub-childmenu {
    left: auto;
    right: 200px;
}

/* Sidebar navigation arrows */
html[dir="rtl"]
    .page-wrapper.compact-wrapper
    .sidebar-wrapper
    .sidebar-main
    .sidebar-links
    span.menu-arrow::after,
html[dir="rtl"] .sidebar-list .menu-arrow::after {
    transform: rotate(180deg);
}

html[dir="rtl"]
    .page-wrapper.compact-wrapper
    .sidebar-wrapper
    .sidebar-main
    .sidebar-links
    li.active
    span.menu-arrow::after,
html[dir="rtl"] .sidebar-list.active .menu-arrow::after {
    transform: rotate(90deg);
}

/* Sidebar menu text */
html[dir="rtl"]
    .page-wrapper.compact-wrapper
    .sidebar-wrapper
    .sidebar-main
    .sidebar-links
    li
    a
    span.menu-title {
    padding-right: 15px;
    padding-left: 0;
}

html[dir="rtl"]
    .page-wrapper.compact-wrapper
    .sidebar-wrapper
    .sidebar-main
    .sidebar-links
    li
    a {
    text-align: right;
}

html[dir="rtl"]
    .page-wrapper.compact-wrapper
    .sidebar-wrapper
    .sidebar-main
    .sidebar-links
    li
    a
    svg,
html[dir="rtl"]
    .page-wrapper.compact-wrapper
    .sidebar-wrapper
    .sidebar-main
    .sidebar-links
    li
    a
    i {
    margin-right: 0;
    margin-left: 15px;
}

/* Submenu */
html[dir="rtl"] .sidebar-submenu {
    padding-right: 30px;
    padding-left: 0;
}

html[dir="rtl"] .sidebar-submenu li a {
    text-align: right;
    padding-right: 20px;
    padding-left: 0;
}

html[dir="rtl"] .sidebar-submenu li::before {
    left: auto;
    right: 0;
}

/* Header */
html[dir="rtl"] .page-header .header-wrapper {
    padding-left: 30px;
    padding-right: 0;
}

html[dir="rtl"] .page-header .header-wrapper .nav-left {
    float: right;
}

html[dir="rtl"] .page-header .header-wrapper .nav-right {
    float: left;
}

html[dir="rtl"] .page-header .header-wrapper .nav-right > ul > li {
    margin-right: 0;
    margin-left: 10px;
}

html[dir="rtl"] .page-header .header-wrapper .nav-right .notification-box,
html[dir="rtl"] .page-header .header-wrapper .nav-right .cart-box,
html[dir="rtl"] .page-header .header-wrapper .nav-right .bookmark-box {
    right: auto;
    left: 0;
}

/* Logo wrapper */
html[dir="rtl"] .logo-wrapper {
    text-align: right;
    border-right: none;
    border-left: 1px solid #e6e6e6;
}

html[dir="rtl"] .logo-wrapper .toggle-sidebar {
    margin-left: 0;
    margin-right: 20px;
}

/* ===========================
   Form Elements RTL
   =========================== */

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

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

html[dir="rtl"] .input-group > .form-control,
html[dir="rtl"] .input-group > .form-select {
    border-radius: 0.375rem 0 0 0.375rem;
}

html[dir="rtl"] .input-group > .btn:first-child,
html[dir="rtl"] .input-group > .input-group-text:first-child {
    border-radius: 0 0.375rem 0.375rem 0;
}

html[dir="rtl"] .input-group > .btn:last-child,
html[dir="rtl"] .input-group > .input-group-text:last-child {
    border-radius: 0.375rem 0 0 0.375rem;
}

html[dir="rtl"] .form-check {
    padding-left: 0;
    padding-right: 1.5em;
}

html[dir="rtl"] .form-check-input {
    float: right;
    margin-left: 0;
    margin-right: -1.5em;
}

/* ===========================
   Tables RTL
   =========================== */

html[dir="rtl"] table {
    text-align: right;
}

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

html[dir="rtl"] .dataTables_wrapper .dataTables_filter {
    float: left;
    text-align: left;
}

html[dir="rtl"] .dataTables_wrapper .dataTables_length {
    float: right;
}

html[dir="rtl"] .dataTables_wrapper .dataTables_info {
    float: right;
}

html[dir="rtl"] .dataTables_wrapper .dataTables_paginate {
    float: left;
}

html[dir="rtl"] .dataTables_wrapper .dataTables_filter input {
    margin-left: 0;
    margin-right: 0.5em;
}

/* ===========================
   Buttons RTL
   =========================== */

html[dir="rtl"] .btn i,
html[dir="rtl"] .btn svg {
    margin-right: 0;
    margin-left: 5px;
}

html[dir="rtl"] .btn-group > :not(:first-child) {
    margin-left: 0;
    margin-right: -1px;
}

/* ===========================
   Cards RTL
   =========================== */

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

html[dir="rtl"] .card-header .card-header-right {
    left: 20px;
    right: auto;
}

/* ===========================
   Alerts RTL
   =========================== */

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

html[dir="rtl"] .alert .btn-close {
    left: 15px;
    right: auto;
}

html[dir="rtl"] .alert-dismissible {
    padding-right: 15px;
    padding-left: 40px;
}

/* ===========================
   Dropdowns RTL
   =========================== */

html[dir="rtl"] .dropdown-menu {
    text-align: right;
    left: auto;
    right: 0;
}

html[dir="rtl"] .dropdown-item {
    text-align: right;
}

html[dir="rtl"] .dropdown-item i,
html[dir="rtl"] .dropdown-item svg {
    margin-right: 0;
    margin-left: 8px;
}

/* ===========================
   Lists RTL
   =========================== */

html[dir="rtl"] ul,
html[dir="rtl"] ol {
    padding-left: 0;
    padding-right: 2rem;
}

html[dir="rtl"] .list-group {
    padding-right: 0;
}

html[dir="rtl"] .list-unstyled {
    padding-right: 0;
}

/* ===========================
   Modals RTL
   =========================== */

html[dir="rtl"] .modal-header .btn-close {
    margin: -0.5rem auto -0.5rem -0.5rem;
}

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

/* ===========================
   Pagination RTL
   =========================== */

html[dir="rtl"] .pagination {
    flex-direction: row-reverse;
}

html[dir="rtl"] .page-item:first-child .page-link {
    border-radius: 0 0.375rem 0.375rem 0;
}

html[dir="rtl"] .page-item:last-child .page-link {
    border-radius: 0.375rem 0 0 0.375rem;
}

/* ===========================
   Breadcrumb RTL
   =========================== */

html[dir="rtl"] .breadcrumb {
    flex-direction: row-reverse;
    justify-content: flex-end;
}

html[dir="rtl"] .breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-right: 0;
    padding-left: 0.5rem;
    content: "\\";
}

/* ===========================
   Icons RTL
   =========================== */

html[dir="rtl"] .iconly-Arrow-Left-2::before {
    transform: rotate(180deg);
    display: inline-block;
}

html[dir="rtl"] .iconly-Arrow-Right-2::before {
    transform: rotate(180deg);
    display: inline-block;
}

html[dir="rtl"] .ti-angle-left::before {
    content: "\e649"; /* ti-angle-right */
}

html[dir="rtl"] .ti-angle-right::before {
    content: "\e64a"; /* ti-angle-left */
}

/* ===========================
   Float Utilities RTL
   =========================== */

html[dir="rtl"] .float-start {
    float: right !important;
}

html[dir="rtl"] .float-end {
    float: left !important;
}

/* ===========================
   Text Alignment RTL
   =========================== */

html[dir="rtl"] .text-start {
    text-align: right !important;
}

html[dir="rtl"] .text-end {
    text-align: left !important;
}

/* ===========================
   Margin/Padding RTL
   =========================== */

html[dir="rtl"] .ms-1 {
    margin-right: 0.25rem !important;
    margin-left: 0 !important;
}
html[dir="rtl"] .ms-2 {
    margin-right: 0.5rem !important;
    margin-left: 0 !important;
}
html[dir="rtl"] .ms-3 {
    margin-right: 1rem !important;
    margin-left: 0 !important;
}
html[dir="rtl"] .ms-4 {
    margin-right: 1.5rem !important;
    margin-left: 0 !important;
}
html[dir="rtl"] .ms-5 {
    margin-right: 3rem !important;
    margin-left: 0 !important;
}
html[dir="rtl"] .ms-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

html[dir="rtl"] .me-1 {
    margin-left: 0.25rem !important;
    margin-right: 0 !important;
}
html[dir="rtl"] .me-2 {
    margin-left: 0.5rem !important;
    margin-right: 0 !important;
}
html[dir="rtl"] .me-3 {
    margin-left: 1rem !important;
    margin-right: 0 !important;
}
html[dir="rtl"] .me-4 {
    margin-left: 1.5rem !important;
    margin-right: 0 !important;
}
html[dir="rtl"] .me-5 {
    margin-left: 3rem !important;
    margin-right: 0 !important;
}
html[dir="rtl"] .me-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

html[dir="rtl"] .ps-1 {
    padding-right: 0.25rem !important;
    padding-left: 0 !important;
}
html[dir="rtl"] .ps-2 {
    padding-right: 0.5rem !important;
    padding-left: 0 !important;
}
html[dir="rtl"] .ps-3 {
    padding-right: 1rem !important;
    padding-left: 0 !important;
}
html[dir="rtl"] .ps-4 {
    padding-right: 1.5rem !important;
    padding-left: 0 !important;
}
html[dir="rtl"] .ps-5 {
    padding-right: 3rem !important;
    padding-left: 0 !important;
}

html[dir="rtl"] .pe-1 {
    padding-left: 0.25rem !important;
    padding-right: 0 !important;
}
html[dir="rtl"] .pe-2 {
    padding-left: 0.5rem !important;
    padding-right: 0 !important;
}
html[dir="rtl"] .pe-3 {
    padding-left: 1rem !important;
    padding-right: 0 !important;
}
html[dir="rtl"] .pe-4 {
    padding-left: 1.5rem !important;
    padding-right: 0 !important;
}
html[dir="rtl"] .pe-5 {
    padding-left: 3rem !important;
    padding-right: 0 !important;
}

/* ===========================
   Border RTL
   =========================== */

html[dir="rtl"] .border-start {
    border-left: 0 !important;
    border-right: var(--bs-border-width) var(--bs-border-style)
        var(--bs-border-color) !important;
}

html[dir="rtl"] .border-end {
    border-right: 0 !important;
    border-left: var(--bs-border-width) var(--bs-border-style)
        var(--bs-border-color) !important;
}

/* ===========================
   Position RTL
   =========================== */

html[dir="rtl"] .start-0 {
    left: auto !important;
    right: 0 !important;
}
html[dir="rtl"] .start-50 {
    left: auto !important;
    right: 50% !important;
}
html[dir="rtl"] .start-100 {
    left: auto !important;
    right: 100% !important;
}

html[dir="rtl"] .end-0 {
    right: auto !important;
    left: 0 !important;
}
html[dir="rtl"] .end-50 {
    right: auto !important;
    left: 50% !important;
}
html[dir="rtl"] .end-100 {
    right: auto !important;
    left: 100% !important;
}

/* ===========================
   Dashboard Widgets RTL
   =========================== */

html[dir="rtl"] .widget-card .widget-icon {
    left: auto;
    right: 15px;
}

html[dir="rtl"] .widget-card .card-body {
    text-align: right;
}

/* ===========================
   Footer RTL
   =========================== */

html[dir="rtl"] .footer {
    margin-left: 0;
    margin-right: 280px;
}

html[dir="rtl"] .page-wrapper.compact-wrapper.sidebar-close .footer {
    margin-right: 90px;
}

/* ===========================
   Tap to Top RTL
   =========================== */

html[dir="rtl"] .tap-top {
    right: auto;
    left: 30px;
}

/* ===========================
   Select2 RTL (if used)
   =========================== */

html[dir="rtl"]
    .select2-container--default
    .select2-selection--single
    .select2-selection__arrow {
    left: 1px;
    right: auto;
}

html[dir="rtl"]
    .select2-container--default
    .select2-selection--single
    .select2-selection__rendered {
    padding-left: 20px;
    padding-right: 8px;
}

/* ===========================
   Toast/Notifications RTL
   =========================== */

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

html[dir="rtl"] .toast-header .btn-close {
    margin-left: -0.375rem;
    margin-right: auto;
}

/* ===========================
   Slick Slider RTL
   =========================== */

html[dir="rtl"] .slick-slider {
    direction: rtl;
}

html[dir="rtl"] .slick-slide {
    float: right;
}

html[dir="rtl"] .slick-prev {
    left: auto;
    right: -25px;
}

html[dir="rtl"] .slick-next {
    right: auto;
    left: -25px;
}

/* ===========================
   Badge RTL
   =========================== */

html[dir="rtl"] .badge {
    margin-left: 0;
    margin-right: 5px;
}

/* ===========================
   Profile/Avatar RTL
   =========================== */

html[dir="rtl"] .profile-menu {
    left: 0;
    right: auto;
}

html[dir="rtl"] .profile-menu .dropdown-menu {
    left: 0;
    right: auto;
}

/* ===========================
   Numbers/Digits LTR (keep numbers left-to-right)
   =========================== */

html[dir="rtl"] input[type="number"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="date"],
html[dir="rtl"] input[type="datetime-local"],
html[dir="rtl"] input[type="time"],
html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"] {
    direction: ltr;
    text-align: right;
}

/* ===========================
   Responsive RTL
   =========================== */

@media (max-width: 991.98px) {
    html[dir="rtl"]
        .page-wrapper.compact-wrapper
        .page-body-wrapper
        .page-body {
        margin-right: 0;
    }

    html[dir="rtl"] .footer {
        margin-right: 0;
    }

    html[dir="rtl"] .page-wrapper.compact-wrapper .sidebar-wrapper {
        transform: translateX(100%);
    }

    html[dir="rtl"] .page-wrapper.compact-wrapper .sidebar-wrapper.close_icon {
        transform: translateX(0);
    }
}

/* ===========================
   Additional Sidebar RTL Fixes
   =========================== */

/* Page sidebar positioning */
html[dir="rtl"] .page-sidebar {
    right: 0;
    left: auto;
}

/* Sidebar menu arrow positioning */
html[dir="rtl"] .sidebar-link .menu-arrow {
    position: absolute;
    left: 15px;
    right: auto;
    transition: transform 0.3s ease;
}

html[dir="rtl"] .sidebar-list.menu-open .menu-arrow,
html[dir="rtl"] .sidebar-list.active .menu-arrow {
    transform: rotate(-90deg);
}

/* Sidebar submenu icons */
html[dir="rtl"] .sidebar-submenu li a i {
    margin-left: 8px;
    margin-right: 0;
}

/* Sidebar link text */
html[dir="rtl"] .sidebar-link h6 {
    margin-right: 15px;
    margin-left: 0;
}

/* Main sidebar scroll */
html[dir="rtl"] .main-sidebar {
    direction: rtl;
}

/* Sidebar menu list */
html[dir="rtl"] .sidebar-menu {
    padding-right: 0;
}

/* Left/Right arrows for sidebar scroll */
html[dir="rtl"] #left-arrow {
    right: auto;
    left: 0;
}

html[dir="rtl"] #right-arrow {
    left: auto;
    right: 0;
}

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

/* DataTable action buttons */
html[dir="rtl"] .dt-buttons {
    float: right;
}

html[dir="rtl"] .dt-buttons .btn {
    margin-left: 5px;
    margin-right: 0;
}

/* Fix sidebar submenu positioning */
html[dir="rtl"] .sidebar-submenu {
    margin-right: 0;
    margin-left: 0;
}

/* Fix input group for RTL */
html[dir="rtl"] .input-group {
    flex-direction: row-reverse;
}

html[dir="rtl"] .input-group > .input-group-text:first-child {
    border-top-left-radius: 0;
    border-bottom-left-radius: 0;
    border-top-right-radius: 0.375rem;
    border-bottom-right-radius: 0.375rem;
    border-left: 0;
    border-right: 1px solid #ced4da;
}

html[dir="rtl"] .input-group > .form-control:last-child {
    border-top-right-radius: 0;
    border-bottom-right-radius: 0;
    border-top-left-radius: 0.375rem;
    border-bottom-left-radius: 0.375rem;
}

/* Sidebar menu arrow rotation for FontAwesome in RTL */
html[dir="rtl"] .sidebar-link .menu-arrow i {
    transition: transform 0.3s;
}

html[dir="rtl"] .sidebar-list.active .menu-arrow i,
html[dir="rtl"] .sidebar-list.menu-open .menu-arrow i {
    transform: rotate(-90deg);
}

/* ===========================
   Sidebar 3-level nesting (B > C)
   =========================== */

html[dir="rtl"] .page-sidebar .sidebar-submenu > li > .submenu-title {
    display: flex;
    align-items: center;
    justify-content: space-between;
    gap: 8px;
    padding: 8px 15px 8px 4px;
    margin-bottom: 4px;
    cursor: pointer;
    font-weight: 600;
    font-size: 15px;
    color: var(--body-font-color);
    border-radius: 8px;
    user-select: none;
}

html[dir="rtl"] .page-sidebar .sidebar-submenu > li > .submenu-title:hover {
    color: var(--theme-default);
    background-color: rgba(48, 142, 135, 0.08);
}

html[dir="rtl"] .page-sidebar .sidebar-submenu > li.active > .submenu-title {
    color: var(--theme-default);
}

html[dir="rtl"] .page-sidebar .submenu-chevron {
    font-size: 11px;
    transition: transform 0.25s ease;
    opacity: 0.75;
}

html[dir="rtl"] .page-sidebar .sidebar-submenu > li.active > .submenu-title .submenu-chevron {
    transform: rotate(-90deg);
    opacity: 1;
}

html[dir="rtl"] .page-sidebar .according-submenu {
    margin: 4px 0 8px;
    padding: 0 14px 0 0;
    border-right: 2px dashed rgba(48, 142, 135, 0.35);
    border-left: none;
    list-style: none;
}

html[dir="rtl"] .page-sidebar .sidebar-submenu > li:not(.active) > .according-submenu,
html[dir="rtl"] .page-sidebar .according-submenu > li:not(.active) > .according-submenu {
    display: none !important;
}

html[dir="rtl"] .page-sidebar .sidebar-submenu > li.active > .according-submenu,
html[dir="rtl"] .page-sidebar .according-submenu > li.active > .according-submenu,
html[dir="rtl"] .page-sidebar .according-submenu.active {
    display: block !important;
}

html[dir="rtl"] .page-sidebar .submenu-title--nested {
    font-size: 14px;
    padding: 5px 8px;
}

html[dir="rtl"] .page-sidebar .according-submenu--nested {
    margin: 2px 0 6px;
    padding: 0 12px 0 0;
    border-right: 2px dashed rgba(48, 142, 135, 0.25);
}

html[dir="rtl"] .page-sidebar .according-submenu li a {
    display: block;
    padding: 6px 10px 6px 4px;
    font-size: 14px;
    font-weight: 500;
    color: var(--gray-700);
    border-radius: 6px;
}

html[dir="rtl"] .page-sidebar .according-submenu li a::before {
    right: 0;
    left: auto;
}

html[dir="rtl"] .page-sidebar .according-submenu li a:hover,
html[dir="rtl"] .page-sidebar .according-submenu li a.active {
    color: var(--theme-default);
    background-color: rgba(48, 142, 135, 0.1);
}

html[dir="rtl"] .page-sidebar .sidebar-group > .sidebar-submenu > li > a:not(.submenu-title) {
    font-weight: 500;
}

/* Leaflet maps — fix Bootstrap/global img rules breaking tiles */
.family-map-wrapper {
    position: relative;
    z-index: 0;
    margin-top: 10px;
    isolation: isolate;
}

.family-map,
.family-map.leaflet-container {
    height: 300px;
    width: 100%;
    border-radius: 8px;
    border: 1px solid var(--bs-border-color, #dee2e6);
    background: #e9ecef;
}

.family-map--tall,
.family-map--tall.leaflet-container {
    height: 400px;
}

.family-map-wrapper .leaflet-container img,
.leaflet-container img {
    max-width: none !important;
    max-height: none !important;
}

.leaflet-container .leaflet-tile-pane img {
    width: 256px !important;
    height: 256px !important;
}

.leaflet-control-zoom a {
    color: #333 !important;
    text-decoration: none;
}

.leaflet-control-attribution {
    font-size: 11px;
    direction: ltr;
    text-align: left;
}

/* Dashboard quick-add information wizard */
.dashboard-quick-info .quick-info-type-btn.active,
.dashboard-quick-info .quick-info-section-btn.active {
    color: #fff;
    border-color: var(--theme-default);
    background-color: var(--theme-default);
}

.dashboard-quick-info .quick-info-type-btn,
.dashboard-quick-info .quick-info-section-btn {
    transition: all 0.2s ease;
}

