.navbar {
    padding: 0;
}

.container-fluid {
    padding: 10px;
    box-shadow: 0 0 5px gray;
}

.bg-light {
    background-color: #fff !important;
}

/* Logo */
.navbar-brand {
    padding: 0;
}

.navbar-brand img {
    width: auto;
    height: 70px;
    margin-right: 8px;
}

/* 更改漢堡按鈕的圖片 */
/* .navbar-light .navbar-toggler-icon {
    background-image: url(../images/navbar.png);
} */

.navbar-light .navbar-toggler {
    border: none;
}

/* === 主選單連結 === */
.navbar-light .navbar-nav .nav-link {
    color: #333;
    padding: 10px 20px;
    border-radius: 10px;
}

/* === Hover & Active 狀態 === */
/* ==== 動畫1 ===*/
.nav-link:hover,
.nav-link.active,
.menu-arrow:hover,
.nav-link:hover+.menu-arrow,
.nav-link.active+.menu-arrow,
.nav-item.dropdown .d-flex:hover .nav-link,
.nav-item.dropdown .nav-link.menu-arrow.active,
.d-flex .nav-link.active+.menu-arrow,
.nav-item.dropdown .d-flex:hover .nav-link,
.nav-item.dropdown .d-flex .nav-link.active,
.nav-item.dropdown .d-flex .nav-link:hover+.menu-arrow,
.nav-item.dropdown .d-flex .nav-link.active+.menu-arrow,
.nav-item.open>.d-flex .nav-link,
.nav-item.open>.d-flex .menu-arrow,
.dropdown-item:hover {
    background-color: #1e3764;
    color: #dde3ef !important;
}

/* ==== 動畫2 ===*/
/* --- 主選單 nav-link的hover跟active設定改成底線動畫 --- */
/* .nav-link {
    position: relative;
}

.nav-link::after {
    content: "";
    position: absolute;
    left: 50%;
    bottom: 0;
    height: 4px;
    width: 0;
    background-color: #c586a4;
    transition: width 0.3s ease;
    transform: translateX(-50%);
}

.nav-link.menu-arrow::after {
    content: '';
    background-color: transparent;
}

.nav-link:hover::after,
.nav-link.active::after {
    width: 60%;
}

.nav-link:hover,
.nav-link.active {
    color: #c586a4 !important;
    font-weight: 700;
} */


/* === 下拉選單（第一層）=== */
.nav-item.dropdown a {
    color: #333;
}

/* .nav-item.dropdown .nav-link {
    padding: 20px 25px;
} */

.nav-item.dropdown .d-flex {
    align-items: center;
    justify-content: space-between;
}

.nav-item.dropdown .d-flex .nav-link {
    border-radius: 0;
    border-top-left-radius: 10px;
    border-bottom-left-radius: 10px;
}

.nav-item.dropdown .d-flex .nav-link.menu-arrow {
    padding: 10px 10px 10px 0;
    line-height: 24px;
    border-radius: 0;
    border-top-right-radius: 10px;
    border-bottom-right-radius: 10px;
}


/* === 下拉選單（第二層展開）=== */
.dropdown-submenu {
    position: relative;
}

.dropdown-submenu .dropdown-menu {
    top: 0;
    left: 100%;
    margin-left: 0.1rem;
}

/* === 下拉選單項目 === */
.dropdown-item {
    padding: 15px;
    /* border-radius: 10px; */
    color: #333;
    background-color: #fff;
    transition: all 0.3s ease;
}

/* 限制下拉選單最多顯示 15 個項目 */
.dropdown-menu li:nth-child(n+16) {
    display: none;
}

.dropdown-menu a {
    display: block;
    /* max-width: 230px; */
    /* 限制寬度，必要 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* 超出字數自動加 ... */
}

/* 有第三層的字數獨立控制 */
.dropdown-menu .dropdown-submenu .dropdown-item span {
    max-width: 9.5em;
    /* 限制寬度，必要 */
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    /* 超出字數自動加 ... */
}

