/**
 * Bottom Navigation Bar
 * Mobile-first sticky navigation
 */

:root {
    --bottom-nav-bg: #ffffff;
    --bottom-nav-color: #666666;
    --bottom-nav-active: #d32f2f;
    --bottom-nav-height: 60px;
    --bottom-nav-shadow: 0 -2px 10px rgba(0, 0, 0, 0.1);
}

/* Bottom Navigation Container */
.bottom-navigation {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    background: var(--bottom-nav-bg);
    box-shadow: var(--bottom-nav-shadow);
    z-index: 999;
    transform: translateY(0);
    transition: transform 0.3s ease-in-out;
    display: none;
}

/* Show on mobile only */
@media (max-width: 768px) {
    .bottom-navigation {
        display: block;
    }
    
    /* Add padding to body to prevent content hiding */
    body {
        padding-bottom: var(--bottom-nav-height);
    }
}

/* Hide on scroll */
.bottom-navigation.hide-on-scroll.hidden {
    transform: translateY(100%);
}

/* Navigation Container */
.bottom-nav-container {
    display: flex;
    justify-content: space-around;
    align-items: center;
    height: var(--bottom-nav-height);
    max-width: 100%;
    margin: 0 auto;
    padding: 0 8px;
}

/* Navigation Item */
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 44px;
    min-height: 44px;
    padding: 4px 8px;
    color: var(--bottom-nav-color);
    text-decoration: none;
    transition: all 0.2s ease;
    position: relative;
    cursor: pointer;
}

.bottom-nav-item:hover,
.bottom-nav-item:focus {
    color: var(--bottom-nav-active);
    outline: none;
}

.bottom-nav-item:active {
    transform: scale(0.95);
}

/* Active state */
.bottom-nav-item.active {
    color: var(--bottom-nav-active);
}

/* Icon */
.bottom-nav-icon {
    position: relative;
    width: 24px;
    height: 24px;
    margin-bottom: 2px;
}

.bottom-nav-icon svg {
    width: 100%;
    height: 100%;
    display: block;
}

/* Label */
.bottom-nav-label {
    font-size: 11px;
    font-weight: 500;
    line-height: 1;
    text-align: center;
    white-space: nowrap;
}

/* Badge (for cart count) */
.bottom-nav-badge {
    position: absolute;
    top: -4px;
    right: -6px;
    background: var(--bottom-nav-active);
    color: #ffffff;
    font-size: 10px;
    font-weight: 600;
    min-width: 16px;
    height: 16px;
    line-height: 16px;
    text-align: center;
    border-radius: 8px;
    padding: 0 4px;
    box-shadow: 0 1px 3px rgba(0, 0, 0, 0.2);
}

/* Animation for badge update */
@keyframes badgePulse {
    0%, 100% {
        transform: scale(1);
    }
    50% {
        transform: scale(1.2);
    }
}

.bottom-nav-badge.updated {
    animation: badgePulse 0.3s ease;
}

/* Ripple effect on tap */
.bottom-nav-item::before {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 0, 0, 0.1);
    transform: translate(-50%, -50%);
    transition: width 0.3s ease, height 0.3s ease;
}

.bottom-nav-item:active::before {
    width: 100%;
    height: 100%;
}

/* Accessibility - focus visible */
.bottom-nav-item:focus-visible {
    outline: 2px solid var(--bottom-nav-active);
    outline-offset: 2px;
}

/* Dark mode support */
@media (prefers-color-scheme: dark) {
    :root {
        --bottom-nav-bg: #1a1a1a;
        --bottom-nav-color: #cccccc;
        --bottom-nav-shadow: 0 -2px 10px rgba(0, 0, 0, 0.5);
    }
}

/* High contrast mode */
@media (prefers-contrast: high) {
    .bottom-navigation {
        border-top: 2px solid currentColor;
    }
}

/* Reduced motion */
@media (prefers-reduced-motion: reduce) {
    .bottom-navigation,
    .bottom-nav-item,
    .bottom-nav-item::before {
        transition: none;
    }
    
    .bottom-nav-badge.updated {
        animation: none;
    }
}

/* Safe area insets for devices with notch */
@supports (padding-bottom: env(safe-area-inset-bottom)) {
    .bottom-navigation {
        padding-bottom: env(safe-area-inset-bottom);
    }
    
    body {
        padding-bottom: calc(var(--bottom-nav-height) + env(safe-area-inset-bottom));
    }
}

/* Landscape mode adjustments */
@media (max-width: 768px) and (orientation: landscape) {
    :root {
        --bottom-nav-height: 48px;
    }
    
    .bottom-nav-label {
        display: none;
    }
    
    .bottom-nav-icon {
        margin-bottom: 0;
    }
}
