/* Reset & base */
* { box-sizing: border-box; }
html,body { height: 100%; margin: 0; padding: 0; font-family: "Inter", system-ui, -apple-system, "Segoe UI", Roboto, "Helvetica Neue", Arial; background: #f2f6fb; color: #0f1724; }

/* Layout */
/* 容器放宽，内容展示空间更大 */
.wrap { max-width: 1400px; margin: 36px auto; padding: 28px; }

/* Hero 与主卡片内边距微调以保持比例 */
.main-card { max-width: none; width: 100%; margin: 0 auto; padding: 40px 32px; }

/* Content layout */
.content { display: grid; grid-template-columns: 1fr; gap: 18px; margin-top: 18px; align-items: start; }

/* Card */
.card { background: #fff; border-radius: 10px; padding: 18px; box-shadow: 0 6px 20px rgba(16,24,40,0.06); display:flex; flex-direction:column; gap:16px; }
.card-title { margin: 0 0 12px 0; font-size: 18px; color: #071033; }

/* Upload area */
.upload-area { display: flex; gap: 14px; align-items: center; flex-wrap: wrap; }
.file-input { flex: 1; padding: 10px 12px; border-radius: 8px; border: 1px dashed #d7e6ef; background: #fbfeff; min-width: 180px; }
.upload-actions { display:flex; gap:12px; align-items:center; flex-wrap:wrap; }
.notice { color:#6b7280; font-size:13px; }

/* Buttons */
.btn { padding: 9px 14px; border-radius: 8px; cursor: pointer; font-weight: 600; border: none; }
.btn-primary { 
  background: #0ea5a4; 
  color: #fff; 
  box-shadow: 0 6px 14px rgba(14,165,164,0.12); 
  padding: 12px 24px;
  border-radius: 12px;
  font-weight: 700;
  font-size: 16px;
  background: linear-gradient(135deg, #0ea5a4, #06b6d4);
  box-shadow: 0 8px 20px rgba(14,165,164,0.25);
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}
.btn-primary:hover { 
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(14,165,164,0.35);
  background: linear-gradient(135deg, #0d9488, #0891b2);
}
.btn-primary:active {
  transform: translateY(-1px) scale(0.98);
}

/* 下载按钮：初始灰色禁用样式；启用时移除 .disabled */
.btn-download {
  padding: 12px 24px;
  border-radius: 12px;
  text-decoration: none;
  font-weight: 700;
  font-size: 16px;
  color: #fff;
  background: linear-gradient(135deg, #9ca3af, #6b7280); /* 灰色过渡，表示不可用 */
  box-shadow: 0 4px 8px rgba(156,163,175,0.1);
  pointer-events: none;
  opacity: 0.7;
  transition: all 0.3s cubic-bezier(0.175, 0.885, 0.32, 1.275);
  position: relative;
  overflow: hidden;
}

/* 启用样式（app.js 会移除 aria-disabled 并设置 href） */
.btn-download.enabled {
  background: linear-gradient(135deg, #059669, #0d9488);
  box-shadow: 0 8px 20px rgba(5,150,105,0.25);
  pointer-events: auto;
  opacity: 1;
}

.btn-download.enabled:hover {
  transform: translateY(-3px) scale(1.02);
  box-shadow: 0 12px 30px rgba(5,150,105,0.35);
  background: linear-gradient(135deg, #047857, #0f766e);
}

.btn-download.enabled:active {
  transform: translateY(-1px) scale(0.98);
}

/* 添加按钮发光效果 */
.btn-download.enabled::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.btn-download.enabled:hover::before {
  left: 100%;
}

/* Progress */
.progress-wrap { 
  display: flex; 
  gap: 12px; 
  align-items: center; 
  margin-top: 12px; 
  flex-wrap: nowrap;
}
.progress-label {
  white-space: nowrap;
  font-weight: 600;
  color: #374151;
  min-width: fit-content;
}
#progressText {
  white-space: nowrap;
  font-weight: 600;
  color: #0ea5a4;
  min-width: fit-content;
  padding-left: 4px;
}
progress { 
  -webkit-appearance: none; 
  flex: 1;
  height: 10px; 
  border-radius: 999px; 
  overflow: hidden;
  min-width: 120px;
  position: relative;
}
progress::-webkit-progress-bar { background: #e6eef5; border-radius: 999px; }
progress::-webkit-progress-value { background: linear-gradient(90deg,#06b6d4,#0ea5a4); border-radius: 999px; }

/* 计算中的动态效果 */
progress.calculating {
  animation: pulse-glow 2s ease-in-out infinite;
}

progress.calculating::-webkit-progress-value {
  background: linear-gradient(90deg, #06b6d4, #0ea5a4, #10b981, #06b6d4);
  background-size: 300% 100%;
  animation: shimmer 2s ease-in-out infinite;
}

/* 闪烁效果 */
@keyframes pulse-glow {
  0%, 100% {
    box-shadow: 0 0 5px rgba(14,165,164,0.3);
  }
  50% {
    box-shadow: 0 0 20px rgba(14,165,164,0.6), 0 0 30px rgba(6,182,212,0.4);
  }
}

/* 流光效果 */
@keyframes shimmer {
  0% {
    background-position: -300% 0;
  }
  100% {
    background-position: 300% 0;
  }
}

/* 计算中文字也添加微妙动效 */
#progressText {
  transition: all 0.3s ease;
}

.progress-wrap:has(progress.calculating) #progressText {
  animation: text-pulse 2s ease-in-out infinite;
}

@keyframes text-pulse {
  0%, 100% {
    opacity: 0.8;
    transform: scale(1);
  }
  50% {
    opacity: 1;
    transform: scale(1.05);
  }
}

/* Status & download */
.status-area { margin-top:12px; display:flex; gap:12px; flex-direction: column; }
.response { 
  background:#ffffff; 
  padding:14px; 
  border-radius:10px; 
  color:#0f1724; 
  font-size:13px; 
  max-height:160px; 
  overflow:auto; 
  box-shadow: 0 4px 18px rgba(16,24,40,0.04); 
  white-space: pre-line; /* 支持换行符显示 */
}
.download-wrap a { display:inline-block; margin-top:6px; background:#0ea5a4; color:#fff; padding:10px 14px; border-radius:10px; text-decoration:none; font-weight:700; box-shadow: 0 8px 30px rgba(6,182,212,0.12); }

/* 滚动提示样式 */
.scroll-hint {
  position: fixed;
  bottom: 20px;
  right: 20px;
  z-index: 1000;
  background: linear-gradient(135deg, #0ea5a4, #06b6d4);
  color: white;
  border-radius: 50px;
  padding: 12px 20px;
  cursor: pointer;
  box-shadow: 0 8px 25px rgba(14, 165, 164, 0.3);
  animation: bounce-hint 2s ease-in-out infinite;
  transition: all 0.3s ease;
}

.scroll-hint:hover {
  transform: translateY(-3px) scale(1.05);
  box-shadow: 0 12px 35px rgba(14, 165, 164, 0.4);
}

.scroll-hint-content {
  display: flex;
  align-items: center;
  gap: 8px;
  font-size: 14px;
  font-weight: 600;
}

.scroll-hint-icon {
  font-size: 18px;
  animation: bounce-icon 1s ease-in-out infinite;
}

.scroll-hint-text {
  white-space: nowrap;
}

/* 提示动画 */
@keyframes bounce-hint {
  0%, 20%, 50%, 80%, 100% {
    transform: translateY(0);
  }
  40% {
    transform: translateY(-10px);
  }
  60% {
    transform: translateY(-5px);
  }
}

@keyframes bounce-icon {
  0%, 100% {
    transform: translateY(0);
  }
  50% {
    transform: translateY(5px);
  }
}

/* 响应式滚动提示 */
@media (max-width: 768px) {
  .scroll-hint {
    bottom: 15px;
    right: 15px;
    padding: 10px 16px;
  }
  
  .scroll-hint-content {
    gap: 6px;
    font-size: 13px;
  }
  
  .scroll-hint-icon {
    font-size: 16px;
  }
}

/* Result table */
/* 直接展示全部行：取消固定高度和 overflow 限制，使表格自然扩展显示所有数据 */
.result-table-wrap { margin-top: 18px; }
.table-scroll {
    overflow: visible;   /* 不再滚动，直接展示全部行 */
    max-height: none;    /* 取消高度限制 */
    border-radius:8px;
    box-shadow: inset 0 0 0 1px rgba(15,23,36,0.03);
    -webkit-overflow-scrolling: touch;
}

/* 维持表格样式 */
.result-grid { width:100%; border-collapse:collapse; min-width:0; background:#fff; table-layout: auto; }
.result-grid thead th {
  position: sticky; top: 0; background: linear-gradient(180deg,#fbfeff,#fff);
  border-bottom:1px solid #eef6fb; padding:12px; text-align:left; font-weight:700; font-size:13px;
}
.result-grid tbody td {
  padding:12px; border-bottom:1px solid #f4f9fc; font-size:13px; color:#10203a;
}
.result-grid tbody tr:hover { background: linear-gradient(90deg, rgba(14,165,164,0.02), rgba(6,182,212,0.02)); }

/* 排序功能样式 */
.result-grid thead th.sortable {
  user-select: none;
  transition: all 0.2s ease;
  position: relative;
}

.result-grid thead th.sortable:hover {
  background: linear-gradient(180deg, #f0f9ff, #f0f9ff);
  color: #0ea5a4;
}

.result-grid thead th.sorted {
  background: linear-gradient(180deg, #e0f7fa, #e0f7fa);
  color: #0ea5a4;
  font-weight: 900;
}

.sort-icon {
  font-size: 12px;
  color: #6b7280;
  margin-left: 4px;
  opacity: 0.7;
  transition: all 0.2s ease;
}

.result-grid thead th.sortable:hover .sort-icon {
  opacity: 1;
  color: #0ea5a4;
}

.result-grid thead th.sorted .sort-icon {
  opacity: 1;
  color: #0ea5a4;
  font-weight: bold;
}

/* 排序提示 */
.sort-info {
  font-size: 12px;
  color: #6b7280;
  font-style: italic;
  margin-bottom: 8px;
  text-align: right;
  display: flex;
  justify-content: space-between;
  align-items: center;
}

/* 重置排序按钮 */
.sort-reset-btn {
  padding: 4px 8px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 4px;
  color: #6b7280;
  font-size: 11px;
  cursor: pointer;
  transition: all 0.2s ease;
  font-style: normal;
}

.sort-reset-btn:hover {
  background: #e5e7eb;
  color: #374151;
  border-color: #9ca3af;
}

.sort-reset-btn:active {
  background: #d1d5db;
}

/* Info aside */
.info h3 { margin-top:0; }
.info ul { padding-left:18px; margin:6px 0; color:#475569; }

/* small helpers */
.hidden { display:none !important; }

/* 上传区：自定义选择文件按钮 */
.file-btn {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border-radius: 8px;
  background: linear-gradient(90deg,#ffffff 0%, #f7fafe 100%);
  border: 1px solid rgba(14,165,164,0.12);
  color: #0ea5a4;
  font-weight: 600;
  cursor: pointer;
  box-shadow: 0 4px 10px rgba(14,165,164,0.06);
}
.file-btn:hover { transform: translateY(-2px); }

/* 标题区：按钮组样式 */
.card-header { display:flex; justify-content:space-between; align-items:center; gap:12px; }
.header-actions { display:flex; gap:10px; align-items:center; }

/* 下载选项组 */
.download-options {
  display: flex;
  align-items: center;
  gap: 8px;
}

/* 格式选择器样式 */
.format-select {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  background: #ffffff;
  color: #374151;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 140px;
}

.format-select:focus {
  outline: none;
  border-color: #0ea5a4;
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.1);
}

.format-select:hover {
  border-color: #9ca3af;
}

/* 添加按钮发光效果 */
.header-actions .btn-primary::before {
  content: '';
  position: absolute;
  top: 0;
  left: -100%;
  width: 100%;
  height: 100%;
  background: linear-gradient(90deg, transparent, rgba(255,255,255,0.2), transparent);
  transition: left 0.5s;
}

.header-actions .btn-primary:hover::before {
  left: 100%;
}

/* 禁用状态下取消动效 */
.btn-disabled {
  opacity: 0.6;
  cursor: not-allowed;
  pointer-events: none;
  transform: none !important;
  box-shadow: 0 4px 8px rgba(14,165,164,0.1) !important;
}

/* 高价值徽标与普通徽标 */
.badge {
  display: inline-block;
  padding: 2px 8px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 700;
  line-height: 1.4;
}
.badge-success {
  color: #065f46;
  background: rgba(14,165,164,0.15);
  border: 1px solid rgba(14,165,164,0.35);
}
.badge-warning {
  color: #92400e;
  background: rgba(245, 158, 11, 0.15);
  border: 1px solid rgba(245, 158, 11, 0.35);
}
.badge-info {
  color: #0c4a6e;
  background: rgba(59, 130, 246, 0.15);
  border: 1px solid rgba(59, 130, 246, 0.35);
}
.badge-muted {
  color: #374151;
  background: #e5e7eb;
  border: 1px solid #d1d5db;
}

/* 高价值整行高亮 */
.row-highlight {
  background: linear-gradient(90deg, rgba(14,165,164,0.08), rgba(6,182,212,0.06));
}

/* 分页样式 */
.pagination-wrap {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-top: 20px;
  padding: 16px 0;
  border-top: 1px solid #e2e8f0;
}

.page-info {
  color: #64748b;
  font-size: 14px;
  font-weight: 500;
}

.page-buttons {
  display: flex;
  align-items: center;
  gap: 8px;
}

.page-btn {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  background: #ffffff;
  color: #374151;
  border-radius: 6px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: all 0.2s ease;
  min-width: 40px;
}

.page-btn:hover:not(:disabled) {
  background: #f8fafc;
  border-color: #0ea5a4;
  color: #0ea5a4;
}

.page-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
  background: #f9fafb;
  color: #9ca3af;
}

.page-btn.page-number {
  min-width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
}

.page-btn.active {
  background: linear-gradient(135deg, #0ea5a4, #06b6d4);
  color: #ffffff;
  border-color: #0ea5a4;
  box-shadow: 0 2px 8px rgba(14,165,164,0.25);
}

.page-btn.active:hover {
  background: linear-gradient(135deg, #0d9488, #0891b2);
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(14,165,164,0.35);
}

.page-ellipsis {
  padding: 8px 4px;
  color: #9ca3af;
  font-size: 14px;
  display: flex;
  align-items: center;
  justify-content: center;
  min-width: 36px;
}

/* 响应式分页 */
@media (max-width: 768px) {
  .pagination-wrap {
    flex-direction: column;
    gap: 12px;
  }
  
  .page-buttons {
    flex-wrap: wrap;
    justify-content: center;
  }
  
  .page-btn {
    padding: 6px 10px;
    font-size: 13px;
    min-width: 32px;
  }
  
  .page-btn.page-number {
    height: 32px;
    min-width: 32px;
  }
}

/* 散点图样式 */
.scatter-chart-wrap {
  margin-top: 24px;
  padding: 20px;
  background: #ffffff;
  border-radius: 12px;
  box-shadow: 0 4px 12px rgba(16,24,40,0.08);
}

.scatter-chart-wrap h3 {
  margin: 0 0 20px 0;
  font-size: 18px;
  color: #071033;
  font-weight: 700;
}

.chart-hint {
  margin: 0 0 16px 0;
  padding: 8px 12px;
  background: rgba(14, 165, 164, 0.1);
  border-left: 3px solid #0ea5a4;
  color: #0f1724;
  font-size: 13px;
  border-radius: 4px;
}

.chart-container {
  position: relative;
  height: 500px;
  width: 100%;
  background: #fafbfc;
  border-radius: 8px;
  padding: 16px;
  border: 1px solid #e2e8f0;
}

.chart-container canvas {
  max-height: 100%;
  max-width: 100%;
}

/* 表格头部样式 */
.table-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  gap: 16px;
}

.table-header h3 {
  margin: 0;
  font-size: 18px;
  color: #071033;
  font-weight: 700;
}

/* 搜索框样式 */
.search-box {
  display: flex;
  align-items: center;
  gap: 8px;
  position: relative;
}

.search-input {
  padding: 8px 12px;
  border: 1px solid #d1d5db;
  border-radius: 8px;
  font-size: 14px;
  width: 200px;
  transition: all 0.2s ease;
  background: #ffffff;
  color: #374151;
}

.search-input:focus {
  outline: none;
  border-color: #0ea5a4;
  box-shadow: 0 0 0 3px rgba(14, 165, 164, 0.1);
}

.search-input::placeholder {
  color: #9ca3af;
}

.search-clear-btn {
  padding: 6px 12px;
  background: #f3f4f6;
  border: 1px solid #d1d5db;
  border-radius: 6px;
  color: #6b7280;
  font-size: 12px;
  cursor: pointer;
  transition: all 0.2s ease;
}

.search-clear-btn:hover {
  background: #e5e7eb;
  color: #374151;
}

/* 搜索高亮样式 */
.search-highlight {
  background: rgba(255, 235, 59, 0.3);
  font-weight: 700;
  color: #f57c00;
}

/* 无搜索结果提示 */
.no-results {
  text-align: center;
  padding: 40px 20px;
  color: #6b7280;
  font-style: italic;
}

/* 响应式搜索 */
@media (max-width: 768px) {
  .table-header {
    flex-direction: column;
    align-items: stretch;
    gap: 12px;
  }
  
  .search-box {
    justify-content: center;
  }
  
  .search-input {
    width: 100%;
    max-width: 300px;
  }
}

/* 响应式图表 */
@media (max-width: 768px) {
  .chart-container {
    height: 400px;
    padding: 12px;
  }
  
  .scatter-chart-wrap {
    padding: 16px;
  }
}

@media (max-width: 480px) {
  .chart-container {
    height: 350px;
    padding: 8px;
  }
}
