/*
 * Project styles on top of the Metronic bundles (LTR and the generated RTL
 * ones). Colours live in colors.css. Logical properties are used throughout
 * so the same rules serve both directions.
 */

* {
    scroll-behavior: smooth;
}

/* Typeface: Inter for English, Cairo for Arabic. */
html[lang="ar"] {
    --bs-font-sans-serif: "Cairo", Inter, Helvetica, sans-serif;
    --bs-body-font-family: "Cairo", Inter, Helvetica, sans-serif;
}

html[lang="ar"] body,
html[lang="ar"] .swal2-popup,
html[lang="ar"] .select2-container,
html[lang="ar"] .flatpickr-calendar {
    font-family: "Cairo", Inter, Helvetica, sans-serif;
    letter-spacing: 0;
}

html[lang="ar"] .text-uppercase {
    letter-spacing: 0 !important;
}

/* Numbers, codes and addresses always read left to right. */
.ltr,
[dir="ltr"] {
    direction: ltr;
    unicode-bidi: isolate;
}

/* These elements are LTR themselves, so "start" is their left edge. */
html[dir="rtl"] .ltr,
html[dir="rtl"] input[dir="ltr"],
html[dir="rtl"] textarea[dir="ltr"] {
    text-align: start;
}

html[dir="rtl"] input[type="email"],
html[dir="rtl"] input[type="url"],
html[dir="rtl"] input[type="tel"],
html[dir="rtl"] input[type="password"] {
    direction: ltr;
    text-align: end;
}

.form-control,
.form-select {
    border-color: var(--bs-gray-300) !important;
}

/* Brand wordmark used until logo files are supplied. */
.brand-wordmark {
    font-family: Inter, Helvetica, sans-serif;
    font-weight: 700;
    font-size: 1.5rem;
    letter-spacing: -0.02em;
    line-height: 1;
    color: var(--bs-gray-900);
    direction: ltr;
    white-space: nowrap;
}

.brand-wordmark span {
    color: var(--loadserv-turquoise);
}

.brand-wordmark-light {
    color: #ffffff;
}

/* Dark (staff) sidebar in brand graphite. */
[data-kt-app-layout="dark-sidebar"] .app-sidebar {
    background-color: var(--loadserv-graphite);
    border-inline-end: 0;
}

[data-kt-app-layout="dark-sidebar"] .app-sidebar .app-sidebar-logo {
    border-bottom: 1px dashed #2f2f2f;
}

.app-sidebar .menu .menu-item .menu-link .menu-badge .badge {
    min-width: 1.5rem;
}

