html, body {
    font-family: 'Helvetica Neue', Helvetica, Arial, sans-serif;
}

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;
}

.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;
}

/* Stili per la stampa */
@media print {
    /* Nascondi elementi non necessari in stampa */
    .no-print {
        display: none !important;
    }

    /* Ottimizza la stampa della tabella */
    body {
        font-size: 10pt;
    }

    h1 {
        font-size: 18pt;
        margin-bottom: 10pt;
    }

    table {
        width: 100%;
        border-collapse: collapse;
    }

    table thead {
        display: table-header-group;
    }

    table tbody tr {
        page-break-inside: avoid;
    }

    /* Evita interruzioni di pagina indesiderate */
    .card {
        page-break-inside: avoid;
    }

    /* Rimuovi ombre e bordi non necessari */
    .card, .table {
        box-shadow: none !important;
    }

    /* Mantieni i bordi della tabella */
    .table-bordered th,
    .table-bordered td {
        border: 1px solid #000 !important;
    }
}

/* Classi di colore personalizzate */
.text-purple {
    color: #6f42c1 !important;
}

.text-orange {
    color: #fd7e14 !important;
}

.btn-purple {
    color: #fff;
    background-color: #6f42c1;
    border-color: #6f42c1;
}

.btn-purple:hover {
    color: #fff;
    background-color: #5a32a3;
    border-color: #5a32a3;
}

.btn-purple:focus, .btn-purple:active {
    color: #fff;
    background-color: #5a32a3;
    border-color: #5a32a3;
    box-shadow: 0 0 0 0.25rem rgba(111, 66, 193, 0.5);
}

.btn-orange {
    color: #fff;
    background-color: #fd7e14;
    border-color: #fd7e14;
}

.btn-orange:hover {
    color: #fff;
    background-color: #e66a0a;
    border-color: #e66a0a;
}

.btn-orange:focus, .btn-orange:active {
    color: #fff;
    background-color: #e66a0a;
    border-color: #e66a0a;
    box-shadow: 0 0 0 0.25rem rgba(253, 126, 20, 0.5);
}

/* ========================================
   EUROPEAN ACCESSIBILITY ACT (EAA) / WCAG 2.1 AA
   Stili per accessibilità
   ======================================== */

/* Skip Navigation Link (WCAG 2.4.1) */
.skip-link {
    position: absolute;
    top: -40px;
    left: 0;
    background: #1b6ec2;
    color: white;
    padding: 8px 16px;
    text-decoration: none;
    z-index: 100;
    font-weight: bold;
    border-radius: 0 0 4px 0;
}

.skip-link:focus,
.skip-link:active {
    top: 0;
}

/* Focus Visibile Migliorato (WCAG 2.4.7) */
a:focus-visible,
button:focus-visible,
select:focus-visible,
textarea:focus-visible,
.btn:focus-visible {
    outline: 3px solid #1b6ec2;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(27, 110, 194, 0.3);
}

/* Focus per input */
input:focus-visible {
    outline: 3px solid #1b6ec2;
    outline-offset: 2px;
    box-shadow: 0 0 0 3px rgba(27, 110, 194, 0.3);
}

/* Focus per elementi interattivi custom */
[role="button"]:focus-visible,
[tabindex]:focus-visible {
    outline: 3px solid #1b6ec2;
    outline-offset: 2px;
}

/* Miglioramento contrasto per link (WCAG 1.4.3) */
a {
    text-decoration: underline;
}

a:hover,
a:focus {
    text-decoration: underline;
    text-decoration-thickness: 2px;
}

/* Screen Reader Only (ma visibile su focus) */
.visually-hidden-focusable:not(:focus):not(:focus-within) {
    position: absolute !important;
    width: 1px !important;
    height: 1px !important;
    padding: 0 !important;
    margin: -1px !important;
    overflow: hidden !important;
    clip: rect(0, 0, 0, 0) !important;
    white-space: nowrap !important;
    border: 0 !important;
}

/* Indicatori di stato con icone + testo (WCAG 1.4.1) */
.visually-hidden {
    position: absolute;
    width: 1px;
    height: 1px;
    padding: 0;
    margin: -1px;
    overflow: hidden;
    clip: rect(0, 0, 0, 0);
    white-space: nowrap;
    border: 0;
}

/* Miglioramento navigazione tastiera per tabelle */
table:focus-within {
    outline: 2px solid #1b6ec2;
    outline-offset: 2px;
}

/* Miglioramento contrasto per badge */
.badge {
    font-weight: 600;
    padding: 0.4em 0.65em;
}

/* Focus trap per modali (WCAG 2.4.3) */
.modal.show {
    outline: none;
}

.modal-content:focus {
    outline: 3px solid #1b6ec2;
}

/* Contrasto minimo 4.5:1 per testo normale (WCAG 1.4.3) */
.text-muted {
    color: #6c757d !important; /* Contrasto 4.54:1 su bianco */
}

/* Spinner prezzi catalogo - animazione autocontenuta */
.price-spinner {
    display: inline-block;
    width: 0.85rem;
    height: 0.85rem;
    border: 0.18em solid #adb5bd;
    border-top-color: #6c757d;
    border-radius: 50%;
    vertical-align: -0.1em;
    animation: price-spin 0.75s linear infinite !important;
    animation-duration: 0.75s !important;
    animation-iteration-count: infinite !important;
}

@keyframes price-spin {
    0%   { transform: rotate(0deg); }
    100% { transform: rotate(360deg); }
}

