/* ======================================== */
/* 網站整體外觀 */
/* ======================================== */

body {
    font-family: "Microsoft JhengHei", sans-serif;
    background-color: #f2f5f7;
    padding: 30px;
}


/* ======================================== */
/* 網站標題 */
/* ======================================== */

h1 {
    color: #1f6f8b;
}


/* ======================================== */
/* 按鈕 */
/* ======================================== */

button {
    background-color: #1f6f8b;
    color: white;
    padding: 10px 20px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
}

/* 滑鼠移到按鈕時，顏色稍微變深 */
button:hover {
    background-color: #15566d;
}


/* ======================================== */
/* 統計結果區域 */
/* ======================================== */

#resultSection {
    margin-top: 30px;
}


/* ======================================== */
/* 統計表格 */
/* ======================================== */

#resultTable {
    width: 100%;
    border-collapse: collapse;
    margin-top: 15px;
}


/* ======================================== */
/* 統計表格標題及資料 */
/* ======================================== */

#resultTable th,
#resultTable td {
    border: 1px solid #ddd;
    padding: 12px;
    text-align: center;
}


/* ======================================== */
/* 統計表格標題 */
/* ======================================== */

#resultTable th {
    background-color: #f2f4f7;
    font-weight: bold;
}


/* ======================================== */
/* 偶數列背景 */
/* ======================================== */

#resultTable tbody tr:nth-child(even) {
    background-color: #fafafa;
}


/* ======================================== */
/* 滑鼠移到資料列 */
/* ======================================== */

#resultTable tbody tr:hover {
    background-color: #eef5ff;
}


/* ======================================== */
/* 合計列外觀（本次新增） */
/* ======================================== */

/*
    display.js 已經將合計列設定為：

    totalRow.className = "total-row";

    因此可以使用 .total-row
    專門設定合計列的外觀。
*/

#resultTable tbody tr.total-row {

    /* 淡藍色背景 */
    background-color: #dceef5;

    /* 粗體文字 */
    font-weight: bold;

    /* 深藍色文字 */
    color: #164e63;

}


/* ======================================== */
/* 合計列的上方分隔線 */
/* ======================================== */

#resultTable tbody tr.total-row td {

    /* 加粗上方框線 */
    border-top: 3px solid #1f6f8b;

}


/* ======================================== */
/* 滑鼠移到合計列時維持原本顏色 */
/* ======================================== */

#resultTable tbody tr.total-row:hover {

    background-color: #dceef5;

}


/* ======================================== */
/* 健保未列冊確認視窗 */
/* ======================================== */


/* ======================================== */
/* 功能一：確認視窗的背景遮罩 */
/* ======================================== */

.health-dialog {

    /* 固定在整個瀏覽器畫面上 */
    position: fixed;

    /* 覆蓋整個畫面 */
    top: 0;
    left: 0;
    width: 100%;
    height: 100%;

    /* 半透明深色背景 */
    background-color: rgba(0, 0, 0, 0.45);

    /* 將確認視窗放在畫面中央 */
    display: flex;
    justify-content: center;
    align-items: center;

    /* 確保視窗顯示在其他內容上方 */
    z-index: 1000;

    /* 與畫面邊緣保留距離 */
    padding: 20px;

    /* 讓 padding 不會使整體寬度超出畫面 */
    box-sizing: border-box;

}


/* ======================================== */
/* 功能二：確保 hidden 可以正常隱藏視窗 */
/* ======================================== */

/*
    因為上面的 .health-dialog 使用 display: flex，
    所以必須額外設定 [hidden]。

    否則 CSS 的 display: flex 可能覆蓋
    HTML 原本的 hidden 隱藏效果。
*/

.health-dialog[hidden] {
    display: none;
}


/* ======================================== */
/* 功能三：確認視窗的白色內容區域 */
/* ======================================== */

.health-dialog-content {

    /* 白色背景 */
    background-color: white;

    /* 視窗寬度 */
    width: 100%;

    /* 最大寬度 */
    max-width: 1000px;

    /* 最大高度不超過畫面 */
    max-height: 90vh;

    /* 內部留白 */
    padding: 25px;

    /* 圓角 */
    border-radius: 10px;

    /* 陰影 */
    box-shadow: 0 8px 30px rgba(0, 0, 0, 0.2);

    /* 超出高度時可以捲動 */
    overflow-y: auto;

    /* 避免 padding 造成寬度超出 */
    box-sizing: border-box;

}


/* ======================================== */
/* 功能四：確認視窗標題 */
/* ======================================== */

.health-dialog-content h2 {

    /* 使用網站原本的藍色 */
    color: #1f6f8b;

    /* 上方不留多餘空間 */
    margin-top: 0;

}


/* ======================================== */
/* 功能五：員工名單表格容器 */
/* ======================================== */

