﻿.mud-table.hide-toolbar .mud-table-toolbar {
    display: none;
}

/* Header colours */
.mud-table-head th:not(.mud-table-loading) {
    background-color: black;
    color: white !important;
}

.mud-table-loading {
    background-color: white !important;
    color: black !important;
}

/* Editors */
.table-row-editor input,
.table-row-editor select {
    font-size: 14px !important;
    height: 1em !important;
    padding: 1px !important;
}

.table-row-editor {
    background-color: yellow !important;
}

/* Dense padding */
.mud-table-dense * .mud-table-row .mud-table-cell {
    padding: 2px 4px !important;
}

/* Header cell line height */
th.mud-table-cell {
    line-height: 1em !important;
}

.mud-table-cell-custom-group {
    font-size: 16px !important;
}

/* Alignment */
.mud-table td,
.mud-table th {
    text-align: center;
}

    .mud-table td:first-child,
    .mud-table th:first-child {
        text-align: left;
    }

/* Hide default outlined border in editors */
table .mud-input-outlined-border {
    display: none !important;
}

.mud-table-cell input {
    text-align: center !important;
}

/* Dim some entity rows */
.gfd .mud-table-cell.table-row-noeditor,
.irrigationarea-entity .mud-table-cell.table-row-noeditor,
.pivot .mud-table-cell.table-row-noeditor,
.monitoringsite-entity .mud-table-cell.table-row-noeditor,
.watersource-entity .mud-table-cell.table-row-noeditor,
.amendmentsstockpile .mud-table-cell.table-row-noeditor {
    color: silver !important;
}

/* Loading bar */
.mud-table-loading-progress .mud-progress-linear-bar {
    background-color: #2196f3 !important;
}

.mud-table-loading-progress.mud-progress-linear {
    height: 6px !important;
    border-radius: 3px;
}

.mud-table-loading-progress .mud-progress-linear-bar {
    box-shadow: 0 0 6px rgba(33, 150, 243, 0.6);
}

/* =========================================================
   TABLE WRAPPER / SCROLLING
   ========================================================= */

.table-wrapper {
    position: relative;
    max-width: 100%;
    width: 100%;
    box-sizing: border-box;
}

    /* Put the horizontal scroll on the MudTable container */
    .table-wrapper .mud-table-container {
        max-width: 100%;
        width: 100%;
        overflow-x: auto;
        overflow-y: visible;
        scrollbar-gutter: stable;
    }

    /* Root table:
   - at least as wide as container
   - allowed to grow wider (scrollbar will appear) */
    .table-wrapper .mud-table table {
        table-layout: auto;
        min-width: 100%;
        width: max-content;
        border-collapse: separate;
    }

    /* Truncate non-editing cells nicely */
    .table-wrapper .mud-table .mud-table-body tr:not(.editing) td,
    .table-wrapper .mud-table .mud-table-body tr:not(.editing) th {
        overflow: hidden;
        text-overflow: ellipsis;
        white-space: nowrap;
    }

    /* In edit mode, let editors wrap if needed */
    .table-wrapper .mud-table .mud-table-body tr.editing td {
        overflow: visible !important;
        white-space: normal !important;
        text-overflow: clip !important;
    }

/* =========================================================
   STATUS BADGE
   ========================================================= */

.table-status-badge {
    position: absolute;
    left: 8px;
    bottom: 8px;
    z-index: 5;
    pointer-events: auto;
}

    .table-status-badge .mud-button-root {
        opacity: .5;
    }

/* When legend is present, lift badge up */
.table-wrapper.has-legend .table-status-badge {
    bottom: 40px;
}

/* =========================================================
   EXCEPTIONS HOVER
   ========================================================= */

#exceptions-table .mud-table-hover .mud-table-container .mud-table-root
.mud-table-body .mud-table-row:hover {
    background: lightgoldenrodyellow !important;
    cursor: pointer !important;
}

/* Dim table when error */
.table-wrapper.tw-error .mud-table {
    opacity: 0.5;
    pointer-events: none;
}

/* Error overlay */
.table-error-overlay {
    position: absolute;
    inset: 0;
    display: flex;
    align-items: center;
    justify-content: center;
    pointer-events: auto;
    background: rgba(255, 255, 255, 0.05);
}

/* =========================================================
   HIDE MUD'S BUILT-IN EDIT COLUMN
   ========================================================= */

.table-wrapper .editable-table.hide-apply-column .mud-table-root thead tr th:last-child:not(.mud-table-loading),
.table-wrapper .editable-table.hide-apply-column .mud-table-root tbody tr td:last-child:not(.mud-table-loading) {
    display: none !important;
    width: 0 !important;
    padding: 0 !important;
    border: none !important;
}

/* =========================================================
   CUSTOM INLINE EDIT TOOLBAR (LAST CELL)
   ========================================================= */

.table-wrapper .editable-table .table-edit-toolbar-cell {
    position: sticky;
    right: 0;
    z-index: 6;
    width: 70px;
    min-width: 70px;
    max-width: 70px;
    padding: 0 !important;
    text-align: center;
}

.table-wrapper .editable-table .table-edit-toolbar {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    gap: 4px;
    padding: 4px 6px;
    border-radius: 4px;
    background: rgba(255, 255, 255, 0.8);
    box-shadow: -2px 0 4px rgba(0, 0, 0, 0.12);
}

    .table-wrapper .editable-table .table-edit-toolbar .mud-button-root {
        min-width: 0;
        padding-left: 2px;
        padding-right: 2px;
        margin: 0 1px;
    }

