html, body {
    font-family: "Public Sans", "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
}

.mud-main-content {
    min-height: 100vh;
}

.mud-chip {
    font-size: var(--mud-typography-default-size);
}

    .mud-chip.mud-chip-size-small {
        font-size: var(--mud-typography-body1-size);
    }

.mud-tabs {
    background-color: var(--mud-palette-surface);
}

.mud-input-control > .mud-input-control-input-container > .mud-input-label-inputcontrol {
    font-size: var(--mud-typography-subtitle1-size);
}

.mud-input > input.mud-input-root, div.mud-input-slot.mud-input-root {
    font-size: var(--mud-typography-default-size) !important;
}

.mud-input > textarea.mud-input-root {
    font-size: var(--mud-typography-default-size) !important;
}

.mud-simple-table table * tr > td, .mud-simple-table table * tr th {
    font-size: var(--mud-typography-default-size) !important;
}

.mud-expand-panel .mud-expand-panel-header {
    font-size: var(--mud-typography-default-size) !important;
}

.mud-button-year {
    font-size: var(--mud-typography-default-size) !important;
}

.mud-table-cell {
    font-size: var(--mud-typography-default-size) !important;
}


.mud-typography-subtitle2 {
    font-size: var(--mud-typography-subtitle2-size);
    color: var(--mud-palette-text-secondary);
}

.mud-typography-body1 {
    font-size: var(--mud-typography-body1-size);
}

.mud-typography-body2 {
    font-size: var(--mud-typography-body2-size);
    /*color: var(--mud-palette-text-secondary);*/
}

.mud-button-outlined-size-small {
    font-size: var(--mud-typography-body2-size);
}

.mud-grid.readonly-grid > .mud-grid-item {
    border-bottom: 1px solid var(--mud-palette-table-lines);
    padding-bottom: 2px;
}

.mud-nav-link {
    white-space: normal !important;
}

.user-button {
    text-transform: none;
    background: rgba(var(--mud-palette-primary-rgb), 0.1)
}
.mud-list-item-icon{
    min-width:none !important;
}
.side-menu .mud-chip.mud-chip-size-small {
    font-size: 0.625rem;
    height: 1.125rem;
}
.appbar-special-menu 
    .mud-list-item

{
    border-radius: 6px;
    margin: 4px 0;
}
.appbar-special-menu
.mud-list-subheader {
    font-weight: 700;
    font-size: 1rem;
    color: #8898aa;
}
.appbar-special-menu
.mud-typography-body1 {
    font-weight: 600;
}
.appbar-special-menu
.mud-typography-body2 {
    font-weight: 600;
    color: #8898aa;
}
.appbar-special-menu
.mud-list-item-disabled
.mud-typography-body2 {
    font-weight: 600;
    color: rgba(136, 152, 170, 0.6);
}
.layout-menu-shadow {
    box-shadow: 0 30px 60px rgba(0,0,0,0.12) !important;
}

.mud-table.mud-data-grid.mud-xs-table.mud-table-dense.mud-table-hover.mud-elevation-1 .mud-toolbar {
    height: auto !important;
    padding: 1rem
}


.mud-table.mud-data-grid.mud-xs-table.mud-table-dense.mud-table-hover.mud-elevation-1 .mud-toolbar-gutters {
    height: auto !important;
    padding: 1rem
}

.mud-table.mud-data-grid.mud-xs-table.mud-table-dense.mud-table-hover.mud-elevation-1 .mud-table-toolbar {
    height: auto !important;
    padding: 1rem
}

.mud-table.mud-data-grid.mud-xs-table.mud-table-dense.mud-table-hover.mud-elevation-1 .mud-table-pagination-toolbar {
    height: auto !important;
    padding: 0rem !important;
}

.network-status-indicator {
    width: 43px;
    height: 43px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin: 0 auto; /* Center horizontally if needed */
    box-sizing: border-box;
}

.avatar-container {
    position: relative;
    width: 35px; /* Fixed container width, same as avatar */
    height: 35px; /* Fixed container height, same as avatar */
}

/* Red rotating border (common style) */
.rotating-border {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 43px;
    height: 43px;
    border: 3px solid transparent; /* Default transparent */
    border-radius: 50%;
    animation: spin 2s linear infinite; /* Rotating animation */
    z-index: 1;
    box-sizing: border-box;
}

    /* Red border in dark mode */
    .rotating-border.dark-mode {
        border-top: 3px solid rgba(255, 0, 0, 0.8); /* Dark red border */
        box-shadow: 0 0 8px rgba(255, 0, 0, 0.6), 0 0 12px rgba(255, 50, 50, 0.4); /* Enhanced shadow */
    }

    /* Red border in light mode */
    .rotating-border.light-mode {
        border-top: 3px solid rgba(255, 50, 50, 0.8); /* Light red border */
        box-shadow: 0 0 6px rgba(255, 50, 50, 0.5), 0 0 10px rgba(255, 100, 100, 0.3); /* Soft shadow */
    }

