﻿/* 當螢幕寬度小於 768px (手機/直向平板) 時觸發 */
@media screen and (max-width: 992px) {
    /* 隱藏原本的 table 表頭 */
    .rwd-table thead {
        display: none;
    }

    /* 讓 table, tbody, tr, td 全部變成區塊元素欄位 */
    .rwd-table, .rwd-table tbody, .rwd-table tr, .rwd-table td {
        display: block;
        width: 100%;
    }

        /* 每一個資料列變成一個獨立的卡片 */
        .rwd-table tr {
            margin-bottom: 15px;
            border: 1px solid #dee2e6;
            border-radius: 0.25rem;
            padding: 10px;
            box-shadow: 0 2px 4px rgba(0,0,0,0.05);
        }

        /* 處理資料欄位排版 */
        .rwd-table td {
            text-align: left; /* 資料靠右 */
            padding-left: 50%; /* 給左邊標籤留空間 */
            position: relative;
            border: none;
            border-bottom: 1px dashed #eee;
        }

            .rwd-table td:last-child {
                border-bottom: none; /* 最後一欄（按鈕欄）不加底線 */
            }

            /* 利用 :before 偽元素將 data-label 的名稱塞到左邊 */
            .rwd-table td:before {
                content: attr(data-label);
                position: absolute;
                left: 10px;
                width: 45%;
                text-align: left; /* 標籤靠左 */
                font-weight: bold;
                color: #495057;
            }

        /* 手機版按鈕置中或靠右排整齊 */
        .rwd-table .rwd-actions {
            text-align: center;
            padding-left: 0;
        }

            .rwd-table .rwd-actions:before {
                display: none; /* 手機版操作欄隱藏 "操作" 二字標籤 */
            }

            .rwd-table .rwd-actions .btn {
                margin: 2px;
                display: inline-block;
            }
}
