/* ===== Fonts ===== */
@import url('https://fonts.googleapis.com/css2?family=Outfit:wght@300;400;500;700;800;900&display=swap');
@import url('https://fonts.googleapis.com/css2?family=Inter:wght@200;300;400;500;600;700;800&display=swap');

/* ===== Dark mode flash prevention ===== */

html.dark-preload,
html.dark-preload body {
    background-color: #0F172A !important;
    color: #fff !important;
}

/* Pre-seed MudBlazor palette CSS variables for dark theme.
   This prevents the white flash on components during Blazor navigation/re-render. */
html.dark-preload {
    --mud-palette-black: #272c34;
    --mud-palette-white: #ffffff;
    --mud-palette-primary: #7986cb;
    --mud-palette-primary-text: #ffffff;
    --mud-palette-secondary: #f50057;
    --mud-palette-secondary-text: #ffffff;
    --mud-palette-background: #0F172A;
    --mud-palette-background-gray: #020617;
    --mud-palette-surface: #1E293B;
    --mud-palette-drawer-background: #0F172A;
    --mud-palette-drawer-text: rgba(255, 255, 255, 0.70);
    --mud-palette-drawer-icon: rgba(255, 255, 255, 0.70);
    --mud-palette-appbar-background: rgba(15, 23, 42, 0.85);
    --mud-palette-appbar-text: rgba(255, 255, 255, 0.70);
    --mud-palette-lines-default: rgba(255, 255, 255, 0.12);
    --mud-palette-lines-inputs: rgba(255, 255, 255, 0.30);
    --mud-palette-table-lines: rgba(255, 255, 255, 0.12);
    --mud-palette-table-striped: rgba(255, 255, 255, 0.02);
    --mud-palette-table-hover: rgba(255, 255, 255, 0.04);
    --mud-palette-divider: rgba(255, 255, 255, 0.12);
    --mud-palette-divider-light: rgba(255, 255, 255, 0.06);
    --mud-palette-text-primary: rgba(255, 255, 255, 0.70);
    --mud-palette-text-secondary: rgba(255, 255, 255, 0.50);
    --mud-palette-text-disabled: rgba(255, 255, 255, 0.20);
    --mud-palette-action-default: rgba(255, 255, 255, 0.54);
    --mud-palette-action-disabled: rgba(255, 255, 255, 0.26);
    --mud-palette-action-disabled-background: rgba(255, 255, 255, 0.12);
    --mud-palette-skeleton: rgba(255, 255, 255, 0.11);
    --mud-palette-dark: #1E293B;
    --mud-palette-dark-text: rgba(255, 255, 255, 0.70);
    --mud-palette-success: #00e676;
    --mud-elevation-1: 0px 2px 1px -1px rgba(0, 0, 0, 0.3), 0px 1px 1px 0px rgba(0, 0, 0, 0.24), 0px 1px 3px 0px rgba(0, 0, 0, 0.22);
    --mud-elevation-2: 0px 3px 1px -2px rgba(0, 0, 0, 0.3), 0px 2px 2px 0px rgba(0, 0, 0, 0.24), 0px 1px 5px 0px rgba(0, 0, 0, 0.22);
    --mud-elevation-4: 0px 2px 4px -1px rgba(0, 0, 0, 0.3), 0px 4px 5px 0px rgba(0, 0, 0, 0.24), 0px 1px 10px 0px rgba(0, 0, 0, 0.22);
}

/* Light theme preload */
html.light-preload,
html.light-preload body {
    background-color: #F2F2F7 !important;
}

html.light-preload {
    --mud-palette-background: #F2F2F7;
    --mud-palette-background-gray: #F8FAFC;
    --mud-palette-surface: #FFFFFF;
    --mud-palette-drawer-background: #FFFFFF;
    --mud-palette-appbar-background: rgba(255, 255, 255, 0.85);
    --mud-palette-appbar-text: rgba(0, 0, 0, 0.70);
    --mud-palette-text-primary: rgba(0, 0, 0, 0.87);
    --mud-palette-text-secondary: rgba(0, 0, 0, 0.54);
}

html,
body {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif;
}

/* Force Apple/Inter font stack globally except for icon fonts and code/monospace elements */
*:not(.material-symbols-rounded):not(.mud-icon-root):not(.material-icons):not([class*="fa-"]):not([class*="icon-"]):not(code):not(pre):not(kbd):not(samp):not([class*="mono"]):not([class*="code"]) {
    font-family: -apple-system, BlinkMacSystemFont, "SF Pro Text", "SF Pro Display", "Inter", "Segoe UI", Roboto, Helvetica, Arial, sans-serif !important;
}

body {
    padding-top: 0;
    /* Removed for translucent statusbar - content starts at Y=0 */
}

/* Disable user selection globally for a native app feel */
* {
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    user-select: none;
    
    /* Tắt highlight khi tap trên mobile */
    -webkit-tap-highlight-color: transparent;
    
    /* Tắt callout menu khi long-press (iOS) */
    -webkit-touch-callout: none;
}

/* Nhưng vẫn cho phép select ở input/textarea */
input, textarea, [contenteditable] {
    -webkit-user-select: text;
    -moz-user-select: text;
    -ms-user-select: text;
    user-select: text;
}


.app-content-wrapper {
    padding-top: env(safe-area-inset-top, 0px) !important;
}

.mesh-gradient-bg {
    background-color: #F2F2F7;
}

/* On mobile, there is no top AppBar – only a bottom tab bar.
   MudMainContent automatically adds padding-top equal to the AppBar height (~64px)
   during pre-render before viewport detection completes, creating a blank gap.
   We override it to safe-area-inset-top only, so that:
   1. The MudBlazor AppBar gap (~64px) is removed.
   2. Content still starts below the device safe area (status bar / notch).
   3. Sticky floating island headers (.ios-header) whose top includes
      env(safe-area-inset-top) will not overlap content on first load. */
@media (max-width: 959.98px) {
    .mud-main-content {
        padding-top: env(safe-area-inset-top, 0px) !important;
        padding-bottom: 160px !important;
        padding-bottom: calc(160px + env(safe-area-inset-bottom, 0px)) !important;
    }
}

/* Dark mode variant for main content background */
html.dark-preload .mesh-gradient-bg {
    background-color: #0F172A;
}

