html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    margin: 0;
    padding: 0;
    overflow-x: hidden;
}

/* Mobile-first responsive design */
* {
    box-sizing: border-box;
}

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,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;
}

/* Mobile Responsive Styles */
/* Fix drawer margin issues on mobile */
@media (max-width: 767.98px) {
    /* Ensure main content takes full width when drawer is closed on mobile */
    .mud-main-content {
        margin-left: 0 !important;
        padding-left: 0 !important;
        width: 100% !important;
    }
    
    /* Remove any left margin that might be applied */
    .mud-layout {
        margin-left: 0 !important;
    }
    
    /* Ensure temporary drawer doesn't affect layout */
    .mud-drawer--temporary {
        position: fixed !important;
        z-index: 1300 !important;
    }
    
    /* Overlay for mobile drawer */
    .mud-overlay {
        position: fixed !important;
        top: 0 !important;
        left: 0 !important;
        width: 100vw !important;
        height: 100vh !important;
        background-color: rgba(0, 0, 0, 0.5) !important;
        z-index: 1200 !important;
    }
}

/* Small devices (landscape phones, 576px and up) */
@media (max-width: 575.98px) {
    /* Make cards stack vertically on mobile */
    .mud-grid-item {
        flex: 0 0 100% !important;
        max-width: 100% !important;
    }
    
    /* Reduce padding on mobile */
    .mud-container {
        padding-left: 8px !important;
        padding-right: 8px !important;
    }
    
    .mud-paper {
        margin-bottom: 16px;
    }
    
    /* Make typography smaller on mobile */
    .mud-typography-h3 {
        font-size: 1.5rem !important;
    }
    
    .mud-typography-h4 {
        font-size: 1.25rem !important;
    }
    
    .mud-typography-h6 {
        font-size: 1rem !important;
    }
    
    /* Navigation adjustments */
  /*  .mud-drawer {
        width: 280px !important;
    }*/
    
    /* App bar adjustments */
    .mud-appbar .mud-typography-h6 {
        font-size: 0.9rem !important;
        margin-left: 8px !important;
    }
    
    /* Ensure hamburger menu button is properly clickable */
    .mud-appbar .mud-icon-button {
        min-height: 44px !important;
        min-width: 44px !important;
        z-index: 1400 !important;
    }
    
    /* Button adjustments */
    .mud-button {
        padding: 8px 12px !important;
        font-size: 0.875rem !important;
    }
    
    /* Table responsiveness */
    .mud-table {
        font-size: 0.875rem !important;
    }
    
    .mud-table-cell {
        padding: 8px !important;
    }
    
    /* List adjustments */
    .mud-list-item {
        padding: 8px 16px !important;
    }
    
    /* Form controls */
    .mud-input {
        font-size: 16px !important; /* Prevents zoom on iOS */
    }
}

/* Medium devices (tablets, 768px and up) */
@media (min-width: 576px) and (max-width: 767.98px) {
    .mud-grid-item[class*="xs-12"][class*="md-6"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
    
    .mud-container {
        padding-left: 16px !important;
        padding-right: 16px !important;
    }
}

/* Large devices (desktops, 992px and up) */
@media (min-width: 768px) and (max-width: 991.98px) {
    .mud-grid-item[class*="md-3"] {
        flex: 0 0 25% !important;
        max-width: 25% !important;
    }
    
    .mud-grid-item[class*="md-6"] {
        flex: 0 0 50% !important;
        max-width: 50% !important;
    }
}

/* Touch-friendly interactions */
@media (hover: none) and (pointer: coarse) {
    /* Increase touch targets */
    .mud-button,
    .mud-icon-button {
        min-height: 44px;
        min-width: 44px;
    }
    
    .mud-list-item {
        min-height: 44px;
    }
    
    /* Remove hover effects on touch devices */
    .mud-button:hover {
        background-color: inherit !important;
    }
    
    .mud-list-item:hover {
        background-color: inherit !important;
    }
}

/* Print styles */
@media print {
    .mud-drawer,
    .mud-appbar,
    .mud-fab {
        display: none !important;
    }
    
    .mud-main-content {
        padding: 0 !important;
    }
    
    * {
        color: black !important;
        background: white !important;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mud-paper {
        border: 1px solid;
    }
    
    .mud-button {
        border: 2px solid;
    }
}

/* Reduced motion support */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
    }
}

