/* ===== 篮球违例判定系统 — Dark Theme ===== */
:root {
  --bg: #0a0e14;
  --surface: #131820;
  --surface2: #1a202c;
  --border: #252d3a;
  --text: #c8d0dc;
  --text-dim: #6a7385;
  --accent: #ff6b35;
  --accent2: #00b894;
  --red: #e74c3c;
  --green: #2ecc71;
  --blue: #3498db;
}

* { margin: 0; padding: 0; box-sizing: border-box; }

body {
  font-family: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
               "Microsoft YaHei", sans-serif;
  background: var(--bg);
  color: var(--text);
  min-height: 100vh;
  line-height: 1.6;
}

.app { max-width: 1100px; margin: 0 auto; padding: 20px; min-height: 100vh; display: flex; flex-direction: column; }

/* ===== HEADER ===== */
.header {
  display: flex; justify-content: space-between; align-items: center;
  padding: 20px 28px; background: var(--surface); border-radius: 12px;
  border: 1px solid var(--border); margin-bottom: 24px; flex-wrap: wrap; gap: 16px;
}
.logo { display: flex; align-items: center; gap: 14px; }
.logo-icon { font-size: 36px; }
.logo h1 { font-size: 20px; font-weight: 700; color: #fff; }
.logo p { font-size: 12px; color: var(--text-dim); }
.header-badges { display: flex; gap: 10px; }
.header-badges span {
  background: var(--surface2); border: 1px solid var(--border);
  padding: 5px 14px; border-radius: 20px; font-size: 12px; color: var(--accent2);
}

/* ===== VIEWS ===== */
.view { display: none; flex: 1; }
.view.active { display: block; }

/* ===== UPLOAD ===== */
.upload-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 32px; text-align: center; margin-bottom: 24px;
}
.upload-zone {
  border: 2px dashed var(--border); border-radius: 12px;
  padding: 50px 20px; cursor: pointer; transition: all 0.25s; margin-bottom: 20px;
}
.upload-zone:hover, .upload-zone.drag-over {
  border-color: var(--accent); background: rgba(255,107,53,0.05);
}
.upload-icon { color: var(--text-dim); margin-bottom: 12px; }
.upload-title { font-size: 16px; font-weight: 600; color: #fff; margin-bottom: 8px; }
.upload-hint { font-size: 13px; color: var(--text-dim); }
.file-info {
  display: flex; justify-content: center; gap: 20px;
  padding: 10px; background: var(--surface2); border-radius: 8px;
  margin-bottom: 16px;
}
.file-name { color: #fff; font-weight: 500; }
.file-size { color: var(--text-dim); }

.btn {
  display: inline-block; padding: 12px 28px; border: none; border-radius: 8px;
  font-size: 15px; font-weight: 600; cursor: pointer; transition: all 0.2s;
  text-decoration: none; color: #fff;
}
.btn:disabled { opacity: 0.4; cursor: not-allowed; }
.btn-primary { background: var(--accent); }
.btn-primary:hover:not(:disabled) { background: #e85d2a; }
.btn-outline {
  background: transparent; border: 1px solid var(--border); color: var(--text);
}
.btn-outline:hover { border-color: var(--accent); color: var(--accent); }

.info-grid {
  display: grid; grid-template-columns: repeat(3, 1fr); gap: 16px;
}
.info-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 20px;
}
.info-card h4 { color: var(--accent); font-size: 14px; margin-bottom: 8px; }
.info-card p { font-size: 13px; color: var(--text-dim); }

/* ===== PROCESSING ===== */
.processing-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 60px 32px; text-align: center;
}
.spinner {
  width: 48px; height: 48px; border: 3px solid var(--border);
  border-top-color: var(--accent); border-radius: 50%;
  animation: spin 0.8s linear infinite; margin: 0 auto 24px;
}
@keyframes spin { to { transform: rotate(360deg); } }
.processing-card h2 { font-size: 18px; margin-bottom: 20px; color: #fff; }
.progress-bar {
  width: 100%; max-width: 400px; height: 8px; background: var(--surface2);
  border-radius: 4px; margin: 0 auto 12px; overflow: hidden;
}
.progress-fill {
  width: 0%; height: 100%; background: linear-gradient(90deg, var(--accent), var(--accent2));
  border-radius: 4px; transition: width 0.4s ease;
}
.progress-text { font-size: 24px; font-weight: 700; color: var(--accent); margin-bottom: 20px; }
.proc-stages { display: flex; justify-content: center; gap: 12px; flex-wrap: wrap; }
.stage {
  padding: 6px 16px; border-radius: 20px; font-size: 12px;
  background: var(--surface2); border: 1px solid var(--border); color: var(--text-dim);
  transition: all 0.3s;
}
.stage.active { background: rgba(0,184,148,0.15); border-color: var(--accent2); color: var(--accent2); }
.stage.done { background: rgba(46,204,113,0.15); border-color: var(--green); color: var(--green); }

/* ===== RESULTS ===== */
.results-grid { display: flex; flex-direction: column; gap: 20px; }

.verdict-card {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 12px; padding: 28px; text-align: center;
}
.verdict-icon { font-size: 48px; margin-bottom: 8px; }
.verdict-card h2 { font-size: 28px; font-weight: 700; margin-bottom: 8px; }
.verdict-card > p { color: var(--text-dim); font-size: 14px; margin-bottom: 16px; }
.confidence-bar {
  width: 100%; max-width: 300px; height: 6px; background: var(--surface2);
  border-radius: 3px; margin: 0 auto 8px; overflow: hidden;
}
.confidence-fill {
  width: 0%; height: 100%; border-radius: 3px; transition: width 0.5s ease;
}
.confidence-text { font-size: 13px; color: var(--text-dim); }

.verdict-card.violation { border-color: var(--red); }
.verdict-card.violation h2 { color: var(--red); }
.verdict-card.violation .confidence-fill { background: var(--red); }
.verdict-card.legal { border-color: var(--green); }
.verdict-card.legal h2 { color: var(--green); }
.verdict-card.legal .confidence-fill { background: var(--green); }

.stats-row { display: grid; grid-template-columns: repeat(4, 1fr); gap: 12px; }
.stat {
  background: var(--surface); border: 1px solid var(--border);
  border-radius: 10px; padding: 16px; text-align: center;
}
.stat-val { display: block; font-size: 22px; font-weight: 700; color: #fff; }
.stat-label { display: block; font-size: 12px; color: var(--text-dim); margin-top: 4px; }

/* Tabs */
.tabs { display: flex; gap: 4px; background: var(--surface); border-radius: 10px; padding: 4px; }
.tab {
  flex: 1; padding: 10px; background: transparent; border: none;
  color: var(--text-dim); font-size: 14px; cursor: pointer; border-radius: 8px;
  transition: all 0.2s;
}
.tab.active { background: var(--surface2); color: #fff; }
.tab-content { display: none; background: var(--surface); border-radius: 10px; padding: 16px; }
.tab-content.active { display: block; }

#report-json {
  background: var(--surface2); color: var(--accent2); padding: 20px; border-radius: 8px;
  font-family: "JetBrains Mono", "Fira Code", monospace; font-size: 13px;
  overflow-x: auto; max-height: 500px; overflow-y: auto; white-space: pre-wrap;
}

.actions { display: flex; gap: 12px; justify-content: center; flex-wrap: wrap; }

/* ===== ERROR ===== */
.error-card {
  background: var(--surface); border: 1px solid var(--red);
  border-radius: 12px; padding: 48px 32px; text-align: center;
}
.error-card h2 { color: var(--red); margin-bottom: 12px; }
.error-card p { color: var(--text-dim); margin-bottom: 24px; }

/* ===== FOOTER ===== */
.footer { text-align: center; padding: 20px; color: var(--text-dim); font-size: 12px; margin-top: auto; }

/* ===== RESPONSIVE ===== */
@media (max-width: 768px) {
  .header { flex-direction: column; text-align: center; }
  .info-grid { grid-template-columns: 1fr; }
  .stats-row { grid-template-columns: repeat(2, 1fr); }
  .header-badges { justify-content: center; }
}
