/* ================================================================
   Label Studio — 清新型 + 动态背景
   ================================================================ */

/* ── CSS Variables ── */
:root {
  --bg: #e8eef7;
  --surface: rgba(255, 255, 255, 0.92);
  --surface-hover: rgba(248, 250, 252, 0.96);
  --border: rgba(203, 213, 225, 0.7);
  --border-focus: #3b82f6;
  --text: #1e293b;
  --text-secondary: #64748b;
  --text-muted: #94a3b8;

  --primary: #3b82f6;
  --primary-hover: #2563eb;
  --primary-light: rgba(59, 130, 246, 0.1);
  --primary-text: #1d4ed8;

  --success: #10b981;
  --success-light: rgba(16, 185, 129, 0.12);
  --warning: #f59e0b;
  --danger: #ef4444;

  --radius-sm: 6px;
  --radius: 10px;
  --radius-lg: 14px;
  --shadow-sm: 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 1px 2px rgba(0, 0, 0, 0.04);
  --shadow-md: 0 4px 12px rgba(0, 0, 0, 0.06), 0 2px 4px rgba(0, 0, 0, 0.04);

  --font: -apple-system, BlinkMacSystemFont, "Segoe UI", "PingFang SC",
    "Microsoft YaHei", system-ui, sans-serif;
}

/* ── Reset ── */
*, *::before, *::after { box-sizing: border-box; }
html { -webkit-font-smoothing: antialiased; }
body {
  position: relative;
  margin: 0;
  font-family: var(--font);
  font-size: 15px;
  line-height: 1.5;
  color: var(--text);
  background: var(--bg);
  min-height: 100vh;
  overflow-x: hidden;
}

/* ================================================================
   DECORATIVE BACKGROUND
   ================================================================ */

.bg-decor {
  position: fixed;
  inset: 0;
  z-index: -1;
  overflow: hidden;
  pointer-events: none;
}

/* 基础渐变 */
.bg-decor::before {
  content: '';
  position: absolute;
  inset: 0;
  background:
    radial-gradient(ellipse 80% 60% at 10% 20%, rgba(59, 130, 246, 0.12), transparent 70%),
    radial-gradient(ellipse 60% 50% at 90% 80%, rgba(99, 102, 241, 0.10), transparent 70%),
    radial-gradient(ellipse 50% 40% at 50% 0%, rgba(56, 189, 248, 0.08), transparent 60%),
    linear-gradient(160deg, #dbeafe 0%, #eef2ff 30%, #f0f4f8 60%, #e0e7ff 100%);
  animation: bgShift 20s ease-in-out infinite alternate;
}

@keyframes bgShift {
  0%   { opacity: 0.7; }
  50%  { opacity: 1; }
  100% { opacity: 0.7; }
}

/* 网格纹理 */
.bg-grid {
  position: absolute;
  inset: 0;
  background-image:
    linear-gradient(rgba(59, 130, 246, 0.04) 1px, transparent 1px),
    linear-gradient(90deg, rgba(59, 130, 246, 0.04) 1px, transparent 1px);
  background-size: 60px 60px;
  animation: gridShift 40s linear infinite;
}

@keyframes gridShift {
  0%   { transform: translate(0, 0); }
  100% { transform: translate(60px, 60px); }
}

/* 浮动光晕 */
.bg-orb {
  position: absolute;
  border-radius: 50%;
  filter: blur(80px);
  will-change: transform;
}

.bg-orb-1 {
  width: 500px;
  height: 500px;
  top: -120px;
  left: -80px;
  background: radial-gradient(circle, rgba(59, 130, 246, 0.20), rgba(59, 130, 246, 0.04));
  animation: orbFloat1 25s ease-in-out infinite;
}

.bg-orb-2 {
  width: 400px;
  height: 400px;
  bottom: -100px;
  right: -60px;
  background: radial-gradient(circle, rgba(99, 102, 241, 0.15), rgba(99, 102, 241, 0.03));
  animation: orbFloat2 30s ease-in-out infinite;
}

.bg-orb-3 {
  width: 300px;
  height: 300px;
  top: 40%;
  left: 60%;
  background: radial-gradient(circle, rgba(56, 189, 248, 0.12), rgba(56, 189, 248, 0.02));
  animation: orbFloat3 22s ease-in-out infinite;
}

.bg-orb-4 {
  width: 200px;
  height: 200px;
  top: 60%;
  left: 10%;
  background: radial-gradient(circle, rgba(129, 140, 248, 0.12), rgba(129, 140, 248, 0.02));
  animation: orbFloat4 28s ease-in-out infinite;
}

@keyframes orbFloat1 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(80px, 60px) scale(1.1); }
  66%      { transform: translate(-40px, 90px) scale(0.95); }
}