/* Dark mode adjustments for mobile */
@media (prefers-color-scheme: dark) and (max-width: 575.98px) {
    .mud-paper {
        background-color: #1e1e1e;
        color: #ffffff;
    }
}

/* Landscape phone adjustments */
@media (max-width: 767.98px) and (orientation: landscape) {
    .mud-appbar {
        height: 48px !important;
    }
    
    .mud-container {
        padding-top: 8px !important;
        padding-bottom: 8px !important;
    }
}

/* Accessibility improvements */
@media (max-width: 575.98px) {
    /* Ensure focus indicators are visible */
    .mud-button:focus,
    .mud-icon-button:focus,
    .mud-input-control:focus-within {
        outline: 2px solid #2196f3;
        outline-offset: 2px;
    }
    
    /* Improve text spacing */
    p {
        line-height: 1.5;
    }
    
    /* Make clickable areas larger */
    .mud-nav-link {
        padding: 12px 16px !important;
    }
}

/* Statistics Paper - Remove double edge effect */
/* To undo this change, simply comment out or delete the .statistics-paper class */
.statistics-paper {
    box-shadow: none !important;
    border: 1px solid rgba(0, 0, 0, 0.08) !important;
    background-color: rgba(0, 0, 0, 0.02) !important;
}

/* RTL (Right-to-Left) Language Support */
/* Base RTL styles */
[dir="rtl"] {
    text-align: right;
}

[dir="rtl"] .mud-drawer {
    right: 0;
    left: auto;
}

[dir="rtl"] .mud-drawer-open-responsive-md-left {
    right: 0 !important;
    left: auto !important;
}

[dir="rtl"] .mud-main-content {
    margin-right: 240px;
    margin-left: 0;
}

/* RTL Drawer positioning fix */
[dir="rtl"] .mud-drawer,
[dir="rtl"] .mud-drawer.mud-drawer-responsive,
[dir="rtl"] .mud-drawer.mud-drawer-responsive.mud-drawer-left,
[dir="rtl"] .mud-drawer-left {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
}

[dir="rtl"] .mud-drawer.mud-drawer-responsive.mud-drawer-left.mud-drawer-open,
[dir="rtl"] .mud-drawer.mud-drawer-open {
    right: 0 !important;
    left: auto !important;
    transform: none !important;
}

/* RTL Main content adjustment - stronger rules */
[dir="rtl"] .mud-main-content {
    margin-right: 240px !important;
    margin-left: 0 !important;
}

/* RTL Layout container positioning */
[dir="rtl"] .mud-layout {
    direction: rtl;
}

/* Navigation adjustments for RTL */
[dir="rtl"] .mud-nav-link {
    text-align: right;
    padding-right: 16px;
    padding-left: 8px;
}

[dir="rtl"] .mud-nav-link .mud-icon-root {
    margin-left: 8px;
    margin-right: 0;
}

/* AppBar RTL adjustments */
[dir="rtl"] .mud-appbar .mud-typography-h6 {
    margin-right: 8px;
    margin-left: 0;
}

[dir="rtl"] .mud-appbar .mud-button {
    margin-left: 8px;
    margin-right: 0;
}

/* Button icon positioning for RTL */
[dir="rtl"] .mud-button-start-icon {
    margin-right: -4px;
    margin-left: 8px;
}

[dir="rtl"] .mud-button-end-icon {
    margin-left: -4px;
    margin-right: 8px;
}

/* Form and input adjustments */
[dir="rtl"] .mud-input-adornment-end {
    left: 0;
    right: auto;
}

[dir="rtl"] .mud-input-adornment-start {
    right: 0;
    left: auto;
}

[dir="rtl"] .mud-select .mud-select-input {
    padding-right: 0;
    padding-left: 32px;
}

[dir="rtl"] .mud-input-control {
    text-align: right;
}

/* Card and paper adjustments */
[dir="rtl"] .mud-card-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .mud-card-actions .mud-button:not(:last-child) {
    margin-left: 8px;
    margin-right: 0;
}

