/* ===== 全域設定 ===== */
body {
    font-family: "Segoe UI", Arial, sans-serif;
    margin: 0;
    background-color: #f5f7fb;
    color: #333;
}

/* ===== 上方導覽 ===== */
.top {
    display: flex;
    justify-content: space-between;
    align-items: center;
    background-color: #1e2a38;
    color: white;
    padding: 12px 24px;
}

.top .left {
    font-size: 22px;
    font-weight: bold;
    cursor: pointer;
}

.top .right {
    display: flex;
    align-items: center;
    gap: 15px;
}

.top img {
    cursor: pointer;
}

/* ===== 篩選區塊 ===== */
.inspection-filters {
    background: white;
    margin: 20px auto;
    padding: 20px;
    width: 90%;
    max-width: 1100px;
    border-radius: 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);

    display: flex;
    flex-wrap: wrap;
    gap: 10px;
    align-items: center;
}

.inspection-filters label {
    font-weight: 600;
}

.inspection-filters input,
.inspection-filters select {
    padding: 6px 10px;
    border-radius: 6px;
    border: 1px solid #ccc;
}

.inspection-filters button {
    padding: 7px 14px;
    border: none;
    border-radius: 6px;
    cursor: pointer;
    transition: 0.2s;
}

/* 搜尋按鈕 */
#searchBtn {
    background-color: #4CAF50;
    color: white;
}

#searchBtn:hover {
    background-color: #43a047;
}

/* CSV */
#downloadCsvBtn {
    background-color: #2196F3;
    color: white;
}

#downloadCsvBtn:hover {
    background-color: #1976d2;
}

/* ===== Tabs ===== */
.tabs {
    width: 90%;
    max-width: 1100px;
    margin: 10px auto;
    display: flex;
    gap: 10px;
}

.tabs button {
    flex: 1;
    padding: 10px;
    border: none;
    background: #ddd;
    cursor: pointer;
    border-radius: 8px 8px 0 0;
    font-weight: bold;
    transition: 0.2s;
}

.tabs button:hover {
    background: #ccc;
}

.tabs .active {
    background: white;
    border-bottom: 2px solid white;
}

/* ===== 分頁內容 ===== */
.tab-pannel {
    width: 90%;
    max-width: 1100px;
    margin: 0 auto 30px;
    background: white;
    padding: 20px;
    border-radius: 0 12px 12px 12px;
    box-shadow: 0 2px 10px rgba(0, 0, 0, 0.08);
    overflow-x: auto;
    box-sizing: border-box;
}

/* ===== 表格 ===== */
#inspectionTable {
    width: 100%;
    border-collapse: collapse;
    min-width: 900px;
}

#inspectionTable thead {
    background-color: #1e2a38;
    color: white;
}

#inspectionTable th,
#inspectionTable td {
    padding: 10px;
    text-align: center;
    border-bottom: 1px solid #ddd;
    vertical-align: middle;
}

#inspectionTable th {
    background: #f3f6fb;
    color: #2c3e50;
    font-weight: 700;
}

#inspectionTable tr:hover {
    background-color: #f9fbff;
}

/* 說明欄位可讀性 */
#inspectionTable td:nth-child(6) {
    text-align: left;
    min-width: 220px;
    line-height: 1.5;
}

/* 操作欄 */
#inspectionTable td:last-child,
#inspectionTable th:last-child {
    min-width: 220px;
}

/* 預覽、刪除按鈕 */
.action-buttons {
    display: flex;
    justify-content: center;
    align-items: center;
    gap: 8px;
    flex-wrap: wrap;
}

.action-buttons button {
    border: none;
    padding: 8px 14px;
    border-radius: 999px;
    font-size: 14px;
    font-weight: 600;
    cursor: pointer;
    transition: all 0.2s ease;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.preview-btn {
    background: #e0f2fe;
    color: #0369a1;
}

.preview-btn:hover {
    transform: translateY(-1px);
    background: #bae6fd;
}

.edit-btn {
    background: #fef3c7;
    color: #b45309;
}

.edit-btn:hover {
    transform: translateY(-1px);
    background: #fde68a;
}

.delete-btn {
    background: #fee2e2;
    color: #b91c1c;
}

.delete-btn:hover {
    transform: translateY(-1px);
    background: #fecaca;
}

/* 異常標示 */
td:nth-child(5) {
    font-weight: bold;
}

/* ===== 圖表區 ===== */
#stats {
    text-align: center;
}

#inspectionChart {
    max-width: 500px;
    margin: 20px auto;
}

#inspectionChart {
    width: 100% !important;
    height: 100% !important;
}

.chart-container {
    width: 100%;
    max-width: 900px;
    height: 450px;
    margin: 20px auto;
}



/* 圖表按鈕 */
#chartTypeBtn {
    margin-top: 20px;
    padding: 10px 18px;
    font-size: 14px;
    font-weight: 600;
    color: white;
    background: linear-gradient(135deg, #4CAF50, #2e7d32);
    border: none;
    border-radius: 8px;
    cursor: pointer;
    transition: all 0.25s ease;
    box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15);
}

/* hover 效果 */
#chartTypeBtn:hover {
    transform: translateY(-2px);
    box-shadow: 0 6px 14px rgba(0, 0, 0, 0.2);
}

/* 點擊 */
#chartTypeBtn:active {
    transform: scale(0.96);
}

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

    .inspection-filters {
        flex-direction: column;
        align-items: flex-start;
    }

    .tabs {
        flex-direction: column;
    }

    .tabs button {
        border-radius: 8px;
    }

    #inspectionTable th,
    #inspectionTable td {
        font-size: 12px;
        padding: 6px;
    }

    #chartTypeBtn {
        width: 100%;
    }

}