/*--------------General--------------*/
:root {
    --mantine-primary-color-filled: var(--mantine-color-orange-light-color) !important;
    --mantine-primary-color-filled-hover: var(--mantine-color-orange-light-color) !important;
    --input-bd-focus: var(--mantine-color-orange-light-color) !important;
}

/* Light theme softening (charte graphique): use a gentle off-white for the page
   background and structural chrome (AppShell header/navbar, login panel) instead of
   pure white. Surfaces such as Cards, Modals and inputs keep --mantine-color-white
   (#fff) so they stand out slightly against the off-white background.
   Scoped to the light scheme ONLY so the dark theme keeps its own background.
   Selector mirrors Mantine's own :root[data-mantine-color-scheme="light"] specificity so
   it overrides the default #fff (our sheet loads after Mantine's). */
:root[data-mantine-color-scheme="light"] {
    --mantine-color-body: #fdfdfc;
}

.hidden {
    display: none;
}

/* Custom Scrollbar for Webkit browsers (Chrome, Edge, Safari, Opera) */
::-webkit-scrollbar {
    width: 4px;
}
/* Firefox-specific scrollbar styling */
* {
    scrollbar-width: thin;
}

/* Scroll offset for doc headings below fixed header */
h2[id], h4[id] {
    scroll-margin-top: 100px;
}

/* Hide scrollbar for TOC aside */
.hide-scrollbar::-webkit-scrollbar {
    display: none;
}

/* Chevrons select */
.mantine-ComboboxChevron-chevron {
    display: none;
}

/* Arrow selection theme */
*:where([data-combobox-selected]) {
    background-color: var(--mantine-color-orange-light-color) !important;
    color: var(--mantine-color-white) !important;
}

/* Text selection theme */
::selection {
    background-color: var(--mantine-color-gray-1) !important;
    color: var(--mantine-color-dark-blue-light-color) !important;
}

/* Carousel Indicator styles */
.dmc-indicator {
    width: 12px;
    height: 4px;
    transition: width 250ms ease;
    background-color: var(--mantine-color-gray-1) !important;
    &[data-active] {
        width: 40px;
        background-color: var(--mantine-color-orange-light-color) !important;
  }
}
.mantine-Carousel-indicators {
    position: initial !important;
    margin-top: 1rem;
}


/* --------------Dash Leaflet customization (Mantine theme integration)-------------- */
/* Custom dark basemap: invert light tiles (no free native dark tiles) */
.map-tiles-dark {
    -webkit-filter: invert(1) hue-rotate(180deg) brightness(1.8) contrast(0.7);
    filter: invert(1) hue-rotate(180deg) brightness(1.8) contrast(0.7);
}

/* hidden tooltips */
.no-labels .leaflet-tooltip {
    display: none !important;
}

/* hidden colorbar */
.no-colorbar .leaflet-control-colorbar {
    display: none !important;
}

/* Active state easy button */
.easy-button-button:has(.btn-icon-active) {
    background-color: var(--mantine-primary-color-filled) !important;
    color: white !important;
}

/* Scale bar styling (ScaleControl) */
.leaflet-control-scale-line {
    background-color: var(--mantine-color-body) !important;
    color: var(--mantine-color-text) !important;
    border-color: var(--mantine-color-default-border) !important;
    font-family: 'SVN-Century Gothic', sans-serif;
    text-shadow: none !important;
}

/* Layers control menu container (LayersControl) */
.leaflet-control-layers {
    background-color: var(--mantine-color-body) !important;
    color: var(--mantine-color-text) !important;
    border: 1px solid var(--mantine-color-gray-filled) !important;
    border-radius: var(--mantine-radius-xs) !important;
}
.leaflet-control-layers-separator {
    border-top: 1px solid var(--mantine-color-gray-filled) !important;
}
/* Radio buttons and checkboxes color */
.leaflet-control-layers-selector {
    accent-color: var(--mantine-primary-color-filled);
    cursor: pointer;
}
/* Layers control button (Bootstrap icon replacement) */
.leaflet-control-layers-toggle {
    background-image: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
    color: var(--mantine-primary-color-filled) !important;
    text-decoration: none !important;
}
.leaflet-control-layers-toggle::after {
    content: "\F45A";
    font-family: bootstrap-icons !important;
    font-size: 25px;
}
.leaflet-control-layers-expanded .leaflet-control-layers-toggle {
    display: none !important;
}

