/* ============================================
   MEGA MENU STYLES - Desktop/Mobile Separation
   Version 2.0.0
   ============================================ */

/* ============================================
   BASE / SHARED STYLES
   Applies to both desktop and mobile
   ============================================ */

/* Reset and base navbar styles */
.mega-menu-navbar {
    position: sticky;
    top: 0;
    z-index: 1000;
    width: 100%;
}

/* Container - shared layout */
.mega-menu-container {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    align-items: center;
    justify-content: space-between;
    position: relative;
}

/* Logo styles - shared */
.mega-menu-logo a {
    font-size: 24px;
    font-weight: 700;
    color: #333;
    text-decoration: none;
    display: block;
    padding: 20px 0;
}

/* Menu list base - no display/flex yet */
.mega-menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    width: 100%;
}

/* Menu item base */
.mega-menu-item {
    margin: 0;
    padding: 0;
    width: auto;
}

/* Dropdown base */
.mega-menu-dropdown {
    min-width: 240px;
    background: #0c1928;
    box-shadow: 0 4px 16px rgba(0, 0, 0, 0.15);
    margin-top: 0;
    width: 100%;
}

/* Dropdown list base */
.mega-menu-dropdown-list {
    list-style: none;
    margin: 0;
    padding: 8px 0;
}

/* Dropdown item base */
.mega-menu-dropdown-item {
    margin: 0;
    padding: 0;
    background-color: #0c1928;
}

/* Dropdown link base */
.mega-menu-dropdown-link {
    display: block;
    color: #fff;
    text-decoration: none;
    font-size: 15px;
    font-weight: bold;
    transition: background-color 0.2s ease, color 0.2s ease;
    word-wrap: break-word;
}

/* Dropdown link hover */
.mega-menu-dropdown-link:hover {
    color: #fff;
    text-decoration: none;
}

/* Dropdown icon wrapper - provides padding without shrinking icon */
.dropdown-icon-wrapper {
    display: inline-flex;
    align-items: center;
    justify-content: center;
    padding: 6px;
    cursor: pointer;
    transition: transform 0.3s ease;
    flex-shrink: 0;
}

/* Dropdown icon base */
.dropdown-icon {
    color: #ffffff;
    display: block;
}

/* Link wrapper base */
.mega-menu-link-wrapper {
    display: flex;
    flex-direction: row;
    align-items: center;
}

/* Trade account item base */
.trade-account-menu-item {
    position: relative;
}

.trade-account-menu-item .mega-menu-dropdown-list {
    display: initial;
}

/* Current menu item base */
.mega-menu-item.current-menu-item > .mega-menu-link,
.mega-menu-item.current_page_item > .mega-menu-link {
    background-color: #5ebca7;
}

/* Mobile Toggle Button base */
.mega-menu-toggle {
    display: none;
    flex-direction: row;
    background: none;
    border: none;
    cursor: pointer;
    z-index: 1001;
    height: 100%;
    align-items: center;
    justify-content: space-between;
}

.mega-menu-toggle span {
    display: block;
    width: 25px;
    background-color: #fff;
    transition: all 0.3s ease;
    border-radius: 3px;
}

.mega-menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.mega-menu-toggle.active span:nth-child(3) {
    transform: rotate(-45deg) translate(6px, -6px);
}

/* Mobile header base */
.mobile-mega-header {
    width: 100%;
    background-position: center center;
    background-size: cover;
    background-color: white;
    display: none;
    position: sticky;
    top: 0;
    height: 80px;
}

/* ============================================
   DESKTOP STYLES (.mm-desktop)
   Viewport: 992px and above
   ============================================ */

.mm-desktop .mega-menu-navbar {
    background-color: #29b998;
}

.mm-desktop .mega-menu-list {
    display: flex;
    justify-content: space-between;
    align-items: center;
}

.mm-desktop .mega-menu-link-wrapper {
    justify-content: space-between;
    width: 95%;
}

.mm-desktop .mega-menu-link {
    display: flex;
    align-items: center;
    justify-content: center;
    padding: 0px 10px;
    color: #ffffff;
    font-size: 15px;
    font-weight: bold;
    white-space: nowrap;
    height: 48px;
    text-decoration: none;
    transition: color 0.3s ease, background-color 0.3s ease;
}