.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+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5IDUzLjYyODMgMjkwLjE4NSA5Mi4xODMxIDI5MC41NDUgOTIuNzk1IDI5MC42NTYgOTIuOTk2QzI5MC44NzcgOTMuNTEzIDI5MSA5NC4wODE1IDI5MSA5NC42NzgyIDI5MSA5Ny4wNjUxIDI4OS4wMzggOTkgMjg2LjYxNyA5OUwyNDAuMzgzIDk5QzIzNy45NjMgOTkgMjM2IDk3LjA2NTEgMjM2IDk0LjY3ODIgMjM2IDk0LjM3OTkgMjM2LjAzMSA5NC4wODg2IDIzNi4wODkgOTMuODA3MkwyMzYuMzM4IDkzLjAxNjIgMjM2Ljg1OCA5Mi4xMzE0IDI1OS40NzMgNTMuNjI5NCAyNTkuOTYxIDUyLjc5ODUgMjYwLjQwNyA1Mi4yNjU4QzI2MS4yIDUxLjQ4MzcgMjYyLjI5NiA1MSAyNjMuNTA2IDUxWk0yNjMuNTg2IDY2LjAxODNDMjYwLjczNyA2Ni4wMTgzIDI1OS4zMTMgNjcuMTI0NSAyNTkuMzEzIDY5LjMzNyAyNTkuMzEzIDY5LjYxMDIgMjU5LjMzMiA2OS44NjA4IDI1OS4zNzEgNzAuMDg4N0wyNjEuNzk1IDg0LjAxNjEgMjY1LjM4IDg0LjAxNjEgMjY3LjgyMSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3LjgyNSA2OS43NDc1QzI2Ny44NiA2OS43MzA5IDI2Ny44NzkgNjkuNTg3NyAyNjcuODc5IDY5LjMxNzkgMjY3Ljg3OSA2Ny4xMTgyIDI2Ni40NDggNjYuMDE4MyAyNjMuNTg2IDY2LjAxODNaTTI2My41NzYgODYuMDU0N0MyNjEuMDQ5IDg2LjA1NDcgMjU5Ljc4NiA4Ny4zMDA1IDI1OS43ODYgODkuNzkyMSAyNTkuNzg2IDkyLjI4MzcgMjYxLjA0OSA5My41Mjk1IDI2My41NzYgOTMuNTI5NSAyNjYuMTE2IDkzLjUyOTUgMjY3LjM4NyA5Mi4yODM3IDI2Ny4zODcgODkuNzkyMSAyNjcuMzg3IDg3LjMwMDUgMjY2LjExNiA4Ni4wNTQ3IDI2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "An error has occurred."
}

.ios-tab-bar {
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(128, 128, 128, 0.15);
    background: rgba(255, 255, 255, 0.88) !important;

    /* Ensure it sticks to the bottom */
    position: fixed !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    
    /* Support mobile safe areas / notch devices dynamically */
    padding-bottom: 0 !important;
    height: 76px !important;
    height: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    
    z-index: 1000 !important;
    display: flex !important;

    /* Rounded top corners for premium iOS/Android visual feel */
    border-radius: 28px 28px 0 0 !important;
    overflow: visible !important; /* Allow the center button to pop out without clipping */
    box-shadow: 0 -8px 32px rgba(0, 0, 0, 0.06) !important;
}

/* Dark mode override for appbar background */
html.dark-preload .ios-tab-bar {
    background: rgba(30, 41, 59, 0.88) !important;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Constrain the inner toolbar so items are perfectly centered above safe-area-inset-bottom */
.ios-tab-bar>.mud-toolbar {
    height: 76px !important;
    height: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    min-height: 76px !important;
    min-height: calc(76px + env(safe-area-inset-bottom, 0px)) !important;
    align-items: center !important;
    justify-content: space-around !important;
    padding-bottom: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 0px) !important;
    width: 100%;
    overflow: visible !important;
}

.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    height: 100%;
    color: #8E8E93; /* Premium iOS secondary gray */
    text-decoration: none;
    cursor: pointer;
    transition: transform 0.1s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.bottom-nav-item:active {
    transform: scale(0.92);
}

/* Capsule background wraps BOTH the icon and label to match the selected layout */
.bottom-nav-item .nav-item-wrapper {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 2px 0;
    gap: 6px; /* Tăng khoảng cách icon và text hơn */
    min-width: 82px;
    transition: all 0.22s cubic-bezier(0.4, 0, 0.2, 1);
    box-sizing: border-box;
}

.bottom-nav-item .nav-icon-wrapper {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 56px;
    height: 32px;
    border-radius: 16px; /* bo tròn dạng viên nhộng ong */
    transition: background-color 0.2s ease, box-shadow 0.2s ease;
    box-sizing: border-box;
}

.bottom-nav-item.active .nav-icon-wrapper {
    background-color: rgba(46, 204, 113, 0.25) !important; /* màu xanh giảm lại 10% */
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.1);
}

html.dark-preload .bottom-nav-item.active .nav-icon-wrapper {
    background-color: rgba(46, 204, 113, 0.35) !important;
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.15);
}

.bottom-nav-item .nav-item-label {
    font-size: 0.68rem; /* 11px */
    font-weight: 400;
    line-height: 1.2;
    margin-top: 0px;
    color: #8E8E93;
    transition: color 0.15s ease-out;
    white-space: nowrap;
}

.bottom-nav-item.active .nav-item-label {
    color: #2ECC71 !important; /* Text được chọn cũng tô xanh */
}

html.dark-preload .bottom-nav-item.active .nav-item-label {
    color: #2ECC71 !important;
}

.bottom-nav-item.active .material-symbols-rounded {
    font-variation-settings: 'FILL' 1, 'wght' 400 !important;
    color: #2ECC71 !important; /* Icon được chọn cũng tô xanh */
}

.bottom-nav-item .material-symbols-rounded {
    font-size: 1.5rem; /* ~24px standard icon size */
    font-variation-settings: 'wght' 300;
    color: #8E8E93;
    transition: color 0.15s ease, font-variation-settings 0.15s ease;
}

.bottom-nav-item:hover .material-symbols-rounded,
.bottom-nav-item:hover .nav-item-label {
    color: #2ECC71;
}

