/* ============================================
   MOBILE BOTTOM NAVIGATION
   App-like bottom navigation bar for mobile
   ============================================ */

.mobile-bottom-nav {
    display: none; /* Hidden by default, shown on mobile */
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    width: 100%;
    background: var(--bg-color);
    border-top: 1px solid var(--border-color);
    box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
    z-index: 9997;
    padding: 0;
    margin: 0;
    align-items: stretch;
    -webkit-align-items: stretch; /* Safari/Opera support */
    justify-content: space-around;
    -webkit-justify-content: space-around; /* Safari/Opera support */
    height: 64px;
    min-height: 64px;
    max-height: 64px;
    /* Safe area for devices with notches - add to height, not padding */
    height: calc(64px + env(safe-area-inset-bottom));
    height: calc(64px + constant(safe-area-inset-bottom)); /* iOS 11.0-11.2 */
    height: 64px; /* Fallback */
    /* Prevent movement when browser bars show/hide - use hardware acceleration */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Force GPU acceleration to prevent shifting */
    will-change: transform;
    /* Lock to viewport bottom - don't move with scroll */
    position: fixed !important;
    bottom: 0 !important;
    /* Prevent any layout shifts */
    contain: layout style paint;
}

/* Hide on desktop */
@media (min-width: 969px) {
    .mobile-bottom-nav {
        display: none !important;
    }
}

/* Show on mobile/tablet */
@media (max-width: 968px) {
    .mobile-bottom-nav {
        display: flex !important;
        display: -webkit-flex !important; /* Safari/Opera support */
        /* Ensure it stays fixed at bottom even when browser bars change */
        position: fixed !important;
        bottom: 0 !important;
        left: 0 !important;
        right: 0 !important;
        /* Prevent layout shifts when browser UI shows/hides */
        transform: translate3d(0, 0, 0) !important;
        -webkit-transform: translate3d(0, 0, 0) !important;
        backface-visibility: hidden !important;
        -webkit-backface-visibility: hidden !important;
        /* Lock to viewport bottom - never move */
        will-change: transform;
        /* Prevent any movement */
        contain: layout style paint;
        /* Hide when drawer is open */
        transition: opacity 0.3s ease, visibility 0.3s ease;
        -webkit-transition: opacity 0.3s ease, visibility 0.3s ease;
    }
    
    /* Hide bottom nav when drawer is open */
    body.drawer-open .mobile-bottom-nav {
        opacity: 0;
        visibility: hidden;
        pointer-events: none;
    }
    
    /* Add padding to body to prevent content from being hidden behind bottom nav */
    /* Use calc to account for safe area */
    body {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
        padding-bottom: calc(64px + constant(safe-area-inset-bottom)); /* iOS 11.0-11.2 */
        padding-bottom: 64px; /* Fallback */
    }
}

.mobile-bottom-nav-item {
    flex: 1;
    -webkit-flex: 1; /* Safari/Opera support */
    display: flex;
    display: -webkit-flex; /* Safari/Opera support */
    flex-direction: column;
    -webkit-flex-direction: column; /* Safari/Opera support */
    align-items: center;
    -webkit-align-items: center; /* Safari/Opera support */
    justify-content: center;
    -webkit-justify-content: center; /* Safari/Opera support */
    gap: 4px;
    /* Fallback for older Safari */
    margin-bottom: 4px;
    padding: 8px 4px;
    padding-bottom: calc(8px + env(safe-area-inset-bottom));
    padding-bottom: calc(8px + constant(safe-area-inset-bottom)); /* iOS 11.0-11.2 */
    padding-bottom: 8px; /* Fallback */
    text-decoration: none;
    color: var(--text-color);
    background: transparent;
    border: none;
    cursor: pointer;
    transition: all 0.2s ease;
    -webkit-transition: all 0.2s ease; /* Safari/Opera support */
    position: relative;
    -webkit-appearance: none;
    -moz-appearance: none;
    appearance: none;
    font-family: inherit;
    font-size: inherit;
    min-width: 0;
    /* Prevent movement/shifting - hardware acceleration */
    transform: translate3d(0, 0, 0);
    -webkit-transform: translate3d(0, 0, 0);
    backface-visibility: hidden;
    -webkit-backface-visibility: hidden;
    /* Lock position */
    will-change: auto;
    /* Prevent layout shifts */
    contain: layout style;
    /* Ensure links are clickable */
    pointer-events: auto;
    z-index: 1;
}

