/* Local Font Face Definitions (CoFo Sans Pro Arabic mapped to Cairo) */
@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cofo-sans-pro-arabic-regular.ttf') format('truetype');
    font-weight: 400;
    font-style: normal;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cofo-sans-pro-arabic-book.ttf') format('truetype');
    font-weight: 450;
    font-style: normal;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cofo-sans-pro-arabic-medium.ttf') format('truetype');
    font-weight: 500;
    font-style: normal;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cofo-sans-pro-arabic-bold.ttf') format('truetype');
    font-weight: 700;
    font-style: normal;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cofo-sans-pro-arabic-black.ttf') format('truetype');
    font-weight: 900;
    font-style: normal;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cofo-sans-pro-arabic-light.ttf') format('truetype');
    font-weight: 300;
    font-style: normal;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cofo-sans-pro-arabic-thin.ttf') format('truetype');
    font-weight: 200;
    font-style: normal;
}

@font-face {
    font-family: 'Cairo';
    src: url('../fonts/cofo-sans-pro-arabic-hairline.ttf') format('truetype');
    font-weight: 100;
    font-style: normal;
}

/* Custom Premium Scrollbar Styling */
::-webkit-scrollbar {
    width: 6px !important;
    height: 6px !important;
}

::-webkit-scrollbar-track {
    background: transparent !important;
}

::-webkit-scrollbar-thumb {
    background: #cbd5e1 !important;
    border-radius: 8px !important;
    transition: background 0.15s ease-in-out !important;
}

::-webkit-scrollbar-thumb:hover {
    background: #0d9488 !important;
}

html {
    scrollbar-width: thin !important;
    scrollbar-color: #cbd5e1 transparent !important;
}

/* Custom System-Wide Styles */
html {
    font-size: 14px !important;
}

body {
    font-family: 'Cairo', sans-serif;
    background-color: #f8fafc;
    color: #1e293b;
}

[x-cloak] {
    display: none !important;
}


/* Custom Select2 Overrides */
.select2-container--default .select2-selection--single {
    border-color: #e2e8f0;
    border-radius: 0.5rem;
    height: 38px;
    display: flex;
    align-items: center;
}

/* Custom Inputs & Components */
input[type="number"]::-webkit-inner-spin-button,
input[type="number"]::-webkit-outer-spin-button {
    -webkit-appearance: none;
    margin: 0;
}

/* ==========================================
   DataTables Modern Custom Styling (Tailwind-integrated RTL)
   ========================================== */
.dataTable {
    width: 100% !important;
    border-collapse: collapse !important;
    border-spacing: 0 !important;
    margin: 0 !important;
}

/* Table Header Overrides for jQuery UI DataTables */
.dataTable thead th.ui-state-default,
.dataTable thead th.ui-widget-header,
.dataTable thead th {
    background-image: none !important;
    background-color: #f8fafc !important;
    /* light slate background */
    border: none !important;
    border-bottom: 2px solid #e2e8f0 !important;
    color: #475569 !important;
    /* slate text */
    font-weight: 700 !important;
    font-size: 0.8rem !important;
    padding: 14px 16px !important;
    text-align: right !important;
    font-family: 'Cairo', sans-serif !important;
    box-shadow: none !important;
}

/* Align operations th to the left */
.dataTable thead th.text-left {
    text-align: left !important;
}

/* Align text-center th to center */
.dataTable thead th.text-center {
    text-align: center !important;
}

/* Column headers flex wrapper */
.dt-column-header {
    display: inline-flex !important;
    align-items: center !important;
    width: 100% !important;
    justify-content: space-between !important;
}

.text-center .dt-column-header {
    justify-content: center !important;
}

.text-left .dt-column-header {
    justify-content: flex-end !important;
}

/* Sorting indicators (clean look) */
.dt-column-order {
    margin-right: 6px !important;
    opacity: 0.25 !important;
    transition: opacity 0.15s ease-in-out !important;
}

th:hover .dt-column-order {
    opacity: 0.75 !important;
}

.dt-ordering-asc .dt-column-order,
.dt-ordering-desc .dt-column-order {
    opacity: 1 !important;
    color: #0d9488 !important;
    /* Teal-600 for active sort */
}

/* Table body overrides */
.dataTable tbody td {
    border: none !important;
    border-bottom: 1px solid #f1f5f9 !important;
    background-color: transparent !important;
    padding: 14px 16px !important;
    font-size: 0.8rem !important;
    color: #334155 !important;
    font-family: 'Cairo', sans-serif !important;
    vertical-align: middle !important;
}

