/* ═══════════════════════════════════════════════════
   Bottom Navigation — App employé (v2)
   5 items + FAB central + bottom sheets
═══════════════════════════════════════════════════ */

:root {
    --baid-nav-h: 64px;
    --baid-nav-grad-1: #6c5ce7;
    --baid-nav-grad-2: #ec4899;
    --baid-nav-active: #4f46e5;
    --baid-nav-muted: #94a3b8;
    --baid-nav-muted-hover: #475569;
    --baid-streak-1: #dc2626;
    --baid-streak-2: #ea580c;
}

/* ───────────── Le nav ───────────── */
.baid-app-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: rgba(255, 255, 255, 0.97);
    backdrop-filter: blur(12px);
    -webkit-backdrop-filter: blur(12px);
    border-top: 1px solid #e2e8f0;
    box-shadow: 0 -4px 24px rgba(15, 23, 42, 0.07);
    z-index: 9999;
    padding-bottom: env(safe-area-inset-bottom, 0px);
    transform: translateY(0);
    transition: transform .25s ease;
}

.baid-app-nav.is-hidden {
    transform: translateY(100%);
}

.baid-app-nav-inner {
    display: flex;
    align-items: stretch;
    max-width: 540px;
    margin: 0 auto;
    height: var(--baid-nav-h);
    padding: 0 4px;
    position: relative;
}

/* ───────────── Item générique ───────────── */
.baid-app-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 3px;
    padding: 6px 0 4px;
    color: var(--baid-nav-muted);
    text-decoration: none !important;
    font-size: 12px;
    font-weight: 600;
    letter-spacing: 0.01em;
    position: relative;
    transition: color .15s ease, transform .15s ease;
    -webkit-tap-highlight-color: transparent;
}

.baid-nav-btn {
    background: none;
    border: 0;
    cursor: pointer;
    font-family: inherit;
}

.baid-app-nav-item:hover,
.baid-app-nav-item:focus-visible {
    color: var(--baid-nav-muted-hover);
    text-decoration: none !important;
}

.baid-app-nav-item:focus-visible {
    outline: 2px solid var(--baid-nav-active);
    outline-offset: 2px;
    border-radius: 12px;
}

/* Pill autour de l'icône (état hover/actif) */
.baid-nav-pill {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    width: 40px;
    height: 28px;
    border-radius: 14px;
    transition: background .2s ease, transform .15s ease, box-shadow .2s ease;
    position: relative;
}

.baid-nav-pill i {
    font-size: 20px;
    line-height: 1;
    pointer-events: none;
}

.baid-nav-label {
    font-size: 12px;
    font-weight: 600;
    line-height: 1.1;
    pointer-events: none;
}

/* État actif : pill colorée gradient + scale + couleur active */
.baid-app-nav-item.is-active {
    color: var(--baid-nav-active);
}

.baid-app-nav-item.is-active .baid-nav-pill {
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.18), rgba(236, 72, 153, 0.18));
    box-shadow: 0 2px 8px rgba(108, 92, 231, 0.20);
    transform: scale(1.05);
}

/* Tap feedback */
.baid-app-nav-item:active .baid-nav-pill {
    transform: scale(0.94);
}

/* ───────────── Badge notifs ───────────── */
.baid-nav-badge {
    position: absolute;
    top: -2px;
    right: -2px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    border-radius: 9px;
    background: #ef4444;
    color: #fff;
    font-size: 10px;
    font-weight: 700;
    line-height: 18px;
    text-align: center;
    box-shadow: 0 0 0 2px #fff;
    pointer-events: none;
}

/* ───────────── Avatar perso (item 5) ───────────── */
.baid-nav-avatar .baid-nav-avatar-wrap {
    position: relative;
    width: 30px;
    height: 30px;
    border-radius: 50%;
    overflow: visible;
    display: inline-flex;
    align-items: center;
    justify-content: center;
}

.baid-nav-avatar-img {
    width: 28px;
    height: 28px;
    border-radius: 50%;
    object-fit: cover;
    display: block;
    background: #e2e8f0;
    border: 2px solid transparent;
}

/* Ring streak gradient orange/rouge */
.baid-nav-avatar.has-streak .baid-nav-avatar-wrap::before {
    content: '';
    position: absolute;
    inset: -2px;
    border-radius: 50%;
    background: conic-gradient(from 0deg, var(--baid-streak-1), var(--baid-streak-2), var(--baid-streak-1));
    z-index: 0;
}