.health-dialog-table-wrapper {

    /* 名單太寬時可以左右捲動 */
    overflow-x: auto;

    /* 與上下內容保持距離 */
    margin-top: 15px;
    margin-bottom: 20px;

}


/* ======================================== */
/* 功能六：未列冊員工表格 */
/* ======================================== */

#healthDialogTable {

    /* 填滿容器 */
    width: 100%;

    /* 合併表格框線 */
    border-collapse: collapse;

    /* 避免欄位太窄 */
    min-width: 760px;

}


/* ======================================== */
/* 功能七：表格標題與資料 */
/* ======================================== */

#healthDialogTable th,
#healthDialogTable td {

    /* 表格框線 */
    border: 1px solid #ddd;

    /* 儲存格留白 */
    padding: 12px;

    /* 文字垂直置中 */
    vertical-align: middle;

    /* 文字靠左 */
    text-align: left;

}


/* ======================================== */
/* 功能八：表格標題 */
/* ======================================== */

#healthDialogTable th {

    background-color: #f2f4f7;

    font-weight: bold;

    /* 避免標題自動換行 */
    white-space: nowrap;

}


/* ======================================== */
/* 功能九：偶數列背景 */
/* ======================================== */

#healthDialogTable tbody tr:nth-child(even) {
    background-color: #fafafa;
}


/* ======================================== */
/* 功能十：處理狀態下拉選單 */
/* ======================================== */

.health-status {

    /* 填滿儲存格 */
    width: 100%;

    /* 最小寬度 */
    min-width: 180px;

    /* 內部留白 */
    padding: 9px;

    /* 邊框 */
    border: 1px solid #ccc;

    /* 圓角 */
    border-radius: 5px;

    /* 字體 */
    font-family: inherit;

    /* 字體大小 */
    font-size: 14px;

    /* 白色背景 */
    background-color: white;

    box-sizing: border-box;

}


/* ======================================== */
/* 功能十一：未列冊原因輸入框 */
/* ======================================== */

.health-reason {

    /* 填滿儲存格 */
    width: 100%;

    /* 最小寬度 */
    min-width: 220px;

    /* 內部留白 */
    padding: 9px;

    /* 邊框 */
    border: 1px solid #ccc;

    /* 圓角 */
    border-radius: 5px;

    /* 字體 */
    font-family: inherit;

    /* 字體大小 */
    font-size: 14px;

    box-sizing: border-box;

}


/* ======================================== */
/* 功能十二：輸入框取得焦點時 */
/* ======================================== */

.health-status:focus,
.health-reason:focus {

    /* 藍色外框 */
    outline: 2px solid #1f6f8b;

    /* 設定邊框顏色 */
    border-color: #1f6f8b;

}


/* ======================================== */
/* 功能十三：確認視窗的說明區域 */
/* ======================================== */

.health-dialog-note {

    /* 淺藍色背景 */
    background-color: #eef5f8;

    /* 左側藍色線條 */
    border-left: 4px solid #1f6f8b;

    /* 內部留白 */
    padding: 12px 16px;

    /* 圓角 */
    border-radius: 5px;

    /* 文字大小 */
    font-size: 14px;

    /* 行距 */
    line-height: 1.6;

}


/* ======================================== */
/* 功能十四：說明文字間距 */
/* ======================================== */

.health-dialog-note p {

    margin-top: 6px;

    margin-bottom: 6px;

}


/* ======================================== */
/* 功能十五：確認視窗按鈕區域 */
/* ======================================== */

.health-dialog-buttons {

    /* 按鈕靠右排列 */
    display: flex;

    justify-content: flex-end;

    /* 按鈕之間的距離 */
    gap: 12px;

    /* 與上方內容保持距離 */
    margin-top: 20px;

}


/* ======================================== */
/* 功能十六：取消統計按鈕 */
/* ======================================== */

#cancelHealth {

    /* 灰色背景 */
    background-color: #777;

}


/* 滑鼠移到取消按鈕 */
#cancelHealth:hover {

    background-color: #555;

}


/* ======================================== */
/* 功能十七：確認並繼續按鈕 */
/* ======================================== */

#confirmHealth {

    /* 沿用網站主要藍色 */
    background-color: #1f6f8b;

}


/* 滑鼠移到確認按鈕 */
#confirmHealth:hover {

    background-color: #15566d;

}


/* ======================================== */
/* 功能十八：小螢幕顯示調整 */
/* ======================================== */

@media (max-width: 600px) {

    /* 縮小網站留白 */
    body {
        padding: 15px;
    }

    /* 縮小確認視窗留白 */
    .health-dialog-content {
        padding: 16px;
    }

    /* 按鈕改成上下排列 */
    .health-dialog-buttons {
        flex-direction: column;
    }

    /* 按鈕填滿寬度 */
    .health-dialog-buttons button {
        width: 100%;
    }

}