/* Buttons controls container */
.leaflet-bar, .easy-button-container {
    border: 1px solid var(--mantine-color-gray-filled) !important;
    border-radius: var(--mantine-radius-xs) !important;
}
.leaflet-bar a, .easy-button-button {
    background-color: var(--mantine-color-body) !important;
    color: var(--mantine-color-text) !important;
    border-bottom: 1px solid var(--mantine-color-gray-filled) !important;
}
.leaflet-bar a:last-child, .easy-button-button:last-child {
    border-bottom: none !important;
}
.leaflet-bar a:hover, .easy-button-button:hover {
    background-color: var(--mantine-color-default-hover) !important;
}
.easy-button-button {
    padding: 0 !important;
    line-height: 1 !important;
 }
.leaflet-bar button:first-of-type,
.leaflet-bar button:last-of-type {
    border-radius: var(--mantine-radius-xs) !important;
}
.easy-button-button .button-state {
    font-size: 20px !important;
    display: flex !important;
    align-items: center !important;
    justify-content: center !important;
}

/* Fullscreen control button (Bootstrap icon replacement) */
.fullscreen-icon {
    background-image: none !important;
    display: flex !important;
    align-items: center;
    justify-content: center;
}
.fullscreen-icon::after {
    content: "\F3DF";
    font-family: bootstrap-icons !important;
    font-size: 18px;
}
.leaflet-fullscreen-on::after { /* exit */
    content: "\F3DE";
}

/* Colorbar customization */
.leaflet-control-colorbar {
    background-color: var(--mantine-color-body) !important;
    color: var(--mantine-color-text) !important;
    border: 1px solid var(--mantine-color-gray-filled) !important;
    border-radius: var(--mantine-radius-xs) !important;
    padding: 10px !important;
    font-family: 'SVN-Century Gothic', sans-serif !important;
}

/* Tooltips customization */
.leaflet-tooltip {
    background-color: var(--mantine-color-body) !important;
    border: 1px solid var(--mantine-color-default-border) !important;
    border-radius: var(--mantine-radius-xs) !important;
    color: var(--mantine-color-text) !important;
    box-shadow: var(--mantine-shadow-xs) !important;
    font-family: 'SVN-Century Gothic', sans-serif !important;
    padding: 2px 6px !important;
}
/* Arrow */
.leaflet-tooltip-top:before,
.leaflet-tooltip-bottom:before,
.leaflet-tooltip-left:before,
.leaflet-tooltip-right:before {
    display: none !important;
}

/* Popup Customization */
.leaflet-popup-content-wrapper {
    background-color: var(--mantine-color-body) !important;
    color: var(--mantine-color-text) !important;
    border: 1px solid var(--mantine-color-default-border) !important;
    border-radius: var(--mantine-radius-sm) !important;
    box-shadow: var(--mantine-shadow-xs) !important;
}
/* Arrow */
.leaflet-popup-tip {
    background-color: var(--mantine-color-body) !important;
    border: 1px solid var(--mantine-color-default-border) !important;
    box-shadow: var(--mantine-shadow-xs) !important;
}
.leaflet-popup-content {
    margin: 10px !important;
    width: auto !important;
    font-family: 'SVN-Century Gothic', sans-serif !important;
}
.leaflet-popup-content p {
    margin: 0 !important;
}
/* exit */
.leaflet-popup-close-button {
    color: var(--mantine-color-dimmed) !important;
    padding: 4px 4px 0 0 !important;
    font-size: 20px !important;
}
.leaflet-popup-close-button:hover {
    color: var(--mantine-primary-color-filled) !important;
}



/*--------------Header--------------*/
/* Legacy header styles - kept for backward compatibility */
.header {
    overflow: hidden;
    display: flex;
    flex-wrap: nowrap;
    position: sticky;
}

