/* ===================================================================
   KINGCART AI - MASTER NAVIGATION STYLESHEET
   -------------------------------------------------------------------
   This file contains all styles for:
   1. Desktop Main Navigation (with dropdowns)
   2. Mobile PWA Bottom Navigation Bar
   3. Mobile Off-Canvas (Hamburger) Menu
=================================================================== */


/* =================================================================
   1. DESKTOP MAIN NAVIGATION BAR
   ================================================================= */
.nav-marketplace-container {
    padding: 0 1rem;
    background-color: #fff;
}

.nav-marketplace-list {
    display: flex;
    justify-content: center;
    align-items: center;
    list-style: none;
    margin: 0;
    padding: 0;
    height: 50px;
}

.nav-marketplace-item {
    position: relative;
    display: flex;
    align-items: center;
}

.nav-marketplace-link {
    display: flex;
    align-items: center;
    padding: 0 1rem;
    height: 100%;
    color: #343a40;
    text-decoration: none;
    font-weight: 500;
    border-bottom: 3px solid transparent;
    transition: color 0.2s ease-in-out, border-bottom-color 0.2s ease-in-out;
    margin: 0 0.25rem;
}

.nav-marketplace-item:hover > .nav-marketplace-link,
.nav-marketplace-item.active > .nav-marketplace-link {
    color: var(--theme-primary-color, #0d6efd);
    border-bottom-color: var(--theme-primary-color, #0d6efd);
}

.dropdown-arrow {
    font-size: 0.7em;
    margin-left: 0.5rem;
    transition: transform 0.2s ease;
}

.nav-marketplace-item.has-dropdown:hover .dropdown-arrow {
    transform: rotate(180deg);
}

.dropdown-menu-custom {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #fff;
    border: 1px solid #e9ecef;
    border-radius: 0.5rem;
    padding: 0.5rem 0;
    list-style: none;
    min-width: 200px;
    box-shadow: 0 0.5rem 1rem rgba(0,0,0,0.15);
    z-index: 1000;
}

.nav-marketplace-item.has-dropdown:hover .dropdown-menu-custom {
    display: block;
}

.dropdown-item-custom a {
    display: flex;
    align-items: center;
    padding: 0.5rem 1.25rem;
    color: #343a40;
    text-decoration: none;
    white-space: nowrap;
}

.dropdown-item-custom:hover > a,
.dropdown-item-custom.active > a {
    background-color: #f8f9fa;
    color: var(--theme-primary-color, #0d6efd);
}


/* ===================================================================
   2. MOBILE PWA BOTTOM NAVIGATION BAR
   - Visibility is controlled by the Blade @if statement.
   - This CSS assumes if the element exists, it should be visible.
   =================================================================== */

/* This rule adds padding to the page content so the fixed navigation
   bar doesn't overlap the footer or other content. */
body.pwa-nav-active {
    padding-bottom: 60px !important;
}

.mobile-bottom-nav-marketplace {
    /* THE FINAL FIX: Force visibility with !important */
    display: flex !important;
    position: fixed;
    bottom: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: #ffffff;
    border-top: 1px solid #e9ecef;
    box-shadow: 0 -2px 5px rgba(0, 0, 0, 0.05);
    z-index: 1000; /* High z-index to stay on top */
}

.mobile-bottom-nav-marketplace ul {
    display: flex;
    justify-content: space-around;
    align-items: stretch; /* Make items take full height */
    width: 100%;
    height: 100%;
    list-style: none;
    padding: 0;
    margin: 0;
}

.mobile-bottom-nav-marketplace li {
    flex: 1; /* Each item takes equal width */
    display: flex;
}

.mobile-bottom-nav-marketplace li a {
    flex-grow: 1;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    padding: 4px 2px;
    text-decoration: none;
    color: #6c757d;
    transition: color 0.2s ease-in-out;
}

.mobile-bottom-nav-marketplace .mobile-nav-icon {
    font-size: 22px;
    line-height: 1;
    margin-bottom: 4px; /* Space between icon and label */
}

.mobile-bottom-nav-marketplace .mobile-nav-label {
    display: block;
    width: 100%;
    font-size: 11px;
    line-height: 1.2;
    white-space: nowrap;
    text-align: center;
}

.mobile-bottom-nav-marketplace a.active {
    color: var(--theme-primary-color, #0d6efd);
    font-weight: 500;
}


/* =================================================================
   3. OFF-CANVAS (HAMBURGER) MENU
   - For non-PWA mobile view.
   ================================================================= */

/* The dark overlay behind the menu */
.offcanvas-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

.offcanvas-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* The slide-in menu panel */
.offcanvas-menu {
    position: fixed;
    top: 0;
    left: 0;
    width: 280px; /* Width of the slide-in menu */
    height: 100%;
    background-color: #fff;
    z-index: 1050;
    transform: translateX(-100%); /* Start off-screen */
    transition: transform 0.3s ease;
    display: flex;
    flex-direction: column;
}

.offcanvas-menu.active {
    transform: translateX(0); /* Slide into view */
}

.offcanvas-header {
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 15px 20px;
    border-bottom: 1px solid #e9ecef;
    flex-shrink: 0; /* Prevent header from shrinking */
}

.offcanvas-header .offcanvas-logo img {
    max-height: 35px;
}

.offcanvas-header .close-btn {
    background: none;
    border: none;
    font-size: 28px;
    line-height: 1;
    padding: 0;
    color: #333;
}

.offcanvas-body {
    padding: 10px 0;
    overflow-y: auto;
    flex-grow: 1;
}

/* Adapt the Desktop Nav for Vertical Layout in Off-Canvas */
.offcanvas-menu .nav-marketplace-list {
    flex-direction: column;
    align-items: flex-start;
    height: auto;
}

.offcanvas-menu .nav-marketplace-item {
    width: 100%;
}

.offcanvas-menu .nav-marketplace-link {
    width: 100%;
    padding: 12px 20px;
    font-weight: 500;
    font-size: 1rem;
    border-bottom: 1px solid #f0f0f0;
    color: #343a40;
}

.offcanvas-menu .nav-marketplace-item:last-child .nav-marketplace-link {
    border-bottom: none;
}

.offcanvas-menu .nav-marketplace-item:hover > .nav-marketplace-link,
.offcanvas-menu .nav-marketplace-item.active > .nav-marketplace-link {
    border-bottom-color: #f0f0f0; /* Keep the separator line */
    background-color: #f8f9fa; /* Use a light background instead */
    color: var(--theme-primary-color, #0d6efd);
}

/* Vertical dropdown menu */
.offcanvas-menu .dropdown-menu-custom {
    display: none; /* Controlled by JS or a different mechanism if needed */
    position: static;
    width: 100%;
    border: none;
    box-shadow: none;
    padding: 0 0 0 20px; /* Indent dropdown items */
    background-color: #f8f9fa;
}

.offcanvas-menu .dropdown-item-custom a {
    padding: 10px 20px;
    font-size: 0.9rem;
}


/* First, by default, hide the PWA nav. */
.mobile-bottom-nav-marketplace {
    display: none;
}

/* ==========================================================
   FINAL PWA VISIBILITY FIX
   This ensures the PWA nav is hidden on desktop.
   ========================================================== */
@media (min-width: 992px) {
    .mobile-bottom-nav-marketplace {
        display: none !important;
    }
}