/* --- 全局樣式 --- */
body {
    margin: 0;
    font-family: 'Open Sans', Arial, sans-serif; /* 使用 Open Sans 作為預設字體 */
    background-color: #f8f9fa; /* 淺灰色背景 */
    color: #333;
    line-height: 1.6;
    /*display: flex; !* 使用 Flexbox 讓頁尾固定在底部 *!*/
    /*flex-direction: column; !* 垂直排列子元素 *!*/
    min-height: 100vh; /* 確保內容至少佔滿整個視窗高度 */
}

/* 讓內容區塊可以彈性伸展，把 footer 推到底部 */
.main-content {
    flex: 1;
    max-width: 1000px;
    margin: 0 auto;
}

.page-cover-box {
    margin: 10px auto;
    justify-items: center;
}

.page-cover-box img{
    display:block;
    max-width: 500px;
    max-height: 500px;
    margin: 0 auto;
}


/* --- 導覽列 (Navbar) 樣式 --- */
.navbar {
    background-color: #2c3e50; /* 深藍灰色 */
    color: white;
    display: flex;
    /* 桌面版：品牌靠左，選單和語言選擇器靠右 */
    justify-content: space-between;
    align-items: center;
    padding: 15px 25px; /* 增加左右內距 */
    position: relative; /* 定位基準 */
    box-shadow: 0 3px 8px rgba(0, 0, 0, 0.1); /* 柔和的陰影 */
    z-index: 1000; /* 確保選單在最上層 */
    flex-wrap: wrap; /* 允許在手機版時換行 */
}

.navbar-brand {
    color: #ecf0f1; /* 淺灰色文字 */
    text-decoration: none;
    font-family: 'Roboto', sans-serif; /* 品牌名稱使用 Roboto */
    font-size: 26px; /* 稍微放大品牌名稱 */
    font-weight: 700;
    transition: color 0.3s ease;
    /* 桌面版時，靠左 */
    margin-right: auto;
}

.navbar-brand:hover {
    color: #f1c40f; /* 懸停時變黃色 */
}

/* --- 主選單列表 (navbar-nav) 樣式 --- */
.navbar-nav {
    list-style: none;
    margin: 0;
    padding: 0;
    display: flex; /* 桌面版橫向排列 */
    /* 桌面版：讓導覽選單佔用剩餘空間並靠右 */
    flex-grow: 1;
    justify-content: flex-end;
    align-items: center; /* 垂直置中 */
    order: unset; /* 重置手機版的 order */
}

.navbar-nav li {
    position: relative;
    margin-left: 25px; /* 增加選單項目間距 */
}

.navbar-nav a {
    color: #ecf0f1; /* 淺灰色文字 */
    text-decoration: none;
    padding: 10px 0; /* 增加上下內距 */
    display: block;
    white-space: nowrap; /* 防止文字換行 */
    font-weight: 600; /* 加粗文字 */
    transition: color 0.3s ease, transform 0.2s ease; /* 添加過渡效果 */
}

.navbar-nav a:hover {
    color: #f1c40f; /* 懸停時變黃色 */
    transform: translateY(-2px); /* 懸停時稍微上移 */
}

/* --- 語言選擇器樣式 --- */
.language-selector {
    position: relative;
    margin-left: 30px; /* 桌面版：與主選單項目之間保持距離 */
    cursor: pointer;
    z-index: 1010; /* 確保在選單項目之上 */
    order: unset; /* 重置手機版的 order */
    display: none; /* 桌面版始終顯示 */
}

.current-language {
    color: #ecf0f1;
    font-weight: 600;
    padding: 8px 15px;
    border: 1px solid #466381; /* 邊框 */
    border-radius: 4px;
    display: flex;
    align-items: center;
    transition: background-color 0.3s ease;
    justify-content: flex-start; /* 桌面版靠左 */
}
.current-language:hover {
    background-color: #34495e; /* hover 變色 */
}
/* 語言選擇器內部的 icon 樣式 */
.current-language i.fa-globe {
    margin-right: 8px; /* 圖示與文字的間距 */
    font-size: 16px; /* 圖示大小 */
}


.current-language .arrow { /* 語言選擇器內的箭頭 */
    border-top-color: #ecf0f1;
    margin-left: 8px;
    transition: transform 0.3s ease;
}