.header i {
    font-size: 24px;
}

/* AppShell Header styles */
.mantine-AppShell-header {
    border-bottom: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4));
}

.mantine-AppShell-header i {
    font-size: 24px;
}


/*--------------Header Settings Dropdown--------------*/
#settings-dropdown-items .bi-upload {
    transform: rotate(90deg);
}

#settings-dropdown-items .mantine-Stack-root {
    padding: 12px;
}

#settings-dropdown-items .mantine-Menu-label {
    font-size: var(--mantine-font-size-sm);
    padding: 0;
}

#settings-dropdown-items .mantine-Menu-item {
    padding: 0;
}

#settings-dropdown-items .mantine-Button-inner {
    justify-content: flex-start;
}


/*--------------Sidebar--------------*/
/* Legacy sidebar styles - kept for backward compatibility */
.vertical-navbar {
    border-right: 1px solid var(--mantine-color-gray-6);
    height: calc(100vh - 70px) !important;
    width: 260px;
}

/* AppShell Navbar styles */
.mantine-AppShell-navbar {
    border-right: 1px solid light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4));
}

.sidebar-divider {
    border-color: light-dark(var(--mantine-color-gray-3), var(--mantine-color-dark-4));
}

.accordion-control-vertical-navbar .mantine-Divider-label {
    margin-right: 1rem;
}

.accordion-control-vertical-navbar:hover {
    background-color: transparent;
}

.btn-vertical-navbar .mantine-Button-inner {
    justify-content: flex-start;
}


/*--------------Pages--------------*/
/* Legacy page container - kept for backward compatibility */
#page-container {
    margin: 70px 0 0 260px;
    height: calc(100vh - 70px);
    width: calc(100vw - 260px);
}

.page-content i {
    font-size: 24px;
    flex-grow: 0;
}

/* AppShell Main content area */
.mantine-AppShell-main {
    min-height: 100vh;
}


/*--------------Cards--------------*/
.card-container {
    overflow: hidden;
}

.card-container h1 {
    font-size: 28px;
    font-weight: 500 !important;
    text-transform: inherit;
    margin: 0;
}


/*--------------Table--------------*/
.custom-table .mantine-Select-root {
    width: 100% !important;
}

.custom-table .mantine-Input-section {
    z-index: 0;
}


/*--------------User Management Page--------------*/
#popover-apps-user-management-target {
    width: 100% !important;
}

#popover-apps-user-management-target .mantine-Group-root {
    cursor: pointer;
}


/*--------------Notification Center--------------*/
.notification-card {
    transition: box-shadow 120ms ease, transform 120ms ease;
}
.notification-card:hover {
    box-shadow: var(--mantine-shadow-sm);
    transform: translateY(-1px);
}
/*--------------Export PNG Button--------------*/
@keyframes spin { from { transform: rotate(0deg); } to { transform: rotate(360deg); } }
.export-png-btn { opacity: 0.4; transition: opacity 0.2s ease; cursor: pointer; }
.export-png-btn:hover { opacity: 1; }
.export-png-spinning { animation: spin 1s linear infinite; }
/*--------------Login Split-Screen--------------*/
.login-split-container {
    display: flex;
    height: 100vh;
}

.login-branding-column {
    flex: 0 0 42%;
}

.login-branding-panel {
    height: 100%;
    background: linear-gradient(135deg, #1a1a1a 0%, #283034 50%, #323b40 100%);
    position: relative;
    overflow: hidden;
}

.login-branding-panel::before {
    content: "";
    position: absolute;
    width: 300px;
    height: 300px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(227, 108, 10, 0.08) 0%, transparent 70%);
    top: -80px;
    right: -60px;
    pointer-events: none;
}

.login-branding-panel::after {
    content: "";
    position: absolute;
    width: 400px;
    height: 400px;
    border-radius: 50%;
    background: radial-gradient(circle, rgba(227, 108, 10, 0.05) 0%, transparent 70%);
    bottom: -120px;
    left: -100px;
    pointer-events: none;
}

