/* ============================================
   Bottom Navigation Bar - Mobile Only
   Floating Bar Style - Icons Only
   Professional Design for E-commerce Apps
   ============================================ */

/* Hide on desktop - Mobile only */
@media (min-width: 768px) {
    .bottom-nav {
        display: none !important;
    }
    
    body {
        padding-bottom: 0 !important;
    }
}

/* Hide bottom nav on cart and checkout pages */
body.hide-bottom-nav .bottom-nav,
body.cart-page .bottom-nav,
body.checkout-page .bottom-nav {
    display: none !important;
}

body.cart-page,
body.checkout-page {
    padding-bottom: 0 !important;
}

/* Bottom Navigation Container - Floating Bar */
.bottom-nav {
    position: fixed;
    bottom: 12px;
    left: 50%;
    transform: translateX(-50%);
    width: calc(100% - 24px);
    max-width: 500px;
    height: 65px;
    padding: 10px 12px calc(10px + env(safe-area-inset-bottom));
    background: rgba(255, 255, 255, 0.65);
    backdrop-filter: blur(28px) saturate(180%);
    -webkit-backdrop-filter: blur(28px) saturate(180%);
    border: 1px solid rgba(255, 182, 193, 0.12);
    border-radius: 24px;
    box-shadow: 
        0 -4px 32px rgba(255, 182, 193, 0.10),
        0 -2px 16px rgba(255, 192, 203, 0.06),
        0 8px 24px rgba(255, 182, 193, 0.04),
        inset 0 1px 0 rgba(255, 255, 255, 0.95);
    display: flex;
    justify-content: space-around;
    align-items: center;
    z-index: 1000;
    transition: transform 0.3s cubic-bezier(0.4, 0, 0.2, 1),
                opacity 0.3s ease,
                box-shadow 0.3s ease,
                background 0.3s ease;
}

/* Fixed at bottom when scrolled to end */
.bottom-nav--fixed {
    position: fixed;
    bottom: 0;
    border-radius: 0;
    width: 100%;
    max-width: 100%;
    margin: 0;
    left: 0;
    transform: none;
}

/* Navigation Items */
.bottom-nav__item {
    display: flex;
    align-items: center;
    justify-content: center;
    width: 50px;
    height: 50px;
    padding: 0;
    color: #9CA3AF;
    text-decoration: none;
    position: relative;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    -webkit-tap-highlight-color: transparent;
    border-radius: 16px;
    flex: 0 0 auto;
}

/* Active Background Circle */
.bottom-nav__item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 42px;
    height: 42px;
    background: linear-gradient(135deg, rgba(255, 192, 203, 0.25) 0%, rgba(255, 182, 193, 0.18) 100%);
    border-radius: 14px;
    transition: transform 0.4s cubic-bezier(0.34, 1.56, 0.64, 1),
                background 0.3s ease;
    z-index: 0;
    opacity: 0;
}

.bottom-nav__item.active::before {
    transform: translate(-50%, -50%) scale(1);
    opacity: 1;
    background: linear-gradient(135deg, rgba(255, 192, 203, 0.35) 0%, rgba(255, 182, 193, 0.25) 100%);
    box-shadow: 
        0 4px 12px rgba(255, 192, 203, 0.3),
        inset 0 1px 0 rgba(255, 255, 255, 0.6);
}

/* Icons */
.bottom-nav__icon {
    font-size: 20px;
    line-height: 1;
    transition: all 0.35s cubic-bezier(0.34, 1.56, 0.64, 1);
    display: block;
    position: relative;
    z-index: 1;
    color: #9CA3AF;
}

.bottom-nav__item.active .bottom-nav__icon {
    color: #FFB6C1;
    transform: scale(1.15);
    filter: drop-shadow(0 2px 4px rgba(255, 182, 193, 0.5));
}

.bottom-nav__item:not(.active) .bottom-nav__icon {
    color: #9CA3AF;
}

/* Active State - Lift Effect */
.bottom-nav__item.active {
    color: #FFB6C1;
    transform: translateY(-3px);
}

/* Hover Effect (for devices that support it) */
@media (hover: hover) {
    .bottom-nav__item:hover:not(.active) {
        color: #FFB6C1;
        transform: translateY(-2px);
    }
    
    .bottom-nav__item:hover:not(.active) .bottom-nav__icon {
        transform: scale(1.08);
        color: #FFB6C1;
    }
    
    .bottom-nav__item:hover:not(.active)::before {
        transform: translate(-50%, -50%) scale(0.8);
        opacity: 0.4;
    }
}

/* Press/Tap Effect */
.bottom-nav__item:active {
    transform: translateY(-1px) scale(0.92);
    transition: transform 0.1s ease;
}

.bottom-nav__item.active:active {
    transform: translateY(-2px) scale(0.95);
}

/* Cart Badge Wrapper */
.bottom-nav__cart-wrapper {
    position: relative;
    display: flex;
    align-items: center;
    justify-content: center;
    width: 100%;
    height: 100%;
}