@keyframes orbFloat2 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  33%      { transform: translate(-60px, -50px) scale(1.05); }
  66%      { transform: translate(40px, -80px) scale(0.9); }
}

@keyframes orbFloat3 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(100px, -60px) scale(1.15); }
}

@keyframes orbFloat4 {
  0%, 100% { transform: translate(0, 0) scale(1); }
  50%      { transform: translate(-70px, 50px) scale(1.1); }
}


/* ================================================================
   TOP BAR
   ================================================================ */

.topbar {
  position: sticky;
  top: 0;
  z-index: 100;
  display: flex;
  align-items: center;
  justify-content: space-between;
  gap: 16px;
  height: 60px;
  padding: 0 24px;
  background: rgba(255, 255, 255, 0.78);
  backdrop-filter: blur(16px) saturate(1.2);
  -webkit-backdrop-filter: blur(16px) saturate(1.2);
  border-bottom: 1px solid rgba(203, 213, 225, 0.5);
}

.topbar-left {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}

.logo {
  font-size: 24px;
  line-height: 1;
}

.logo-text {
  font-size: 17px;
  font-weight: 700;
  color: var(--text);
  letter-spacing: -0.02em;
  background: linear-gradient(135deg, #1e293b, #3b82f6);
  -webkit-background-clip: text;
  -webkit-text-fill-color: transparent;
  background-clip: text;
}

.topbar-center {
  flex: 1;
  display: flex;
  justify-content: center;
}

.topbar-right {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-shrink: 0;
}


/* ================================================================
   TABS
   ================================================================ */

.tabs {
  display: flex;
  gap: 3px;
  padding: 3px;
  border-radius: var(--radius);
  background: rgba(226, 232, 240, 0.6);
}

.tab {
  display: flex;
  align-items: center;
  gap: 6px;
  padding: 7px 18px;
  border: none;
  border-radius: 7px;
  background: transparent;
  color: var(--text-secondary);
  font-size: 14px;
  font-weight: 500;
  font-family: inherit;
  cursor: pointer;
  transition: background 0.2s, color 0.2s, box-shadow 0.2s, transform 0.15s;
  position: relative;
}

.tab span {
  font-size: 16px;
  line-height: 1;
}

.tab:hover {
  color: var(--text);
  background: rgba(255, 255, 255, 0.5);
}

.tab:active {
  transform: scale(0.96);
}

.tab.active {
  color: var(--text);
  background: rgba(255, 255, 255, 0.9);
  box-shadow: 0 1px 3px rgba(0, 0, 0, 0.06), 0 0 0 1px rgba(255, 255, 255, 0.8);
}


/* ================================================================
   STATUS BADGE
   ================================================================ */

.status-badge {
  display: inline-flex;
  align-items: center;
  gap: 6px;
  padding: 5px 12px;
  border-radius: 999px;
  font-size: 13px;
  font-weight: 500;
  cursor: default;
  transition: background 0.2s, border-color 0.2s, color 0.2s;
}

.status-badge .dot {
  width: 8px;
  height: 8px;
  border-radius: 50%;
  transition: background 0.3s, box-shadow 0.3s;
}

.status-badge.offline {
  background: rgba(255, 255, 255, 0.6);
  border: 1px solid rgba(203, 213, 225, 0.6);
  color: var(--text-muted);
}

.status-badge.offline .dot {
  background: var(--text-muted);
}

.status-badge.online {
  background: var(--success-light);
  border: 1px solid rgba(16, 185, 129, 0.3);
  color: #047857;
}

.status-badge.online .dot {
  background: var(--success);
  box-shadow: 0 0 6px rgba(16, 185, 129, 0.4);
}

/* 连接时的脉冲动画 */
.status-badge.online .dot {
  animation: pulse-dot 2s ease-in-out infinite;
}

@keyframes pulse-dot {
  0%, 100% { box-shadow: 0 0 0 0 rgba(16, 185, 129, 0.5); }
  50%      { box-shadow: 0 0 0 6px rgba(16, 185, 129, 0); }
}


/* ================================================================
   ICON BUTTON
   ================================================================ */

.icon-btn {
  width: 36px;
  height: 36px;
  display: flex;
  align-items: center;
  justify-content: center;
  border: 1px solid rgba(203, 213, 225, 0.5);
  border-radius: var(--radius-sm);
  background: transparent;
  font-size: 18px;
  line-height: 1;
  color: var(--text-secondary);
  cursor: pointer;
  transition: background 0.15s, color 0.15s, border-color 0.15s, transform 0.15s;
}

.icon-btn:hover {
  background: rgba(255, 255, 255, 0.6);
  border-color: var(--border);
  color: var(--text);
}

.icon-btn:active {
  transform: scale(0.92);
}


/* ================================================================
   MAIN CONTENT
   ================================================================ */

.main {
  max-width: 960px;
  margin: 24px auto;
  padding: 0 20px 48px;
}


/* ================================================================
   TAB CONTENT
   ================================================================ */

.tab-content {
  display: none;
}

.tab-content.active {
  display: block;
}


/* ================================================================
   CARD — 毛玻璃卡片
   ================================================================ */

.card {
  background: var(--surface);
  border: 1px solid rgba(255, 255, 255, 0.6);
  border-radius: var(--radius-lg);
  box-shadow: var(--shadow);
  margin-bottom: 20px;
  overflow: hidden;
  backdrop-filter: blur(4px);
  -webkit-backdrop-filter: blur(4px);
  transition: box-shadow 0.25s, border-color 0.25s;
}

.card:hover {
  box-shadow: var(--shadow-md);
  border-color: rgba(148, 163, 184, 0.3);
}

/* 卡片入场动画 */
.card-enter {
  animation: cardSlideUp 0.5s ease both;
}

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

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  padding: 18px 20px 0;
}

