html {
  height: 100%;
  width: 100%;
}
body {
  background: linear-gradient(120deg, #f5f7fa 0%, #e8edff 100%);
  font-family: 'Prompt', sans-serif;
  min-height: 100vh;
}
/* สไตล์สำหรับกลุ่มการปฏิบัติ */
.action-group {
  display: flex;
  align-items: center;
  margin-bottom: 4px;
}
.action-link {
  display: inline-block;
  padding: 4px 8px;
  border-radius: 6px;
  background: #f8f9fa;
  border-left: 3px solid #1a73e8;
  font-size: 0.9em;
  font-weight: 500;
  transition: all 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  max-width: 100%;
}
.action-link:hover {
  background: #e9ecef;
  transform: translateX(2px);
}
.action-link.text-success {
  border-left-color: #28a745;
  background: #d4edda;
}
.action-link.text-success:hover {
  background: #c3e6cb;
}
/* ไอคอน NEW แบบกระพริบ */
.blink-new {
  animation: blink 1.5s infinite;
  font-size: 0.75em;
  font-weight: bold;
}
@keyframes blink {
  0%, 50% { opacity: 1; }
  51%, 100% { opacity: 0.3; }
}
/* Fixed table layout */
.table-fixed {
  table-layout: fixed;
  width: 100%;
}
/* Column widths for balance */
.table-fixed th:nth-child(1), /* ลำดับ */
.table-fixed td:nth-child(1) {
  width: 6%;
}
.table-fixed th:nth-child(2), /* เลขทะเบียนรับ */
.table-fixed td:nth-child(2) {
  width: 12%;
}
.table-fixed th:nth-child(3), /* ที่หนังสือ */
.table-fixed td:nth-child(3) {
  width: 12%;
}
.table-fixed th:nth-child(4), /* ลงวันที่ */
.table-fixed td:nth-child(4) {
  width: 12%;
}
.table-fixed th:nth-child(5), /* จากหน่วยงาน */
.table-fixed td:nth-child(5) {
  width: 14%;
}
.table-fixed th:nth-child(6), /* ถึง */
.table-fixed td:nth-child(6) {
  width: 14%;
}
.table-fixed th:nth-child(7), /* เรื่อง */
.table-fixed td:nth-child(7) {
  width: 22%; /* เพิ่มจาก 17% เป็น 22% */
  text-align: left !important;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}
.table-fixed th:nth-child(8), /* การปฏิบัติ */
.table-fixed td:nth-child(8) {
  width: 17%;
  overflow: hidden;
  text-overflow: ellipsis;
}
.table-fixed th:nth-child(9), /* ไฟล์แนบ */
.table-fixed td:nth-child(9) {
  width: 10%;
}
.table-fixed th:nth-child(10), /* จัดจัดการ */
.table-fixed td:nth-child(10) {
  width: 12%;
}
/* Override existing การปฏิบัติ column styling */
.table td:nth-child(8) {
  white-space: normal;
  word-wrap: break-word;
  line-height: 1.4;
  vertical-align: top;
}
/* จัดชื่อคอลัมน์ให้อยู่ตรงกลาง */
.table thead th {
  text-align: center !important;
  vertical-align: middle !important;
}
/* ตารางเฉพาะหน้า */
#dataTable {
  width: 98%; /* เพิ่มจาก 95% เป็น 98% เกือบถึงขอบ */
  margin: 0 auto;
  table-layout: fixed;
}
#dataTable thead th,
#dataTable td {
  border-right: 1px solid #dee2e6; /* เพิ่มเส้นขอบขวาเพื่อให้สีขยายถึงขอบ */
}
#downloadLogTable {
  width: 92%;
  margin: 0 auto;
  table-layout: fixed;
}
#downloadLogTable th {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
  padding: 8px;
}
#downloadLogTable td {
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}
/* กำหนดความกว้างคอลัมน์สำหรับตาราง Download Log */
#downloadLogTable th:nth-child(1), /* เวลาดาวน์โหลด */
#downloadLogTable td:nth-child(1) {
  width: 22%;
}
#downloadLogTable th:nth-child(2), /* เลขทะเบียนรับ */
#downloadLogTable td:nth-child(2) {
  width: 22%;
}
#downloadLogTable th:nth-child(3), /* ที่หนังสือ */
#downloadLogTable td:nth-child(3) {
  width: 22%;
}
#downloadLogTable th:nth-child(4), /* เรื่องที่โหลด */
#downloadLogTable td:nth-child(4) {
  width: 22%;
}
#downloadLogTable th:nth-child(5), /* กลุ่มงาน */
#downloadLogTable td:nth-child(5) {
  width: 17%;
}
#downloadLogTable th:nth-child(6), /* ชื่อผู้ดาวน์โหลด */
#downloadLogTable td:nth-child(6) {
  width: 17%;
}
#documentForm {
  width: 90%;
  margin: 0 auto;
}
/* ปรับสีหัวตารางให้เด่นชัด */
#dataTable thead th,
#downloadLogTable thead th {
  background-color: #003087; /* น้ำเงินเข้ม */
  color: white; /* ข้อความสีขาว */
  font-weight: bold; /* ตัวหนา */
  border-bottom: 2px solid #001f5f; /* เส้นขอบล่างเด่น */
}
/* Responsive improvements */
@media (max-width: 768px) {
  .action-link {
    font-size: 0.8em;
    padding: 2px 6px;
  }
  .table td:nth-child(8) {
    width: 15%;
  }
  #dataTable, #downloadLogTable, #documentForm {
    width: 100%; /* เต็มหน้าจอในมือถือ */
  }
}
/* Alert positioning fix */
.alert.position-fixed {
  top: 20px !important;
  right: 20px !important;
  z-index: 9999 !important;
  min-width: 300px !important;
}
/* Card enhancements */
.card {
  border: none;
  border-radius: 15px;
}
.card-header {
  border-radius: 15px 15px 0 0 !important;
  font-weight: 600;
}
/* Button styling */
.btn {
  border-radius: 8px;
  font-weight: 500;
}
.nav-pills .nav-link {
  border-radius: 10px;
  margin: 0 2px;
  transition: all 0.3s ease;
}
.nav-pills .nav-link.active {
  background: linear-gradient(45deg, #007bff, #0056b3);
  box-shadow: 0 4px 15px rgba(0, 123, 255, 0.3);
}
/* Form styling */
.form-control {
  border-radius: 8px;
  border: 2px solid #e9ecef;
  transition: all 0.3s ease;
}
.form-control:focus {
  border-color: #007bff;
  box-shadow: 0 0 0 0.2rem rgba(0, 123, 255, 0.25);
}
/* Table styling */
.table {
  border-radius: 10px;
  overflow: hidden;
}
.table thead th {
  font-weight: 600;
  text-transform: uppercase;
  font-size: 0.85em;
  letter-spacing: 0.5px;
}
/* Modal styling */
.modal-content {
  border: none;
  border-radius: 15px;
  box-shadow: 0 10px 40px rgba(0, 0, 0, 0.1);
}
.modal-header {
  border-bottom: 2px solid #f8f9fa;
  border-radius: 15px 15px 0 0;
}
/* Action buttons styling */
.action-buttons .btn {
  width: 35px;
  height: 35px;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: 0;
}
/* Loading animation */
.loading {
  opacity: 0.6;
  pointer-events: none;
}
/* Success feedback */
.success-feedback {
  background: linear-gradient(45deg, #28a745, #20c997);
  color: white;
  padding: 10px 15px;
  border-radius: 8px;
  margin: 10px 0;
}
/* File display styling */
#fileDisplay .d-flex {
  transition: all 0.2s ease;
}
#fileDisplay .d-flex:hover {
  background-color: #f8f9fa !important;
  transform: translateY(-1px);
  box-shadow: 0 2px 4px rgba(0,0,0,0.1);
}
#fileDisplay .bi-file-earmark {
  font-size: 1.1em;
}