/* ============================================
   Honeywell Scanner 配置码快速查询页面 - 层级分类展示
   独立样式文件 v1.0
   开发：阿米尔 & 人工智能-哈皮
   ============================================ */

/* == 全局容器 == */
.container {
  max-width: 1300px;
  margin: 0 auto;
  padding: 24px 20px;
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'Roboto', 'Helvetica Neue', Arial, sans-serif;
  background: #f8fafc;
  min-height: 100vh;
}

/* == Loading 覆盖层 == */
.loading-overlay {
  position: fixed;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 9999;
}

.loading-content {
  text-align: center;
  color: white;
  padding: 40px;
}

.loading-content p {
  font-size: 18px;
  margin-top: 16px;
  font-weight: 500;
}

.spinner {
  width: 60px;
  height: 60px;
  border: 5px solid rgba(255, 255, 255, 0.3);
  border-top-color: #ffffff;
  border-radius: 50%;
  animation: spin 1s linear infinite;
  margin: 0 auto 20px;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

/* == 配置面板 == */
.config-panel {
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 32px;
}

/* == 页面头部 == */
.page-header {
  margin-bottom: 32px;
  padding-bottom: 24px;
  border-bottom: none;
}

.page-header h1 {
  font-size: 28px;
  font-weight: 700;
  color: #2d3748;
  margin: 0 0 12px 0;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
  display: flex;
  flex-direction: column;
}

.page-meta {
  font-size: 14px;
  color: #718096;
  font-style: italic;
}

/* == 搜索框容器 == */
.search-wrapper {
  position: relative;
  margin-bottom: 24px;
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  border-radius: 12px;
  padding: 8px;
  box-shadow: 0 2px 12px rgba(102, 126, 234, 0.2);
}

.search-box input {
  width: 100%;
  padding: 14px 50px 14px 20px;
  border: none;
  border-radius: 8px;
  font-size: 15px;
  background: white;
  color: #2d3748;
  transition: all 0.3s ease;
  box-sizing: border-box;
}

.search-box input:focus {
  outline: none;
  box-shadow: 0 0 0 3px rgba(102, 126, 234, 0.3);
}

.search-box input::placeholder {
  color: #a0aec0;
}

/* 清除按钮 */
.search-box .clear-btn {
  position: absolute;
  right: 8px;
  top: 50%;
  transform: translateY(-50%);
  background: rgba(102, 126, 234, 0.15);
  border: none;
  font-size: 20px;
  cursor: pointer;
  color: #667eea;
  padding: 6px 12px;
  border-radius: 6px;
  display: none;
  transition: all 0.2s ease;
  line-height: 1;
  z-index: 5;
  font-weight: 600;
}

.search-box .clear-btn:hover {
  background: rgba(102, 126, 234, 0.25);
  color: #764ba2;
  transform: translateY(-50%) scale(1.1);
}

.search-box.has-search .clear-btn {
  display: block;
}

/* == 分类标签栏 == */
.category-tabs {
  display: flex;
  gap: 6px;
  margin-bottom: 20px;
  overflow-x: auto;
  padding-bottom: 8px;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 transparent;
}

.category-tabs::-webkit-scrollbar {
  height: 6px;
}

.category-tabs::-webkit-scrollbar-track {
  background: transparent;
}

.category-tabs::-webkit-scrollbar-thumb {
  background-color: #cbd5e0;
  border-radius: 3px;
}

.category-tab {
  flex: 0 0 auto;
  padding: 10px 18px;
  cursor: pointer;
  border: none;
  background: #edf2f7;
  color: #4a5568;
  font-size: 14px;
  font-weight: 600;
  border-radius: 8px;
  white-space: nowrap;
  transition: all 0.3s ease;
  border: 1px solid #e2e8f0;
}

.category-tab:hover {
  background: #e2e8f0;
  color: #2d3748;
  transform: translateY(-2px);
  box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1);
}

.category-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
}

/* == 数据表格容器 == */
.data-table-container {
  overflow-x: auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 表格样式 */
#config-table {
  width: 100%;
  border-collapse: separate;
  border-spacing: 0;
  font-size: 14px;
}

#config-table thead th {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  font-weight: 600;
  padding: 16px 14px;
  text-align: left;
  border-bottom: 2px solid #dee2e6;
  white-space: nowrap;
  position: sticky;
  top: 0;
  z-index: 10;
}

#config-table thead th:first-child {
  border-top-left-radius: 12px;
}

#config-table thead th:last-child {
  border-top-right-radius: 12px;
}

#config-table tbody td {
  padding: 12px 14px;
  border-bottom: 1px solid #edf2f7;
  color: #4a5568;
  vertical-align: middle;
  transition: background 0.2s ease;
}

#config-table tbody tr:hover {
  background: #f7fafc;
}

/* 分类列特殊样式 */
td.category-column {
  font-weight: 600;
  color: #2d3748;
  padding-right: 16px;
}

td.category-column .category-cn {
  display: block;
  font-size: 15px;
  color: #667eea;
  margin-bottom: 4px;
  font-weight: 700;
}

td.category-column .category-en {
  display: block;
  font-size: 12px;
  color: #a0aec0;
  font-style: italic;
}

/* 配置码列 */
td.serial-command-column {
  font-family: 'Consolas', 'Monaco', 'Courier New', monospace;
  font-size: 13px;
  color: #2d3748;
  background: #f7fafc;
  padding: 10px 12px;
  border-radius: 6px;
  text-align: center;
  letter-spacing: 1px;
  font-weight: 600;
}

/* 手册页数列 */
td.page-number-column {
  text-align: center;
  color: #667eea;
  font-weight: 600;
  background: #ebf8ff;
  padding: 8px 12px;
  border-radius: 6px;
  font-size: 13px;
}

