/* Slate Precision Theme - Inter Font Family */
body, .mud-typography {
    font-family: 'Inter', 'Roboto', 'Helvetica', 'Arial', sans-serif;
}

/* ========================================
   Mobile Bottom Navigation
   ======================================== */

/* Mobile bottom navigation bar */
.mobile-bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: white;
    border-top: 1px solid rgba(0, 0, 0, 0.12);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1100;
    padding: 0;
    padding-bottom: env(safe-area-inset-bottom);
    box-shadow: 0 -2px 4px rgba(0, 0, 0, 0.05);
}

/* Support for iOS devices with notch/home indicator */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-bottom-nav {
        height: calc(64px + env(safe-area-inset-bottom));
    }
}

/* Bottom nav items */
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    text-decoration: none;
    color: rgba(0, 0, 0, 0.6);
    transition: color 0.2s ease;
    padding: 8px 4px;
    gap: 2px;
}

.bottom-nav-item:hover {
    color: #334155;
    background-color: rgba(51, 65, 85, 0.04);
    text-decoration: none;
}

.bottom-nav-item.active {
    color: #334155;
    font-weight: 600;
    position: relative;
}

/* Active indicator bar */
.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 32px;
    height: 3px;
    background-color: #334155;
    border-radius: 0 0 3px 3px;
}

.bottom-nav-item .mud-icon-root {
    color: inherit;
}

.bottom-nav-label {
    font-size: 0.75rem;
    line-height: 1;
    margin-top: 2px;
}

/* Add bottom padding to main content on mobile to account for bottom nav */
@media (max-width: 959px) {
    .mobile-content-padding {
        padding-bottom: 80px;
    }

    /* Adjust for iOS safe area */
    @supports (padding-bottom: env(safe-area-inset-bottom)) {
        .mobile-content-padding {
            padding-bottom: calc(80px + env(safe-area-inset-bottom));
        }
    }

    /* Reduce AppBar height on mobile */
    .mud-appbar {
        min-height: 56px !important;
    }

    .mud-appbar .mud-toolbar-gutters {
        min-height: 56px !important;
    }
}

/* Prevent text selection on bottom nav items */
.bottom-nav-item {
    -webkit-tap-highlight-color: transparent;
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
}

/* Active state ripple effect */
.bottom-nav-item:active {
    background-color: rgba(51, 65, 85, 0.08);
}

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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) 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;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* ========================================
   Mobile Optimization Styles
   ======================================== */

/* Ensure MudCards have better touch targets on mobile */
@media (max-width: 600px) {
    .mud-card {
        margin-bottom: 12px;
    }

    /* Increase touch target size for icon buttons on mobile */
    .mud-icon-button {
        min-width: 44px;
        min-height: 44px;
    }

    /* Make table text slightly smaller on mobile for better fit */
    .mud-table-cell {
        font-size: 0.875rem;
        padding: 8px 4px;
    }

    /* Ensure full-width buttons on mobile have adequate padding */
    .mud-button-root {
        min-height: 44px;
    }

    /* Reduce card padding on mobile */
    .mud-card-content {
        padding: 12px;
    }

    /* Better form field spacing on mobile */
    .mud-input-control {
        margin-bottom: 8px;
    }

    /* Ensure dialogs don't overflow on small screens */
    .mud-dialog {
        max-height: 90vh;
        overflow-y: auto;
    }

    .mud-dialog-content {
        padding: 12px;
    }
}

/* Minimalist card hover effects */
.mud-card:hover {
    background-color: rgba(0, 0, 0, 0.02);
    transition: background-color 0.2s ease;
}

/* Improve table responsiveness */
.mud-table-container {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
    max-width: 100%;
}

/* Prevent table overflow on desktop */
.mud-table {
    table-layout: auto;
}

/* Mobile-first: Ensure all content fits within viewport */
@media (max-width: 600px) {
    /* Reduce container padding for more space */
    .mud-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }

    /* Ensure cards don't overflow */
    .mud-card {
        max-width: 100%;
    }

    /* Ensure all flex containers wrap properly */
    .d-flex {
        flex-wrap: wrap;
    }

    /* Force text to break in long strings */
    .mud-typography {
        word-wrap: break-word;
        overflow-wrap: anywhere;
    }
}

/* Tablet optimization */
@media (min-width: 601px) and (max-width: 960px) {
    .mud-table-cell {
        padding: 8px 6px;
        font-size: 0.875rem;
    }
}

/* Desktop table optimization */
@media (min-width: 961px) {
    .mud-table-cell {
        padding: 12px 8px;
    }
}