/* Alternating zebra row colors */
.dataTable tbody tr:nth-child(even) {
    background-color: #fafbfc !important;
}

/* Hover highlights */
.dataTable tbody tr:hover {
    background-color: #f1f5f9 !important;
    /* soft hover */
}

/* Highlight sorting column */
.dataTable tbody td.sorting_1 {
    background-color: rgba(13, 148, 136, 0.015) !important;
}

/* Table container styling */
.dt-layout-table {
    margin: 1.5rem 0 !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 1rem !important;
    overflow: hidden !important;
    box-shadow: 0 1px 3px 0 rgba(0, 0, 0, 0.05) !important;
    background-color: #ffffff !important;
}

/* Layout Rows & Cells Overrides */
.dt-layout-row {
    display: flex !important;
    flex-direction: row-reverse !important;
    align-items: center !important;
    justify-content: space-between !important;
    width: 100% !important;
    flex-wrap: wrap !important;
    gap: 12px !important;
    margin: 1rem 0 !important;
}

.dt-layout-row::after,
.dt-layout-row::before {
    display: none !important;
    /* disable old float fixes */
}

.dt-layout-cell {
    display: flex !important;
    align-items: center !important;
    gap: 12px !important;
}

.dt-layout-start {
    justify-content: flex-start !important;
}

.dt-layout-end {
    justify-content: flex-end !important;
}

/* JQuery UI buttonset overrides */
.ui-buttonset {
    display: inline-flex !important;
    gap: 6px !important;
    margin: 0 !important;
}

.ui-buttonset .dt-button,
.ui-buttonset .fg-button {
    margin: 0 !important;
}

/* Redesign Search Area */
.dt-search {
    display: flex !important;
    align-items: center !important;
    gap: 8px !important;
    font-size: 0.8rem !important;
    font-weight: 700 !important;
    color: #475569 !important;
}

.dt-search label {
    margin-bottom: 0 !important;
}

.dt-search input.dt-input {
    border: 1px solid #cbd5e1 !important;
    border-radius: 0.5rem !important;
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
    font-family: 'Cairo', sans-serif !important;
    outline: none !important;
    background-color: #ffffff !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    transition: all 0.15s ease-in-out !important;
    width: 220px !important;
}

.dt-search input.dt-input:focus {
    border-color: #0d9488 !important;
    box-shadow: 0 0 0 2px rgba(13, 148, 136, 0.15) !important;
}

/* Info Summary Box */
.dt-info {
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    color: #64748b !important;
    padding: 4px 8px !important;
}

/* Pagination Overrides (jQuery UI classes: .fg-button, .ui-state-default, .ui-state-disabled) */
.dt-paging nav {
    display: inline-flex !important;
    gap: 4px !important;
}

/* General button state (Default) */
.dt-paging nav .fg-button {
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    padding: 6px 12px !important;
    border-radius: 0.375rem !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
    font-family: 'Cairo', sans-serif !important;
    cursor: pointer !important;
    transition: all 0.15s ease-in-out !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
    display: inline-flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Hover state */
.dt-paging nav .fg-button:hover:not(.ui-state-disabled) {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #0d9488 !important;
    /* Teal color on hover */
}

/* Active current page button state */
.dt-paging nav .fg-button[aria-current="page"] {
    background-color: #0d9488 !important;
    /* Teal-600 */
    border-color: #0d9488 !important;
    color: #ffffff !important;
    cursor: default !important;
    box-shadow: 0 1px 3px 0 rgba(13, 148, 136, 0.25) !important;
}

/* Disabled button state (like disabled first/prev/next/last) */
.dt-paging nav .fg-button.ui-state-disabled:not([aria-current="page"]) {
    opacity: 0.4 !important;
    cursor: not-allowed !important;
    background-color: #f8fafc !important;
    color: #94a3b8 !important;
    border-color: #f1f5f9 !important;
    box-shadow: none !important;
}

/* Length Options */
.dt-length select {
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.375rem !important;
    padding: 4px 24px 4px 8px !important;
    font-size: 0.75rem !important;
    background-color: #ffffff !important;
    margin: 0 4px !important;
    outline: none !important;
}

/* Export Buttons Wrapper */
.dt-buttons {
    display: inline-flex;
    gap: 6px;
    margin-bottom: 1rem;
}

.dt-buttons .dt-button {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    border-radius: 0.5rem !important;
    padding: 6px 12px !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    cursor: pointer !important;
    transition: all 0.15s ease-in-out;
    border: 1px solid transparent !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05) !important;
}

