/* Terrain design system — Space Grotesk + IBM Plex Sans/Mono, self-hosted (offline job sites). */

@font-face {
    font-family: 'Space Grotesk';
    font-weight: 700;
    font-display: swap;
    src: url('../fonts/SpaceGrotesk-Bold.woff2') format('woff2');
}

@font-face {
    font-family: 'IBM Plex Sans';
    font-weight: 400;
    font-display: swap;
    src: url('../fonts/IBMPlexSans-Regular.woff2') format('woff2');
}

@font-face {
    font-family: 'IBM Plex Sans';
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/IBMPlexSans-SemiBold.woff2') format('woff2');
}

@font-face {
    font-family: 'IBM Plex Mono';
    font-weight: 600;
    font-display: swap;
    src: url('../fonts/IBMPlexMono-SemiBold.woff2') format('woff2');
}

html, body {
    margin: 0;
    padding: 0;
    --font-mono: 'IBM Plex Mono', ui-monospace, 'Consolas', monospace;
    --mud-typography-default-family: 'IBM Plex Sans', system-ui, -apple-system, 'Segoe UI', sans-serif;
    --mud-typography-h1-family: 'Space Grotesk', system-ui, sans-serif;
    --mud-typography-h2-family: 'Space Grotesk', system-ui, sans-serif;
    --mud-typography-h3-family: 'Space Grotesk', system-ui, sans-serif;
    --mud-typography-h4-family: 'Space Grotesk', system-ui, sans-serif;
    --mud-typography-h5-family: 'Space Grotesk', system-ui, sans-serif;
    --mud-typography-h6-family: 'Space Grotesk', system-ui, sans-serif;
    --mud-typography-subtitle1-family: var(--mud-typography-default-family);
    --mud-typography-subtitle2-family: var(--mud-typography-default-family);
    --mud-typography-body1-family: var(--mud-typography-default-family);
    --mud-typography-body2-family: var(--mud-typography-default-family);
    --mud-typography-button-family: 'Space Grotesk', system-ui, sans-serif;
    --mud-typography-caption-family: var(--mud-typography-default-family);
    --mud-typography-overline-family: var(--mud-typography-default-family);
}

/* Boutons : pas de MAJUSCULES forcées (look moins "Material", plus moderne). */
.mud-button-root {
    text-transform: none;
    letter-spacing: normal;
    font-weight: 600;
}

/* Cartes douces : bordure fine + ombre subtile plutôt qu'élévation Material marquée. */
.soft-card {
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 12px;
}

/* Chiffres clés : quantités, références — chiffres tabulaires, lisibles d'un coup d'œil. */
.t-mono {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
}

.t-display {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 2rem;
    line-height: 1;
}

/* Barre de recherche pleine largeur, forme "pill" comme dans le design system. */
.search-field .mud-input-outlined {
    border-radius: 999px;
}

