/* ========================================
   MOBILE BOTTOM NAVIGATION BAR
   Component: Mobile Bottom Nav Bar
   Shopee-style design with icons and labels
   ======================================== */

.mobile-bottom-nav {
    position: fixed !important;
    top: auto !important;
    bottom: 0 !important;
    left: 0 !important;
    right: 0 !important;
    width: 100% !important;
    background: white !important;
    box-shadow: 0 -4px 20px rgba(0, 0, 0, 0.15) !important;
    z-index: 99999 !important;
    display: none;
    justify-content: space-around !important;
    align-items: center !important;
    height: 70px !important;
    padding: 0 !important;
    padding-bottom: env(safe-area-inset-bottom, 10px) !important;
    border-top: 2px solid rgba(0, 0, 0, 0.1) !important;
}

/* Show only on mobile devices (max-width: 968px) */
@media (max-width: 968px) {
    .mobile-bottom-nav {
        display: flex !important;
    }

    /* Add padding to body to prevent content from hiding behind bottom nav */
    body {
        padding-bottom: 70px;
    }

    /* Adjust back-to-top button position on mobile */
    .back-to-top {
        bottom: 90px; /* Move up to avoid overlap with bottom nav */
    }

    .back-to-top.show {
        bottom: 90px;
    }
}

/* Individual bottom nav items */
.bottom-nav-item {
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    flex: 1;
    min-width: 44px;
    min-height: 44px;
    padding: 8px 4px;
    text-decoration: none;
    color: var(--gray-600);
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    position: relative;
    cursor: pointer;
    gap: 4px;
}

/* Active state indicator - top border */
.bottom-nav-item::before {
    content: '';
    position: absolute;
    top: 0;
    left: 50%;
    transform: translateX(-50%);
    width: 0;
    height: 3px;
    background: linear-gradient(135deg, var(--primary), var(--secondary));
    border-radius: 0 0 3px 3px;
    transition: width 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

/* Active state background */
.bottom-nav-item::after {
    content: '';
    position: absolute;
    inset: 0;
    background: linear-gradient(135deg, rgba(30, 64, 175, 0.05), rgba(249, 115, 22, 0.05));
    opacity: 0;
    transition: opacity 0.3s ease;
    z-index: -1;
}

/* Hover effect */
.bottom-nav-item:hover {
    color: var(--primary);
    background: rgba(30, 64, 175, 0.05);
}

.bottom-nav-item:hover .bottom-nav-icon {
    transform: scale(1.1);
}

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

.bottom-nav-item.active::before {
    width: 80%;
}

.bottom-nav-item.active::after {
    opacity: 1;
}

.bottom-nav-item.active .bottom-nav-icon {
    transform: scale(1.15);
    color: var(--primary);
}

.bottom-nav-item.active .bottom-nav-label {
    font-weight: 700;
    color: var(--primary);
}

/* Bottom nav icon */
.bottom-nav-icon {
    font-size: 20px;
    transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
    display: block;
    line-height: 1;
}

/* Bottom nav label */
.bottom-nav-label {
    font-size: 11px;
    font-weight: 500;
    text-align: center;
    line-height: 1.2;
    transition: all 0.3s ease;
    white-space: nowrap;
}

body.th .bottom-nav-label {
    font-size: 10px;
}

/* Focus visible state for accessibility */
.bottom-nav-item:focus-visible {
    outline: 3px solid var(--primary);
    outline-offset: -3px;
    border-radius: 8px;
}

/* Responsive adjustments for smaller screens */
@media (max-width: 768px) {
    .mobile-bottom-nav {
        height: 65px;
    }

    body {
        padding-bottom: 65px;
    }

    .back-to-top {
        bottom: 85px;
    }

    .back-to-top.show {
        bottom: 85px;
    }

    .bottom-nav-icon {
        font-size: 19px;
    }

    .bottom-nav-label {
        font-size: 10.5px;
    }

    body.th .bottom-nav-label {
        font-size: 9.5px;
    }
}

@media (max-width: 480px) {
    .mobile-bottom-nav {
        height: 60px;
    }

    body {
        padding-bottom: 60px;
    }

    .back-to-top {
        bottom: 80px;
    }

    .back-to-top.show {
        bottom: 80px;
    }

    .bottom-nav-item {
        padding: 6px 2px;
        gap: 3px;
    }

    .bottom-nav-icon {
        font-size: 18px;
    }

    .bottom-nav-label {
        font-size: 10px;
    }

    body.th .bottom-nav-label {
        font-size: 9px;
    }
}

@media (max-width: 480px) {
    .bottom-nav-item {
        padding: 14px 0px;
        gap: 3px;
    }
}

/* Small Phones - iPhone 6/7/8/SE - 375px */
@media (max-width: 375px) {
    .mobile-bottom-nav {
        height: 58px;
    }

    body {
        padding-bottom: 58px;
    }

    .back-to-top {
        bottom: 78px;
    }

    .back-to-top.show {
        bottom: 78px;
    }

    .bottom-nav-item {
        padding: 5px 2px;
        gap: 2px;
    }

    .bottom-nav-icon {
        font-size: 17px;
    }

    .bottom-nav-label {
        font-size: 9px;
    }

    body.th .bottom-nav-label {
        font-size: 8.5px;
    }
}

/* Extra Small Phones - iPhone 5/SE - 320px */
@media (max-width: 320px) {
    .mobile-bottom-nav {
        height: 55px;
    }

    body {
        padding-bottom: 55px;
    }

    .back-to-top {
        bottom: 75px;
    }

    .back-to-top.show {
        bottom: 75px;
    }

    .bottom-nav-item {
        padding: 4px 1px;
        gap: 2px;
    }

    .bottom-nav-icon {
        font-size: 16px;
    }

    .bottom-nav-label {
        font-size: 8px;
    }

    body.th .bottom-nav-label {
        font-size: 7.5px;
    }
}

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

    body {
        padding-bottom: 0 !important;
    }
}

/* Animation when bottom nav appears */
@media (max-width: 968px) {
    .mobile-bottom-nav {
        animation: slideUpNav 0.4s cubic-bezier(0.4, 0, 0.2, 1);
    }
}

@keyframes slideUpNav {
    from {
        transform: translateY(100%);
        opacity: 0;
    }
    to {
        transform: translateY(0);
        opacity: 1;
    }
}
