/*
 * Topbar2 Styling
 * Clean, modern top navigation bar
 * Designed to work independently without conflicts
 */

/* Main Topbar2 Container */
#topBar2.topbar2 {
    background-color: #fff;
    border-bottom: 1px solid rgba(0,0,0,0.1);
    min-height: 40px;
    line-height: 40px;
    z-index: 10;
    position: relative;
    font-size: 12px;
}

/* Mobile Menu Integration */
/* Ensure topbar2 works with mobile menu */
body.mobile-menu-open #topBar2 {
    z-index: 9998; /* Lower than mobile menu overlay */
}

/* Hide topbar2 dropdowns when mobile menu is open */
body.mobile-menu-open #topBar2 .dropdown-menu {
    display: none !important;
}

/* Ensure mobile menu hamburger is above topbar2 */
.mobile_menu_hamburger {
    z-index: 1000065 !important;
    position: relative;
}

/* Mobile menu overlay should be above everything */
.sidenav {
    z-index: 99999999 !important;
}

/* Smooth transitions for mobile menu coordination */
#topBar2 .dropdown-menu,
.flagset-dropdown .dropdown-menu {
    transition: opacity 0.3s ease, visibility 0.3s ease;
}

/* Mobile menu open state */
body.mobile-menu-open {
    overflow: hidden;
}

/* Remove margins from Bootstrap columns */
#topBar2 .row > [class*="col-"] {
    margin: 0 !important;
}

/* Dark theme support */
#topBar2.topbar2.dark {
    background-color: #363839;
    border-bottom-color: rgba(255,255,255,0.1);
    color: #ccc;
}

/* User Info Section */
.topbar2-user-info,
.topbar2-guest-info {
    display: inline-block;
}

.topbar2-user-info .text-welcome,
.topbar2-guest-info .text-welcome {
    color: #151515;
    font-size: 12px;
    line-height: 40px;
    text-decoration: none;
}

#topBar2.dark .topbar2-user-info .text-welcome,
#topBar2.dark .topbar2-guest-info .text-welcome {
    color: #fff;
}

/* Language Dropdown (Flagset) */
.topbar2 .flagset-dropdown {
    display: inline-block;
    margin-right: 10px;
    vertical-align: middle;
    align-self: center;
}

.topbar2 .flagset-dropdown .btn.dropdown-toggle {
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.3);
    color: #2c3e50;
    padding: 5px 10px;
    margin-top: 0;
    height: 30px;
    line-height: 20px;
    transition: all 0.3s ease;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.topbar2 .flagset-dropdown .btn.dropdown-toggle:hover {
    background: rgba(255,255,255,1);
    border-color: rgba(255,255,255,0.5);
}

.topbar2 .flagset-dropdown .flag-lang {
    margin-right: 5px;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
}

/* Language dropdown menu */
.topbar2 .flagset-dropdown .dropdown-menu {
    min-width: 120px;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-top: 5px;
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
    z-index: 100000 !important;
    background: white !important;
    padding: 8px 0;
    display: none;
    visibility: visible !important;
    opacity: 1 !important;
}

/* Ensure dropdowns appear above mobile menu bar */
#topBar2 .flagset-dropdown .dropdown-menu,
#topBar2 .topbar2-user-dropdown .dropdown-menu {
    z-index: 100000 !important;
}

/* Language dropdown open state */
.topbar2 .flagset-dropdown.open .dropdown-menu {
    display: block !important;
}

/* Language dropdown menu items */
.topbar2 .flagset-dropdown .dropdown-menu li {
    margin: 0;
    list-style: none;
    display: block;
    width: 100%;
}

.topbar2 .flagset-dropdown .dropdown-menu li a {
    transition: all 0.2s ease;
    border-radius: 4px;
    margin: 0;
    display: block !important;
    width: 100% !important;
    cursor: pointer;
    color: #333 !important;
    text-decoration: none !important;
    visibility: visible !important;
    opacity: 1 !important;
    background: transparent;
}

.topbar2 .flagset-dropdown .dropdown-menu li a:hover {
    background-color: #f5f5f5 !important;
    color: #000 !important;
}

.topbar2 .flagset-dropdown .dropdown-menu .flag-lang {
    margin-right: 8px;
    border-radius: 2px;
    box-shadow: 0 1px 3px rgba(0,0,0,0.2);
    visibility: visible !important;
    opacity: 1 !important;
}

/* Right side container for horizontal alignment */
.topbar2-right-container {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 10px;
}

/* User Dropdown */
.topbar2-user-dropdown {
    display: inline-block;
    position: relative;
    vertical-align: middle;
    align-self: center;
    margin-left: 10px;
}

.topbar2-user-dropdown .btn.dropdown-toggle {
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.3);
    color: #2c3e50;
    padding: 5px 10px;
    margin-top: 0;
    height: 30px;
    line-height: 20px;
    transition: all 0.3s ease;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
}

.topbar2-user-dropdown .btn.dropdown-toggle:hover {
    background: rgba(255,255,255,1);
    border-color: rgba(255,255,255,0.5);
}