/* Assicura che gli input disabled siano riconoscibili */
input:disabled,
select:disabled,
textarea:disabled,
button:disabled {
    opacity: 0.6;
    cursor: not-allowed;
}

/* Miglioramento per campi form con errori (WCAG 3.3.1) */
.invalid,
input[aria-invalid="true"],
select[aria-invalid="true"],
textarea[aria-invalid="true"] {
    outline: 2px solid #dc3545;
    outline-offset: 2px;
}

.validation-message {
    color: #dc3545;
    font-weight: 600;
    margin-top: 0.25rem;
    font-size: 0.875em;
}

/* Assicura contrasto sufficiente per pulsanti */
.btn-primary:hover,
.btn-primary:focus {
    background-color: #155a9e;
    border-color: #145289;
}

/* Miglioramento per checkbox e radio (WCAG 2.5.5) */
.form-check-input {
    width: 1.25em;
    height: 1.25em;
    margin-top: 0.125em;
}

.form-check-input:focus {
    border-color: #1b6ec2;
    box-shadow: 0 0 0 0.25rem rgba(27, 110, 194, 0.25);
}

/* Animazioni rispettano prefers-reduced-motion (WCAG 2.3.3) */
@media (prefers-reduced-motion: reduce) {
    *,
    *::before,
    *::after {
        animation-duration: 0.01ms !important;
        animation-iteration-count: 1 !important;
        transition-duration: 0.01ms !important;
        scroll-behavior: auto !important;
    }
}

/* Fix globale spinner Bootstrap: la specificità di .spinner-border (0,1,0) vince
   sul selettore * (0,0,0) del prefers-reduced-motion, garantendo la rotazione */
.spinner-border {
    border-radius: 50% !important;
    border-right-color: transparent !important;
    animation: bs-spin 0.75s linear infinite !important;
    animation-duration: 0.75s !important;
    animation-iteration-count: infinite !important;
}

@keyframes bs-spin {
    to { transform: rotate(360deg); }
}

/* Zoom testo fino a 200% (WCAG 1.4.4) */
@media screen and (min-width: 1280px) {
    html {
        font-size: 16px;
    }
}

/* Contrasto aumentato per modalità High Contrast */
@media (prefers-contrast: high) {
    .btn,
    .form-control,
    .form-select {
        border-width: 2px;
    }

    a {
        text-decoration-thickness: 2px;
    }
}

/* ========================================
   TABELLE PERSONALIZZATE
   ======================================== */

/* Header tabella con stile Bootstrap table-dark (nero con testo bianco) */
/* Selettore molto specifico per sovrascrivere Bootstrap */
table thead.table-header-celeste,
.table thead.table-header-celeste,
.table-bordered thead.table-header-celeste,
.table-hover thead.table-header-celeste,
.table-striped thead.table-header-celeste {
    background-color: #212529 !important; /* Nero Bootstrap dark */
    color: #ffffff !important;
    font-weight: 500;
    border-color: #373b3e !important;
}

table thead.table-header-celeste th,
.table thead.table-header-celeste th,
.table-bordered thead.table-header-celeste th,
.table-hover thead.table-header-celeste th,
.table-striped thead.table-header-celeste th {
    background-color: #212529 !important;
    color: #ffffff !important;
    border-color: #373b3e !important;
    vertical-align: middle;
}

table thead.table-header-celeste th.sortable:hover,
.table thead.table-header-celeste th.sortable:hover {
    background-color: #32383e !important;
    cursor: pointer;
}

/* Assicura che le icone nelle intestazioni siano bianche */
table thead.table-header-celeste i,
table thead.table-header-celeste .bi,
.table thead.table-header-celeste i,
.table thead.table-header-celeste .bi {
    color: #ffffff !important;
}

/* Compatibilità con tutte le combinazioni di classi table */
.table.table-bordered thead.table-header-celeste th,
.table.table-hover thead.table-header-celeste th,
.table.table-striped thead.table-header-celeste th {
    background-color: #212529 !important;
    color: #ffffff !important;
    border: 1px solid #dee2e6 !important;
}

/* Spaziatura bottoni azioni nelle tabelle */
.btn-group {
    gap: 0.25rem;
}

td .btn-group {
    gap: 0.25rem; /* Ridotto per evitare che vadano a capo */
}

/* Spaziatura bottoni azioni che non sono in btn-group */
td .btn + .btn {
    margin-left: 0.35rem; /* Ridotto */
}

/* Bottoni più compatti nella colonna Azioni */
td.no-print .btn,
td .btn-group .btn {
    padding: 0.25rem 0.5rem; /* Ridotto da default Bootstrap */
    font-size: 0.875rem; /* Leggermente più piccolo */
}

td.no-print .btn i,
td .btn-group .btn i {
    font-size: 1rem !important; /* Icone più piccole */
}

/* Assicura che i bottoni stiano su una riga */
td.no-print,
td .btn-group {
    white-space: nowrap;
}

/* ========================================
   FIX MODALE - Rimuove gradient bootstrap indesiderati
   ======================================== */

/* ✅ Rimuove gli pseudo-elementi ::before e ::after da modal-body
   che potrebbero creare linee/gradient indesiderati */
.modal-body::before,
.modal-body::after {
    display: none !important;
}

/* ✅ Rimuove gli pseudo-elementi ::before e ::after da modal-content
   per evitare bordi o ombre duplicate */
.modal-content::before,
.modal-content::after {
    display: none !important;
}

/* ✅ Assicura che anche i modal-header e modal-footer non abbiano pseudo-elementi */
.modal-header::before,
.modal-header::after,
.modal-footer::before,
.modal-footer::after {
    display: none !important;
}
