/* === Reset === */
* {
    margin: 0;
    padding: 0;
    box-sizing: border-box;
}

html,
body {
    width: 100%;
    height: 100%;
    overflow-x: hidden;
    background-color: #fff;
    font-family: "Noto Sans TC", "Microsoft JhengHei", sans-serif;
}

/* === 基本元素 === */
img,
iframe {
    display: block;
    max-width: 100%;
    border: none;
}

/* === Header 區塊 === */
header {
    width: 100%;
    background-color: #8B0000;
    color: #fff;
    position: relative;
    z-index: 10;
    margin: 0;
    padding: 0;
}

/* Banner 圖片 */
.header-banner {
    width: 100%;
    display: block;
}

@media (max-width: 992px) {
    .header-banner {
        display: none;
    }
}

/* === 導覽列 === */
.nav-bar {
    display: flex;
    align-items: center;
    justify-content: space-between;
    max-width: 1200px;
    margin: 0 auto;
    padding: 15px 20px;
}

/* LOGO */
.logo {
    font-size: 1.2rem;
    font-weight: bold;
    color: #fff;
}

/* 導覽列連結區 */
.nav-links {
    display: flex;
    align-items: center;
    gap: 20px;
    /* 調整間距讓視覺更寬鬆 */
}

/* ⭐ 重點修正：只針對「非 dropdown-item」的連結設定白色 
   或者我們保留通用設定，但後面覆寫 dropdown 內的設定
*/
.nav-links>a {
    color: #fff;
    text-decoration: none;
    font-weight: 700;
    transition: color 0.3s;
    line-height: 1;
    padding: 5px 8px;
    white-space: nowrap;
    /* 防止文字換行 */
}

.nav-links>a:hover {
    color: #ffcc00;
}

/* === ⭐ 新增：Bootstrap Dropdown 樣式修正 === */

/* 1. 修正下拉選單觸發按鈕 (學員中心) 的顏色 */
.nav-links .dropdown-toggle {
    color: #fff !important;
    /* 強制白色 */
    font-weight: 700;
    text-decoration: none;
    background: none;
    border: none;
    padding: 5px 8px;
    display: flex;
    /* 讓文字跟箭頭對齊 */
    align-items: center;
}

.nav-links .dropdown-toggle:hover {
    color: #ffcc00 !important;
}

/* 2. 修正下拉選單容器 */
.nav-links .dropdown-menu {
    background-color: #fff;
    /* 背景白色 */
    border-radius: 6px;
    border: 1px solid #ddd;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
    margin-top: 10px;
    /* 稍微往下推一點 */
    padding: 5px 0;
    min-width: 160px;
}

/* 3. ⭐ 關鍵修正：下拉選單內的選項文字顏色 (白底黑字) */
.nav-links .dropdown-menu .dropdown-item {
    color: #333 !important;
    /* 強制深色，不然會被上層的 color: #fff 蓋過去變成白字 */
    font-weight: 500;
    padding: 8px 16px;
    text-decoration: none;
    display: block;
    line-height: 1.5;
}

.nav-links .dropdown-menu .dropdown-item:hover {
    background-color: #f2f2f2;
    /* 滑鼠移過去變淺灰 */
    color: #8B0000 !important;
    /* 文字變深紅 */
}

/* 4. 修正分隔線顏色 */
.nav-links .dropdown-menu .dropdown-divider {
    border-top: 1px solid #eee;
    margin: 5px 0;
}

/* === 修正使用者資訊與登出按鈕的排列 === */
.user-menu {
    display: flex !important;
    /* 強制使用 Flex 排版 */
    flex-direction: row;
    /* 確保是橫向排列 (左文字、右按鈕) */
    align-items: center;
    /* 垂直置中對齊 */
    gap: 10px;
    /* 文字與按鈕的間距 */
    margin-left: 15px;
    /* 與左邊選單的距離 */
    white-space: nowrap;
    /* 強制不換行 */
}

/* 關鍵修正：讓 Form 標籤乖乖排在文字旁邊 */
.user-menu form {
    margin: 0;
    padding: 0;
    display: flex;
    /* 設為 flex 或是 inline-block */
    align-items: center;
}

.user-info {
    color: #fff;
    font-weight: 600;
    display: flex;
    align-items: center;
    gap: 5px;
    line-height: 1;
    white-space: nowrap;
    /* 防止名字太長換行 */
}

/* 登出按鈕 */
.logout-btn {
    background: none;
    border: 1px solid #ffcc00;
    color: #ffcc00;
    padding: 4px 12px;
    border-radius: 6px;
    cursor: pointer;
    font-weight: 600;
    transition: all 0.3s ease;
    line-height: 1;
    white-space: nowrap;
}

