/* 页面基础 */
:root {
  --bg-start: #0a0e27;
  --bg-end: #1a0f3d;
  --card-bg: rgba(15, 18, 45, 0.85);
  --text: #f0f4ff;
  --muted: rgba(240, 244, 255, 0.72);
  --accent: #4f7fff;
  --accent-2: #a855ff;
  --accent-3: #ff6b6b;
  --shadow: 0 24px 48px rgba(0, 0, 0, 0.6);
  --border: rgba(255, 255, 255, 0.1);
  --radius: 16px;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  min-height: 100vh;
  font-family: "Inter", system-ui, -apple-system, BlinkMacSystemFont, "Segoe UI", sans-serif;
  background: radial-gradient(circle at 20% 25%, rgba(79, 127, 255, 0.4), transparent 45%),
    radial-gradient(circle at 80% 35%, rgba(168, 85, 255, 0.35), transparent 50%),
    radial-gradient(circle at 50% 90%, rgba(255, 107, 107, 0.2), transparent 50%),
    linear-gradient(135deg, var(--bg-start), var(--bg-end));
  color: var(--text);
  overflow-x: hidden;
}

.page {
  min-height: 100vh;
  display: flex;
  justify-content: center;
  align-items: center;
  padding: 40px 24px;
}

.scene {
  position: relative;
  width: min(720px, 100%);
  padding: 48px;
}

.glow {
  position: absolute;
  inset: 0;
  pointer-events: none;
  background: radial-gradient(circle at 35% 40%, rgba(79, 127, 255, 0.3), transparent 50%),
    radial-gradient(circle at 65% 25%, rgba(168, 85, 255, 0.25), transparent 50%),
    radial-gradient(circle at 50% 85%, rgba(255, 107, 107, 0.15), transparent 45%);
  filter: blur(28px);
  animation: drift 20s ease-in-out infinite;
  border-radius: calc(var(--radius) + 12px);
}

@keyframes drift {
  0%, 100% {
    transform: translate(0, 0) scale(1);
  }
  50% {
    transform: translate(8px, -14px) scale(1.03);
  }
}

.card {
  position: relative;
  padding: 48px 40px;
  border-radius: var(--radius);
  background: var(--card-bg);
  box-shadow: var(--shadow);
  border: 1px solid var(--border);
  backdrop-filter: blur(16px);
  overflow: hidden;
  z-index: 1;
}

.header {
  margin-bottom: 32px;
  text-align: center;
}

.title {
  margin: 0;
  font-size: clamp(2rem, 5vw, 2.5rem);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #4f7fff, #a855ff);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.subtitle {
  margin: 8px 0 0;
  font-size: clamp(0.95rem, 2.4vw, 1.1rem);
  color: var(--muted);
}

.section {
  margin-bottom: 24px;
}

/* 提示框 */
.prompt-box {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 16px 20px;
  border-radius: 12px;
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.15), rgba(168, 85, 255, 0.1));
  border: 1px solid rgba(79, 127, 255, 0.3);
  animation: pulse-border 3s ease-in-out infinite;
}

.prompt-icon {
  font-size: 1.6rem;
  animation: bounce 2s ease-in-out infinite;
}

.prompt-text {
  margin: 0;
  font-size: 1rem;
  font-weight: 500;
  color: var(--text);
}

@keyframes pulse-border {
  0%, 100% {
    box-shadow: 0 0 0 0 rgba(79, 127, 255, 0.4);
  }
  50% {
    box-shadow: 0 0 0 8px rgba(79, 127, 255, 0);
  }
}

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

/* 按钮样式 */
.action-button {
  position: relative;
  display: flex;
  align-items: center;
  justify-content: center;
  gap: 10px;
  width: 100%;
  padding: 16px 24px;
  border-radius: 12px;
  border: none;
  font-family: inherit;
  font-size: 1rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  overflow: hidden;
  color: var(--text);
}

.action-button::before {
  content: "";
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.2), transparent);
  transform: translateX(-100%);
  transition: transform 300ms ease;
}

.action-button:hover::before {
  transform: translateX(100%);
}

.select-btn {
  background: linear-gradient(135deg, rgba(79, 127, 255, 0.35), rgba(79, 127, 255, 0.2));
  border: 2px solid rgba(79, 127, 255, 0.5);
}

.select-btn:hover:not(:disabled) {
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(79, 127, 255, 0.3);
  border-color: rgba(79, 127, 255, 0.8);
}

.select-btn:active:not(:disabled) {
  transform: translateY(0);
}