/* Dynamic green border (common style) */
.online-border {
    position: absolute;
    top: -4px;
    left: -4px;
    width: 43px;
    height: 43px;
    border-radius: 50%;
    animation: green-pulse 2s infinite; /* Breathing animation */
    z-index: 1;
    box-sizing: border-box;
}

    /* Green border in dark mode */
    .online-border.dark-mode {
        border: 3px solid rgba(0, 128, 0, 1); /* Dark green border */
        box-shadow: 0 0 8px rgba(0, 128, 0, 0.6), 0 0 12px rgba(0, 255, 0, 0.4);
    }

    /* Green border in light mode */
    .online-border.light-mode {
        border: 3px solid rgba(0, 200, 0, 1); /* Light green border */
        box-shadow: 0 0 6px rgba(0, 200, 0, 0.5), 0 0 10px rgba(0, 255, 0, 0.3);
    }
/* Breathing animation */
@keyframes green-pulse {
    0% {
        box-shadow: 0 0 8px rgba(0, 128, 0, 0.6), 0 0 12px rgba(0, 255, 0, 0.4);
        transform: scale(1);
    }

    50% {
        box-shadow: 0 0 10px rgba(0, 128, 0, 0.8), 0 0 14px rgba(0, 255, 0, 0.5);
        transform: scale(1.03); /* Reduce scaling amplitude */
    }

    100% {
        box-shadow: 0 0 8px rgba(0, 128, 0, 0.6), 0 0 12px rgba(0, 255, 0, 0.4);
        transform: scale(1);
    }
}

MudAvatar {
    position: relative;
    z-index: 2; /* Ensure avatar is above the border */
}

@keyframes spin {
    from {
        transform: rotate(0deg);
    }

    to {
        transform: rotate(360deg);
    }
}


/* ── Blazor error boundary ──────────────────────────────────────── */
.blazor-error-boundary {
    background: var(--mud-palette-error, #F44336);
    color: #fff;
    padding: .875rem 1.25rem .875rem 3.25rem;
    position: relative;
    border-radius: 8px;
    margin: 1rem;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', sans-serif;
    font-size: .875rem;
}

.blazor-error-boundary::before {
    content: '';
    position: absolute;
    left: 1rem;
    top: 50%;
    transform: translateY(-50%);
    width: 1.5rem;
    height: 1.5rem;
    background: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' viewBox='0 0 24 24' fill='white'%3E%3Cpath d='M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm1 15h-2v-2h2v2zm0-4h-2V7h2v6z'/%3E%3C/svg%3E") no-repeat center/contain;
}

.blazor-error-boundary::after {
    content: "An error has occurred. Please try reloading the page.";
}

/* ── Blazor unhandled error notification ────────────────────────── */
#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 10000;
    padding: 1rem 1.25rem;
    background: #1E1E1E;
    color: #fff;
    font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, sans-serif;
    font-size: .875rem;
    box-shadow: 0 -4px 24px rgba(0,0,0,.30);
    border-top: 3px solid #F44336;
    display: none;
    align-items: center;
    gap: 1rem;
}

@media (prefers-color-scheme: light) {
    #blazor-error-ui {
        background: #FFFFFF;
        color: #424242;
        box-shadow: 0 -4px 24px rgba(0,0,0,.12);
    }
}

#blazor-error-ui .err-icon {
    flex-shrink: 0;
    width: 24px; height: 24px;
    background: #F44336;
    border-radius: 50%;
    display: flex; align-items: center; justify-content: center;
}

#blazor-error-ui .err-text { flex: 1; line-height: 1.5; }

#blazor-error-ui a.reload {
    color: #0C63CE;
    font-weight: 600;
    text-decoration: none;
    white-space: nowrap;
    border: 1.5px solid #0C63CE;
    border-radius: 6px;
    padding: .35rem .875rem;
    transition: background .15s;
}

#blazor-error-ui a.reload:hover { background: rgba(12,99,206,.10); }

#blazor-error-ui a.dismiss {
    cursor: pointer;
    opacity: .6;
    font-size: 1.1rem;
    line-height: 1;
    padding: .25rem;
    flex-shrink: 0;
}

#blazor-error-ui a.dismiss:hover { opacity: 1; }

/* ===================================================================
   Hiệu ứng kiểu app mobile (spec UI) — áp toàn cục qua MudBlazor class.
   Tôn trọng prefers-reduced-motion: tắt hiệu ứng khi người dùng yêu cầu.
   =================================================================== */

/* Bỏ ô sáng xanh khi chạm trên di động + cuộn quán tính mượt */
* { -webkit-tap-highlight-color: transparent; }
.mud-drawer-content, .mud-main-content, .mud-dialog-content, .mud-table-container {
    -webkit-overflow-scrolling: touch;
}

