/* assets/css/style.css */

/* 1. Table Responsive Wrapper (เลื่อนแนวนอนได้ถ้าจำเป็น) */
.table-responsive {
    overflow-x: auto;
    -webkit-overflow-scrolling: touch;
}

/* 2. Mobile Table to Card View (Magic starts here!) */
@media screen and (max-width: 768px) {
    /* ซ่อนหัวตาราง เพราะเราจะเอาชื่อคอลัมน์ไปแปะไว้ข้างๆ ข้อมูลแทน */
    .mobile-table thead {
        display: none;
    }

    /* เปลี่ยนแถว (tr) ให้เป็นกล่องการ์ด */
    .mobile-table tbody tr {
        display: block;
        margin-bottom: 1rem;
        background-color: #fff;
        border: 1px solid #e2e8f0;
        border-radius: 0.5rem;
        box-shadow: 0 1px 2px 0 rgba(0, 0, 0, 0.05);
        overflow: hidden;
    }

    /* เปลี่ยนเซลล์ (td) ให้เป็น Flex เพื่อจัดชื่อหัวข้อและค่าให้อยู่คนละฝั่ง */
    .mobile-table tbody td {
        display: flex;
        justify-content: space-between;
        align-items: center;
        padding: 0.75rem 1rem;
        border-bottom: 1px solid #f1f5f9;
        text-align: right; /* จัดค่าข้อมูลชิดขวา */
    }

    .mobile-table tbody td:last-child {
        border-bottom: none;
        justify-content: center; /* ปุ่ม Action ให้center */
        background-color: #f8fafc;
    }

    /* ใช้ Pseudo-element ดึงค่าจาก attribute 'data-label' มาแสดงเป็นหัวข้อฝั่งซ้าย */
    .mobile-table tbody td::before {
        content: attr(data-label);
        font-weight: 600;
        color: #64748b;
        text-transform: uppercase;
        font-size: 0.75rem;
        margin-right: 1rem;
        text-align: left;
    }
}