/* 桌機 hover 展開 */
@media (min-width: 768px) {
    .container-fluid {
        /* padding: 10px 20px; */
        display: flex;
        justify-content: center;
        flex-wrap: wrap;
        row-gap: 10px;
        padding-bottom: 10px;
    }

    .navbar-brand {
        margin-right: 0;
    }

    .navbar-brand img {
        width: auto;
        max-height: 50px;
        /* margin: 15px 0; */
        /* margin-left: 20px; */
    }

    .navbar-collapse {
        justify-content: space-around;
    }

    .navbar-nav {
        gap: 10px;
    }

    .navbar-light .navbar-nav .nav-link {
        padding: 10px;
    }

    /* .menu-arrow,
    .submenu-toggle {
        display: none;
    } */
    /* === 下拉選單（第一層）=== */
    .dropdown:hover>.dropdown-menu {
        display: block;
    }

    .nav-item.dropdown .d-flex {
        justify-content: space-between;
    }

    .nav-item.dropdown .d-flex .text {
        padding-right: 3px;
    }

    .nav-item.dropdown .d-flex .nav-link.menu-arrow {
        padding: 10px 10px 10px 0;
        line-height: 24px;
    }

    /* === 下拉選單（第二層）=== */
    .dropdown-submenu:hover>.dropdown-menu {
        display: block;
    }

    .dropdown-submenu .dropdown-item .submenu-toggle i {
        font-size: 13px;
        margin-right: 10px;
    }

    /* hover跟active動畫 */
    /* --- 第一層下拉選單 (第一個dropdown-menu的 dropdown-item) --- */
    /* .dropdown-menu>li .dropdown-item {
        position: relative;
        padding-left: 16px;
        預留直線空間
    }

    .dropdown-menu>li .dropdown-item::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 0;
        background-color: #c586a4;
        transition: width 0.3s ease;
    }

    .dropdown-menu>li .dropdown-item:hover::before,
    .dropdown-menu>li .dropdown-item.active::before {
        width: 6px;
        左側直線
    }

    .dropdown-submenu>.dropdown-item {
        position: relative;
        padding-left: 16px;
        預留直線空間
    }

    .dropdown-submenu>.dropdown-item::before {
        content: "";
        position: absolute;
        left: 0;
        top: 0;
        bottom: 0;
        width: 0;
        background-color: #c586a4;
        transition: width 0.3s ease;
    }

    .dropdown-submenu>.dropdown-item:hover::before,
    .dropdown-submenu>.dropdown-item.active::before {
        width: 6px;
        左側直線
    }

    .dropdown-menu>li .dropdown-item:hover,
    .dropdown-menu>li .dropdown-item.active {
        color: #c586a4;
        font-weight: 700;
        background-color: #fff;
    } */
}


@media (min-width: 992px) {
    .container-fluid {
        padding: 10px 20px;
    }

    .navbar-brand img {
        width: auto;
        max-height: 60px;
    }

    .navbar-light .navbar-nav .nav-link {
        padding: 15px 25px;
    }

    .nav-item.dropdown .d-flex .text {
        padding-right: 7px;
    }

    .nav-item.dropdown .d-flex .nav-link.menu-arrow {
        padding: 15px 15px 15px 0;
        line-height: 24px;
    }
}

@media (min-width: 1400px) {
    /* .container-fluid {
        padding: 20px 50px;
    } */

    .navbar-brand img {
        margin: 0;
        width: auto;
        max-height: 60px;
        margin-left: 150px;
    }

    .navbar-nav {
        gap: 15px;
    }
}

@media (min-width: 1700px) {
    /* .container-fluid {
        padding: 20px 80px;
    } */

    .navbar-brand img {
        margin-left: 300px;
        width: auto;
        min-height: 70px;
    }
}

@media(max-width: 1400px) {
    .navbar-nav {
        align-items: baseline;
    }
}