.mm-desktop .mega-menu-link:hover {
    background: #5ebca7;
    color: white;
    border-color: #fff;
    text-decoration: none;
}

.mm-desktop .mega-menu-item.has-dropdown:hover .dropdown-icon-wrapper {
    transform: rotate(180deg);
}

.mm-desktop .mega-menu-dropdown {
    position: absolute;
    top: 100%;
    right: 0;
    opacity: 0;
    visibility: hidden;
    transform: translateY(-10px);
    transition: opacity 0.3s ease, transform 0.3s ease, visibility 0.3s;
    z-index: 100;
}

.mm-desktop .mega-menu-item.has-dropdown:hover .mega-menu-dropdown {
    opacity: 1;
    visibility: visible;
    transform: translateY(0);
}

.mm-desktop .mega-menu-dropdown-list {
    display: grid;
    grid-template-columns: repeat(5, 1fr);
    gap: 5px;
}

.mm-desktop .mega-menu-dropdown-link {
    padding: 12px 24px;
}

.mm-desktop .mobile-mega-header {
    display: none;
}

.mm-desktop .mega-menu-toggle {
    display: none;
}

/* ============================================
   MOBILE STYLES (.mm-mobile)
   Viewport: 991px and below
   ============================================ */

.mm-mobile .mega-menu-navbar {
    background-color: #fff;
    z-index: 10000;
    overflow: visible;
}

.mm-mobile .mega-menu-container {
    max-width: 100%;
    overflow: visible;
    position: relative;
}

.mm-mobile .mega-menu-list {
    position: absolute;
    top: 80px;
    left: 0;
    background: #29b998;
    flex-direction: column;
    align-items: stretch;
    overflow-y: auto;
    overflow-x: hidden;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    display: none;
    z-index: 99999;
}

.mm-mobile .mega-menu-list.active {
    display: block;
}

.mm-mobile .mega-menu-item {
    width: auto;
}

.mm-mobile .mega-menu-item.has-dropdown {
    position: static;
}

.mm-mobile .mega-menu-link {
    display: flex;
    align-items: center;
    padding: 16px 24px;
    justify-content: space-between;
    color: #ffffff;
    font-size: 15px;
    font-weight: bold;
    text-decoration: none;
    transition: color 0.3s ease, background-color 0.3s ease;
    white-space: nowrap;
}

.mm-mobile .mega-menu-link-wrapper {
    justify-content: space-between;
    width: 100%;
}

.mm-mobile .mega-menu-dropdown {
    position: static;
    opacity: 1;
    visibility: visible;
    transform: none;
    box-shadow: none;
    border-radius: 0;
    max-height: 0;
    overflow: hidden;
    max-width: 100%;
}

.mm-mobile .mega-menu-item.has-dropdown.active .mega-menu-dropdown {
    max-height: 500px;
    overflow-y: scroll;
    width: 100%;
}

.mm-mobile .mega-menu-item.has-dropdown.active .dropdown-icon-wrapper {
    transform: rotate(180deg);
}

.mm-mobile .mega-menu-dropdown-list {
    background-color: #f8f9fa;
    padding: 0;
    gap: 0;
    display: flex;
    flex-direction: column;
    grid-template-columns: 1fr;
}

.mm-mobile .mega-menu-dropdown-link {
    padding: 12px 24px 12px 44px;
    font-size: 14px;
}

.mm-mobile .mobile-mega-header {
    display: block;
}

.mm-mobile .mega-menu-toggle {
    display: flex;
}

.mm-mobile .mega-menu-overlay {
    position: fixed;
    top: 80px;
    left: 0;
    width: 100%;
    height: calc(100vh - 80px);
    background: rgba(0, 0, 0, 0.5);
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s ease, visibility 0.3s;
    z-index: 9998;
}

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

/* Override Bootstrap container constraint */
.mm-mobile #header-nav-wrapper .container {
    max-width: 100%;
    padding: 0;
}

.mm-mobile .mega-toggle-blocks-center {
    z-index: 10001;
    position: relative;
}

