/* This files contains custom css needed, it contains the next sections: 
    - Shared classes
    - Map page styles 
    - Override of mud blazor components classes
*/


/* Themes for non blazor components */
.dark-theme {
    --dash-card-border-color: rgba(40, 40, 42, 0.6);
}

.light-theme {
    --dash-card-border-color: rgba(221, 218, 215, 0.6);
}

:root {
    --map-header-height: 48px;
}


/* Class for custom toggle button component*/
.togglebutton {
    --mud-button-border-color: var(--mud-palette-primary);
}

/* Class for all pages margin */
.page-margin {
    margin: 0px; 
    padding: 30px;
    width: 100%; 
}

/*traffic light status */
.status-icon {
    font-size: 12px;
}

.dash-panel {
    --card-gap: 10px;
    gap: var(--card-gap);
    padding: 10px;
}

.dash-card {
    display: block;
    /*    width: calc(100%-20px);*/
    background-color: var(--mud-palette-drawer-background);
    border: 1px solid var(--dash-card-border-color);
    border-radius: 14px;
    padding-left: 10px;
    padding-right: 10px;
    padding-top: 10px;
    padding-bottom: 0px; /* solves LiveCharts layout/padding for x axis/bottom of charts, for now */
    margin-left: 0px;
    margin-top: 0px;
    min-width: 260px;
}

.card-bar {
    width: 100%;
    height: calc(100% - 25px);
}


.label-primary-color .mud-input-label-text  {
    color: var(--mud-palette-primary) !important;
}

.icon-row {
    padding-left: 0px !important;
    padding-right: 0px !important;
}

.drawer-header {
    padding-top: 8px !important;
    padding-left: 16px !important;
    padding-right: 10px !important;
}

.drawer-item {
    padding-left: 16px !important;
    padding-right: 10px !important;
}


.custom-navmenu .mud-nav-link.active:not(.mud-nav-link-disabled) {
    border-top-right-radius: 8px;
    border-bottom-right-radius: 8px;
    padding-right: 0px;
    max-width: calc(100% - 20px);
    background-color: var(--mud-palette-primary) !important;
    color: black !important;
}

.custom-navmenu .mud-nav-link.active:not(.mud-nav-link-disabled) svg {
    color: black !important;
}

/* Map page styles */
#map {
    min-height: calc(100vh - var(--mud-appbar-height));
    overflow: hidden;
    scrollbar-width: none; /*Firefox */
    -ms-overflow-style: none; /*IE and Edge */
    /* #216: shows through whenever the GL canvas is mid-resize (the buffer
       clears to transparent for a frame) — without it the dark theme's black
       page background flashes. Tone approximates the road basemap. */
    background-color: #dfdcd7;
}

    #map::-webkit-scrollbar {
        display: none; /* Chrome, Safari, and Opera */
    }


/* Hide only the map style name text inside the button */
.azure-maps-control-button.curr-style {
    font-size: 0;
}
.azure-maps-control-button.curr-style img,
.azure-maps-control-button.curr-style .icon {
    font-size: initial; /*Restores font size for icons and images */
}
/* End map page styles */


/* overide moving mud app bar gutters so the menu icon stays inline with the nav menu icons*/
.mud-toolbar-gutters {
    padding-left: 16px !important;
    padding-right: 16px !important;
}

/* align menu menuitem names with nexus logo */
.mud-nav-link .mud-nav-link-text {
    margin-left: 16px !important;
}

.mud-nav-link {
    font-size: var(--mud-typography-body2-size);
    font-weight: var(--mud-typography-body2-weight);
    line-height: var(--mud-typography-body2-lineheight);
    letter-spacing: var(--mud-typography-body2-letterspacing);
    padding-left: 16px;
}

    .custom-navmenu .mud-nav-link.active:not(.mud-nav-link-disabled) {
    border-top-right-radius: 0px;
    border-bottom-right-radius: 0px;
    padding-right: 0px;
    max-width: calc(100% - 0px);
    background-color: var(--mud-palette-primary) !important;
    color: black !important;
}

.custom-navmenu .mud-nav-link.active:not(.mud-nav-link-disabled) svg {
    color: black !important;
}


.w-25 {
    width: 25%;
}

.w-100 {
    width: 100%;
}

.h-100 {
    height: 100%;
}

.transparent-table {
    background-color: transparent;
}


.custom-color-picker .mud-input-slot {
    display: none !important;
}

.custom-color-picker .mud-input.mud-input-underline:before {
    border-bottom: none !important;
}

.custom-color-picker .mud-input.mud-input-underline:after{
    border-bottom: none !important;
}



.map-header {
    position: absolute;
    background-color: var(--mud-palette-drawer-background);
    width: 100%;
    z-index: 1000;
    height: var(--map-header-height);
    padding-left: 16px !important; /* match .dashboard-header so the view select isn't flush against the nav */
    padding-right: 10px !important;
}

.dashboard-header {
    background-color: var(--mud-palette-drawer-background);
    width: 100%;
    height: var(--map-header-height);
    padding-left: 16px !important;
    padding-right: 8px !important;
}

.header-select {
/*    padding-left: 15px;*/
    padding-top: 0px;
    padding-bottom: 0px;
    width: 20%;
}

.card-select {
    /*    padding-left: 15px;*/
    padding-top: 0px;
    padding-bottom: 0px;
    width: 110px;
}

.search-bar-width {
    width: 40%;
    min-width:87px;
}

.highlight-row {
    background-color: color-mix(in srgb, var(--mud-palette-primary-darken) 30%, transparent) !important;
    transition: background-color 0.3s ease !important;
}

