/* ============================================
   1. 基础重置与变量
   ============================================ */
:root {
  --table-border-color: #e8ecf1;
  --table-header-bg: #e7e7e7;
  --table-header-color: #555555;
  --table-row-hover-bg: #00bcd4;
  --table-row-hover-color: #ffffff;
  --table-stripe-bg: #f5f5f5;
  --table-shadow: 0 0 20px rgba(0, 0, 0, 0.1);
  --scrollbar-thumb: #c1c7cd;
  --scrollbar-track: #f1f1f1;
  --border-radius: 3px;
  --img-size: 35px;
  --first-col-width: 40px;    /* 第一列（序号）宽度 */
  --last-col-width: 110px;    /* 最后一列（操作）宽度 */
  --col-gap: 8px;
}

/* ============================================
   2. 表格容器
   ============================================ */
.table-container {
  max-width: 100%;
  margin: 10px 0;
}

/* ============================================
   3. 滚动容器
   ============================================ */
.table-scroll-wrapper {
  max-height: calc(100vh - 240px);
  max-width: 100%;
  overflow: auto;
  border: 1px solid var(--table-border-color);
  border-radius: var(--border-radius);
  /* Firefox 滚动条 */
  scrollbar-width: thin;
  scrollbar-color: var(--scrollbar-thumb) var(--scrollbar-track);
}
table{
  /*border: 1px solid #d1d5db;*/
  opacity: 1;
  border-width: 1px;
  border-collapse: collapse;
  width: 100%;
  text-indent: 0;
  border-color: inherit;
}
table::after, ::before {
  box-sizing: border-box;
  border-width: 0;
  border-style: solid;
  border-color: #f3f4f6;
}
th {
  /*border: 1px solid #d1d5db;*/
  background-color: #f3f4f6;
  padding: 10px 1px;
}
td{
  /*border: 1px solid #d1d5db;*/
}
.Tablethead th{
  border: 1px solid #d1d5db;
}
.Tabletbody input{
  width: 100%;
  box-sizing: border-box;
  padding: 5px;
  border: 0px solid #a9a9a9;
  border-radius: 2px;
  box-sizing: border-box;
  margin: 0px;
}
.Tabletbody input:focus{
  border-color: #2196f3;
  outline: none;
  box-shadow: 0 0 0 .15rem transparent;
}
.Tabletbody td {
  padding: 10px 1px;
  border: 1px solid #d1d5db;
  background-color: #FFFFFF;
}
.Tabletfoot td {
  border: 1px solid #d1d5db;
  background-color: #ffffff;
  /*padding: 10px 1px;*/
  font-weight: 700;
}
.Tabletfoot td{
  padding: 5px 1px;
}
/* ============================================
   4. 表格核心样式
   ============================================ */
.table-responsive {
  width: 100%;
  /*min-width: 1000px;*/
  border-collapse: collapse;
  white-space: nowrap;
  box-shadow: var(--table-shadow);
  border-radius: 0 0 var(--border-radius) var(--border-radius);
  table-layout: auto;
}

/* ----- 4.1 表头 ----- */
.table-responsive thead {
  position: sticky;
  top: 0;
  z-index: 10;
}

.table-responsive thead tr {
  background-color: var(--table-header-bg);
  color: var(--table-header-color);
  text-align: center;
}

.table-responsive thead th {
  padding: 10px 5px;
  font-weight: 600;
  letter-spacing: 0.5px;
  background-color: var(--table-header-bg);
  position: sticky;
  top: 0;
  z-index: 10;
}

/* ----- 4.2 表体 ----- */
.table-responsive tbody tr {
  cursor: pointer;
  background-color: #ffffff;
  border-bottom: 1px solid #dddddd;
  transition: background-color 0.2s ease, color 0.2s ease;
}

.table-responsive tbody tr:nth-child(even) {
  background-color: var(--table-stripe-bg);
}

.table-responsive tbody tr:last-child {
  border-bottom-color: #d1d5db;
}

.table-responsive tbody tr:hover {
  border-bottom: 1px solid red;
  background-color: var(--table-row-hover-bg);
  color: var(--table-row-hover-color);
}

/* ----- 4.3 单元格 ----- */
.table-responsive td {
  padding: 5px;
  text-align: center;
  vertical-align: middle;
}

/* 第一列（序号列）- 固定宽度 */
.table-responsive td:first-child,
.table-responsive th:first-child {
  width: var(--first-col-width);
  min-width: var(--first-col-width);
  max-width: var(--first-col-width);
  /*font-weight: 300;*/
}

/* 最后一列（操作列）- 固定宽度 */
.table-responsive td:last-child,
.table-responsive th:last-child {
  width: var(--last-col-width);
  min-width: var(--last-col-width);
  max-width: var(--last-col-width);
}