/* 空状态 */
.empty-state {
  text-align: center;
  padding: 60px 20px;
  color: #a0aec0;
  font-size: 16px;
}

.empty-state .icon {
  font-size: 48px;
  margin-bottom: 16px;
  display: block;
}

/* 响应式适配 */
@media (max-width: 768px) {
  .container {
    padding: 16px 12px;
  }

  .page-header {
    padding-bottom: 16px;
  }

  .page-header h1 {
    font-size: 22px;
  }

  .page-meta {
    font-size: 13px;
  }

  .search-wrapper {
    margin-bottom: 16px;
  }

  .search-box input {
    padding: 12px 40px 12px 14px;
    font-size: 14px;
  }

  .category-tabs {
    gap: 4px;
    padding-bottom: 4px;
  }

  .category-tab {
    padding: 8px 14px;
    font-size: 13px;
  }

  #config-table {
    font-size: 13px;
  }

  #config-table thead th {
    padding: 12px 10px;
  }

  #config-table tbody td {
    padding: 10px 10px;
  }

  .category-column .category-cn {
    font-size: 14px;
  }

  .category-column .category-en {
    font-size: 11px;
  }
}

@media (max-width: 480px) {
  .page-header h1 {
    font-size: 20px;
  }

  .search-box input {
    font-size: 13px;
    padding: 10px 36px 10px 12px;
  }

  .category-tab {
    padding: 6px 10px;
    font-size: 12px;
  }

  #config-table {
    font-size: 12px;
  }

  #config-table thead th,
  #config-table tbody td {
    padding: 8px 6px;
  }

  .serial-command-column {
    font-size: 11px;
    padding: 6px 8px;
  }

  .page-number-column {
    font-size: 12px;
    padding: 6px 8px;
  }
}

/* 纵向分类标签栏（可独立滚动） */
.category-tabs-vertical {
  display: flex;
  flex-direction: column;
  gap: 6px;
  width: 240px;
  min-width: 180px;
  overflow-y: auto;
  scrollbar-width: thin;
  scrollbar-color: #cbd5e0 transparent;
}

.category-tabs-vertical::-webkit-scrollbar {
  width: 6px;
}

.category-tabs-vertical::-webkit-scrollbar-track {
  background: transparent;
}

.category-tabs-vertical::-webkit-scrollbar-thumb {
  background-color: #cbd5e0;
  border-radius: 3px;
}

/* 纵向标签 */
.category-tabs-vertical .category-tab {
  flex: 0 0 auto;
  padding: 10px 14px;
  cursor: pointer;
  border: none;
  background: #edf2f7;
  color: #4a5568;
  font-size: 13px;
  font-weight: 600;
  text-align: left;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  transition: all 0.3s ease;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.category-tabs-vertical .category-tab:hover {
  background: #e2e8f0;
  color: #2d3748;
  transform: translateX(2px);
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.08);
}

.category-tabs-vertical .category-tab.active {
  background: linear-gradient(135deg, #667eea 0%, #764ba2 100%);
  color: white;
  border-color: #667eea;
  box-shadow: 0 4px 12px rgba(102, 126, 234, 0.3);
  transform: translateX(2px);
}

/* 容器布局调整 */
.container {
  display: flex;
  flex-direction: column;
  gap: 20px;
}

.config-panel {
  display: flex;
  flex-direction: row;
  gap: 20px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
  padding: 24px;
}

/* 数据表格容器（右侧区域） */
.data-table-container {
  flex: 1;
  min-width: 0;
  overflow-x: auto;
  background: white;
  border-radius: 12px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
}

/* 搜索框（顶部居中） */
.search-wrapper {
  margin: 0 auto 20px;
  width: fit-content;
  max-width: 400px;
}

/* 响应式适配（移动端改为纵向） */
@media (max-width: 768px) {
  .container {
    flex-direction: column;
    gap: 16px;
  }

  .config-panel {
    flex-direction: column;
    gap: 16px;
  }

  .category-tabs-vertical {
    max-width: none;
    width: 100%;
    position: static;
    overflow-x: auto;
    overflow-y: auto;
  }

  .category-tabs-vertical .category-tab {
    text-align: center;
    white-space: normal;
  }

  .search-wrapper {
    margin: 0 0 16px;
  }
}

/* 左侧分类栏扩展样式 */
.category-tabs-vertical .category-tab .category-cn {
  display: block;
  font-weight: 700;
  line-height: 1.3;
  margin-bottom: 2px;
}

.category-tabs-vertical .category-tab .category-en {
  display: block;
  font-size: 11px;
  color: #a0aec0;
  font-style: italic;
  overflow: hidden;
  text-overflow: ellipsis;
  white-space: nowrap;
}

/* 激活状态高亮 */
.category-tabs-vertical .category-tab.active {
  border-left: 3px solid white;
  padding-left: 11px;
}

/* === 桌面端（>768px）横向布局 === */
@media (min-width: 769px) {
  .container {
    display: flex;
    gap: 20px;
    padding: 24px;
  }

  .config-panel {
    display: flex;
    gap: 24px;
    background: #ffffff;
    border-radius: 16px;
    box-shadow: 0 4px 24px rgba(0, 0, 0, 0.08);
    padding: 24px;
    /* 固定高度，让两侧各自独立滚动 */
    height: calc(100vh - 180px);
    overflow: hidden;
  }

  .category-tabs-vertical {
    flex: 0 0 auto;
    width: 240px;
    max-height: 100%;
    height: 100%;
    padding-right: 8px;
  }

  .data-table-container {
    flex: 1;
    min-width: 0;
    overflow-y: auto;
    overflow-x: auto;
  }

  .search-wrapper {
    align-self: center;
    margin-bottom: 0;
  }
}