/**
 * Mobile-Responsive Menu Styles
 * Supports accordion-style submenu expansion on mobile devices
 */

/* ===== Mobile Menu Container ===== */
.mobile-menu-container {
    position: fixed;
    top: 0;
    left: -280px;
    width: 280px;
    height: 100vh;
    background: linear-gradient(135deg, #222831 0%, #393E46 100%);
    z-index: 1050;
    transition: left 0.3s ease-in-out;
    overflow-y: auto;
    box-shadow: 2px 0 15px rgba(0, 0, 0, 0.3);
}

.mobile-menu-container.open {
    left: 0;
}

/* ===== Overlay ===== */
.mobile-menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1040;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
}

.mobile-menu-overlay.active {
    opacity: 1;
    visibility: visible;
}

/* ===== Menu Header ===== */
.mobile-menu-header {
    padding: 1rem;
    background: rgba(255, 255, 255, 0.1);
    display: flex;
    justify-content: space-between;
    align-items: center;
    border-bottom: 1px solid rgba(255, 255, 255, 0.1);
}

.mobile-menu-header .logo {
    max-height: 40px;
}

.mobile-menu-close {
    background: none;
    border: none;
    color: #fff;
    font-size: 1.5rem;
    cursor: pointer;
    padding: 0.5rem;
    transition: transform 0.2s;
}

.mobile-menu-close:hover {
    transform: rotate(90deg);
}

/* ===== Menu Items ===== */
.mobile-menu-nav {
    padding: 0;
    margin: 0;
    list-style: none;
}

/* ===== Menu Search ===== */
.mobile-menu-search {
    padding: 0.75rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-menu-item {
    border-bottom: 1px solid rgba(255, 255, 255, 0.05);
}

.mobile-menu-link {
    display: flex;
    align-items: center;
    padding: 1rem 1.25rem;
    color: #e0e0e0;
    text-decoration: none;
    font-size: 1rem;
    font-weight: 500;
    transition: all 0.2s ease;
    min-height: 52px;
    /* Touch-friendly 48px+ */
}

.mobile-menu-link:hover,
.mobile-menu-link:focus {
    background: rgba(255, 255, 255, 0.1);
    color: #fff;
    text-decoration: none;
}

.mobile-menu-link i {
    width: 24px;
    margin-right: 12px;
    text-align: center;
    font-size: 1.1rem;
    opacity: 0.8;
}

/* ===== Dropdown Toggle ===== */
.mobile-menu-dropdown-toggle {
    display: flex;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: pointer;
}

.mobile-menu-dropdown-toggle::after {
    content: '\f107';
    /* fa-angle-down */
    font-family: 'Font Awesome 6 Free';
    font-weight: 900;
    transition: transform 0.3s ease;
}

.mobile-menu-item.open .mobile-menu-dropdown-toggle::after {
    transform: rotate(180deg);
}

/* ===== Submenu (Accordion Style) ===== */
.mobile-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out;
    background: rgba(0, 0, 0, 0.2);
}

.mobile-menu-item.open .mobile-submenu {
    max-height: 500px;
    transition: max-height 0.5s ease-in;
}

.mobile-submenu-item {
    list-style: none;
}

.mobile-submenu-link {
    display: flex;
    align-items: center;
    padding: 0.85rem 1.25rem 0.85rem 3rem;
    color: #bbb;
    text-decoration: none;
    font-size: 0.9rem;
    transition: all 0.2s ease;
    min-height: 48px;
}

.mobile-submenu-link:hover,
.mobile-submenu-link:focus {
    background: rgba(255, 255, 255, 0.08);
    color: #fff;
    padding-left: 3.25rem;
    text-decoration: none;
}

.mobile-submenu-link i {
    width: 20px;
    margin-right: 10px;
    font-size: 0.9rem;
    opacity: 0.7;
}

/* ===== Divider ===== */
.mobile-menu-divider {
    border-top: 1px solid rgba(255, 255, 255, 0.1);
    margin: 0.5rem 1rem;
}

/* ===== Header (Section Title) ===== */
.mobile-menu-header-item {
    padding: 1rem 1.25rem 0.5rem;
    color: #888;
    font-size: 0.75rem;
    text-transform: uppercase;
    letter-spacing: 1px;
    font-weight: 600;
}