.card-header h2 {
  margin: 0;
  font-size: 16px;
  font-weight: 600;
  color: var(--text);
}

.card-actions {
  display: flex;
  align-items: center;
  gap: 8px;
}

.card-body {
  padding: 16px 20px 20px;
}


/* ================================================================
   BUTTONS
   ================================================================ */

.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 6px;
  padding: 8px 18px;
  border: none;
  border-radius: var(--radius-sm);
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  transition: background 0.2s, box-shadow 0.2s, transform 0.12s, border-color 0.2s;
  white-space: nowrap;
  position: relative;
}

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

.btn-primary {
  background: linear-gradient(135deg, #3b82f6, #6366f1);
  color: #fff;
  box-shadow: 0 1px 3px rgba(59, 130, 246, 0.3);
}

.btn-primary:hover {
  background: linear-gradient(135deg, #2563eb, #4f46e5);
  box-shadow: 0 2px 6px rgba(59, 130, 246, 0.35);
}

/* 发光按钮（主操作） */
.btn-glow {
  position: relative;
  overflow: hidden;
}

.btn-glow::after {
  content: '';
  position: absolute;
  inset: -2px;
  border-radius: inherit;
  background: linear-gradient(135deg, rgba(59,130,246,0.3), rgba(99,102,241,0.3));
  opacity: 0;
  transition: opacity 0.3s;
  z-index: -1;
  filter: blur(8px);
}

.btn-glow:hover::after {
  opacity: 1;
}

.btn-outline {
  background: rgba(255, 255, 255, 0.5);
  border: 1px solid rgba(203, 213, 225, 0.6);
  color: var(--text-secondary);
}

.btn-outline:hover {
  background: rgba(255, 255, 255, 0.8);
  border-color: var(--border);
  color: var(--text);
}

.btn-sm {
  padding: 6px 14px;
  font-size: 13px;
}


/* ================================================================
   VIDEO AREA
   ================================================================ */

.video-area {
  padding: 16px 20px 20px;
}

.video-placeholder {
  position: relative;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 8px;
  min-height: 360px;
  border: 2px dashed rgba(148, 163, 184, 0.4);
  border-radius: var(--radius);
  background: rgba(241, 245, 249, 0.5);
  transition: border-color 0.25s, background 0.25s;
  cursor: pointer;
  overflow: hidden;
}

.video-placeholder:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

/* 拖拽区域光效 */
.placeholder-glow {
  position: absolute;
  inset: 0;
  background: radial-gradient(ellipse at 50% 50%, rgba(59,130,246,0.06), transparent 70%);
  opacity: 0;
  transition: opacity 0.3s;
}

.video-placeholder:hover .placeholder-glow {
  opacity: 1;
}

.placeholder-icon {
  font-size: 48px;
  line-height: 1;
  opacity: 0.45;
  transition: opacity 0.2s, transform 0.2s;
}

.video-placeholder:hover .placeholder-icon {
  opacity: 0.7;
  transform: scale(1.06);
}

.placeholder-text {
  margin: 0;
  font-size: 15px;
  font-weight: 500;
  color: var(--text-secondary);
}

.placeholder-hint {
  margin: 0;
  font-size: 13px;
  color: var(--text-muted);
}


/* ================================================================
   TIMELINE
   ================================================================ */

.timeline-area {
  margin-bottom: 18px;
}

.timeline-track {
  position: relative;
  height: 32px;
  background: rgba(241, 245, 249, 0.6);
  border-radius: 6px;
  cursor: pointer;
}

.timeline-range {
  position: absolute;
  top: 0;
  bottom: 0;
  background: linear-gradient(90deg, rgba(59,130,246,0.2), rgba(99,102,241,0.3));
  border-radius: 6px;
  pointer-events: none;
}

.timeline-handle {
  position: absolute;
  top: 50%;
  width: 18px;
  height: 18px;
  margin-top: -9px;
  margin-left: -9px;
  border: 2.5px solid var(--primary);
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.12);
  cursor: ew-resize;
  z-index: 2;
  transition: box-shadow 0.15s, transform 0.15s;
}

.timeline-handle:hover {
  box-shadow: 0 1px 6px rgba(59,130,246,0.3);
  transform: scale(1.15);
}

.timeline-handle::after {
  content: '';
  position: absolute;
  top: -10px;
  bottom: -10px;
  left: -10px;
  right: -10px;
  border-radius: 50%;
}

.timeline-playhead {
  position: absolute;
  top: -4px;
  bottom: -4px;
  width: 2.5px;
  margin-left: -1px;
  background: var(--primary);
  z-index: 3;
  pointer-events: none;
  border-radius: 2px;
}

.timeline-labels {
  display: flex;
  justify-content: space-between;
  margin-top: 6px;
  font-size: 12px;
  color: var(--text-muted);
}


/* ================================================================
   TRIM PARAMS
   ================================================================ */

.trim-params {
  display: flex;
  align-items: flex-end;
  gap: 12px;
  flex-wrap: wrap;
}

.param-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.param-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-secondary);
}

