/**
 * Mobile Bottom Navigation Styles
 *
 * Mobile app-style sticky bottom navigation bar
 * Only visible on mobile devices (≤768px)
 */

/* Container - Hidden by default on desktop */
.safaroto-mobile-nav {
    display: none;
}

/* Mobile styles */
@media screen and (max-width: 768px) {
    .safaroto-mobile-nav {
        display: block;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        z-index: 9999;
        background-color: #ffffff;
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        border-top: 1px solid #e0e0e0;
        padding-bottom: env(safe-area-inset-bottom); /* iOS safe area */
    }

    .mobile-nav-container {
        display: flex;
        justify-content: space-around;
        align-items: stretch;
        max-width: 100%;
        margin: 0 auto;
        padding: 0;
    }

    .mobile-nav-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        padding: 8px 4px;
        text-decoration: none;
        color: #767676;
        transition: all 0.2s ease;
        position: relative;
        min-height: 60px;
    }

    .mobile-nav-item:hover,
    .mobile-nav-item:focus {
        color: #222222;
        background-color: #f7f7f7;
        outline: none;
    }

    .mobile-nav-item.active {
        color: #26b8f3;
    }

    .mobile-nav-item.active .mobile-nav-icon {
        transform: scale(1.1);
    }

    /* Active state indicator */
    .mobile-nav-item.active::before {
        content: '';
        position: absolute;
        top: 0;
        left: 50%;
        transform: translateX(-50%);
        width: 30px;
        height: 2px;
        background-color: #26b8f3;
        border-radius: 0 0 2px 2px;
    }

    /* Override active state for primary button - don't apply active indicator */
    .mobile-nav-item-primary.active::before {
        display: none;
    }

    /* Icon styling */
    .mobile-nav-icon {
        font-size: 24px;
        margin-bottom: 4px;
        transition: transform 0.2s ease;
        display: flex;
        align-items: center;
        justify-content: center;
    }

    /* Avatar image styling */
    .mobile-nav-avatar {
        width: 28px;
        height: 28px;
        border-radius: 50%;
        object-fit: cover;
        border: 2px solid #e0e0e0;
        transition: all 0.2s ease;
    }

    .mobile-nav-item:hover .mobile-nav-avatar,
    .mobile-nav-item:focus .mobile-nav-avatar {
        border-color: #222222;
    }

    .mobile-nav-item.active .mobile-nav-avatar {
        border-color: #26b8f3;
        border-width: 2px;
    }

    /* Custom icon styling for Add Trip */
    .mobile-nav-custom-icon {
        width: 40px;
        height: 40px;
        object-fit: contain;
        /* Gray filter for inactive state - converts blue (#26b8f3) to gray (#767676) */
        filter: grayscale(100%) brightness(0.8);
        transition: filter 0.2s ease;
    }

    /* Active state - blue color like other nav items */
    .mobile-nav-item.active .mobile-nav-custom-icon {
        filter: none; /* Show original blue color */
    }

    /* Label styling */
    .mobile-nav-label {
        font-size: 11px;
        font-weight: 500;
        text-align: center;
        line-height: 1.2;
        white-space: nowrap;
    }

    /* Primary/Center button (Add Trip) - elevated style */
    .mobile-nav-item-primary {
        background-color: #ffffff;
        border-radius: 12px;
        margin: 0 4px;
        box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15),
                    0 2px 6px rgba(0, 0, 0, 0.1);
        transform: translateY(-8px);
        z-index: 10;
        color: #767676 !important; /* Keep gray when not active - using !important to override .mobile-nav-item.active */
    }

    .mobile-nav-item-primary .mobile-nav-icon {
        font-size: 24px;
        margin-bottom: 4px;
    }

    .mobile-nav-item-primary:hover,
    .mobile-nav-item-primary:focus {
        box-shadow: 0 6px 16px rgba(0, 0, 0, 0.2),
                    0 3px 8px rgba(0, 0, 0, 0.12);
        transform: translateY(-10px);
    }

    /* Only turn blue when active (matching the icon state) */
    .mobile-nav-item-primary.active {
        color: #26b8f3 !important;
    }

    /* Ensure content has bottom padding to prevent overlap */
    body.has-mobile-nav {
        padding-bottom: 70px;
    }
}

/* Tablet optimization */
@media screen and (min-width: 481px) and (max-width: 768px) {
    .mobile-nav-item {
        padding: 10px 8px;
    }

    .mobile-nav-icon {
        font-size: 26px;
    }

    .mobile-nav-avatar {
        width: 32px;
        height: 32px;
    }

    .mobile-nav-custom-icon {
        width: 32px;
        height: 32px;
    }

    .mobile-nav-label {
        font-size: 12px;
    }

    .mobile-nav-item-primary {
        border-radius: 14px;
        margin: 0 6px;
    }

    .mobile-nav-item-primary .mobile-nav-icon {
        font-size: 26px;
    }
}

/* Dark mode support (optional) */
@media (prefers-color-scheme: dark) {
    @media screen and (max-width: 768px) {
        .safaroto-mobile-nav {
            background-color: #ffffff; /* Keep white background even in dark mode for consistent mobile browser chrome */
            border-top-color: #e0e0e0;
            box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
        }

        .mobile-nav-item {
            color: #666666; /* Darker text for white background */
        }

        .mobile-nav-item:hover,
        .mobile-nav-item:focus {
            color: #333333;
            background-color: #f7f7f7;
        }

        .mobile-nav-item.active {
            color: #26b8f3;
        }

        .mobile-nav-item-primary {
            color: #26b8f3;
        }
    }
}

/* Accessibility improvements */
.mobile-nav-item:focus-visible {
    outline: 2px solid #26b8f3;
    outline-offset: -2px;
}

/* Print styles - hide on print */
@media print {
    .safaroto-mobile-nav {
        display: none !important;
    }
}