.baid-nav-avatar.has-streak .baid-nav-avatar-img {
    position: relative;
    z-index: 1;
    border: 2px solid #fff;
}

.baid-nav-streak-flame {
    position: absolute;
    bottom: -4px;
    right: -6px;
    font-size: 12px;
    line-height: 1;
    z-index: 2;
    filter: drop-shadow(0 1px 2px rgba(0, 0, 0, 0.25));
}

/* État actif sur l'avatar : on garde le ring streak prioritaire */
.baid-nav-avatar.is-active {
    color: var(--baid-nav-active);
}

/* ───────────── FAB central (item 3) ───────────── */
.baid-app-nav-fab {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: flex-start;
    padding: 0 0 4px;
    margin-top: -8px;       /* dépasse vers le haut */
    background: transparent;
    border: 0;
    cursor: pointer;
    color: var(--baid-nav-muted-hover);
    font-family: inherit;
    -webkit-tap-highlight-color: transparent;
}

.baid-nav-fab-circle {
    width: 56px;
    height: 56px;
    border-radius: 50%;
    background: linear-gradient(135deg, var(--baid-nav-grad-1), var(--baid-nav-grad-2));
    color: #fff;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    box-shadow: 0 6px 16px rgba(108, 92, 231, 0.40), 0 2px 6px rgba(236, 72, 153, 0.25);
    transition: transform .15s ease, box-shadow .2s ease;
    border: 3px solid #fff;
}

.baid-nav-fab-circle i {
    font-size: 22px;
    line-height: 1;
}

.baid-app-nav-fab:hover .baid-nav-fab-circle,
.baid-app-nav-fab:focus-visible .baid-nav-fab-circle {
    transform: translateY(-2px);
    box-shadow: 0 10px 22px rgba(108, 92, 231, 0.45), 0 4px 8px rgba(236, 72, 153, 0.30);
}

.baid-app-nav-fab:active .baid-nav-fab-circle {
    transform: scale(0.95);
}

.baid-app-nav-fab:focus-visible {
    outline: none;
}

.baid-app-nav-fab:focus-visible .baid-nav-fab-circle {
    outline: 2px solid var(--baid-nav-active);
    outline-offset: 3px;
}

.baid-nav-label--fab {
    margin-top: 2px;
    font-size: 11px;
    color: var(--baid-nav-muted-hover);
}

/* ───────────── Décalage body pour ne pas passer sous le nav ───────────── */
body.baid-user-app {
    padding-bottom: calc(var(--baid-nav-h) + env(safe-area-inset-bottom, 0px)) !important;
    overflow-x: hidden;
}

/* Pousse l'éventuel FAB legacy au-dessus du nav */
.baid-fab {
    bottom: calc(var(--baid-nav-h) + env(safe-area-inset-bottom, 0px) + 1rem) !important;
}

/* ───────────── Backdrop des bottom sheets ───────────── */
.baid-sheet-backdrop {
    position: fixed;
    inset: 0;
    background: rgba(15, 23, 42, 0.60);
    backdrop-filter: blur(4px);
    -webkit-backdrop-filter: blur(4px);
    opacity: 0;
    transition: opacity .2s ease;
    z-index: 10000;
}

.baid-sheet-backdrop.is-open {
    opacity: 1;
}

/* ───────────── Bottom sheet ───────────── */
.baid-sheet {
    position: fixed;
    left: 0;
    right: 0;
    bottom: 0;
    background: #fff;
    border-top-left-radius: 20px;
    border-top-right-radius: 20px;
    box-shadow: 0 -8px 32px rgba(15, 23, 42, 0.18);
    max-height: 80vh;
    overflow-y: auto;
    padding: 8px 16px calc(20px + env(safe-area-inset-bottom, 0px));
    z-index: 10001;
    transform: translateY(100%);
    transition: transform .22s cubic-bezier(.22, 1, .36, 1);
    -webkit-overflow-scrolling: touch;
}

.baid-sheet.is-open {
    transform: translateY(0);
}

.baid-sheet-handle {
    width: 40px;
    height: 4px;
    background: #cbd5e1;
    border-radius: 2px;
    margin: 4px auto 12px;
}

.baid-sheet-header {
    display: flex;
    align-items: center;
    justify-content: space-between;
    margin-bottom: 8px;
    padding-bottom: 8px;
}

