:root {
    font-size: 16px;
}

html, body {
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "Helvetica Neue", Arial, sans-serif;
    font-size: 1rem;
}

/* Loading progress */
.loading-progress {
    position: absolute;
    display: block;
    width: 8rem;
    height: 8rem;
    inset: 20vh 0 auto 0;
    margin: 0 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: #1565C0;
    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");
}

/* Blazor error UI */
#blazor-error-ui {
    background: lightyellow;
    bottom: 0;
    box-shadow: 0 -1px 2px rgba(0,0,0,0.2);
    display: none;
    left: 0;
    padding: 0.6rem 1.25rem 0.7rem;
    position: fixed;
    width: 100%;
    z-index: 1000;
}

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

/* Logo in header */
.logo-img {
    object-fit: contain;
}

/* Hamburger button — hidden on desktop, visible on mobile */
.hamburger-btn {
    display: flex;
}

@media (min-width: 960px) {
    .hamburger-btn {
        display: none !important;
    }
}

/* Mobile bottom nav */
.bottom-nav-mobile {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 64px;
    background: #ffffff;
    box-shadow: 0 -2px 6px rgba(0, 0, 0, 0.12);
    z-index: 1100;
    display: flex;
    justify-content: space-around;
    align-items: center;
}

@media (min-width: 960px) {
    .bottom-nav-mobile {
        display: none !important;
    }
}

/* Extra padding at bottom on mobile to avoid content hidden behind nav */
@media (max-width: 959px) {
    .mud-main-content {
        padding-bottom: 80px !important;
    }
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    text-decoration: none;
    color: #1565C0;
    font-size: 0.75rem;
    padding: 8px 12px;
    min-width: 64px;
    min-height: 56px;
    gap: 2px;
    border-radius: 8px;
    transition: background 0.15s;
}

.bottom-nav-item:hover, .bottom-nav-item.active {
    background: rgba(21, 101, 192, 0.08);
}

/* Active nav link in dark blue drawer — white highlight */
.mud-drawer .mud-nav-link.active,
.mud-drawer .mud-nav-link:hover {
    background-color: rgba(255, 255, 255, 0.15) !important;
    color: #ffffff !important;
}

.mud-drawer .mud-nav-link.active .mud-nav-link-text,
.mud-drawer .mud-nav-link.active .mud-icon-root {
    color: #ffffff !important;
}

/* Minimum touch target size for accessibility */
.mud-button-root,
.mud-icon-button,
.mud-nav-link,
.mud-list-item-button {
    min-height: 44px !important;
}

/* Print styles */
@media print {
    .no-print,
    .mud-appbar,
    .mud-drawer,
    .mud-drawer-overlay,
    .bottom-nav-mobile,
    .mud-fab,
    .mud-button-root:not(.print-action),
    .mud-icon-button {
        display: none !important;
    }

    .mud-main-content {
        margin-left: 0 !important;
        padding-top: 0 !important;
        padding-bottom: 0 !important;
    }

    .mud-container {
        max-width: 100% !important;
        padding: 0 !important;
    }

    body {
        font-size: 9pt;
        color: #000;
    }

    .print-header {
        display: flex !important;
        align-items: center;
        gap: 12px;
        margin-bottom: 8px;
        border-bottom: 1px solid #ccc;
        padding-bottom: 6px;
    }

    .print-header img {
        height: 36px;
    }

    .print-header strong {
        font-size: 13pt;
    }

    @page {
        size: A4;
        margin: 12mm;
    }

    table {
        width: 100%;
        border-collapse: collapse;
        font-size: 9pt;
    }

    th, td {
        border: 1px solid #ccc;
        padding: 2px 6px;
        text-align: left;
        line-height: 1.3;
    }

    th {
        background: #f0f0f0;
        font-weight: bold;
        font-size: 8pt;
    }

    /* MudBlazor overrides for print */
    .mud-table-cell {
        padding: 2px 6px !important;
        height: auto !important;
        font-size: 9pt !important;
    }

    .mud-table-head .mud-table-cell {
        font-size: 8pt !important;
        font-weight: bold !important;
    }

    p, .mud-typography {
        margin: 0 !important;
        font-size: 9pt !important;
    }
}

/* Rapport print table */
.rapport-table {
    width: 100%;
    border-collapse: collapse;
    font-size: 0.875rem;
}

.rapport-table th {
    background: #f5f5f5;
    font-weight: 600;
    font-size: 0.8rem;
    padding: 4px 8px;
    border-bottom: 2px solid #ddd;
    text-align: left;
    white-space: nowrap;
}

.rapport-table td {
    padding: 3px 8px;
    border-bottom: 1px solid #eee;
    vertical-align: top;
}

.rapport-table tr:hover td {
    background: #fafafa;
}

.rapport-table .rapport-comment-row td {
    padding: 1px 8px 4px 24px;
    font-style: italic;
    color: #555;
    border-bottom: 1px solid #eee;
    font-size: 0.8rem;
}

/* QR code label grid */
.qr-label-grid {
    display: grid;
    grid-template-columns: repeat(4, 1fr);
    gap: 4px;
}

.qr-label {
    border: 1px solid #ccc;
    padding: 4px;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 2px;
    page-break-inside: avoid;
    break-inside: avoid;
}

.qr-label svg {
    width: 60px;
    height: 60px;
}

.qr-label-text {
    font-size: 0.65rem;
    text-align: center;
    font-weight: 600;
    line-height: 1.2;
}

.qr-label-url {
    font-size: 0.55rem;
    text-align: center;
    color: #444;
    word-break: break-all;
    line-height: 1.2;
}

.qr-label-org {
    font-size: 0.55rem;
    text-align: center;
    color: #444;
    line-height: 1.2;
}

@media print {
    .qr-label-grid {
        grid-template-columns: repeat(5, 1fr);
        gap: 1mm;
    }

    .qr-label {
        border: none;
        padding: 1mm;
        gap: 0.5mm;
    }

    .qr-label svg {
        width: 30mm;
        height: 30mm;
    }

    .qr-label-text {
        font-size: 7pt;
    }

    .qr-label-url,
    .qr-label-org {
        display: none;
    }
}

/* Hide camera button on non-touch devices (desktop) */
@media (hover: hover) and (pointer: fine) {
    .ocr-camera-btn {
        display: none !important;
    }
}