/* Copy button */
.dt-buttons .buttons-copy {
    background-color: #f1f5f9 !important;
    color: #475569 !important;
    border-color: #cbd5e1 !important;
}

.dt-buttons .buttons-copy:hover {
    background-color: #e2e8f0 !important;
}

/* Excel button */
.dt-buttons .buttons-excel {
    background-color: #f0fdf4 !important;
    color: #166534 !important;
    border-color: #bbf7d0 !important;
}

.dt-buttons .buttons-excel:hover {
    background-color: #dcfce7 !important;
}

/* PDF button */
.dt-buttons .buttons-pdf {
    background-color: #fef2f2 !important;
    color: #991b1b !important;
    border-color: #fecaca !important;
}

.dt-buttons .buttons-pdf:hover {
    background-color: #fee2e2 !important;
}

/* Print button */
.dt-buttons .buttons-print {
    background-color: #f0fdfa !important;
    color: #115e59 !important;
    border-color: #99f6e4 !important;
}

.dt-buttons .buttons-print:hover {
    background-color: #ccfbf1 !important;
}

/* ==========================================================================
   Antigravity Premium System UI & DataTables Responsive Customizations
   ========================================================================== */

/* Premium DataTables Layout & Buttons */
.dt-buttons {
    display: flex !important;
    gap: 0.5rem !important;
    margin-bottom: 1.25rem !important;
    flex-wrap: wrap !important;
}

.dt-button {
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    color: #475569 !important;
    font-weight: 700 !important;
    font-size: 0.75rem !important;
    padding: 0.55rem 1.1rem !important;
    border-radius: 0.85rem !important;
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1) !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.45rem !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02) !important;
}

.dt-button:hover {
    background-color: #f8fafc !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
    transform: translateY(-1.5px) !important;
    box-shadow: 0 10px 15px -3px rgba(0, 0, 0, 0.04), 0 4px 6px -2px rgba(0, 0, 0, 0.02) !important;
}

.dt-button:active {
    transform: translateY(0px) !important;
    scale: 0.98 !important;
}

/* DataTables Search input styling */
.dt-search {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    margin-bottom: 0 !important;
}

.dt-search label {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: #475569 !important;
    margin: 0 !important;
    white-space: nowrap !important;
}

.dt-search input {
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.85rem !important;
    height: 38px !important;
    box-sizing: border-box !important;
    padding: 0 1rem !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    background-color: rgba(248, 250, 252, 0.4) !important;
    transition: all 0.2s ease !important;
    outline: none !important;
    width: 200px !important;
}

.dt-search input:focus {
    border-color: #0d9488 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.08) !important;
}

/* DataTables Length select styling */
.dt-length {
    display: inline-flex !important;
    align-items: center !important;
    margin-bottom: 0 !important;
}

.dt-length label {
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.5rem !important;
    margin: 0 !important;
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: #475569 !important;
    white-space: nowrap !important;
}

.dt-length select {
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.85rem !important;
    height: 38px !important;
    box-sizing: border-box !important;
    padding: 0 2.25rem 0 1.1rem !important;
    font-size: 0.75rem !important;
    font-weight: 600 !important;
    background-color: rgba(248, 250, 252, 0.4) !important;
    transition: all 0.2s ease !important;
    outline: none !important;
}

.dt-length select:focus {
    border-color: #0d9488 !important;
    background-color: #ffffff !important;
}

/* Layout Cell Alignment & Responsive Wrappers */
.dt-layout-cell {
    display: flex !important;
    align-items: center !important;
    gap: 1rem !important;
    flex-wrap: wrap !important;
    justify-content: flex-start !important;
}

.dt-layout-end {
    justify-content: flex-end !important;
}

@media (max-width: 640px) {
    .dt-layout-cell {
        width: 100% !important;
        justify-content: center !important;
        gap: 0.75rem !important;
    }

    .dt-search {
        width: 100% !important;
        justify-content: space-between !important;
    }

    .dt-search input {
        width: 100% !important;
        max-width: 160px !important;
    }

    .dt-length {
        width: 100% !important;
        justify-content: space-between !important;
    }
}

