html,
body {
    font-family: 'Poppins', Helvetica, Arial, sans-serif;
}

/* Default chiaro: Safari/iPad al resume da background altrimenti scurisce form e aree senza background esplicito. */
html {
    color-scheme: light;
}

h1:focus {
    outline: none;
}

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

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

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

.invalid {
    outline: 1px solid red;
}

.validation-message {
    color: red;
}

#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 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,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNj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Y2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.loading-screen {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    height: 100vh;
    width: 100vw;
    position: fixed;
    inset: 0;
    z-index: 20000;
}

.loading-bg-container {
    position: absolute;
    inset: 0;
    z-index: 0;
}

.loading-content {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex-grow: 1;
    gap: 2rem;
}

.loading-bg-video {
    width: 100vw;
    height: 100vh;
    object-fit: cover;
    pointer-events: none;
}

.loading-content {
    position: relative;
}

.skip-intro-btn {
    position: fixed;
    left: 50%;
    bottom: 40px;
    transform: translateX(-50%);
    z-index: 20002;
    padding: 12px 32px;
    font-size: 1.2rem;
    color: #fff;
    background: #888;
    border: none;
    border-radius: 24px;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.2);
    cursor: pointer;
    pointer-events: auto;
}

.skip-intro-btn[hidden] {
    display: none !important;
}

.loading-progress-logo {
    max-width: min(80vw, 320px);
    height: auto;
    margin-bottom: 1.5rem;
}

.branded-loading-indicator {
    position: relative;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    line-height: 0;
}

/* Logo overlay: never a child of the rotating indeterminate circular. */
.branded-loading-indicator-icon {
    position: absolute;
    left: 50%;
    top: 50%;
    transform: translate(-50%, -50%);
    display: block;
    object-fit: contain;
    pointer-events: none;
    z-index: 1;
}

/*
 * Soft white gloss around MustWait spinner + logo.
 * iOS Safari often drops `filter` on animated SVG (MudProgressCircular), especially
 * when an ancestor uses backdrop-filter (CollectionsView .custom-blur-dialog).
 * Use a radial halo + logo drop-shadow (Safari-safe) instead of filter on the circular.
 */
.must-wait-gloss {
    /* Own compositing layer: reduces backdrop-filter + filter interactions on WebKit */
    transform: translateZ(0);
    -webkit-transform: translateZ(0);
}

.must-wait-gloss .branded-loading-indicator {
    isolation: isolate;
}

.must-wait-gloss .branded-loading-indicator::before {
    content: "";
    position: absolute;
    left: 50%;
    top: 50%;
    width: 5.25rem;
    height: 5.25rem;
    transform: translate(-50%, -50%);
    border-radius: 50%;
    pointer-events: none;
    z-index: 0;
    background: radial-gradient(
        circle,
        rgba(255, 255, 255, 0.95) 0%,
        rgba(255, 255, 255, 0.55) 28%,
        rgba(255, 255, 255, 0.22) 52%,
        transparent 72%
    );
}

/* Alpha-aware edge glow on the logo (works better on iOS than filter on the SVG parent). */
.must-wait-gloss .branded-loading-indicator-icon {
    -webkit-filter:
        drop-shadow(0 0 1px rgba(255, 255, 255, 1))
        drop-shadow(0 0 3px rgba(255, 255, 255, 0.85))
        drop-shadow(0 0 8px rgba(255, 255, 255, 0.55))
        drop-shadow(0 0 14px rgba(255, 255, 255, 0.3));
    filter:
        drop-shadow(0 0 1px rgba(255, 255, 255, 1))
        drop-shadow(0 0 3px rgba(255, 255, 255, 0.85))
        drop-shadow(0 0 8px rgba(255, 255, 255, 0.55))
        drop-shadow(0 0 14px rgba(255, 255, 255, 0.3));
}

.loading-progress-wrapper {
    position: relative;
    width: 4rem;
    height: 4rem;
    display: flex;
    align-items: center;
    justify-content: center;
}

.loading-progress {
    width: 100%;
    height: 100%;
}

.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;
    font-weight: bold;
    font-size: 0.8rem;
}

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

.loading-progress-footer {
    display: flex;
    flex-direction: column;
    align-items: inherit;
    gap: 0.15rem;
}

.loading-progress-copyright {
    text-align: center;
    opacity: 0.5;
    font-size: 0.8rem;
    margin: 0;
}

.loading-progress-version {
    text-align: center;
    opacity: 0.45;
    font-size: 0.7rem;
    margin: 0;
    line-height: 1.2;
}

/* Loading progress e copyright in basso a destra */
.loading-bottom-right {
    position: fixed;
    bottom: 1rem;
    right: 1rem;
    z-index: 20001;
    display: flex;
    flex-direction: column;
    align-items: flex-end;
    gap: 1rem;
}

code {
    color: #c02d76;
}

/* Blocca lo scroll del body durante la schermata di loading */
.body-no-scroll {
    overflow: hidden !important;
    height: 100vh;
}

/* MudChip nelle griglie: solo lo sfondo al 50% (testo resta pieno). */
.mud-data-grid .mud-chip.mud-chip-filled,
.mud-table .mud-chip.mud-chip-filled {
    background-color: color-mix(in srgb, var(--mud-palette-action-disabled-background) 50%, transparent) !important;
}

