/*
 * Styles of the application, on top of the Metronic theme (loaded in the layout for every page).
 * Use theme variables (--bs-*) whenever possible.
 */

/* Page title in the top bar (section "header" of the pages): Metronic hides it below 992px, here it stays visible
   (truncated, the breadcrumb is hidden below 768px) */
/* Dashboard: long tables scroll inside the card, with the header fixed */
.dashboard-table-scroll {
    max-height: 460px;
    overflow-y: auto;
}

.dashboard-table-scroll thead th {
    position: sticky;
    top: 0;
    z-index: 1;
    background-color: var(--bs-card-bg);
}

@media (max-width: 991.98px) {
    .app-header .page-title {
        display: flex !important;
    }
}

/* Lines of a document (proposals and orders), in the look of the legacy table */
.table.document-lines {
    font-size: 0.925rem;
    border: 1px solid var(--bs-gray-200);
}

.table.document-lines > :not(caption) > * > * {
    border: 1px solid var(--bs-gray-200);
    padding: 0.4rem;
    vertical-align: middle;
}

.table.document-lines > thead > tr > th {
    font-weight: 600;
    text-align: center;
    color: var(--bs-gray-900);
}

.document-lines .form-check-input {
    width: 1.25rem;
    height: 1.25rem;
    float: none;
    margin: 0;
}

.document-lines .form-control,
.document-lines .input-group-text {
    font-size: inherit;
    background: transparent;
    border-width: 0 0 1px;
    border-color: var(--bs-gray-200);
    border-radius: 0;
}

.document-lines .select2-selection {
    font-size: inherit;
    background-color: transparent;
    border-width: 0 0 1px !important;
    border-radius: 0 !important;
}

.document-lines .form-control:focus {
    border-color: var(--bs-primary);
}

.document-lines .form-control.is-invalid {
    border-color: var(--bs-danger);
}

/* Columns adjusted by the user (app/core/column-resize.js) */
table[data-resizable] {
    table-layout: fixed;
}

.document-lines[data-resizable] {
    min-width: 1000px;
}

.document-lines[data-resizable] > thead > tr > th {
    padding-inline: 0.2rem;
}

.document-lines[data-resizable] .form-control {
    padding-inline: 0.35rem;
}

.document-lines[data-resizable] .input-group-text {
    padding-inline: 0.2rem;
}

table[data-resizable] > thead > tr > th {
    position: relative;
}

.column-grip {
    position: absolute;
    top: 0;
    right: 0;
    bottom: 0;
    width: 7px;
    cursor: col-resize;
    touch-action: none;
}

.column-grip:hover,
.column-grip:active {
    background-color: var(--bs-primary);
    opacity: 0.5;
}

.document-lines-handle {
    text-align: center;
    color: var(--bs-gray-500);
}

.document-lines [data-drag-handle] {
    cursor: grab;
}

.document-lines-section td {
    background-color: var(--bs-gray-100);
}

.document-lines tr.document-lines-dragging {
    opacity: 0.4;
}

.document-lines tr.document-lines-drop-before > td {
    border-top: 2px solid var(--bs-primary);
}

.document-lines tr.document-lines-drop-after > td {
    border-bottom: 2px solid var(--bs-primary);
}

.document-products .dropdown-item.active {
    background-color: var(--bs-primary);
    color: var(--bs-white);
}

/* Kanban of the deals. The columns of closing and deleting show while dragging, fixed in a corner: always within reach */
.kanban-board[data-kind="close"],
.kanban-board[data-kind="delete"] {
    position: fixed;
    bottom: 1.5rem;
    width: 220px !important;
    margin: 0 !important;
    z-index: 1000;
    background-color: var(--bs-gray-200);
    border: 2px dashed var(--bs-gray-500);
    box-shadow: var(--bs-box-shadow);
}

.kanban-board[data-kind="close"] {
    right: 1.5rem;
}

.kanban-board[data-kind="delete"] {
    right: calc(1.5rem + 236px);
}

.kanban-board[data-kind="close"] .kanban-drag,
.kanban-board[data-kind="delete"] .kanban-drag {
    min-height: 90px;
    max-height: 90px;
    overflow: hidden;
}

.kanban-board .kanban-board-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
}

.kanban-board .kanban-title-board {
    font-weight: 600;
}

.kanban-board .kanban-title-button {
    margin: 0 !important;
    flex-shrink: 0;
}

.kanban-board.kanban-unavailable {
    opacity: .4;
}

.kanban-card {
    display: flex;
    align-items: center;
    gap: .75rem;
    padding-right: 1.25rem;
    position: relative;
}

.kanban-card-menu {
    position: absolute;
    top: -.5rem;
    right: -.75rem;
}