/* Grid and layout adjustments */
[dir="rtl"] .d-flex.justify-space-between {
    flex-direction: row-reverse;
}

[dir="rtl"] .mud-grid.justify-end {
    justify-content: flex-start !important;
}

/* Commented out - causing layout issues */
/* [dir="rtl"] .mud-grid.justify-start {
    justify-content: flex-end !important;
} */

/* Page header and button layout mirroring */
[dir="rtl"] .d-flex.justify-space-between {
    flex-direction: row-reverse !important;
}

[dir="rtl"] .d-flex.align-center:not(.mud-nav-link):not(.mud-list-item) {
    flex-direction: row-reverse;
}

/* Button group positioning */
[dir="rtl"] .mud-button + .mud-button {
    margin-left: 0;
    margin-right: 8px;
}

/* Flex item ordering for common layouts */
[dir="rtl"] .page-header {
    flex-direction: row-reverse;
}

/* MudBlazor flex adjustments */
[dir="rtl"] .mud-flex {
    flex-direction: row-reverse;
}

[dir="rtl"] .mud-flex.mud-flex-column {
    flex-direction: column; /* Keep columns as columns */
}

/* Spacing adjustments */
[dir="rtl"] .mr-2 {
    margin-right: 0;
    margin-left: 8px;
}

[dir="rtl"] .ml-2 {
    margin-left: 0;
    margin-right: 8px;
}

[dir="rtl"] .mr-4 {
    margin-right: 0;
    margin-left: 16px;
}

[dir="rtl"] .ml-4 {
    margin-left: 0;
    margin-right: 16px;
}

/* Table RTL support */
[dir="rtl"] .mud-table-cell {
    text-align: right;
}

[dir="rtl"] .mud-table-head .mud-table-cell:first-child {
    text-align: right;
}

[dir="rtl"] .mud-table-sortlabel {
    flex-direction: row-reverse;
}

[dir="rtl"] .mud-table-sortlabel .mud-icon-root {
    margin-left: 4px;
    margin-right: 0;
}

/* Dialog adjustments */
[dir="rtl"] .mud-dialog-title {
    text-align: right;
}

[dir="rtl"] .mud-dialog-actions {
    flex-direction: row-reverse;
}

[dir="rtl"] .mud-dialog-actions .mud-button:not(:last-child) {
    margin-left: 8px;
    margin-right: 0;
}

/* List and menu items */
[dir="rtl"] .mud-list-item {
    text-align: right;
}

[dir="rtl"] .mud-list-item-icon {
    margin-left: 16px;
    margin-right: 0;
}

[dir="rtl"] .mud-list-item-text {
    text-align: right;
}

/* Snackbar positioning */
[dir="rtl"] .mud-snackbar-location-topRight {
    top: 24px;
    left: 24px;
    right: auto;
}

[dir="rtl"] .mud-snackbar-location-bottomRight {
    bottom: 24px;
    left: 24px;
    right: auto;
}

[dir="rtl"] .mud-snackbar-location-topLeft {
    top: 24px;
    right: 24px;
    left: auto;
}

[dir="rtl"] .mud-snackbar-location-bottomLeft {
    bottom: 24px;
    right: 24px;
    left: auto;
}

/* Statistics and metric cards RTL */
[dir="rtl"] .mud-statistic {
    text-align: right;
}

[dir="rtl"] .mud-statistic .mud-icon-root {
    margin-left: 8px;
    margin-right: 0;
}

/* Statistics paper mirroring */
[dir="rtl"] .statistics-paper .mud-grid {
    direction: rtl;
}

[dir="rtl"] .statistics-paper .mud-grid-item {
    text-align: right;
}

/* Data grid and table actions RTL */
[dir="rtl"] .mud-table-toolbar {
    flex-direction: row-reverse;
}

[dir="rtl"] .mud-table-toolbar .mud-spacer {
    margin-left: 0;
    margin-right: auto;
}

/* Search and filter sections */
[dir="rtl"] .mud-card-content .mud-grid {
    direction: rtl;
}

[dir="rtl"] .mud-grid-item .mud-button-group {
    flex-direction: row-reverse;
}

