/*=============================================================================
  Virtual Grid Component CSS - v2.0
  
  A comprehensive stylesheet for a data-rich virtual grid component in Blazor.
  Features include core grid elements, customizable scrollbars, filtering,
  row state indication, modals, and responsive design.
  
  Color scheme:
  - Primary blue: #0072ce, #007acc
  - Success green: rgba(144, 238, 144, 0.5)
  - Warning yellow: rgba(255, 255, 224, 0.6)
  - Danger red: #d9534f, #c9302c
  - Neutral grays: #f9f9f9, #e0e0e0, #ccc, #ddd
  
  Last updated: June 20, 2025
=============================================================================*/

/*=============================================================================
  1. CORE GRID STRUCTURE
=============================================================================*/

/* Main grid container */
.virtual-grid {
    width: 100%;
    /* Zoom-compensated floor: 640px is the design-time minimum width. When the
       page is zoomed in, the CSS-px viewport shrinks and a literal 640px floor
       would push the grid off-screen. Multiplying by `var(--scroll-zoom-comp,
       1)` (written by Dom.js as 1 / browserZoom) keeps the floor at a constant
       on-screen size, so the grid still fits inside the zoomed viewport.
       Fallback `1` keeps the original behavior when the JS hasn't run yet. */
    min-width: calc(640px * var(--scroll-zoom-comp, 1));
    display: flex;
    flex-direction: column;
    align-items: center;
    box-sizing: border-box;

    /* Keep header/tbody first column widths in sync (actions column) */
    --virtual-grid-actions-width: 65px;
}

/* Select Save As dropdown variant (used by sidebar Open action) */
.virtual-grid-select-save-as-dropdown-backdrop {
    background-color: rgba(0,0,0,0.0);
    z-index: 1998;
}

.main-undo-redo-dropdown.virtual-grid-select-save-as-dropdown {
    display: block;
    z-index: 1999;
}

/* Make the currently selected SavedAs stand out more than the generic dropdown selection styling */
.main-undo-redo-dropdown.virtual-grid-select-save-as-dropdown .dropdown-item.selected,
.main-undo-redo-dropdown.virtual-grid-select-save-as-dropdown .dropdown-item.selected:hover {
    background: #e2e2e2;
    background-color: #e2e2e2;
    box-shadow: inset 4px 0 0 #8a8a8a;
    color: #222;
}

.virtual-grid-select-save-as-item {
    display: grid;
    grid-template-columns: 1fr auto;
    align-items: center;
    gap: 6px;
}

.virtual-grid-select-save-as-delete {
    border: 0;
    background: transparent;
    cursor: pointer;
    color: #c62828;
    padding: 6px 10px;
    border-radius: 6px;
}

.virtual-grid-select-save-as-delete:hover {
    background: #f5f5f5;
}

/* Center the grid viewport/table container within whatever page container hosts it.
   Do NOT set a min-width here: the inner container must be free to shrink to the
   table's natural rendered width so the sibling vertical scrollbar lands at the
   table's right edge, not the viewport's. The outer `.virtual-grid` element keeps
   its own `min-width: 640px` so the overall component still won't collapse. */
.virtual-grid-table-container {
    display: block;
    margin-left: auto;
    margin-right: auto;
}

/* Row that contains the horizontally-scrolling table container and the custom
   vertical scrollbar as a sibling. Keeping the scrollbar OUTSIDE the scroll
   container is what prevents it from overlaying the rightmost column when the
   table is scrolled fully right.

   `width: max-content` makes the row shrink-wrap to its children (table
   container + scrollbar lane), so the scrollbar sits flush against the table's
   right edge instead of being pushed to the right edge of the surrounding page
   area. `margin: 0 auto` then horizontally centers the whole pair inside
   `.virtual-grid`. */
.virtual-grid-viewport {
    display: flex;
    flex-direction: row;
    align-items: stretch;
    justify-content: flex-start;
    width: max-content;
    max-width: 100%;
    min-width: 0;
    margin-left: auto;
    margin-right: auto;
}

    .virtual-grid-viewport > .virtual-grid-table-container {
        /* JS sets an explicit pixel width on .virtual-grid-table-container, so it
           must NOT flex-grow (which would push the scrollbar to the far right
           and break centering). Keep it at its assigned width and let
           justify-content on the parent handle horizontal placement. */
        flex: 0 0 auto;
        margin-left: 0;
        margin-right: 0;
        min-width: 0;
    }

.virtual-grid-table-content-wrapper {
    margin-left: auto;
    margin-right: auto;
}

/* Content wrapper that contains the table and its spacers */
.virtual-grid-table-content-wrapper {
    display: inline-block;
    position: relative;
    min-width: 0;
    width: auto;
    /* Removed max-width: 100% to allow table to expand and create horizontal scroll */
}

