:root {
    --font-scale: 1.0;
}

html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
    height: 100%;
    margin: 0;
    padding: 0;
    overflow: hidden;
}

/* MudBlazor Layout - pełna wysokość ekranu */
.mud-layout {
    height: 100vh;
    display: flex;
    flex-direction: column;
}

/* MudDrawer - rozciągnięty do dołu, bez scrollbara */
.mud-drawer {
    height: 100%;
    overflow-y: auto;
}

.mud-drawer .mud-drawer-content {
    height: 100%;
    display: flex;
    flex-direction: column;
}

/* MudMainContent - no scrolling (grid handles it now) */
.mud-main-content {
    flex: 1;
    overflow-y: hidden; /* Changed from auto - adaptive grid handles scrolling */
    height: calc(100vh - 64px); /* odejmujemy wysokość AppBar (64px dla dense=true) */
}

/* Apply font scaling globally via rem units - responsive and no overflow */
html {
    font-size: calc(16px * var(--font-scale));
}

h1:focus {
    outline: none;
}

a, .btn-link {
    color: #0071c1;
}

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

.content {
    padding-top: 1.1rem;
}

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

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#blazor-error-ui {
    color-scheme: light only;
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0, 0, 0, 0.2);
    box-sizing: border-box;
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem 1.25rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

    #blazor-error-ui .dismiss {
        cursor: pointer;
        position: absolute;
        right: 0.75rem;
        top: 0.5rem;
    }

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

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

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .loading-progress circle {
        fill: none;
        stroke: #e0e0e0;
        stroke-width: 0.6rem;
        transform-origin: 50% 50%;
        transform: rotate(-90deg);
    }

        .loading-progress circle:last-child {
            stroke: #1b6ec2;
            stroke-dasharray: calc(3.141 * var(--blazor-load-percentage, 0%) * 0.8), 500%;
            transition: stroke-dasharray 0.05s ease-in-out;
        }

.loading-progress-text {
    position: absolute;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

    .loading-progress-text:after {
        content: var(--blazor-load-percentage-text, "Loading");
    }

code {
    color: #c02d76;
}

.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;
}

/* ========================================
   FOCUS INDICATORS (WCAG 2.4.7)
   ======================================== */

