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

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 {
    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: url(data:image/svg+xml;base64,PHN2ZyB3aWR0aD0iNTYiIGhlaWdodD0iNDkiIHhtbG5zPSJodHRwOi8vd3d3LnczLm9yZy8yMDAwL3N2ZyIgeG1sbnM6eGxpbms9Imh0dHA6Ly93d3cudzMub3JnLzE5OTkveGxpbmsiIG92ZXJmbG93PSJoaWRkZW4iPjxkZWZzPjxjbGlwUGF0aCBpZD0iY2xpcDAiPjxyZWN0IHg9IjIzNSIgeT0iNTEiIHdpZHRoPSI1NiIgaGVpZ2h0PSI0OSIvPjwvY2xpcFBhdGg+PC9kZWZzPjxnIGNsaXAtcGF0aD0idXJsKCNjbGlwMCkiIHRyYW5zZm9ybT0idHJhbnNsYXRlKC0yMzUgLTUxKSI+PHBhdGggZD0iTTI2My41MDYgNTFDMjY0LjcxNyA1MSAyNjUuODEzIDUxLjQ4MzcgMjY2LjYwNiA1Mi4yNjU4TDI2Ny4wNTIgNTIuNzk4NyAyNjcuNTM5I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I2My41NzYgODYuMDU0N1oiIGZpbGw9IiNGRkU1MDAiIGZpbGwtcnVsZT0iZXZlbm9kZCIvPjwvZz48L3N2Zz4=) no-repeat 1rem/1.8rem, #b32121;
    padding: 1rem 1rem 1rem 3.7rem;
    color: white;
}

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

.loading-progress {
    position: relative;
    display: block;
    width: 8rem;
    height: 8rem;
    margin: 20vh auto 1rem auto;
}

    .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;
    text-align: center;
    font-weight: bold;
    inset: calc(20vh + 3.25rem) 0 auto 0.2rem;
}

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

code {
    color: #c02d76;
}

.form-floating > .form-control-plaintext::placeholder, .form-floating > .form-control::placeholder {
    color: var(--bs-secondary-color);
    text-align: end;
}

.form-floating > .form-control-plaintext:focus::placeholder, .form-floating > .form-control:focus::placeholder {
    text-align: start;
}

/* Shared table header style for MudTable headers across list pages */
.list-table-header {
    background-color: var(--mud-palette-primary) !important;
    color: var(--mud-palette-primary-text) !important;
}

.list-table-header th {
    background-color: var(--mud-palette-primary) !important;
    color: var(--mud-palette-primary-text) !important;
    border-color: var(--mud-palette-primary) !important;
}

/* Right-align numeric input fields */
.text-align-right input {
    text-align: right;
}


/* Gray background utility class for card headers and sections */
.gray-bg {
    background-color: var(--mud-palette-background-gray);
}

/* Primary background utility class for card headers */
.primary-bg {
    background-color: var(--mud-palette-primary);
    color: var(--mud-palette-primary-text);
}

/* Active nav link — solid gold background, white text */
.mud-nav-link.active {
    background-color: #C9920E !important;
    border-left: 3px solid #A37008 !important;
    padding-left: 10px !important;
    color: #FFFFFF !important;
    font-weight: 600 !important;
    box-shadow: 0 2px 8px rgba(201, 146, 14, 0.4) !important;
}

.mud-nav-link.active .mud-nav-link-icon {
    color: #FFFFFF !important;
    opacity: 1 !important;
}

.mud-nav-link.active .mud-nav-link-text {
    color: #FFFFFF !important;
}

/* ── Floating two-panel layout ───────────────────────────────────────────── */

/* No AppBar in this layout — zero out all appbar-related offsets */
:root {
    --mud-appbar-height: 0px !important;
}

.mud-main-content {
    padding-top: 0 !important;
    margin-top: 0 !important;
}

/* Drawer: full-height floating panel on the left */
.mud-drawer[id="nav-drawer"] {
    top: 8px !important;
    left: 8px !important;
    height: calc(100vh - 16px) !important;
    border-radius: 16px !important;
    overflow: hidden !important;
}

/* ── Mobile: modal overlay drawer + floating hamburger ───────────────────── */

/* On small screens the drawer becomes a full-height modal panel flush to the
   left edge, sliding in over a scrim (MudBlazor Temporary variant). */
