#openModalBtn {
    padding: 10px 20px;
    font-size: 16px;
}

.modal {
    display: none;
    position: fixed;
    z-index: 1;
    left: 50%;
    transform: translateX(-50%);
    top: 0;
    width: 85%;
    max-width: 85%;
    height: 100%;
    overflow: hidden; /* Changed from 'auto' to 'hidden' to prevent closing on outside click */    
    padding-top: 60px;
}

.modal-content {
    background-color: #fefefe;
    margin: auto;
    border-radius: 10px;
    width: 100%;
    max-width: 100%;
    animation: fadeIn 0.5s;
    box-shadow: 0 5px 15px rgba(0,0,0,0.3);
}

@keyframes fadeIn {
	from { opacity: 0; }
	to { opacity: 1; }
}

.modal-header {
	background-color: #1f48d4;
	color: white;
	padding: 10px;
	border-top-left-radius: 10px;
	border-top-right-radius: 10px;
	display: flex;
	justify-content: space-between;
	align-items: center;
}

.modal-title {
	font-size: 18px;
}

.close {
	color: white;
	font-size: 18px;
	font-weight: bold;
	cursor: pointer;
}

.close:hover,
.close:focus {
	color: #bbb;
	text-decoration: none;
}
.modal-body {
    padding: 15px;
    width: 100%;
    max-width: 100%;
    max-height: calc(100vh - 50px); /* 뷰포트 높이에서 여유 공간 확보 */
    overflow-y: auto; /* 세로 스크롤 추가 */
}

.custom-card {
	background-color: #f9f9f9;
	padding: 20px;
	border: 1px solid #ddd;
	border-radius: 5px;
	box-shadow: 0 1px 3px rgba(0,0,0,0.1);
}

.tooltip-inner {
    background-color: black !important; /* 배경색 */
    color: white !important; /* 글자색 */
}
.tooltip-arrow {
    color: black !important; /* 화살표 색상 */
} 

/* 입력창에 대한 설계 */
.ui-autocomplete {
	max-height: 500px;
	overflow-y: auto;
	overflow-x: hidden;
}

.specialinputWrap {
	position: relative;
	display: inline-block;
	width:100%;
}

.specialbtnClear {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
	border: none;
	color: black;
	cursor: pointer;
}

.specialbtnClear:before {
	content: 'X';
	font-size: 12px;
}

.specialbtnClear:hover {
	color: black;
}

.btnClear_lot {
	position: absolute;
	right: 10px;
	top: 50%;
	transform: translateY(-50%);
	background: transparent;
	border: none;
	color: black;
	cursor: pointer;
}

.btnClear_lot:before {
	content: 'X';
	font-size: 12px;
}

.btnClear_lot:hover {
	color: black;
} 
		
/* 전체 테이블에 대한 설정 */
table {
    border-collapse: collapse;
}

/* 모든 td 요소에 적용되는 기본 패딩 및 행간 조정 */
td {
    padding: 5px !important; /* 셀의 내부 여백을 줄임 */
    line-height: 1.3 !important; /* 행간을 줄여서 상하단 여백을 줄임 */
}

/* 테이블의 상단과 하단 마진을 제거하여 전체 공백 줄이기 */
table, .d-flex {
    margin-top: 2 !important;
    margin-bottom: 2 !important;
}
	