.mm-mobile .mega-search-wrap {
    display: flex !important;
    visibility: visible !important;
}

.mm-mobile .search-icon.dashicons::before,
.mm-mobile .search-icon.dashicons-search::before {
    color: #000;
}

.mm-mobile .mega-menu-logo a {
    font-size: 20px;
    padding: 15px 0;
}

.mm-mobile .mega-menu-list {
    width: 100%;
}

.mm-mobile .mega-menu-dropdown {
    max-width: 100%;
    overflow-x: hidden;
}

/* ============================================
   SMALL MOBILE OVERRIDES
   Viewport: 480px and below
   Size adjustments only - behavior unchanged
   ============================================ */

@media (max-width: 480px) {
    .mm-mobile .mega-menu-list {
        width: 100%;
    }

    .mm-mobile .mega-menu-link {
        padding: 14px 16px;
        font-size: 14px;
    }

    .mm-mobile .mega-menu-dropdown-link {
        padding: 10px 16px 10px 32px;
        font-size: 13px;
    }
}

/* ============================================
   SHARED COMPONENT STYLES
   Apply to both desktop and mobile
   ============================================ */

/* LEFT (LOGO) */
.mega-toggle-blocks-left img {
    height: auto;
    width: 145px;
}

/* CENTER ICONS */
.mega-toggle-blocks-center {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 16px;
    padding-right: 12px;
}

/* Icons */
.mega-icon {
    width: 24px;
    height: 24px;
    display: flex;
    align-items: center;
    justify-content: center;
    background-size: contain;
    background-repeat: no-repeat;
}

.mega-icon.phone {
    background-image: url('https://img.icons8.com/ios-glyphs/30/000000/phone.png');
}

.mega-icon.cart {
    background-image: url('https://img.icons8.com/ios-glyphs/30/000000/shopping-cart.png');
}

/* SEARCH */
.mega-search-wrap {
    position: relative;
    display: flex;
    align-items: center;
}

.mega-search {
    display: flex;
    align-items: center;
    border-radius: 4px;
    overflow: hidden;
    transition: background 0.3s ease;
}

.mega-search-wrap.active .mega-search {
    background: #fff !important;
    box-shadow: 0 2px 8px rgba(0, 0, 0, 0.15);
}

.mega-search input[type="text"] {
    background: transparent;
    border: none;
    color: #333;
    width: 0;
    padding: 0;
    outline: none;
    transition: width 0.3s ease, padding 0.3s ease;
    font-size: 14px;
}

.mega-search-wrap.active .mega-search input[type="text"] {
    width: 150px;
    padding: 8px 12px;
}

/* SEARCH ICON */
.search-icon {
    color: #000;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: color 0.3s ease;
    width: 24px;
    height: 24px;
}

.search-icon:hover {
    color: #29b998;
}

.search-icon.dashicons,
.search-icon.dashicons-search {
    font-size: 20px;
    width: 24px;
    height: 24px;
}

/* HAMBURGER BUTTON */
.mobile-menu-button {
    background: none;
    border: none;
    padding: 0;
    cursor: pointer;
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.mobile-menu-button .menu-icon,
.menu-icon::before,
.menu-icon::after {
    width: 40px;
    height: 4px;
    background-color: white;
    border-radius: 4px;
    display: block;
    position: relative;
    transition: all 0.3s ease;
}

.menu-icon::before {
    content: "";
    position: absolute;
    top: -10px;
}

.menu-icon::after {
    content: "";
    position: absolute;
    top: 10px;
}

.mega-toggle-blocks-left,
.mega-toggle-blocks-center,
.mega-toggle-blocks-right {
    height: 100%;
    display: flex;
    align-items: center;
}

.mega-toggle-blocks-left {
    padding-left: 12px;
    flex: 1;
}

.mega-toggle-blocks-center {
    flex: 0 0 auto;
}

.mega-toggle-blocks-right {
    background-color: #29b998;
    justify-content: center;
    flex: 0 0 80px;
}

/* Hamburger animation */
.mobile-menu-button.active .menu-icon {
    background: transparent;
}

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

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

.mobile-menu-button.focus {
    outline: 0;
}
