/* TopBar Menu Styles */
.topbar-menu {
    position: sticky;
    top: 0;
    left: 0;
    right: 0;
    height: 60px;
    background-color: var(--secondary-color);
    z-index: 1000;
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 0 2rem;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.1);
}

.topbar-left {
    display: flex;
    align-items: center;
}

.topbar-logo-link {
    display: flex;
    align-items: center;
    text-decoration: none;
    cursor: default;
    pointer-events: none;
    height: 100%;
}

.topbar-logo {
    height: 20px;
    width: auto;
    object-fit: contain;
}

.topbar-right {
    display: flex;
    align-items: center;
    gap: 1rem;
}

/* Navigation Menu */
.topbar-nav {
    flex: 1;
    display: flex;
    justify-content: center;
    align-items: center;
}

.menu-list {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex;
    gap: 0.5rem;
    align-items: center;
}

.menu-item {
    position: relative;
    height: 60px;
    display: flex;
    align-items: center;
}

.menu-link {
    color: #ffffff;
    text-decoration: none;
    padding: 0 12px;
    display: flex;
    align-items: center;
    height: 100%;
    font-size: 14px;
    font-weight: 500;
    transition: color 0.3s ease;
    cursor: pointer;
}

.menu-link:hover {
    color: var(--primary-color);
}

/* Submenu */
.submenu {
    position: absolute;
    top: 100%;
    left: 50%;
    transform: translateX(-50%);
    background-color: #2d2d2d;
    min-width: 175px;
    list-style: none;
    margin: 0;
    padding: 4px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 0 0 8px 8px;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid #444444;
    border-top: none;
}

.menu-item:hover .submenu {
    opacity: 1;
    visibility: visible;
}

.submenu li {
    margin: 0;
    padding: 0;
}