.param-input-wrap {
  display: flex;
  align-items: center;
  border: 1px solid rgba(203, 213, 225, 0.6);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.6);
  overflow: hidden;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
}

.param-input-wrap:focus-within {
  border-color: var(--primary);
  background: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}

.param-input {
  width: 72px;
  padding: 7px 8px;
  border: none;
  background: transparent;
  font-family: inherit;
  font-size: 14px;
  font-weight: 500;
  color: var(--text);
  outline: none;
}

.param-unit {
  padding: 0 10px 0 2px;
  font-size: 12px;
  color: var(--text-muted);
  flex-shrink: 0;
}

.param-action {
  margin-left: auto;
}


/* ================================================================
   PROGRESS
   ================================================================ */

.progress-area {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-top: 16px;
}

.progress-bar {
  flex: 1;
  height: 6px;
  border-radius: 999px;
  background: rgba(241, 245, 249, 0.8);
  overflow: hidden;
}

.progress-fill {
  height: 100%;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary), #6366f1, #3b82f6);
  background-size: 200% 100%;
  animation: progressShimmer 2s linear infinite;
  transition: width 0.35s ease;
}

@keyframes progressShimmer {
  0%   { background-position: 200% 0; }
  100% { background-position: -200% 0; }
}

.progress-text {
  font-size: 13px;
  font-weight: 500;
  color: var(--text-secondary);
  white-space: nowrap;
}


/* ================================================================
   BADGE
   ================================================================ */

.badge {
  display: inline-flex;
  align-items: center;
  padding: 3px 11px;
  border-radius: 999px;
  font-size: 12px;
  font-weight: 600;
}

.badge-blue {
  background: rgba(59, 130, 246, 0.1);
  color: var(--primary-text);
  border: 1px solid rgba(59, 130, 246, 0.15);
}


/* ================================================================
   THUMBNAIL GRID
   ================================================================ */