.language-options {
    list-style: none;
    margin: 0;
    padding: 0;
    position: absolute;
    top: calc(100% + 5px); /* 位於當前語言下方 */
    right: 0; /* 靠右對齊 */
    background-color: #34495e;
    min-width: 120px;
    box-shadow: 0 4px 8px rgba(0, 0, 0, 0.2);
    border-radius: 4px;
    overflow: hidden;
    display: none; /* 預設隱藏 */
    opacity: 0;
    transform: translateY(10px);
    transition: opacity 0.3s ease, transform 0.3s ease;
}

.language-options.active {
    display: block;
    opacity: 1;
    transform: translateY(0);
}

.language-options li a {
    padding: 10px 15px;
    color: #ecf0f1;
    text-decoration: none;
    display: block;
    white-space: nowrap;
    font-weight: 400;
    transition: background-color 0.3s ease, color 0.3s ease;
}

.language-options li a:hover {
    background-color: #466381;
    color: #f1c40f;
    transform: none; /* 這裡不需要 transform */
}
.language-options li a.selected { /* 當前選中的語言 */
    background-color: #466381;
    color: #f1c40f;
    font-weight: 600;
}


/* --- 手機版切換按鈕 (漢堡按鈕) 樣式 --- */
.navbar-toggler {
    background: none;
    border: none;
    cursor: pointer;
    padding: 5px; /* 增加點擊區域 */
    display: none; /* 桌面版隱藏 */
    outline: none; /* 移除點擊後的藍框 */
    position: relative; /* 為了漢堡線動畫 */
    width: 30px;
    height: 30px;
    /* 桌面版不需要 margin-left，會在手機版調整 */
}

.navbar-toggler .icon-bar {
    display: block;
    width: 100%;
    height: 3px;
    background-color: #ecf0f1; /* 漢堡線顏色 */
    margin: 5px 0;
    transition: all 0.3s ease; /* 平滑過渡 */
    border-radius: 2px; /* 稍微圓潤 */
}

/* 切換按鈕在開啟狀態時的樣式 (讓圖示變成 X) */
.navbar-toggler.active .icon-bar:nth-child(1) {
    transform: rotate(-45deg) translate(-5px, 6px);
}

.navbar-toggler.active .icon-bar:nth-child(2) {
    opacity: 0;
}

.navbar-toggler.active .icon-bar:nth-child(3) {
    transform: rotate(45deg) translate(-5px, -6px);
}

/* --- 箭頭樣式 (通用，如果用於語言選擇器) --- */
.arrow {
    display: inline-block;
    width: 0;
    height: 0;
    border-left: 6px solid transparent; /* 箭頭寬度 */
    border-right: 6px solid transparent;
    border-top: 6px solid #ecf0f1; /* 預設向下的箭頭顏色 */
    margin-left: 10px; /* 箭頭與文字間距 */
    vertical-align: middle;
    transition: transform 0.3s ease; /* 箭頭旋轉過渡 */
}
/* 當語言選擇器展開時，箭頭向上 */
.language-selector.active .current-language .arrow {
    transform: rotate(180deg);
}

/* --- 網頁內容區塊樣式 (僅為示範) --- */
.content-section {
    padding: 40px 20px;
    text-align: center;
    max-width: 800px;
    margin: 30px auto;
    background-color: #fff;
    border-radius: 8px;
    box-shadow: 0 4px 12px rgba(0, 0, 0, 0.05);
}
.content-section h2 {
    color: #2c3e50;
    font-family: 'Roboto', sans-serif;
    font-size: 25px;
    font-weight: 700;
    margin-bottom: 20px;
}
.content-section p {
    color: #555;
}

/* --- 頁尾 (Footer) 樣式 --- */
.footer {
    background-color: #2c3e50; /* 和 Navbar 顏色一致 */
    color: #ecf0f1; /* 和 Navbar 文字顏色一致 */
    text-align: center;
    padding: 25px 20px;
    font-size: 14px;
    margin-top: 50px; /* 讓頁尾和內容之間有間距 */
}

.footer p {
    margin: 0;
}

.footer a {
    color: #f1c40f; /* 連結顏色 */
    text-decoration: none;
    transition: color 0.3s ease;
}

.footer a:hover {
    color: #fff;
    text-decoration: underline;
}


