/* ============================================================================
   CountrPro — "Liquid" design system
   iOS-17 clean base + Liquid-Glass chrome, layered on top of MudBlazor.

   Philosophy (after Jony Ive): restraint, deference to content, honest
   materials, precision, soft continuous curvature, quiet confidence.

   Colors/radius come from the MudTheme (App.razor). This file adds the
   *materials*: glass on the chrome (app bar, drawer, dialogs), clean solid
   surfaces for data, pill buttons, hairline tables, and restrained motion.
   Translucency derives from --mud-palette-surface via color-mix, so it adapts
   to light & dark automatically, with @supports fallbacks for older engines.
   ============================================================================ */

/* ---- Canvas & rendering ------------------------------------------------- */
html, body {
    font-family: 'Inter', -apple-system, BlinkMacSystemFont, system-ui, sans-serif;
    letter-spacing: -0.01em;
    -webkit-font-smoothing: antialiased;
    -moz-osx-font-smoothing: grayscale;
    text-rendering: optimizeLegibility;
}

.mud-layout,
.mud-main-content,
.mud-table-container,
.mud-table-root { background: transparent !important; }

/* A calm, alive ambient field so the glass has something beautiful to refract.
   Fixed, behind everything, never competes with content. */
body::before {
    content: "";
    position: fixed;
    inset: 0;
    z-index: -1;
    pointer-events: none;
    background:
        radial-gradient(1100px 620px at 10% -10%, rgba(0, 122, 255, 0.10), transparent 60%),
        radial-gradient(900px 520px at 102% 0%, rgba(88, 86, 214, 0.09), transparent 55%),
        radial-gradient(820px 600px at 50% 118%, rgba(52, 199, 89, 0.06), transparent 60%);
}

/* ---- Typography: SF-Pro-like rhythm via Inter ---------------------------- */
.mud-typography-h1, .mud-typography-h2, .mud-typography-h3,
.mud-typography-h4, .mud-typography-h5, .mud-typography-h6 {
    letter-spacing: -0.022em;
    font-weight: 600;
}
.mud-typography-subtitle1, .mud-typography-subtitle2 { letter-spacing: -0.01em; }

/* ============================================================================
   LIQUID GLASS — chrome only (app bar, drawer, dialogs, menus)
   ============================================================================ */
.mud-appbar {
    background: color-mix(in srgb, var(--mud-palette-surface) 72%, transparent) !important;
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    backdrop-filter: saturate(180%) blur(22px);
    box-shadow: none !important;
    border-bottom: 1px solid var(--mud-palette-lines-default);
}

.mud-drawer {
    background: color-mix(in srgb, var(--mud-palette-surface) 66%, transparent) !important;
    -webkit-backdrop-filter: saturate(180%) blur(22px);
    backdrop-filter: saturate(180%) blur(22px);
    border-right: 1px solid var(--mud-palette-lines-default) !important;
    box-shadow: none !important;
}

.mud-dialog {
    background: color-mix(in srgb, var(--mud-palette-surface) 82%, transparent) !important;
    -webkit-backdrop-filter: saturate(180%) blur(30px);
    backdrop-filter: saturate(180%) blur(30px);
    border: 1px solid color-mix(in srgb, #fff 50%, transparent);
    border-radius: 20px !important;
    box-shadow: 0 30px 80px rgba(0, 0, 0, 0.22) !important;
}
.mud-overlay .mud-overlay-scrim { backdrop-filter: blur(2px); }

/* Popover surfaces (menus, selects, date pickers) — light frost */
.mud-popover {
    background: color-mix(in srgb, var(--mud-palette-surface) 88%, transparent) !important;
    -webkit-backdrop-filter: saturate(180%) blur(20px);
    backdrop-filter: saturate(180%) blur(20px);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 14px !important;
    box-shadow: 0 12px 40px rgba(0, 0, 0, 0.16) !important;
}

/* ============================================================================
   CLEAN iOS-17 SURFACES — data stays solid, legible, fast
   ============================================================================ */
.mud-paper {
    border-radius: 14px;
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}
.mud-card {
    border-radius: 20px !important;
    border: 1px solid color-mix(in srgb, var(--mud-palette-lines-default) 60%, transparent);
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04), 0 12px 32px rgba(0, 0, 0, 0.07) !important;
}