/* Main table element.

   `table-layout: fixed` locks each column's width to whatever the FIRST
   row (the header) declares (`<th width="...">`). Without this, the default
   `auto` layout lets each rendered row re-influence column widths via
   `max-content`, so as the user scrolls through rows of different content
   lengths the table's total width jitters by 1-2 px on each re-render and
   leaves a small gap between the table's right edge and the sibling vertical
   scrollbar. Fixed layout keeps the column widths -- and therefore the total
   table width -- stable across renders. */
.virtual-grid-table {
    width: max-content;
    /* Removed max-width: 100% to allow table to be its natural width and create horizontal scroll */
    border-collapse: collapse;
    table-layout: fixed;
}

    /* Table cells - both headers and data cells */
    .virtual-grid-table th,
    .virtual-grid-table td {
        padding: 0 8px;
        margin: 0;
        border: 1px solid #ddd;
        text-align: left;
        white-space: nowrap;
        height: 35px;
    }

/* SaveAs is treated as a read-only column; keep the cursor as the default arrow (not the text caret). */
.virtual-grid-table td[data-field="savedas"] {
    cursor: default;
}

    /* Table header styling */
    .virtual-grid-table thead {
        background: #f9f9f9;
        position: sticky;
        top: 0;
        z-index: 500; /* Ensure header stays above content when scrolling */
    }


.virtual-grid-footer-bar {
    width: auto;
    max-width: 100%;
    display: flex;
    justify-content: center;
    box-sizing: border-box;
    padding-top: 5px;
    flex: 0 0 auto;
    min-height: 43px;
    overflow-x: auto;
}

.virtual-grid-footer-host {
    width: 100%;
    max-width: 100%;
    box-sizing: border-box;
    background: rgba(255, 255, 255, 0.95);
    font-weight: 600;
    font-size: 12pt;
    min-height: 38px;
    padding: 0 8px;
    overflow-x: auto;
}

.virtual-grid-footer-row {
    display: flex;
    align-items: center;
    justify-content: flex-start;
    gap: 4px;
    width: 100%;
    flex-wrap: nowrap;
}