/* =========================================================
   PANEL ENTITY COLOUR THEMES
   ========================================================= */

.panel-entity-amendments th.mud-table-cell {
    background-color: var(--color_amendments_light) !important;
    color: var(--color_amendments) !important;
}

.panel-entity-amendments .mud-table th {
    border-top: 1px solid var(--color_amendments);
    border-bottom: 1px solid var(--color_amendments);
}

.panel-entity-zone th.mud-table-cell {
    background-color: var(--color_zone_light) !important;
    color: var(--color_zone) !important;
}

.panel-entity-zone .mud-table th {
    border-top: 1px solid var(--color_zone);
    border-bottom: 1px solid var(--color_zone);
}

.panel-entity-stockpiles th.mud-table-cell {
    background-color: var(--color_stockpiles_light) !important;
    color: var(--color_stockpiles) !important;
}

.panel-entity-stockpiles .mud-table th {
    border-top: 1px solid var(--color_stockpiles);
    border-bottom: 1px solid var(--color_stockpiles);
}

.panel-entity-watersource th.mud-table-cell {
    background-color: var(--color_watersource_light) !important;
    color: var(--color_watersource) !important;
}

.panel-entity-watersource .mud-table th {
    border-top: 1px solid var(--color_watersource);
    border-bottom: 1px solid var(--color_watersource);
}

.panel-entity-user .mud-table th {
    border-top: 1px solid var(--color_user);
    border-bottom: 1px solid var(--color_user);
}

.panel-entity-user th.mud-table-cell {
    background-color: var(--color_user_light) !important;
    color: var(--color_user) !important;
}

.panel-entity-system th.mud-table-cell {
    background-color: var(--color_system_light) !important;
    color: var(--color_system) !important;
}

.panel-entity-system .mud-table th {
    border-top: 1px solid var(--color_system);
    border-bottom: 1px solid var(--color_system);
}

.panel-entity-sulphur th.mud-table-cell {
    background-color: var(--color_sulphur_light) !important;
    color: var(--color_sulphur) !important;
}

.panel-entity-sulphur .mud-table th {
    border-top: 1px solid var(--color_sulphur);
    border-bottom: 1px solid var(--color_sulphur);
}

.panel-entity-soilsurface th.mud-table-cell {
    background-color: var(--color_soilsurface_light) !important;
    color: var(--color_soilsurface) !important;
}

.panel-entity-soilprofile th.mud-table-cell {
    background-color: var(--color_soilprofile_light) !important;
    color: var(--color_soilprofile) !important;
}

.panel-entity-soilsurface .mud-table th {
    border-top: 1px solid var(--color_soilsurface);
    border-bottom: 1px solid var(--color_soilsurface);
}

.panel-entity-soilprofile .mud-table th {
    border-top: 1px solid var(--color_soilprofile);
    border-bottom: 1px solid var(--color_soilprofile);
}

.panel-entity-irrigationarea th.mud-table-cell {
    background-color: var(--color_irrigationarea_light) !important;
    color: var(--color_irrigationarea) !important;
}

.panel-entity-irrigationarea .mud-table th {
    border-top: 1px solid var(--color_irrigationarea);
    border-bottom: 1px solid var(--color_irrigationarea);
}

.panel-entity-irrigation th.mud-table-cell {
    background-color: var(--color_irrigation_light) !important;
    color: var(--color_irrigation) !important;
}

.panel-entity-irrigation .mud-table th {
    border-top: 1px solid var(--color_irrigation);
    border-bottom: 1px solid var(--color_irrigation);
}

.panel-entity-gypsum th.mud-table-cell {
    background-color: var(--color_gypsum_light) !important;
    color: var(--color_gypsum) !important;
}

.panel-entity-gypsum .mud-table th {
    border-top: 1px solid var(--color_gypsum);
    border-bottom: 1px solid var(--color_gypsum);
}

.panel-entity-gfd th.mud-table-cell {
    background-color: var(--color_gfd_light) !important;
    color: var(--color_gfd) !important;
}

.panel-entity-gfd .mud-table th {
    border-top: 1px solid var(--color_gfd);
    border-bottom: 1px solid var(--color_gfd);
}

/* =========================================================
   LEGEND (SAFE EVEN IF YOU REMOVE THE MARKUP)
   ========================================================= */

.data-table-legend {
    display: block !important;
    max-width: 100%;
    width: 100%;
    overflow-x: hidden; /* legend will never create horizontal scroll */
    box-sizing: border-box;
}

.table-legend {
    display: flex !important;
    flex-wrap: wrap !important;
    justify-content: center !important;
    align-items: center;
    gap: 0.5rem;
    max-width: 100%;
}

.table-legend-item {
    display: inline-flex !important;
    flex: 0 1 auto !important;
    align-items: center;
    gap: 0.25rem;
    white-space: normal !important; /* allow wrapping of text */
    min-width: 0;
}

.table-legend-color {
    box-sizing: border-box;
}

/* Header sort label colour overrides */
.mud-table-head th .mud-table-sort-label {
    color: black !important;
}
/*
.mud-table-head td.mud-table-cell {
    color: black !important;
}*/
.admin-page .mud-table-head th .mud-table-sort-label {
    color: white !important;
}