/* ===== Mobile Footer Component ===== */

/* Hide mobile footer by default (desktop) */
.mobile-footer {
    display: none;
}

/* Mobile-only display and styling */
@media (max-width: 991.18px) {
    /* Hide desktop footer on mobile */
    footer:not(.mobile-footer) {
        display: none !important;
    }
    
    /* Ensure main content has white background on mobile */
    main {
        background: white !important;
        margin-bottom: 0 !important;
    }
    
    /* Mobile footer container */
    .mobile-footer {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        background: white;
        border-top: 1px solid var(--gray-200);
        z-index: 1000;
        transform: translateY(0);
        transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1);
        will-change: transform;
        
        /* iOS safe area support */
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
    
    /* Hidden state */
    .mobile-footer.hidden {
        transform: translateY(100%);
    }
    
    /* Navigation container */
    .mobile-footer-nav {
        display: flex;
        justify-content: space-around;
        align-items: center;
        padding: 0;
        background: white;
    }
    
    /* Individual nav items */
    .mobile-footer-item,
    .rn-nav-item {
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        flex: 1;
        padding: 8px 4px;
        text-decoration: none;
        color: var(--gray-600);
        transition: all 0.2s ease;
        position: relative;
        cursor: pointer;
        -webkit-tap-highlight-color: transparent;
    }
    
    /* Icon styling */
    .mobile-footer-item i,
    .rn-nav-item i {
        font-size: 20px;
        margin-bottom: 4px;
        transition: transform 0.2s ease;
    }
    
    /* Text label */
    .mobile-footer-item span,
    .rn-nav-item span {
        font-size: 11px;
        font-weight: 500;
        white-space: nowrap;
        overflow: hidden;
        text-overflow: ellipsis;
        max-width: 60px;
    }
    
    /* Active state */
    .mobile-footer-item.active,
    .rn-nav-item.active {
        color: var(--primary-blue);
    }
    
    .mobile-footer-item.active i,
    .rn-nav-item.active i {
        transform: scale(1.1);
    }
    
    /* Hover/Touch feedback */
    .mobile-footer-item:active,
    .rn-nav-item:active {
        background-color: var(--gray-50);
        border-radius: 8px;
    }
    
    /* Touch interaction optimization */
    .mobile-footer-item::before,
    .rn-nav-item::before {
        content: '';
        position: absolute;
        top: -8px;
        bottom: -8px;
        left: -8px;
        right: -8px;
    }
    
    /* Notification badge (for future use) */
    .mobile-footer-item .badge {
        position: absolute;
        top: 0;
        right: 50%;
        transform: translateX(10px);
        background: var(--red-500);
        color: white;
        font-size: 10px;
        padding: 2px 4px;
        border-radius: 10px;
        min-width: 16px;
        text-align: center;
    }
    
    /* Adjust main content padding to account for footer */
    main {
        padding-bottom: calc(60px + env(safe-area-inset-bottom, 0)) !important;
        transition: padding-bottom 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    }
    
    /* Remove padding when footer is hidden */
    body.footer-hidden main {
        padding-bottom: 0 !important;
    }
}

/* Landscape mobile adjustments */
@media (max-width: 767px) and (orientation: landscape) {
    .mobile-footer-nav {
        padding: 6px 0;
    }
    
    .mobile-footer-item i,
    .rn-nav-item i {
        font-size: 18px;
        margin-bottom: 2px;
    }
    
    .mobile-footer-item span,
    .rn-nav-item span {
        font-size: 10px;
    }
}

/* Handle iOS Safari's dynamic viewport */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .mobile-footer {
        padding-bottom: env(safe-area-inset-bottom, 0);
    }
}

/* Dark mode support (future enhancement) */
@media (prefers-color-scheme: dark) {
    @media (max-width: 767px) {
        .mobile-footer {
            background: var(--gray-900);
            border-top-color: var(--gray-700);
        }
        
        .mobile-footer-nav {
            background: var(--gray-900);
        }
        
        .mobile-footer-item,
        .rn-nav-item {
            color: var(--gray-400);
        }
        
        .mobile-footer-item.active,
        .rn-nav-item.active {
            color: var(--primary-blue-light);
        }
        
        .mobile-footer-item:active,
        .rn-nav-item:active {
            background-color: var(--gray-800);
        }
    }
}

/* Accessibility improvements */
@media (prefers-reduced-motion: reduce) {
    .mobile-footer {
        transition: none;
    }
    
    .mobile-footer-item i,
    .rn-nav-item i {
        transition: none;
    }
}

/* High contrast mode support */
@media (prefers-contrast: high) {
    .mobile-footer {
        border-top-width: 2px;
    }
    
    .mobile-footer-item,
    .rn-nav-item {
        font-weight: 600;
    }
}