.thumbnail-grid {
  display: grid;
  grid-template-columns: repeat(auto-fill, minmax(140px, 1fr));
  gap: 12px;
}

.thumbnail-item {
  display: flex;
  flex-direction: column;
  gap: 6px;
  cursor: pointer;
  transition: transform 0.2s;
}

.thumbnail-item:hover {
  transform: translateY(-2px);
}

.thumbnail-img {
  aspect-ratio: 16 / 10;
  border-radius: var(--radius-sm);
  border: 1px solid rgba(203, 213, 225, 0.5);
  overflow: hidden;
  transition: box-shadow 0.2s, border-color 0.2s;
}

.thumbnail-item:hover .thumbnail-img {
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.15);
  border-color: rgba(59, 130, 246, 0.25);
}

.thumbnail-label {
  font-size: 12px;
  color: var(--text-secondary);
  text-align: center;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ================================================================
   FORM / LAYOUT HELPERS
   ================================================================ */

.form-row {
  display: flex;
  gap: 14px;
  align-items: flex-end;
  margin-bottom: 14px;
}

.form-row:last-child {
  margin-bottom: 0;
}

.form-group {
  display: flex;
  flex-direction: column;
  gap: 4px;
}

.flex-1 {
  flex: 1;
}

.form-sep {
  color: var(--text-muted);
  font-size: 13px;
  flex-shrink: 0;
}

.form-hint {
  margin: 10px 0 0;
  font-size: 13px;
  color: var(--text-muted);
  line-height: 1.5;
}

.form-hint code {
  padding: 1px 6px;
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary-text);
  font-size: 12px;
}


/* ================================================================
   MODEL SELECT ROW
   ================================================================ */

.model-select-row {
  display: flex;
  align-items: center;
  gap: 10px;
  flex-wrap: wrap;
}

.model-drop-zone {
  flex: 1;
  min-width: 160px;
}

.model-drop-inner {
  display: flex;
  align-items: center;
  gap: 8px;
  padding: 9px 14px;
  border: 1.5px dashed rgba(148, 163, 184, 0.4);
  border-radius: var(--radius-sm);
  background: rgba(241, 245, 249, 0.4);
  color: var(--text-muted);
  font-size: 13px;
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.model-drop-inner:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--text-secondary);
}

.model-drop-icon {
  font-size: 18px;
  line-height: 1;
}

/* ── Select ── */
.form-select {
  min-height: 38px;
  padding: 0 32px 0 12px;
  border: 1px solid rgba(203, 213, 225, 0.6);
  border-radius: var(--radius-sm);
  background: rgba(255, 255, 255, 0.6) url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='12' height='12' viewBox='0 0 12 12'%3E%3Cpath fill='%2394a3b8' d='M6 8.5L1.5 4h9z'/%3E%3C/svg%3E") no-repeat right 10px center;
  appearance: none;
  font-family: inherit;
  font-size: 14px;
  color: var(--text);
  outline: none;
  cursor: pointer;
  transition: border-color 0.15s, box-shadow 0.15s, background 0.15s;
  min-width: 140px;
}

.form-select:focus {
  border-color: var(--primary);
  background-color: #fff;
  box-shadow: 0 0 0 3px rgba(59, 130, 246, 0.12);
}


/* ================================================================
   SLIDER
   ================================================================ */

.slider-group {
  display: flex;
  align-items: center;
  gap: 12px;
}

.slider {
  flex: 1;
  height: 6px;
  appearance: none;
  -webkit-appearance: none;
  border-radius: 999px;
  background: linear-gradient(90deg, var(--primary) 25%, rgba(203, 213, 225, 0.5) 25%);
  outline: none;
  cursor: pointer;
}

.slider::-webkit-slider-thumb {
  appearance: none;
  -webkit-appearance: none;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  box-shadow: 0 1px 3px rgba(0,0,0,0.1);
  cursor: pointer;
  transition: box-shadow 0.15s, transform 0.15s;
}

.slider::-webkit-slider-thumb:hover {
  box-shadow: 0 0 0 4px rgba(59, 130, 246, 0.15);
  transform: scale(1.15);
}

.slider::-moz-range-thumb {
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  border: 2px solid var(--primary);
  cursor: pointer;
}