.bottom-nav-item.active:hover .material-symbols-rounded,
.bottom-nav-item.active:hover .nav-item-label {
    color: #2ECC71 !important;
}

/* Central Action Button (Floating Plus Action) */
.center-action-item {
    position: relative;
    overflow: visible !important;
    display: flex;
    justify-content: center;
    align-items: center;
}

.center-icon-wrapper {
    width: 56px;
    height: 56px;
    background: #2ECC71 !important; /* Custom green brand theme */
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-top: -32px; /* Float and pop out beautifully */
    box-shadow: 0 4px 16px rgba(46, 204, 113, 0.4);
    border: 4px solid var(--mud-palette-surface);
    transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
    z-index: 10;
}

.center-action-item .center-icon-wrapper .material-symbols-rounded {
    color: white !important;
    font-size: 2.2rem !important; /* Balanced plus icon size */
    font-variation-settings: 'wght' 400;
}

.center-action-item:active .center-icon-wrapper {
    transform: scale(0.9);
    box-shadow: 0 2px 8px rgba(46, 204, 113, 0.2);
}

.center-action-item.active .center-icon-wrapper {
    background: #27AE60 !important; /* Slightly darker green when active */
    box-shadow: 0 6px 20px rgba(46, 204, 113, 0.55);
}

.mobile-bottom-drawer {
    border-radius: 20px 20px 0 0 !important;
}

/* Custom Confirm Dialog */
.custom-confirm-dialog {
    border-radius: 28px !important;
    padding: 12px !important;
    overflow: hidden;
}

.custom-confirm-dialog .mud-dialog-content {
    padding: 16px 20px 24px 20px !important;
}

.confirm-dialog-title {
    font-weight: 800 !important;
    color: #333;
}

.confirm-dialog-title {
    font-weight: 800 !important;
    color: #333;
}

.confirm-dialog-content {
    color: #666;
    line-height: 1.5;
    font-size: 0.95rem;
}

.confirm-btn-red {
    background-color: #FF4B3A !important;
    color: white !important;
    border-radius: 24px !important;
    padding: 10px 28px !important;
    font-weight: 700 !important;
    box-shadow: 0 4px 12px rgba(255, 75, 58, 0.3) !important;
    text-transform: none !important;
    font-size: 0.9rem !important;
}

.confirm-btn-red:hover {
    background-color: #E63E2F !important;
}

.cancel-btn-text {
    color: #333 !important;
    font-weight: 700 !important;
    text-transform: none !important;
    font-size: 0.9rem !important;
}

.custom-confirm-dialog .mud-dialog-actions {
    padding: 0 20px 20px 20px !important;
    justify-content: flex-end !important;
}

/* Global Dialog Backdrop Blur */
.mud-dialog-container {
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
}

/* Rounded components for Weather page */
.rounded-pill-field .mud-input-outlined-border {
    border-radius: 50px !important;
}

.custom-date-range .mud-input-root {
    margin-top: 0 !important;
}

.custom-date-range .mud-input>input {
    text-align: center;
    font-weight: 500;
}

/* Weather Page Specific Styles */


.weather-header-compact {
    margin-bottom: 12px !important;
}

.weather-card {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.5) !important;
    border-radius: 24px !important;
    padding: 16px !important;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.03) !important;
    cursor: pointer;
    
    position: relative;
    
    /* Support long-press gesture by disabling selection and native menus */
    user-select: none;
    -webkit-user-select: none;
    -moz-user-select: none;
    -ms-user-select: none;
    -webkit-touch-callout: none;
}

html.dark-preload .weather-card {
    background: rgba(30, 41, 59, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.08) !important;
    box-shadow: 0 4px 20px rgba(0, 0, 0, 0.2) !important;
}

.weather-card:active {
    transform: scale(0.995);
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.02) !important;
}

.temp-badge {
    margin-top: 28px !important;
    border-radius: 12px !important;
    font-weight: 800 !important;
    padding: 4px 12px !important;
    min-width: 72px;
    display: flex;
    justify-content: center;
    color: white !important;
    border: none !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.1) !important;
}

