/* 全寬背景色容器 */

.menu-color {
    background-color: rgba(34, 83, 127, 0.8);
    width: 100%;
    position: fixed;
    top: 0;
    left: 0;
    z-index: 999;
    box-shadow: 0 2px 10px rgba(0,0,0,0.1);
}

/* 全屏菜单背景层 */
.menu-overlay {
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(34, 83, 127, 0.8);
    z-index: 998;
    opacity: 0;
    visibility: hidden;
    transition: opacity 0.3s, visibility 0.3s;
}

.menu-overlay.show {
    opacity: 1;
    visibility: visible;
}

/* 主容器設定 - 桌面版 */
.menu-wrapper {
    padding: 10px 20px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    flex-wrap: nowrap;
    width: 100%;
}

/* 滚动容器 - 桌面版 */
.menu-scroll-container {
    display: flex;
    align-items: center;
    width: 100%;
    justify-content: space-between;
}

/* Logo樣式 */
.menu-logo {
    width: 250px;
    height: 250px;
    position: fixed;
    padding-left: 10px;
    z-index: 1000;
}

.menu-logo img {
    width: 100%;
    height: 100%;
    object-fit: contain;
}

/* 主導航菜單 - 桌面版 */
.top-menu {
    list-style-type: none;
    display: flex;
    margin: 0;
    padding: 0;
    justify-content: flex-start;
    flex-grow: 1;
    order: 1;
}

.top-menu li {
    position: relative;
    text-align: center;
    width: auto;
    min-width: 100px;
    height: 55px;
    font-size: 18px;
    font-weight: 800;
    padding: 0 10px;
}

/* 分隔線 - 桌面版 */
.top-menu li:not(:last-child)::after {
    content: "|";
    position: absolute;
    right: 0;
    top: 50%;
    transform: translateY(-50%);
    color: rgba(255, 255, 255, 0.5);
    font-size: 14px;
}

.top-menu a {
    text-decoration: none;
    color: #fff;
    display: block;
    height: 100%;
    line-height: 58px;
    transition: color 0.3s;
}

.top-menu a:hover {
    color: rgba(255, 255, 255, 0.7);
}

/* 圖標菜單 - 桌面版 */
.top-icon {
    list-style-type: none;
    display: flex;
    margin: 0;
    padding: 0;
    justify-content: flex-end;
    flex-shrink: 0;
    order: 2;
    margin-left: 20px;
}

.top-icon li {
    width: 52px;
    height: 52px;
    margin-left: 10px;
}

.top-icon a {
    display: flex;
    align-items: center;
    justify-content: center;
    height: 100%;
}

.top-icon img {
    width: 50px;
    height: 50px;
    transition: opacity 0.3s;
    object-fit: contain;
}

.top-icon a:hover img {
    opacity: 0.7;
}

/* 修正後的漢堡菜單按鈕 - 確保顯示完美X形 */
.hamburger {
    /* 保持原有基本樣式不變 */
    display: none;
    cursor: pointer;
    position: fixed;
    right: 20px;
    top: 20px;
    background: transparent;
    border: none;
    padding: 12px;
    z-index: 1000;
    transition: transform 0.3s ease;
    outline: none;
}

.hamburger-box {
    width: 30px;
    height: 24px;
    display: inline-block;
    position: relative;
}

.hamburger-inner {
    width: 100%;
    height: 3px;
    background-color: #fff;
    position: absolute;
    left: 0;
    top: 50%;
    transform: translateY(-50%);
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
    border-radius: 3px;
}

.hamburger-inner::before,
.hamburger-inner::after {
    content: "";
    width: 100%;
    height: 3px;
    background-color: #fff;
    position: absolute;
    left: 0;
    transition: all 0.3s cubic-bezier(0.645, 0.045, 0.355, 1);
    border-radius: 3px;
}

.hamburger-inner::before {
    top: -10px; /* 調整為10px間距 */
    transform-origin: center; /* 確保旋轉中心點正確 */
}

.hamburger-inner::after {
    bottom: -10px; /* 調整為10px間距 */
    transform-origin: center; /* 確保旋轉中心點正確 */
}

/* 關鍵修正 - 完美X形轉換 */
.hamburger[aria-expanded="true"] .hamburger-inner {
    background-color: transparent !important; /* 確保完全透明 */
    transform: translateY(-50%) scale(0.9); /* 輕微縮小以改善視覺效果 */
}

.hamburger[aria-expanded="true"] .hamburger-inner::before {
    top: 0; /* 移動到垂直中心 */
    transform: rotate(45deg) translateY(0) scaleX(0.9); /* 精確45度 */
}

.hamburger[aria-expanded="true"] .hamburger-inner::after {
    bottom: 0; /* 移動到垂直中心 */
    transform: rotate(-45deg) translateY(0) scaleX(0.9); /* 精確-45度 */
}

/* 保持其他效果 */
.hamburger:hover .hamburger-inner,
.hamburger:hover .hamburger-inner::before,
.hamburger:hover .hamburger-inner::after {
    background-color: rgba(255, 255, 255, 0.9);
}

.hamburger:active {
    transform: scale(0.95);
}

.hamburger:focus-visible {
    outline: 2px solid rgba(255, 255, 255, 0.8);
    outline-offset: 2px;
}

.top-menu .spacer {
    width: 200px;
    visibility: hidden;
}

/* 確保body在菜單打開時不滾動 */
body.menu-open {
    overflow: hidden;
    position: fixed;
    width: 100%;
    height: 100%;
}

/* 響應式設計 - 移動版 */
@media (max-width: 1024px) {
    .menu-wrapper {
        flex-direction: column;
        padding: 0;
        height: auto;
    }
    
    .menu-scroll-container {
        flex-direction: column;
        padding-top: 55px;
        padding-bottom: 20px;
        max-height: calc(100vh - 0px);
        overflow-y: auto;
        -webkit-overflow-scrolling: touch;
        width: 100%;
    }
    
    .menu-logo {
        width: 180px;
        height: 180px;
        top: 5px;
        left: 5px;
    }
    
    .top-menu,
    .top-icon {
        width: 100%;
        display: none;
        padding: 15px 0;
        margin-left: 0;
        justify-content: center;
    }
    
    .top-menu.show {
        display: flex;
        flex-direction: column;
    }
    
    .top-icon.show {
        display: flex;
        flex-direction: row;
        padding-bottom: 20px;
    }
    
    .top-menu li::after {
        display: none;
    }
    
    .top-menu li {
        width: 100%;
        padding: 12px 0;
    }
    
    .top-menu a {
        padding: 12px 20px;
        line-height: 1.5;
    }
    
    .top-icon li {
        width: 50px;
        height: 50px;
        margin: 0 10px;
    }
    
    .top-icon img {
        width: 40px;
        height: 40px;
    }
    
    .hamburger {
        display: block;
    }
    
    /* 新增：隐藏spacer元素 */
    .top-menu li.spacer {
        display: none !important;
    }
	.menu-color {
        box-shadow: none;
    }
}

@media (max-width: 480px) {
    .menu-logo {
        width: 150px;
        height: 150px;
    }
       
    .top-icon li {
        width: 45px;
        height: 45px;
        margin: 0 5px;
    }
    
    .top-icon img {
        width: 35px;
        height: 35px;
    }
    
    .menu-scroll-container {
        padding-top: 70px;
    }
}