@media print {
	body {
		width: 210mm; /* A4 width */
		height: 297mm; /* A4 height */
		margin: 0; /* Remove default margin */
		font-size: 8pt; /* Font size for printing */
	}
	.table {
		width: 100%; /* Full width tables */
		table-layout: fixed; /* Uniform column sizing */
		border-collapse: collapse; /* Ensure borders collapse */
	}
	.table th, .table td {
		padding: 1px; /* Reduce padding */
		/* border: 1px solid black!important;  Ensure borders are visible */
	}
	.text-center {
		text-align: center; /* Maintain center alignment */
	}

	/* Prevent table row splitting */
	.table tr {
		page-break-inside: avoid; /* Prevent breaking inside rows */
		page-break-after: avoid; /* Allow breaking after rows */
	}
	.table thead {
		display: table-header-group; /* Ensure table headers are repeated */
	}
	.table tbody {
		display: table-row-group; /* Ensure table rows are grouped */
	}
	.table tfoot {
		display: table-footer-group; /* Ensure table footers are repeated */
	}

	/* Add top and bottom margins to each page */
	.table tbody:before,
	.table tbody:after {
		content: "";
		display: table-row;
		height: 5mm; /* Adjust as needed for top and bottom margins */
	}

	/* Remove border from the before and after elements */
	.table tbody:before td,
	.table tbody:after td {
		border: none; /* Remove borders */
	}

	/* Adjust the border of the last row on the page */
	.table tbody tr:last-child td {
		border-bottom: none; /* Remove the bottom border */
		border-left: none; /* Remove the bottom border */
		border-right: none; /* Remove the bottom border */
		border-top: none; /* Remove the bottom border */
	}

	/* Prevent border at the connection of two pages */
	.table tbody tr:last-child td:first-child {
		border-bottom: none; /* Remove the bottom border */
		border-left: none; /* Remove the bottom border */
		border-right: none; /* Remove the bottom border */
		border-top: none; /* Remove the bottom border */
	}
	.table tbody tr:last-child td:last-child {
		border-bottom: none; /* Remove the bottom border */
		border-left: none; /* Remove the bottom border */
		border-right: none; /* Remove the bottom border */
		border-top: none; /* Remove the bottom border */
	}	

}

#specailTable th, #specailTable td {
	padding: 3px!important;
}
#specailTable2 th, #specailTable2 td {
	padding: 3px!important;
	border: 0.2px solid gray !important;
}

/* Assembly Table Styles */
.table-container {
    width: 100%;    
}

#assemblyTable {
    table-layout: fixed;
    width: 100%; 
}

#assemblyTable th:first-child,
#assemblyTable td:first-child {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
}

#assemblyTable th:nth-child(2),
#assemblyTable td:nth-child(2) {
    width: 1100px;
    min-width: 1100px;
    max-width: 1100px;
}

/* 테이블 셀의 padding 최소화 */
#assemblyTable td {
    padding: 2px !important;
    vertical-align: middle;
}

#assemblyTable th {
    padding: 2px !important;
    vertical-align: middle;
}

.input-container {
    white-space: nowrap;
    display: flex;
    align-items: center;
    justify-content: start;
    padding: 0;
    margin: 0;
}

.input-container input,
.input-container span {
    display: inline-block;
    margin-right: 5px; /* 간격 늘림 */
    padding: 1px 2px; /* input 내부 padding 최소화 */
    border: 0.2px solid #ccc;
    font-size: 0.8rem; /* 폰트 크기 줄임 */
    text-align: center; /* 모든 텍스트 가운데 정렬 */
    vertical-align: middle;
}

.input-container input[type="text"] {
    width: 40px;	
    height: 26px; /* 높이 줄임 */
}

/* 음영, A각 표시 행의 체크박스도 text-input 칸과 동일 폭/높이 */
.input-container input[type="checkbox"] {
    width: 16px; /* 체크박스 크기 줄임 */
    height: 16px; /* 체크박스 크기 줄임 */
    margin: 0;
    padding: 0;
    vertical-align: middle;
}

/* form-control 클래스의 padding 최소화 */
.form-control {
    padding: 1px 2px !important;
    font-size: 0.8rem !important;
    height: 24px !important;    
}

.form-check-input {
    padding: 0 !important;
    margin: 0 12px 0 16px!important;
    width: 17px !important;
    height: 16px !important;
}

/* 테이블 전체 스타일 최적화 */
.table {
    margin-bottom: 0;
}

.table-bordered td,
.table-bordered th {
    border-width: 0.2px;
}

/* 체크박스가 포함된 셀도 동일한 너비 유지 */
.input-container:has(input[type="checkbox"]) {
    justify-content: start; /* 왼쪽 정렬로 되돌림 */
}

/* 모든 input-container의 자식 요소들이 동일한 공간을 차지하도록 */
.input-container > * {
    flex-shrink: 0; /* 요소가 축소되지 않도록 */
}