.temp-cold { background: linear-gradient(135deg, #60A5FA 0%, #A5F3FC 100%) !important; }
.temp-cool { background: linear-gradient(135deg, #34D399 0%, #A7F3D0 100%) !important; }
.temp-warm { background: linear-gradient(135deg, #FBBF24 0%, #FDE68A 100%) !important; }
.temp-hot  { background: linear-gradient(135deg, #FB7185 0%, #FDA4AF 100%) !important; }

.weather-page-container {
    animation: fadeIn 0.6s ease-out;
}

.search-filter-group {
    background: rgba(255, 255, 255, 0.5);
    border-radius: 28px;
    border: 1px solid rgba(255, 255, 255, 0.8);
    padding: 8px;
    box-shadow: 0 8px 32px rgba(0, 0, 0, 0.04);
}

@media (max-width: 600px) {
    .search-filter-group {
        border-radius: 20px;
    }
}

html.dark-preload .search-filter-group {
    background: rgba(30, 41, 59, 0.4);
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.action-btn-circle {
    background: rgba(255, 255, 255, 0.8) !important;
    backdrop-filter: blur(8px);
    border-radius: 12px !important;
    width: 36px;
    height: 36px;
}

html.dark-preload .action-btn-circle {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* Modern Glassmorphism Menu */
.modern-menu-popover {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(24px) !important;
    -webkit-backdrop-filter: blur(24px) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    border-radius: 20px !important;
    box-shadow: 0 10px 40px rgba(0, 0, 0, 0.08) !important;
    margin-top: 8px !important;
    overflow: hidden !important;
}

.modern-menu-popover .mud-list-item {
    min-height: 56px !important; /* Significantly taller than default */
    padding-top: 12px !important;
    padding-bottom: 12px !important;
}

.modern-menu-popover .mud-list-item:not(:last-child) {
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

html.dark-preload .modern-menu-popover {
    background: rgba(30, 41, 59, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.action-menu-btn .mud-icon-button {
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(8px);
    border-radius: 50% !important;
    width: 32px;
    height: 32px;
    padding: 0 !important;
}

html.dark-preload .action-menu-btn .mud-icon-button {
    background: rgba(255, 255, 255, 0.05) !important;
}

/* ===== Blazor Error UI ===== */
#blazor-error-ui {
    display: none;
    background: #fff9c4;
    bottom: 0;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.15);
    color: #333;
    left: 0;
    padding: 0.8rem 1.5rem;
    position: fixed;
    width: 100%;
    z-index: 2000;
    font-weight: 500;
    border-top: 2px solid #fbc02d;
    align-items: center;
    justify-content: center;
    gap: 12px;
}

#blazor-error-ui .reload {
    margin-left: 10px;
    background: #fbc02d;
    color: #000;
    padding: 4px 12px;
    border-radius: 16px;
    text-decoration: none;
    font-size: 0.85rem;
    font-weight: 600;
    transition: background 0.2s;
}

#blazor-error-ui .reload:hover {
    background: #f9a825;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    position: absolute;
    right: 1.25rem;
    top: 50%;
    transform: translateY(-50%);
    font-size: 1.2rem;
    opacity: 0.6;
}

#blazor-error-ui .dismiss:hover {
    opacity: 1;
}

/* Dark mode error UI compatibility */
html.dark-preload #blazor-error-ui {
    background: #332b00;
    color: #fff9c4;
    border-top-color: #fbc02d;
    box-shadow: 0 -4px 12px rgba(0, 0, 0, 0.4);
}

/* ===== Global Authentication & Glassmorphism UI ===== */

.auth-container {
    background-color: #F2F2F7 !important;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    /* Use dvh to ensure it accounts for mobile toolbars and status bar */
    height: 100dvh;
    width: 100%;
    z-index: 1000;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 16px;
    padding-top: calc(16px + env(safe-area-inset-top));
    padding-bottom: calc(16px + env(safe-area-inset-bottom));
    padding-left: calc(16px + env(safe-area-inset-left));
    padding-right: calc(16px + env(safe-area-inset-right));
    overflow-y: auto;
    -webkit-overflow-scrolling: touch;

    /* Force Light Theme variables inside auth-container */
    --mud-palette-primary: #594ae2 !important;
    --mud-palette-primary-text: #ffffff !important;
    --mud-palette-secondary: #ff4081 !important;
    --mud-palette-text-primary: #1a202c !important;
    --mud-palette-text-secondary: rgba(0, 0, 0, 0.54) !important;
    --mud-palette-surface: #FFFFFF !important;
    --mud-palette-background: #F2F2F7 !important;
    --mud-palette-lines-default: rgba(0, 0, 0, 0.12) !important;
    --mud-palette-lines-inputs: rgba(0, 0, 0, 0.3) !important;
    --mud-palette-action-default: rgba(0, 0, 0, 0.54) !important;
    --mud-palette-action-disabled: rgba(0, 0, 0, 0.26) !important;
    --mud-palette-divider: rgba(0, 0, 0, 0.12) !important;
    color: #1a202c !important;
}

.auth-card {
    background: rgba(242, 242, 247, 0.4) !important;
    backdrop-filter: blur(20px);
    border: 1px solid rgba(255, 255, 255, 0.6);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.12), 0 0 40px rgba(102, 126, 234, 0.25) !important;
    width: 100%;
    max-width: 440px;
    margin: 0 auto;
    transform: translateY(0);
    transition: transform 0.3s ease, box-shadow 0.3s ease;
}

/* Force Light Theme for auth-card inside auth-container */
.auth-container .auth-card {
    background: rgba(242, 242, 247, 0.4) !important;
    border: 1px solid rgba(255, 255, 255, 0.6) !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.12), 0 0 40px rgba(102, 126, 234, 0.25) !important;
}

html.dark-preload .auth-card {
    background: rgba(30, 41, 59, 0.45) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3) !important;
}


@keyframes fadeInScale {
    from {
        opacity: 0;
        transform: scale(0.95) translateY(20px);
    }
    to {
        opacity: 1;
        transform: scale(1) translateY(0);
    }
}

.header-icon-container {
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(12px);
    width: 72px;
    height: 72px;
    border-radius: 22px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    margin: 0 auto;
    box-shadow: 0 10px 25px rgba(102, 126, 234, 0.1), 0 4px 10px rgba(0, 0, 0, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.9);
    position: relative;
    transition: transform 0.3s ease;
}

.auth-container .header-icon-container {
    background: rgba(255, 255, 255, 0.7) !important;
    border: 1px solid rgba(255, 255, 255, 0.9) !important;
}

.header-icon-container:hover {
    transform: translateY(-4px) scale(1.05);
}

html.dark-preload .header-icon-container {
    background: rgba(30, 41, 59, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1);
}

.color-text-primary {
    color: #1a202c;
}

.auth-container .color-text-primary {
    color: #1a202c !important;
}

.color-text-secondary {
    color: #718096;
}

.auth-container .color-text-secondary {
    color: #718096 !important;
}

.text-gradient {
    background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    display: inline-block;
}

.logo-text {
    font-family: 'Outfit', sans-serif;
    font-size: 2.25rem;
    font-weight: 900;
    letter-spacing: -0.05em;
    display: flex;
    align-items: center;
    justify-content: center;
    gap: 1px;
}

.logo-text span.order {
    background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%);
    -webkit-background-clip: text;
    -webkit-text-fill-color: transparent;
    position: relative;
}

.logo-text span.chain {
    color: #1e293b;
    font-weight: 700;
    position: relative;
    transition: color 0.3s ease;
}

html.dark-preload .logo-text span.chain {
    color: rgba(255, 255, 255, 0.95);
}

.auth-container .logo-text span.chain {
    color: #1e293b !important;
}

.logo-text span.dot {
    width: 6px;
    height: 6px;
    background: #2ECC71;
    border-radius: 50%;
    margin-left: 2px;
    margin-top: 12px;
    box-shadow: 0 0 10px rgba(46, 204, 113, 0.4);
    transition: background 0.3s ease;
}

html.dark-preload .logo-text span.dot {
    background: #a78bfa;
}

.auth-container .logo-text span.dot {
    background: #7c3aed !important;
}

/* Shimmer Effect */
.shimmer {
    background: linear-gradient(
        90deg, 
        rgba(255,255,255,0) 0%, 
        rgba(255,255,255,0.4) 50%, 
        rgba(255,255,255,0) 100%
    );
    background-size: 200% 100%;
    background-clip: text;
    -webkit-background-clip: text;
    animation: shimmer 3s infinite linear;
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    pointer-events: none;
}

@keyframes shimmer {
    0% { background-position: -200% 0; }
    100% { background-position: 200% 0; }
}

html.dark-preload .color-text-primary {
    color: rgba(255, 255, 255, 0.95) !important;
}

html.dark-preload .color-text-secondary {
    color: rgba(255, 255, 255, 0.6) !important;
}


.gradient-button {
    background: linear-gradient(135deg, #2ECC71 0%, #27AE60 100%) !important;
    height: 56px !important;
    color: white !important;
    font-weight: 600 !important;
    letter-spacing: 0.5px;
    box-shadow: 0 4px 14px 0 rgba(46, 204, 113, 0.39) !important;
    transition: all 0.3s ease !important;
    border-radius: 50px !important;
}

.gradient-button:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 20px rgba(102, 126, 234, 0.45) !important;
    filter: brightness(1.1);
}

.google-button {
    border: 1.5px solid #d1d5db !important;
    transition: all 0.2s ease !important;
    background-color: white !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.05) !important;
    border-radius: 50px !important;
}

.google-button:hover {
    background-color: #f9fafb !important;
    border-color: #9ca3af !important;
    box-shadow: 0 2px 4px rgba(0, 0, 0, 0.1) !important;
    transform: translateY(-1px);
}

/* Fix for browser autofill - light mode */
.mud-input-root:-webkit-autofill,
.mud-input-root:-webkit-autofill:hover, 
.mud-input-root:-webkit-autofill:focus, 
.mud-input-root:-webkit-autofill:active {
    -webkit-box-shadow: 0 0 0 100px #ffffff inset !important;
    -webkit-text-fill-color: #2d3748 !important;
    transition: background-color 5000s ease-in-out 0s;
}

/* Ensure label stays up when autofilled */
.mud-input-filled-shrink ~ label.mud-input-label-outlined, 
.mud-input:focus-within ~ label.mud-input-label-outlined,
.mud-input-input-control:focus-within ~ label.mud-input-label-outlined {
    transform: translate(14px, -6px) scale(0.75) !important;
}

.header-section {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 8px;
    text-align: center;
    margin-bottom: 24px;
}

.header-subtitle {
    font-size: 1rem;
    max-width: 280px;
    margin: 0 auto;
    line-height: 1.5;
}

/* Rounded corners and Glassmorphism for MudTextField globally */
.mud-input-outlined-border {
    border-radius: 16px !important;
}

.mud-input-control {
    border-radius: 16px !important;
    transition: all 0.3s ease;
}

.mud-input {
    background: rgba(255, 255, 255, 0.5) !important;
    border-radius: 16px !important;
    overflow: hidden !important; /* Clips background and autofill boxes */
}

html.dark-preload .mud-input {
    background: rgba(30, 41, 59, 0.5) !important; /* Dark glass */
}

/* Robust Custom Input Group for Mobile/iOS */
.custom-input-group .mud-input {
    background: white !important;
    border-radius: 12px !important;
    border: 1px solid rgba(0, 0, 0, 0.12) !important;
    transition: all 0.2s ease !important;
    transform: translateZ(0); /* Hardware acceleration fix for iOS resume */
    padding: 0 16px !important;
    overflow: visible !important; /* Prevent clipping */
    height: 56px !important; /* Premium height */
    min-height: 56px !important;
    display: flex !important;
    align-items: center !important;
}

/* Hide the unstable/duplicate MudBlazor outlined border when using custom-input-group */
.custom-input-group .mud-input-outlined-border {
    border: none !important;
}

/* Ensure inner input takes full height and is centered */
.custom-input-group .mud-input-slot {
    height: 100% !important;
    padding: 0 !important;
}

.custom-input-group .mud-input:focus-within {
    border-color: var(--mud-palette-primary) !important;
    box-shadow: 0 0 0 1px var(--mud-palette-primary) !important;
}

/* Dark mode support for custom input group */
html.dark-preload .custom-input-group .mud-input {
    background: #0F172A !important;
    border-color: rgba(255, 255, 255, 0.15) !important;
}

html.dark-preload .custom-input-group .mud-input:focus-within {
    border-color: var(--mud-palette-primary) !important;
    box-shadow: 0 0 0 1px var(--mud-palette-primary) !important;
}


.mud-input-control:focus-within .mud-input {
    background: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1) !important;
}

.auth-container .mud-input {
    background: #ffffff !important;
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.02) inset !important;
    transform: translateZ(0); /* Fix for iOS rendering bugs */
    border: 1px solid rgba(102, 126, 234, 0.2) !important; /* Robust border */
    height: 56px !important;
    min-height: 56px !important;
    display: flex !important;
    align-items: center !important;
    padding: 0 16px !important;
}