.mud-drawer[id="nav-drawer"].mobile-drawer {
    top: 0 !important;
    height: 100vh !important;
    width: 280px !important;
    border-radius: 0 16px 16px 0 !important;
}

/* Horizontal position is state-scoped so it can beat BOTH our base
   `left: 8px !important` rule above AND still let the drawer slide
   off-screen when MudBlazor marks it closed. Without this, an
   unconditional `left: 0 !important` traps the drawer on screen. */
.mud-drawer[id="nav-drawer"].mobile-drawer.mud-drawer--open {
    left: 0 !important;
}

.mud-drawer[id="nav-drawer"].mobile-drawer.mud-drawer--closed {
    left: -300px !important;
    box-shadow: none !important;
}

/* Floating hamburger that opens the drawer on small screens */
.mobile-nav-fab {
    position: fixed !important;
    top: 12px;
    left: 12px;
    z-index: 1300;
    background-color: var(--mud-palette-drawer-background) !important;
    color: var(--mud-palette-drawer-text) !important;
    box-shadow: 0 4px 14px rgba(0, 0, 0, 0.30) !important;
    border-radius: 12px !important;
}

.mobile-nav-fab:hover {
    background-color: var(--mud-palette-drawer-background) !important;
    filter: brightness(1.15);
}

/* Force the hamburger glyph to the light drawer-text colour — otherwise the
   SVG falls back to a dark fill and is invisible on the dark FAB. */
.mobile-nav-fab .mud-icon-root,
.mobile-nav-fab svg {
    color: var(--mud-palette-drawer-text) !important;
    fill: var(--mud-palette-drawer-text) !important;
}

/* Reserve space at the top of the page so the floating FAB never covers
   page titles / toolbars while the drawer is closed. */
@media (max-width: 959.98px) {
    .global-page-background {
        margin-top: 56px !important;
    }
}

/* Drawer inner: flex column so brand/nav/footer stack properly */
.nav-drawer-inner {
    display: flex;
    flex-direction: column;
    height: 100%;
}

.nav-links-area {
    flex: 1 1 auto;
    overflow-y: auto;
    overflow-x: hidden;
}

.nav-brand-header,
.nav-user-footer {
    flex-shrink: 0;
}

/* ── Rounded nav links — inset from drawer edges so the pill floats */
.mud-nav-link,
.mud-nav-group-header {
    border-radius: 8px !important;
    margin: 2px 8px !important;
    padding-left: 12px !important;
    padding-right: 12px !important;
    width: calc(100% - 16px) !important;
}

.mud-nav-group .mud-nav-group-header {
    border-radius: 8px !important;
}

/* Nav group dividers: replace harsh lines with subtle breathing room */
.nav-links-area .mud-divider {
    border-color: transparent !important;
    margin: 3px 16px !important;
    opacity: 0;
}

/* Section gap via top border on each nav group — very subtle */
.nav-links-area .mud-nav-group {
    margin-top: 2px;
}

/* Sub-nav links live inside MudCollapse, not a mud-nav-group-items wrapper */
.mud-nav-group .mud-collapse-container .mud-nav-link {
    padding-left: 32px !important;
    font-size: 0.825rem !important;
    opacity: 1;
}

/* ── Mini / collapsed nav rail ────────────────────────────────────────────── */

/* Shrink drawer to icon rail */
.mud-drawer[id="nav-drawer"].mini-drawer {
    width: 56px !important;
    min-width: 56px !important;
    overflow: visible !important;
    transition: width 0.22s ease !important;
    border-radius: 12px !important;
}

/* Allow flyouts to escape every clipping ancestor in mini mode */
.mud-drawer[id="nav-drawer"].mini-drawer .mud-drawer-content,
.mud-drawer[id="nav-drawer"].mini-drawer .nav-drawer-inner,
.mud-drawer[id="nav-drawer"].mini-drawer .nav-links-area {
    overflow: visible !important;
    width: 56px;
}

/* Brand header: centre the hamburger icon */
.mini-brand-header {
    display: flex;
    justify-content: center;
    align-items: center;
    height: 52px;
}

/* User footer: stack icons centred */
.mini-user-footer {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 6px 0 8px;
    gap: 2px;
}