/* wrapper: 원래 폭과 높이를 그대로 쓰되 inline-block 으로 묶어줌 */
.input-container .col-cell {
  display: inline-block;
  vertical-align: middle;
  position: relative;
  /* wrapper 에는 너비나 높이를 지정하지 않습니다.
     table-layout:fixed 와 input/span 의 width:40px;height:24px 가
     각각 칸을 균등 분할하고, 내부 요소 크기를 결정합니다. */
}

/* 삭제 버튼 */
.col-cell .remove-col {
  position: absolute;
  top: 0;
  right: 0;
  width: 1em;
  height: 1em;
  line-height: 1em;
  padding: 0;
  font-size: 0.8rem;
  border: none;
  background: transparent;
  color: #d33;
  cursor: pointer;
}

/* 라벨 셀 스타일 */
.lightgray {
    background-color: #f8f9fa;
    font-weight: bold;
    text-align: center;
}

 /* 두 번째 모달(#bendingSearchModal)의 z-index를 높여서 항상 위에 표시되도록 함 */
 #bendingSearchModal {
	z-index: 1060; /* Bootstrap의 기본 모달 z-index(1050)보다 높은 값 */
}

/* 만약 두 번째 모달의 회색 배경(backdrop)도 뒤에 숨는다면 아래 코드도 추가 */
/* 참고: Bootstrap 버전에 따라 backdrop 클래스 명이 다를 수 있음 */
.modal-backdrop.fade.show:nth-of-type(2) {
	z-index: 1055; /* 첫 번째 모달과 두 번째 모달 사이의 값 */
}

/* 선택된 행 스타일 */
#bendingSearchResults tr.table-active {
	background-color: #e3f2fd !important;
	border-left: 4px solid #2196F3;
}

#bendingSearchResults tr:hover {
	background-color: #f8f9fa;
	transition: background-color 0.2s ease;
}

#bendingSearchResults tr {
	transition: all 0.2s ease;
}

/* 조립 부품 테이블 스타일 (bending/write_form.php와 동일) */
.table-container {
	width: 100%;    
}
#assemblyTable {
	table-layout: fixed;
	width: 100%; 
}
#assemblyTable th:first-child,
#assemblyTable td:first-child {
	width: 100px;
	min-width: 100px;
	max-width: 100px;
}
#assemblyTable th:nth-child(2),
#assemblyTable td:nth-child(2) {
	width: auto;
	min-width: 200px;
}
/* 테이블 셀의 padding 최소화 */
#assemblyTable td {
	padding: 2px !important;
	vertical-align: middle;
}
#assemblyTable th {
	padding: 2px !important;
	vertical-align: middle;
}
.input-container {
	white-space: nowrap;
	display: flex;
	align-items: center;
	justify-content: start;
	padding: 0;
	margin: 0;
}

.input-container input,
.input-container span {
	display: inline-block;
	margin-right: 5px;
	padding: 1px 2px;
	border: 1px solid #ccc;
	font-size: 0.8rem;
	text-align: center;
	vertical-align: middle;
}
.input-container input[type="text"] {
	width: 40px;	
	height: 24px;
}

.form-control {
	padding: 1px 2px !important;
	font-size: 0.8rem !important;
	height: 24px !important;    
}
.form-check-input {
	padding: 0 !important;
	margin: 0 12px 0 16px!important;
	width: 17px !important;
	height: 16px !important;
}
.table {
	margin-bottom: 0;
}
.table-bordered td,
.table-bordered th {
	border-width: 1px;
}
.input-container > * {
	flex-shrink: 0;
}
.input-container .col-cell {
	display: inline-block;
	vertical-align: middle;
	position: relative;
}
.col-cell .remove-col {
	position: absolute;
	top: 0;
	right: 0;
	width: 1em;
	height: 1em;
	line-height: 1em;
	padding: 0;
	font-size: 0.8rem;
	border: none;
	background: transparent;
	color: #d33;
	cursor: pointer;
}
.lightgray {
	background-color: #f8f9fa;
	font-weight: bold;
}
.yellowBold {
	background-color: #fff3cd;
	font-weight: bold;
}
.orangeBlackBold {
	background-color: #fd7e14;
	color: white;
	font-weight: bold;
}