.virtual-grid-footer-row-count {
    display: inline-grid;
    grid-template-columns: auto auto;
    align-items: center;
    min-height: 28px;
    justify-content: start;
    column-gap: 4px;
    flex: 0 0 auto;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.virtual-grid-footer-row-count-label {
    justify-self: end;
}

.virtual-grid-footer-row-count-value {
    display: inline-block;
    min-width: 3ch;
    text-align: left;
    white-space: nowrap;
    font-variant-numeric: tabular-nums;
}

.virtual-grid-footer-row-count[data-kind="total"] {
    margin-left: 8px;
}

/* Pending combined pill */
.virtual-grid-footer-row-count[data-kind="pending"] {
    display: inline-flex;
    align-items: center;
    gap: 4px;
    min-width: unset;
    grid-template-columns: unset;
    margin-left: 8px;
}

.vg-pending-label {
    font-weight: 700;
    color: #444;
    white-space: nowrap;
}

.vg-pending-updates,
.vg-pending-deletes {
    display: inline-flex;
    align-items: center;
    gap: 3px;
    white-space: nowrap;
}

.vg-pending-kind {
    font-weight: 600;
    color: #444;
}

.vg-pending-value {
    font-weight: 700;
    font-variant-numeric: tabular-nums;
    min-width: 3ch;
    text-align: left;
}

.vg-pending-updates-value {
    color: #b8860b;
    background: #fffbe6;
    border-radius: 3px;
    padding: 0 4px;
}

.vg-pending-deletes-value {
    color: #c0392b;
    background: #fdecea;
    border-radius: 3px;
    padding: 0 4px;
}

.virtual-grid-footer-actions {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    flex: 0 0 auto;
    flex-wrap: nowrap;
    justify-content: flex-start;
    white-space: nowrap;
    font-size: 10pt;
    font-weight: 600;
    color: #222;
}

.virtual-grid-footer-load-input {
    width: 72px;
    min-width: 72px;
    max-width: 72px;
    height: 30px;
    padding: 2px 6px;
    border: 1px solid #b7b7b7;
    border-radius: 4px;
    font-size: 10pt;
    font-weight: 600;
    color: inherit;
    text-align: right;
    font-variant-numeric: tabular-nums;
}

@media (max-width: 900px) {
    .virtual-grid-footer-row {
        flex-wrap: wrap;
    }

    .virtual-grid-footer-row-count {
        width: 100%;
        justify-content: start;
        min-width: 0;
        grid-template-columns: auto minmax(8ch, 1fr);
    }

    .virtual-grid-footer-row-count[data-kind="total"] {
        margin-left: 0;
    }

    .virtual-grid-footer-actions {
        width: 100%;
        flex-wrap: wrap;
    }
}

.virtual-grid-footer-button {
    border: 1px solid #b7b7b7;
    background: #f7f7f7;
    color: inherit;
    border-radius: 4px;
    padding: 4px 10px;
    font-size: 10pt;
    font-weight: 600;
    cursor: pointer;
}

.virtual-grid-footer-button:hover {
    background: #ececec;
}

.virtual-grid-footer-button:disabled {
    cursor: default;
    opacity: 0.55;
    background: #f2f2f2;
    color: #666;
}

    /* Header cell focus state */
    .virtual-grid-table th:focus {
        outline: 2px solid #007acc;
        outline-offset: -2px;
    }

    /* Data cell default state — transparent so row-level stripe/state background shows through */
    .virtual-grid-table td {
        background-color: transparent;
    }

        /* Data cell focus state */
        .virtual-grid-table td:focus {
            background-color: #e0f7ff;
            outline-offset: -2px;
        }

/* Table body container */
.virtual-grid-table-body {
    position: relative;
}

/* Zebra striping — even data rows */
.virtual-grid-table-row:nth-child(even) {
    background-color: #f9f9f9;
}

/* Row hover */
.virtual-grid-table-row:hover {
    background-color: var(--mibt-row-hover, #E0EFFF);
}

.virtual-grid-table-body tr:hover:not(.row-inserted):not(.virtual-grid-table-row-updated):not(.virtual-grid-table-row-deleted) > td {
    background-color: var(--mibt-row-hover, #E0EFFF);
}

/* Hidden columns for specific data fields */
.virtual-grid-table-hidden-column,
td[data-field="issues"] {
    display: none !important;
}

/*=============================================================================
  2. ROW STATE INDICATORS
=============================================================================*/

/* Inserted rows - light green background */
.virtual-grid-table-row-inserted {
    background-color: rgba(144, 238, 144, 0.3);
}

.row-inserted td {
    background-color: rgba(144, 238, 144, 0.5);
}

    .row-inserted td.virtual-grid-table-delete-toggle {
        background-color: rgba(144, 238, 144, 0.3);
    }

/* Updated rows - light yellow background */
.virtual-grid-table-row-updated {
    background-color: rgba(255, 255, 224, 0.3);
}

    .virtual-grid-table-row-updated td {
        background-color: rgba(255, 255, 224, 0.6);
    }

        .virtual-grid-table-row-updated td.virtual-grid-table-delete-toggle {
            background-color: rgba(255, 255, 224, 0.3);
        }

/* Deleted rows - gray with strikethrough */
.virtual-grid-table-row-deleted {
    color: #888;
    position: relative;
}

    .virtual-grid-table-row-deleted::after {
        content: "";
        position: absolute;
        left: 0;
        top: 50%;
        width: 100%;
        border-top: 2px solid rgba(217, 83, 79, 0.8);
        z-index: 10;
        pointer-events: none; /* Allow clicks to pass through */
    }

/*=============================================================================
  3. CUSTOM SCROLLBAR
=============================================================================*/

/* Zoom-compensation note:
   Every fixed-pixel rule on the custom scrollbar parts multiplies through
   `var(--scroll-zoom-comp, 1)` so the bar, chevrons, and thumb stay at a
   constant on-screen size regardless of browser zoom (Ctrl + / Ctrl -).
   Dom.js writes `--scroll-zoom-comp = 1 / browserZoom` onto the document
   root on load and on every resize/visualViewport change. When zoom is 1.0
   the variable is 1 and nothing changes; this matches how native browser
   scrollbars behave (they do not scale with page zoom). */

/* Scrollbar container - sibling of the scrollable table container inside
   .virtual-grid-viewport, so it never overlays the rightmost column. It is a
   flex column that stacks: up-chevron, track (with absolute thumb), down-chevron.

   Default to `display: none` so the bar (and its chevrons) are hidden during
   the initial page render before any data has loaded. Dom.js `showScrollBar`
   sets it to `display: flex` only when the data overflows the visible rows
   and a thumb is actually needed; otherwise it leaves it hidden. Using the
   CSS default of `none` (rather than `flex`) prevents the chevrons from
   briefly flashing in before JS hides them on first paint. */
.virtual-grid-table-scroll-bar {
    position: relative;
    flex: 0 0 calc(13px * var(--scroll-zoom-comp, 1));
    display: none;
    flex-direction: column;
    align-items: stretch;
    background: #f5f5f5; /* track background - Windows/Chrome default */
    border: none;
    /* Round the top and bottom of the bar into a full semicircle arch on each
       end. Half of the 13px bar width (6.5px) gives a perfect pill ends.
       `overflow: hidden` clips the chevron button backgrounds to the rounded
       shape so the arch reads cleanly. */
    border-radius: calc(6.5px * var(--scroll-zoom-comp, 1));
    overflow: hidden;
    box-sizing: border-box;
    /* JS sets `marginTop` (header offset) and `height` (track + chevrons total
       height) to align with the tbody. */
}

/* Chevron buttons at the ends of the scrollbar. Glyphs are inline SVG with
   rounded stroke caps/joins (see VirtualGrid.razor) so the points are softened
   to match the native Windows/Chrome scrollbar chevrons.

   Visibility is driven by the parent `.virtual-grid-table-scroll-bar`: Dom.js
   sets the parent to `display: none` when the data fits without scrolling and
   to `display: flex` when the thumb is needed, so the chevrons automatically
   appear/disappear in lockstep with the scrollbar/thumb. */
.virtual-grid-table-scroll-up,
.virtual-grid-table-scroll-down {
    /* Doubled from 14px so the larger SVG chevron isn't clipped to a sliver
       by `overflow: hidden`. */
    flex: 0 0 calc(28px * var(--scroll-zoom-comp, 1));
    display: flex;
    align-items: center;
    justify-content: center;
    background: #f5f5f5; /* matches track background */
    /* A shade lighter than the resting thumb (#888) so the chevrons read as a
       softer, secondary control. */
    color: #a8a8a8;
    cursor: pointer;
    user-select: none;
    line-height: 1;
    font-size: calc(14px * var(--scroll-zoom-comp, 1));
    overflow: hidden;
}

    .virtual-grid-table-scroll-up:hover,
    .virtual-grid-table-scroll-down:hover {
        background: #e0e0e0;
        color: #7a7a7a;
    }

    .virtual-grid-table-scroll-up:active,
    .virtual-grid-table-scroll-down:active {
        background: #b0b0b0;
        color: #4a4a4a;
    }

.virtual-grid-table-scroll-arrow {
    pointer-events: none;
    line-height: 1;
    width: calc(11px * var(--scroll-zoom-comp, 1));
    height: calc(11px * var(--scroll-zoom-comp, 1));
    display: block;
}

/* The actual track in which the thumb moves. Thumb is positioned absolutely
   relative to this element, so its clientHeight is the thumb's travel range. */
.virtual-grid-table-scroll-track {
    position: relative;
    flex: 1 1 auto;
    min-height: 0;
    background: #f5f5f5; /* track background - Windows/Chrome default */
}

/* Scrollbar draggable thumb - darker than the native Chrome thumb so it reads
   as a deliberate custom control. Fully pill-shaped to match native scrollbars. */
.virtual-grid-table-scroll-thumb {
    position: absolute;
    left: calc(1px * var(--scroll-zoom-comp, 1));
    right: calc(1px * var(--scroll-zoom-comp, 1));
    width: auto;
    background: #888888; /* darker resting thumb gray */
    margin: 0;
    cursor: default !important;
    border-radius: 999px; /* pill shape - cap radius is clamped to half the shorter side */
}

    .virtual-grid-table-scroll-thumb:hover {
        background: #6e6e6e; /* darker hover gray */
    }

    .virtual-grid-table-scroll-thumb:active {
        background: #555555; /* even darker while dragging */
    }

/* Legacy `.arrow` rule kept narrow for backward compatibility with any other
   scrollbar usage; not used by the virtual grid anymore. */
.arrow {
    width: 100%;
    height: 12px;
    text-align: center;
    line-height: 12px;
    font-size: 10px;
    background: #ccc;
    cursor: pointer;
    user-select: none;
}

/*=============================================================================
  4. FILTERING COMPONENTS
=============================================================================*/

/* Filter row input fields */
.filter-row input {
    width: 100%;
    border: 1px solid #ddd;
    padding: 0 0 0 5px !important;
    margin: 0;
    height: 35px;
    display: block;
    box-sizing: border-box;
    vertical-align: top;
}

/* Filter row header cells */
.filter-row th {
    padding: 0 !important;
    margin: 0 !important;
    border: 1px solid #ddd;
    background-color: white;
}

/* Multi-filter button focus state */
.virtual-grid-table-multi-filter-btn:focus {
    outline: 2px solid #4d90fe;
    outline-offset: 2px;
    box-shadow: 0 0 0 2px rgba(77, 144, 254, 0.5);
    position: relative;
    z-index: 2;
}

/* Filter dropdown container */
.virtual-grid-multi-filter-container {
    position: relative;
}

/* Filter dropdown panel */
.virtual-grid-multi-filter-dropdown {
    position: absolute;
    top: 100%;
    left: 0;
    width: 350px;
    background-color: #fff;
    border: 1px solid #ccc;
    border-radius: 4px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    z-index: 1000;
    padding: 12px;
    display: none;
}

/* Filter button styling */
.virtual-grid-multi-filter-btn {
    padding: 6px 8px;
    background-color: #e6ffe6;
    border: 1px solid #009900;
    border-radius: 4px;
    cursor: pointer;
    color: #009900;
    font-weight: bold;
    transition: outline-color 0.2s ease-in-out;
}

.virtual-grid-multi-filter-clear-btn {
    padding: 6px 8px;
    background-color: #ffcccc;
    border: 1px solid #009900;
    border-radius: 4px;
    cursor: pointer;
    color: #660000;
    font-weight: bold;
    transition: outline-color 0.2s ease-in-out;
}

.virtual-grid-multi-filter-close-btn {
    padding: 6px 8px;
    background-color: #f2f2f2;
    border: 1px solid #999999;
    border-radius: 4px;
    cursor: pointer;
    color: #333333;
    width: 100%;
    transition: outline-color 0.2s ease-in-out;
}

/* Filter search input */
.virtual-grid-multi-filter-search {
    width: auto;
    padding: 8px 30px 8px 8px;
    border-radius: 4px;
    border: 1px solid #ddd;
    box-sizing: border-box;
    font-size: 14px;
}

/* Filter checkbox container */
.virtual-grid-multi-checkbox-container {
    height: 250px;
    overflow-y: auto;
    border-top: 1px solid #eee;
    padding-top: 8px;
    width: 100%;
}

/* Filter checkbox styling */
.virtual-grid-multi-filter-checkbox {
    width: 16px;
    height: 16px;
    margin-right: 8px;
    margin-left: 2px;
    flex-shrink: 0;
    flex-basis: 16px;
    position: relative;
    top: -1px;
    box-sizing: border-box;
    outline-offset: 2px;
}

/* Filter checkbox label */
.virtual-grid-multi-filter-checkbox-label {
    font-size: 15px;
    cursor: pointer;
    flex-grow: 1;
    user-select: none;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    min-width: 0;
    max-width: 310px; /* Ensures text fits in the dropdown */
}

/* Filter checkbox wrapper */
.virtual-grid-multi-filter-checkbox-wrapper {
    margin-bottom: 6px;
    display: flex;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
    min-width: 0;
    padding-left: 1px; /* Space for focus outline */
}

/* Filter close button wrapper */
.virtual-grid-multi-filter-close-btn-wrapper {
    text-align: center;
    margin-top: 10px;
    padding-top: 8px;
    border-top: 1px solid #eee;
    flex-shrink: 0;
}

/* Filter status messages */
.virtual-grid-multi-filter-no-data,
.virtual-grid-multi-filter-loading {
    padding: 4px;
    font-style: italic;
    color: #666;
    font-size: 14px;
}

.virtual-grid-multi-filter-no-results {
    padding: 8px;
    color: #666;
    font-style: italic;
    text-align: center;
}

/* Plant-specific filter components */
.plant-filter-container {
    width: 100%;
}

.plant-filter-summary {
    height: 28px;
    line-height: 20px;
    box-sizing: border-box;
    display: flex;
    align-items: center;
}

    .plant-filter-summary:hover {
        border-color: #aaa;
        background-color: #f8f8f8;
    }

.plant-filter-dropdown {
    margin-top: 2px;
}

.plant-filter-btn {
    border: 1px solid #ccc;
    background: #f0f0f0;
    border-radius: 3px;
    cursor: pointer;
}

    .plant-filter-btn:hover {
        background: #e0e0e0;
    }

.plant-checkbox-container {
    max-height: 200px;
    overflow-y: auto;
}

    .plant-checkbox-container input[type="checkbox"] {
        cursor: pointer;
    }

    .plant-checkbox-container label {
        cursor: pointer;
        user-select: none;
    }

/*=============================================================================
  5. ACTION CONTROLS
=============================================================================*/

/* Delete toggle button */
.virtual-grid-table-delete-toggle {
    cursor: pointer;
    text-align: center;
    width: var(--virtual-grid-actions-width);
    min-width: var(--virtual-grid-actions-width);
    max-width: var(--virtual-grid-actions-width);
    padding: 2px;
    height: 100%;
    position: relative;
    color: #d9534f;
}

    .virtual-grid-table-delete-toggle:hover {
        background-color: rgba(217, 83, 79, 0.15);
        color: #c9302c;
    }

    .virtual-grid-table-delete-toggle.active {
        background-color: rgba(217, 83, 79, 0.2);
        color: #c9302c;
        font-weight: bold;
    }

    .virtual-grid-table-delete-toggle .delete-icon {
        font-size: 20px;
        line-height: 1;
        font-style: normal;
        display: inline-block;
    }

    /* Layout wrappers so the TD/TH remain table-cells (keeps column widths aligned)
       NOTE: Keep these wrappers compact so they don't force the whole column wider. */
    .virtual-grid-table-actions-header {
        display: flex;
        align-items: center;
        justify-content: center;
        gap: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .virtual-grid-table-actions-cell {
        display: flex;
        align-items: center;
        justify-content: center;
        /* Keep same spacing as header so the row trash can aligns under the header trash can */
        gap: 10px;
        width: 100%;
        box-sizing: border-box;
    }

    .virtual-grid-table-memo-icon-placeholder {
        font-style: normal;
        font-size: 20px;
        visibility: hidden;
    }

/* Delete column header */
.virtual-grid-table-delete-header {
    text-align: center;
    width: var(--virtual-grid-actions-width);
    min-width: var(--virtual-grid-actions-width);
    max-width: var(--virtual-grid-actions-width);
}

/* Mass delete and memo edit controls */
.virtual-grid-table-mass-delete-toggle,
.virtual-grid-table-memo-edit-toggle {
    cursor: pointer;
    text-align: center;
    height: 100%;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

    .virtual-grid-table-mass-delete-toggle:hover,
    .virtual-grid-table-memo-edit-toggle:hover {
        background-color: rgba(217, 83, 79, 0.15);
    }

    .virtual-grid-table-mass-delete-toggle.active,
    .virtual-grid-table-memo-edit-toggle.active {
        background-color: rgba(217, 83, 79, 0.2);
    }

    .virtual-grid-table-mass-delete-toggle .virtual-grid-table-mass-delete-icon,
    .virtual-grid-table-memo-edit-toggle .virtual-grid-table-memo-icon {
        font-size: 20px;
        line-height: 1;
        font-style: normal;
        display: inline-block;
        width: auto;
        color: #d9534f;
    }

    .virtual-grid-table-mass-delete-toggle.active .virtual-grid-table-mass-delete-icon {
        color: #c9302c;
        font-weight: bold;
    }

/*=============================================================================
  6. MENU AND TOOLBAR
=============================================================================*/

/* Toolbar container */
.virtual-grid-tool-bar {
    width: 100%;
    margin: 0;
    padding: 0;
    background: #f5f5f5;
    border-radius: 4px;
    height: 40px;
}

/* Menu bar */
.virtual-grid-menu {
    padding: 0;
    margin: 0;
    color: #0072ce;
    background-color: #FAFAFA;
    width: 100%;
    height: 40px;
}

/* Menu container */
.virtual-grid-menu-container {
    display: flex;
    justify-content: center;
    align-items: center;
    position: relative;
    height: 40px;
}

/* Row count positioned on left */
.virtual-grid-row-count {
    position: absolute;
    left: 10px;
    font-size: 14px;
    font-weight: bold;
    color: #0072ce;
    margin-left: 0 !important;
    pointer-events: none; 
    user-select: none;
}

.virtual-grid-drop-zone {
    position: absolute;
    left: 128px;
    /*  
    right: 0;
    top: 50%;
    transform: translateY(-50%);*/
    white-space: nowrap;
    display: flex;
    gap: 8px;
    padding-right: 15px;
}

    .virtual-grid-drop-zone > * {
        white-space: nowrap;
        cursor: pointer;
        font-weight: bold;
        border-radius: 3px;
        padding: 4px 8px;
        border: 1px solid #ccc;
        transition: background-color 0.2s, border-color 0.2s;
    }

.virtual-grid-drop-zone-upload {
    background-color: #f0f4ff;
    color: #003366;
}

    .virtual-grid-drop-zone-upload:hover,
    .virtual-grid-drop-zone-upload:focus {
        background-color: #e0eaff;
        border-color: #007bff;
    }

.virtual-grid-drop-zone-drop {
    background-color: #e6f7ff;
    color: #004466;
}

    .virtual-grid-drop-zone-drop:hover,
    .virtual-grid-drop-zone-drop:focus {
        background-color: #d0ebff;
        border-color: #007bff;
    }

.virtual-grid-drop-zone-paste {
    background-color: #f5f5f5;
    color: #333333;
}

    .virtual-grid-drop-zone-paste:hover,
    .virtual-grid-drop-zone-paste:focus {
        background-color: #fffbe6;
        border-color: #007bff;
    }



/* Menu buttons */
.virtual-grid-menu-button {
    background-color: transparent;
    color: #0072ce;
    border: none;
    padding: 6px 12px;
    font-size: 16px;
    font-weight: bold;
    cursor: pointer;
    border-radius: 4px;
    transition: background-color 0.2s;
}

    .virtual-grid-menu-button:hover {
        background-color: lightgray;
        color: white;
    }

    .virtual-grid-menu-button:focus {
        outline: none;
        box-shadow: 0 0 0 2px rgba(0, 114, 206, 0.5);
    }

/* Dropdown container */
.virtual-grid-menu-dropdown-container {
    position: relative;
    display: inline-block;
}

/* Dropdown toggle button */
.virtual-grid-menu-dropdown-toggle {
    display: flex;
    align-items: center;
}

/* Dropdown arrow icon */
.virtual-grid-menu-dropdown-icon {
    margin-left: 4px;
    font-size: 10px;
}

/* Dropdown content panel */
.virtual-grid-menu-dropdown-content {
    display: none;
    position: absolute;
    background-color: #FAFAFA;
    min-width: 180px;
    box-shadow: 0 8px 16px rgba(0,0,0,0.1);
    border-radius: 4px;
    z-index: 1000;
    text-align: left;
}

/* Show dropdown menu on hover */
.virtual-grid-menu-dropdown-container:hover .virtual-grid-menu-dropdown-content {
    display: block;
}

/* Dropdown menu items */
.virtual-grid-menu-dropdown-item {
    width: 100%;
    text-align: left;
    padding: 8px 16px;
    background: none;
    border: none;
    cursor: pointer;
    color: #0072ce;
    font-size: 14px;
}

    .virtual-grid-menu-dropdown-item:hover {
        background-color: #f0f0f0;
    }

/* Menu divider line */
.virtual-grid-table-memu-divider {
    height: 1px;
    background-color: #e0e0e0;
    margin: 4px 0;
}

/*=============================================================================
  7. DIALOGS AND MODALS
=============================================================================*/

/* Modal backdrops */
.virtual-grid-save-as-dialog-backdrop,
.virtual-grid-product-dialog-backdrop,
.virtual-grid-select-save-as-dialog-backdrop,
.virtual-grid-dialog-backdrop {
    position: fixed;
    top: 0;
    left: 0;
    width: 100vw;
    height: 100vh;
    background-color: rgba(0,0,0,0.5);
    z-index: 1040;
}

.virtual-grid-dialog-backdrop {
    z-index: 1999; /* Higher z-index for bulk edit */
}

/* Product dialog modal */
.virtual-grid-product-dialog-modal {
    position: fixed !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050;
    width: 90%;
    max-width: 600px;
    max-height: 90vh;
    overflow-y: auto;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    border-radius: 10px;
    border: 1px solid white;
    background-color: white;
}

/* Product list in dialog */
.virtual-grid-product-dialog-product-list {
    border: 1px solid #ced4da;
    border-radius: 4px;
    padding: 10px;
    min-height: 150px;
    overflow-y: auto;
    text-transform: uppercase;
    background-color: white;
}

    .virtual-grid-product-dialog-product-list:focus {
        outline: none;
    }

/* Plant list in dialog */
.virtual-grid-product-dialog-plant-list {
    text-transform: uppercase;
    background-color: white;
    border: 1px solid lightgrey;
    border-radius: 5px;
}

    .virtual-grid-product-dialog-plant-list:focus {
        outline: none;
    }

/* Save As dialog */
.virtual-grid-save-as-dialog-modal,
.virtual-grid-select-save-as-dialog-modal {
    position: fixed !important;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1050;
    box-shadow: 0 0 10px rgba(0,0,0,0.5);
    border-radius: 10px;
    border: 1px solid white;
    background-color: white;
    overflow: hidden;
}

.virtual-grid-draggable-header {
    display: flex;
    justify-content: center;
    align-items: center;
    cursor: pointer;
    text-align: center;
    background-color: #b2d7fc;
    font-size: 24pt;
    border-top-left-radius: 10px;
    border-top-right-radius: 10px;
    overflow: hidden;
}

.virtual-grid-save-as-dialog-container {
    transition: margin-top 0.3s ease;
    display: flex;
    flex-direction: column;
    margin-top: 0;
    border: 0px !important;
}

.virtual-grid-dialog-button-container {
    display: flex;
    justify-content: flex-end;
    align-items: center;
    gap: 10px; 
    padding-right: 16px; 
    height: 73px;
    background-color: #f9f9f9;
}

/* Dialog buttons */
.virtual-grid-dialog-button-cancel {
    padding: 8px 16px;
    background-color: #f2f2f2;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}

.virtual-grid-dialog-button-save {
    padding: 8px 16px;
    background-color: #e6f2ff;
    border: 1px solid #0066cc;
    border-radius: 4px;
    cursor: pointer;
    color: #0066cc;
    font-weight: bold;
}

/* Alert dialog */
.virtual-grid-alert {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    z-index: 1500;
    padding: 20px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    border-radius: 10px;
    font-weight: bold;
    font-size: 12pt;
    background-color: lightblue;
    display: inline-block;
    text-align: left;
}

    .virtual-grid-alert button {
        height: 30px;
        background-color: #0072ce !important;
        color: white !important;
        border: 0px !important;
        cursor: pointer !important;
        vertical-align: bottom;
        font-weight: bold !important;
        border-radius: 5px;
    }

        .virtual-grid-alert button:hover {
            background-color: grey !important;
            color: white !important;
            border: 1px solid lightgray;
            border-radius: 5px;
        }

            .virtual-grid-alert button:hover:active {
                background-color: #0072ce !important;
                color: white !important;
                border: 1px solid #005bb5;
                border-radius: 5px;
                box-shadow: inset 0 3px 5px rgba(0, 0, 0, 0.2);
            }

/* Save confirmation dialog */
.virtual-grid-confirm-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(0, 0, 0, 0.35);
    z-index: 1490;
    display: flex;
    align-items: center;
    justify-content: center;
}

.virtual-grid-confirm {
    background: #fff;
    border-radius: 10px;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.2);
    padding: 24px 28px 18px;
    min-width: 320px;
    max-width: 440px;
    font-size: 12pt;
    font-weight: bold;
    z-index: 1500;
}

.virtual-grid-confirm-body p {
    margin: 0 0 8px;
}

.virtual-grid-confirm-body ul {
    margin: 0 0 12px;
    padding-left: 20px;
}

.virtual-grid-confirm-body ul li {
    margin-bottom: 4px;
}

.vg-confirm-update-count {
    color: #b8860b;
}

.vg-confirm-delete-count {
    color: #c0392b;
}

.virtual-grid-confirm-actions {
    display: flex;
    justify-content: center;
    gap: 16px;
    margin-top: 8px;
}

.vg-confirm-btn {
    height: 32px;
    min-width: 80px;
    border: 0;
    border-radius: 5px;
    cursor: pointer;
    font-weight: bold;
    font-size: 11pt;
}

.vg-confirm-yes {
    background-color: #0072ce;
    color: white;
}

    .vg-confirm-yes:hover {
        background-color: #005bb5;
    }

.vg-confirm-no {
    background-color: #e0e0e0;
    color: #333;
}

    .vg-confirm-no:hover {
        background-color: #bdbdbd;
    }

/* Bulk edit dialog */
.virtual-grid-bulk-edit-dialog {
    position: fixed;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    background-color: white;
    border: 1px solid #ccc;
    border-radius: 10px;
    padding: 0;
    box-shadow: 0 4px 15px rgba(0, 0, 0, 0.2);
    z-index: 2000;
    max-width: 800px;
    width: 90%;
    max-height: 90vh;
    display: flex;
    flex-direction: column;
}

.virtual-grid-bulk-edit-header {
    border-bottom: 1px solid #eee;
    padding: 20px;
    flex-shrink: 0;
    border-top-left-radius:10px;
    border-top-right-radius:10px;
    overflow:hidden;
}

.virtual-grid-bulk-edit-scrollable-container {
    overflow-y: auto;
    padding: 20px;
    flex-grow: 1;
    max-height: calc(80vh - 150px);
}

.virtual-grid-bulk-edit-form {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(300px, 1fr));
    gap: 15px;
}

.virtual-grid-bulk-edit-field-container {
    margin-bottom: 10px;
}

.virtual-grid-bulk-edit-field-label {
    display: block;
    margin-bottom: 5px;
    font-weight: bold;
}

.virtual-grid-bulk-edit-field-input {
    width: 100%;
    padding: 8px;
    border-radius: 4px;
    border: 1px solid #ccc;
}

.virtual-grid-bulk-edit-button-container {
    display: flex;
    justify-content: flex-end;
    gap: 10px;
    padding: 15px 20px;
    border-top: 1px solid #eee;
    background-color: #f9f9f9;
    border-bottom-left-radius: 8px;
    border-bottom-right-radius: 8px;
    flex-shrink: 0;
}

/* Bulk edit buttons */
.virtual-grid-bulk-edit-cancel-button {
    padding: 8px 16px;
    background-color: #f2f2f2;
    border: 1px solid #ccc;
    border-radius: 4px;
    cursor: pointer;
}


.virtual-grid-bulk-edit-update-button {
    padding: 8px 16px;
    background-color: #e6f2ff;
    border: 1px solid #0066cc;
    border-radius: 4px;
    cursor: pointer;
    color: #0066cc;
    font-weight: bold;
}


.virtual-grid-bulk-edit-insert-button {
    padding: 8px 16px;
    background-color: #e6ffe6;
    border: 1px solid #009900;
    border-radius: 4px;
    cursor: pointer;
    color: #009900;
    font-weight: bold;
}

/*=============================================================================
  8. NOTIFICATIONS AND TOOLTIPS
=============================================================================*/

/* Notification toast */
.virtual-grid-notification {
    position: fixed;
    bottom: 20px;
    right: 20px;
    background-color: #333;
    color: white;
    padding: 10px 15px;
    border-radius: 4px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    z-index: 3000;
    transition: opacity 0.3s ease-in-out;
}

/* Tooltip for issues */
.virtual-grid-table-issue-tooltip {
    position: absolute;
    background-color: #B0E0E6;
    border: 1px solid #4682B4;
    border-radius: 15px;
    padding: 10px;
    margin-top: 10px;
    z-index: 1000;
    box-shadow: 0 3px 7px rgba(0, 0, 0, 0.2);
    min-width: 128px;
}

/*=============================================================================
  9. RESPONSIVE DESIGN
=============================================================================*/

/* Adjustments for smaller screens */
@media (max-width: 576px) {
    .virtual-grid-product-dialog-modal {
        width: 95%;
        max-width: none;
    }

    /* Additional mobile optimizations could be added here */
}