.logout-btn:hover {
    background-color: #ffcc00;
    color: #8B0000;
}

/* 未登入的登入按鈕 */
.login-link {
    color: #fff;
    font-weight: 600;
    border: 1px solid #ffcc00;
    padding: 4px 12px;
    border-radius: 6px;
    text-decoration: none;
    margin-left: 10px;
    transition: all 0.3s ease;
    line-height: 1;
    white-space: nowrap;
}

.login-link:hover {
    background-color: #ffcc00;
    color: #8B0000 !important;
}

/* === 手機漢堡選單 === */
.menu-toggle {
    display: none;
    flex-direction: column;
    justify-content: space-between;
    width: 26px;
    height: 20px;
    cursor: pointer;
}

.menu-toggle span {
    display: block;
    height: 3px;
    width: 100%;
    background-color: #fff;
    border-radius: 2px;
    transition: all 0.3s ease;
}

.menu-toggle.active span:nth-child(1) {
    transform: translateY(8px) rotate(45deg);
}

.menu-toggle.active span:nth-child(2) {
    opacity: 0;
}

.menu-toggle.active span:nth-child(3) {
    transform: translateY(-8px) rotate(-45deg);
}

/* === 手機 RWD === */
@media (max-width: 992px) {
    .menu-toggle {
        display: flex;
    }

    .nav-links {
        position: absolute;
        top: 100%;
        right: 0;
        background-color: #8B0000;
        flex-direction: column;
        width: 100%;
        text-align: center;
        padding: 20px 0;
        gap: 15px;
        display: none;
        box-shadow: 0 4px 6px rgba(0, 0, 0, 0.1);
        /* 加一點陰影 */
    }

    .nav-links.active {
        display: flex;
        animation: slideDown 0.3s ease forwards;
    }

    @keyframes slideDown {
        from {
            opacity: 0;
            transform: translateY(-10px);
        }

        to {
            opacity: 1;
            transform: translateY(0);
        }
    }

    /* 手機版下拉選單修正 */
    .nav-links .dropdown-menu {
        position: static !important;
        /* 手機版不浮動，直接撐開 */
        float: none;
        width: 90%;
        /* 寬度稍微內縮 */
        margin: 0 auto;
        text-align: center;
        background-color: #9e0000;
        /* 手機版選單背景深一點，區隔層次 */
        border: none;
    }

    .nav-links .dropdown-menu .dropdown-item {
        color: #fff !important;
        /* 手機版深底白字 */
    }

    .nav-links .dropdown-menu .dropdown-item:hover {
        background-color: rgba(255, 255, 255, 0.1);
        color: #ffcc00 !important;
    }

    .user-menu {
        flex-direction: column;
        margin-top: 10px;
        margin-left: 0;
    }
}

/* === Footer 區塊 === */
footer {
    width: 100%;
    background: linear-gradient(180deg, #8B0000 0%, #660000 100%);
    color: #f9f9f9;
    text-align: center;
    padding: 50px 0 30px 0;
    letter-spacing: 0.5px;
    margin: 0;
    border: none;
}

/* Footer 內容區 */
footer .footer-inner {
    max-width: 1000px;
    margin: 0 auto 30px auto;
    display: flex;
    justify-content: space-around;
    flex-wrap: wrap;
    gap: 40px;
}

/* Footer 標題 */
footer h3 {
    font-size: 1.2rem;
    font-weight: 700;
    margin-bottom: 12px;
    border-left: 4px solid #ffcc00;
    padding-left: 8px;
    text-align: left;
}

/* Footer 文字 */
footer p {
    font-size: 0.95rem;
    line-height: 1.8;
    color: #f2f2f2;
    text-align: left;
}

/* Footer 連結 */
footer a {
    color: #ffffff;
    text-decoration: none;
    transition: all 0.3s ease;
}

footer a:hover {
    color: #ffcc00;
    text-decoration: none;
}

/* 分隔線 */
footer hr {
    border: 0;
    border-top: 1px solid rgba(255, 255, 255, 0.25);
    margin: 20px auto;
    width: 90%;
}

/* 版權文字 */
footer .copyright {
    font-size: 0.85rem;
    color: #ddd;
    line-height: 1.6;
}

/* 手機版 Footer 排版 */
@media (max-width: 768px) {
    footer .footer-inner {
        flex-direction: column;
        align-items: center;
        text-align: center;
    }

    footer h3 {
        text-align: center;
        border-left: none;
        border-bottom: 2px solid #ffcc00;
        display: inline-block;
        padding-bottom: 4px;
        margin-bottom: 10px;
    }

    footer p {
        text-align: center;
    }
}