/* Arabic Fonts Enhancer - Font Definitions */

/* Cairo */
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cairo-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cairo-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Changa */
@font-face {
    font-family: 'Changa';
    src: url('../fonts/changa-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Changa';
    src: url('../fonts/changa-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Noto Sans Arabic */
@font-face {
    font-family: 'NotoSansArabic';
    src: url('../fonts/notosansarabic-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'NotoSansArabic';
    src: url('../fonts/notosansarabic-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Amiri */
@font-face {
    font-family: 'Amiri';
    src: url('../fonts/amiri-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Amiri';
    src: url('../fonts/amiri-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* Tajawal */
@font-face {
    font-family: 'Tajawal';
    src: url('../fonts/tajawal-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'Tajawal';
    src: url('../fonts/tajawal-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* IBM Plex Arabic */
@font-face {
    font-family: 'IBMPlexArabic';
    src: url('../fonts/ibmplexarabic-regular.woff2') format('woff2');
    font-weight: 400;
    font-style: normal;
    font-display: swap;
}
@font-face {
    font-family: 'IBMPlexArabic';
    src: url('../fonts/ibmplexarabic-700.woff2') format('woff2');
    font-weight: 700;
    font-style: normal;
    font-display: swap;
}

/* ============================================================================
   BASE STYLES - Arabic Fonts Enhanced
   ============================================================================ */
html.arabic-fonts-enhanced {
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

/* Code/monospace elements should not be affected */
html.arabic-fonts-enhanced code,
html.arabic-fonts-enhanced pre,
html.arabic-fonts-enhanced .ace_editor {
    font-family: monospace !important;
}

/* ============================================================================
   RTL (Right-to-Left) ENHANCEMENTS
   Comprehensive RTL support for Arabic interface
   ============================================================================ */

/* Global RTL Direction */
html.arabic-fonts-enhanced {
    direction: rtl;
}

html.arabic-fonts-enhanced body {
    direction: rtl;
    text-align: right;
}

/* Main Layout RTL */
html.arabic-fonts-enhanced .main-content,
html.arabic-fonts-enhanced .content-wrapper,
html.arabic-fonts-enhanced .page-content {
    direction: rtl;
    text-align: right;
}

/* Sidebar RTL */
html.arabic-fonts-enhanced #sidebar,
html.arabic-fonts-enhanced .sidebar,
html.arabic-fonts-enhanced .sidebar-menu {
    direction: rtl;
    text-align: right;
}

html.arabic-fonts-enhanced .sidebar-menu li a {
    text-align: right;
    padding-right: 15px;
    padding-left: 10px;
}

html.arabic-fonts-enhanced .sidebar-menu li a i,
html.arabic-fonts-enhanced .sidebar-menu li a svg {
    margin-left: 10px;
    margin-right: 0;
}

/* Submenu arrows */
html.arabic-fonts-enhanced .sidebar-menu .submenu-toggle::after,
html.arabic-fonts-enhanced .sidebar-menu .has-submenu > a::after {
    float: left;
    transform: rotate(180deg);
}

/* Navbar RTL */
html.arabic-fonts-enhanced .navbar,
html.arabic-fonts-enhanced .top-navbar {
    direction: rtl;
}

html.arabic-fonts-enhanced .navbar-nav {
    flex-direction: row-reverse;
}

/* Cards & Boxes RTL */
html.arabic-fonts-enhanced .card,
html.arabic-fonts-enhanced .box,
html.arabic-fonts-enhanced .panel {
    direction: rtl;
    text-align: right;
}

html.arabic-fonts-enhanced .card-header,
html.arabic-fonts-enhanced .card-footer {
    text-align: right;
}

/* Tables RTL */
html.arabic-fonts-enhanced table,
html.arabic-fonts-enhanced .table {
    direction: rtl;
}

html.arabic-fonts-enhanced th,
html.arabic-fonts-enhanced td {
    text-align: right;
}

html.arabic-fonts-enhanced .dataTables_wrapper {
    direction: rtl;
}

html.arabic-fonts-enhanced .dataTables_filter,
html.arabic-fonts-enhanced .dataTables_length {
    text-align: right;
}

html.arabic-fonts-enhanced .dataTables_filter label,
html.arabic-fonts-enhanced .dataTables_length label {
    direction: rtl;
}

html.arabic-fonts-enhanced .dataTables_paginate {
    direction: ltr;
}

/* Forms RTL */
html.arabic-fonts-enhanced .form-group,
html.arabic-fonts-enhanced .form-check {
    text-align: right;
}

html.arabic-fonts-enhanced label {
    text-align: right;
    display: block;
}

html.arabic-fonts-enhanced select {line-height: 1.5; padding: 10px 26px;}

html.arabic-fonts-enhanced input,
html.arabic-fonts-enhanced select,
html.arabic-fonts-enhanced textarea {
    direction: rtl;
    text-align: right;
}

html.arabic-fonts-enhanced input[type="number"],
html.arabic-fonts-enhanced input[type="email"],
html.arabic-fonts-enhanced input[type="url"],
html.arabic-fonts-enhanced input[type="tel"] {
    direction: ltr;
    text-align: left;
}

html.arabic-fonts-enhanced .input-group {
    flex-direction: row-reverse;
}

html.arabic-fonts-enhanced .input-group-prepend {
    margin-left: -1px;
    margin-right: 0;
}

html.arabic-fonts-enhanced .input-group-append {
    margin-right: -1px;
    margin-left: 0;
}

/* Buttons RTL */
html.arabic-fonts-enhanced .btn-group {
    direction: rtl;
}

html.arabic-fonts-enhanced .btn i,
html.arabic-fonts-enhanced .btn svg {
    margin-left: 5px;
    margin-right: 0;
}

/* Dropdowns RTL */
html.arabic-fonts-enhanced .dropdown-menu {
    direction: rtl;
    text-align: right;
    left: auto;
    right: 0;
}

html.arabic-fonts-enhanced .dropdown-item {
    text-align: right;
}

/* Modals RTL */
html.arabic-fonts-enhanced .modal-header,
html.arabic-fonts-enhanced .modal-body,
html.arabic-fonts-enhanced .modal-footer {
    direction: rtl;
    text-align: right;
}

html.arabic-fonts-enhanced .modal-header .close,
html.arabic-fonts-enhanced .modal-header .btn-close {
    margin-left: 0;
    margin-right: auto;
}

/* Alerts & Notifications RTL */
html.arabic-fonts-enhanced .alert {
    direction: rtl;
    text-align: right;
}

html.arabic-fonts-enhanced .alert-dismissible .close,
html.arabic-fonts-enhanced .alert-dismissible .btn-close {
    left: 0;
    right: auto;
}

/* Breadcrumbs RTL */
html.arabic-fonts-enhanced .breadcrumb {
    direction: rtl;
    justify-content: flex-end;
}

html.arabic-fonts-enhanced .breadcrumb-item + .breadcrumb-item::before {
    float: right;
    padding-left: 0.5rem;
    padding-right: 0.5rem;
    content: "\\";
}

/* Pagination RTL */
html.arabic-fonts-enhanced .pagination {
    direction: rtl;
    justify-content: flex-end;
}

/* List Groups RTL */
html.arabic-fonts-enhanced .list-group {
    direction: rtl;
}

html.arabic-fonts-enhanced .list-group-item {
    text-align: right;
}

/* Tabs RTL */
html.arabic-fonts-enhanced .nav-tabs,
html.arabic-fonts-enhanced .nav-pills {
    direction: rtl;
}

/* Progress Bars RTL */
html.arabic-fonts-enhanced .progress {
    direction: rtl;
}

html.arabic-fonts-enhanced .progress-bar {
    float: right;
}

/* Tooltips & Popovers RTL */
html.arabic-fonts-enhanced .tooltip,
html.arabic-fonts-enhanced .popover {
    direction: rtl;
    text-align: right;
}

/* Icons adjustment for RTL */
html.arabic-fonts-enhanced .fa-angle-right::before,
html.arabic-fonts-enhanced .fa-chevron-right::before,
html.arabic-fonts-enhanced .fa-arrow-right::before {
    content: "\f104"; /* angle-left */
}

html.arabic-fonts-enhanced .fa-angle-left::before,
html.arabic-fonts-enhanced .fa-chevron-left::before,
html.arabic-fonts-enhanced .fa-arrow-left::before {
    content: "\f105"; /* angle-right */
}

/* Float utilities RTL */
html.arabic-fonts-enhanced .float-left {
    float: right !important;
}

html.arabic-fonts-enhanced .float-right {
    float: left !important;
}

/* Text alignment utilities RTL */
html.arabic-fonts-enhanced .text-left {
    text-align: right !important;
}

html.arabic-fonts-enhanced .text-right {
    text-align: left !important;
}

/* Margin/Padding utilities RTL */
html.arabic-fonts-enhanced .ml-auto {
    margin-right: auto !important;
    margin-left: 0 !important;
}

html.arabic-fonts-enhanced .mr-auto {
    margin-left: auto !important;
    margin-right: 0 !important;
}

html.arabic-fonts-enhanced .pl-0 {
    padding-right: 0 !important;
}

html.arabic-fonts-enhanced .pr-0 {
    padding-left: 0 !important;
}

/* Specific CRM Elements RTL */
html.arabic-fonts-enhanced .project-list,
html.arabic-fonts-enhanced .task-list,
html.arabic-fonts-enhanced .invoice-list {
    direction: rtl;
    text-align: right;
}

html.arabic-fonts-enhanced .widget,
html.arabic-fonts-enhanced .dashboard-widget {
    direction: rtl;
    text-align: right;
}

/* Timeline RTL */
html.arabic-fonts-enhanced .timeline {
    direction: rtl;
}

html.arabic-fonts-enhanced .timeline::before {
    right: 50%;
    left: auto;
}

/* ============================================================================
   SAUDI RIYAL SYMBOL STYLES
   ============================================================================ */

/* SAR Symbol Wrapper */
.sar-symbol-wrapper {
    display: inline-flex;
    align-items: baseline;
    direction: ltr; /* Keep numbers LTR */
    unicode-bidi: embed;
    white-space: nowrap;
    gap: 0;
}

/* SAR Amount (the number) - appears on RIGHT */
.sar-symbol-wrapper .sar-amount {
    font-weight: 600;
    direction: ltr;
    order: 0; /* Amount comes FIRST (rightmost in LTR flex) */
}

/* SAR Spacer - between amount and symbol */
.sar-symbol-wrapper .sar-spacer {
    order: 1; /* Spacer in middle */
    flex-shrink: 0;
}

/* SAR Symbol SVG - Positioned on LEFT of amount */
.sar-symbol-svg {
    width: 0.65em;
    height: 0.75em;
    vertical-align: baseline;
    fill: currentColor;
    opacity: 0.85;
    margin: 0 !important;
    position: relative;
    top: 0.05em;
    flex-shrink: 0;
    order: 2; /* Symbol comes LAST (leftmost in LTR flex) */
}

/* RTL context */
html.arabic-fonts-enhanced .sar-symbol-wrapper {
    /* Order: amount(0) -> spacer(1) -> symbol(2) = visually: symbol spacer amount */
}

html.arabic-fonts-enhanced .sar-symbol-svg {
    /* Order already set to 0, no margin needed */
}

/* Unicode SAR symbol styling */
.sar-symbol-unicode {
    font-size: 0.7em;
    line-height: 1;
    opacity: 0.85;
    margin-right: 4px;
    vertical-align: baseline;
    position: relative;
    top: 0.1em;
}

html.arabic-fonts-enhanced .sar-symbol-unicode {
    margin-left: 4px;
    margin-right: 0;
}

/* Replaced marker class */
.sar-replaced {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-flex;
    align-items: baseline;
}

html.arabic-fonts-enhanced .sar-replaced {
    flex-direction: row-reverse;
}

/* Print styles for SAR symbol */
@media print {
    .sar-symbol-svg {
        -webkit-print-color-adjust: exact;
        print-color-adjust: exact;
        fill: #000 !important;
    }
}

/* ============================================================================
   CURRENCY DISPLAY ENHANCEMENTS
   ============================================================================ */

/* All currency amounts should display LTR with RTL wrapper */
html.arabic-fonts-enhanced .currency-amount,
html.arabic-fonts-enhanced .amount,
html.arabic-fonts-enhanced .price,
html.arabic-fonts-enhanced .total,
html.arabic-fonts-enhanced .balance {
    direction: ltr;
    unicode-bidi: embed;
    display: inline-block;
}

/* Dashboard widgets currency */
html.arabic-fonts-enhanced .widget-amount,
html.arabic-fonts-enhanced .stat-value {
    direction: ltr;
    unicode-bidi: embed;
}

/* Invoice/Payment amounts */
html.arabic-fonts-enhanced .invoice-amount,
html.arabic-fonts-enhanced .payment-amount {
    direction: ltr;
    unicode-bidi: embed;
    text-align: left;
}

