/* Custom Navigation Styles */

/* Parent must be static for the dropdown to center relative to the container */
.nav.navbar-nav>li.mega-menu-parent {
    position: static !important;
}

/* Mega Menu Dropdown */
.mega-menu-dropdown {
    width: 600px;
    /* Reduced width further */
    max-width: 90vw;
    left: 0 !important;
    right: 0 !important;
    margin: 0 auto !important;
    /* Center using margin auto */
    transform: none !important;
    /* Remove translate */
    padding: 10px;
    /* Compact padding */
    margin-top: 0;
    border: 1px solid #eee;
    /* Clearer border */
    border-top: 3px solid #782b90;
    /* Highlight top border */
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.1);
    /* Softer shadow */
    background-color: #fff;
    display: none;
    background-clip: padding-box;
    text-align: left;
    /* Override parent text-center */
}

/* Left Align specific items (Giftbox, Mugs) */
.nav.navbar-nav>li.mega-menu-parent.mega-align-left {
    position: relative !important;
}

.mega-menu-parent.mega-align-left .mega-menu-dropdown {
    left: 0 !important;
    right: auto !important;
    transform: none !important;
    margin: 0 !important;
}


/* Open state for desktop hover */
@media (min-width: 768px) {
    .nav.navbar-nav>li:hover .mega-menu-dropdown {
        display: block;
        animation: fadeIn 0.3s ease-in-out;
    }
}

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

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

.mega-menu-grid {
    display: flex;
    flex-wrap: wrap;
    align-items: stretch;
    /* Align heights */
}

.mega-menu-col-links {
    width: 55%;
    /* Links take less space */
    padding: 10px;
    /* border-right: 1px solid #f0f0f0; */
    background-color: #fff;
}

.mega-menu-col-image {
    width: 45%;
    /* Image takes more space */
    padding: 10px;
    background-color: #fff;
    /* Subtle contrast */
    display: flex;
    align-items: center;
    justify-content: center;
    border-radius: 0 0 5px 0;
}