/* 中间所有列 - 自适应宽度 */
.table-responsive td:not(:first-child):not(:last-child),
.table-responsive th:not(:first-child):not(:last-child) {
  width: auto;
  min-width: 60px;  /* 设置最小宽度，保证可读性 */
  max-width: 300px; /* 设置最大宽度，防止过宽 */
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 图片单元格 */
.table-responsive td.img-cell {
  text-align: center;
  vertical-align: middle;
  height: 50px;
}

.table-responsive td img {
  display: inline-block;
  vertical-align: middle;
  width: var(--img-size);
  height: var(--img-size);
  object-fit: cover;
}

/* 文本对齐辅助类 */
.table-responsive td.text-left {
  text-align: left;
}

.table-responsive td.text-right {
  text-align: right;
}

/* ============================================
   5. 辅助类
   ============================================ */
.row-danger  td { color: red; }
.row-warning td { color: orange; }
.row-success td { color: green; }
.row-muted   td { color: gray; }

.table-serial {
  text-align: center;
}
#dataTable button {
  padding: 5px 10px;
  margin: 0 2px;
  border: none;
  border-radius: 4px;
  cursor: pointer;
  transition: all 0.2s ease;
}
/* ============================================
   6. 表尾
   ============================================ */
.table-footer {
  margin-top: 20px;
  text-align: center;
  color: #666666;
}

/* ============================================
   7. 自定义滚动条（WebKit）
   ============================================ */
.table-scroll-wrapper::-webkit-scrollbar {
  width: 10px;
  height: 10px;
}

.table-scroll-wrapper::-webkit-scrollbar-track {
  background: var(--scrollbar-track);
  border-radius: 4px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb {
  background: var(--scrollbar-thumb);
  border-radius: 4px;
}

.table-scroll-wrapper::-webkit-scrollbar-thumb:hover {
  background: #a0a7ae;
}
/* ============================================
   8. 分页样式
   ============================================ */
.pagination {
  margin-top: 15px;
  text-align: center;
  font-size: 14px;
}
.pagination a, .pagination span {
  display: inline-block;
  padding: 5px 10px;
  margin: 0 2px;
  border: 1px solid #ddd;
  border-radius: 3px;
  text-decoration: none;
  color: #333;
  background-color: #fff;
  cursor: pointer;
}
.pagination a:hover {
  background-color: #2196f3;
  color: white;
  border-color: #2196f3;
}
.pagination .active {
  background-color: #2196f3;
  color: white;
  border-color: #2196f3;
}
.pagination .disabled {
  color: #ccc;
  cursor: not-allowed;
}
.page-jump {
  margin-left: 10px;
}
.page-jump input {
  width: 50px;
  padding: 3px;
  text-align: center;
  margin-right: 5px;
  border: 1px solid #ddd;
  margin-left:5px;
  border-radius: 3px;
}
.page-jump input:focus{
  border-color: #2196f3;
  outline: none;
  color: #404040;
  border-radius: 3px;
  box-shadow: 0 0 0 0.15rem transparent;
}
.page-jump input:disabled{
  color: #ccc;
}
.page-size {
  width: 60px;
  margin: 0px 5px;
  padding: 2px;
}

/* ============================================
   9. 响应式设计
   ============================================ */
@media (max-width: 768px) {
  .table-scroll-wrapper {
    max-height: 400px;
  }
  
/*  .table-responsive {
    min-width: 800px;
    font-size: 14px;
  }*/
  
  .table-responsive td,
  .table-responsive th {
    padding: 8px 6px;
  }
  
  /* 小屏幕调整固定列宽度 */
  .table-responsive td:first-child,
  .table-responsive th:first-child {
    width: 50px;
    min-width: 50px;
    max-width: 50px;
  }
  
  .table-responsive td:last-child,
  .table-responsive th:last-child {
    width: 120px;
    min-width: 120px;
    max-width: 120px;
  }
  
  /* 中间列在小屏幕减小最小宽度 */
  .table-responsive td:not(:first-child):not(:last-child),
  .table-responsive th:not(:first-child):not(:last-child) {
    min-width: 60px;
    max-width: 200px;
  }
}

@media (max-width: 500px) {
  .table-scroll-wrapper {
    max-height: 350px;
  }  
  .table-responsive td,
  .table-responsive th {
    padding: 6px 4px;
  }
  
  .table-responsive td.img-cell {
    height: 40px;
  }
  
  .table-responsive td img {
    width: 25px;
    height: 25px;
  }
  
  /* 手机屏幕进一步缩小固定列 */
  .table-responsive td:first-child,
  .table-responsive th:first-child {
    width: 40px;
    min-width: 40px;
    max-width: 40px;
  }
  
  .table-responsive td:last-child,
  .table-responsive th:last-child {
    width: 100px;
    min-width: 100px;
    max-width: 100px;
  }
  
  /* 中间列在手机屏幕继续调整 */
  .table-responsive td:not(:first-child):not(:last-child),
  .table-responsive th:not(:first-child):not(:last-child) {
    min-width: 50px;
    max-width: 150px;
  }
}