/* Minimised sidebar shows the short mark only. */
[data-kt-app-sidebar-minimize="on"]:not([data-kt-app-sidebar-hoverable="true"]) .app-sidebar .brand-wordmark-full,
[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .brand-wordmark-full {
    display: none;
}

.brand-wordmark-mini {
    display: none;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .brand-wordmark-mini {
    display: inline;
}

/* RTL touches the generated bundle cannot infer. */
html[dir="rtl"] .app-sidebar-toggle .ki-black-left-line,
html[dir="rtl"] .breadcrumb .ki-right,
html[dir="rtl"] .rtl-flip {
    transform: scaleX(-1);
}

html[dir="rtl"] .menu-arrow:after {
    transform: scaleX(-1);
}

html[dir="rtl"] .menu-item.show > .menu-link .menu-arrow:after,
html[dir="rtl"] .menu-item.hover > .menu-link .menu-arrow:after {
    transform: rotate(-90deg);
}

html[dir="rtl"] .dt-container .dt-paging .page-link .previous,
html[dir="rtl"] .dt-container .dt-paging .page-link .next {
    transform: scaleX(-1);
}

html[dir="rtl"] .select2-container--bootstrap5 .select2-selection--single .select2-selection__rendered {
    text-align: start;
}

html[dir="rtl"] .swal2-popup {
    direction: rtl;
}

/* DataTables footer row */
.dt-container .dt-length select {
    width: auto;
    display: inline-block;
}

/* Detail cells on show pages */
.detail-label {
    color: var(--bs-gray-600);
    font-weight: 500;
    font-size: 0.925rem;
}

.detail-value {
    color: var(--bs-gray-900);
    font-weight: 600;
    word-break: break-word;
}

/* JSON in the audit log modal */
pre.json-view {
    direction: ltr;
    text-align: start;
    background: var(--bs-gray-100);
    border-radius: 0.475rem;
    padding: 1rem;
    max-height: 320px;
    overflow: auto;
    font-size: 0.85rem;
    white-space: pre-wrap;
    word-break: break-word;
}

/* Auth pages */
body.auth-bg {
    background-color: var(--loadserv-graphite);
    background-image: radial-gradient(1200px 600px at 85% -10%, rgba(105, 180, 188, 0.28), transparent 60%),
    radial-gradient(900px 500px at -10% 110%, rgba(105, 180, 188, 0.18), transparent 60%);
}

@media print {
    .app-header,
    .app-sidebar,
    .app-toolbar,
    .app-footer,
    .scrolltop,
    .no-print {
        display: none !important;
    }

    .app-wrapper,
    .app-main {
        margin: 0 !important;
        padding: 0 !important;
    }
}

/* Company logo (white "LOAD" lettering: always shown on the dark brand colour). */
.brand-logo {
    display: inline-flex;
    align-items: center;
    line-height: 1;
}

.brand-logo-full {
    height: 38px;
    width: auto;
}

.brand-logo-mini,
.brand-logo-mark {
    height: 32px;
    width: auto;
}

.brand-logo-mini {
    display: none;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .brand-logo-full {
    display: none;
}

[data-kt-app-sidebar-minimize="on"] .app-sidebar:not(:hover) .brand-logo-mini {
    display: inline;
}

.brand-logo-band {
    background-color: var(--loadserv-graphite);
}

.brand-logo-auth .brand-logo-full {
    height: 56px;
}

/* Flex children that must be allowed to shrink so .text-truncate works. */
.min-w-0 {
    min-width: 0;
}

.menu-sub-dropdown .scroll-y {
    overflow-x: hidden;
}

/*
 * ApexCharts measures and positions everything left-to-right. Inside an RTL
 * page its tooltip lands off-screen, so the canvas stays LTR and only the
 * text blocks (tooltip, legend) read right-to-left.
 */
html[dir="rtl"] .apexcharts-canvas {
    direction: ltr;
}

html[dir="rtl"] .apexcharts-tooltip,
html[dir="rtl"] .apexcharts-legend,
html[dir="rtl"] .apexcharts-xaxistooltip,
html[dir="rtl"] .apexcharts-yaxistooltip {
    direction: rtl;
    text-align: start;
}

html[dir="rtl"] .apexcharts-tooltip-marker {
    margin-inline: 10px 0;
}

html[lang="ar"] .apexcharts-canvas text,
html[lang="ar"] .apexcharts-legend-text,
html[lang="ar"] .apexcharts-tooltip,
html[lang="ar"] .apexcharts-tooltip *,
html[lang="ar"] .tooltip,
html[lang="ar"] .popover,
html[lang="ar"] .daterangepicker,
html[lang="ar"] .dataTables_wrapper,
html[lang="ar"] .select2-dropdown,
html[lang="ar"] .swal2-container,
html[lang="ar"] .toast,
html[lang="ar"] .modal,
html[lang="ar"] input,
html[lang="ar"] select,
html[lang="ar"] textarea,
html[lang="ar"] button {
    font-family: Cairo, Inter, Helvetica, sans-serif !important;
}

/* Arabic weekday names are wider than the Latin three-letter ones. */
html[lang="ar"] span.flatpickr-weekday {
    font-size: 0.68rem;
    font-weight: 600;
}

/* Arabic glyphs (Cairo) run wider than the Latin face: tighten data tables so the
   last column (row actions, totals) is not pushed out of the card. */
html[lang="ar"] .table-responsive > .table,
html[lang="ar"] .dataTables_wrapper .table {
    font-size: .875rem;
}

html[lang="ar"] .table-responsive > .table > :not(caption) > * > *,
html[lang="ar"] .dataTables_wrapper .table > :not(caption) > * > * {
    padding-inline: .5rem;
}

/* The mark is dark: on the dark (minimized) sidebar it sits on a light tile. */
.app-sidebar .brand-logo-mini {
    background-color: #fff;
    border-radius: 8px;
    padding: 3px;
}
