html, body {
    font-family: 'Roboto', 'Helvetica Neue', sans-serif;
    overscroll-behavior: none;
}

/* ── Bottom navigation bar ─────────────────────────────────────────── */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    z-index: 1200;
    display: flex;
    align-items: stretch;
    height: 64px;
    border-top: 1px solid rgba(255, 255, 255, 0.08);
}

/* Le <a> généré par MudButton Href */
.bottom-nav .mud-button-root.bnav-btn {
    flex: 1;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    height: 64px;
    padding: 6px 2px;
    border-radius: 0;
    color: rgba(255, 255, 255, 0.5);
    min-width: 0;
    -webkit-tap-highlight-color: transparent;
}

.bottom-nav .mud-button-root.bnav-btn:hover {
    color: rgba(255, 255, 255, 0.85);
    background-color: rgba(255, 255, 255, 0.05);
}

.bottom-nav .mud-button-root.bnav-btn.active {
    color: #6c63ff;
}

/* .mud-button-label hérite display/align/justify du parent via "inherit" */
.bottom-nav .mud-button-root.bnav-btn .mud-button-label {
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
}

/* Icône */
.bottom-nav .bnav-icon.mud-icon-root {
    font-size: 1.375rem !important;
    width: 1.375rem !important;
    height: 1.375rem !important;
    margin: 0 !important;
}

/* Label texte */
.bottom-nav .bnav-label {
    font-size: 0.6rem !important;
    line-height: 1 !important;
    white-space: nowrap;
    text-transform: none !important;
    letter-spacing: 0 !important;
    margin: 0 !important;
}

/* Responsive : très petit écran (<360px), réduire encore */
@media (max-width: 360px) {
    .bottom-nav .bnav-label {
        font-size: 0.52rem !important;
    }
    .bottom-nav .bnav-icon.mud-icon-root {
        font-size: 1.2rem !important;
        width: 1.2rem !important;
        height: 1.2rem !important;
    }
}

/* Blazor error boundary */
.blazor-error-boundary {
    background: #b32121;
    padding: 1rem;
    color: white;
}

.blazor-error-boundary::after {
    content: "Une erreur inattendue s'est produite.";
}

/* Validation */
.valid.modified:not([type=checkbox]) {
    outline: 1px solid var(--mud-palette-success, #26b050);
}

.invalid {
    outline: 1px solid var(--mud-palette-error, #e50000);
}

.validation-message {
    color: var(--mud-palette-error, #e50000);
}

/* ── Reconnexion SignalR — modal ────────────────────────────────────── */
/*
 * Blazor ajoute automatiquement une classe sur #components-reconnect-modal :
 *   .components-reconnect-show     → reconnexion en cours
 *   .components-reconnect-failed   → toutes les tentatives ont échoué
 *   .components-reconnect-rejected → circuit rejeté (session expirée)
 * Sans classe → display: none (état normal, pas de déconnexion)
 */

#components-reconnect-modal {
    display: none;
    position: fixed;
    bottom: 80px;
    left: 50%;
    transform: translateX(-50%);
    z-index: 9998;
    background: var(--mud-palette-surface, #1a1a2e);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: 10px;
    padding: 12px 20px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.5);
    min-width: 220px;
    max-width: 90vw;
    align-items: center;
    gap: 10px;
    color: rgba(255, 255, 255, 0.87);
    font-size: 0.88rem;
    white-space: nowrap;
}

/* Tous les labels masqués par défaut */
#components-reconnect-modal .reconnect-label {
    display: none;
}

/* État : reconnexion en cours */
#components-reconnect-modal.components-reconnect-show {
    display: flex;
}

#components-reconnect-modal.components-reconnect-show .reconnect-label-show {
    display: inline;
}

#components-reconnect-modal.components-reconnect-show .reconnect-spinner {
    display: block;
}

/* État : abandon (toutes les tentatives ont échoué) */
#components-reconnect-modal.components-reconnect-failed {
    display: flex;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-label-failed {
    display: inline;
}

#components-reconnect-modal.components-reconnect-failed .reconnect-spinner {
    display: none;
}

/* État : rejeté (session expirée côté serveur) */
#components-reconnect-modal.components-reconnect-rejected {
    display: flex;
}

#components-reconnect-modal.components-reconnect-rejected .reconnect-label-rejected {
    display: inline;
}

#components-reconnect-modal.components-reconnect-rejected .reconnect-spinner {
    display: none;
}

/* Spinner CSS pur */
.reconnect-spinner {
    display: none; /* masqué par défaut, activé par l'état show */
    width: 18px;
    height: 18px;
    border: 2px solid rgba(108, 99, 255, 0.3);
    border-top-color: #6c63ff;
    border-radius: 50%;
    animation: reconnect-spin 0.8s linear infinite;
    flex-shrink: 0;
}

@keyframes reconnect-spin {
    to { transform: rotate(360deg); }
}

/* Lien recharger */
.reconnect-reload {
    color: #6c63ff;
    text-decoration: underline;
    cursor: pointer;
    font-weight: 500;
    margin-left: 4px;
}

#blazor-error-ui {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: #b32121;
    color: white;
    padding: 0.6rem 1.25rem;
    z-index: 9999;
}

#blazor-error-ui .reload {
    color: white;
    text-decoration: underline;
    cursor: pointer;
}

#blazor-error-ui .dismiss {
    position: absolute;
    right: 0.75rem;
    top: 0.5rem;
    cursor: pointer;
}

/* Login form — SSR inputs styled for dark theme */
.login-field {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

.login-label {
    font-size: 0.8rem;
    font-weight: 500;
    color: rgba(255, 255, 255, 0.7);
    letter-spacing: 0.01em;
}

.login-input {
    width: 100%;
    padding: 14px 16px;
    background: rgba(255, 255, 255, 0.05);
    border: 1px solid rgba(255, 255, 255, 0.23);
    border-radius: 6px;
    color: rgba(255, 255, 255, 0.87);
    font-size: 1rem;
    font-family: inherit;
    outline: none;
    box-sizing: border-box;
    transition: border-color 0.2s, background 0.2s;
    -webkit-appearance: none;
    appearance: none;
}

.login-input:hover {
    border-color: rgba(255, 255, 255, 0.5);
    background: rgba(255, 255, 255, 0.08);
}

.login-input:focus {
    border-color: #6c63ff;
    background: rgba(108, 99, 255, 0.08);
    box-shadow: 0 0 0 2px rgba(108, 99, 255, 0.15);
}

.login-input::placeholder {
    color: rgba(255, 255, 255, 0.3);
}

.login-error {
    font-size: 0.75rem;
    color: #f44336;
    margin-top: 2px;
}

.login-checkbox {
    width: 18px;
    height: 18px;
    accent-color: #6c63ff;
    cursor: pointer;
}