.auth-container .mud-input-outlined-border {
    border: none !important;
}

.auth-container .mud-input-control:focus-within .mud-input {
    background: #ffffff !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.08) !important;
}

.auth-container .mud-input-control:focus-within .mud-input-outlined-border {
    border-color: #667eea !important;
    border-width: 1.5px !important;
}

.auth-container .mud-input-slot {
    color: #1a202c !important;
    font-weight: 500 !important;
}

.auth-container .mud-input-slot::placeholder {
    color: rgba(0, 0, 0, 0.4) !important;
    font-weight: 400 !important;
}

.auth-container .mud-input-adornment-start .mud-icon-root,
.auth-container .mud-input-adornment-end .mud-icon-root {
    color: #718096 !important;
    font-size: 1.25rem !important;
}

html.dark-preload .mud-input-control:focus-within .mud-input {
    background: rgba(30, 41, 59, 0.8) !important;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.3) !important;
}

.auth-container .mud-input-control:focus-within .mud-input {
    background: rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 4px 12px rgba(102, 126, 234, 0.1) !important;
}

/* Custom Start Icon for Password Fields */
.password-field .mud-input-slot {
    padding-left: 44px !important;
}

.password-field .mud-input::before {
    /* Lock icon matching the image */
    content: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' height='22' viewBox='0 -960 960 960' width='22' fill='%235f6368'%3E%3Cpath d='M240-80q-33 0-56.5-23.5T160-160v-400q0-33 23.5-56.5T240-640h40v-80q0-83 58.5-141.5T480-920q83 0 141.5 58.5T680-720v80h40q33 0 56.5 23.5T800-560v400q0 33-23.5 56.5T720-80H240Zm0-80h480v-400H240v400Zm240-120q33 0 56.5-23.5T560-360q0-33-23.5-56.5T480-440q-33 0-56.5 23.5T400-360q0 33 23.5 56.5T480-280ZM360-640h240v-80q0-50-35-85t-85-35q-50 0-85 35t-35 85v80ZM240-160v-400 400Z'/%3E%3C/svg%3E");
    position: absolute;
    left: 14px;
    top: 50%;
    transform: translateY(-50%);
    z-index: 10;
    opacity: 0.7;
    pointer-events: none;
}

