#video-popup-overlay {
    display: none;
    position: fixed;
    top: 0; left: 0; width: 100%; height: 100%;
    background: rgba(0, 0, 0, 0.85);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

/* Modal Content Container */
#video-popup-container {
    position: relative;
    width: 90%;
    max-width: 800px;
}

/* Close Button */
#close-video {
    position: absolute;
    top: -40px; right: 0;
    background: none; border: none;
    color: #fff; font-size: 35px; cursor: pointer;
}

/* Responsive 16:9 Aspect Ratio Aspect */
.video-wrapper {
    position: relative;
    padding-bottom: 56.25%; /* 16:9 ratio */
    height: 0;
}
.video-wrapper iframe {
    position: absolute;
    top: 0; left: 0; width: 100%; height: 100%;
}

.header-navigation {
    display: flex;
    justify-content: flex-end; /* 改用 flex-end 代替 right 以符合現代標準 */
    width: 82%;
    position: relative; /* 擴充：為手機版絕對定位做準備 */
}

/* 隱藏手機版專用的開關與漢堡按鈕 */
.menu-toggle,
.hamburger-btn {
    display: none;
}

.header-navigation ul {
    list-style-type: none;
    margin: 0;
    padding: 0;
    float: right;
}

.header-navigation ul li {
    float: left;
    margin-right: 20px;
    padding-top: 50px;
}

.header-navigation ul li a {
    font-family: Gotham-Book, 'Helvetica Neue', Helvetica, 'Lucida Grande', sans-serif;
    font-weight: 700;
    font-size: 18px;
    color: #232120;
    text-decoration: none;
    transition: color 0.3s ease;
}

/* ==========================================================================
   2. 手機版響應式斷點（當螢幕寬度小於或等於 1049px 時自動切換）
   ========================================================================== */
@media (max-width: 1050px) {
    .header-navigation {
        width: auto;
        display: block;
    }

    /* 漢堡按鈕基礎樣式 */
    .hamburger-btn {
        display: flex;
        flex-direction: column;
        justify-content: space-between;
        width: 48px;
        height: 40px;
        cursor: pointer;
        z-index: 100;
        margin-top: 50px;
        float: right;
        margin-right: 50px;
        overflow: visible !important; /* 確保任何動態擴展絕對不被切掉 */
    }

    .hamburger-btn span {
        display: block;
        height: 4px; /* 稍微加粗到 4px，在大按鈕（48px）下視覺比例更完美平衡 */
        width: 100%;
        background-color: #232120;
        border-radius: 2px;
        transition: all 0.3s ease-in-out;
        transform-origin: center; /* 【關鍵修正 1】鎖定中心旋轉，不往上下左右偏斜 */
    }

    /* 下拉選單基礎樣式 */
    .header-navigation ul {
        display: none;
        clear: both;
        float: none;
        position: absolute;
        top: 105px; /* 配合按鈕變大，將選單往下推一點點，避免疊在按鈕正下方 */
        right: 50px;
        width: 340px;
        background-color: #ffffff;
        box-shadow: 0 4px 12px rgba(0,0,0,0.1);
        padding: 10px 0;
        z-index: 99;
        border-radius: 4px;
    }

    .header-navigation ul li {
        float: none;
        margin-right: 0;
        padding-top: 0;
    }

    .header-navigation ul li a {
        display: block;
        padding: 15px 20px;
        border-bottom: 1px solid #f5f5f5;
        font-size: 2.8em;
    }

    .header-navigation ul li:last-child a {
        border-bottom: none;
    }

    /* ==========================================================================
       新核心開關：【關鍵修正 2】依據 40px 高度重新精密計算的交會幾何數值
       ========================================================================== */
    .hamburger-btn.active span:nth-child(1) {
        /* 40px 容器減去線寬後，正中心位移恰好為 18px */
        transform: translateY(18px) rotate(45deg);
    }

    .hamburger-btn.active span:nth-child(2) {
        opacity: 0;
        transform: scale(0); /* 縮小到 0，徹底釋放空間不干擾 */
    }

    .hamburger-btn.active span:nth-child(3) {
        /* 往上移動 18px 並反向旋轉，與第一條線形成完美對稱的 X */
        transform: translateY(-18px) rotate(-45deg);
    }
}

/* Backdrop / Overlay */
#table-popup-overlay {
    display: none; /* Hidden by default */
    position: fixed;
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0, 0, 0, 0.7);
    z-index: 9999;
    justify-content: center;
    align-items: center;
}

/* Modal Main Container */
#table-popup-container {
    position: relative;
    width: 90%;
    max-width: 700px;
    max-height: 85vh; /* Prevents taller modals from going off screen */
    background: #ffffff;
    border-radius: 8px;
    padding: 24px;
    box-shadow: 0 10px 30px rgba(0, 0, 0, 0.3);
    display: flex;
    flex-direction: column;
}

/* Close Button (X) */
#close-table {
    position: absolute;
    top: 12px;
    right: 16px;
    background: transparent;
    border: none;
    color: #666;
    font-size: 28px;
    cursor: pointer;
    line-height: 1;
    padding: 0;
}

#close-table:hover {
    color: #000;
}

/* Modal Header */
.popup-title {
    margin-top: 0;
    margin-bottom: 16px;
    font-size: 20px;
    color: #333;
}

/* Scrollable Table Wrapper (for overflow on small screens) */
.table-wrapper {
    overflow-x: auto;
    overflow-y: auto;
    max-height: 60vh;
}

/* Table Styling */
.data-table {
    width: 100%;
    border-collapse: collapse;
    text-align: left;
    font-family: Arial, sans-serif;
}

.data-table th,
.data-table td {
    padding: 12px 16px;
    border-bottom: 1px solid #e0e0e0;
}

.data-table th {
    background-color: #f8f9fa;
    color: #333;
    font-weight: 600;
    position: sticky;
    top: 0; /* Keeps table header visible when scrolling */
}

.data-table tr:hover {
    background-color: #f5f5f5;
}

/* Trigger Button Styling */
.btn-open-table {
    padding: 12px 24px;
    font-size: 16px;
    background-color: #007bff;
    color: #fff;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

.btn-open-table:hover {
    background-color: #0056b3;
}

.open-table {cursor: pointer}