.slider-value {
  min-width: 44px;
  padding: 4px 8px;
  border-radius: var(--radius-sm);
  background: rgba(59, 130, 246, 0.08);
  color: var(--primary-text);
  font-size: 13px;
  font-weight: 600;
  text-align: center;
  font-variant-numeric: tabular-nums;
}


/* ================================================================
   CLASS TAGS
   ================================================================ */

.class-tag-list {
  display: flex;
  flex-wrap: wrap;
  gap: 8px;
}

.class-tag {
  display: inline-flex;
  align-items: center;
  padding: 5px 14px;
  border: 1px solid rgba(203, 213, 225, 0.6);
  border-radius: 999px;
  background: rgba(255, 255, 255, 0.6);
  color: var(--text-secondary);
  font-size: 13px;
  font-weight: 500;
  cursor: default;
  transition: border-color 0.15s, background 0.15s;
}

.class-tag:hover {
  border-color: var(--primary);
  background: var(--primary-light);
  color: var(--text);
}

.class-tag-add {
  border-style: dashed;
  color: var(--primary);
  cursor: pointer;
}

.class-tag-add:hover {
  border-color: var(--primary);
  background: rgba(59, 130, 246, 0.12);
}


/* ================================================================
   LOG AREA
   ================================================================ */

.log-area {
  margin-top: 14px;
  border: 1px solid rgba(203, 213, 225, 0.5);
  border-radius: var(--radius-sm);
  overflow: hidden;
}

.log-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  padding: 8px 14px;
  background: rgba(241, 245, 249, 0.5);
  border-bottom: 1px solid rgba(203, 213, 225, 0.4);
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.log-count {
  font-weight: 400;
  color: var(--text-muted);
}

.log-body {
  padding: 8px 14px;
  max-height: 160px;
  overflow-y: auto;
  background: rgba(248, 250, 252, 0.4);
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  font-size: 12px;
  line-height: 1.7;
}

.log-line {
  padding: 1px 0;
  white-space: pre;
}

.log-line.log-info {
  color: var(--text-secondary);
}

.log-line.log-success {
  color: #047857;
}

.log-line.log-warn {
  color: #b45309;
}

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


/* ================================================================
   THUMBNAIL BOX (推理框覆盖)
   ================================================================ */

.thumbnail-box {
  position: absolute;
  border: 2px solid var(--primary);
  border-radius: 4px;
  background: rgba(59, 130, 246, 0.12);
  display: flex;
  align-items: flex-end;
  justify-content: flex-start;
  padding: 2px 4px;
  font-size: 10px;
  font-weight: 600;
  color: #1d4ed8;
  line-height: 1.2;
  pointer-events: none;
}


/* ================================================================
   DATASET GRID
   ================================================================ */

.dataset-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 12px;
  margin-bottom: 16px;
}

