/* 布局与配色参考常见 Vue 后台（如 ws-design）：侧栏 + 顶栏 + 卡片 */

:root {
  --bg-page: #f4f6f9;
  --bg-sidebar: #1e293b;
  --bg-sidebar-hover: #334155;
  --text-sidebar: #e2e8f0;
  --text-muted: #64748b;
  --primary: #10b981;
  --primary-dark: #059669;
  --card-bg: #ffffff;
  --card-shadow: 0 4px 24px rgba(15, 23, 42, 0.08);
  --radius: 12px;
  --radius-sm: 8px;
  --border: #e2e8f0;
  --danger: #ef4444;
}

* {
  box-sizing: border-box;
}

body {
  margin: 0;
  font-family: "Segoe UI", "Microsoft YaHei", system-ui, sans-serif;
  background: var(--bg-page);
  color: #0f172a;
  min-height: 100vh;
}

.layout {
  display: flex;
  min-height: 100vh;
}

.sidebar {
  width: 220px;
  flex-shrink: 0;
  background: var(--bg-sidebar);
  color: var(--text-sidebar);
  display: flex;
  flex-direction: column;
  padding: 1.25rem 0;
}

.brand {
  font-weight: 700;
  font-size: 1.1rem;
  padding: 0 1.25rem 1.5rem;
  letter-spacing: 0.02em;
  border-bottom: 1px solid rgba(255, 255, 255, 0.08);
  margin-bottom: 0.75rem;
}

.nav-group-label {
  font-size: 0.7rem;
  text-transform: uppercase;
  letter-spacing: 0.06em;
  color: #94a3b8;
  padding: 0.5rem 1rem 0.35rem;
}

nav {
  display: flex;
  flex-direction: column;
  gap: 0.25rem;
  padding: 0 0.75rem;
  flex: 1;
}

.nav-item {
  display: block;
  padding: 0.65rem 1rem;
  border-radius: var(--radius-sm);
  color: var(--text-sidebar);
  text-decoration: none;
  font-size: 0.92rem;
  transition: background 0.15s ease;
}

.nav-item:hover:not(.disabled) {
  background: var(--bg-sidebar-hover);
}

.nav-item.active {
  background: rgba(16, 185, 129, 0.2);
  color: #6ee7b7;
}

.panel {
  display: none;
}

.panel.panel-active {
  display: block;
}

.card-title {
  margin: 0 0 0.75rem;
  font-size: 1.05rem;
  font-weight: 600;
}

.card-lead {
  margin: 0 0 1rem;
  font-size: 0.92rem;
  color: var(--text-muted);
  line-height: 1.5;
}

.sidebar-foot {
  padding: 1rem 1.25rem;
  font-size: 0.75rem;
  color: #94a3b8;
}

.main {
  flex: 1;
  min-width: 0;
  display: flex;
  flex-direction: column;
}

.topbar {
  background: var(--card-bg);
  border-bottom: 1px solid var(--border);
  padding: 1rem 1.75rem;
}

.topbar h1 {
  margin: 0;
  font-size: 1.25rem;
  font-weight: 600;
}

.main-inner {
  padding: 1.5rem 1.75rem 2.5rem;
  max-width: 1280px;
  width: 100%;
  margin: 0 auto;
}

.card {
  background: var(--card-bg);
  border-radius: var(--radius);
  box-shadow: var(--card-shadow);
  border: 1px solid var(--border);
  padding: 1.25rem 1.5rem;
  margin-bottom: 1.25rem;
}

.upload-zone {
  border: 2px dashed #cbd5e1;
  border-radius: var(--radius-sm);
  padding: 2rem 1.5rem;
  text-align: center;
  transition: border-color 0.2s, background 0.2s;
  cursor: pointer;
}

.upload-zone:hover,
.upload-zone.dragover {
  border-color: var(--primary);
  background: rgba(16, 185, 129, 0.04);
}

.upload-zone p {
  margin: 0.35rem 0;
  color: var(--text-muted);
  font-size: 0.9rem;
}