/* Cart Badge */
.bottom-nav__cart-badge {
    position: absolute;
    top: 6px;
    right: 6px;
    background: linear-gradient(135deg, #FFB6C1 0%, #FFC0CB 100%);
    color: #FFFFFF;
    border-radius: 10px;
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    display: none;
    align-items: center;
    justify-content: center;
    font-size: 10px;
    font-weight: 700;
    border: 2px solid #FFFFFF;
    box-shadow: 
        0 2px 8px rgba(255, 182, 193, 0.4),
        0 1px 3px rgba(0, 0, 0, 0.15),
        inset 0 1px 0 rgba(255, 255, 255, 0.4);
    z-index: 10;
    animation: badgePulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
    line-height: 1;
}

[dir="rtl"] .bottom-nav__cart-badge {
    right: auto;
    left: 8px;
}

@keyframes badgePulse {
    0% {
        transform: scale(0) rotate(-180deg);
        opacity: 0;
    }
    50% {
        transform: scale(1.15) rotate(5deg);
    }
    100% {
        transform: scale(1) rotate(0deg);
        opacity: 1;
    }
}

/* RTL Support */
[dir="rtl"] .bottom-nav {
    flex-direction: row-reverse;
}

/* Safe Area Support for Notched Devices */
@supports (padding: max(0px)) {
    .bottom-nav {
        padding-bottom: max(10px, calc(10px + env(safe-area-inset-bottom)));
        bottom: max(12px, calc(12px + env(safe-area-inset-bottom)));
    }
}

/* Smaller screens optimization */
@media (max-width: 360px) {
    .bottom-nav {
        width: calc(100% - 16px);
        height: 60px;
        padding: 8px 8px calc(8px + env(safe-area-inset-bottom));
        bottom: 8px;
        border-radius: 20px;
    }
    
    .bottom-nav__item {
        width: 44px;
        height: 44px;
    }
    
    .bottom-nav__item::before {
        width: 38px;
        height: 38px;
    }
    
    .bottom-nav__icon {
        font-size: 18px;
    }
    
    .bottom-nav__cart-badge {
        top: 4px;
        right: 4px;
        min-width: 16px;
        height: 16px;
        font-size: 9px;
        padding: 0 4px;
    }
    
    [dir="rtl"] .bottom-nav__cart-badge {
        left: 4px;
    }
}

/* Smooth scrolling support */
@supports (scroll-behavior: smooth) {
    .bottom-nav {
        scroll-margin-bottom: 85px;
    }
}

/* Body padding for bottom nav */
body {
    padding-bottom: 95px;
    position: relative;
}

/* Spacer for fixed bottom nav at end of page */
body::after {
    content: '';
    display: block;
    height: 0;
    transition: height 0.3s ease;
}

body.bottom-nav-fixed::after {
    height: 90px;
}

@media (max-width: 360px) {
    body {
        padding-bottom: 85px;
    }
    
    body.bottom-nav-fixed::after {
        height: 80px;
    }
}

/* Hide bottom nav when keyboard is open on mobile */
@media (max-height: 500px) {
    .bottom-nav {
        transform: translateX(-50%) translateY(calc(100% + 20px));
        opacity: 0;
        pointer-events: none;
    }
}

/* Accessibility */
.bottom-nav__item:focus-visible {
    outline: 3px solid rgba(255, 182, 193, 0.5);
    outline-offset: 4px;
    border-radius: 16px;
}

/* Loading state */
.bottom-nav--loading {
    opacity: 0.6;
    pointer-events: none;
}

/* Ripple effect on click */
.bottom-nav__item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%) scale(0);
    width: 50px;
    height: 50px;
    background: rgba(255, 182, 193, 0.25);
    border-radius: 50%;
    opacity: 0;
    transition: transform 0.5s ease, opacity 0.5s ease;
    z-index: 0;
    pointer-events: none;
}

.bottom-nav__item:active::after {
    transform: translate(-50%, -50%) scale(1.5);
    opacity: 1;
    transition: transform 0.3s ease, opacity 0.3s ease;
}

/* Dark mode support - Keep white blur even in dark mode */
@media (prefers-color-scheme: dark) {
    .bottom-nav {
        background: rgba(255, 255, 255, 0.8);
        backdrop-filter: blur(24px) saturate(180%);
        -webkit-backdrop-filter: blur(24px) saturate(180%);
        border-color: rgba(255, 182, 193, 0.2);
        box-shadow: 
            0 -4px 32px rgba(255, 182, 193, 0.15),
            0 -2px 16px rgba(255, 192, 203, 0.1),
            0 8px 24px rgba(255, 182, 193, 0.08),
            inset 0 1px 0 rgba(255, 255, 255, 0.95);
    }
    
    .bottom-nav__icon {
        color: #9CA3AF;
    }
    
    .bottom-nav__item.active .bottom-nav__icon {
        color: #FFB6C1;
    }
    
    .bottom-nav__item.active::before {
        background: linear-gradient(135deg, rgba(255, 192, 203, 0.35) 0%, rgba(255, 182, 193, 0.25) 100%);
        box-shadow: 
            0 4px 12px rgba(255, 192, 203, 0.3),
            inset 0 1px 0 rgba(255, 255, 255, 0.6);
    }
}

/* Enhanced animation for active state change */
@keyframes activePulse {
    0% {
        transform: translate(-50%, -50%) scale(0.8);
    }
    50% {
        transform: translate(-50%, -50%) scale(1.05);
    }
    100% {
        transform: translate(-50%, -50%) scale(1);
    }
}

.bottom-nav__item.active::before {
    animation: activePulse 0.4s cubic-bezier(0.34, 1.56, 0.64, 1);
}