/* Better scrollbar styling for horizontal scroll */
.mud-table-container::-webkit-scrollbar {
    height: 8px;
}

.mud-table-container::-webkit-scrollbar-track {
    background: #f1f1f1;
    border-radius: 4px;
}

.mud-table-container::-webkit-scrollbar-thumb {
    background: #888;
    border-radius: 4px;
}

.mud-table-container::-webkit-scrollbar-thumb:hover {
    background: #555;
}

/* Ensure proper max-width for very wide screens */
@media (min-width: 1920px) {
    .mud-container.mud-container-maxwidth-lg {
        max-width: 1400px;
    }
}

/* Improve button spacing in button groups */
.mud-button-group .mud-button-root {
    margin-right: 8px;
}

.mud-button-group .mud-button-root:last-child {
    margin-right: 0;
}

/* Better spacing for form elements */
.mud-input-root + .mud-input-root {
    margin-top: 16px;
}

/* Ensure snackbar notifications are visible on mobile */
.mud-snackbar {
    max-width: calc(100vw - 32px);
}

/* Improve chip readability */
.mud-chip {
    font-weight: 500;
}

/* Better focus states for accessibility */
.mud-button-root:focus-visible,
.mud-icon-button:focus-visible,
.mud-input-root:focus-within {
    outline: 2px solid #1976d2;
    outline-offset: 2px;
}

/* Tablet optimizations */
@media (min-width: 600px) and (max-width: 960px) {
    .mud-container {
        padding-left: 16px;
        padding-right: 16px;
    }

    .mud-table-cell {
        padding: 12px 8px;
    }
}

/* Ensure proper spacing in MudStack components */
.mud-stack > * + * {
    margin-top: 0 !important;
}

/* Prevent layout shift on loading */
.mud-progress-circular {
    display: block;
    margin: 20px auto;
}

/* Better AppBar layout on mobile */
@media (max-width: 600px) {
    .mud-appbar .mud-toolbar-gutters {
        padding-left: 8px;
        padding-right: 8px;
    }

    .mud-appbar .mud-typography-h6 {
        font-size: 1.1rem;
    }
}

/* Improve drawer usability */
.mud-drawer {
    -webkit-overflow-scrolling: touch;
}

/* Better touch feedback for nav menu items */
.mud-nav-link:active {
    background-color: rgba(0, 0, 0, 0.04);
}

/* Ensure proper card elevation transitions */
.mud-card {
    transition: box-shadow 0.2s ease;
}

/* Optimize grid spacing on mobile */
@media (max-width: 600px) {
    .mud-grid-item {
        padding: 6px;
    }

    .mud-grid {
        margin: -6px;
    }
}

/* Improve form layout on mobile */
@media (max-width: 600px) {
    .mud-form .mud-grid-item {
        margin-bottom: 8px;
    }
}

/* Better date picker usability on mobile */
@media (max-width: 600px) {
    .mud-picker-calendar-container {
        max-width: 100%;
    }
}

/* Ensure icons are properly sized */
.mud-icon-root {
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Improve select dropdown usability */
.mud-select {
    -webkit-tap-highlight-color: transparent;
}

/* Better loading state visibility */
.mud-overlay-scrim {
    -webkit-backdrop-filter: blur(2px);
    backdrop-filter: blur(2px);
}

/* Ensure proper text wrapping in tables */
.mud-table-cell {
    word-wrap: break-word;
    overflow-wrap: break-word;
}

/* Optimize for iPhone notch */
@supports (padding: max(0px)) {
    body {
        padding-left: env(safe-area-inset-left);
        padding-right: env(safe-area-inset-right);
    }

    .mud-appbar {
        padding-left: max(8px, env(safe-area-inset-left));
        padding-right: max(8px, env(safe-area-inset-right));
    }
}

/* Improve accessibility - high contrast mode */
@media (prefers-contrast: high) {
    .mud-button-outlined {
        border-width: 2px;
    }

    .mud-card {
        border: 1px solid currentColor;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    * {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }

    .mud-card.mud-ripple {
        transition: none;
    }
}

/* Print optimization */
@media print {
    .mud-appbar,
    .mud-drawer,
    .mud-button-root,
    .mud-fab {
        display: none !important;
    }

    .mud-main-content {
        padding: 0;
    }

    .mud-card {
        box-shadow: none;
        border: 1px solid #ddd;
        page-break-inside: avoid;
    }

    .mud-table {
        page-break-inside: auto;
    }

    .mud-table-row {
        page-break-inside: avoid;
    }
}