.div1 {
    width: 1200px;  /* กำหนดความกว้างคงที่ */
    height: 200px;  /* กำหนดความสูงคงที่ */
    overflow: auto; /* เปลี่ยนเป็น auto เพื่อแสดง scrollbar เมื่อจำเป็น */
    margin: 20px auto; /* จัดกึ่งกลาง */
}

.div1 table {
    table-layout: fixed;
    width: 100%;
    border: none;
    border-collapse: separate;
    border-spacing: 0;
}

.div1 th {
    padding: 8px 4px;
    position: sticky;
    top: 0;
    background: #e1e6ff;
    color: #2D3748;
    text-align: center;
    width: 80px;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    box-sizing: border-box;
    border: none;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 13px;
    font-weight: 600;
    letter-spacing: 0.3px;
    cursor: pointer;
}

.div1 td {
    padding: 6px 4px;
    width: 80px;
    max-width: 80px;
    white-space: nowrap;
    overflow: hidden;
    text-overflow: ellipsis;
    vertical-align: middle;
    text-align: left;
    box-sizing: border-box;
    border: none;
    background: #fcfcfc; 
    color: #6B5B73;
    transition: background-color 0.2s ease;
    font-family: 'Segoe UI', Tahoma, Geneva, Verdana, sans-serif;
    font-size: 12px;
    font-weight: 400;
    line-height: 1.4;
    cursor: pointer;
}

.div1 tr {
    height: 36px; /* เพิ่มความสูงเพื่อรองรับฟอนต์ที่ใหญ่ขึ้น */
    cursor: pointer;
}

/* Hover effect สำหรับแถว */
.div1 tr:hover {
    background-color: #ffffff !important; /* Cream */
}

.div1 tr:hover td {
    background-color: #5d87ff !important; /* Cream */
    transform: scale(1.01);
}

/* กำหนดขนาดพิเศษสำหรับคอลัมน์ที่กว้าง */
.w-50 {
    width: 50px !important;
    min-width: 50px !important;
    max-width: 50px !important;
    background: white !important;
}

.w-100 {
    width: 100px !important;
    min-width: 100px !important;
    max-width: 100px !important;
}

.w-200 {
    width: 200px !important;
    min-width: 200px !important;
    max-width: 200px !important;
}

.w-300 {
    width: 300px !important;
    min-width: 300px !important;
    max-width: 300px !important;
}

/* ===== CLASS-BASED FREEZING SYSTEM ===== */

/* Base freeze classes */
.freeze-left {
    position: sticky !important;
    left: 0;
    z-index: 10;
    background: #e1e6ff !important; /* Astra */
    color: #424242 !important;
    box-shadow: 2px 0 4px rgba(0,0,0,0.1);
    font-weight: 500;
}

.freeze-left:nth-child(1) {
    left: 0px !important;
    z-index: 10;
}

.freeze-left:nth-child(2) {
    left: 50px !important;
    z-index: 11;
}

.freeze-left:nth-child(3) {
    left: 250px !important;
    z-index: 12;
}

.freeze-right {
    position: sticky !important;
    right: 0;
    z-index: 10;
    background: #e1e6ff !important; /* Astra */
    color: #424242 !important;
    box-shadow: -2px 0 4px rgba(0,0,0,0.1);
    font-weight: 500;
}

.freeze-right:nth-last-child(1) {
    right: 0px !important;
    z-index: 10;
}

.freeze-top {
    position: sticky !important;
    top: 0;
    z-index: 10;
    background: #e1e6ff !important; /* Astra */
    color: #424242 !important;
    font-weight: 600;
}

/* Combined freeze classes */
.freeze-left.freeze-top {
    z-index: 20;
    background: #e1e6ff !important; /* Astra */
    color: #424242 !important;
}

.freeze-left.freeze-top:nth-child(1) {
    left: 0px !important;
    z-index: 20;
}

.freeze-left.freeze-top:nth-child(2) {
    left: 50px !important;
    z-index: 21;
}

.freeze-right.freeze-top {
    z-index: 20;
    background: #e1e6ff !important; /* Astra */
    color: #424242 !important;
}

.freeze-right.freeze-top:nth-last-child(1) {
    right: 0px !important;
    z-index: 20;
}