.custom-label {
    font-weight: 700 !important;
    color: #1a202c !important;
    display: flex;
    align-items: center;
    font-size: 0.95rem !important;
}

html.dark-preload .custom-label {
    color: rgba(255, 255, 255, 0.87) !important;
}

.auth-container .custom-label {
    color: #1a202c !important;
}

.required-star {
    color: #ef4444;
    margin-right: 4px;
    font-size: 1.1rem;
    font-weight: bold;
}

.custom-input-group .mud-input-control {
    margin-top: 0 !important;
}

/* ===== Dashboard & Action Grid UI ===== */

.dashboard-container {
    animation: fadeIn 0.6s ease-out;
    padding-bottom: 24px;
}

.welcome-section {
    margin-bottom: 24px;
}

.dashboard-grid {
    display: grid;
    grid-template-columns: repeat(auto-fill, minmax(160px, 1fr));
    gap: 16px;
}

@media (max-width: 600px) {
    .dashboard-grid {
        grid-template-columns: repeat(2, 1fr);
    }
}

.dashboard-card {
    background: rgba(255, 255, 255, 0.5) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 20px !important;
    transition: all 0.3s ease !important;
    cursor: pointer;
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 20px 16px !important;
    height: 100%;
}

html.dark-preload .dashboard-card {
    background: rgba(30, 41, 59, 0.5) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.dashboard-card:hover {
    transform: translateY(-4px);
    background: rgba(255, 255, 255, 0.7) !important;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.05) !important;
}

html.dark-preload .dashboard-card:hover {
    background: rgba(30, 41, 59, 0.7) !important;
    box-shadow: 0 12px 24px rgba(0, 0, 0, 0.3) !important;
}

.icon-wrapper-large {
    width: 56px;
    height: 56px;
    border-radius: 16px;
    display: flex;
    justify-content: center;
    align-items: center;
    margin-bottom: 12px;
    box-shadow: 0 4px 12px rgba(0,0,0,0.1);
}

.icon-wrapper-large .material-symbols-rounded {
    font-size: 28px;
    color: white;
}

