/* CSS for conditional cell editing in AG Grid */

/* Define CSS custom properties for theme-aware colors */
:root {
    --disabled-cell-bg-light: #e9e9e9;
    --disabled-cell-bg-dark: #383838;
}

/* Light theme (default) */
.ag-theme-alpine {
    --disabled-cell-bg: var(--disabled-cell-bg-light);
}

/* Dark theme */
.ag-theme-alpine-dark,
[data-mantine-color-scheme="dark"] .ag-theme-alpine {
    --disabled-cell-bg: var(--disabled-cell-bg-dark);
}

/* Style for disabled cells */
.cell-disabled {
    background-color: var(--disabled-cell-bg) !important;
    color: transparent !important;
    cursor: not-allowed !important;
    opacity: .6 !important;
}

/* Make text completely invisible in disabled cells */
.cell-disabled * {
    opacity: 0 !important;
}

/* Prevent hover effects on disabled cells */
.cell-disabled:hover {
    background-color: var(--disabled-cell-bg) !important;
}

/* Style for disabled cells when selected */
.ag-row-selected .cell-disabled {
    background-color: var(--disabled-cell-bg) !important;
}

/* Ensure text remains invisible even when selected */
.ag-row-selected .cell-disabled * {
    opacity: 0 !important;
}

/* Bulk Edit Changed Cell Highlighting */

/* Dark mode - changed cells */
html[data-mantine-color-scheme='dark'] .ag-theme-alpine.ag-theme-custom-theme .bulk-edit-changed-cell {
    background-color: rgba(45, 134, 190, 0.25) !important;
}

html[data-mantine-color-scheme='dark'] .ag-theme-alpine.ag-theme-custom-theme .bulk-edit-changed-cell .ag-cell-wrapper {
    background-color: transparent !important;
}

/* Light mode - changed cells */
html[data-mantine-color-scheme='light'] .ag-theme-alpine.ag-theme-custom-theme .bulk-edit-changed-cell {
    background-color: rgba(45, 134, 190, 0.15) !important;
}

html[data-mantine-color-scheme='light'] .ag-theme-alpine.ag-theme-custom-theme .bulk-edit-changed-cell .ag-cell-wrapper {
    background-color: transparent !important;
}

/* Invalid Cell Highlighting */

/* Dark mode - invalid cells */
html[data-mantine-color-scheme='dark'] .ag-theme-alpine.ag-theme-custom-theme .invalid-cell {
    background-color: rgba(255, 82, 82, 0.25) !important;
}

html[data-mantine-color-scheme='dark'] .ag-theme-alpine.ag-theme-custom-theme .invalid-cell .ag-cell-wrapper {
    background-color: transparent !important;
}

/* Light mode - invalid cells */
html[data-mantine-color-scheme='light'] .ag-theme-alpine.ag-theme-custom-theme .invalid-cell {
    background-color: rgba(255, 82, 82, 0.15) !important;
}

html[data-mantine-color-scheme='light'] .ag-theme-alpine.ag-theme-custom-theme .invalid-cell .ag-cell-wrapper {
    background-color: transparent !important;
}

/* When a cell is both changed and invalid, show RED only (invalid overrides changed) */
html[data-mantine-color-scheme='dark'] .ag-theme-alpine.ag-theme-custom-theme .bulk-edit-changed-cell.invalid-cell {
    background-color: rgba(255, 82, 82, 0.3) !important;
}

html[data-mantine-color-scheme='light'] .ag-theme-alpine.ag-theme-custom-theme .bulk-edit-changed-cell.invalid-cell {
    background-color: rgba(255, 82, 82, 0.2) !important;
}

html[data-mantine-color-scheme='dark'] .ag-theme-alpine.ag-theme-custom-theme .bulk-edit-changed-cell.invalid-cell .ag-cell-wrapper {
    background-color: transparent !important;
}

html[data-mantine-color-scheme='light'] .ag-theme-alpine.ag-theme-custom-theme .bulk-edit-changed-cell.invalid-cell .ag-cell-wrapper {
    background-color: transparent !important;
}