.baid-sheet-title {
    font-size: 17px;
    font-weight: 700;
    margin: 0;
    color: #0f172a;
}

.baid-sheet-close {
    width: 32px;
    height: 32px;
    border-radius: 50%;
    border: 0;
    background: #f1f5f9;
    color: #475569;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    cursor: pointer;
    transition: background .15s ease, color .15s ease;
}

.baid-sheet-close:hover,
.baid-sheet-close:focus-visible {
    background: #e2e8f0;
    color: #0f172a;
    outline: none;
}

.baid-sheet-body {
    display: flex;
    flex-direction: column;
    gap: 6px;
}

/* ───────────── Lignes module (sheet Modules) ───────────── */
.baid-sheet-item {
    display: flex;
    align-items: center;
    gap: 12px;
    padding: 12px 12px;
    border-radius: 12px;
    color: #0f172a;
    text-decoration: none !important;
    transition: background .15s ease, transform .12s ease;
}

.baid-sheet-item:hover,
.baid-sheet-item:focus-visible {
    background: #f8fafc;
    outline: none;
}

.baid-sheet-item:active {
    transform: scale(0.99);
}

.baid-sheet-icon {
    width: 40px;
    height: 40px;
    border-radius: 12px;
    background: linear-gradient(135deg, rgba(108, 92, 231, 0.10), rgba(236, 72, 153, 0.10));
    display: inline-flex;
    align-items: center;
    justify-content: center;
    font-size: 22px;
    flex-shrink: 0;
}

.baid-sheet-item-body {
    flex: 1;
    display: flex;
    flex-direction: column;
    gap: 2px;
    min-width: 0;
}

.baid-sheet-item-title {
    font-size: 15px;
    font-weight: 600;
    color: #0f172a;
}

.baid-sheet-item-desc {
    font-size: 12px;
    color: #64748b;
}

.baid-sheet-chev {
    color: #cbd5e1;
    font-size: 14px;
    flex-shrink: 0;
}

/* ───────────── Cartes (sheet Proposer) ───────────── */
.baid-sheet-body--cards {
    flex-direction: row;
    gap: 12px;
    padding-top: 4px;
}

.baid-sheet-card {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    gap: 8px;
    padding: 20px 14px;
    border-radius: 16px;
    text-decoration: none !important;
    color: #0f172a;
    text-align: center;
    transition: transform .15s ease, box-shadow .2s ease;
    min-width: 0;
}

.baid-sheet-card--idee {
    background: linear-gradient(135deg, #fef3c7, #fde68a);
}

.baid-sheet-card--probleme {
    background: linear-gradient(135deg, #fee2e2, #fecaca);
}

.baid-sheet-card:hover,
.baid-sheet-card:focus-visible {
    transform: translateY(-2px);
    box-shadow: 0 6px 18px rgba(15, 23, 42, 0.10);
    outline: none;
}

.baid-sheet-card:active {
    transform: scale(0.98);
}

.baid-sheet-card-emoji {
    font-size: 34px;
    line-height: 1;
}

.baid-sheet-card-title {
    font-size: 15px;
    font-weight: 700;
}

.baid-sheet-card-desc {
    font-size: 12px;
    color: #475569;
    font-weight: 500;
}

/* ───────────── Lock body scroll quand sheet ouverte ───────────── */
body.baid-sheet-locked {
    overflow: hidden;
}

/* ───────────── Responsive ───────────── */
@media (max-width: 380px) {
    .baid-nav-label {
        font-size: 11px;
    }
    .baid-nav-pill {
        width: 36px;
    }
    .baid-nav-fab-circle {
        width: 52px;
        height: 52px;
    }
    .baid-nav-fab-circle i {
        font-size: 20px;
    }
}

@media (min-width: 540px) {
    .baid-sheet {
        max-width: 540px;
        margin: 0 auto;
        border-top-left-radius: 20px;
        border-top-right-radius: 20px;
    }
}

/* ───────────── Respect prefers-reduced-motion ───────────── */
@media (prefers-reduced-motion: reduce) {
    .baid-app-nav,
    .baid-sheet,
    .baid-sheet-backdrop,
    .baid-nav-pill,
    .baid-nav-fab-circle,
    .baid-app-nav-item,
    .baid-sheet-card {
        transition: none !important;
    }
    .baid-app-nav.is-hidden {
        transform: none; /* on garde le nav visible si reduce motion */
    }
}
