/* ==========================================================================
   AFRISANTE — Bottom Navigation mobile (PWA style)
   ========================================================================== */

.bottom-nav {
    display: none;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: white;
    border-top: 1px solid var(--gray-200);
    box-shadow: 0 -4px 16px rgba(0,0,0,0.08);
    z-index: var(--z-fixed);
    padding: 0 4px calc(0px + env(safe-area-inset-bottom));
    height: 64px;
}

.bottom-nav-inner {
    display: flex;
    align-items: stretch;
    max-width: 640px;
    margin: 0 auto;
    height: 100%;
    position: relative;
}

.bottom-nav-item {
    flex: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 2px;
    padding: 6px 4px;
    color: var(--gray-500);
    text-decoration: none;
    font-size: 11px;
    font-weight: 500;
    transition: color var(--transition-fast);
    position: relative;
    line-height: 1;
}

.bottom-nav-item svg,
.bottom-nav-item i {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
}

.bottom-nav-item.active {
    color: var(--primary);
}

.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 28px;
    height: 3px;
    background: var(--primary);
    border-radius: 0 0 3px 3px;
}

/* BOUTON CENTRAL PRIMARY : bien centré grâce à flex + alignement inner */
.bottom-nav-item.primary {
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white !important;
    border-radius: 50%;
    width: 54px;
    height: 54px;
    flex: 0 0 54px;
    padding: 0;
    margin: 0 8px;
    align-self: center;
    transform: translateY(-14px);
    box-shadow: 0 4px 16px rgba(10, 110, 189, 0.45), 0 0 0 4px white;
    display: flex;
    align-items: center;
    justify-content: center;
}

.bottom-nav-item.primary svg,
.bottom-nav-item.primary i {
    width: 24px;
    height: 24px;
    stroke-width: 2.2;
}

/* Pas de label sous bouton primary */
.bottom-nav-item.primary span { display: none; }

.bottom-nav-item .badge-dot {
    position: absolute;
    top: 8px;
    right: 28%;
    width: 8px;
    height: 8px;
    background: var(--danger);
    border-radius: 50%;
    border: 2px solid white;
}

@media (max-width: 900px) {
    .bottom-nav {
        display: block;
    }
    body {
        padding-bottom: calc(80px + env(safe-area-inset-bottom));
    }
    .sidebar:not(.open) {
        display: none !important;
    }
    .dashboard {
        grid-template-columns: 1fr !important;
    }
    .dashboard-main {
        padding: var(--space-4) !important;
    }
    /* Responsive fixes */
    .dashboard-header {
        flex-direction: column;
        align-items: flex-start !important;
    }
    .dashboard-header > :nth-child(2) {
        width: 100%;
    }
    h1.dashboard-title {
        font-size: var(--text-xl) !important;
        word-wrap: break-word;
    }
    h1 {
        font-size: var(--text-2xl) !important;
        word-wrap: break-word;
    }
    .stats-grid {
        grid-template-columns: 1fr 1fr !important;
        gap: var(--space-3) !important;
    }
    .stat-card {
        padding: var(--space-3) !important;
    }
    .stat-value {
        font-size: var(--text-lg) !important;
    }
    .toast-container {
        left: var(--space-2) !important;
        right: var(--space-2) !important;
        top: var(--space-2) !important;
    }
    .toast {
        min-width: auto !important;
        max-width: 100% !important;
    }
    /* Hero landing : réduire padding mobile */
    .hero {
        padding-block: var(--space-6) var(--space-8) !important;
    }
    /* Empêcher débordement horizontal */
    html, body {
        overflow-x: hidden !important;
        max-width: 100vw;
    }
    .carousel-slide {
        padding: var(--space-4) !important;
        height: 240px !important;
    }
    .carousel-slide h2 {
        font-size: var(--text-lg) !important;
    }
}

/* ==========================================================================
   PWA MODE : masquer footer/navbar quand installée en standalone
   ========================================================================== */
@media all and (display-mode: standalone) {
    .footer,
    .navbar {
        display: none !important;
    }
    body {
        padding-top: env(safe-area-inset-top);
    }
    .pwa-install-banner {
        display: none !important;
    }
    .dashboard-main, main {
        padding-top: calc(var(--space-4) + env(safe-area-inset-top)) !important;
    }
}

/* Install prompt PWA */
.pwa-install-banner {
    position: fixed;
    bottom: 80px;
    left: var(--space-4);
    right: var(--space-4);
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    color: white;
    padding: var(--space-4);
    border-radius: var(--radius-lg);
    box-shadow: var(--shadow-xl);
    z-index: var(--z-fixed);
    display: none;
    align-items: center;
    gap: var(--space-3);
    animation: slideInUp 400ms ease;
}

.pwa-install-banner.show { display: flex; }
.pwa-install-banner.dismissed { display: none !important; }

@media (min-width: 900px) {
    .pwa-install-banner { display: none !important; }
}
