/* 基本重設與通用樣式 */
* {
    box-sizing: border-box;
    margin: 0;
    padding: 0;
}

body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f9;
    color: #333;
}

.container {
    max-width: 1200px;
    margin: 20px auto;
    padding: 0 15px;
}

/* --- 1. 頂部三層選單 (RWD) --- */

/* --- 1. 頂部三層選單 (RWD) --- */

.main-header {
    background-color: #333;
    color: white;
    /* 新增以下三行 */
    position: fixed; /* 設定為固定定位 */
    top: 0;          /* 距離視窗頂部 0 */
    width: 100%;     /* 寬度佔滿整個視窗 */
    z-index: 1000;   /* 確保選單在其他內容之上 */
}

/* 新增：為了防止固定選單遮擋到內容，需要調整 body 或 main 的 top padding/margin */
body {
    font-family: Arial, sans-serif;
    line-height: 1.6;
    background-color: #f4f4f9;
    color: #333;
    padding-top: 60px; /* 增加頂部內距，數值需大於或等於 .main-header 的高度 */
}

/* 確保 Navbar 內部的結構不變 */
.navbar {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px; /* 假設 header 高度約為 60px */
}

/* (其他 CSS 樣式保持不變) */

.navbar {
    max-width: 1200px;
    margin: 0 auto;
    display: flex;
    justify-content: space-between;
    align-items: center;
    padding: 10px 15px;
}

.logo {
    color: white;
    text-decoration: none;
    font-size: 1.5em;
    font-weight: bold;
}

.nav-links {
    list-style: none;
    display: flex;
}

.nav-links > li {
    position: relative;
    padding: 10px 15px;
}

.nav-links a {
    color: white;
    text-decoration: none;
    display: block;
}

.nav-links a:hover {
    color: #ff9900;
}

/* 第一層下拉選單 */
.dropdown-content {
    display: none;
    position: absolute;
    top: 100%;
    left: 0;
    background-color: #444;
    min-width: 160px;
    z-index: 10;
    list-style: none;
    padding: 5px 0;
}

.dropdown:hover .dropdown-content {
    display: block;
}

.dropdown-content a {
    padding: 10px 15px;
    color: white;
}

.dropdown-content a:hover {
    background-color: #555;
}

/* 第二層下拉選單 */
.sub-dropdown-content {
    display: none;
    position: absolute;
    top: 0;
    left: 100%;
    background-color: #555;
    min-width: 160px;
    list-style: none;
    padding: 5px 0;
}

.sub-dropdown:hover .sub-dropdown-content {
    display: block;
}

.sub-dropdown-content a {
    padding: 10px 15px;
    color: white;
}

.sub-dropdown-content a:hover {
    background-color: #666;
}

.menu-icon {
    display: none; /* 桌面隱藏 */
    color: white;
    font-size: 1.5em;
    cursor: pointer;
}

/* --- 2. 輪播篇幅 (Carousel) --- */

.carousel-container {
    /* max-width: 1200px; */
    margin: 0px auto;
    position: relative;
    overflow: hidden;
    background-color: #ccc;
}

.carousel-slide {
    display: none;
}

.carousel-slide img {
    width: 100%;
    height: auto;
    display: block;
}

.carousel-caption {
    position: absolute;
    bottom: 0;
    left: 0;
    right: 0;
    background-color: rgba(0, 0, 0, 0.5);
    color: white;
    padding: 10px;
    text-align: center;
    font-size: 1.2em;
}

/* 箭頭樣式 */
.prev, .next {
    cursor: pointer;
    position: absolute;
    top: 50%;
    width: auto;
    padding: 16px;
    margin-top: -22px;
    color: white;
    font-weight: bold;
    font-size: 18px;
    transition: 0.6s ease;
    border-radius: 0 3px 3px 0;
    user-select: none;
    background-color: rgba(0, 0, 0, 0.3);
}

.next {
    right: 0;
    border-radius: 3px 0 0 3px;
}

.prev:hover, .next:hover {
    background-color: rgba(0, 0, 0, 0.8);
}

/* --- 3. 按鈕 (Button) 範例 --- */

.action-button {
    background-color: #007bff;
    color: white;
    border: none;
    padding: 10px 20px;
    margin-bottom: 20px;
    border-radius: 5px;
    cursor: pointer;
    font-size: 1em;
    transition: background-color 0.3s;
}