.btn-row {
  display: flex;
  gap: 0.75rem;
  flex-wrap: wrap;
  margin-top: 1rem;
  align-items: center;
}

.btn {
  border: none;
  border-radius: var(--radius-sm);
  padding: 0.55rem 1.25rem;
  font-size: 0.9rem;
  cursor: pointer;
  font-weight: 500;
  transition: background 0.15s, transform 0.1s;
}

.btn:active {
  transform: scale(0.98);
}

.btn-primary {
  background: var(--primary);
  color: #fff;
}

.btn-primary:hover:not(:disabled) {
  background: var(--primary-dark);
}

.btn-primary:disabled {
  opacity: 0.55;
  cursor: not-allowed;
}

.btn-ghost {
  background: #f1f5f9;
  color: #334155;
}

.btn-ghost:hover {
  background: #e2e8f0;
}

.file-input {
  display: none;
}

.hint {
  font-size: 0.82rem;
  color: var(--text-muted);
  margin-top: 0.75rem;
}

.status {
  margin-top: 0.75rem;
  font-size: 0.88rem;
}

.status.error {
  color: var(--danger);
}

.results-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(320px, 1fr));
  gap: 1.25rem;
}

.result-card h3 {
  margin: 0 0 0.5rem;
  font-size: 0.95rem;
  font-weight: 600;
  word-break: break-all;
}

.result-card .meta {
  font-size: 0.8rem;
  color: var(--text-muted);
  margin-bottom: 0.75rem;
}

.meta {
  font-size: 0.86rem;
  color: var(--text-muted);
  margin-bottom: 0.8rem;
}

.result-card img.scene {
  width: 100%;
  border-radius: var(--radius-sm);
  border: 1px solid var(--border);
  display: block;
}

.det-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 0.65rem;
  margin-top: 0.75rem;
}

.det-item {
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  padding: 0.5rem;
  background: #fafafa;
  font-size: 0.78rem;
}

.det-item img {
  width: 100%;
  height: auto;
  border-radius: 4px;
  margin-bottom: 0.35rem;
}

.det-item strong {
  color: var(--primary-dark);
}

.det-item .cls-code {
  display: block;
  font-size: 0.72rem;
  color: var(--text-muted);
  margin-top: 0.2rem;
}

.loader {
  display: inline-block;
  width: 1rem;
  height: 1rem;
  border: 2px solid #e2e8f0;
  border-top-color: var(--primary);
  border-radius: 50%;
  animation: spin 0.7s linear infinite;
  vertical-align: middle;
  margin-right: 0.35rem;
}

.batch-chart {
  display: flex;
  flex-direction: column;
  gap: 0.6rem;
  margin-top: 0.8rem;
  margin-bottom: 1rem;
}

.batch-bar-row {
  display: grid;
  grid-template-columns: 180px 1fr 46px;
  gap: 0.6rem;
  align-items: center;
}

.batch-bar-label {
  font-size: 0.85rem;
  color: #0f172a;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}

.batch-bar-track {
  height: 12px;
  border-radius: 999px;
  background: #e2e8f0;
  overflow: hidden;
}

.batch-bar-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, #34d399, #10b981);
}

.batch-bar-value {
  text-align: right;
  font-size: 0.85rem;
  color: #334155;
}

.batch-list-title {
  margin: 0.3rem 0 0.6rem;
  font-size: 0.95rem;
}

.batch-list-scroll {
  max-height: 340px;
  overflow: auto;
  border: 1px solid var(--border);
  border-radius: var(--radius-sm);
  background: #fafafa;
}

.batch-list {
  list-style: none;
  margin: 0;
  padding: 0;
}

.batch-list li {
  display: grid;
  grid-template-columns: minmax(180px, 40%) 1fr;
  gap: 0.75rem;
  padding: 0.6rem 0.8rem;
  border-bottom: 1px solid #edf2f7;
  font-size: 0.85rem;
}

.batch-list li:last-child {
  border-bottom: none;
}

.batch-item-name {
  color: #0f172a;
  word-break: break-all;
}

.batch-item-summary {
  color: #334155;
}

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