@supports (gap: 4px) {
    .mobile-bottom-nav-item {
        margin-bottom: 0;
    }
}

.mobile-bottom-nav-item i {
    font-size: 1.5rem;
    opacity: 0.7;
    transition: all 0.2s ease;
    -webkit-transition: all 0.2s ease; /* Safari/Opera support */
    color: var(--text-color);
}

/* SVG Icon Styling */
.mobile-bottom-nav-icon {
    width: 24px;
    height: 24px;
    opacity: 0.7;
    transition: all 0.2s ease;
    -webkit-transition: all 0.2s ease; /* Safari/Opera support */
    color: var(--text-color);
    stroke: currentColor;
    flex-shrink: 0;
}

.mobile-bottom-nav-item span {
    font-size: 0.7rem;
    font-weight: 500;
    line-height: 1.2;
    opacity: 0.8;
    transition: all 0.2s ease;
    -webkit-transition: all 0.2s ease; /* Safari/Opera support */
    color: var(--text-color);
    text-align: center;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
}

/* Active state */
.mobile-bottom-nav-item.active {
    color: var(--accent-color-1);
}

.mobile-bottom-nav-item.active i {
    opacity: 1;
    color: var(--accent-color-1);
    transform: scale(1.1);
    -webkit-transform: scale(1.1); /* Safari/Opera support */
}

.mobile-bottom-nav-item.active .mobile-bottom-nav-icon {
    opacity: 1;
    color: var(--accent-color-1);
    transform: scale(1.1);
    -webkit-transform: scale(1.1); /* Safari/Opera support */
}

.mobile-bottom-nav-item.active span {
    opacity: 1;
    color: var(--accent-color-1);
    font-weight: 600;
}

/* Hover state */
.mobile-bottom-nav-item:hover,
.mobile-bottom-nav-item:focus {
    background: var(--hover-bg);
    color: var(--accent-color-1);
    outline: none;
}

.mobile-bottom-nav-item:hover i,
.mobile-bottom-nav-item:focus i {
    opacity: 1;
    color: var(--accent-color-1);
    transform: scale(1.1);
    -webkit-transform: scale(1.1); /* Safari/Opera support */
}

.mobile-bottom-nav-item:hover .mobile-bottom-nav-icon,
.mobile-bottom-nav-item:focus .mobile-bottom-nav-icon {
    opacity: 1;
    color: var(--accent-color-1);
    transform: scale(1.1);
    -webkit-transform: scale(1.1); /* Safari/Opera support */
}

.mobile-bottom-nav-item:hover span,
.mobile-bottom-nav-item:focus span {
    opacity: 1;
    color: var(--accent-color-1);
}

/* Active state for hamburger menu button */
.mobile-bottom-nav-menu[aria-expanded="true"] {
    background: var(--hover-bg);
    color: var(--accent-color-1);
}

.mobile-bottom-nav-menu[aria-expanded="true"] i {
    opacity: 1;
    color: var(--accent-color-1);
}

.mobile-bottom-nav-menu[aria-expanded="true"] .mobile-bottom-nav-icon {
    opacity: 1;
    color: var(--accent-color-1);
}

.mobile-bottom-nav-menu[aria-expanded="true"] span {
    opacity: 1;
    color: var(--accent-color-1);
    font-weight: 600;
}

