body {
    min-height: 100vh;
    display: flex;
    flex-direction: column;
    background-color: #c2c2c2;
    padding-top: 120px;
    /* 增加上方間距，確保內容不被 header 遮住 */
}

header {
    color: white;
    background-color: rgb(0, 0, 0);
    height: 110px;
    /* 增加 header 高度 */
    width: 100%;
    position: fixed;
    border: 5px #000000 solid;
    padding: 0 30px;
    /* 修改 padding */
    z-index: 1000;
    top: 0;
    left: 0;
}

header h1 {
    color: white;
    position: absolute;
    left: 120px;
    top: 0;
    line-height: 100px;
    background-image: url(images/logo1.png);
    background-repeat: no-repeat;
    background-position: center;
    background-size: 215px auto;
    width: 210px;
    text-indent: -9999px;
}

header li {
    display: inline;
    margin-right: 5vw;
    /* 從4vw增加到5vw */
    padding: 0 10px;
    /* 新增左右內間距 */
}

header a {
    color: white;
    text-decoration: none;
    position: relative;
    padding: 8px 0;
    transition: color 0.3s ease;
}

header a:after {
    content: '';
    position: absolute;
    width: 0;
    height: 2px;
    bottom: -5px;
    left: 0;
    background-color: #808080;
    transition: width 0.3s ease;
}

header a:hover {
    color: #808080;
    text-decoration: none;
}

header a:hover:after {
    width: 100%;
}

.menu-items {
    list-style: none;
    padding: 0;
    margin: 0;
    overflow: hidden;
    transition: max-h eight 0.3s ease;
    margin-right: 30px;
    margin-left: auto;
    padding-right: 50px;
    margin-top: 30px;
    /* 增加上方間距 */
}


.menu-items.open {
    max-height: 300px;
}

.menu {
    display: none;
    background-color: transparent;
    color: rgb(255, 255, 255);
    font-size: 35px;
    position: absolute;
    top: 25px;
    left: 30px;
    border: none;
    cursor: pointer;
}

nav {
    display: flex;
    align-items: center;
    justify-content: flex-end;
    height: 100px;
    width: 100%;
    overflow: visible;
}

.menu-items {
    margin-right: 30px;
    display: flex;
    align-items: center;
    position: static;
    line-height: normal;
    font-size: 20px;
    /* 調整字體大小 */
    overflow: visible;
}



.search-form {
    position: relative;
    display: flex;
    align-items: center;
    margin: 0 auto;
    margin-right: 30px;
    width: 320px;
    z-index: 1000;
    background: transparent;
    /* 或 background: none; */
    box-shadow: none;
    /* 如有陰影也可移除 */
    border-radius: 16px;
    padding: 0;
}

.search-form input[type="text"] {
    width: 100%;
    padding: 10px 15px;
    border: 2px solid #808080;
    border-radius: 25px;
    background-color: rgba(0, 0, 0, 0.85);
    /* 透明度提高 */
    color: #222;
    /* 文字顏色改深色 */
    font-size: 16px;
    transition: all 0.3s ease;
}

.search-form input[type="text"]:focus {
    outline: none;
    background-color: rgba(255, 255, 255, 0.2);
    border-color: #000000;
    box-shadow: 0 0 10px rgba(255, 255, 255, 0.2);
}

.search-form input[type="text"]::placeholder {
    color: rgba(255, 255, 255, 0.7);
}



.search-form button[type="submit"] {
    position: absolute;
    right: 10px;
    padding: 8px 15px;
    background: transparent;
    border: none;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
}

.search-form button[type="submit"]:hover {
    color: #808080;
    transform: scale(1.1);
}

/* 修改推薦列表的樣式 */
#suggest-list {
    position: absolute;
    top: 100%;
    left: 0;
    /* 改為從左側對齊 */
    width: 100%;
    /* 使用與搜尋欄相同的寬度 */
    background-color: rgba(0, 0, 0, 0.9) !important;
    border: 1px solid #808080 !important;
    border-radius: 10px;
    margin-top: 5px;
    z-index: 1002;
    padding: 0;
    list-style: none;
    display: none;
    max-height: 400px;
    overflow-y: auto;
}

/* 修改建議項目的樣式 */
#suggest-list li {
    padding: 10px 15px;
    color: white;
    cursor: pointer;
    transition: all 0.3s ease;
    white-space: normal;
    text-overflow: ellipsis;
    overflow: hidden;
    border-bottom: 1px solid #808080;
    display: block;
    text-align: left;
    /* 改為左對齊 */
    width: 100%;
}

#suggest-list li:hover {
    background-color: rgba(255, 255, 255, 0.1);
    padding-left: 20px;
}

/* 響應式設計 */
@media screen and (max-width: 768px) {
    header {
        height: 110px;
        padding: 0 15px;
    }

    header h1 {
        left: 50%;
        transform: translateX(-63%);
    }

    .menu:hover {
        color: #808080;
        transform: scale(1.1);
    }

    .menu {
        display: block;
    }

    .menu-items {
        position: fixed;
        top: 90px;
        /* 調整手機版選單位置 */
        left: 0;
        width: 100%;
        background-color: #000;
        flex-direction: column;
        align-items: center;
        padding: 0;
        /* 移除預設 padding */
        max-height: 0;
        overflow: hidden;
        transition: max-height 0.3s ease;
    }

    .menu-items>* {
        opacity: 0;
        /* 初始時隱藏所有內容 */
        transition: opacity 0.3s ease;
    }

    .menu-items.open {
        max-height: 500px;
        padding: 15px 0;
    }

    .menu-items.open>* {
        opacity: 1;
        /* 展開時顯示所有內容 */
    }

    nav ul {
        display: flex;
    }

    nav {
        flex-direction: column;
        align-items: stretch;
        height: auto;
    }

    .menu-items {
        flex-direction: column;
        align-items: flex-start;
        margin-right: 0;
    }

    .search-form {
        width: 80%;
        margin: 20px auto;
        position: relative;
        transition: all 0.3s ease;
        left: auto;
        top: auto;
        order: -1;
        opacity: 0;
        transition: opacity 0.3s ease;
    }

    .menu-items.open .search-form {
        opacity: 1;
    }

    nav {
        flex-direction: column;
        align-items: center;
        height: auto;
    }

    .menu-items li {
        width: 100%;
        text-align: center;
        margin: 20px 0;
        /* 從15px增加到20px */
        padding: 5px 0;
        /* 新增上下內間距 */
    }

    .menu-items.open>* {
        opacity: 1;
    }

    #suggest-list {
        width: 80% !important;
        /* 調整手機版寬度 */
        left: 50% !important;
        /* 置中對齊 */
        transform: translateX(-50%) !important;
        /* 保持置中 */
        /* 確保建議列表在搜尋欄下方 */
        max-height: 350px;
    }

    #suggest-list li {
        padding: 15px;
        text-align: center;
    }
}