/* Icon positioning in RTL */
[dir="rtl"] .mud-button .mud-button-start-icon {
    margin-right: -4px;
    margin-left: 8px;
}

[dir="rtl"] .mud-button .mud-button-end-icon {
    margin-left: -4px;
    margin-right: 8px;
}

/* Page layout mirroring - Key classes used in pages */
[dir="rtl"] .mb-4 {
    margin-bottom: 16px; /* Keep vertical margins */
}

/* RTL Detection - Clean version */

/* RTL flex container rules - Using .rtl class only */
.rtl .d-flex.flex-column {
    flex-direction: column !important;
}

.rtl .d-flex.justify-space-between {
    flex-direction: row-reverse !important;
}

.rtl .d-flex.justify-space-between.align-center {
    flex-direction: row-reverse !important;
    direction: ltr !important;
}

/* Text alignment in RTL for page headers */
.rtl .d-flex.justify-space-between > div:first-child {
    text-align: right !important;
}

/* Page title styling */
.rtl .mud-typography-h3,
.rtl .mud-typography-h4,
.rtl .mud-typography-h5 {
    text-align: right !important;
}

/* Page description text */
.rtl .mud-typography-body1,
.rtl .mud-typography-body2 {
    text-align: right !important;
}

/* Universal text alignment for RTL */
.rtl h1, .rtl h2, .rtl h3, 
.rtl h4, .rtl h5, .rtl h6 {
    text-align: right !important;
}

.rtl p, .rtl span:not(.mud-icon-root) {
    text-align: right !important;
}

/* MudBlazor component RTL fixes */
[dir="rtl"] .mud-paper.pa-4.mb-4 {
    direction: rtl;
}

[dir="rtl"] .mud-card .mud-card-content {
    direction: rtl;
}

[dir="rtl"] .mud-card .mud-card-content .mud-grid {
    direction: rtl;
}

/* Ensure proper RTL for page content containers */
[dir="rtl"] .mud-container {
    direction: rtl;
}

/* More aggressive RTL flexbox rules */
[dir="rtl"] .mud-container .d-flex.flex-column {
    flex-direction: column !important; /* Keep columns as columns */
}

/* Specific overrides for common Bootstrap/MudBlazor classes */
[dir="rtl"] .justify-content-between,
[dir="rtl"] .justify-space-between {
    flex-direction: row-reverse !important;
}

/* Button positioning in headers */
[dir="rtl"] .mud-button.mud-button-filled.mud-button-size-large {
    order: -1;
}

/* Universal text alignment for RTL */
[dir="rtl"] h1, [dir="rtl"] h2, [dir="rtl"] h3, 
[dir="rtl"] h4, [dir="rtl"] h5, [dir="rtl"] h6 {
    text-align: right !important;
}

[dir="rtl"] p, [dir="rtl"] span:not(.mud-icon-root) {
    text-align: right !important;
}

/* Enhanced Breadcrumb RTL support */
[dir="rtl"] .mud-breadcrumbs {
    direction: rtl !important;
}

[dir="rtl"] .mud-breadcrumb-item {
    direction: rtl !important;
}

[dir="rtl"] .mud-breadcrumb-separator {
    transform: scaleX(-1) !important;  /* Flip horizontally instead of rotation */
    display: inline-block !important;
}

/* Breadcrumb icon alignment for RTL */
[dir="rtl"] .mud-breadcrumb-item .mud-icon-root {
    margin-left: 4px !important;
    margin-right: 0 !important;
}

/* Compact breadcrumb RTL adjustments */
[dir="rtl"] .compact-breadcrumbs {
    direction: rtl !important;
    text-align: right !important;
}

/* Breadcrumb navigation flow for RTL */
[dir="rtl"] .mud-breadcrumbs .mud-breadcrumb-item {
    float: right !important;
}

/* Pagination RTL */
[dir="rtl"] .mud-pagination {
    flex-direction: row-reverse;
}

[dir="rtl"] .mud-pagination-item {
    margin-left: 4px;
    margin-right: 0;
}

