/* Bottom Navigation Bar Styles */

/* Main Container */
.bottom-nav {
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background: rgba(10, 10, 10, 0.98);
    backdrop-filter: blur(20px);
    -webkit-backdrop-filter: blur(20px);
    border-top: 1px solid rgba(0, 212, 255, 0.15);
    display: none;
    align-items: center;
    justify-content: space-around;
    padding: 0 var(--space-2);
    z-index: 90;
    box-shadow: 0 -2px 20px rgba(0, 0, 0, 0.3);
    transition: transform var(--transition-base);
    will-change: transform;
    contain: layout style;
}

/* Show only on mobile and tablet */
@media (max-width: 768px) {
    .bottom-nav {
        display: flex;
    }

    /* Reserve space with CSS custom property to prevent CLS */
    :root {
        --bottom-nav-height: 60px;
    }

    /* Use min-height instead of padding to prevent reflow */
    body::after {
        content: '';
        display: block;
        height: var(--bottom-nav-height);
    }

    /* Adjust footer spacing */
    .footer {
        margin-bottom: var(--bottom-nav-height);
    }
}

/* Navigation Items */
.bottom-nav-item {
    position: relative;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    gap: 4px;
    flex: 1;
    height: 100%;
    min-height: 48px; /* WCAG touch target minimum */
    color: var(--color-gray-400);
    text-decoration: none;
    transition: all var(--transition-fast);
    padding: 0 var(--space-2);
    min-width: 48px; /* WCAG touch target minimum */
    -webkit-tap-highlight-color: transparent;
    touch-action: manipulation;
    user-select: none; /* Prevent text selection on tap */
}

/* Icon Styling */
.bottom-nav-item svg {
    width: 22px;
    height: 22px;
    flex-shrink: 0;
    transition: all var(--transition-fast);
}

/* Text Label */
.bottom-nav-item span:not(.bottom-nav-badge) {
    font-size: 11px;
    font-weight: 500;
    letter-spacing: 0.2px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    max-width: 100%;
    transition: all var(--transition-fast);
}

/* Active State */
.bottom-nav-item.active {
    color: var(--color-primary);
}

.bottom-nav-item.active svg {
    transform: scale(1.1);
    filter: drop-shadow(0 0 8px rgba(0, 212, 255, 0.5));
}

.bottom-nav-item.active span:not(.bottom-nav-badge) {
    color: var(--color-primary);
    font-weight: 600;
}

/* Active Indicator */
.bottom-nav-item.active::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 30px;
    height: 2px;
    background: var(--gradient-secondary);
    border-radius: 0 0 4px 4px;
    animation: slideDown 0.3s ease-out;
}

/* Hover/Touch Effects */
@media (hover: hover) {
    .bottom-nav-item:hover {
        color: var(--color-primary);
    }

    .bottom-nav-item:hover svg {
        transform: translateY(-2px);
        filter: drop-shadow(0 2px 8px rgba(0, 212, 255, 0.3));
    }
}

/* Touch Feedback */
.bottom-nav-item:active {
    transform: scale(0.95);
    opacity: 0.8;
}

/* Cart Badge */
.bottom-nav-badge {
    position: absolute;
    top: 8px;
    right: 50%;
    transform: translateX(12px);
    min-width: 18px;
    height: 18px;
    padding: 0 5px;
    background: var(--color-accent);
    color: var(--color-white);
    font-size: 10px;
    font-weight: bold;
    border-radius: var(--radius-full);
    display: none;
    align-items: center;
    justify-content: center;
    box-shadow: 0 2px 8px rgba(239, 68, 68, 0.4);
    animation: badgePulse 2s ease-in-out infinite;
}

.bottom-nav-badge:not(:empty) {
    display: flex;
}

/* Badge Animation */
@keyframes badgePulse {
    0%, 100% {
        transform: translateX(12px) scale(1);
    }
    50% {
        transform: translateX(12px) scale(1.05);
    }
}

/* Slide Down Animation */
@keyframes slideDown {
    from {
        opacity: 0;
        transform: translateX(-50%) translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateX(-50%) translateY(0);
    }
}

/* Hide on Scroll (Optional) */
.bottom-nav.hidden {
    transform: translateY(100%);
}

/* Ripple Effect for Touch */
.bottom-nav-item::after {
    content: '';
    position: absolute;
    top: 50%;
    left: 50%;
    width: 0;
    height: 0;
    border-radius: 50%;
    background: rgba(0, 212, 255, 0.3);
    transform: translate(-50%, -50%);
    transition: width 0.5s, height 0.5s;
    pointer-events: none;
}

.bottom-nav-item:active::after {
    width: 100px;
    height: 100px;
}

/* Accessibility */
.bottom-nav-item:focus {
    outline: none;
    background: rgba(0, 212, 255, 0.05);
}

.bottom-nav-item:focus-visible {
    outline: 2px solid var(--color-primary);
    outline-offset: -2px;
    border-radius: var(--radius-lg);
}

/* Landscape Mode Adjustments */
@media (max-height: 500px) and (orientation: landscape) {
    .bottom-nav {
        height: 50px;
    }

    .bottom-nav-item svg {
        width: 18px;
        height: 18px;
    }

    .bottom-nav-item span:not(.bottom-nav-badge) {
        font-size: 10px;
    }

    body {
        padding-bottom: 50px;
    }
}

/* iPad/Tablet Specific */
@media (min-width: 768px) and (max-width: 1024px) {
    .bottom-nav {
        display: none; /* Hide by default on tablets, can be toggled */
    }

    .bottom-nav.show-tablet {
        display: flex;
    }
}

/* Dark Mode Support */
@media (prefers-color-scheme: dark) {
    .bottom-nav {
        background: rgba(5, 5, 5, 0.98);
        border-top-color: rgba(0, 212, 255, 0.1);
    }
}

/* High Contrast Mode */
@media (prefers-contrast: high) {
    .bottom-nav {
        border-top-width: 2px;
    }

    .bottom-nav-item.active {
        text-decoration: underline;
    }
}

/* Reduced Motion */
@media (prefers-reduced-motion: reduce) {
    .bottom-nav,
    .bottom-nav-item,
    .bottom-nav-item svg,
    .bottom-nav-item span {
        transition: none;
    }

    .bottom-nav-item::after {
        display: none;
    }

    @keyframes badgePulse {
        0%, 100% {
            transform: translateX(12px) scale(1);
        }
    }
}