.mega-menu-col-image img {
    max-width: 100%;
    max-height: 300px;
    /* Reduced height */
    width: 100%;
    /* Fill container */
    aspect-ratio: 1 / 1;
    /* Force square */
    object-fit: cover;
    /* Crop to fit */
    /* border-radius: 4px; */
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.mega-menu-links {
    list-style: none;
    padding: 0;
    margin: 0;
}

.mega-menu-links li {
    margin-bottom: 10px;
}

.mega-menu-links li a {
    color: #333;
    font-size: 13px;
    /* Slightly smaller font */
    text-decoration: none;
    transition: color 0.2s;
    display: block;
    padding: 3px 0;
    /* Tighter padding */
}

.mega-menu-links li a:hover {
    color: #782b90;
    /* Theme purple */
    padding-left: 5px;
}

/* Initial Mobile Menu Button (Hamburger) */
.mobile-menu-trigger {
    display: none;
    float: left;
    padding: 15px;
    background: transparent;
    border: none;
    font-size: 24px;
    cursor: pointer;
    color: #333;
    z-index: 1001;
    /* Above mask */
}

/* Off-canvas Menu (Mobile) */
.offcanvas-menu {
    position: fixed;
    top: 0;
    left: -300px;
    /* Hidden by default */
    width: 300px;
    height: 100%;
    background: #fff;
    z-index: 1002;
    transition: left 0.3s ease-in-out;
    overflow-y: auto;
    box-shadow: 2px 0 10px rgba(0, 0, 0, 0.1);
    padding-top: 60px;
    /* Space for close button */
}

.offcanvas-menu.active {
    left: 0;
}

.offcanvas-mask {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background: rgba(0, 0, 0, 0.5);
    z-index: 1000;
    display: none;
    /* Hidden by default */
}

.offcanvas-mask.active {
    display: block;
}

.offcanvas-close {
    position: absolute;
    top: 15px;
    right: 15px;
    font-size: 24px;
    background: transparent;
    border: none;
    cursor: pointer;
    color: #333;
}

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

.mobile-nav-item {
    border-bottom: 1px solid #f0f0f0;
}

.mobile-nav-link {
    display: block;
    padding: 15px 20px;
    color: #333;
    text-decoration: none;
    font-size: 16px;
    font-weight: 500;
    position: relative;
}

.mobile-nav-link:hover,
.mobile-nav-link:focus {
    text-decoration: none;
    color: #782b90;
    background: #f9f9f9;
}

/* Mobile Accordion */
.mobile-accordion-toggle::after {
    content: '+';
    position: absolute;
    right: 20px;
    top: 50%;
    transform: translateY(-50%);
    font-size: 18px;
    font-weight: bold;
}

.mobile-accordion-toggle.open::after {
    content: '-';
}

.mobile-submenu {
    display: none;
    /* Hidden by default */
    background: #f9f9f9;
    padding: 0;
}

.mobile-submenu li a {
    padding: 12px 30px;
    /* Indented */
    display: block;
    color: #555;
    font-size: 14px;
    border-bottom: 1px solid #eee;
    text-decoration: none;
}

.mobile-submenu li a:hover {
    color: #782b90;
    padding-left: 35px;
}

/* Responsive Visibility */
@media (max-width: 767px) {
    .navbar-collapse.collapse {
        display: none !important;
        /* Hide default BS menu */
    }

    .mobile-menu-trigger {
        display: block;
    }

    .navbar-header {
        float: none;
        display: flex;
        align-items: center;
        justify-content: space-between;
        padding-right: 5px;
        /* Reduced to move icons right */
    }

    /* Increase cart icon size by 40% (20px * 1.4 = 28px) */
    svg.cart_header {
        width: 28px;
    }

    /* Container for icons (h2) */
    .navbar-header .menu-title {
        flex-grow: 1;
        margin: 0;
        display: flex;
        justify-content: flex-end;
        align-items: center;
    }

    .navbar-header .top-menu {
        margin-bottom: 0;
    }

    .mobile-menu-trigger {
        display: block;
        margin-top: 0;
        margin-left: 5px;
        /* Added spacing */
        order: -1;
        font-size: 34px;
        /* Increased size */
        padding: 10px;
    }

    .mobile-logo {
        position: absolute;
        left: 50%;
        transform: translateX(-50%);
        display: block;
        z-index: 10;
        margin-left: 0;
        /* Align perfectly center */
    }

    .mega-menu-col-image {
        display: none !important;
        /* Strictly hide images in sub-menus on mobile */
    }
}


/* Lock scroll when mobile menu is open */
body.mobile-menu-open {
    overflow: hidden;
    text-align: left;
    /* Changed to left for English default */
    width: 65%;
}

/* Fix Mobile Search Overlap */
@media (max-width: 767px) {
    #mobileSearchWrapper {
        position: absolute;
        top: 100%;
        left: 0;
        width: 100%;
        background: #fff;
        z-index: 999;
        padding: 10px 0;
        /* Reduced padding */
        box-shadow: 0 4px 10px rgba(0, 0, 0, 0.1);
        margin: 0;
        /* Override existing margin */
        display: none;
        /* Controlled by JS */
    }

    #mobileSearchWrapper .container {
        width: 100%;
        padding: 0 15px;
        display: flex;
        justify-content: center;
    }

    #mobileSearchWrapper .form-container {
        width: 100%;
        max-width: 400px;
        /* Prevent it from being too wide on tablets */
    }

    #mobileSearchWrapper .form-tab {
        display: flex;
        align-items: center;
        border: none;
        /* Removed border as requested */
        border-radius: 4px;
        padding: 5px;
        width: 100%;
        background-color: #f9f9f9;
        height: 45px;
        /* Fixed container height */
    }

    /* Hide the independent placeholder if it messes up layout, 
       assuming input has placeholder or we rely on the input's own padding */
    #mobileSearchWrapper .search-placeholder {
        display: none;
    }

    #mobileSearchWrapper .search-field {
        flex: 1;
        margin: 0;
    }

    #mobileSearchWrapper .search-field form,
    #mobileSearchWrapper .search-field input.text-field {
        width: 100%;
        margin: 0;
    }

    #mobileSearchWrapper .search-field input.text-field {
        height: 35px;
        /* Reduced height */
        border: none;
        background: transparent;
        padding: 0 10px;
        font-size: 14px;
        /* Slightly smaller font */
    }

    #mobileSearchWrapper .search-btn {
        width: 40px;
        /* Reduced width */
        height: 35px;
        /* Reduced height */
        display: flex;
        align-items: center;
        justify-content: center;
        background: #662d91;
        /* Space website purple */
        border-radius: 4px;
        cursor: pointer;
    }

    #mobileSearchWrapper .search-btn i {
        color: #fff;
        font-size: 18px;
        /* Slightly smaller icon */
    }
}

/* Utility Classes for Header Refactoring */
.logo-img {
    max-height: 40px !important;
}

.mobile-search-item {
    margin-right: 0px !important;
    /* Force override if needed */
}

.mobile-search-icon {
    width: 28px;
}

/* Mugs Menu Image */
.mugs-menu-image {
    background: #ccc;
    padding: 20px;
}

/* Mobile Social Media Icons */
.mobile-social-icons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 20px;
    padding: 30px 20px;
    border-top: 1px solid #f0f0f0;
    margin-top: 20px;
}

.mobile-social-icons a {
    display: flex;
    justify-content: center;
    align-items: center;
    width: 42px;
    height: 42px;
    border-radius: 50%;
    background-color: #f0f0f0;
    color: #555;
    transition: all 0.3s ease;
}

.mobile-social-icons a:hover {
    background-color: #662d91;
    color: #fff;
}

.mobile-social-icons svg {
    width: 20px;
    height: 20px;
}

/* Mobile Contact Email */
.mobile-contact-email {
    text-align: center;
    padding-bottom: 30px;
}

.mobile-contact-email a {
    display: inline-flex;
    align-items: center;
    gap: 8px;
    color: #555;
    font-size: 15px;
    text-decoration: none;
    transition: color 0.3s ease;
}

.mobile-contact-email a i {
    font-size: 18px;
    color: #662d91;
}

.mobile-contact-email a:hover {
    color: #662d91;
}