@media (prefers-reduced-motion: no-preference) {

    /* Chuyển trang: mờ nhẹ khi đổi trang (tinh tế, không nảy) */
    .page-transition {
        animation: pageEnter .2s ease-out;
    }
    @keyframes pageEnter {
        from { opacity: 0; transform: translateY(4px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* Nút / thẻ / menu: chỉ đổi màu & bóng mượt khi rê — KHÔNG phóng to/nhún khi nhấn */
    .mud-button-root { transition: box-shadow .15s ease, background-color .15s ease; }
    .mud-icon-button { transition: background-color .15s ease; }
    .mud-paper, .mud-card { transition: box-shadow .18s ease; }
    .mud-nav-link { transition: background-color .15s ease; border-radius: 8px; }

    /* Dòng bảng: nền chuyển mượt khi rê */
    .mud-table-row { transition: background-color .15s ease; }

    /* Hộp thoại: hiện ra mờ nhẹ (không trồi mạnh) */
    .mud-dialog { animation: dialogPop .18s ease-out; }
    @keyframes dialogPop {
        from { opacity: 0; transform: translateY(6px); }
        to   { opacity: 1; transform: translateY(0); }
    }

    /* Danh sách: mục hiện dần khi cần (opt-in .stagger-item) */
    .stagger-item { animation: itemIn .22s ease-out both; }
    @keyframes itemIn {
        from { opacity: 0; transform: translateY(4px); }
        to   { opacity: 1; transform: translateY(0); }
    }
}

/* ===================================================================
   Thiết kế lại FORM / HỘP THOẠI — đồng bộ toàn hệ thống (MudDialog + MudForm)
   =================================================================== */

/* Khung hộp thoại: bo góc lớn, cắt gọn */
.mud-dialog { border-radius: 16px !important; overflow: hidden; }

/* Tiêu đề: đậm, có vạch nhấn thương hiệu bên trái + đường kẻ dưới */
.mud-dialog-title {
    font-size: 1.15rem; font-weight: 700;
    padding: 1rem 1.5rem 1rem 1.75rem;
    border-bottom: 1px solid var(--mud-palette-lines-default);
    position: relative;
}
.mud-dialog-title::before {
    content: ""; position: absolute; left: 0; top: .9rem; bottom: .9rem;
    width: 4px; border-radius: 0 4px 4px 0; background: var(--mud-palette-primary);
}

/* Nội dung: đệm thoáng, cuộn mượt khi dài */
.mud-dialog-content { padding: 1.25rem 1.5rem !important; -webkit-overflow-scrolling: touch; }

/* Khu nút: đường kẻ trên, canh phải, khoảng cách đều */
.mud-dialog-actions {
    border-top: 1px solid var(--mud-palette-lines-default);
    padding: .75rem 1.25rem; gap: .5rem;
}
.mud-dialog-actions .mud-button-root { border-radius: 10px; padding: .4rem 1.25rem; }

/* Ô nhập: bo góc mềm hơn cho cảm giác hiện đại */
.mud-input.mud-input-filled, .mud-input.mud-input-outlined { border-radius: 10px; }
.mud-input-outlined .mud-input-outlined-border { border-radius: 10px; }

/* Mobile: hộp thoại trồi từ đáy như bottom-sheet, nút full-width xếp dọc */
@media (max-width: 600px) {
    .mud-dialog-container { align-items: flex-end !important; }
    .mud-dialog {
        border-radius: 18px 18px 0 0 !important;
        width: 100% !important; max-width: 100% !important; margin: 0 !important;
    }
    .mud-dialog-actions { flex-direction: column-reverse; }
    .mud-dialog-actions .mud-button-root { width: 100%; }
}

/* ===== Hồ sơ bệnh nhân: thanh tab dọc bên trái ===== */
.ho-so-tabs .mud-tab {
    justify-content: flex-start;
    text-align: left;
    border-radius: 8px;
    margin: 2px 6px;
    min-height: 44px;
    text-transform: none;
}
.ho-so-tabs .mud-tab.mud-tab-active {
    background: rgba(12,99,206,.08);
    font-weight: 600;
}
.ho-so-tabs .mud-tabs-tabbar { border-right: 1px solid var(--mud-palette-lines-default); }

/* Mobile: thu gọn cột tab cho đỡ chiếm chỗ */
@media (max-width: 600px) {
    .ho-so-tabs .mud-tabs-tabbar { min-width: 120px; }
    .ho-so-tabs .mud-tab { font-size: .78rem; padding-left: .5rem; padding-right: .5rem; }
}

/* Khoảng cách giữa thanh tab dọc và vùng nội dung hồ sơ bệnh nhân */
.ho-so-tabs .mud-tabs-panels { margin-left: 16px; }
@media (max-width: 600px) {
    .ho-so-tabs .mud-tabs-panels { margin-left: 8px; }
}