/* Tuile de marque : carré arrondi ambre + icône, comme le logo du design system. */
.brand-tile {
    width: 44px;
    height: 44px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Tuile de liste : carré arrondi tonal + icône, pour les lignes/cartes (lieux, clients). */
.list-tile {
    width: 44px;
    height: 44px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

/* Sidebar : items de nav en pilule, actif = fond container primaire. */

.mud-drawer .nav-pill,
.mud-drawer .nav-pill .mud-nav-link {
    border-radius: 999px;
    margin: 2px 4px;
}

.mud-drawer .nav-pill.active,
.mud-drawer .nav-pill .mud-nav-link.active {
    background: color-mix(in srgb, var(--mud-palette-primary) 20%, transparent);
    color: var(--mud-palette-drawer-text);
}

/* StatusPill — tonal container background per status, matching the design system's
   "En stock / Stock bas / Rupture" pills. */
.sp-pill {
    display: inline-flex;
    align-items: center;
    gap: 6px;
    height: 28px;
    padding: 0 12px;
    border-radius: 999px;
    font-size: 0.8125rem;
    font-weight: 500;
    white-space: nowrap;
}

.sp-pill-icon {
    font-size: 16px !important;
}

/* Terrain : plus de rouge/vert pour les statuts — tout passe par l'ambre primaire. */
.sp-pill-in {
    background: color-mix(in srgb, var(--mud-palette-text-primary) 8%, transparent);
    color: var(--mud-palette-text-primary);
}

.sp-pill-low {
    background: var(--mud-palette-primary);
    color: #fff;
}

.sp-pill-out {
    background: transparent;
    color: color-mix(in srgb, var(--mud-palette-primary) 70%, black);
    border: 1.5px solid var(--mud-palette-primary);
}

/* Fiche article — hero : tuile icône tonale + overline + grand chiffre centré. */
.detail-icon-tile {
    width: 60px;
    height: 60px;
    flex: none;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.detail-overline {
    font-size: 0.6875rem;
    font-weight: 500;
    letter-spacing: 1.2px;
    text-transform: uppercase;
    color: var(--mud-palette-text-secondary);
}

.detail-quantity {
    font-size: 3rem;
    line-height: 1;
}

/* StatCard — dashboard KPI tile: tinted icon tile + big mono figure + label. */
.stat-card {
    display: flex;
    flex-direction: column;
    gap: 12px;
}

.stat-card-icon {
    width: 44px;
    height: 44px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    flex: none;
}

/* Terrain : tuiles icône — coins plus ronds, teinte ambre unique. */
.brand-tile, .list-tile, .detail-icon-tile, .stat-card-icon {
    border-radius: 11px;
    background: color-mix(in srgb, var(--mud-palette-primary) 16%, var(--mud-palette-surface));
    color: color-mix(in srgb, var(--mud-palette-primary) 70%, black);
}

.stat-card-value {
    font-family: var(--font-mono);
    font-variant-numeric: tabular-nums;
    font-weight: 700;
    font-size: 2rem;
    line-height: 1;
}

.stat-card-unit {
    font-family: var(--mud-typography-default-family);
    font-weight: 500;
    font-size: 1.125rem;
    margin-left: 4px;
    color: var(--mud-palette-text-secondary);
}

.stat-card-label {
    font-size: 0.875rem;
    color: var(--mud-palette-text-secondary);
    margin-top: 4px;
}

/* Barre de navigation mobile — onglets en bas + FAB ambre central (remplace le drawer sur mobile). */
.bottom-tab-bar {
    display: flex;
    align-items: center;
    justify-content: space-around;
    padding: 10px 6px;
    background: var(--mud-palette-appbar-background);
}

.bottom-tab-bar .tab {
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 3px;
    color: var(--mud-palette-appbar-text);
    opacity: .55;
    font-size: 9px;
    font-weight: 600;
    text-decoration: none;
    cursor: pointer;
}

.bottom-tab-bar .tab.active {
    opacity: 1;
    color: var(--mud-palette-primary);
}

.bottom-tab-bar .fab {
    width: 48px;
    height: 48px;
    flex: none;
    border-radius: 16px;
    transform: translateY(-12px);
    background: var(--mud-palette-primary);
    color: #fff;
    border: none;
    display: flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px color-mix(in srgb, var(--mud-palette-primary) 45%, transparent);
}

/* Sélecteur de type de mouvement — pilule segmentée (remplace le MudSelect). */
.mvt-segmented {
    display: flex;
    background: var(--mud-palette-surface);
    border: 1px solid var(--mud-palette-lines-default);
    border-radius: 999px;
    overflow: hidden;
}

.mvt-segmented button {
    flex: 1;
    text-align: center;
    padding: 9px 4px;
    font: inherit;
    font-size: 12.5px;
    font-weight: 600;
    color: var(--mud-palette-text-secondary);
    background: transparent;
    border: none;
    border-radius: 999px;
    cursor: pointer;
}

.mvt-segmented button.active {
    background: var(--mud-palette-primary);
    color: #fff;
}

/* Terrain : sur mobile, la bottom-tab-bar remplace le drawer/hamburger desktop. */
.bottom-tab-bar {
    display: none;
}

@media (max-width: 959.98px) {
    .bottom-tab-bar {
        display: flex;
        position: fixed;
        left: 0;
        right: 0;
        bottom: 0;
        /* Doit rester sous le popover MudBlazor (z-index 1200 par défaut) pour
           que le menu "Plus..." (MudMenu) ne soit pas masqué par la barre opaque. */
        z-index: 1100;
    }

    .desktop-only {
        display: none !important;
    }

    .desktop-fab {
        display: none !important;
    }

    .mud-main-content {
        padding-bottom: 64px;
    }
}

.app-loading {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100vh;
    font-family: 'Segoe UI', system-ui, sans-serif;
    color: #64748B;
}

.status-bar-safe-area {
    height: env(safe-area-inset-top, 0);
    width: 100%;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    padding: 0.8rem 1.2rem;
    background: #EF4444;
    color: #fff;
    z-index: 1000;
}

#blazor-error-ui .dismiss {
    cursor: pointer;
    float: right;
}
