html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    background-color: var(--mud-palette-background) !important;
    color: var(--mud-palette-text-primary) !important;
    transition: background-color 0.3s ease, color 0.3s ease;
    margin: 0;
    padding: 0;
    height: 100%;
    overflow: hidden; /* Prevent body scroll */
}

/* Force body and root elements to use theme background */
#app, .mud-layout {
    background-color: var(--mud-palette-background) !important;
}

/* Ensure app fills viewport and prevents scrolling */
#app {
    height: 100vh;
    overflow: hidden;
}

/* MudLayout should fill viewport */
.mud-layout {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* Ensure MudBlazor main content fills available space */
.mud-main-content {
    background-color: var(--mud-palette-background) !important;
    flex: 1;
    min-height: 0; /* Allow flex item to be constrained so overflow-y can trigger */
    overflow-y: auto;
}

/* Fix for cards and surfaces in dark mode */
.mud-paper {
    background-color: var(--mud-palette-surface) !important;
}

/* Fix for dialogs in dark mode */
.mud-dialog {
    background-color: var(--mud-palette-surface) !important;
}

/* Fix for drawer in dark mode */
.mud-drawer {
    background-color: var(--mud-palette-drawer-background) !important;
}

/* Fix for app bar in dark mode */
.mud-appbar {
    background-color: var(--mud-palette-appbar-background) !important;
}
 
a, .btn-link {
    color: #006bb7;
}

.btn-primary {
    color: #fff;
    background-color: #1b6ec2;
    border-color: #1861ac;
}

.btn:focus, .btn:active:focus, .btn-link.nav-link:focus, .form-control:focus, .form-check-input:focus {
  box-shadow: 0 0 0 0.1rem white, 0 0 0 0.25rem #258cfb;
}

.content {
    padding-top: 1.1rem;
}

h1:focus {
    outline: none;
}

.valid.modified:not([type=checkbox]) {
    outline: 1px solid #26b050;
}

.invalid {
    outline: 1px solid #e50000;
}

.validation-message {
    color: #e50000;
}

.blazor-error-boundary {
    background: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3Jn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44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

    .blazor-error-boundary::after {
        content: "An error has occurred."
    }

.darker-border-checkbox.form-check-input {
    border-color: #929292;
}

/* ========================================
   COMPACT DIALOG LAYOUT STYLES
   Ultra-dense form layout with professional styling
   ======================================== */

/* Main container for compact dialogs */
.compact-dialog-content {
    padding: 4px;
    font-family: 'Segoe UI', Tahoma, Arial, sans-serif;
    font-size: 12px;
    line-height: 1.4;
}

/* Header panel with subtle professional styling */
.compact-header-panel {
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    margin-bottom: 8px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Main panel */
.compact-main-panel {
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    border: 1px solid #dee2e6;
    padding: 8px 12px;
    border-radius: 6px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.08);
}

/* Section banners - professional gradient */
.compact-section-banner {
    background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
    color: #ffffff;
    font-weight: 600;
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 4px;
    margin: 8px 0 6px 0;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.3);
}

.compact-section-banner-alt {
    background: linear-gradient(135deg, #f093fb 0%, #f5576c 100%);
    color: #ffffff;
    font-weight: 600;
    font-size: 11px;
    padding: 4px 12px;
    border-radius: 4px;
    margin: 8px 0 6px 0;
    letter-spacing: 0.8px;
    text-transform: uppercase;
    box-shadow: 0 2px 4px rgba(245, 87, 108, 0.3);
}

/* Label-left, control-right field layout */
.compact-field {
    display: flex;
    flex-direction: row;
    align-items: center;
    min-width: 0;
    margin-bottom: 0;
}

.compact-label {
    flex: 0 0 auto;
    width: 30%;
    text-align: right;
    padding-right: 8px;
    font-size: 11px;
    font-weight: 500;
    color: #495057;
    line-height: 24px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.compact-control {
    flex: 1 1 0;
    min-width: 0;
}

.compact-cell {
    padding: 0 3px !important;
}

/* Hide MudBlazor floating labels in compact mode */
.compact-dialog-content .mud-input-label,
.compact-dialog-content .mud-input-label-filled,
.compact-dialog-content .mud-input-label-animated {
    display: none !important;
}

/* Ultra-compact input controls */
.compact-dialog-content .mud-input-root,
.compact-dialog-content .mud-input-root-filled {
    min-height: unset !important;
    height: 24px !important;
    padding: 3px 6px !important;
    font-size: 11px !important;
    line-height: 18px !important;
    border-radius: 4px !important;
    box-sizing: border-box !important;
    transition: all 0.2s ease;
}

.compact-dialog-content .mud-input {
    font-size: 11px !important;
    line-height: 18px !important;
    padding: 0 !important;
    height: 18px !important;
}

.compact-dialog-content .mud-input-filled {
    background-color: #ffffff !important;
    border: 1px solid #ced4da;
}

.compact-dialog-content .mud-input-root-filled:hover {
    border-color: #80bdff;
}

.compact-dialog-content .mud-input-root-filled.mud-input-root-filled-focused {
    border-color: #667eea;
    box-shadow: 0 0 0 2px rgba(102, 126, 234, 0.15);
}

.compact-dialog-content .mud-input-root-filled.mud-disabled,
.compact-dialog-content .mud-input-root.mud-disabled {
    opacity: 0.6;
    background-color: #f8f9fa !important;
}

/* Zero margins for form controls */
.compact-dialog-content .mud-form-control,
.compact-dialog-content .mud-form-control-margin-dense {
    margin: 0 !important;
    padding: 0 !important;
}

.compact-dialog-content .mud-input-helper-text {
    display: none !important;
}

/* Compact dropdown styling */
.compact-dialog-content .mud-input-adornment-end {
    height: 24px !important;
    margin: 0 !important;
    padding: 0 !important;
}

.compact-dialog-content .mud-input-adornment .mud-icon-root,
.compact-dialog-content .mud-select .mud-icon-root {
    font-size: 16px !important;
}

.compact-dialog-content .mud-input-adornment .mud-icon-button {
    width: 22px !important;
    height: 22px !important;
    padding: 0 !important;
}

/* Compact checkboxes */
.compact-dialog-content .mud-checkbox {
    margin: 0 !important;
    padding: 0 !important;
    height: 24px;
}

.compact-dialog-content .mud-checkbox .mud-button-root {
    padding: 2px !important;
}

.compact-dialog-content .mud-checkbox .mud-icon-root {
    font-size: 18px !important;
}

.compact-dialog-content .mud-checkbox .mud-checkbox-label {
    font-size: 11px !important;
    font-weight: 500;
    color: #495057;
}

/* Narrow date-range filter input (audit trail toolbars). MudPicker forwards its Style
   parameter to BOTH the input and the calendar popover paper (PickerPaperStylename
   includes AddStyle(Style)), so an inline max-width meant only for the input also caps
   the popover - if that max-width is below MudBlazor's own .mud-picker-content
   min-width (310px), the calendar gets squeezed to a few day columns. Class is only
   applied to the input, so it doesn't have this problem.  */
.filter-date-narrow {
    min-width: 160px;
    max-width: 180px;
}

/* Compact date pickers */
.compact-dialog-content .mud-picker {
    height: 24px !important;
}

.compact-dialog-content .mud-picker-input {
    height: 24px !important;
}

/* Compact numeric fields */
.compact-dialog-content .mud-input-numeric {
    text-align: right;
}

/* Compact tables - ultra dense */
.compact-dialog-content .mud-table {
    font-size: 10px !important;
}

.compact-dialog-content .mud-table-cell {
    padding: 3px 6px !important;
    height: 26px !important;
}

.compact-dialog-content .mud-table-head .mud-table-cell {
    font-weight: 600;
    font-size: 10px !important;
    padding: 4px 6px !important;
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
}

/* Ensure dialog content fits screen */
.compact-dialog .mud-dialog-content {
    max-height: calc(100vh - 180px) !important;
    overflow-y: auto !important;
    padding: 4px 8px !important;
}

/* Compact grid spacing */
.compact-dialog-content .mud-grid {
    margin: 0 !important;
}

.compact-dialog-content .mud-grid-item {
    padding: 1px !important;
}

/* ========================================
   COMPACT DATA GRID STYLES
   Shared across all compact data grid pages
   ======================================== */

.compact-grid .mud-toolbar,
.compact-grid .mud-table-toolbar {
    min-height: 36px !important;
    padding: 0 8px !important;
}

.compact-grid .mud-table-head .mud-table-cell {
    font-size: 0.7rem !important;
    padding: 2px 8px !important;
    height: 26px !important;
}

.compact-grid .mud-table-body .mud-table-cell {
    font-size: 0.72rem !important;
    padding: 1px 8px !important;
    height: 24px !important;
}

.compact-grid .mud-table-row {
    height: 24px !important;
}

.compact-grid .mud-typography {
    font-size: 0.72rem !important;
}

.compact-grid-title {
    font-size: 0.8rem !important;
    font-weight: 600 !important;
    line-height: 1.2 !important;
    white-space: nowrap;
}

.compact-grid-card .mud-card-content {
    padding: 4px !important;
}

/* ========================================
   CALIBRATION FORM SPECIFIC STYLES
   Professional, compact calibration tables
   ======================================== */

/* Calibration form panels - professional borders */
.calibration-panel-primary {
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    border: 2px solid #667eea !important;
    border-radius: 6px;
    padding: 12px !important;
    box-shadow: 0 2px 4px rgba(102, 126, 234, 0.1);
}

.calibration-panel-secondary {
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    border: 2px solid #f093fb !important;
    border-radius: 6px;
    padding: 12px !important;
    box-shadow: 0 2px 4px rgba(240, 147, 251, 0.1);
}

.calibration-panel-tertiary {
    background: linear-gradient(to bottom, #ffffff, #f8f9fa);
    border: 2px solid #4facfe !important;
    border-radius: 6px;
    padding: 12px !important;
    box-shadow: 0 2px 4px rgba(79, 172, 254, 0.1);
}

/* Ultra-compact table for calibration nozzles */
.calibration-nozzle-table {
    font-size: 9px !important;
    max-height: 400px;
    overflow-y: auto;
}

.calibration-nozzle-table .mud-table-cell {
    padding: 1px 3px !important;
    font-size: 9px !important;
    height: 22px !important;
}

.calibration-nozzle-table .mud-table-head .mud-table-cell {
    padding: 2px 3px !important;
    font-size: 9px !important;
    font-weight: 600;
    background: linear-gradient(to bottom, #f8f9fa, #e9ecef);
    border-bottom: 2px solid #dee2e6;
}

.calibration-nozzle-table .mud-input-root {
    height: 20px !important;
    font-size: 9px !important;
    padding: 1px 2px !important;
}

.calibration-nozzle-table .mud-input {
    font-size: 9px !important;
    height: 16px !important;
}

/* Compact checkboxes in tables */
.calibration-table-checkbox .mud-checkbox {
    margin: 0 !important;
    padding: 0 !important;
}

.calibration-table-checkbox .mud-checkbox .mud-icon-root {
    font-size: 16px !important;
}

/* Section headers in calibration form */
.calibration-section-header {
    font-size: 12px;
    font-weight: 600;
    color: #495057;
    margin: 8px 0 4px 0;
    padding-bottom: 4px;
    border-bottom: 2px solid #e9ecef;
}

/* Satellite date-range calendar (Block/Field Analysis) — circles every day that actually has
   satellite imagery, via MudDatePicker/MudDateRangePicker's AdditionalDateClassesFunc. An ::after
   overlay (not border/outline on the cell itself) so it never fights MudBlazor's own hover/
   selected/range-highlight circle drawn on the same element — it just sits on top of it. */
.has-imagery-date {
    position: relative;
}

.has-imagery-date::after {
    content: "";
    position: absolute;
    inset: 2px;
    border: 2px solid #1a9850;
    border-radius: 50%;
    pointer-events: none;
}

/* Graph Analysis's synced Prev/Next photo paging — each block's image sits in a div keyed on the
   current date index, so Blazor recreates the element on every step; this animation just makes
   that swap read as a soft crossfade instead of an instant, jarring pop. */
.photo-fade {
    animation: photoFadeIn 0.3s ease;
}

@keyframes photoFadeIn {
    from { opacity: 0; }
    to { opacity: 1; }
}