/* Reusable Gradients */
.grad-orange { background: linear-gradient(135deg, #FF6B6B, #FF8E53); }
.grad-blue { background: linear-gradient(135deg, #4facfe, #00f2fe); }
.grad-green { background: linear-gradient(135deg, #43e97b, #38f9d7); }
.grad-pink { background: linear-gradient(135deg, #fa709a, #fee140); }
.grad-purple { background: linear-gradient(135deg, #a18cd1, #fbc2eb); }
.grad-indigo { background: linear-gradient(135deg, #667eea, #764ba2); }

@keyframes fadeIn {
    from { opacity: 0; transform: translateY(10px); }
    to { opacity: 1; transform: translateY(0); }
}

/* New Mobile Header & Stats */
.header-avatar-gradient {
    width: 54px;
    height: 54px;
    border-radius: 50%;
    background: linear-gradient(135deg, #00d2ff 0%, #3a7bd5 100%);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 3px solid white;
    box-shadow: 0 10px 20px rgba(58, 123, 213, 0.25), 0 4px 10px rgba(0, 0, 0, 0.1);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    cursor: pointer;
    overflow: hidden;
    position: relative;
}

.header-avatar-gradient:hover {
    transform: translateY(-2px) scale(1.05);
    box-shadow: 0 15px 30px rgba(58, 123, 213, 0.35), 0 8px 15px rgba(0, 0, 0, 0.15);
}

html.dark-preload .header-avatar-gradient {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
}

.header-avatar-gradient .material-symbols-rounded {
    color: white;
    font-size: 32px;
}

.stats-scroll-container {
    display: flex;
    gap: 16px;
    overflow-x: auto;
    padding-bottom: 8px;
    -ms-overflow-style: none;
    scrollbar-width: none;
    scrollbar-width: none;
}

.stats-scroll-container::-webkit-scrollbar {
    display: none;
}

.stat-card {
    min-width: 110px;
    flex: 1;
    background: rgba(255, 255, 255, 0.7) !important;
    backdrop-filter: blur(10px);
    border: 1px solid rgba(255, 255, 255, 0.4) !important;
    border-radius: 24px !important;
    padding: 20px 16px !important;
    display: flex;
    flex-direction: column;
    align-items: center;
    box-shadow: 0 4px 15px rgba(0,0,0,0.05) !important;
}

html.dark-preload .stat-card {
    background: rgba(30, 41, 59, 0.6) !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
}

.stat-label {
    font-weight: 700 !important;
    color: #888 !important;
    font-size: 0.75rem !important;
    margin-bottom: 4px;
}

.stat-value {
    font-weight: 800 !important;
    font-size: 1.6rem !important;
    line-height: 1.2 !important;
    transform: translateZ(0); /* Fix Safari rendering artifacts with backdrop-filter */
    -webkit-font-smoothing: antialiased;
    white-space: nowrap;
}

.stat-unit {
    color: #999 !important;
    font-size: 0.75rem !important;
}

.color-green { color: #00c853 !important; }
.color-blue { color: #2196f3 !important; }
.color-pink { color: #e91e63 !important; }

/* Reusable Modern Dialog Style */
.modern-dialog {
    border-radius: 28px !important;
    overflow: hidden;
    border: 1px solid rgba(255, 255, 255, 0.8) !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.1), 0 0 40px rgba(102, 126, 234, 0.15) !important;
}

html.dark-preload .modern-dialog {
    background-color: #1E293B !important;
    border: 1px solid rgba(255, 255, 255, 0.1) !important;
    box-shadow: 0 25px 50px rgba(0, 0, 0, 0.3) !important;
}

/* ===== Profile Image Upload Styles ===== */
.profile-dialog-content {
    /* Removed forced dark background */
    padding-top: 12px !important;
    padding-bottom: 24px !important;
}

.avatar-upload-container {
    position: relative;
    display: inline-block;
    padding: 2px;
    border-radius: 50%;
    margin-bottom: 12px;
}


.avatar-img-wrapper {
    width: 100%;
    height: 100%;
    border-radius: 50%;
    overflow: hidden;
    background-color: var(--mud-palette-surface);
    display: flex;
    align-items: center;
    justify-content: center;
    border: 4px solid white;
    box-shadow: 0 10px 25px rgba(0,0,0,0.1), 0 4px 10px rgba(0,0,0,0.05);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
}

html.dark-preload .avatar-img-wrapper {
    border-color: rgba(255, 255, 255, 0.1);
    box-shadow: 0 10px 30px rgba(0,0,0,0.4);
}

.avatar-img-wrapper:hover {
    transform: translateY(-2px) scale(1.02);
    box-shadow: 0 15px 35px rgba(0,0,0,0.15);
}

.camera-upload-button {
    position: absolute;
    bottom: 5px !important;
    right: 5px !important;
    left: auto !important;
    background: rgba(0, 0, 0, 0.4) !important;
    backdrop-filter: blur(4px);
    color: white !important;
    border: 2px solid rgba(255, 255, 255, 0.6) !important;
    width: 32px !important;
    height: 32px !important;
    min-width: 32px !important;
    z-index: 10;
    box-shadow: 0 4px 12px rgba(0,0,0,0.15);
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0 !important;
    border-radius: 50% !important;
    transition: all 0.2s ease;
}

.camera-upload-button .mud-icon-root {
    font-size: 1.1rem !important;
}

.camera-upload-button:hover {
    background: rgba(0, 0, 0, 0.6) !important;
    transform: scale(1.1);
}

.profile-info-centered {
    text-align: center;
    margin-bottom: 20px;
}

.profile-name-large {
    font-size: 1.4rem !important;
    font-weight: 800 !important;
    color: var(--mud-palette-text-primary) !important;
    margin-bottom: 2px !important;
    font-family: 'Outfit', sans-serif;
}

.profile-email-small { font-size: 0.85rem !important; color: var(--mud-palette-text-secondary) !important; font-family: 'Outfit', sans-serif; }
.dark-input { color: inherit; }

/* ===== iOS Grouped UI Styles ===== */
.ios-page-container {
    background-color: #F2F2F7;
    min-height: 100vh;
    padding-bottom: 40px;
}

html.dark-preload .ios-page-container {
    background-color: #0F172A;
}

.ios-header-sticky {
    position: sticky;
    top: env(safe-area-inset-top, 0px);
    z-index: 100;
    background: rgba(242, 242, 247, 0.8);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-bottom: 1px solid rgba(0, 0, 0, 0.05);
}

html.dark-preload .ios-header-sticky {
    background: rgba(0, 0, 0, 0.8);
    border-bottom-color: rgba(255, 255, 255, 0.1);
}

.ios-header-title {
    font-weight: 700 !important;
    font-size: 1.1rem !important;
}

.ios-header-button {
    text-transform: none !important;
    font-weight: 500 !important;
    font-size: 1rem !important;
}

.ios-grouped-section {
    background: white;
    border-radius: 12px;
    margin: 20px 16px 8px 16px;
    overflow: hidden;
    box-shadow: none !important;
}

html.dark-preload .ios-grouped-section {
    background: #1C1C1E;
}

.ios-row {
    display: flex;
    align-items: center;
    padding: 12px 16px;
    min-height: 44px;
}

.ios-row-divider {
    height: 1px;
    background-color: rgba(0, 0, 0, 0.05);
    margin-left: 16px;
}

html.dark-preload .ios-row-divider {
    background-color: rgba(255, 255, 255, 0.05);
}

.ios-icon-circle {
    width: 32px;
    height: 32px;
    border-radius: 8px;
    display: flex;
    align-items: center;
    justify-content: center;
    margin-right: 12px;
}

.ios-icon-circle-orange { background-color: #FF9500; }
.ios-icon-circle-gray { background-color: #8E8E93; }
.ios-icon-circle-blue { background-color: #007AFF; }

.ios-subtext {
    font-size: 0.85rem;
    color: #8E8E93;
    margin: 0 32px 20px 32px;
    line-height: 1.3;
}

.ios-row-label {
    flex: 1;
    font-size: 1rem;
    color: #000;
}

html.dark-preload .ios-row-label {
    color: #FFF;
}

.ios-row-value {
    color: #8E8E93;
    font-size: 1rem;
    display: flex;
    align-items: center;
}

.ios-action-text {
    color: #34C759;
    font-weight: 500;
    width: 100%;
    text-align: center;
    font-size: 1rem;
}

.ios-chevron {
    color: #C7C7CC;
    margin-left: 8px;
}

.ios-input-field {
    flex: 1;
    border: none;
    background: transparent;
    font-size: 1.1rem;
    padding: 0;
    outline: none;
}

html.dark-preload .ios-input-field {
    color: white;
}

.ios-input-field::placeholder {
    color: #C7C7CC;
}

/* ===== Mobile Bottom Sheet Dialogs ===== */
@media (max-width: 600px) {
    .mobile-bottom-sheet {
        border-radius: 24px 24px 0 0 !important;
        margin-bottom: 0 !important;
        margin-top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        /* Animation: Slide up from bottom */
        animation: slideUp 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }

    .mobile-bottom-sheet .mud-dialog-content {
        padding: 0 20px 40px 20px !important;
    }

    .mobile-bottom-sheet-header {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 16px 20px;
        border-bottom: 1px solid rgba(0, 0, 0, 0.05);
        margin-bottom: 16px;
    }

    html.dark-preload .mobile-bottom-sheet-header {
        border-bottom-color: rgba(255, 255, 255, 0.05);
    }

    /* Pull handle indicator */
    .mobile-bottom-sheet::before {
        content: "";
        position: absolute;
        top: 8px;
        left: 50%;
        transform: translateX(-50%);
        width: 36px;
        height: 5px;
        background-color: rgba(0, 0, 0, 0.1);
        border-radius: 3px;
    }

    html.dark-preload .mobile-bottom-sheet::before {
        background-color: rgba(255, 255, 255, 0.2);
    }
}

@keyframes slideUp {
    from { transform: translateY(100%); }
    to { transform: translateY(0); }
}

/* Standardized iOS-Style Header */
.ios-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px;
    position: sticky;
    top: calc(12px + env(safe-area-inset-top, 0px));
    z-index: 100;
    background: rgba(255, 255, 255, 0.4) !important;
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    margin: 12px 16px;
    width: calc(100% - 32px);
    min-height: 52px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.03);
    border: 1px solid rgba(255,255,255,0.3);
    border-radius: 24px;
}

.header-left, .header-right {
    display: flex;
    align-items: center;
    gap: 8px;
    flex: 1;
    min-width: 40px;
}

.header-right {
    justify-content: flex-end;
}

html.dark-preload .ios-header {
    background: rgba(31, 41, 55, 0.4) !important;
    box-shadow: 0 4px 20px rgba(0,0,0,0.4);
    border: 1px solid rgba(255,255,255,0.08);
}

.ios-header-title {
    position: absolute;
    left: 50%;
    transform: translateX(-50%);
    font-weight: 700;
    font-size: 1.15rem;
    color: var(--mud-palette-text-primary);
    letter-spacing: -0.5px;
    white-space: nowrap;
}

/* ===== Offline Overlay UI Styles ===== */
#offline-overlay {
    position: fixed;
    top: env(safe-area-inset-top);
    left: 0;
    right: 0;
    bottom: 0;
    width: 100vw;
    background: rgba(15, 23, 42, 0.4);
    backdrop-filter: blur(16px);
    -webkit-backdrop-filter: blur(16px);
    z-index: 999999;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: opacity 0.4s ease, visibility 0.4s ease;
    opacity: 0;
    visibility: hidden;
    user-select: none;
    -webkit-user-select: none;
    -webkit-touch-callout: none;
}

#offline-overlay.offline-overlay-visible {
    opacity: 1;
    visibility: visible;
}

/* Khóa cuộn trang khi offline */
html.device-offline, html.device-offline body {
    overflow: hidden !important;
    height: 100% !important;
    width: 100% !important;
    position: fixed !important;
}

/* Ẩn reconnect modal của Blazor Server khi thiết bị mất mạng hoàn toàn */
html.device-offline #components-reconnect-modal {
    display: none !important;
}

.offline-card {
    background: rgba(255, 255, 255, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.5);
    border-radius: 28px;
    padding: 32px 24px;
    width: 85%;
    max-width: 340px;
    text-align: center;
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.15);
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 16px;
    transform: translateY(20px) scale(0.95);
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}

#offline-overlay.offline-overlay-visible .offline-card {
    transform: translateY(0) scale(1);
}

/* Dark Mode adaptation */
html.dark-preload .offline-card {
    background: rgba(30, 41, 59, 0.85);
    border: 1px solid rgba(255, 255, 255, 0.1);
    box-shadow: 0 20px 40px rgba(0, 0, 0, 0.4);
}

.offline-icon-wrapper {
    position: relative;
    width: 80px;
    height: 80px;
    background: linear-gradient(135deg, #FF6B6B 0%, #FF3B30 100%);
    border-radius: 50%;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 8px 24px rgba(255, 59, 48, 0.35);
    margin-bottom: 4px;
}

.offline-icon {
    font-size: 38px !important;
    color: white;
}

.pulse-ring-offline {
    position: absolute;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    border-radius: 50%;
    background: rgba(255, 59, 48, 0.3);
    animation: pulse-animation-offline 2s infinite ease-in-out;
    z-index: -1;
}

@keyframes pulse-animation-offline {
    0% { transform: scale(1); opacity: 0.8; }
    100% { transform: scale(1.6); opacity: 0; }
}

.offline-title {
    font-family: 'Outfit', sans-serif;
    font-size: 1.35rem;
    font-weight: 800;
    color: #1A202C;
    margin: 0;
}

html.dark-preload .offline-title {
    color: #FFFFFF;
}

.offline-desc {
    font-family: 'Roboto', sans-serif;
    font-size: 0.95rem;
    line-height: 1.5;
    color: #4A5568;
    margin: 0;
}

html.dark-preload .offline-desc {
    color: #CBD5E0;
}

.offline-badge {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    background: rgba(255, 149, 0, 0.12);
    color: #D97706;
    padding: 6px 14px;
    border-radius: 20px;
    font-size: 0.75rem;
    font-weight: 700;
    border: 1px solid rgba(255, 149, 0, 0.2);
}

html.dark-preload .offline-badge {
    background: rgba(255, 149, 0, 0.08);
    color: #FBBF24;
    border-color: rgba(255, 149, 0, 0.15);
}

/* Nút Tải lại dự phòng */
.offline-retry-btn {
    border: 1px solid rgba(0, 0, 0, 0.15);
    background: transparent;
    color: #4A5568;
    padding: 10px 24px;
    border-radius: 20px;
    font-size: 0.85rem;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    margin-top: 8px;
    outline: none;
}

.offline-retry-btn:hover {
    background: rgba(0, 0, 0, 0.05);
    border-color: rgba(0, 0, 0, 0.25);
}

.offline-retry-btn:active {
    transform: scale(0.95);
}

html.dark-preload .offline-retry-btn {
    border-color: rgba(255, 255, 255, 0.15);
    color: #CBD5E0;
}

html.dark-preload .offline-retry-btn:hover {
    background: rgba(255, 255, 255, 0.05);
    border-color: rgba(255, 255, 255, 0.25);
}

/* Hide floating action button (FAB) on mobile when scrolled to bottom */
html.hide-fab-btn .v2-fab-btn {
    opacity: 0 !important;
    pointer-events: none !important;
    transform: scale(0) !important;
}

/* ===== Desktop Sizing and Layout Constraints ===== */
@media (min-width: 960px) {
    .dashboard-container,
    .transactions-container,
    .budgets-container,
    .reports-page-container,
    .reports-v2-container,
    .profile-container,
    .ios-page-container,
    .wallets-page {
        max-width: 1200px;
        margin-left: auto !important;
        margin-right: auto !important;
        width: 100%;
        padding-left: 24px !important;
        padding-right: 24px !important;
    }
}