/* ===== 分頁控制 (BBC style) ===== */
.pagination {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 0.5rem;
    margin-top: 2rem;
}
.pagination button {
    padding: 0.4rem 0.8rem;
    border: 1px solid #00773e;
    background-color: #fff;
    color: #043e22;
    font-weight: 600;
    cursor: pointer;
    border-radius: 3px;
    transition: background-color 0.3s;
}
.pagination button:hover:not(:disabled) {
    background-color: #00773e;
    color: #fff;
}
.pagination button:disabled {
    opacity: 0.5;
    cursor: not-allowed;
}
.pagination .active-page {
    background-color: #043e22;
    color: #fff;
    cursor: default;
    border: 1px solid #043e22;
}

/* ===== 響應式 ===== */
@media (max-width: 992px) {

}


/* --- 手機版樣式 (媒體查詢) --- */
@media (max-width: 768px) {
    .navbar {
        /* 手機版：品牌靠左，漢堡按鈕靠右 */
        justify-content: space-between;
        align-items: center; /* 讓品牌和漢堡按鈕垂直置中 */
        padding: 15px 20px;
    }

    .navbar-brand {
        font-size: 24px;
        margin-right: auto; /* 確保品牌名稱佔滿左側空間 */
    }

    /* 手機版顯示漢堡按鈕 */
    .navbar-toggler {
        display: block;
        margin-left: 15px; /* 與品牌之間保持距離 */
    }

    /* 手機版主選單 */
    .navbar-nav {
        width: 100%; /* 手機版選單佔滿寬度 */
        flex-direction: column; /* 垂直排列 */
        display: none; /* 預設隱藏 */
        background-color: #34495e; /* 手機版選單背景色 */
        padding: 10px 0;
        box-shadow: none; /* 移除手機版選單陰影 */
        border-radius: 0; /* 移除圓角 */
        order: 2; /* 放在品牌和漢堡按鈕下方 */
        justify-content: flex-start; /* 讓選單項目靠左對齊 */
        margin-left: 0; /* 重置桌面版 margin */
    }

    .navbar-nav.active {
        display: flex; /* 顯示選單 */
    }

    .navbar-nav li {
        margin: 0; /* 重置手機版選單項目間距 */
        border-bottom: 1px solid rgba(0,0,0,0.1); /* 添加分隔線 */
    }
    .navbar-nav li:last-child {
        border-bottom: none; /* 最後一個沒有分隔線 */
    }

    .navbar-nav a {
        padding: 12px 25px; /* 增加手機版連結內距 */
        font-size: 16px;
    }
    .navbar-nav a:hover {
        transform: none; /* 手機版不漂浮 */
    }

    /* 當主選單 active 時，顯示語言選擇器 */
    /* 這裡使用 `+` 相鄰兄弟選擇器，因為 language-selector 緊跟在 navbar-nav 後面 */
    .navbar-nav.active + .language-selector {
    }

    /* 手機版語言選擇器 */
    .language-selector {
        margin-left: 0; /* 重置桌面版 margin */
        display: none; /* 預設隱藏，與主選單同步顯示 */
        order: 3; /* 放在主選單之後 */
        width: 100%; /* 佔滿整行 */
        margin-top: 10px; /* 與主選單分隔 */
        padding: 0 20px; /* 內距，與主選單對齊 */
        box-sizing: border-box; /* 確保 padding 不會使寬度超出 */
    }

    .current-language {
        width: 100%; /* 佔滿可用寬度 */
        justify-content: center; /* 文字置中 */
        box-sizing: border-box; /* 包含 padding 和 border */
        border-radius: 0; /* 取消圓角 */
    }
    /* 手機版語言選擇器內部的 icon 樣式 */
    .current-language i.fa-globe {
        margin-right: 8px; /* 圖示與文字的間距 */
        font-size: 16px; /* 圖示大小 */
    }

    .language-options {
        position: static; /* 變成靜態定位，在流中 */
        width: 100%;
        box-shadow: none;
        border-radius: 0;
        background-color: #466381; /* 變淺一點 */
        opacity: 1; /* 直接顯示 */
        transform: none;
        top: auto;
        right: auto;
        margin-top: 0; /* 移除桌面版 top margin */
    }
    .language-options li a {
        padding: 10px 0; /* 調整內距 */
        text-align: center; /* 文字置中 */
    }
}


/* 導覽列 RWD 調整 */
@media (max-width: 600px) {

    .page-cover-box img{
        display:block;
        max-width: 400px;
        max-height: 350px;
    }

    .page-cover-box {
        margin: 10px auto;
        justify-items: center;
    }

}