/* Drawer toggle positioning for RTL */
[dir="rtl"] .mud-appbar .mud-icon-button:first-child {
    margin-right: 8px;
    margin-left: 0;
}

/* Ensure proper text direction inheritance */
[dir="rtl"] * {
    direction: rtl;
}

[dir="rtl"] input, 
[dir="rtl"] textarea, 
[dir="rtl"] select {
    text-align: right;
}

/* Language-specific fonts for better readability */
[lang="ar"] {
    font-family: 'Segoe UI', 'Tahoma', 'Arial Unicode MS', sans-serif;
}

[lang="fr"] {
    font-family: 'Segoe UI', 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

/* Mobile RTL adjustments */
@media (max-width: 767.98px) {
    [dir="rtl"] .mud-main-content {
        margin-right: 0 !important;
        margin-left: 0 !important;
    }
    
    [dir="rtl"] .mud-drawer--temporary,
    [dir="rtl"] .mud-drawer.mud-drawer-temporary {
        right: 0 !important;
        left: auto !important;
        transform: translateX(0) !important;
    }
    
    [dir="rtl"] .mud-drawer--temporary.mud-drawer-open,
    [dir="rtl"] .mud-drawer.mud-drawer-temporary.mud-drawer-open {
        right: 0 !important;
        left: auto !important;
    }
    
    [dir="rtl"] .mud-appbar .mud-icon-button {
        margin-right: 0;
        margin-left: 8px;
    }
}

/* Ensure icons don't get reversed for RTL */
[dir="rtl"] .mud-icon-root {
    transform: none !important;
}

/* Special handling for directional icons in RTL */
[dir="rtl"] .mud-icon-root.mud-svg-icon[data-icon*="arrow-left"] {
    transform: rotate(180deg) !important;
}

[dir="rtl"] .mud-icon-root.mud-svg-icon[data-icon*="arrow-right"] {
    transform: rotate(180deg) !important;
}

[dir="rtl"] .mud-icon-root.mud-svg-icon[data-icon*="chevron-left"] {
    transform: rotate(180deg) !important;
}

[dir="rtl"] .mud-icon-root.mud-svg-icon[data-icon*="chevron-right"] {
    transform: rotate(180deg) !important;
}

/* RTL Select field label positioning fixes */
[dir="rtl"] .mud-input-outlined .mud-input-outlined-label {
    right: 14px;
    left: auto;
    transform-origin: top right;
}

[dir="rtl"] .mud-input-outlined .mud-input-outlined-label.mud-input-outlined-label-shrink {
    transform: translate(12px, -1.5em) scale(0.75);
    right: 14px;
    left: auto;
    transform-origin: top right;
}

[dir="rtl"] .mud-select .mud-input-outlined-label {
    right: 14px;
    left: auto;
    transform-origin: top right;
}

[dir="rtl"] .mud-select .mud-input-outlined-label.mud-input-outlined-label-shrink {
    transform: translate(12px, -1.5em) scale(0.75);
    right: 14px;
    left: auto;
    transform-origin: top right;
}

/* RTL Input label outlined padding fix for numeric fields */
[dir="rtl"] .mud-input-label-outlined {
    padding: 0px 40px !important;
}

/* RTL Select field label animation and positioning - more specific targeting */
[dir="rtl"] .mud-select .mud-input-label,
[dir="rtl"] .mud-input-control .mud-input-label {
    left: auto;
    transform-origin: top right !important;
}

[dir="rtl"] .mud-select .mud-input-label.mud-input-label-shrink,
[dir="rtl"] .mud-input-control .mud-input-label.mud-input-label-shrink {
    transform: translate(8px, -1.5em) scale(0.75);
    left: auto;
    transform-origin: top right !important;
}

/* RTL Text field label positioning fixes */
[dir="rtl"] .mud-input-text .mud-input-outlined-label {
    right: 12px;
    left: auto;
    transform-origin: top right;
}

[dir="rtl"] .mud-input-text .mud-input-outlined-label.mud-input-outlined-label-shrink {
    transform: translate(0, -1.5em) scale(0.75);
    right: 12px;
    left: auto;
}

/* RTL Adornment positioning for text fields */
[dir="rtl"] .mud-input-adornment.mud-input-adornment-start {
    order: 2;
    margin-left: 8px;
    margin-right: 0;
}

[dir="rtl"] .mud-input-adornment.mud-input-adornment-end {
    order: 0;
    margin-right: 8px;
    margin-left: 0;
}

/* RTL Input placeholder and text alignment */
[dir="rtl"] .mud-input-outlined-input,
[dir="rtl"] .mud-select-input {
    text-align: right;
    padding-right: 48px;
    padding-left: 12px;
}

/* Ensure proper spacing between label and dropdown arrow in RTL */
[dir="rtl"] .mud-select .mud-input-outlined-label,
[dir="rtl"] .mud-select .mud-input-label {
    padding-left: 8px;
    padding-right: 0;
}

/* RTL Select input container adjustments */
[dir="rtl"] .mud-input-control.mud-input-outlined {
    flex-direction: row-reverse;
}

[dir="rtl"] .mud-select .mud-input-outlined-notched-outline {
    text-align: right;
}

/* CompactPageHeader RTL Support */
[dir="rtl"] .compact-page-header .page-title {
    text-align: right;
}

[dir="rtl"] .compact-page-header .page-description {
    text-align: right;
}

[dir="rtl"] .compact-page-header .action-buttons {
    flex-direction: row-reverse;
}

/* Dense Numeric Field Spin Buttons Fix */
/* Properly size spin buttons to fit inside dense/compact input boxes */

/* FIX: Change flex-direction to row to arrange buttons horizontally for compact design */
.mud-input-control.mud-input-number-control .mud-input-numeric-spin {
    flex-direction: row !important;
    gap: 1px !important;
    padding: 0 !important;
    position: relative !important;
}

/* Make spin buttons smaller for dense/compact appearance */
.mud-input-control.mud-input-number-control .mud-input-numeric-spin button {
    width: 24px !important;
    height: 100% !important;
    min-width: 24px !important;
    padding: 2px !important;
    margin: 0 !important;
}

/* Increase icon size in spin buttons for better visibility */
.mud-input-control.mud-input-number-control .mud-input-numeric-spin button svg,
.mud-input-control.mud-input-number-control .mud-input-numeric-spin button .mud-icon-root {
    font-size: 18px !important;
    width: 18px !important;
    height: 18px !important;
}

/* RTL support */
[dir="rtl"] .mud-input-control.mud-input-number-control .mud-input-numeric-spin {
    flex-direction: row-reverse !important;
    position: relative !important;
}

/* Prevent arrows from being mirrored in RTL */
[dir="rtl"] .mud-input-control.mud-input-number-control .mud-input-numeric-spin button svg,
[dir="rtl"] .mud-input-control.mud-input-number-control .mud-input-numeric-spin button .mud-icon-root {
    transform: none !important;
    direction: ltr !important;
}

/* Compact Select Box Styling - Force Dense Appearance */
/* Make MudSelect components compact to match text field height */
.mud-select.mud-input-control-margin-dense,
.mud-select .mud-input-control-margin-dense {
    min-height: 40px !important;
}

.mud-select.mud-input-control-margin-dense .mud-input-slot,
.mud-select .mud-input-control-margin-dense .mud-input-slot {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

.mud-select.mud-input-control-margin-dense .mud-select-input,
.mud-select .mud-input-control-margin-dense .mud-select-input {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

/* Force compact height for all outlined selects with margin dense */
.mud-input-outlined.mud-input-margin-dense {
    min-height: 40px !important;
}

.mud-input-outlined.mud-input-margin-dense .mud-input-slot {
    padding-top: 8px !important;
    padding-bottom: 8px !important;
}

/* Adjust select arrow positioning for compact mode */
.mud-input-margin-dense .mud-input-adornment {
    margin-top: 0 !important;
}

/* Make sure the label scales correctly in dense mode */
.mud-input-margin-dense .mud-input-label {
    transform: translate(0, 20px) scale(1) !important;
}

.mud-input-margin-dense .mud-input-label.mud-input-label-inputfilled,
.mud-input-margin-dense .mud-input-label.mud-input-label-shrink {
    transform: translate(0, -1.5px) scale(0.75) !important;
}
