/* admin/css/style.css */
* {
  margin: 0;
  padding: 0;
  box-sizing: border-box;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', Roboto, 'Helvetica Neue', Arial, sans-serif;
  background: #f0f2f5;
  color: #333;
}

/* 登录页 */
.login-page {
  min-height: 100vh;
  display: flex;
  align-items: center;
  justify-content: center;
  background: linear-gradient(135deg, #1890ff 0%, #096dd9 100%);
}

.login-box {
  background: #fff;
  padding: 50px;
  border-radius: 12px;
  box-shadow: 0 8px 32px rgba(0,0,0,0.1);
  width: 400px;
}

.login-box h1 {
  text-align: center;
  color: #1890ff;
  margin-bottom: 10px;
}

.login-box .subtitle {
  text-align: center;
  color: #999;
  margin-bottom: 30px;
  font-size: 14px;
}

.form-group {
  margin-bottom: 20px;
}

.form-group label {
  display: block;
  margin-bottom: 8px;
  font-weight: 500;
}

.form-group input,
.form-group select,
.form-group textarea {
  width: 100%;
  padding: 10px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 6px;
  font-size: 14px;
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: #1890ff;
}

.btn-primary {
  background: #1890ff;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn-primary:hover {
  background: #40a9ff;
}

.btn-danger {
  background: #ff4d4f;
  color: #fff;
  border: none;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

.btn-secondary {
  background: #fff;
  color: #1890ff;
  border: 1px solid #1890ff;
  padding: 10px 20px;
  border-radius: 6px;
  cursor: pointer;
  font-size: 14px;
}

/* 主界面 */
.main-page {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  background: #001529;
  color: #fff;
  display: flex;
  flex-direction: column;
}

.logo {
  padding: 20px;
  font-size: 20px;
  font-weight: bold;
  text-align: center;
  border-bottom: 1px solid #1f3a5f;
}

.menu {
  flex: 1;
  padding: 10px 0;
}

.menu-item {
  padding: 14px 20px;
  cursor: pointer;
  transition: background 0.2s;
  font-size: 14px;
}

.menu-item:hover {
  background: #1890ff;
}

.menu-item.active {
  background: #1890ff;
}

.menu-item span {
  margin-right: 10px;
}

.user-info {
  padding: 15px 20px;
  border-top: 1px solid #1f3a5f;
  font-size: 13px;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

.user-info a {
  color: #1890ff;
  text-decoration: none;
}

.content {
  flex: 1;
  padding: 20px;
  overflow-y: auto;
}

.page {
  display: none;
}

.page.active {
  display: block;
}

.page h2 {
  margin-bottom: 10px;
  font-size: 18px;
  color: #262626;
  font-weight: 600;
  padding-bottom: 8px;
  border-bottom: 1px solid #f0f0f0;
}

/* 统计卡片 - 紧凑合理布局 */
.stats-grid {
  display: grid !important;
  grid-template-columns: repeat(4, 1fr) !important;
  gap: 6px !important;
  margin-bottom: 6px !important;
}

.stats-grid-6 {
  display: grid !important;
  grid-template-columns: repeat(6, 1fr) !important;
  gap: 6px !important;
  margin-bottom: 6px !important;
}

.stat-card {
  background: #fff;
  padding: 6px 10px !important;
  border-radius: 5px !important;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04) !important;
  display: flex !important;
  align-items: center !important;
  gap: 6px !important;
  min-height: 38px !important;
}

.stat-card .stat-icon-wrap {
  width: 26px !important;
  height: 26px !important;
  border-radius: 4px !important;
  display: flex !important;
  align-items: center !important;
  justify-content: center !important;
  font-size: 13px !important;
  flex-shrink: 0 !important;
}

.stat-card .stat-info {
  flex: 1 !important;
  min-width: 0 !important;
}

.stat-card .stat-num {
  font-size: 16px !important;
  font-weight: 700 !important;
  line-height: 1.1 !important;
}

.stat-card .stat-label {
  color: #8c8c8c !important;
  font-size: 10px !important;
  white-space: nowrap !important;
  overflow: hidden !important;
  text-overflow: ellipsis !important;
}

/* 统计区域分组标题 */
.stats-group-title {
  font-size: 11px !important;
  color: #8c8c8c !important;
  margin-bottom: 3px !important;
  margin-top: 4px !important;
  padding-left: 2px !important;
  font-weight: 600 !important;
}

/* 卡片颜色主题 */
.stat-card.blue .stat-icon-wrap { background: linear-gradient(135deg, #e6f7ff, #bae7ff); }
.stat-card.blue .stat-num { color: #1890ff; }
.stat-card.green .stat-icon-wrap { background: linear-gradient(135deg, #f6ffed, #d9f7be); }
.stat-card.green .stat-num { color: #52c41a; }
.stat-card.orange .stat-icon-wrap { background: linear-gradient(135deg, #fff7e6, #ffe7ba); }
.stat-card.orange .stat-num { color: #fa8c16; }
.stat-card.red .stat-icon-wrap { background: linear-gradient(135deg, #fff1f0, #ffccc7); }
.stat-card.red .stat-num { color: #f5222d; }
.stat-card.purple .stat-icon-wrap { background: linear-gradient(135deg, #f9f0ff, #efdbff); }
.stat-card.purple .stat-num { color: #722ed1; }
.stat-card.cyan .stat-icon-wrap { background: linear-gradient(135deg, #e6fffb, #b5f5ec); }
.stat-card.cyan .stat-num { color: #13c2c2; }

/* 返修口按检测比例统计 */
.repair-ratio-section {
  background: #fff;
  padding: 8px 12px;
  border-radius: 5px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  margin-bottom: 6px;
}
.repair-ratio-section .section-title {
  font-size: 12px;
  font-weight: 600;
  color: #262626;
  margin-bottom: 6px;
}
.repair-ratio-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 6px;
}
.repair-ratio-item {
  text-align: center;
  padding: 6px;
  background: linear-gradient(135deg, #fff1f0, #fff7f7);
  border-radius: 5px;
  border: 1px solid #ffccc7;
}
.repair-ratio-num {
  font-size: 18px;
  font-weight: 700;
  color: #f5222d;
}
.repair-ratio-label {
  font-size: 10px;
  color: #595959;
  margin-top: 1px;
}

/* 整体进度可视化 */
.progress-section {
  background: #fff;
  padding: 8px 12px;
  border-radius: 5px;
  box-shadow: 0 1px 2px rgba(0,0,0,0.04);
  margin-bottom: 6px;
  display: grid;
  grid-template-columns: 1fr 1fr;
  gap: 12px;
}
.progress-item .progress-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 4px;
}
.progress-item .progress-title {
  font-size: 12px;
  font-weight: 600;
  color: #333;
}
.progress-item .progress-value {
  font-size: 11px;
  color: #666;
}
.progress-bar {
  height: 10px;
  background: #f0f0f0;
  border-radius: 5px;
  overflow: hidden;
}
.progress-fill {
  height: 100%;
  border-radius: 8px;
  transition: width 0.5s ease;
}
.progress-fill.green {
  background: linear-gradient(90deg, #52c41a, #73d13d);
}
.progress-fill.blue {
  background: linear-gradient(90deg, #1890ff, #40a9ff);
}

.chart-section {
  background: #fff;
  padding: 20px;
  border-radius: 10px;
  box-shadow: 0 2px 8px rgba(0,0,0,0.06);
  margin-bottom: 16px;
}

.chart-section h3 {
  margin-bottom: 15px;
  font-size: 16px;
  color: #262626;
}

/* 筛选栏 */
.filter-bar {
  background: #fff;
  padding: 15px;
  border-radius: 8px;
  margin-bottom: 15px;
  display: flex;
  gap: 10px;
  align-items: center;
  flex-wrap: wrap;
}

.filter-bar input,
.filter-bar select {
  padding: 8px 12px;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  font-size: 14px;
}

/* 数据表格 */
.data-table {
  width: 100%;
  background: #fff;
  border-collapse: collapse;
  border-radius: 8px;
  overflow: visible;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.data-table th {
  background: #fafafa;
  padding: 12px;
  text-align: left;
  font-weight: 600;
  border-bottom: 2px solid #f0f0f0;
  font-size: 14px;
  position: sticky;
  top: 0;
  z-index: 10;
}

/* 表格滚动容器：确保表头sticky生效 */
.table-scroll-container {
  overflow-x: auto;
  overflow-y: auto;
  max-height: 500px;
  border: 1px solid #e8e8e8;
  border-radius: 4px;
}

.table-scroll-container .data-table {
  margin: 0;
}

.table-scroll-container .data-table th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fafafa;
}

.data-table td {
  padding: 14px 12px;
  border-bottom: 1px solid #f0f0f0;
  font-size: 14px;
  word-wrap: break-word;
  word-break: break-all;
  white-space: normal;
  line-height: 1.5;
  vertical-align: middle;
}

.data-table th {
  padding: 14px 12px;
  font-size: 13px;
  font-weight: 600;
  line-height: 1.4;
}

.data-table tr:hover {
  background: #fafafa;
}

.tag {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 4px;
  font-size: 12px;
}

.tag-success {
  background: #f6ffed;
  color: #52c41a;
  border: 1px solid #b7eb8f;
}

.tag-warning {
  background: #fffbe6;
  color: #faad14;
  border: 1px solid #ffe58f;
}

.tag-error {
  background: #fff2f0;
  color: #ff4d4f;
  border: 1px solid #ffccc7;
}

/* 分页 */
.pagination {
  margin-top: 15px;
  text-align: center;
}

.pagination button {
  margin: 0 5px;
  padding: 6px 12px;
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 4px;
  cursor: pointer;
}

.pagination button.active {
  background: #1890ff;
  color: #fff;
  border-color: #1890ff;
}

/* 到期警告 */
.expire-warning {
  background: #fffbe6;
  border: 1px solid #ffe58f;
  padding: 12px;
  border-radius: 6px;
  margin-bottom: 15px;
  color: #faad14;
  font-size: 14px;
}

/* 照片网格 */
.photo-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(200px, 1fr));
  gap: 15px;
}

.photo-item {
  background: #fff;
  border-radius: 8px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0,0,0,0.05);
}

.photo-item img {
  width: 100%;
  height: 150px;
  object-fit: cover;
}

.photo-item .photo-info {
  padding: 10px;
  font-size: 12px;
  color: #666;
}

/* 导出表单 */
.export-form {
  background: #fff;
  padding: 30px;
  border-radius: 8px;
  max-width: 500px;
}

/* 设置 */
.settings-section {
  background: #fff;
  padding: 25px;
  border-radius: 8px;
  margin-bottom: 20px;
}

.settings-section h3 {
  margin-bottom: 20px;
}

/* 弹窗 */
.modal {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: rgba(0,0,0,0.5);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 1000;
}

.modal-content {
  background: #fff;
  border-radius: 8px;
  width: 500px;
  max-height: 80vh;
  overflow-y: auto;
}

.modal-header {
  padding: 15px 20px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  font-weight: 600;
}

.modal-header .close {
  cursor: pointer;
  font-size: 20px;
  color: #999;
}

.modal-body {
  padding: 20px;
}

/* 基础数据库冻结首行和首列 */
#line-master-table {
  overflow: visible;
}
#line-master-table thead th {
  position: sticky;
  top: 0;
  z-index: 10;
  background: #fafafa;
  border-bottom: 2px solid #f0f0f0;
}
#line-master-table td:first-child {
  position: sticky;
  left: 0;
  z-index: 5;
  background: #fff;
  border-right: 1px solid #f0f0f0;
}
#line-master-table thead th:first-child {
  position: sticky;
  left: 0;
  top: 0;
  z-index: 15;
  background: #fafafa;
}

/* 列宽拖拽 */
#line-master-table th {
  position: relative;
  user-select: none;
}
.col-resizer {
  position: absolute;
  top: 0;
  right: 0;
  width: 5px;
  height: 100%;
  cursor: col-resize;
  background: transparent;
}
.col-resizer:hover {
  background: #1890ff;
}

/* ========== 响应式适配（手机/平板） ========== */
@media (max-width: 768px) {
  .main-page {
    flex-direction: column;
  }
  
  .sidebar {
    width: 100% !important;
    height: auto !important;
    position: relative !important;
    padding: 10px !important;
  }
  
  .sidebar .logo {
    text-align: center;
    padding: 10px 0;
    font-size: 18px;
  }
  
  .sidebar .menu {
    display: flex;
    flex-wrap: wrap;
    gap: 5px;
    padding: 5px 0;
  }
  
  .sidebar .menu-item {
    padding: 8px 12px !important;
    font-size: 13px;
    border-radius: 4px;
    flex: 0 0 auto;
  }
  
  .sidebar .user-info {
    display: none;
  }
  
  .content {
    padding: 10px !important;
  }
  
  .content h2 {
    font-size: 18px !important;
  }
  
  /* 统计卡片：手机上2列 */
  .stats-grid {
    grid-template-columns: repeat(2, 1fr) !important;
    gap: 8px !important;
  }
  
  .stat-card {
    padding: 10px 12px !important;
  }
  
  .stat-num {
    font-size: 20px !important;
  }
  
  .stat-label {
    font-size: 11px !important;
  }
  
  /* 图表：手机上1列 */
  #page-dashboard > div[style*="grid-template-columns:1fr 1fr"] {
    grid-template-columns: 1fr !important;
  }
  
  /* 筛选栏：手机上换行 */
  .filter-bar {
    flex-wrap: wrap;
    gap: 5px;
  }
  
  .filter-bar select,
  .filter-bar input,
  .filter-bar button {
    font-size: 12px;
    padding: 5px 8px;
  }
  
  /* 表格：手机上横向滚动 */
  .data-table {
    font-size: 12px;
  }
  
  .data-table th,
  .data-table td {
    padding: 6px 8px;
    white-space: nowrap;
  }
  
  /* 按钮组：手机上更小 */
  .btn-primary, .btn-secondary {
    font-size: 12px;
    padding: 6px 10px;
  }
  
  /* 分页：手机上调整 */
  .pagination button {
    padding: 4px 8px;
    font-size: 12px;
  }
}

@media (max-width: 480px) {
  /* 超小屏幕：统计卡片1列 */
  .stats-grid {
    grid-template-columns: 1fr !important;
  }
}

/* ========== WPS风格表格 ========== */
.wps-table {
  border-collapse: collapse;
  border-radius: 0;
  box-shadow: none;
  font-size: 13px;
}

.wps-table th {
  background: #f5f5f5;
  padding: 6px 8px;
  border: 1px solid #d4d4d4;
  font-weight: normal;
  font-size: 13px;
  text-align: center;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

.wps-table td {
  padding: 0;
  border: 1px solid #d4d4d4;
  font-size: 13px;
  height: 28px;
  vertical-align: middle;
}

.wps-table tr:hover {
  background: #fff;
}

.wps-table td.row-num {
  background: #f5f5f5;
  text-align: center;
  color: #666;
  font-size: 12px;
  width: 50px;
  min-width: 50px;
  position: sticky;
  left: 0;
  z-index: 5;
  cursor: pointer;
  border: 1px solid #d4d4d4;
}

.wps-table td.row-num:hover {
  background: #e8e8e8;
}

.wps-table td.row-num.selected {
  background: #d6e4ff;
  color: #1890ff;
}

.wps-table input.cell-input {
  width: 100%;
  min-width: 80px;
  border: none;
  padding: 5px 6px;
  font-size: 13px;
  color: #000;
  background: transparent;
  outline: none;
  height: 28px;
  box-sizing: border-box;
}

.wps-table input.cell-input:focus {
  background: #fff;
  outline: 2px solid #1890ff;
  outline-offset: -2px;
}

.wps-table textarea.cell-textarea {
  width: 100%;
  min-width: 80px;
  border: none;
  padding: 5px 6px;
  font-size: 13px;
  color: #000;
  background: transparent;
  outline: none;
  min-height: 28px;
  box-sizing: border-box;
  resize: none;
  overflow: hidden;
  line-height: 1.4;
  font-family: inherit;
  vertical-align: middle;
}

.wps-table textarea.cell-textarea:focus {
  background: #fff;
  outline: 2px solid #1890ff;
  outline-offset: -2px;
}

/* 行高拖拽区域 */
.wps-table .row-resizer {
  position: absolute;
  bottom: 0;
  left: 0;
  right: 0;
  height: 4px;
  cursor: row-resize;
  background: transparent;
}

.wps-table .row-resizer:hover {
  background: #1890ff;
}

.wps-table td.cell-selected {
  background: #e6f4ff;
}

.wps-table tr.row-selected td {
  background: #e6f4ff;
}

.wps-table tr.row-selected td.row-num {
  background: #d6e4ff;
  color: #1890ff;
}

/* WPS风格：单元格hover效果 */
.wps-table td:hover {
  background: #f0f7ff;
}

.wps-table input.cell-input:hover {
  background: #f0f7ff;
}

/* WPS风格：表格边框优化 */
.wps-table {
  border-collapse: collapse;
}

.wps-table td {
  border: 1px solid #e8e8e8;
  padding: 0;
}

.wps-table th {
  border: 1px solid #d9d9d9;
  background: #fafafa;
  position: sticky;
  top: 0;
  z-index: 1;
}

/* WPS风格：行号列 */
.wps-table td.row-num {
  background: #fafafa;
  text-align: center;
  color: #666;
  font-size: 12px;
  border-right: 2px solid #d9d9d9;
  user-select: none;
}

.wps-table td.row-num:hover {
  background: #e6f4ff;
  color: #1890ff;
  cursor: pointer;
}

.wps-table td.row-num.selected {
  background: #1890ff;
  color: #fff;
}

/* ========== WPS风格筛选下拉框 ========== */
.filter-dropdown {
  position: absolute;
  background: #fff;
  border: 1px solid #d9d9d9;
  border-radius: 4px;
  box-shadow: 0 4px 12px rgba(0,0,0,0.15);
  z-index: 1000;
  min-width: 220px;
  max-width: 300px;
  font-size: 13px;
}

.filter-dropdown-header {
  padding: 8px 12px;
  border-bottom: 1px solid #f0f0f0;
  display: flex;
  gap: 8px;
}

.filter-dropdown-search {
  flex: 1;
  padding: 5px 8px;
  border: 1px solid #d9d9d9;
  border-radius: 2px;
  font-size: 12px;
  outline: none;
}

.filter-dropdown-search:focus {
  border-color: #1890ff;
}

.filter-dropdown-body {
  max-height: 280px;
  overflow-y: auto;
  padding: 4px 0;
}

.filter-dropdown-item {
  padding: 5px 12px;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
}

.filter-dropdown-item:hover {
  background: #f5f5f5;
}

.filter-dropdown-item input[type="checkbox"] {
  cursor: pointer;
}

.filter-dropdown-item .count {
  margin-left: auto;
  color: #999;
  font-size: 11px;
}

.filter-dropdown-item .filter-only-btn {
  display: inline-block;
  padding: 1px 6px;
  font-size: 10px;
  color: #1890ff;
  border: 1px solid #1890ff;
  border-radius: 3px;
  cursor: pointer;
  margin-left: 4px;
  user-select: none;
}
.filter-dropdown-item .filter-only-btn:hover {
  background: #1890ff;
  color: #fff;
}

.filter-dropdown-footer {
  padding: 8px 12px;
  border-top: 1px solid #f0f0f0;
  display: flex;
  justify-content: space-between;
  align-items: center;
  gap: 8px;
}

.filter-dropdown-footer .left-btns {
  display: flex;
  gap: 8px;
}

.filter-dropdown-footer button {
  padding: 4px 12px;
  border: 1px solid #d9d9d9;
  background: #fff;
  border-radius: 2px;
  cursor: pointer;
  font-size: 12px;
}

.filter-dropdown-footer button:hover {
  border-color: #1890ff;
  color: #1890ff;
}

.filter-dropdown-footer button.primary {
  background: #1890ff;
  color: #fff;
  border-color: #1890ff;
}

.filter-dropdown-footer button.primary:hover {
  background: #40a9ff;
  color: #fff;
}

/* 表头筛选图标 */
.th-filter-icon {
  display: inline-block;
  margin-left: 4px;
  cursor: pointer;
  opacity: 0.6;
  font-size: 11px;
}

.th-filter-icon:hover,
.th-filter-icon.active {
  opacity: 1;
  color: #1890ff;
}

.th-filter-icon.active {
  color: #1890ff;
}

/* 统计卡片优化 */
.stat-card {
  background: #fff;
  padding: 6px 10px;
  border-radius: 6px;
  box-shadow: 0 1px 3px rgba(0,0,0,0.06);
  display: flex;
  align-items: center;
  gap: 8px;
  min-height: 40px;
  transition: all 0.2s;
}
.stat-card:hover {
  box-shadow: 0 2px 8px rgba(0,0,0,0.1);
  transform: translateY(-1px);
}
.stat-card .stat-icon {
  width: 32px;
  height: 32px;
  border-radius: 6px;
  display: flex;
  align-items: center;
  justify-content: center;
  font-size: 15px;
  flex-shrink: 0;
}
.stat-card .stat-value {
  font-size: 22px;
  font-weight: 700;
  line-height: 1.2;
}
.stat-card .stat-label {
  color: #8c8c8c;
  font-size: 12px;
  margin-top: 2px;
}

/* 百分比卡片底色 */
.rate-excellent { background: linear-gradient(135deg, #f6ffed, #d9f7be) !important; }
.rate-good { background: linear-gradient(135deg, #e6f7ff, #bae7ff) !important; }
.rate-warning { background: linear-gradient(135deg, #fffbe6, #ffe58f) !important; }
.rate-danger { background: linear-gradient(135deg, #fff1f0, #ffa39e) !important; }

/* 超级管理员入口按钮 */
.super-admin-entry {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 99999;
  background: linear-gradient(135deg, #722ed1, #531dab);
  color: #fff;
  border: none;
  padding: 12px 20px;
  border-radius: 24px;
  font-size: 14px;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 16px rgba(114,46,209,0.4);
  transition: all 0.2s;
}
.super-admin-entry:hover {
  transform: translateY(-2px);
  box-shadow: 0 6px 16px rgba(114,46,209,0.4);
}