/* 手機版：子選單改為向下展開，不要往右 */
@media (max-width: 767.98px) {

    /* === Navbar 基本設定 === */
    .container-fluid {
        padding: 5px 15px;
    }

    /* === logo === */
    .navbar-brand.d-flex {
        padding: 0;
    }

    .navbar-brand img {
        width: auto;
        max-height: 50px;
    }

    /* === 主選單連結 === */
    .navbar-nav {
        width: 100%;
    }

    .navbar-toggler {
        margin-right: 20px;
    }

    /* === Nav item === */
    .nav-item {
        width: 100%;
        border-bottom: 1px solid #ededed;
    }

    .nav-item.dropdown {
        width: 100%;
    }

    .nav-item.dropdown .d-flex {
        width: 95%;
        margin: 5px;
        border-radius: 10px;
    }

    /* === Nav link === */
    .nav-link {
        margin: 5px;
        width: 95%;
        font-size: 14px;
        border: none;
    }

    /* 下拉的主選單 */
    .nav-item.dropdown .d-flex .nav-link {
        width: 85%;
        margin: 0;

    }

    /* === Menu arrow (第一層箭頭) === */
    .menu-arrow {
        border: none;
    }

    .nav-item.dropdown .d-flex .nav-link.menu-arrow {
        width: 15%;
        padding: 0.5px 0;
        padding-right: 15px;
        margin: 0;
        line-height: 41px;
        font-size: 13.4px;
        height: 41px;
    }



    /* === Dropdown Menu === */
    /* ===第一層 ===*/
    .nav-item .dropdown-menu,
    .dropdown-submenu .dropdown-menu,
    .dropdown-menu {
        display: none;
        border: none;
    }

    .nav-item.open>.dropdown-menu,
    .dropdown-submenu .dropdown-menu.show,
    .dropdown-menu.open {
        display: block;
    }

    .dropdown-menu {
        padding: 8px 15px;
    }

    .dropdown-menu li {
        border-bottom: 1px solid #ededed;
    }

    .dropdown-menu .dropdown-item {
        width: 95%;
        padding: 10px 15px;
        margin: 5px;
        font-size: 14px;
       border-radius: 10px;
    }

    /* === 第二層 ===*/
    .dropdown-submenu .dropdown-menu {
        margin-left: 0;
    }

    .dropdown-submenu .dropdown-menu li {
        border-bottom: 1px solid #ededed;
    }

    .dropdown-menu li:last-child,
    .dropdown-submenu .dropdown-menu li:last-child {
        border-bottom: none;
    }

    .dropdown-submenu .dropdown-item {
        justify-content: space-between;
        font-size: 14px;
        border-bottom: none;
        border-radius: 10px;
    }

    .dropdown-submenu .dropdown-item .submenu-toggle {
        margin-right: 25px;
    }

    .dropdown-submenu .dropdown-item .submenu-toggle i {
        transform: rotate(90deg);
        margin-right: 5px;
        font-size: 13px;
    }

    /* === Hover & Active 狀態 === */
    .nav-link:hover,
    .nav-link.active,
    .menu-arrow:hover,
    .nav-link.active+.menu-arrow,
    .nav-item.dropdown .d-flex:hover .nav-link,
    .nav-item.dropdown .d-flex .nav-link.active,
    .nav-item.dropdown .d-flex .nav-link:hover+.menu-arrow,
    .nav-item.dropdown .d-flex .nav-link.active+.menu-arrow,
    .nav-item.open>.d-flex .nav-link,
    .nav-item.open>.d-flex .menu-arrow,
    .dropdown-item:hover {
        font-weight: normal;
        background-color: #1e3764;
        color: #dde3ef !important;
    }

    /* d-flex 父層背景色 (nav-link active) */
    .nav-item.dropdown .d-flex:has(.nav-link.active),
    .nav-item.dropdown .d-flex:has(.nav-link:hover) {
        background-color: #1e3764;
    }
}



/* 去掉 Bootstrap 自動的箭頭，用自訂箭頭 */
.dropdown-toggle::after {
    display: none;
}

.menu-arrow {
    cursor: pointer;
    padding: 0 6px;
    font-size: 0.8rem;
}

@media (max-width: 360px) {
    .container-fluid {
        padding: 5px;
    }

    .navbar-brand {
        margin: 0;
    }

    .navbar-brand img {
        margin: 0;
        width: auto;
        max-height: 40px;
    }

    .navbar-toggler {
        margin: 0;
        padding: 4px 8px;
    }

    .navbar-toggler-icon {
        width: 20px;
        height: 20px;
    }

}