.mud-data-grid .mud-chip.mud-chip-filled.mud-chip-color-primary,
.mud-table .mud-chip.mud-chip-filled.mud-chip-color-primary {
    background-color: color-mix(in srgb, var(--mud-palette-primary) 50%, transparent) !important;
}

.mud-data-grid .mud-chip.mud-chip-filled.mud-chip-color-secondary,
.mud-table .mud-chip.mud-chip-filled.mud-chip-color-secondary {
    background-color: color-mix(in srgb, var(--mud-palette-secondary) 50%, transparent) !important;
}

.mud-data-grid .mud-chip.mud-chip-filled.mud-chip-color-tertiary,
.mud-table .mud-chip.mud-chip-filled.mud-chip-color-tertiary {
    background-color: color-mix(in srgb, var(--mud-palette-tertiary) 50%, transparent) !important;
}

.mud-data-grid .mud-chip.mud-chip-filled.mud-chip-color-info,
.mud-table .mud-chip.mud-chip-filled.mud-chip-color-info {
    background-color: color-mix(in srgb, var(--mud-palette-info) 50%, transparent) !important;
}

.mud-data-grid .mud-chip.mud-chip-filled.mud-chip-color-success,
.mud-table .mud-chip.mud-chip-filled.mud-chip-color-success {
    background-color: color-mix(in srgb, var(--mud-palette-success) 50%, transparent) !important;
}

.mud-data-grid .mud-chip.mud-chip-filled.mud-chip-color-warning,
.mud-table .mud-chip.mud-chip-filled.mud-chip-color-warning {
    background-color: color-mix(in srgb, var(--mud-palette-warning) 50%, transparent) !important;
}

.mud-data-grid .mud-chip.mud-chip-filled.mud-chip-color-error,
.mud-table .mud-chip.mud-chip-filled.mud-chip-color-error {
    background-color: color-mix(in srgb, var(--mud-palette-error) 50%, transparent) !important;
}

.mud-data-grid .mud-chip.mud-chip-filled.mud-chip-color-dark,
.mud-table .mud-chip.mud-chip-filled.mud-chip-color-dark {
    background-color: color-mix(in srgb, var(--mud-palette-dark) 50%, transparent) !important;
}

/*
 * Tutti i MudTextField multiline (textarea) — ridimensionabili verticalmente.
 * MudBlazor 9: .mud-input>textarea.mud-input-root { resize:none; background:none }
 */
.mud-input > textarea.mud-input-root,
.mud-input > textarea.mud-input-slot,
.mud-input-control textarea {
    resize: vertical !important;
    overflow-x: hidden !important;
    overflow-y: auto !important;
    min-height: 5.5rem;
    padding-bottom: 1.35rem !important;
    background-color: transparent !important;
    background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='20' height='20' viewBox='0 0 20 20'%3E%3Cpath d='M17 5 L5 17' stroke='%23ff9800' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M17 10 L10 17' stroke='%23ff9800' stroke-width='2.2' stroke-linecap='round'/%3E%3Cpath d='M17 15 L15 17' stroke='%23ff9800' stroke-width='2.2' stroke-linecap='round'/%3E%3C/svg%3E") !important;
    background-repeat: no-repeat !important;
    background-position: right 6px bottom 4px !important;
    background-size: 20px 20px !important;
}

.mud-input > textarea.mud-input-root::-webkit-resizer,
.mud-input-control textarea::-webkit-resizer {
    background: transparent;
    border: none;
}

.mud-input:has(> textarea) {
    overflow: visible !important;
}

/*
 * Catalog slideshow: scroll verticale dell'intera pagina (iPad), non del carousel.
 * Le regole devono stare qui (non nel CSS scoped di CatalogPage) perché .mud-layout
 * è un antenato della pagina.
 */
.mud-layout:has(.catalog-carousel-page) {
    overflow-y: auto !important;
    overflow-x: hidden !important;
    height: auto !important;
    min-height: 100dvh;
    max-height: none !important;
}

.mud-main-content:has(.catalog-carousel-page) {
    overflow: visible !important;
}

/* Compare dopo 6s dallo spinner senza dipendere dal thread Blazor WASM. */
.slow-loading-message {
    opacity: 0;
    animation: slow-loading-message-reveal 0.25s ease-in 6s forwards;
}

@keyframes slow-loading-message-reveal {
    to {
        opacity: 1;
    }
}

/*
 * Varianti catalogo (cards / carousel / CollectionsView):
 * l'intera cella bordata apre il MudMenu, non solo l'icona TouchApp.
 * Nota: .mud-menu-activator usa display:contents → l'activator è flex-item di .mud-menu.
 */
.catalog-var-cell {
    position: relative;
    overflow: hidden;
}

.catalog-var-tooltip.mud-tooltip-root {
    width: 100% !important;
    height: 100% !important;
    display: flex !important;
}

.catalog-var-menu.mud-menu {
    width: 100%;
    height: 100%;
    display: flex;
    align-self: stretch;
    align-items: stretch;
}

.catalog-var-activator {
    flex: 1 1 auto;
    width: 100%;
    min-height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-sizing: border-box;
}

/*
 * Zoom immagine (ProductImageDialog / CollectionsView): su iPad/Safari il long-press
 * apre altrimenti il callout nativo Condividi/Salva e annulla la lente.
 */
img.product-image-zoom-img,
img.catalog-carousel-zoom-img {
    -webkit-touch-callout: none;
    -webkit-user-select: none;
    user-select: none;
    -webkit-user-drag: none;
}