/* Buttons */
.mud-button:focus-visible,
.mud-icon-button:focus-visible,
.mud-button-root:focus-visible,
.mud-fab:focus-visible {
    outline: 3px solid var(--mud-palette-primary, #1976d2);
    outline-offset: 2px;
    border-radius: 4px;
}

/* Inputs, Autocomplete */
.mud-input:focus-within,
.mud-autocomplete:focus-within {
    box-shadow: 0 0 0 3px rgba(25, 118, 210, 0.25) !important;
    border-radius: 4px;
}

/* Disable MudBlazor default focus styles that might conflict */
.mud-input:focus-within .mud-input-slot,
.mud-autocomplete:focus-within .mud-input-slot {
    box-shadow: none !important;
}

/* Checkbox, Radio, Switch */
.mud-checkbox:focus-visible .mud-checkbox-input,
.mud-radio:focus-visible .mud-radio-input,
.mud-switch:focus-visible .mud-switch-input {
    outline: 3px solid var(--mud-palette-primary, #1976d2);
    outline-offset: 2px;
}

/* Links */
a:focus-visible {
    outline: 3px solid var(--mud-palette-primary, #1976d2);
    outline-offset: 2px;
    border-radius: 2px;
}

/* Dark mode adjustments */
.mud-theme-dark .mud-button:focus-visible,
.mud-theme-dark .mud-icon-button:focus-visible,
.mud-theme-dark a:focus-visible {
    outline-color: var(--mud-palette-primary, #90caf9);
}

.mud-theme-dark .mud-input:focus-within,
.mud-theme-dark .mud-autocomplete:focus-within {
    box-shadow: 0 0 0 3px rgba(144, 202, 249, 0.25) !important;
}

/* Respect prefers-reduced-motion */
@media (prefers-reduced-motion: reduce) {
    .mud-button:focus-visible,
    .mud-icon-button:focus-visible,
    .mud-input:focus-within,
    .mud-autocomplete:focus-within,
    .mud-select:focus-within,
    a:focus-visible {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mud-button:focus-visible,
    .mud-icon-button:focus-visible,
    a:focus-visible {
        outline-width: 4px;
        outline-style: solid;
    }
}

/* ========================================
   SKIP NAVIGATION (WCAG 2.4.1)
   ======================================== */

.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: var(--mud-palette-primary, #1976d2);
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    font-weight: 500;
    z-index: 10000;
    border-radius: 0 0 4px 0;
    transition: top 0.2s ease-in-out;
}

.skip-link:focus {
    top: 0;
    outline: 3px solid white;
    outline-offset: -3px;
}

/* Dark mode */
.mud-theme-dark .skip-link {
    background: var(--mud-palette-primary, #90caf9);
    color: #000000;
}

.mud-theme-dark .skip-link:focus {
    outline-color: #000000;
}

/* Main content focus */
#main-content:focus {
    outline: none;
}

/* ========================================
   TABLE CAPTIONS (WCAG 1.3.1)
   ======================================== */

/* Visually hide captions but keep them accessible to screen readers */
.mud-table-caption {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border-width: 0;
}

/* ========================================
   ERROR ANNOUNCEMENTS (WCAG 3.3.1, 4.1.3)
   ======================================== */

/* MudBlazor automatically adds role="alert" and aria-live to snackbars */
/* All MudAlert components should have role="alert" and aria-live="assertive" for errors */
/* This is handled in markup via attributes on MudAlert components */

/* ========================================
   TOUCH TARGETS (WCAG 2.5.5 Level AAA, 2.5.8 Level AA)
   ======================================== */

/* Ensure all interactive elements are at least 44x44px */
/* MudBlazor Size.Small IconButtons are ~32px - TOO SMALL */
/* Use Size.Medium (40px) or CSS to ensure minimum 44px */

/* IconButtons - ensure minimum touch target size */
.mud-icon-button {
    min-width: 44px;
    min-height: 44px;
}

/* Small IconButtons specifically */
.mud-icon-button-size-small {
    min-width: 44px;
    min-height: 44px;
    padding: 6px; /* Adds space around the icon */
}

/* Checkbox, Radio, Switch - WCAG 2.5.5 compliance via container, not icon button */
/* The entire checkbox (icon + label) is the touch target, not just the icon */
/* Reset icon button size constraints for proper alignment with text */
.mud-checkbox .mud-icon-button,
.mud-radio .mud-icon-button,
.mud-switch .mud-icon-button {
    min-width: auto;
    min-height: auto;
}

/* Ensure the checkbox/radio/switch container itself meets WCAG 2.5.5 (44x44px) */
.mud-checkbox,
.mud-radio,
.mud-switch {
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* Chips (status badges) - already large enough but ensure clickable ones are 44px */
.mud-chip-clickable {
    min-height: 32px; /* MudBlazor default is OK for non-interactive */
}

/* Links and small buttons */
a, button {
    min-height: 24px; /* Text links are OK to be smaller */
}

button.mud-button-root {
    min-height: 40px; /* Buttons should be at least 40px */
}

/* Table action buttons - critical for accessibility */
.mud-table-container .mud-icon-button {
    min-width: 44px;
    min-height: 44px;
}

/* Spacing between adjacent touch targets (WCAG 2.5.8) */
/* Ensure at least 8px spacing or non-interactive content between targets */
.mud-table-cell .mud-icon-button + .mud-icon-button {
    margin-left: 8px;
}

/* Menu items and list items */
.mud-list-item {
    min-height: 44px;
    padding: 8px 16px;
}

/* Dialog close button */
.mud-dialog-title .mud-icon-button {
    min-width: 44px;
    min-height: 44px;
}

/* Snackbar close button */
.mud-snackbar-close-button {
    min-width: 44px;
    min-height: 44px;
}