/* ===== Hamburger Button ===== */
.mobile-menu-toggle {
    display: none;
    background: none;
    border: none;
    padding: 0.5rem;
    cursor: pointer;
    z-index: 1000;
}

.mobile-menu-toggle .hamburger {
    display: block;
    width: 24px;
    height: 2px;
    background: #EEEEEE;
    position: relative;
    transition: all 0.3s ease;
}

.mobile-menu-toggle .hamburger::before,
.mobile-menu-toggle .hamburger::after {
    content: '';
    position: absolute;
    width: 24px;
    height: 2px;
    background: #EEEEEE;
    transition: all 0.3s ease;
}

.mobile-menu-toggle .hamburger::before {
    top: -7px;
}

.mobile-menu-toggle .hamburger::after {
    top: 7px;
}

/* Hamburger Animation */
.mobile-menu-toggle.active .hamburger {
    background: transparent;
}

.mobile-menu-toggle.active .hamburger::before {
    transform: rotate(45deg);
    top: 0;
}

.mobile-menu-toggle.active .hamburger::after {
    transform: rotate(-45deg);
    top: 0;
}

/* ===== Category Menu Specific ===== */
.category-menu-image {
    width: 24px;
    height: 24px;
    object-fit: cover;
    border-radius: 4px;
    margin-right: 12px;
}

/* ===== Hierarchical Category Menu ===== */
/* Nested category submenu container */
.mobile-category-submenu {
    max-height: 0;
    overflow: hidden;
    transition: max-height 0.35s ease-out;
    background: rgba(0, 0, 0, 0.12);
    margin: 0;
    padding: 0;
    list-style: none;
}

.mobile-submenu-item.open>.mobile-category-submenu {
    max-height: 2000px;
    /* Large value for deeply nested menus */
    transition: max-height 0.5s ease-in;
}

/* Category toggle link with chevron */
.mobile-category-toggle {
    display: flex !important;
    justify-content: space-between;
    align-items: center;
    width: 100%;
    cursor: pointer;
}

/* Chevron icon styling and animation */
.category-chevron {
    font-size: 0.7rem;
    transition: transform 0.3s ease;
    opacity: 0.6;
    margin-left: auto;
    padding-left: 1rem;
}

.mobile-submenu-item.open>.mobile-category-toggle .category-chevron {
    transform: rotate(90deg);
    opacity: 1;
}

/* Depth-based indentation (0 = first level inside Categories dropdown) */
.level-0>.mobile-submenu-link,
.level-0>.mobile-category-toggle {
    padding-left: 3rem;
}

.level-1>.mobile-submenu-link,
.level-1>.mobile-category-toggle {
    padding-left: 3.75rem;
}

.level-2>.mobile-submenu-link,
.level-2>.mobile-category-toggle {
    padding-left: 4.5rem;
}

.level-3>.mobile-submenu-link,
.level-3>.mobile-category-toggle {
    padding-left: 5.25rem;
}

/* Nested submenu background gets progressively darker */
.level-1>.mobile-category-submenu {
    background: rgba(0, 0, 0, 0.08);
}

.level-2>.mobile-category-submenu {
    background: rgba(0, 0, 0, 0.06);
}

.level-3>.mobile-category-submenu {
    background: rgba(0, 0, 0, 0.04);
}