.topbar2-user-dropdown .dropdown-menu {
    min-width: 150px;
    border-radius: 8px;
    border: 1px solid #e1e8ed;
    box-shadow: 0 4px 15px rgba(0,0,0,0.1);
    margin-top: 5px;
    position: absolute !important;
    right: 0 !important;
    left: auto !important;
    z-index: 100000 !important;
    background: white !important;
    padding: 8px 0;
    display: none;
}

.topbar2-user-dropdown.open .dropdown-menu {
    display: block !important;
}

.topbar2-user-dropdown .dropdown-menu li {
    margin: 0;
}

.topbar2-user-dropdown .dropdown-menu li a {
    padding: 8px 15px;
    font-size: 12px;
    color: #333;
    text-decoration: none;
    display: block;
    transition: all 0.2s ease;
}

.topbar2-user-dropdown .dropdown-menu li a:hover {
    background-color: #f5f5f5;
    color: #000;
}

.topbar2-user-dropdown .dropdown-menu li a i {
    margin-right: 8px;
    width: 14px;
}

.topbar2-user-dropdown .dropdown-menu .divider {
    height: 1px;
    margin: 5px 0;
    background-color: #e5e5e5;
}

/* Auth Links (Login/Register) - Styled like user dropdown */
.topbar2-auth-links {
    display: inline-block;
    vertical-align: middle;
    align-self: center;
}

.topbar2-auth-links .nav-pills {
    margin: 0;
    padding: 0;
}

.topbar2-auth-links .nav-pills > li {
    display: inline-block;
    margin: 0 5px 0 0;
    padding: 0;
}

.topbar2-auth-links .nav-pills > li > a {
    background: rgba(255,255,255,0.9);
    border: 1px solid rgba(255,255,255,0.3);
    color: #2c3e50;
    padding: 5px 10px;
    margin-top: 3px;
    height: 30px;
    line-height: 20px;
    border-radius: 20px;
    font-size: 13px;
    font-weight: 500;
    text-decoration: none;
    display: block;
    transition: all 0.3s ease;
}

.topbar2-auth-links .nav-pills > li:hover > a,
.topbar2-auth-links .nav-pills > li:focus > a {
    background: rgba(255,255,255,1);
    border-color: rgba(255,255,255,0.5);
    color: #2c3e50;
}

.topbar2-auth-links .nav-pills > li.active > a {
    background: rgba(255,255,255,1);
    color: #2c3e50;
}

.topbar2-auth-links .nav-pills > li > a i {
    margin-right: 5px;
}

/* Responsive Design */
@media (max-width: 768px) {
    #topBar2.topbar2 {
        text-align: center;
        padding: 5px 0;
        font-size: 1.4rem;
    }
    
    .topbar2-user-info,
    .topbar2-guest-info {
        display: none;
    }
    
    .topbar2-right-container {
        justify-content: flex-end;
        gap: 5px;
    }
    
    .topbar2 .flagset-dropdown,
    .topbar2-user-dropdown,
    .topbar2-auth-links {
        display: inline-block;
        margin: 0;
        vertical-align: middle;
    }
    
    .topbar2 .flagset-dropdown {
        margin-right: 8px;
    }
    
    /* Mobile user name styling */
    .topbar2-mobile-user-name {
        margin-right: 5px;
    }
    
    .topbar2 .flagset-dropdown .btn.dropdown-toggle,
    .topbar2-user-dropdown .btn.dropdown-toggle {
        font-size: 1.4rem;
        padding: 4px 8px;
        height: 32px;
        line-height: 24px;
        margin-top: 0;
    }
    
    .topbar2-auth-links .nav-pills > li > a {
        font-size: 1.4rem;
        padding: 4px 8px;
        height: 32px;
        line-height: 24px;
        margin-top: 0;
    }
    
    .topbar2-auth-links .nav-pills > li {
        margin: 0 3px 0 0;
    }
    
    /* Universal mobile browser fixes for dropdown positioning */
    .topbar2 .flagset-dropdown .dropdown-menu,
    .topbar2-user-dropdown .dropdown-menu {
        position: fixed !important;
        max-width: 90vw !important;
        width: auto !important;
        transform: none !important;
        top: auto !important;
        bottom: auto !important;
        margin: 0 !important;
        box-sizing: border-box !important;
    }
    
    /* Language dropdown - appears below the button */
    .topbar2 .flagset-dropdown .dropdown-menu {
        left: auto !important;
        right: auto !important;
        max-width: 200px !important;
        min-width: 120px !important;
    }
    
    /* User dropdown - appears to the right */
    .topbar2-user-dropdown .dropdown-menu {
        right: 0 !important;
        left: auto !important;
        max-width: 250px !important;
        min-width: 150px !important;
    }
}

/* Hide on very small screens if needed */
@media (max-width: 480px) {
    .topbar2-user-info .text-welcome,
    .topbar2-guest-info .text-welcome {
        font-size: 11px;
    }
}