.filter-tabs {
    background-color: var(--mud-palette-background) !important;
}
/* #535: Current Conditions panel (Map page bottom panel).
   Height is set on the drawer itself; these rules only keep the header row and the
   body legible as the window narrows. */
.current-conditions-panel .cc-header {
    height: 38px;
    min-height: 38px;
    flex: none;
}

.current-conditions-panel .cc-title {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    max-width: 40%;
}

.current-conditions-panel .cc-chip {
    flex: none;
    margin: 0 !important;
}

.current-conditions-panel .cc-body {
    flex: 1;
    min-height: 0;
    overflow: hidden;
    padding: 0 16px 10px 16px;
}

/* #536: Current Conditions device state - readings on the left, chart on the right.
   The column count is chosen in C# from the schema's field count; these classes only
   carry it out. */
.current-conditions-panel .cc-split {
    display: flex;
    height: 100%;
    min-height: 0;
    gap: 12px;
}

.current-conditions-panel .cc-readings {
    width: 47%;
    min-width: 0;
    display: flex;
    flex-direction: column;
    border-right: 1px solid var(--mud-palette-lines-default);
    padding-right: 12px;
}

.current-conditions-panel .cc-chart {
    flex: 1;
    min-width: 0;
    display: flex;
    flex-direction: column;
}

.current-conditions-panel .cc-cap {
    font-size: 9px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--mud-palette-primary);
    margin-bottom: 6px;
    flex: none;
}

.current-conditions-panel .cc-cap-ts {
    margin-left: 8px;
    text-transform: none;
    letter-spacing: 0;
    color: var(--mud-palette-text-secondary);
}

.current-conditions-panel .cc-grid {
    display: grid;
    gap: 8px 8px;
    align-content: start;
}

.current-conditions-panel .cc-grid-2 { grid-template-columns: repeat(2, 1fr); }
.current-conditions-panel .cc-grid-3 { grid-template-columns: repeat(3, 1fr); }

/* more fields than fit: the readings scroll, the chart half never moves */
.current-conditions-panel .cc-grid-scroll {
    overflow-y: auto;
    min-height: 0;
    flex: 1;
}

.current-conditions-panel .cc-item label {
    display: block;
    font-size: 8.5px;
    letter-spacing: .4px;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
    margin-bottom: 2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.current-conditions-panel .cc-item > div {
    font-size: 13px;
    font-variant-numeric: tabular-nums;
}

/* few enough fields to breathe: bigger numbers, reads as a status board */
.current-conditions-panel .cc-grid-big .cc-item > div { font-size: 19px; font-weight: 500; }

.current-conditions-panel .cc-uom {
    font-size: 9px;
    color: var(--mud-palette-text-secondary);
    margin-left: 3px;
}

.current-conditions-panel .cc-chart-head {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: none;
    margin-bottom: 2px;
}

.current-conditions-panel .cc-field-select { max-width: 190px; }

.current-conditions-panel .cc-range {
    margin-left: auto;
    color: var(--mud-palette-text-secondary);
    letter-spacing: .3px;
    white-space: nowrap;
}

.current-conditions-panel .cc-chart-body {
    flex: 1;
    min-height: 0;
}

/* #537: Current Conditions non-device states - pager, alert, and the three feature kinds. */
.current-conditions-panel .cc-pager-count {
    white-space: nowrap;
    text-transform: uppercase;
    letter-spacing: .4px;
}

/* a message reads as a sentence, not a stat: give it the full row */
.current-conditions-panel .cc-item-wide { grid-column: 1 / -1; }

/* property values are text, not numbers - no tabular figures, and they may wrap */
.current-conditions-panel .cc-item .cc-text {
    font-size: 11.5px;
    font-variant-numeric: normal;
    line-height: 1.35;
    overflow-wrap: anywhere;
}

.current-conditions-panel .cc-actions {
    display: flex;
    align-items: center;
    gap: 8px;
    margin-top: 8px;
    flex: none;
}

.current-conditions-panel .cc-name-field { max-width: 220px; }

.current-conditions-panel .cc-scroll {
    overflow-y: auto;
    min-height: 0;
}

/* the one number a feature leads with, where a device would have its chart */
.current-conditions-panel .cc-hero {
    display: flex;
    flex-direction: column;
    justify-content: center;
    height: 100%;
}

.current-conditions-panel .cc-hero small {
    font-size: 9px;
    letter-spacing: .6px;
    text-transform: uppercase;
    color: var(--mud-palette-primary);
    margin-bottom: 6px;
}

.current-conditions-panel .cc-hero strong {
    font-size: 30px;
    font-weight: 600;
    line-height: 1;
    font-variant-numeric: tabular-nums;
}

/* #538: keep the map's own controls clear of the chrome that overlays the map.
   Azure Maps v3 is built on MapLibre, so its control containers are the maplibregl
   ones - the same namespace map.js already reaches into for .maplibregl-canvas-container. */

/* The controls moved to TopRight, and .map-header is an absolute overlay across the top
   48px of the map container, so without this they render underneath it. */
#map .maplibregl-ctrl-top-right {
    top: var(--map-header-height);
}

/* The Current Conditions panel (#535) sits across the bottom of the map as a 38px bar even
   with nothing selected. Anything anchored to the bottom - the attribution line in
   particular - has to sit above it. Mirrors CurrentConditionsPanel.CollapsedHeight; when
   the panel is expanded to its full height it does cover these, which is a deliberate,
   temporary overlay rather than a permanent one. */
#map .maplibregl-ctrl-bottom-left,
#map .maplibregl-ctrl-bottom-right {
    bottom: 38px;
}