.start-btn {
  background: linear-gradient(135deg, var(--accent-2), #ff6b9d);
  border: 2px solid var(--accent-2);
  position: relative;
}

.start-btn:not(:disabled):hover {
  transform: translateY(-2px);
  box-shadow: 0 16px 36px rgba(168, 85, 255, 0.4);
  border-color: #ff6b9d;
}

.start-btn:not(:disabled):active {
  transform: translateY(0);
}

.start-btn:disabled {
  opacity: 0.5;
  cursor: not-allowed;
}

.button-icon {
  font-size: 1.2rem;
}

.button-text {
  position: relative;
  z-index: 2;
}

.button-shimmer {
  position: absolute;
  inset: 0;
  background: linear-gradient(90deg, transparent, rgba(255, 255, 255, 0.15), transparent);
  animation: shimmer 2s infinite;
}

@keyframes shimmer {
  0% {
    background-position: -1000px 0;
  }
  100% {
    background-position: 1000px 0;
  }
}

/* 文件树容器 */
.file-tree-container {
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(79, 127, 255, 0.2);
  overflow: hidden;
  transition: all 300ms ease;
}

.tree-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(79, 127, 255, 0.15), rgba(168, 85, 255, 0.1));
  border-bottom: 1px solid rgba(79, 127, 255, 0.2);
}

.tree-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.tree-count {
  padding: 4px 12px;
  border-radius: 6px;
  background: rgba(79, 127, 255, 0.2);
  color: var(--accent);
  font-size: 0.85rem;
  font-weight: 600;
}

.tree-content {
  padding: 20px;
  max-height: 300px;
  overflow-y: auto;
  min-height: 100px;
}

.empty-state {
  margin: 0;
  text-align: center;
  color: var(--muted);
  padding: 40px 20px;
  font-size: 0.95rem;
}

.file-item {
  margin: 8px 0;
  padding: 10px 14px;
  border-radius: 8px;
  background: rgba(79, 127, 255, 0.08);
  border-left: 3px solid var(--accent);
  font-size: 0.9rem;
  color: var(--text);
  word-break: break-all;
  animation: slideInFile 300ms ease forwards;
  opacity: 0;
}

.file-item:nth-child(1) { animation-delay: 50ms; }
.file-item:nth-child(2) { animation-delay: 100ms; }
.file-item:nth-child(3) { animation-delay: 150ms; }
.file-item:nth-child(4) { animation-delay: 200ms; }
.file-item:nth-child(5) { animation-delay: 250ms; }

@keyframes slideInFile {
  from {
    opacity: 0;
    transform: translateX(-10px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}

/* 进度条 */
.progress-container {
  margin-top: 32px;
  padding: 24px;
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(255, 107, 107, 0.3);
}

.progress-bar {
  width: 100%;
  height: 8px;
  border-radius: 4px;
  background: rgba(255, 255, 255, 0.1);
  overflow: hidden;
  margin-bottom: 12px;
}

.progress-fill {
  height: 100%;
  background: linear-gradient(90deg, var(--accent-2), #ff6b9d);
  border-radius: 4px;
  width: 0%;
  transition: width 300ms ease;
  box-shadow: 0 0 20px rgba(255, 107, 107, 0.5);
}

.progress-text {
  margin: 0;
  font-size: 0.9rem;
  color: var(--muted);
  text-align: center;
}

/* 滚动条美化 */
.tree-content::-webkit-scrollbar {
  width: 6px;
}

.tree-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.tree-content::-webkit-scrollbar-thumb {
  background: rgba(79, 127, 255, 0.3);
  border-radius: 3px;
}

.tree-content::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 127, 255, 0.5);
}

/* 预解析结果容器 */
.parse-result-container {
  border-radius: 12px;
  background: rgba(0, 0, 0, 0.3);
  border: 1px solid rgba(76, 175, 80, 0.3);
  overflow: hidden;
  transition: all 300ms ease;
  animation: slideUp 400ms ease;
}

@keyframes slideUp {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

.result-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 16px 20px;
  background: linear-gradient(90deg, rgba(76, 175, 80, 0.15), rgba(56, 142, 60, 0.1));
  border-bottom: 1px solid rgba(76, 175, 80, 0.2);
}

.result-title {
  font-weight: 600;
  color: var(--text);
  font-size: 0.95rem;
}

.result-close {
  cursor: pointer;
  color: rgba(243, 244, 255, 0.6);
  font-size: 1.2rem;
  transition: color 200ms ease, transform 200ms ease;
  user-select: none;
}

.result-close:hover {
  color: var(--text);
  transform: scale(1.2);
}

.result-content {
  padding: 20px;
}

.result-item {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 12px 0;
  border-bottom: 1px solid rgba(79, 127, 255, 0.1);
  font-size: 0.9rem;
}

.result-item:last-of-type {
  border-bottom: none;
}

.result-label {
  color: var(--muted);
  font-weight: 500;
}

.result-value {
  color: var(--accent);
  font-weight: 600;
  padding: 4px 12px;
  background: rgba(79, 127, 255, 0.15);
  border-radius: 6px;
}

/* 数据字段提取区域 */
.result-fields-section {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 2px solid rgba(76, 175, 80, 0.3);
}

.fields-title {
  margin: 0 0 16px;
  color: rgba(76, 175, 80, 0.9);
  font-weight: 600;
  font-size: 0.95rem;
}

.field-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  margin-bottom: 14px;
  padding: 12px;
  background: rgba(76, 175, 80, 0.08);
  border-left: 4px solid rgba(76, 175, 80, 0.5);
  border-radius: 6px;
}