.submenu a {
    display: flex;
    align-items: center;
    padding: 6px 12px 6px 16px;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.submenu a:hover {
    background-color: rgba(240, 116, 0, 0.1);
    color: var(--primary-color);
    padding-left: 20px;
}

.submenu-icon {
    display: inline-flex;
    align-items: center;
    margin-right: 8px;
    font-size: 16px;
}

/* Submenu Separator */
.submenu-separator {
    height: 1px;
    background-color: rgba(255, 255, 255, 0.15);
    margin: 6px 12px;
}

/* Submenu Items (for nested submenus) */
.submenu-item {
    position: relative;
}

.submenu-link {
    display: flex;
    align-items: center;
    justify-content: space-between;
    padding: 6px 12px 6px 16px;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
    cursor: pointer;
}

.submenu-link::after {
    content: '›';
    font-size: 18px;
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.submenu-link:hover {
    background-color: rgba(240, 116, 0, 0.1);
    color: var(--primary-color);
    padding-left: 20px;
}

/* Subsubmenu */
.subsubmenu {
    position: absolute;
    left: 100%;
    top: 0;
    background-color: #1f1f1f;
    min-width: 175px;
    list-style: none;
    margin: 0;
    padding: 4px 0;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
    border-radius: 0 8px 8px 0;
    opacity: 0;
    visibility: hidden;
    transition: all 0.3s ease;
    border: 1px solid #444444;
    border-left: none;
}

.submenu-item:hover .subsubmenu {
    opacity: 1;
    visibility: visible;
}

.subsubmenu li {
    margin: 0;
    padding: 0;
}

.subsubmenu a {
    display: flex;
    align-items: center;
    padding: 6px 12px 6px 16px;
    color: #ffffff;
    text-decoration: none;
    font-size: 13px;
    transition: all 0.3s ease;
}

.subsubmenu a:hover {
    background-color: rgba(240, 116, 0, 0.1);
    color: var(--primary-color);
    padding-left: 20px;
}

/* Disabled menu items */
.submenu a.disabled,
.subsubmenu a.disabled {
    color: #666666 !important;
    cursor: default !important;
    pointer-events: none !important;
    opacity: 0.4 !important;
    user-select: none !important;
}

.submenu a.disabled:hover,
.subsubmenu a.disabled:hover {
    background-color: transparent !important;
    padding-left: 16px !important;
    color: #666666 !important;
}

.submenu-link.disabled {
    color: #666666 !important;
    cursor: default !important;
    pointer-events: none !important;
    opacity: 0.4 !important;
    user-select: none !important;
}

.submenu-link.disabled:hover {
    background-color: transparent !important;
    padding-left: 16px !important;
    color: #666666 !important;
}

.submenu-link.disabled::after {
    color: #666666 !important;
}

/* Home Button */
.home-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
    text-decoration: none;
    margin-right: 0.5rem;
}

.home-btn:hover {
    transform: scale(1.1);
}

.home-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* Logout Button */
.logout-btn {
    background: transparent;
    border: none;
    padding: 4px;
    cursor: pointer;
    display: flex;
    align-items: center;
    justify-content: center;
    transition: all 0.3s ease;
}

.logout-btn:hover {
    transform: scale(1.1);
}

.logout-btn:hover svg {
    stroke: #ff4d4d;
}

.logout-btn svg {
    width: 20px;
    height: 20px;
    stroke: white;
}

/* Hamburger Menu Button */
.hamburger-btn {
    display: none;
    background: transparent;
    border: none;
    cursor: pointer;
    padding: 8px;
    z-index: 1001;
}

.hamburger-btn span {
    display: block;
    width: 25px;
    height: 3px;
    background-color: white;
    margin: 5px 0;
    transition: all 0.3s ease;
    border-radius: 2px;
}

.hamburger-btn.active span:nth-child(1) {
    transform: rotate(45deg) translate(8px, 8px);
}

.hamburger-btn.active span:nth-child(2) {
    opacity: 0;
}

.hamburger-btn.active span:nth-child(3) {
    transform: rotate(-45deg) translate(7px, -7px);
}

/* Mobile Responsive Styles */
@media (max-width: 768px) {
    .topbar-menu {
        padding: 0 1rem;
    }

    .topbar-logo {
        height: 18px;
    }

    .hamburger-btn {
        display: block;
    }

    .topbar-nav {
        position: fixed;
        top: 60px;
        left: -100%;
        width: 100%;
        height: calc(100vh - 60px);
        background-color: var(--secondary-color);
        flex-direction: column;
        justify-content: flex-start;
        padding: 2rem 0;
        transition: left 0.3s ease;
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
    }

    .topbar-nav.active {
        left: 0;
    }

    .menu-list {
        flex-direction: column;
        width: 100%;
        gap: 0;
    }

    .menu-item {
        width: 100%;
        height: auto;
    }

    .menu-link {
        width: 100%;
        padding: 1rem 1.5rem;
        justify-content: space-between;
        font-size: 16px;
        border-bottom: 1px solid rgba(255, 255, 255, 0.1);
    }

    .submenu {
        position: static;
        transform: none;
        width: 100%;
        opacity: 1;
        visibility: visible;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        border: none;
        border-radius: 0;
        background-color: rgba(0, 0, 0, 0.2);
    }

    .menu-item.active .submenu {
        max-height: 500px;
    }

    .submenu a {
        padding: 0.75rem 2rem;
        font-size: 14px;
    }

    .submenu-link {
        padding: 0.75rem 2rem;
        font-size: 14px;
        width: 100%;
        justify-content: space-between;
    }

    .submenu-link::after {
        transform: rotate(0deg);
    }

    .submenu-item.active .submenu-link::after {
        transform: rotate(90deg);
    }

    .subsubmenu {
        position: static;
        left: auto;
        top: auto;
        width: 100%;
        opacity: 1;
        visibility: visible;
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
        border: none;
        border-radius: 0;
        background-color: rgba(0, 0, 0, 0.3);
    }

    .submenu-item.active .subsubmenu {
        max-height: 500px;
    }

    .subsubmenu a {
        padding: 0.625rem 3rem;
        font-size: 13px;
    }

    .topbar-right {
        gap: 0.5rem;
    }

    .home-btn, .theme-toggle-btn, .logout-btn {
        padding: 6px;
    }

    .home-btn svg, .theme-toggle-btn svg, .logout-btn svg {
        width: 18px;
        height: 18px;
    }
}

@media (max-width: 480px) {
    .topbar-menu {
        padding: 0 0.75rem;
    }

    .topbar-logo {
        height: 16px;
    }

    .menu-link {
        font-size: 15px;
        padding: 0.875rem 1rem;
    }

    .submenu a {
        padding: 0.625rem 1.5rem;
        font-size: 13px;
    }

    .submenu-link {
        padding: 0.625rem 1.5rem;
        font-size: 13px;
    }

    .subsubmenu a {
        padding: 0.5rem 2.5rem;
        font-size: 12px;
    }
}