.login-branding-logo {
    filter: brightness(0) invert(1);
}

.login-form-column {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 2rem;
    background-color: var(--mantine-color-body);
}

.login-form-content {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
}

.login-form-footer {
    padding-top: 1.5rem;
}

.policy-scroll-area {
    height: calc(100vh - 6rem);
    width: 100%;
    max-width: 600px;
}

@media (max-width: 768px) {
    .login-branding-column {
        display: none;
    }

    .login-form-column {
        padding: 1.5rem;
    }
}

/* Date pickers: make today's date stand out in the app accent color */
.mantine-DatePickerInput-day[data-today]:not([data-selected]):not([data-in-range]) {
    border: 1px solid var(--mantine-color-orange-6);
    color: var(--mantine-color-orange-6);
    font-weight: 700;
}

/* Material Booking AI orb: grow slightly on hover (FAB bottom-right) */
#btn-mb-chat-open cloudb-orb {
    display: block;
    transition: transform 0.25s ease;
}
#btn-mb-chat-open:hover cloudb-orb {
    transform: scale(1.2);
}

/* Material Booking AI chat drawer: left-edge resize handle */
.mb-chat-resize-handle {
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 6px;
    cursor: ew-resize;
    z-index: 10;
    touch-action: none;
}
.mb-chat-resize-handle:hover,
.mb-chat-resize-handle:active {
    background: var(--mantine-color-orange-6);
    opacity: 0.35;
}

/* Material Booking AI chat: dotted grid backdrop on the message area.
   Default (dark scheme) = faint light dots; light scheme override below. */
#mb-chat-messages {
    background-image: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.18) 1.2px,
        transparent 1.2px
    );
    background-size: 20px 20px;
}
:root[data-mantine-color-scheme="light"] #mb-chat-messages {
    background-image: radial-gradient(
        circle,
        rgba(0, 0, 0, 0.14) 1.2px,
        transparent 1.2px
    );
}

/* Material Booking AI chat: make the drawer body a flex column that fills
   the content section, so only the message list scrolls (not the whole
   drawer) regardless of header height. */
#mb-chat-drawer-body {
    flex: 1;
    min-height: 0;
    display: flex;
    flex-direction: column;
}

/* The drawer content section must be a flex column so its body can be
   height-constrained (flex:1) instead of growing with the message list.
   Scoped to our chat drawer via :has() on its unique body id. */
.mantine-Drawer-content:has(> #mb-chat-drawer-body) {
    display: flex;
    flex-direction: column;
}

/* Chat drawer title fills the header width so the new-conversation button
   (margin-left:auto) can sit at the right edge, before the close button. */
#mb-chat-drawer-title {
    flex: 1;
}

/* Small gap between the new-conversation button and the drawer close (X). */
#btn-mb-chat-clear {
    margin-right: var(--mantine-spacing-sm);
}

/* Lignes de catalogue sélectionnables au clavier : sans anneau de focus, on
   tabule à l'aveugle d'une ligne à l'autre. Posé sur :focus-visible pour ne
   pas cerner la ligne à chaque clic de souris. */
.hvac-selectable-row:focus-visible {
    outline: 2px solid var(--mantine-color-orange-filled);
    outline-offset: -2px;
}

/* AG Grid dark theme: default link blue is unreadable on the dark rows
   (AO Intelligence tables and any other markdown-link cell). */
.ag-theme-alpine-dark a {
    color: #74c0fc;
}

.ag-theme-alpine-dark a:hover {
    color: #a5d8ff;
}

/* AG Grid: the alpine themes tie line-height to the row height, so a column
   declaring `wrapText` still renders a single clipped line. Give wrapped cells a
   text line-height and align the text to the top, so a long label fills the two
   lines the grid's rowHeight leaves for it. Only cells of a wrapText column
   carry this class, so no other table is affected. */
.ag-theme-alpine .ag-cell-wrap-text,
.ag-theme-alpine-dark .ag-cell-wrap-text {
    line-height: 1.35;
    align-items: flex-start;
    padding-top: 6px;
}