/* 기본 스타일 설정 */
input[type="checkbox"],
input[type="radio"] {
	transform: scale(1.2); /* 크기 확대 */
	margin: 3px; /* 여백 추가 */
}

/* "readonly" 상태일 때 스타일 설정 */
.readonly-checkbox,
.readonly-radio {
	pointer-events: none; /* 사용자 상호작용 비활성화 */
	opacity: 1; /* 불투명도 설정 */
	color: red !important;
}

/* 순서 관련 스타일 */
.order-number {
    font-weight: bold;
    color: #007bff;
    background-color: #f8f9fa;
    border-radius: 4px;
    padding: 2px 6px;
    min-width: 30px;
    text-align: center;
}

.draggable-row {
    cursor: move;
}

.draggable-row:hover {
    background-color: #f8f9fa;
}

.dragging {
    opacity: 0.5;
    background-color: #e9ecef !important;
}

.drag-over {
    border-top: 2px solid #007bff;
}

/* 순서 배지 스타일 */
.order-badge {
    font-size: 0.8rem;
    padding: 2px 6px;
}

/* 선택된 부품 스타일 */
.component-block.selected {
    background-color: #e3f2fd !important;
    border: 2px solid #2196f3 !important;
}

.component-block.selected .card {
    border-color: #2196f3 !important;
}

/* 드래그 가능한 부품 스타일 */
.component-block {
    cursor: move;
    transition: all 0.2s ease;
}

.component-block:hover {
    background-color: #f8f9fa;
}

.component-block:not(.selected):hover {
    border: 1px solid #dee2e6;
}

/* 라디오 버튼 스타일 */
.btn-check:checked + .btn-outline-primary {
    background-color: #0d6efd;
    border-color: #0d6efd;
    color: white;
}

.btn-check:checked + .btn-outline-success {
    background-color: #198754;
    border-color: #198754;
    color: white;
}

.btn-check:checked + .btn-outline-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}
.btn-group .btn {
    margin-right: 2px;
}

.btn-group .btn:last-child {
    margin-right: 0;
}

/* search_guiderail.php 이미지 확대 기능 스타일 */
.search-zoomable-image {
    transition: all 0.3s ease;
    cursor: pointer;
    position: relative;
}

.search-zoomable-image:hover {
    opacity: 0.8;
}

/* 이미지 팝업 오버레이 - 마우스 위치에 표시 */
.image-popup-overlay {
    display: none;
    position: fixed;
    background: white;
    border: 2px solid #007bff;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.3);
    z-index: 10000;
    padding: 5px;
    text-align: center;
}

.image-popup-content {
    width: 100%;
    height: 100%;
    display: flex;
    align-items: center;
    justify-content: center;
}

.image-popup-content img {
    max-width: 100%;
    max-height: 100%;
    border-radius: 4px;
    object-fit: contain;
}

/* 이미지 모달 스타일 */
.image-modal {
    display: none;
    position: fixed;
    z-index: 9999;
    left: 0;
    top: 0;
    width: 100%;
    height: 100%;
    background-color: rgba(0,0,0,0.8);
    cursor: pointer;
}

.image-modal-content {
    position: absolute;
    top: 50%;
    left: 50%;
    transform: translate(-50%, -50%);
    max-width: 90%;
    max-height: 90%;
    border-radius: 8px;
    box-shadow: 0 4px 20px rgba(0,0,0,0.5);
}

.image-modal-content img {
    width: 100%;
    height: auto;
    border-radius: 8px;
}

/* 그리기 컨트롤 버튼 활성화 상태 */
#lineBtn.active, #textBtn.active, #eraserBtn.active {
    background-color: #007bff !important;
    color: white !important;
    border-color: #007bff !important;
}

/* "아직 등록된 이미지가 없습니다" 메시지 스타일 */
.no-image-message {
    color: #6c757d;
    font-style: italic;
    padding: 20px;
    text-align: center;
    background-color: #f8f9fa;
    border: 1px dashed #dee2e6;
    border-radius: 4px;
    margin: 10px 0;
}

