/* ========================================
   BOTTOM MOBILE NAVBAR (FLOATING CAPSULE WITH SLIDING HIGHLIGHT)
   ======================================== */
.mobile-bottom-nav {
    display: none;
}

/* Desktop: masquer les éléments réservés au tiroir mobile */
.drawer-mobile-header {
    display: none;
}

.mobile-breve-overlay {
    display: none;
}

@media (max-width: 900px) {
    .mobile-bottom-nav {
        display: flex;
        position: fixed;
        bottom: max(12px, calc(env(safe-area-inset-bottom, 0px) - 8px));
        left: 16px;
        right: 16px;
        max-width: 345px;
        margin: 0 auto;
        height: 52px;
        background: rgba(255, 255, 255, 0.85);
        backdrop-filter: blur(20px);
        -webkit-backdrop-filter: blur(20px);
        border: 1px solid rgba(0, 0, 0, 0.06);
        border-radius: 26px;
        box-shadow: 0 10px 30px rgba(0, 0, 0, 0.08), 0 2px 4px rgba(0, 0, 0, 0.02);
        z-index: 1002;
        box-sizing: border-box;
        padding: 0 6px;
    }

    /* Capsule de fond qui glisse d'une icône à l'autre */
    .mobile-bottom-nav-bg-indicator {
        position: absolute;
        top: 6px;
        left: 0;
        width: 60px;
        height: 38px;
        border-radius: 19px;
        background: rgba(0, 43, 38, 0.06);
        transition: transform 0.35s cubic-bezier(0.25, 1, 0.5, 1), opacity 0.3s ease;
        z-index: 1;
        opacity: 0;
        pointer-events: none;
    }

    .mobile-bottom-nav .nav-item {
        display: flex;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        flex: 1;
        height: 100%;
        color: #7a8280 !important;
        position: relative;
        background: transparent !important;
        padding: 0;
        margin: 0;
        border-radius: 0;
        z-index: 2;
        transition: color 0.3s ease;
    }

    .mobile-bottom-nav .nav-item .nav-icon {
        width: 22px;
        height: 22px;
        margin-right: 0;
        margin-bottom: 0;
        background-color: currentColor;
    }

    /* Active selection capsule styling */
    .mobile-bottom-nav .nav-item.active {
        color: var(--resca-primary) !important;
    }

    /* Bouton central plus */
    .mobile-bottom-nav .plus-item {
        display: flex;
        align-items: center;
        justify-content: center;
        flex: 1;
        height: 100%;
        z-index: 3;
        position: relative;
        text-decoration: none;
    }

    .mobile-bottom-nav .plus-item .plus-icon {
        width: 38px;
        height: 38px;
        border-radius: 50%;
        background: var(--resca-primary);
        color: var(--resca-white);
        display: flex;
        align-items: center;
        justify-content: center;
        box-shadow: 0 4px 12px rgba(0, 43, 38, 0.3);
        transition: transform 0.2s cubic-bezier(0.175, 0.885, 0.32, 1.275), background-color 0.2s ease;
    }

    .mobile-bottom-nav .plus-item:active .plus-icon {
        transform: scale(0.9) rotate(90deg);
        background: var(--resca-accent);
        color: var(--resca-dark);
    }

    /* Dark Mode support */
    [data-theme="dark"] .mobile-bottom-nav {
        background: rgba(28, 28, 30, 0.85);
        border: 1px solid rgba(255, 255, 255, 0.08);
        box-shadow: 0 12px 30px rgba(0, 0, 0, 0.45), 0 2px 4px rgba(0, 0, 0, 0.1);
    }

    [data-theme="dark"] .mobile-bottom-nav-bg-indicator {
        background: rgba(166, 242, 232, 0.08);
    }

    [data-theme="dark"] .mobile-bottom-nav .nav-item {
        color: #8e8e93 !important;
    }

    [data-theme="dark"] .mobile-bottom-nav .plus-item .plus-icon {
        background: var(--resca-accent);
        color: var(--resca-dark);
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.4);
    }

    [data-theme="dark"] .mobile-bottom-nav .plus-item:active .plus-icon {
        background: var(--resca-primary);
        color: var(--resca-white);
    }

    /* =============================================
       OVERLAY MOBILE POUR LE TIROIR DE BRÈVE
       ============================================= */
    .mobile-breve-overlay {
        display: block !important;
        position: fixed;
        top: 0;
        left: 0;
        right: 0;
        bottom: 0;
        background: rgba(0, 0, 0, 0.5);
        backdrop-filter: blur(4px);
        -webkit-backdrop-filter: blur(4px);
        z-index: 1004;
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
        transition: opacity 0.35s ease, visibility 0s linear 0.35s;
    }

    .mobile-breve-overlay.active {
        opacity: 1;
        visibility: visible;
        pointer-events: auto;
        transition: opacity 0.35s ease, visibility 0s linear 0s;
    }

    /* =============================================
       TIROIR DE RÉDACTION MOBILE (COLONNE DE DROITE)
       ============================================= */
    .mobile-drawer-wrapper {
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        top: auto !important;
        width: 100% !important;
        max-width: 100% !important;
        background: var(--resca-bg-light, #f5f5f5) !important;
        z-index: 1005 !important;
        border-top-left-radius: 24px;
        border-top-right-radius: 24px;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0);
        padding: 20px 20px calc(80px + env(safe-area-inset-bottom)) 20px !important;
        max-height: 88vh;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        transform: translateY(100%);
        transition: transform 0.4s cubic-bezier(0.25, 1, 0.5, 1), box-shadow 0.4s ease;
        box-sizing: border-box;
    }

    .mobile-drawer-wrapper.drawer-open {
        transform: translateY(0) !important;
        box-shadow: 0 -10px 40px rgba(0, 0, 0, 0.18) !important;
    }

    /* Header du tiroir mobile */
    .drawer-mobile-header {
        display: flex !important;
        align-items: center;
        justify-content: space-between;
        margin-bottom: 15px;
        position: sticky;
        top: -20px;
        margin-top: -20px;
        background: linear-gradient(to bottom, var(--resca-bg-light, #f5f5f5) 50%, rgba(245, 245, 245, 0) 100%) !important;
        z-index: 15;
        padding: 20px 0 30px 0;
        border-bottom: none !important;
    }

    [data-theme="dark"] .drawer-mobile-header {
        background: linear-gradient(to bottom, var(--resca-bg-light, #1c1c1e) 50%, rgba(28, 28, 30, 0) 100%) !important;
    }

    .drawer-handle {
        width: 42px;
        height: 5px;
        background: var(--resca-border, #ccc);
        border-radius: 3px;
        position: absolute;
        top: 10px;
        left: 50%;
        transform: translateX(-50%);
        opacity: 0.8;
    }

    .drawer-mobile-title {
        font-size: 15px;
        font-weight: 700;
        color: var(--resca-dark, #1a1a1a);
        text-transform: uppercase;
        letter-spacing: 0.5px;
    }

    [data-theme="dark"] .drawer-mobile-title {
        color: var(--resca-white, #fff);
    }

    .drawer-close-btn {
        font-size: 28px;
        font-weight: 500;
        cursor: pointer;
        color: var(--resca-text-muted, #999);
        line-height: 1;
        padding: 0 5px;
        -webkit-tap-highlight-color: transparent;
    }

    /* Scroll Lock pour le corps */
    body.drawer-scroll-lock {
        overflow: hidden !important;
        touch-action: none;
    }

    /* Masquer le bouton flottant crayon sur mobile */
    .fab-btn {
        display: none !important;
    }
}

/* Gradient mask behind floating nav (PWA standalone only) */
.mobile-bottom-nav-mask {
    display: none;
}

@media (max-width: 900px) {
    @media (display-mode: standalone) {
        .mobile-bottom-nav-mask {
            display: block;
            position: fixed;
            bottom: 0;
            left: 0;
            right: 0;
            height: calc(85px + env(safe-area-inset-bottom, 0px));
            background: linear-gradient(to top,
                    rgba(242, 247, 247, 0.85) 0%,
                    rgba(242, 247, 247, 0.55) 45%,
                    rgba(242, 247, 247, 0) 100%);
            z-index: 1001;
            pointer-events: none;
        }

        [data-theme="dark"] .mobile-bottom-nav-mask {
            background: linear-gradient(to top,
                    rgba(0, 0, 0, 0.85) 0%,
                    rgba(0, 0, 0, 0.55) 45%,
                    rgba(0, 0, 0, 0) 100%);
        }
    }
}