/* DataTables Pagination styling */
.dt-paging {
    display: inline-flex !important;
    gap: 2px !important;
}

.dt-paging-button {
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.75rem !important;
    padding: 0.5rem 0.85rem !important;
    font-size: 0.725rem !important;
    font-weight: 700 !important;
    color: #64748b !important;
    background-color: #ffffff !important;
    transition: all 0.15s ease !important;
    margin: 0 !important;
}

.dt-paging-button.current {
    background-color: #0d9488 !important;
    color: #ffffff !important;
    border-color: #0d9488 !important;
    box-shadow: 0 4px 6px -1px rgba(13, 148, 136, 0.1) !important;
}

.dt-paging-button:hover:not(.current):not(.disabled) {
    background-color: #f1f5f9 !important;
    border-color: #cbd5e1 !important;
    color: #0f172a !important;
}

.dt-paging-button.disabled {
    opacity: 0.45 !important;
    cursor: not-allowed !important;
}

/* Select2 Premium Theme overrides */
.select2-container--default .select2-selection--single {
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.85rem !important;
    height: 44px !important;
    padding: 0.5rem 1.1rem !important;
    font-size: 0.825rem !important;
    font-weight: 600 !important;
    background-color: rgba(248, 250, 252, 0.4) !important;
    display: flex !important;
    align-items: center !important;
    transition: all 0.2s ease !important;
}

.select2-container--default .select2-selection--single .select2-selection__arrow {
    height: 42px !important;
    left: 12px !important;
    right: auto !important;
}

.select2-container--default .select2-selection--single .select2-selection__rendered {
    padding-right: 0px !important;
    color: #334155 !important;
}

.select2-container--default .select2-selection--single:focus-within {
    border-color: #0d9488 !important;
    background-color: #ffffff !important;
    box-shadow: 0 0 0 4px rgba(13, 148, 136, 0.08) !important;
}

.select2-dropdown {
    border: 1px solid #e2e8f0 !important;
    border-radius: 1rem !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    overflow: hidden !important;
    margin-top: 4px !important;
}

.select2-container--default .select2-results__option--highlighted[aria-selected] {
    background-color: #0d9488 !important;
}

.select2-container--default .select2-search--dropdown .select2-search__field {
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.75rem !important;
    padding: 0.45rem 0.85rem !important;
    outline: none !important;
}

/* Flatpickr Calendar overrides */
.flatpickr-calendar {
    border-radius: 1.1rem !important;
    box-shadow: 0 20px 25px -5px rgba(0, 0, 0, 0.05), 0 10px 10px -5px rgba(0, 0, 0, 0.04) !important;
    border: 1px solid #e2e8f0 !important;
    padding: 4px !important;
}

.flatpickr-day.selected,
.flatpickr-day.startRange,
.flatpickr-day.endRange {
    background: #0d9488 !important;
    border-color: #0d9488 !important;
    border-radius: 0.5rem !important;
}

.flatpickr-day:hover {
    border-radius: 0.5rem !important;
}

/* DataTables Responsive Child Details View styling (Styled Key-Value Flex List) */
tr.child td.child {
    padding: 1rem 1.5rem !important;
    background-color: #f8fafc !important;
    border-bottom: 1px solid #e2e8f0 !important;
}

ul.dtr-details {
    display: flex !important;
    flex-direction: column !important;
    gap: 0.75rem !important;
    width: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
    list-style: none !important;
}

ul.dtr-details li {
    display: flex !important;
    justify-content: space-between !important;
    align-items: center !important;
    width: 100% !important;
    padding: 0.75rem 1.15rem !important;
    background-color: #ffffff !important;
    border: 1px solid #e2e8f0 !important;
    border-radius: 0.85rem !important;
    box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.02) !important;
    transition: all 0.2s ease-in-out !important;
}

ul.dtr-details li:hover {
    border-color: #cbd5e1 !important;
    background-color: #fafbfc !important;
    transform: translateY(-1.5px) !important;
    box-shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.02) !important;
}

ul.dtr-details li .dtr-title {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: #64748b !important;
    text-align: right !important;
}

ul.dtr-details li .dtr-data {
    font-size: 0.75rem !important;
    font-weight: 700 !important;
    color: #1e293b !important;
    text-align: left !important;
    display: inline-flex !important;
    align-items: center !important;
    gap: 0.25rem !important;
}