/* Touch feedback */
.mobile-bottom-nav-item:active {
    background: var(--hover-bg);
    transform: scale(0.95);
    -webkit-transform: scale(0.95); /* Safari/Opera support */
}

/* Smaller screens - adjust font sizes */
@media (max-width: 480px) {
    .mobile-bottom-nav {
        height: 60px;
        max-height: 60px;
    }
    
    body {
        padding-bottom: 60px;
        padding-bottom: calc(60px + env(safe-area-inset-bottom));
    }
    
    .mobile-bottom-nav-item {
        padding: 6px 2px;
        gap: 3px;
    }
    
    .mobile-bottom-nav-item i {
        font-size: 1.3rem;
    }
    
    .mobile-bottom-nav-item .mobile-bottom-nav-icon {
        width: 20px;
        height: 20px;
    }
    
    .mobile-bottom-nav-item span {
        font-size: 0.65rem;
    }
    
    .mobile-bottom-nav-add-post {
        margin: 6px 3px;
        padding: 4px 2px !important;
    }
    
    .mobile-bottom-nav-add-post i {
        font-size: 1.5rem !important;
    }
    
    .mobile-bottom-nav-add-post .mobile-bottom-nav-icon {
        width: 22px !important;
        height: 22px !important;
    }
    
    .mobile-bottom-nav-add-post span {
        font-size: 0.65rem !important;
    }
}

/* Very small screens - icon only */
@media (max-width: 360px) {
    .mobile-bottom-nav-item span {
        font-size: 0.6rem;
    }
    
    .mobile-bottom-nav-item i {
        font-size: 1.2rem;
    }
    
    .mobile-bottom-nav-item .mobile-bottom-nav-icon {
        width: 18px;
        height: 18px;
    }
}

/* Ensure content doesn't get hidden behind bottom nav */
@media (max-width: 968px) {
    .site-main {
        margin-bottom: calc(64px + env(safe-area-inset-bottom));
        margin-bottom: calc(64px + constant(safe-area-inset-bottom)); /* iOS 11.0-11.2 */
        margin-bottom: 64px; /* Fallback */
    }
    
    .main-content-wrapper {
        padding-bottom: calc(64px + env(safe-area-inset-bottom));
        padding-bottom: calc(64px + constant(safe-area-inset-bottom)); /* iOS 11.0-11.2 */
        padding-bottom: 64px; /* Fallback */
    }
}

/* Center Add Post Button - Prominent styling */
.mobile-bottom-nav-add-post {
    background: var(--accent-color-1) !important;
    color: white !important;
    border-radius: 12px;
    margin: 8px 4px;
    flex: 1.3; /* Slightly larger than other items for more space */
    min-width: 65px; /* Ensure minimum width for text */
    padding: 8px 4px !important;
}

.mobile-bottom-nav-add-post i {
    color: white !important;
    opacity: 1 !important;
    font-size: 1.75rem !important;
}

.mobile-bottom-nav-add-post .mobile-bottom-nav-icon {
    color: white !important;
    opacity: 1 !important;
    width: 26px !important;
    height: 26px !important;
    stroke-width: 2.5;
}

.mobile-bottom-nav-add-post span {
    color: white !important;
    opacity: 1 !important;
    font-weight: 600 !important;
    overflow: visible !important;
    text-overflow: clip !important;
    white-space: nowrap !important;
    max-width: 100% !important;
    display: block !important;
}

.mobile-bottom-nav-add-post:hover,
.mobile-bottom-nav-add-post:focus {
    background: var(--accent-color-2) !important;
    color: white !important;
}

.mobile-bottom-nav-add-post:hover i,
.mobile-bottom-nav-add-post:focus i {
    color: white !important;
    opacity: 1 !important;
    transform: scale(1.1);
    -webkit-transform: scale(1.1);
}

.mobile-bottom-nav-add-post:active {
    background: var(--accent-color-1) !important;
    transform: scale(0.95);
    -webkit-transform: scale(0.95);
}

