/**
 * Mega Menu Styles
 * WalletInvestor Top Navigation Bar
 */

/* Top Menu Bar Container */
.wi-top-menubar {
    background-color: #2c3e50;
    border-bottom: 2px solid #34495e;
    font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", Roboto, "Helvetica Neue", Arial, sans-serif;
    font-size: 14px;
    min-height: 42px;
    position: relative;
    z-index: 1100;
    width: 100%;
    top: 0;
    margin: 0;
    padding: 0;
}

.wi-top-menubar .container-fluid {
    max-width: 1200px;
    margin: 0 auto;
    padding-left: 15px;
    padding-right: 15px;
    display: flex;
    justify-content: center;
    align-items: center;
}

/* Main Navigation */
.wi-top-menubar .navbar-nav {
    margin: 0;
    padding: 0;
    list-style: none;
    display: flex;
    flex-wrap: wrap;
}

.wi-top-menubar .navbar-nav > li {
    position: relative;
    display: inline-block;
}

.wi-top-menubar .navbar-nav > li > a {
    color: #ecf0f1;
    padding: 12px 15px;
    display: block;
    text-decoration: none;
    transition: all 0.3s ease;
    white-space: nowrap;
}

.wi-top-menubar .navbar-nav > li > a:hover,
.wi-top-menubar .navbar-nav > li > a:focus {
    background-color: #1a252f;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

.wi-top-menubar .navbar-nav > li > a strong {
    font-weight: 600;
}

/* Active/Open dropdown state */
.wi-top-menubar .navbar-nav > li.open > a,
.wi-top-menubar .navbar-nav > li.open > a:hover,
.wi-top-menubar .navbar-nav > li.open > a:focus {
    background-color: #1a252f;
    color: #fff;
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
}

/* Dropdown Carets */
.wi-top-menubar .caret {
    display: inline-block;
    width: 0;
    height: 0;
    margin-left: 5px;
    vertical-align: middle;
    border-top: 4px solid;
    border-right: 4px solid transparent;
    border-left: 4px solid transparent;
}

/* Standard Dropdown Menu */
.wi-top-menubar .dropdown-menu {
    position: absolute;
    top: 100%;
    left: 0;
    z-index: 1000;
    display: none;
    min-width: 220px;
    padding: 5px 0;
    margin: 0;
    list-style: none;
    font-size: 14px;
    background-color: #fff;
    border: 1px solid #ddd;
    border-radius: 4px;
    box-shadow: 0 6px 12px rgba(0,0,0,.175);
}

.wi-top-menubar .dropdown.open > .dropdown-menu {
    display: block;
}

/* Animation for dropdown appearance */
@keyframes dropdownFadeIn {
    from {
        opacity: 0;
        transform: translateY(-10px);
    }
    to {
        opacity: 1;
        transform: translateY(0);
    }
}

.wi-top-menubar .dropdown.open > .dropdown-menu {
    animation: dropdownFadeIn 0.3s ease forwards;
}

.wi-top-menubar .dropdown-menu > li > a {
    display: block;
    padding: 8px 20px;
    clear: both;
    font-weight: normal;
    line-height: 1.5;
    color: #333;
    white-space: nowrap;
    text-decoration: none;
    transition: all 0.2s ease;
}

.wi-top-menubar .dropdown-menu > li > a:hover,
.wi-top-menubar .dropdown-menu > li > a:focus {
    color: #fff;
    background-color: #0073aa;
}

.wi-top-menubar .dropdown-menu > li > a.dropdown-blue {
    color: #0073aa;
    font-weight: 600;
}

.wi-top-menubar .dropdown-menu > li > a.dropdown-blue:hover {
    color: #fff;
    background-color: #0073aa;
}

/* Mega Dropdown Menu */
.wi-top-menubar .dropdown-menu-large {
    width: auto;
    min-width: min(900px, calc(100vw - 40px));
    max-width: min(1200px, calc(100vw - 40px));
    padding: 20px 15px;
    background-color: #ffffff;
    border: 1px solid #e1e4e8;
    border-top: 3px solid #0073aa;
    box-shadow: 0 8px 24px rgba(0,0,0,0.15);
}

.wi-top-menubar .dropdown-large .dropdown-menu {
    position: absolute;
    left: auto;
    right: auto;
    transform: none;
}

/* Ensure mega menu doesn't go off-screen */
@media (min-width: 992px) {
    /* Center the container and let dropdowns position naturally */
    .wi-top-menubar .container-fluid {
        position: relative;
    }
    
    /* Ensure dropdown never goes beyond viewport edges */
    .wi-top-menubar .dropdown-menu-large {
        max-width: calc(100vw - 40px);
    }
}

.wi-top-menubar .dropdown-menu-large .row {
    margin-left: -15px;
    margin-right: -15px;
    display: flex;
    flex-wrap: wrap;
}

.wi-top-menubar .dropdown-menu-large .col-sm-3 {
    padding: 0 15px;
    position: relative;
    transition: background-color 0.3s ease;
    border-radius: 6px;
}

.wi-top-menubar .dropdown-menu-large .col-sm-3:hover {
    background-color: #f8fafc;
}

/* Add borders between columns, except for rightmost columns in each row */
.wi-top-menubar .dropdown-menu-large .col-sm-3:nth-child(1):after,
.wi-top-menubar .dropdown-menu-large .col-sm-3:nth-child(2):after,
.wi-top-menubar .dropdown-menu-large .col-sm-3:nth-child(3):after,
.wi-top-menubar .dropdown-menu-large .col-sm-3:nth-child(6):after,
.wi-top-menubar .dropdown-menu-large .col-sm-3:nth-child(7):after,
.wi-top-menubar .dropdown-menu-large .col-sm-3:nth-child(8):after {
    content: "";
    position: absolute;
    right: 0;
    top: 10px;
    bottom: 10px;
    width: 1px;
    background: #e1e4e8;
}

.wi-top-menubar .dropdown-menu-large ul {
    padding: 0;
    list-style: none;
}

.wi-top-menubar .dropdown-header {
    font-size: 14px;
    font-weight: 600;
    padding: 6px 0;
    margin-top: 0;
    margin-bottom: 12px;
    color: #2c3e50;
    border-bottom: 1px solid #e1e4e8;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
}

.wi-top-menubar .dropdown-header a {
    color: #0073aa;
    text-decoration: none;
    font-weight: 600;
    font-size: 14px;
    transition: all 0.3s ease;
    display: inline-block;
    max-width: 100%;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
}

.wi-top-menubar .dropdown-header a:hover {
    color: #005177;
    text-decoration: none;
}

.wi-top-menubar .dropdown-header.black {
    color: #666;
    font-weight: 500;
    font-size: 11px;
    text-transform: uppercase;
    letter-spacing: 0.3px;
    margin-bottom: 10px;
    padding: 4px 0;
    border-bottom: none;
}

.wi-top-menubar .dropdown-menu-large li {
    list-style: none;
}

.wi-top-menubar .dropdown-menu-large li a {
    display: block;
    padding: 8px 0;
    color: #4a5568;
    text-decoration: none;
    font-size: 14px;
    line-height: 1.5;
    transition: all 0.2s ease;
    position: relative;
    padding-left: 15px;
}

.wi-top-menubar .dropdown-menu-large li a:before {
    content: "›";
    position: absolute;
    left: 0;
    color: #cbd5e0;
    font-size: 16px;
    transition: all 0.2s ease;
}

.wi-top-menubar .dropdown-menu-large li a:hover {
    color: #0073aa;
    text-decoration: none;
    padding-left: 20px;
}

.wi-top-menubar .dropdown-menu-large li a:hover:before {
    color: #0073aa;
    left: 5px;
}

/* Mobile Toggle Button */
.wi-mobile-menu-toggle {
    display: none;
    float: right;
    padding: 9px 10px;
    margin: 8px 15px 8px 0;
    background-color: transparent;
    border: 1px solid #ecf0f1;
    border-radius: 4px;
    cursor: pointer;
}

.wi-mobile-menu-toggle:hover {
    background-color: #34495e;
}

.wi-mobile-menu-toggle .icon-bar {
    display: block;
    width: 22px;
    height: 2px;
    background-color: #ecf0f1;
    border-radius: 1px;
    margin: 4px 0;
}

/* Hover Effects for Desktop */
@media (min-width: 768px) {
    .wi-top-menubar .dropdown:hover > .dropdown-menu {
        display: block;
    }
    
    .wi-top-menubar .dropdown > a:focus {
        background-color: transparent;
    }
}

/* Responsive Styles - Smooth scaling */
@media (max-width: 1200px) {
    .wi-top-menubar .dropdown-menu-large {
        /* Use CSS clamp for smooth responsive sizing */
        padding: clamp(15px, 2vw, 20px) clamp(10px, 1.5vw, 15px);
    }
    
    .wi-top-menubar .dropdown-menu-large .col-sm-3 {
        padding: 0 clamp(10px, 1.5vw, 20px);
    }
    
    .wi-top-menubar .dropdown-header {
        font-size: clamp(12px, 1vw, 14px);
    }
    
    .wi-top-menubar .dropdown-header a {
        font-size: clamp(12px, 1vw, 14px);
    }
    
    .wi-top-menubar .dropdown-header.black {
        font-size: clamp(10px, 0.8vw, 11px);
    }
    
    .wi-top-menubar .dropdown-menu-large li a {
        font-size: clamp(12px, 1vw, 14px);
        padding: clamp(5px, 0.5vw, 8px) 0;
    }
}

@media (max-width: 991px) {
    .wi-top-menubar .dropdown-menu-large {
        min-width: 100%;
        max-width: 100%;
        width: 100%;
    }
    
    .wi-top-menubar .dropdown-large .dropdown-menu {
        left: 0 !important;
        right: 0 !important;
        transform: none !important;
    }
    
    .wi-top-menubar .dropdown-menu-large .col-sm-3 {
        width: 50%;
        float: left;
        margin-bottom: 20px;
    }
    
    .wi-top-menubar .container-fluid {
        justify-content: space-between;
    }
}

@media (max-width: 767px) {
    .wi-mobile-menu-toggle {
        display: block;
        background-color: transparent;
        border-color: #ecf0f1;
    }
    
    .wi-mobile-menu-toggle:hover {
        background-color: #34495e;
    }
    
    .wi-mobile-menu-toggle .icon-bar {
        background-color: #ecf0f1;
    }
    
    .wi-top-menubar .container-fluid {
        justify-content: space-between;
    }
    
    .wi-top-menubar .navbar-nav {
        display: none;
        width: 100%;
        flex-direction: column;
        background-color: #2c3e50;
        position: absolute;
        top: 100%;
        left: 0;
        right: 0;
        border-top: 1px solid #34495e;
        max-height: calc(100vh - 60px);
        overflow-y: auto;
    }
    
    .wi-top-menubar .navbar-nav.active {
        display: flex;
    }
    
    .wi-top-menubar .navbar-nav > li {
        width: 100%;
        border-bottom: 1px solid #34495e;
    }
    
    .wi-top-menubar .navbar-nav > li > a {
        padding: 15px 20px;
        color: #ecf0f1;
        font-size: 16px;
    }
    
    .wi-top-menubar .navbar-nav > li > a:hover,
    .wi-top-menubar .navbar-nav > li > a:focus {
        background-color: #34495e;
        color: #fff;
    }
    
    /* Mobile dropdown styles - slide down animation */
    .wi-top-menubar .dropdown-menu {
        position: static;
        width: 100%;
        box-shadow: none;
        border: none;
        border-radius: 0;
        background-color: #34495e !important;
        display: none;
        animation: none;
        padding: 0;
        margin: 0;
        overflow: hidden;
    }
    
    .wi-top-menubar .dropdown.open > .dropdown-menu {
        display: block;
    }
    
    /* Slide animation for all dropdowns */
    .wi-top-menubar .dropdown-menu {
        max-height: 0;
        transition: max-height 0.3s ease-out;
    }
    
    .wi-top-menubar .dropdown.open > .dropdown-menu {
        max-height: 2000px;
        transition: max-height 0.5s ease-in;
        overflow-y: auto;
    }
    
    /* Special handling for mega menu */
    .wi-top-menubar .dropdown.open > .dropdown-menu-large {
        max-height: calc(100vh - 100px);
        overflow-y: auto;
    }
    
    /* Standard dropdown items */
    .wi-top-menubar .dropdown-menu > li > a {
        color: #fff !important;
        padding: 12px 35px;
        background-color: transparent;
        transition: all 0.2s ease;
    }
    
    .wi-top-menubar .dropdown-menu > li > a:hover,
    .wi-top-menubar .dropdown-menu > li > a:focus {
        background-color: #1a252f;
        color: #fff !important;
        padding-left: 40px;
    }
    
    .wi-top-menubar .dropdown-menu > li > a.dropdown-blue {
        color: #fff !important;
        font-weight: 600;
    }
    
    .wi-top-menubar .dropdown-menu > li > a.dropdown-blue:hover {
        color: #fff !important;
        background-color: #0073aa;
    }
    
    /* Mega menu mobile styles */
    .wi-top-menubar .dropdown-menu-large {
        padding: 0;
        background-color: #34495e !important;
        border: none;
        box-shadow: none;
    }
    
    /* Hide clearfix gaps in mobile */
    .wi-top-menubar .dropdown-menu-large .clearfix {
        display: none;
    }
    
    .wi-top-menubar .dropdown-menu-large .col-sm-3 {
        width: 100%;
        padding: 15px 20px;
        background-color: transparent;
        border-bottom: none;
        border-radius: 0;
    }
    
    .wi-top-menubar .dropdown-menu-large .col-sm-3:after {
        display: none;
    }
    
    .wi-top-menubar .dropdown-menu-large .col-sm-3:not(:first-child) {
        border-top: 1px solid #3a526b;
        margin-top: 0;
        padding-top: 15px;
    }
    
    /* Mobile dropdown headers */
    .wi-top-menubar .dropdown-header {
        padding: 8px 15px;
        margin: 0;
        border-bottom: 1px solid #3a526b;
        color: #ecf0f1;
        font-size: 14px;
        white-space: normal;
        text-overflow: initial;
    }
    
    .wi-top-menubar .dropdown-header a {
        color: #3498db;
        font-size: 14px;
        font-weight: 600;
        white-space: normal;
        display: block;
    }
    
    .wi-top-menubar .dropdown-header a:hover {
        color: #5dade2;
    }
    
    .wi-top-menubar .dropdown-header.black {
        color: #95a5a6;
        font-size: 11px;
        text-transform: uppercase;
        padding: 5px 15px;
        border: none;
        margin-bottom: 5px;
    }
    
    /* Mobile mega menu links */
    .wi-top-menubar .dropdown-menu-large li {
        margin: 0;
    }
    
    .wi-top-menubar .dropdown-menu-large li a {
        color: #ecf0f1;
        padding: 8px 15px 8px 25px;
        font-size: 14px;
        transition: all 0.2s ease;
        display: block;
    }
    
    .wi-top-menubar .dropdown-menu-large li a:before {
        display: none;
    }
    
    .wi-top-menubar .dropdown-menu-large li a:hover,
    .wi-top-menubar .dropdown-menu-large li a:focus {
        background-color: #1a252f;
        color: #fff;
        padding-left: 30px;
    }
    
    /* Improve scrolling */
    .wi-top-menubar .navbar-nav::-webkit-scrollbar,
    .wi-top-menubar .dropdown-menu::-webkit-scrollbar {
        width: 4px;
    }
    
    .wi-top-menubar .navbar-nav::-webkit-scrollbar-track,
    .wi-top-menubar .dropdown-menu::-webkit-scrollbar-track {
        background: #34495e;
    }
    
    .wi-top-menubar .navbar-nav::-webkit-scrollbar-thumb,
    .wi-top-menubar .dropdown-menu::-webkit-scrollbar-thumb {
        background: #1a252f;
        border-radius: 2px;
    }
    
    /* Ensure mega menu is scrollable */
    .wi-top-menubar .dropdown-menu-large {
        -webkit-overflow-scrolling: touch;
    }
    
    /* Prevent overlap by indenting nested dropdowns */
    .wi-top-menubar .dropdown.open + li {
        margin-top: 0;
    }
}

/* Clearfix */
.wi-top-menubar .clearfix::after {
    content: "";
    display: table;
    clear: both;
}

/* Font Awesome Icon Support */
.wi-top-menubar .fa {
    margin-left: 5px;
}

/* Account Menu Logout Specific */
.wi-top-menubar .header-menu-logout {
    color: #e74c3c !important;
}

.wi-top-menubar .header-menu-logout:hover {
    color: #c0392b !important;
    background-color: #fee;
}

/* Z-index Management */
.wi-top-menubar {
    z-index: 1030;
}

.wi-top-menubar .dropdown-menu {
    z-index: 1031;
}

/* Admin Bar Compatibility - Removed to prevent spacing issues */

/* Smooth Transitions */
.wi-top-menubar,
.wi-top-menubar a,
.wi-top-menubar .dropdown-menu {
    transition: all 0.3s ease;
}