/* ===================================
   Mobile Bottom Tab Bar Styles
   =================================== */

/* Hide desktop search button on mobile (since we have it in bottom tab bar) */
@media (max-width: 991.98px) {
    #btn-search {
        display: none !important;
    }
}

/* Hide by default on desktop, show only on mobile */
.mobile-bottom-tab-bar {
    display: none;
}

@media (max-width: 991.98px) {
    .site-header #top-account-container,
    .site-header #cart-panel-trigger {
        display: none;
    }

    .mobile-bottom-tab-bar {
        display: flex;
        position: fixed;
        bottom: 0;
        left: 0;
        right: 0;
        width: 100%;
        height: 60px;
        background-color: var(--surface-dark);
        border-top: 1px solid var(--border-dark);
        box-shadow: 0 -2px 10px rgba(0, 0, 0, 0.4);
        z-index: 9999;
        justify-content: space-around;
        align-items: center;
        padding: 0;
        margin: 0;
    }

    .mobile-bottom-tab-bar .tab-item {
        flex: 1;
        display: flex;
        flex-direction: column;
        align-items: center;
        justify-content: center;
        text-decoration: none;
        color: rgba(240, 240, 240, 0.6);
        font-size: 10px;
        font-weight: 500;
        font-family: "Poppins", sans-serif;
        transition: all 0.3s ease;
        padding: 8px 0;
        position: relative;
        cursor: pointer;
    }

    .mobile-bottom-tab-bar .tab-item i {
        font-size: 20px;
        margin-bottom: 4px;
        transition: all 0.3s ease;
    }

    .mobile-bottom-tab-bar .tab-item span {
        font-size: 10px;
        line-height: 12px;
    }

    /* Active tab state */
    .mobile-bottom-tab-bar .tab-item.active {
        color: var(--primary-color);
    }

    .mobile-bottom-tab-bar .tab-item.active i {
        color: var(--primary-color);
        transform: scale(1.1);
    }

    /* Hover/Touch effect */
    .mobile-bottom-tab-bar .tab-item:hover,
    .mobile-bottom-tab-bar .tab-item:active {
        color: var(--primary-color);
        background-color: rgba(255, 255, 255, 0.06);
    }

    /* Cart icon wrapper for badge positioning */
    .mobile-bottom-tab-bar .tab-icon-wrapper {
        position: relative;
        display: inline-block;
        margin-bottom: 4px;
    }

    .mobile-bottom-tab-bar .tab-icon-wrapper i {
        margin-bottom: 0;
    }

    /* Cart badge */
    .mobile-bottom-tab-bar .cart-badge {
        position: absolute;
        top: -8px;
        right: -10px;
        background-color: #dc3545;
        color: #ffffff;
        font-size: 10px;
        font-weight: 600;
        padding: 2px 5px;
        border-radius: 10px;
        min-width: 18px;
        height: 18px;
        display: flex;
        align-items: center;
        justify-content: center;
        line-height: 1;
    }

    /* Hide cart badge when count is 0 */
    .mobile-bottom-tab-bar .cart-badge:empty {
        display: none;
    }

    /* Add bottom padding to body to prevent content from being hidden behind tab bar */
    body {
        padding-bottom: 70px;
    }

    /* Reserve scroll space on the content wrapper; the body has a fixed height. */
    #wrapper {
        padding-bottom: 70px;
    }
}

/* Extra small phones (≤576px) */
@media (max-width: 576px) {
    .mobile-bottom-tab-bar {
        height: 56px;
    }

    .mobile-bottom-tab-bar .tab-item i {
        font-size: 18px;
    }

    .mobile-bottom-tab-bar .tab-item span {
        font-size: 9px;
    }

    body,
    #wrapper {
        padding-bottom: 66px;
    }
}

/* ===================================
   Mobile User Menu (Slide-up menu)
   =================================== */

.mobile-user-menu-overlay {
    display: none;
    position: fixed;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 10000;
    align-items: flex-end;
    animation: fadeIn 0.3s ease;
}

/* This file was never linked in base.html until this migration (a
   pre-existing bug, unrelated to Canvas/Rhythm) so this always-flex vs.
   toggled-.show mismatch with mobile-bottom-nav.js's classList.add/remove
   calls was previously masked by the stylesheet simply never loading. */
.mobile-user-menu-overlay.show {
    display: flex;
}

.mobile-user-menu {
    background-color: var(--surface-dark);
    width: 100%;
    border-radius: 20px 20px 0 0;
    box-shadow: 0 -5px 20px rgba(0, 0, 0, 0.15);
    animation: slideUp 0.3s ease;
    max-height: 70vh;
    overflow-y: auto;
}

.mobile-user-menu-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 20px;
    border-bottom: 1px solid var(--border-dark);
}

.mobile-user-menu-header h4 {
    margin: 0;
    font-size: 18px;
    font-weight: 600;
    font-family: "Poppins", sans-serif;
    color: var(--text-light);
}

.mobile-user-menu-header .mobile-menu-close-btn {
    background: none;
    border: none;
    font-size: 20px;
    color: rgba(240, 240, 240, 0.6);
    cursor: pointer;
    padding: 5px;
    transition: color 0.3s ease;
}

.mobile-user-menu-header .mobile-menu-close-btn:hover {
    color: var(--text-light);
}

.mobile-user-menu-content {
    padding: 10px 0 20px;
}

.mobile-user-menu-content .menu-item {
    display: flex;
    align-items: center;
    padding: 15px 20px;
    color: var(--text-light);
    font-size: 14px;
    font-weight: 500;
    font-family: "Poppins", sans-serif;
    text-decoration: none;
    transition: background-color 0.3s ease;
    border-bottom: 1px solid var(--border-dark);
}

.mobile-user-menu-content .menu-item:hover {
    background-color: rgba(255, 255, 255, 0.06);
}

.mobile-user-menu-content .menu-item i {
    margin-right: 15px;
    font-size: 18px;
    width: 24px;
    text-align: center;
    color: rgba(240, 240, 240, 0.6);
}

.mobile-user-menu-content .menu-item.logout {
    color: #dc3545;
}

.mobile-user-menu-content .menu-item.logout i {
    color: #dc3545;
}

/* Animations */
@keyframes fadeIn {
    from {
        opacity: 0;
    }
    to {
        opacity: 1;
    }
}

@keyframes slideUp {
    from {
        transform: translateY(100%);
    }
    to {
        transform: translateY(0);
    }
}