/* ── Mini nav item container ───────────────────────────────────────────────── */
.mini-nav {
    display: flex;
    flex-direction: column;
    align-items: center;
    padding: 4px 0;
    gap: 2px;
    width: 100%;
    overflow: visible;
}

.mini-nav-item {
    position: relative;
    width: 100%;
    display: flex;
    justify-content: center;
}

/* Icon button (both <a> and <div> variants) */
.mini-nav-link {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 40px;
    border-radius: 8px;
    color: var(--mud-palette-drawer-icon);
    text-decoration: none;
    cursor: pointer;
    transition: background-color 0.15s, color 0.15s;
    position: relative;
    z-index: 1;
}

.mini-nav-item:hover > .mini-nav-link {
    background-color: rgba(255, 255, 255, 0.08);
    color: var(--mud-palette-drawer-text);
}

/* Active group icon — gold highlight matching expanded nav */
.mini-nav-item.mini-active > .mini-nav-link {
    background-color: rgba(201, 146, 14, 0.22);
    color: #F0C060;
    border-left: 3px solid #C9920E;
}

.mini-nav-divider {
    width: 32px;
    height: 1px;
    background-color: var(--mud-palette-drawer-text);
    margin: 3px 0;
    opacity: 0.15;
    flex-shrink: 0;
}

/* ── Flyout panel ─────────────────────────────────────────────────────────── */
.mini-flyout {
    display: none;
    position: absolute;
    left: 100%;        /* sits flush against the right edge of the icon rail */
    top: -4px;
    min-width: 200px;
    background-color: var(--mud-palette-drawer-background);
    border-radius: 8px;
    padding: 6px 0;
    box-shadow: 0 6px 28px rgba(0, 0, 0, 0.45);
    z-index: 2000;
    pointer-events: auto;
}

/* Bridge gap: extend hover area so mouse can reach the flyout */
.mini-nav-item::after {
    content: '';
    position: absolute;
    left: 100%;
    top: 0;
    width: 6px;
    height: 100%;
}

.mini-nav-item:hover .mini-flyout {
    display: block;
}

.mini-flyout-header {
    padding: 6px 14px 4px;
    font-size: 0.68rem;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 0.1em;
    color: var(--mud-palette-primary);
    opacity: 0.9;
}

/* Single-item "tooltip" label (e.g. Dashboard) */
.mini-flyout-label {
    display: block;
    padding: 8px 14px;
    font-size: 0.875rem;
    color: var(--mud-palette-drawer-text);
    white-space: nowrap;
}

.mini-flyout-link {
    display: flex;
    align-items: center;
    gap: 10px;
    padding: 7px 14px;
    color: var(--mud-palette-drawer-text);
    text-decoration: none;
    font-size: 0.85rem;
    transition: background-color 0.12s, color 0.12s;
    white-space: nowrap;
}

.mini-flyout-link:hover {
    background-color: rgba(255, 255, 255, 0.06);
    color: var(--mud-palette-primary-lighten, #7ab8f5);
    text-decoration: none;
}

/* ── Coloured nav group header icons (expanded nav) ───────────────────────── */
/* HeaderClass is applied directly to the header button, so selector is just .hdr-X .mud-nav-link-icon */

.nav-link-dashboard  .mud-nav-link-icon { color: #F59E0B !important; }
.nav-link-customers  .mud-nav-link-icon { color: #A78BFA !important; }
.nav-link-sonakhata  .mud-nav-link-icon { color: #F472B6 !important; }
.nav-hdr-billing    .mud-nav-link-icon  { color: #22C55E !important; }
.nav-hdr-urd        .mud-nav-link-icon  { color: #38BDF8 !important; }
.nav-hdr-stock      .mud-nav-link-icon  { color: #FB923C !important; }
.nav-hdr-customers  .mud-nav-link-icon  { color: #A78BFA !important; }
.nav-hdr-reports    .mud-nav-link-icon  { color: #2DD4BF !important; }
.nav-hdr-sonakhata  .mud-nav-link-icon  { color: #F472B6 !important; }
.nav-hdr-masterdata .mud-nav-link-icon  { color: #818CF8 !important; }
.nav-hdr-settings   .mud-nav-link-icon  { color: #94A3B8 !important; }