.no-image-message i {
    margin-right: 8px;
    font-size: 1.2em;
}

/* 이미지 에디터 스타일 정의 */
dialog {
    width: 1300px; height: 800px;
    border: none; border-radius: .5rem;
    padding: 0; overflow: hidden;
  }
  dialog::backdrop { background: rgba(0,0,0,.5); }
  #editorHeader {
    background: #f8f9fa; padding: .5rem 1rem;
    border-bottom: 1px solid #dee2e6;
    display: flex; align-items: center;
  }
  #editorHeader h5 { margin: 0; flex-grow: 1; }
  #editorHeader .btn-close { margin-left: .5rem; }
  #editorToolbar, #editorToolbar2 {
    background: #fff;
    padding: .5rem; gap: .25rem;
  }
  #editorToolbar { display: flex; align-items: center; flex-wrap: wrap; }
  #editorToolbar2 { display: flex; align-items: center; }
  .toolbar-btn { width: 40px; height: 40px; padding: 0; }
  .toolbar-btn i { font-size: 1.2rem; }
  .toolbar-btn.active { background-color: #0d6efd; color: #fff; }
  .color-btn { width: 24px; height: 24px; padding: 0; border: 2px solid #fff; cursor: pointer; }
  .color-btn.active { border-color: #000; }
  #editorBody { position: relative; width: 100%; height: calc(100% - 128px); }
  #editorBody canvas { width: 100%; height: 100%; cursor: crosshair; }
  .canvas-text-input {
    position: absolute;
    border: 1px dashed #666;
    background: transparent;
    resize: none;
    outline: none;
    padding: 2px;
    font-family: sans-serif;
  }
  
  /* 이미지 컨테이너 스타일 */
  .image-container {
    position: relative;
    display: inline-block;
  }
  
  .paste-overlay {
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    bottom: 0;
    background: rgba(0, 123, 255, 0.8);
    color: white;
    display: flex;
    flex-direction: column;
    align-items: center;
    justify-content: center;
    border-radius: 0.375rem;
    font-size: 0.875rem;
    opacity: 0;
    transition: opacity 0.2s;
  }
  
  .paste-overlay.show {
    opacity: 1;
  }
  
  .paste-overlay i {
    font-size: 2rem;
    margin-bottom: 0.5rem;
  }

  canvas {
    border: 1px solid black;
    margin: 10;
  }

/* 스타일 코드는 변경이 없으므로 여기에 그대로 유지합니다. */
.image-container { position: relative; display: inline-block; }
.image-container img { display: block; }
.input-overlay { position: absolute; background: rgba(255, 255, 255, 0.5); border: 1px solid blue; width: 40px; color: blue; }    
.assembly-area { border: 1px solid #ddd; padding: 10px; margin-top: 10px; background-color: #f9f9f9; }
.assembly-area th { background-color: #f0f0f0; }

/* 정렬 헤더 스타일 */
.sortable-header {
    position: relative;
    user-select: none;
    transition: background-color 0.2s;
}

.sortable-header:hover {
    background-color: #e9ecef !important;
}

.sortable-header.active {
    background-color: #007bff !important;
    color: white !important;
}

.sort-icon {
    margin-left: 5px;
    font-size: 0.8em;
    opacity: 0.6;
}

.sortable-header:hover .sort-icon {
    opacity: 1;
}

.sortable-header.active .sort-icon {
    opacity: 1;
    color: white;
}

/* 정렬 방향 아이콘 */
.sort-asc .sort-icon::before {
    content: "\F12C"; /* bi-arrow-up */
}

.sort-desc .sort-icon::before {
    content: "\F12F"; /* bi-arrow-down */
}

.sort-default .sort-icon::before {
    content: "\F12E"; /* bi-arrow-down-up */
}

/* modal-specialfull 클래스 - width 1800px로 확장 */
.modal-specialfull {
    width: 1700px !important;
    max-width: 1700px !important;
    margin: 1.75rem auto;
}

.modal-specialfull .modal-content {
    width: 100%;
    height: auto;
    min-height: 80vh;
    border: 0;
    border-radius: 0.5rem;
    box-shadow: 0 0.5rem 1rem rgba(0, 0, 0, 0.15);
}

.modal-specialfull .modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

.modal-specialfull .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
}

.modal-specialfull .modal-footer {
    border-top: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
}

/* 반응형 처리 */
@media (max-width: 1920px) {
    .modal-specialfull {
        width: 80% !important;
        max-width: 80% !important;
    }
}

@media (max-width: 1400px) {
    .modal-specialfull {
        width: 98% !important;
        max-width: 98% !important;
    }
}

/* modal-full 클래스 - 화면에 꽉 차게 */
.modal-full {
    width: 100% !important;
    max-width: 100% !important;
    height: 100% !important;
    margin: 0 !important;
    padding: 0 !important;
}

.modal-full .modal-content {
    width: 100% !important;
    height: 100vh !important;
    min-height: 100vh !important;
    border: 0 !important;
    border-radius: 0 !important;
    box-shadow: none !important;
    margin: 0 !important;
    display: flex;
    flex-direction: column;
}

.modal-full .modal-header {
    border-bottom: 1px solid #dee2e6;
    padding: 1rem 1.5rem;
    background-color: #28a745; /* 녹색 배경 */
    color: white; /* 텍스트 색상을 흰색으로 */
}

.modal-full .modal-body {
    padding: 1.5rem;
    overflow-y: auto;
    flex: 1;
    height: calc(100vh - 200px); /* 헤더와 푸터 높이를 더 정확하게 계산 */
    max-height: calc(100vh - 200px); /* 최대 높이 제한 */
    margin-bottom: 0; /* 하부 여백 제거 */
}

.modal-full .modal-footer {
    border-top: 2px solid #dee2e6;
    padding: 1.5rem 2rem;
    background-color: #ffffff;
    position: relative;
    z-index: 1000;
    min-height: 80px; /* 최소 높이 증가 */
    display: flex;
    align-items: center;
    justify-content: flex-end;
    gap: 15px;
    box-shadow: 0 -2px 10px rgba(0,0,0,0.1); /* 상단 그림자 추가 */
    flex-shrink: 0; /* 푸터가 축소되지 않도록 */
}

/* 모달 푸터 버튼 스타일 강화 */
.modal-full .modal-footer .btn {
    font-size: 1rem;
    font-weight: 600;
    padding: 0.75rem 1.5rem;
    border-radius: 6px;
    box-shadow: 0 2px 4px rgba(0,0,0,0.1);
    transition: all 0.3s ease;
    min-width: 120px;
}

.modal-full .modal-footer .btn:hover {
    transform: translateY(-2px);
    box-shadow: 0 4px 8px rgba(0,0,0,0.2);
}

.modal-full .modal-footer .btn-secondary {
    background-color: #6c757d;
    border-color: #6c757d;
    color: white;
}

.modal-full .modal-footer .btn-success {
    background-color: #28a745;
    border-color: #28a745;
    color: white;
}

/* 모달 푸터 전체를 더 눈에 띄게 만들기 */
.modal-full .modal-footer {
    background: linear-gradient(135deg, #f8f9fa 0%, #e9ecef 100%);
    border-top: 3px solid #28a745;
}

/* 버튼에 더 강한 대비 추가 */
.modal-full .modal-footer .btn {
    text-shadow: 0 1px 2px rgba(0,0,0,0.3);
    letter-spacing: 0.5px;
}

/* 선택 적용 버튼 특별 스타일 */
.modal-full .modal-footer #applyBendingSelectionBtn {
    background: linear-gradient(135deg, #28a745 0%, #20c997 100%);
    border: none;
    font-weight: 700;
    text-transform: uppercase;
    letter-spacing: 1px;
}

/* 모달 배경도 전체 화면으로 */
.modal-full {
    position: fixed !important;
    top: 0 !important;
    left: 0 !important;
    right: 0 !important;
    bottom: 0 !important;
}

/* 반응형 처리 - 모든 화면에서 전체 화면 */
@media (max-width: 1920px) {
    .modal-full {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
    }
}

@media (max-width: 1400px) {
    .modal-full {
        width: 100% !important;
        max-width: 100% !important;
        height: 100% !important;
    }
}