/* ========================================
   📌 테이블 헤더 고정 - 강제 적용 (PC & Mobile)
   ======================================== */

/* 테이블 컨테이너 최적화 */
.table-container {
    position: relative !important;
    overflow-x: auto !important;
    overflow-y: auto !important;
    max-height: calc(100vh - 400px) !important;
    -webkit-overflow-scrolling: touch !important;
}

/* 테이블 자체는 position 유지 */
.data-table,
table {
    position: relative !important;
    width: 100% !important;
}

/* 테이블 헤더 강제 고정 - PC */
.data-table thead,
table thead {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background: #ffffff !important;
}

.data-table th,
table th {
    position: sticky !important;
    top: 0 !important;
    z-index: 100 !important;
    background: #ffffff !important;
    box-shadow: 0 1px 0 0 #e2e8f0 !important;
}

/* 모바일 전용 테이블 헤더 고정 */
@media (max-width: 768px) {
    /* 테이블 컨테이너 */
    .table-container {
        position: relative !important;
        display: block !important;
        overflow-x: auto !important;
        overflow-y: auto !important;
        -webkit-overflow-scrolling: touch !important;
        max-height: calc(100vh - 350px) !important;
    }
    
    /* 테이블 */
    .data-table,
    table {
        display: table !important;
        position: relative !important;
        width: 100% !important;
        border-collapse: separate !important;
        border-spacing: 0 !important;
    }
    
    /* 테이블 헤드 */
    .data-table thead,
    table thead {
        display: table-header-group !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        background: #ffffff !important;
    }
    
    /* 테이블 헤더 셀 */
    .data-table th,
    table th {
        display: table-cell !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
        background: #ffffff !important;
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.05) !important;
    }
    
    /* 테이블 바디 */
    .data-table tbody,
    table tbody {
        display: table-row-group !important;
    }
    
    /* 테이블 행 */
    .data-table tr,
    table tr {
        display: table-row !important;
    }
    
    /* 테이블 셀 */
    .data-table td,
    table td {
        display: table-cell !important;
    }
}

/* iOS Safari 전용 수정 */
@supports (-webkit-touch-callout: none) {
    .table-container {
        -webkit-overflow-scrolling: touch !important;
    }
    
    .data-table thead,
    table thead {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
    }
    
    .data-table th,
    table th {
        position: -webkit-sticky !important;
        position: sticky !important;
        top: 0 !important;
        z-index: 100 !important;
    }
}