.field-item:last-child {
  margin-bottom: 0;
}

.field-name {
  color: rgba(76, 175, 80, 0.8);
  font-weight: 600;
  font-size: 0.85rem;
}

.field-value {
  color: var(--text);
  font-family: 'Courier New', monospace;
  font-size: 0.85rem;
  word-break: break-all;
  padding: 8px;
  background: rgba(0, 0, 0, 0.2);
  border-radius: 4px;
  max-height: 80px;
  overflow-y: auto;
}

.result-preview {
  margin-top: 20px;
  padding-top: 16px;
  border-top: 1px solid rgba(79, 127, 255, 0.2);
}

/* 0xA6过滤结果区域 */
.result-a6-section {
  margin-top: 20px;
  padding: 16px;
  background: rgba(74, 222, 128, 0.08);
  border: 2px solid rgba(74, 222, 128, 0.3);
  border-radius: 8px;
}

.a6-title {
  margin: 0 0 12px;
  color: rgba(74, 222, 128, 0.9);
  font-weight: 600;
  font-size: 0.95rem;
}

/* 导出部分容器 */
.export-section {
  display: flex;
  flex-direction: column;
  gap: 10px;
  margin-bottom: 14px;
  padding: 12px;
  background: rgba(74, 222, 128, 0.05);
  border-radius: 6px;
}

.export-section:last-child {
  margin-bottom: 0;
}

.export-label {
  color: rgba(74, 222, 128, 0.8);
  font-weight: 600;
  font-size: 0.85rem;
}

.export-btn {
  display: block;
  padding: 12px 20px;
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.3), rgba(52, 211, 153, 0.2));
  border: 2px solid rgba(74, 222, 128, 0.5);
  border-radius: 8px;
  color: rgba(74, 222, 128, 0.95);
  font-family: inherit;
  font-size: 0.9rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 200ms ease;
  position: relative;
  overflow: hidden;
  text-align: center;
  width: 100%;
}

.export-btn:hover {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.4), rgba(52, 211, 153, 0.3));
  border-color: rgba(74, 222, 128, 0.8);
  transform: translateY(-2px);
  box-shadow: 0 12px 28px rgba(74, 222, 128, 0.2);
}

.export-btn:active {
  transform: translateY(0);
}

.export-btn-a6 {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.3), rgba(34, 197, 94, 0.2));
  border-color: rgba(74, 222, 128, 0.5);
  color: rgba(74, 222, 128, 0.95);
}

.export-btn-a6:hover {
  background: linear-gradient(135deg, rgba(74, 222, 128, 0.4), rgba(34, 197, 94, 0.3));
  box-shadow: 0 12px 28px rgba(74, 222, 128, 0.25);
}

.export-btn-all {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.3), rgba(59, 130, 246, 0.2));
  border-color: rgba(79, 172, 254, 0.5);
  color: rgba(79, 172, 254, 0.95);
}

.export-btn-all:hover {
  background: linear-gradient(135deg, rgba(79, 172, 254, 0.4), rgba(59, 130, 246, 0.3));
  border-color: rgba(79, 172, 254, 0.8);
  box-shadow: 0 12px 28px rgba(79, 172, 254, 0.25);
}

.preview-title {
  margin: 0 0 12px;
  color: var(--text);
  font-weight: 600;
  font-size: 0.9rem;
}

.preview-content {
  margin: 0;
  padding: 12px 16px;
  background: rgba(0, 0, 0, 0.4);
  border: 1px solid rgba(79, 127, 255, 0.2);
  border-radius: 8px;
  color: rgba(79, 200, 100, 0.9);
  font-size: 0.8rem;
  font-family: 'Courier New', monospace;
  overflow-x: auto;
  max-height: 150px;
  overflow-y: auto;
  word-break: break-all;
  white-space: pre-wrap;
}

.preview-content::-webkit-scrollbar {
  width: 4px;
  height: 4px;
}

.preview-content::-webkit-scrollbar-track {
  background: rgba(255, 255, 255, 0.05);
}

.preview-content::-webkit-scrollbar-thumb {
  background: rgba(79, 127, 255, 0.3);
  border-radius: 2px;
}

.preview-content::-webkit-scrollbar-thumb:hover {
  background: rgba(79, 127, 255, 0.5);
}

/* 响应式设计 */
@media (max-width: 500px) {
  .card {
    padding: 32px 24px;
  }

  .title {
    font-size: 1.8rem;
  }

  .tree-content {
    max-height: 250px;
  }

  .action-button {
    font-size: 0.95rem;
    padding: 14px 20px;
  }

  .result-item {
    flex-direction: column;
    align-items: flex-start;
  }

  .result-value {
    margin-top: 8px;
    width: 100%;
    text-align: right;
  }

  .field-item {
    margin-bottom: 12px;
  }

  .field-value {
    font-size: 0.8rem;
  }
}