.kanban-user {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 2.25rem;
    height: 2.25rem;
    border-radius: 50%;
    font-size: .8rem;
    font-weight: 600;
    color: var(--bs-primary);
    background-color: var(--bs-primary-light);
}

/* Expense dashboard. Colours of the series, the same as in app/core/charts.js */
.chart-slot-0 { --chart-slot: #2a78d6; }
.chart-slot-1 { --chart-slot: #eb6834; }
.chart-slot-2 { --chart-slot: #1baf7a; }
.chart-slot-3 { --chart-slot: #eda100; }
[data-bs-theme="dark"] .chart-slot-0 { --chart-slot: #3987e5; }
[data-bs-theme="dark"] .chart-slot-1 { --chart-slot: #d95926; }
[data-bs-theme="dark"] .chart-slot-2 { --chart-slot: #199e70; }
[data-bs-theme="dark"] .chart-slot-3 { --chart-slot: #c98500; }

.expense-tile {
    border: 2px solid var(--chart-slot);
}

.expense-tile-icon {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 4rem;
    height: 4rem;
    background-color: var(--chart-slot);
}

.expense-tile-icon i {
    font-size: 1.75rem;
    color: #fff;
}

.expense-section {
    border-top: 3px solid var(--chart-slot);
}

/* Fleet dashboard */
.fleet-tile {
    border: 2px solid transparent;
}

.fleet-tile:hover,
.fleet-tile-selected {
    border-color: var(--bs-primary);
}

.fleet-plate-danger {
    color: #fff;
    background-color: var(--bs-danger);
}

.fleet-plate-orange {
    color: #1a1a19;
    background-color: #fd7e14;
}

.fleet-plate-warning {
    color: #1a1a19;
    background-color: var(--bs-warning);
}

/* Home page */
.dashboard-tile {
    border: 2px solid transparent;
}

a.dashboard-tile:hover {
    border-color: var(--bs-primary);
}

/* Line below the title of a card, as in the legacy application. Only on cards with a title: the header of a list holds its filters */
:root {
    --card-title-line-start: #000000;
}

[data-bs-theme="dark"] {
    --card-title-line-start: #ffffff;
}

.card > .card-header:has(> .card-title > :is(h2, h3)) {
    position: relative;
}

.card > .card-header:has(> .card-title > :is(h2, h3))::after {
    content: "";
    position: absolute;
    left: 0;
    bottom: 0;
    width: 100%;
    height: 3px;
    background: linear-gradient(to right, var(--card-title-line-start), #df3c41);
}

.card > .card-header:has(> .card-title > :is(h2, h3)) + .card-body,
.card > .card-header:has(> .card-title > :is(h2, h3)) + .collapse > .card-body {
    padding-top: 1.5rem !important;
}

/* The sections of the expenses keep the colour of their type */
.expense-section > .card-header:has(> .card-title > :is(h2, h3))::after {
    background: var(--chart-slot);
}

/* Syswave colours, as in the legacy application: the primary colour of the theme and the gradient of the top bar */
:root,
[data-bs-theme="light"] {
    --bs-primary: #862427;
    --bs-primary-rgb: 134, 36, 39;
    --bs-primary-active: #6b1c1f;
    --bs-primary-light: #f8e9e9;
    --bs-primary-clarity: rgba(134, 36, 39, 0.2);
    --bs-primary-inverse: #ffffff;
    --bs-text-primary: #862427;
    --bs-link-color: #862427;
    --bs-link-color-rgb: 134, 36, 39;
    --bs-link-hover-color: #6b1c1f;
    --bs-link-hover-color-rgb: 107, 28, 31;
    --bs-focus-ring-color: rgba(134, 36, 39, 0.25);
    --bs-component-active-bg: #862427;
    --bs-component-checked-bg: #862427;
    --bs-component-hover-color: #862427;
    --bs-menu-link-color-hover: #862427;
    --bs-menu-link-color-show: #862427;
    --bs-menu-link-color-here: #862427;
    --bs-menu-link-color-active: #862427;
    --bs-nav-pills-link-active-bg: #862427;
    --bs-progress-bar-bg: #862427;
}

/* On a dark background the dark red would not be read: lighter for texts and links */
[data-bs-theme="dark"] {
    --bs-primary: #a93136;
    --bs-primary-rgb: 169, 49, 54;
    --bs-primary-active: #862427;
    --bs-primary-light: #2d1718;
    --bs-primary-clarity: rgba(169, 49, 54, 0.2);
    --bs-primary-inverse: #ffffff;
    --bs-text-primary: #ef8a8e;
    --bs-link-color: #ef8a8e;
    --bs-link-color-rgb: 239, 138, 142;
    --bs-link-hover-color: #f5aeb1;
    --bs-link-hover-color-rgb: 245, 174, 177;
    --bs-focus-ring-color: rgba(169, 49, 54, 0.25);
    --bs-component-active-bg: #a93136;
    --bs-component-checked-bg: #a93136;
    --bs-component-hover-color: #ef8a8e;
    --bs-menu-link-color-hover: #ef8a8e;
    --bs-menu-link-color-show: #ef8a8e;
    --bs-menu-link-color-here: #ef8a8e;
    --bs-menu-link-color-active: #ef8a8e;
    --bs-nav-pills-link-active-bg: #a93136;
    --bs-progress-bar-bg: #a93136;
}

.text-primary {
    color: var(--bs-text-primary) !important;
}

#kt_app_header {
    background: linear-gradient(to right, #000000, #df3c41);
    border-bottom: 0;
    box-shadow: none;
}

/* Over the gradient: title, breadcrumb, last synchronization and the icons. The dropdown menus keep their colours */
#kt_app_header .page-title .page-heading,
#kt_app_header .page-title .breadcrumb-item,
#kt_app_header .page-title .breadcrumb-item a {
    color: #ffffff !important;
}

#kt_app_header .page-title .breadcrumb-item,
#kt_app_header .page-title .breadcrumb-item a {
    opacity: 0.85;
}

#kt_app_header .page-title .breadcrumb-item a:hover {
    opacity: 1;
}

#kt_app_header .page-title .bullet {
    background-color: #ffffff !important;
    opacity: 0.6;
}

#kt_app_header .app-navbar-item > .btn-icon i,
#kt_app_header > .app-container > .d-lg-none .btn-icon i {
    color: #ffffff;
}

#kt_app_header .app-navbar-item > .btn-icon:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
}

/* Page actions, below the top bar as in the legacy application. They stay in view on long pages */
.app-page-actions {
    position: sticky;
    top: var(--bs-app-header-height);
    z-index: 95;
    background-color: var(--bs-app-bg-color);
}

.app-page-actions:not(:has(.btn)) {
    display: none;
}

/* On a phone the buttons take two rows: they would cover too much of the page */
@media (max-width: 991.98px) {
    .app-page-actions {
        position: static;
    }
}

.app-page-actions + #kt_app_content {
    padding-top: 0.5rem;
}

/* Blocked lists, like the other blocked fields */
.select2-container--disabled .select2-selection {
    background-color: var(--bs-gray-200) !important;
}

.swal2-popup .swal2-styled.swal2-confirm {
    background-color: var(--bs-primary);
}

/* The theme writes the blue directly in these, without using its variables */
.form-check-input:checked,
.form-check-input[type="checkbox"]:indeterminate,
.form-check.form-check-solid .form-check-input[type="checkbox"]:indeterminate {
    background-color: var(--bs-primary);
    border-color: var(--bs-primary);
}

.form-control:focus,
.nav-link:focus-visible {
    box-shadow: 0 0 0 0.25rem var(--bs-focus-ring-color);
}

.btn-primary {
    --bs-btn-bg: var(--bs-primary);
    --bs-btn-border-color: var(--bs-primary);
    --bs-btn-hover-bg: var(--bs-primary-active);
    --bs-btn-hover-border-color: var(--bs-primary-active);
    --bs-btn-active-bg: var(--bs-primary-active);
    --bs-btn-active-border-color: var(--bs-primary-active);
    --bs-btn-disabled-bg: var(--bs-primary);
    --bs-btn-disabled-border-color: var(--bs-primary);
}

.nav-pills {
    --bs-nav-pills-link-active-bg: var(--bs-primary);
}

.progress,
.progress-stacked {
    --bs-progress-bar-bg: var(--bs-primary);
}

/* Sidebar as in the legacy application: black, with the logo centred */
.app-sidebar,
.app-sidebar .app-sidebar-logo,
.app-sidebar .app-sidebar-footer {
    background-color: #000000 !important;
}

#kt_app_sidebar_logo > a {
    display: flex;
    justify-content: center;
    width: 100%;
}

#kt_app_sidebar_logo .app-sidebar-logo-default {
    max-width: 175px;
    max-height: 60px;
    object-fit: contain;
}

#kt_app_sidebar_logo .app-sidebar-logo-minimize {
    max-height: 36px;
    object-fit: contain;
}

#kt_app_sidebar_toggle {
    color: #ffffff !important;
    background-color: #1c1c21 !important;
    border: 0 !important;
    box-shadow: none !important;
}

#kt_app_sidebar_toggle i {
    color: inherit !important;
}

#kt_app_sidebar_toggle:hover {
    color: #ffffff !important;
    background-color: #862427 !important;
}