.dataset-card {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.dataset-card-label {
  font-size: 12px;
  font-weight: 600;
  color: var(--text-secondary);
}

.folder-drop {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  gap: 4px;
  min-height: 100px;
  border: 1.5px dashed rgba(148, 163, 184, 0.35);
  border-radius: var(--radius);
  background: rgba(241, 245, 249, 0.3);
  cursor: pointer;
  transition: border-color 0.2s, background 0.2s;
}

.folder-drop:hover {
  border-color: var(--primary);
  background: var(--primary-light);
}

.folder-drop-icon {
  font-size: 28px;
  line-height: 1;
  opacity: 0.4;
  transition: opacity 0.2s, transform 0.2s;
}

.folder-drop:hover .folder-drop-icon {
  opacity: 0.7;
  transform: scale(1.08);
}

.folder-drop-text {
  font-size: 13px;
  color: var(--text-muted);
}

.folder-path {
  padding: 5px 10px;
  border-radius: 4px;
  background: rgba(241, 245, 249, 0.5);
  color: var(--text-muted);
  font-size: 11px;
  font-family: "SF Mono", "Cascadia Code", "Consolas", monospace;
  white-space: nowrap;
  overflow: hidden;
  text-overflow: ellipsis;
}


/* ================================================================
   STATS
   ================================================================ */

.stats-row {
  display: flex;
  gap: 12px;
}

.stat-item {
  flex: 1;
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 4px;
  padding: 14px;
  border: 1px solid rgba(203, 213, 225, 0.4);
  border-radius: var(--radius);
  background: rgba(241, 245, 249, 0.3);
}

.stat-value {
  font-size: 22px;
  font-weight: 700;
  color: var(--text);
  font-variant-numeric: tabular-nums;
}

.stat-label {
  font-size: 12px;
  font-weight: 500;
  color: var(--text-muted);
  text-align: center;
}


/* ================================================================
   CLEANUP TOOLS
   ================================================================ */

.cleanup-row {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.cleanup-btns {
  display: flex;
  gap: 10px;
  margin-top: 8px;
}

.cleanup-btns .btn {
  flex: 1;
}


/* ================================================================
   PARAM GRID (训练页超参数)
   ================================================================ */

.param-grid {
  display: grid;
  grid-template-columns: repeat(3, 1fr);
  gap: 10px;
  margin-bottom: 16px;
}

.param-grid-item {
  display: flex;
  flex-direction: column;
  gap: 4px;
}


/* ================================================================
   TOGGLE SWITCH
   ================================================================ */

.aug-section {
  display: flex;
  flex-direction: column;
  gap: 8px;
}

.toggle-row {
  display: flex;
  flex-wrap: wrap;
  gap: 10px;
}

.toggle {
  display: inline-flex;
  align-items: center;
  gap: 8px;
  cursor: pointer;
  user-select: none;
}

.toggle input {
  position: absolute;
  opacity: 0;
  width: 0;
  height: 0;
  pointer-events: none;
}

.toggle-track {
  position: relative;
  width: 38px;
  height: 22px;
  border-radius: 999px;
  background: rgba(203, 213, 225, 0.6);
  transition: background 0.2s;
  flex-shrink: 0;
}

.toggle-knob {
  position: absolute;
  top: 2px;
  left: 2px;
  width: 18px;
  height: 18px;
  border-radius: 50%;
  background: #fff;
  box-shadow: 0 1px 3px rgba(0,0,0,0.15);
  transition: transform 0.2s;
}

.toggle input:checked + .toggle-track {
  background: var(--primary);
}

.toggle input:checked + .toggle-track .toggle-knob {
  transform: translateX(16px);
}

.toggle-label {
  font-size: 13px;
  color: var(--text-secondary);
}


/* ================================================================
   TRAIN STATS
   ================================================================ */

.train-stats {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 10px;
  margin-top: 14px;
  margin-bottom: 4px;
}

.train-stat-item {
  display: flex;
  flex-direction: column;
  align-items: center;
  gap: 2px;
  padding: 10px 8px;
  border: 1px solid rgba(203, 213, 225, 0.4);
  border-radius: var(--radius);
  background: rgba(241, 245, 249, 0.3);
}

.train-stat-item .stat-value {
  font-size: 18px;
}

.train-stat-item .stat-label {
  font-size: 11px;
}

/* ── 控制台风格日志 ── */
.log-console {
  background: #0f172a;
  color: #e2e8f0;
}

.log-console .log-line.log-info {
  color: #94a3b8;
}

.log-console .log-line.log-warn {
  color: #fbbf24;
}


/* ================================================================
   RESPONSIVE
   ================================================================ */

@media (max-width: 768px) {
  .topbar {
    padding: 0 14px;
    height: 56px;
    flex-wrap: wrap;
  }

  .topbar-center {
    order: 3;
    width: 100%;
    margin-top: 4px;
    justify-content: stretch;
  }

  .tabs {
    width: 100%;
  }

  .tab {
    flex: 1;
    justify-content: center;
    padding: 7px 8px;
    font-size: 13px;
  }

  .tab span {
    font-size: 14px;
  }

  .main {
    padding: 0 14px 32px;
  }

  .trim-params {
    flex-direction: column;
    align-items: stretch;
  }

  .param-action {
    margin-left: 0;
  }

  .param-action .btn {
    width: 100%;
  }

  .form-row {
    flex-direction: column;
    gap: 10px;
  }

  .model-select-row {
    flex-direction: column;
    align-items: stretch;
  }

  .model-select-row .form-select {
    width: 100%;
    min-width: 0;
  }

  .dataset-grid {
    grid-template-columns: 1fr;
    gap: 10px;
  }

  .param-grid {
    grid-template-columns: repeat(2, 1fr);
  }

  .train-stats {
    grid-template-columns: repeat(2, 1fr);
  }

  .stats-row {
    flex-direction: column;
  }

  .cleanup-btns {
    flex-direction: column;
  }

  .cleanup-btns .btn {
    width: 100%;
  }

  .thumbnail-grid {
    grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));
  }
}