/* ---- Buttons: pill-shaped, quiet, confident ----------------------------- */
.mud-button-root {
    border-radius: 980px;
    text-transform: none;
    letter-spacing: 0;
    font-weight: 590;
}
.mud-button-filled { box-shadow: none !important; }
.mud-button-filled:hover { box-shadow: 0 4px 14px rgba(0, 122, 255, 0.25) !important; }
.mud-icon-button { border-radius: 12px; }

/* ---- Inputs: soft, calm, 12px curvature --------------------------------- */
.mud-input.mud-input-outlined .mud-input-outlined-border { border-radius: 12px; }
.mud-input-control { border-radius: 12px; }

/* ---- Tables: airy, hairline rows, no shouty stripes --------------------- */
.mud-table {
    border-radius: 18px !important;
    overflow: hidden;
    border: 1px solid var(--mud-palette-lines-default);
    box-shadow: 0 1px 2px rgba(0, 0, 0, 0.04), 0 1px 3px rgba(0, 0, 0, 0.05) !important;
}
.mud-table-head .mud-table-cell {
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    text-transform: none;
    letter-spacing: 0;
    background: color-mix(in srgb, var(--mud-palette-surface) 60%, transparent);
}
.mud-table-cell { border-bottom: 1px solid var(--mud-palette-table-lines); }
.mud-table-row:hover {
    background: color-mix(in srgb, var(--mud-palette-primary) 6%, transparent) !important;
}

/* ---- Drawer nav: rounded, with a soft active pill ----------------------- */
.mud-nav-link {
    border-radius: 10px;
    margin: 2px 8px;
    font-weight: 500;
}
.mud-nav-link.active {
    background: color-mix(in srgb, var(--mud-palette-primary) 12%, transparent) !important;
    color: var(--mud-palette-primary) !important;
}
.mud-nav-link.active .mud-nav-link-icon { color: var(--mud-palette-primary) !important; }

/* ---- Chips, alerts: softer corners -------------------------------------- */
.mud-chip { border-radius: 980px; }
.mud-alert { border-radius: 14px; }

/* ============================================================================
   MOTION — physical, restrained (spring-like ease, never flashy)
   ============================================================================ */
.mud-button-root,
.mud-icon-button,
.mud-nav-link,
.mud-paper,
.mud-card {
    transition: transform 0.18s cubic-bezier(0.2, 0.8, 0.2, 1),
                background-color 0.18s ease,
                box-shadow 0.22s ease;
}
.mud-button-root:active,
.mud-icon-button:active { transform: scale(0.97); }

/* ============================================================================
   FALLBACKS & ACCESSIBILITY
   ============================================================================ */

/* No backdrop-filter (older engines): use near-opaque surfaces so chrome
   stays legible instead of see-through. */
@supports not ((backdrop-filter: blur(1px)) or (-webkit-backdrop-filter: blur(1px))) {
    .mud-appbar  { background: color-mix(in srgb, var(--mud-palette-surface) 96%, transparent) !important; }
    .mud-drawer  { background: color-mix(in srgb, var(--mud-palette-surface) 97%, transparent) !important; }
    .mud-dialog,
    .mud-popover { background: var(--mud-palette-surface) !important; }
}

/* No color-mix (older engines): fall back to solid theme surfaces. */
@supports not (background: color-mix(in srgb, red 50%, transparent)) {
    .mud-appbar, .mud-drawer, .mud-dialog, .mud-popover { background: var(--mud-palette-surface) !important; }
    .mud-table-head .mud-table-cell { background: var(--mud-palette-surface); }
}

@media (prefers-reduced-motion: reduce) {
    *, *::before, *::after { transition: none !important; animation: none !important; }
}