/* "View All in X" link styling */
.view-all-link {
    font-weight: 500 !important;
    color: #00ADB5 !important;
    font-size: 0.85rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.view-all-link:hover,
.view-all-link:focus {
    color: #4DD9E0 !important;
    background: rgba(0, 173, 181, 0.1) !important;
}

.view-all-link i {
    width: 16px;
    margin-right: 8px;
    font-size: 0.75rem;
}

.view-all-item {
    background: rgba(0, 0, 0, 0.1);
}

/* Has-children indicator - subtle left border */
.mobile-submenu-item.has-children>.mobile-category-toggle::before {
    content: '';
    position: absolute;
    left: 0;
    top: 0;
    bottom: 0;
    width: 3px;
    background: rgba(0, 173, 181, 0.4);
    opacity: 0;
    transition: opacity 0.2s ease;
}

.mobile-submenu-item.has-children.open>.mobile-category-toggle::before {
    opacity: 1;
}

/* Touch-friendly minimum heights */
.mobile-category-submenu .mobile-submenu-link {
    min-height: 44px;
    display: flex;
    align-items: center;
}

/* Smooth border transitions */
.mobile-submenu-item.has-children {
    position: relative;
}

/* ===== Mobile Search Bar ===== */
.mobile-search-bar {
    background: var(--ch-dark, #222831);
    padding: 0.5rem 1rem;
    border-bottom: 1px solid rgba(255, 255, 255, 0.08);
}

.mobile-search-bar__form {
    width: 100%;
}

.mobile-search-bar__input-wrapper {
    position: relative;
    display: flex;
    align-items: center;
}

.mobile-search-bar__icon {
    position: absolute;
    left: 14px;
    color: rgba(255, 255, 255, 0.45);
    font-size: 0.85rem;
    pointer-events: none;
    z-index: 1;
}

.mobile-search-bar__input {
    width: 100%;
    height: var(--input-height-mobile, 48px);
    padding: 0 1rem 0 2.5rem;
    background: rgba(255, 255, 255, 0.1);
    border: 1px solid rgba(255, 255, 255, 0.12);
    border-radius: var(--radius-full, 9999px);
    color: #fff;
    font-size: var(--font-size-sm, 0.875rem);
    font-family: var(--font-primary, inherit);
    transition: all 0.2s ease;
    -webkit-appearance: none;
    appearance: none;
}

.mobile-search-bar__input::placeholder {
    color: rgba(255, 255, 255, 0.45);
}

.mobile-search-bar__input:focus {
    outline: none;
    background: rgba(255, 255, 255, 0.15);
    border-color: var(--primary, #00ADB5);
    box-shadow: 0 0 0 3px rgba(0, 173, 181, 0.15);
}

/* Hide mobile search on desktop */
@media (min-width: 992px) {
    .mobile-search-bar {
        display: none !important;
    }
}

/* ===== Desktop Dropdown Enhancement ===== */
@media (min-width: 992px) {
    .mobile-menu-toggle {
        display: none !important;
    }

    .mobile-menu-container {
        display: none !important;
    }

    .mobile-menu-overlay {
        display: none !important;
    }

    /* Enhanced desktop dropdown */
    .navbar .dropdown-menu {
        border: none;
        border-radius: 8px;
        box-shadow: 0 5px 25px rgba(0, 0, 0, 0.15);
        padding: 0.5rem 0;
        animation: dropdownFadeIn 0.2s ease;
    }

    @keyframes dropdownFadeIn {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    .navbar .dropdown-item {
        padding: 0.6rem 1.25rem;
        transition: all 0.2s ease;
    }

    .navbar .dropdown-item:hover {
        background: linear-gradient(90deg, rgba(0, 173, 181, 0.1) 0%, transparent 100%);
        padding-left: 1.5rem;
    }
}

/* ===== Tablet & Mobile ===== */
@media (max-width: 991px) {
    .mobile-menu-toggle {
        display: block;
    }

    /* Hide desktop menu items */
    .navbar-collapse {
        display: none !important;
    }
}

/* ===== Accessibility ===== */
.mobile-menu-link:focus,
.mobile-submenu-link:focus,
.mobile-menu-toggle:focus {
    outline: 2px solid #00ADB5;
    outline-offset: 2px;
}

/* Reduce motion for users who prefer it */
@media (prefers-reduced-motion: reduce) {

    .mobile-menu-container,
    .mobile-menu-overlay,
    .mobile-submenu,
    .hamburger,
    .hamburger::before,
    .hamburger::after {
        transition: none;
    }

    .cart-badge-pop {
        animation: none !important;
    }
}

/* ===== Mobile Side-Menu Cart Badge ===== */
.mobile-menu-cart-link {
    position: relative;
}

.mobile-cart-badge {
    margin-left: auto;
    background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
    color: #fff;
    font-size: 0.7rem;
    font-weight: 700;
    min-width: 20px;
    height: 20px;
    border-radius: 10px;
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 0 6px;
    line-height: 1;
    box-shadow: 0 2px 6px rgba(239, 68, 68, 0.4);
    letter-spacing: 0.02em;
}

/* ===== Cart Badge Pop Animation (shared) ===== */
@keyframes cartBadgePop {
    0%   { transform: scale(1); }
    30%  { transform: scale(1.35); }
    50%  { transform: scale(0.9); }
    70%  { transform: scale(1.1); }
    100% { transform: scale(1); }
}

.cart-badge-pop {
    animation: cartBadgePop 0.4s ease-out;
}