.action-button:hover {
    background-color: #0056b3;
}

/* --- 4. 表格資料 (RWD) --- */

.data-table-section {
    overflow-x: auto; /* 確保表格在小螢幕上可以橫向滾動 */
    margin-bottom: 40px;
}

.responsive-table {
    width: 100%;
    border-collapse: collapse;
    background-color: white;
    box-shadow: 0 2px 5px rgba(0, 0, 0, 0.1);
}

.responsive-table th, .responsive-table td {
    padding: 12px 15px;
    text-align: left;
    border-bottom: 1px solid #ddd;
}

.responsive-table thead th {
    background-color: #007bff;
    color: white;
    text-transform: uppercase;
    font-size: 0.9em;
}

.responsive-table tbody tr:hover {
    background-color: #f1f1f1;
}

.detail-row {
    background-color: #e9ecef;
    display: none; /* 預設隱藏 */
}

.detail-row td {
    padding: 15px;
    font-style: italic;
    color: #555;
    border-top: 1px solid #ddd;
}

.toggle-button {
    background: none;
    border: 1px solid #007bff;
    color: #007bff;
    padding: 5px 10px;
    border-radius: 3px;
    cursor: pointer;
    transition: background-color 0.3s, color 0.3s;
}

.toggle-button:hover {
    background-color: #007bff;
    color: white;
}

/* --- 5. 版權區塊 (Footer) --- */

.main-footer {
    background-color: #333;
    color: white;
    padding: 20px 0;
    text-align: center;
    font-size: 0.9em;
}

.main-footer a {
    color: #ff9900;
    text-decoration: none;
}

.main-footer a:hover {
    text-decoration: underline;
}

/* --- RWD 響應式調整 --- */

/* 小於 992px 的螢幕 (平板電腦) */
@media (max-width: 992px) {
    
    /* 表格 RWD 調整: 將表格轉換為卡片式顯示 */
    .responsive-table thead {
        display: none; /* 隱藏表頭 */
    }

    .responsive-table, 
    .responsive-table tbody, 
    .responsive-table tr, 
    .responsive-table td {
        display: block;
        width: 100%;
    }

    .responsive-table tr {
        margin-bottom: 15px;
        border: 1px solid #ddd;
        display: block;
    }

    .responsive-table td {
        text-align: right;
        padding-left: 50%; /* 留空間給標籤 */
        position: relative;
    }

    .responsive-table td::before {
        content: attr(data-label); /* 顯示標籤 */
        position: absolute;
        left: 0;
        width: 50%;
        padding-left: 15px;
        font-weight: bold;
        text-align: left;
    }

    .responsive-table .detail-row td {
        text-align: left;
        padding-left: 15px;
    }

    .responsive-table .detail-row td::before {
        content: none;
    }

}


/* 小於 768px 的螢幕 (手機) */
@media (max-width: 768px) {
    
    /* 選單 RWD 調整: 漢堡選單 */
    .nav-links {
        display: none; /* 預設隱藏選單 */
        flex-direction: column;
        width: 100%;
        position: absolute;
        top: 60px; /* 根據 header 高度調整 */
        left: 0;
        background-color: #333;
        text-align: center;
        padding: 10px 0;
        z-index: 5;
    }

    .nav-links.active {
        display: flex; /* 點擊後顯示 */
    }

    .nav-links > li {
        width: 100%;
        padding: 0;
        border-bottom: 1px solid #444;
    }

    .nav-links a {
        padding: 10px 0;
    }

    .menu-icon {
        display: block; /* 顯示漢堡選單圖示 */
    }

    /* 下拉選單處理 (在手機上簡化或改變呈現方式) */
    .dropdown-content, .sub-dropdown-content {
        position: static; /* 取消絕對定位 */
        width: 100%;
        background-color: #444;
        padding: 0;
        display: none;
    }
    
    .dropdown a, .sub-dropdown a {
        padding: 10px 15px;
    }

    /* 點擊主選單項時，下拉選單在下方展開 (需要 JS 控制) */
    .dropdown.active .dropdown-content,
    .sub-dropdown.active .sub-dropdown-content {
        display: block;
    }

    .sub-dropdown a {
        background-color: #444;
    }

    .sub-dropdown-content {
        background-color: #555;
    }
}