html, body {
    font-family: 'Inter', sans-serif;
    margin: 0;
    padding: 0;
}

h1:focus {
    outline: none;
}

#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: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Si e' verificato un errore.";
}

/* Gradient button utility */
.btn-gradient {
    background: linear-gradient(90deg, #2A93D5, #A174F0) !important;
    color: white !important;
    border: none !important;
    border-radius: 12px !important;
}

/* Card style */
.card-guidooo {
    background: #FFFFFF;
    border: 1px solid #E5E5EA;
    border-radius: 12px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.04);
}

/* Custom scrollbar */
::-webkit-scrollbar { width: 6px; height: 6px; }
::-webkit-scrollbar-track { background: transparent; }
::-webkit-scrollbar-thumb { background: #C7C7CC; border-radius: 3px; }
::-webkit-scrollbar-thumb:hover { background: #8E8E93; }

/* Smooth transitions */
.mud-drawer {
    transition: width 0.2s ease !important;
}

/* ========================================
   CSS Custom Properties (responsive vars)
   ======================================== */
:root {
    --page-padding: 24px;
    --font-scale: 1;
    --card-padding: 16px;
    --cal-hour-height: 80px;
    --cal-day-hour-height: 120px;
    --cal-max-height: 700px;
    --cal-time-col: 60px;
    --cal-block-font: 0.7rem;
    --cal-header-font: 0.75rem;
    --cal-header-num-font: 1.1rem;
    --table-row-height: auto;
    --msg-list-width: 33.333%;
}

/* ========================================
   iMac 27" / Large desktop (>1400px)
   ======================================== */
@media (min-width: 1400px) {
    :root {
        --page-padding: 32px;
        --font-scale: 1.05;
        --card-padding: 24px;
        --cal-hour-height: 100px;
        --cal-day-hour-height: 140px;
        --cal-max-height: 840px;
        --cal-time-col: 70px;
        --cal-block-font: 0.8rem;
        --cal-header-font: 0.85rem;
        --cal-header-num-font: 1.25rem;
        --msg-list-width: 30%;
    }

    .mud-main-content {
        padding: 32px !important;
    }

    /* Larger fonts for big screens */
    .mud-typography-h5 { font-size: 1.75rem !important; }
    .mud-typography-h6 { font-size: 1.35rem !important; }
    .mud-typography-body1 { font-size: 0.95rem !important; }
    .mud-typography-body2 { font-size: 0.875rem !important; }
    .mud-typography-caption { font-size: 0.8rem !important; }

    /* Bigger table rows */
    .mud-table-row td,
    .mud-table-cell {
        padding: 12px 16px !important;
        font-size: 0.9rem !important;
    }
    .mud-table-row th,
    .mud-table-head th {
        padding: 14px 16px !important;
        font-size: 0.85rem !important;
    }

    /* Cards more spacious */
    .mud-paper.pa-4 {
        padding: 24px !important;
    }
    .mud-paper.pa-3 {
        padding: 20px !important;
    }

    /* Chip slightly bigger */
    .mud-chip {
        font-size: 0.8rem !important;
    }
}

/* ========================================
   Extra large (>1800px, ultra-wide / 4K)
   ======================================== */
@media (min-width: 1800px) {
    :root {
        --page-padding: 40px;
        --cal-hour-height: 110px;
        --cal-day-hour-height: 160px;
        --cal-max-height: 900px;
    }

    .mud-main-content {
        padding: 40px !important;
    }
}

/* ========================================
   Laptop (1024px - 1399px) - defaults
   ======================================== */
/* Uses the :root defaults above */

/* ========================================
   Tablet (768px - 1023px)
   ======================================== */
@media (max-width: 1023px) {
    :root {
        --page-padding: 16px;
        --card-padding: 14px;
        --cal-hour-height: 70px;
        --cal-day-hour-height: 100px;
        --cal-max-height: 600px;
        --cal-time-col: 50px;
        --cal-block-font: 0.65rem;
        --cal-header-font: 0.7rem;
        --cal-header-num-font: 1rem;
    }

    .mud-main-content {
        padding: 16px !important;
    }
}

/* ========================================
   Mobile (<768px)
   ======================================== */
@media (max-width: 767px) {
    :root {
        --page-padding: 12px;
        --font-scale: 0.92;
        --card-padding: 12px;
        --cal-hour-height: 60px;
        --cal-day-hour-height: 80px;
        --cal-max-height: 500px;
        --cal-time-col: 42px;
        --cal-block-font: 0.6rem;
        --cal-header-font: 0.65rem;
        --cal-header-num-font: 0.9rem;
    }

    .mud-main-content {
        padding: 8px !important;
    }

    /* Smaller fonts on mobile */
    .mud-typography-h5 { font-size: 1.2rem !important; }
    .mud-typography-h6 { font-size: 1rem !important; }

    /* Compact table cells */
    .mud-table-cell {
        padding: 4px 8px !important;
        font-size: 0.8rem !important;
    }

    /* Page header: stack on mobile */
    .page-header {
        flex-direction: column !important;
        align-items: flex-start !important;
        gap: 12px !important;
    }
    .page-header-actions {
        flex-wrap: wrap !important;
        width: 100% !important;
    }

    /* Hide less important columns */
    .hide-mobile {
        display: none !important;
    }

    /* Full width dialogs on mobile */
    .mud-dialog {
        margin: 8px !important;
        max-height: calc(100vh - 16px) !important;
    }
}

/* ========================================
   Small mobile (<480px)
   ======================================== */
@media (max-width: 479px) {
    :root {
        --cal-time-col: 36px;
        --cal-block-font: 0.55rem;
    }

    .mud-main-content {
        padding: 4px !important;
    }

    .mud-typography-h5 { font-size: 1.1rem !important; }
    .mud-button-group .mud-button {
        padding: 2px 8px !important;
        font-size: 0.7rem !important;
    }
}

/* ========================================
   Responsive utility classes
   ======================================== */

/* Page header flex layout */
.page-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 16px;
}
.page-header-actions {
    display: flex;
    gap: 8px;
    align-items: center;
}

/* Responsive text hiding */
@media (max-width: 599px) {
    .hide-xs { display: none !important; }
}
@media (max-width: 959px) {
    .hide-sm { display: none !important; }
}

/* Calendar responsive vars applied */
.cal-grid-scroll {
    overflow-y: auto;
    max-height: var(--cal-max-height);
}
.cal-time-col {
    width: var(--cal-time-col);
    min-width: var(--cal-time-col);
}
.cal-hour-row {
    height: var(--cal-hour-height);
}
.cal-day-hour-row {
    height: var(--cal-day-hour-height);
}
.cal-time-label {
    font-size: 0.7rem;
    color: #8E8E93;
    transform: translateY(-7px);
}
.cal-header-day {
    font-size: var(--cal-header-font);
    color: #8E8E93;
    text-transform: capitalize;
}
.cal-header-num {
    font-size: var(--cal-header-num-font);
    font-weight: 500;
    color: #1C1C1E;
}
.cal-header-num.today {
    font-weight: 700;
    color: #2A93D5;
}

/* Ensure tables can scroll horizontally on mobile */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* Message panel responsive */
.msg-panel {
    height: calc(100vh - 200px);
}
@media (max-width: 767px) {
    .msg-panel {
        height: calc(100vh - 160px);
    }
}
@media (min-width: 1400px) {
    .msg-panel {
        height: calc(100vh - 180px);
    }
}
