/* ========== TestData Hybrid - Ultra侧边栏 + Pro紧凑布局 ========== */

:root {
  /* 颜色系统 */
  --primary: #1e40af;
  --primary-dark: #1e3a8a;
  --primary-light: #3b82f6;
  --accent: #5b8cff;
  --accent-secondary: #22d3ee;

  /* 背景色 */
  --bg-primary: #0f172a;
  --bg-secondary: #1e293b;
  --bg-tertiary: #334155;
  --bg-hover: #475569;

  /* 文字颜色 */
  --text-primary: #f8fafc;
  --text-secondary: #cbd5e1;
  --text-muted: #94a3b8;

  /* 边框 */
  --border-primary: #334155;
  --border-secondary: #475569;
  --border-color: #334155;
  --border-light: #475569;

  /* 状态颜色 */
  --success: #10b981;
  --warning: #f59e0b;
  --error: #ef4444;
  --info: #06b6d4;

  /* 布局尺寸 */
  --sidebar-width: 260px;
  --topbar-height: 70px;
  --radius: 12px;

  /* 阴影 */
  --shadow-sm: 0 1px 2px 0 rgba(0, 0, 0, 0.3);
  --shadow-md: 0 4px 6px -1px rgba(0, 0, 0, 0.4);
  --shadow-lg: 0 10px 15px -3px rgba(0, 0, 0, 0.5);
  --shadow: 0 4px 6px -1px rgba(0, 0, 0, 0.2);

  /* 字体 */
  --mono: 'Consolas', 'Monaco', 'Courier New', monospace;
}

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

html {
  scroll-behavior: smooth;
  color-scheme: dark;
}

body {
  font-family: -apple-system, BlinkMacSystemFont, 'Segoe UI', 'PingFang SC', 'Microsoft YaHei', sans-serif;
  background: var(--bg-primary);
  color: var(--text-primary);
  line-height: 1.6;
  display: flex;
  min-height: 100vh;
  background-image: radial-gradient(ellipse 60% 40% at 50% -10%, rgba(91, 140, 255, .14), transparent);
}

/* ========== 侧边栏（Ultra风格）========== */
.sidebar {
  width: var(--sidebar-width);
  background: var(--bg-secondary);
  border-right: 1px solid var(--border-color);
  display: flex;
  flex-direction: column;
  position: fixed;
  left: 0;
  top: 0;
  bottom: 0;
  z-index: 100;
  transition: transform 0.3s ease;
}

.sidebar-header {
  padding: 20px;
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  gap: 12px;
}

.logo {
  width: 40px;
  height: 40px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: 10px;
  display: flex;
  align-items: center;
  justify-content: center;
  flex-shrink: 0;
  box-shadow: 0 4px 12px rgba(91, 140, 255, .3);
}

.logo svg {
  width: 24px;
  height: 24px;
  stroke: white;
  fill: none;
  stroke-width: 2;
}

.logo-text h1 {
  font-size: 18px;
  font-weight: 700;
  color: var(--text-primary);
  line-height: 1;
  margin-bottom: 2px;
}

.logo-text span {
  font-size: 11px;
  color: var(--accent);
  text-transform: uppercase;
  font-weight: 600;
  letter-spacing: 1px;
}

.sidebar-nav {
  flex: 1;
  overflow-y: auto;
  padding: 16px 0;
}

.nav-section {
  margin-bottom: 24px;
}

.nav-title {
  font-size: 11px;
  font-weight: 600;
  color: var(--text-muted);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  padding: 0 20px 8px;
}

.nav-item {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px 20px;
  color: var(--text-secondary);
  text-decoration: none;
  font-size: 14px;
  transition: all 0.2s;
  position: relative;
  cursor: pointer;
}

.nav-item svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
  flex-shrink: 0;
}

.nav-item span:first-of-type {
  flex: 1;
}

.nav-item:hover {
  background: var(--bg-tertiary);
  color: var(--text-primary);
}

.nav-item.active {
  background: linear-gradient(90deg, rgba(91, 140, 255, 0.15) 0%, transparent 100%);
  color: var(--accent);
  border-left: 3px solid var(--accent);
  padding-left: 17px;
}

.nav-item .badge {
  font-size: 9px;
  padding: 2px 6px;
  border-radius: 4px;
  font-weight: 600;
  text-transform: uppercase;
}

.nav-item .badge.new {
  background: var(--success);
  color: white;
}

.nav-item .badge.hot {
  background: var(--warning);
  color: white;
}

.sidebar-footer {
  padding: 16px;
  border-top: 1px solid var(--border-color);
}

.user-info {
  display: flex;
  align-items: center;
  gap: 12px;
  padding: 10px;
  background: var(--bg-tertiary);
  border-radius: 8px;
  cursor: pointer;
  transition: background 0.2s;
}

.user-info:hover {
  background: var(--bg-hover);
}

.avatar {
  width: 36px;
  height: 36px;
  background: linear-gradient(135deg, var(--accent), var(--accent-secondary));
  border-radius: 50%;
  display: flex;
  align-items: center;
  justify-content: center;
  font-weight: 600;
  color: white;
  flex-shrink: 0;
}

.user-details {
  flex: 1;
}

.user-name {
  font-size: 14px;
  font-weight: 500;
  color: var(--text-primary);
}

.user-role {
  font-size: 12px;
  color: var(--text-muted);
}

/* ========== 主内容区（Pro风格紧凑布局）========== */
.main-content {
  flex: 1;
  margin-left: var(--sidebar-width);
  display: flex;
  flex-direction: column;
}

.topbar {
  height: var(--topbar-height);
  background: var(--bg-secondary);
  border-bottom: 1px solid var(--border-color);
  display: flex;
  align-items: center;
  padding: 0 24px;
  gap: 20px;
  position: sticky;
  top: 0;
  z-index: 50;
}

.menu-toggle {
  display: none;
  width: 40px;
  height: 40px;
  border: none;
  background: var(--bg-tertiary);
  border-radius: 8px;
  cursor: pointer;
  color: var(--text-secondary);
}

.menu-toggle svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  stroke-width: 2;
}

.topbar-title {
  flex: 1;
}

.topbar-title h2 {
  font-size: 20px;
  font-weight: 600;
  color: var(--text-primary);
  margin-bottom: 2px;
}

.topbar-title p {
  font-size: 13px;
  color: var(--text-muted);
}

.topbar-actions {
  display: flex;
  gap: 8px;
}

.btn-icon {
  width: 40px;
  height: 40px;
  border: 1px solid var(--border-color);
  background: var(--bg-tertiary);
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  color: var(--text-secondary);
  transition: all 0.2s;
}

.btn-icon:hover {
  background: var(--bg-hover);
  color: var(--text-primary);
  border-color: var(--border-light);
}

.btn-icon svg {
  width: 20px;
  height: 20px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.content-area {
  flex: 1;
  padding: 24px;
  overflow-y: auto;
}

/* ========== 卡片（Pro紧凑风格）========== */
.card {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: var(--radius);
  padding: 20px;
  margin-bottom: 20px;
  box-shadow: var(--shadow);
}

.card h2 {
  font-size: 15px;
  font-weight: 650;
  color: var(--text-primary);
  margin-bottom: 16px;
  display: flex;
  align-items: center;
  gap: 9px;
}

.card h2 svg {
  width: 17px;
  height: 17px;
  flex-shrink: 0;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
}

.card-header {
  display: flex;
  align-items: center;
  justify-content: space-between;
  margin-bottom: 18px;
  padding-bottom: 14px;
  border-bottom: 1px solid var(--border-color);
}

.card-title {
  font-size: 15px;
  font-weight: 650;
  color: var(--text-primary);
  display: flex;
  align-items: center;
  gap: 9px;
}

.card-title svg {
  width: 17px;
  height: 17px;
  stroke: var(--accent);
  fill: none;
  stroke-width: 2;
}

/* ========== 表单（Pro紧凑风格）========== */
.form-grid {
  display: grid;
  grid-template-columns: repeat(auto-fit, minmax(280px, 1fr));
  gap: 16px;
  margin-bottom: 18px;
}

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

.field {
  margin-bottom: 16px;
}

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

.form-label,
.field > label {
  font-size: 12.5px;
  font-weight: 550;
  color: var(--text-muted);
  display: flex;
  align-items: center;
  gap: 6px;
}

.form-label .required {
  color: var(--error);
}

.form-input,
.form-select,
.form-textarea,
input[type=number],
input[type=text],
input[type=datetime-local],
select,
textarea {
  width: 100%;
  padding: 9px 12px;
  background: var(--bg-tertiary);
  border: 1px solid var(--border-secondary);
  border-radius: 10px;
  color: var(--text-primary);
  font-size: 13.5px;
  font-family: inherit;
  transition: all 0.15s;
  outline: none;
}

.form-input:focus,
.form-select:focus,
.form-textarea:focus,
input:focus,
select:focus,
textarea:focus {
  border-color: var(--accent);
  box-shadow: 0 0 0 3px rgba(91, 140, 255, 0.15);
}

select,
.form-select {
  cursor: pointer;
  appearance: none;
  background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='10' height='6'%3E%3Cpath d='M1 1l4 4 4-4' stroke='%2394a0b8' fill='none' stroke-width='1.5'/%3E%3C/svg%3E");
  background-repeat: no-repeat;
  background-position: right 12px center;
}

.form-textarea,
textarea {
  min-height: 100px;
  max-height: 280px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.6;
}

.form-hint,
.hint {
  font-size: 11.5px;
  color: var(--text-muted);
  margin-top: 6px;
}

/* ========== 按钮（Pro风格）========== */
.btn {
  padding: 10px 18px;
  border: none;
  border-radius: 10px;
  font-size: 13.5px;
  font-weight: 600;
  cursor: pointer;
  display: inline-flex;
  align-items: center;
  justify-content: center;
  gap: 7px;
  transition: all 0.18s;
  font-family: inherit;
}

.btn svg {
  width: 15px;
  height: 15px;
  stroke: currentColor;
  fill: none;
  stroke-width: 2;
}

.btn-primary {
  background: linear-gradient(135deg, var(--accent), #7c5bff);
  color: white;
  box-shadow: 0 4px 14px rgba(91, 140, 255, 0.35);
}

.btn-primary:hover {
  transform: translateY(-1px);
  box-shadow: 0 6px 18px rgba(91, 140, 255, 0.45);
}

.btn-primary:active {
  transform: none;
}

.btn-secondary,
.btn-ghost {
  background: var(--bg-tertiary);
  color: var(--text-primary);
  border: 1px solid var(--border-secondary);
  font-weight: 500;
}

.btn-secondary:hover,
.btn-ghost:hover {
  background: var(--bg-hover);
  border-color: var(--accent);
  color: var(--text-primary);
}

.btn-success {
  background: var(--success);
  color: white;
}

.btn-group {
  display: flex;
  gap: 10px;
  flex-wrap: wrap;
}

/* ========== 表格 ========== */
.data-table {
  width: 100%;
  border-collapse: collapse;
  margin-top: 16px;
  border-radius: 10px;
  overflow: hidden;
}

.data-table thead {
  background: var(--bg-tertiary);
}

.data-table th {
  padding: 11px 14px;
  text-align: left;
  font-size: 12.5px;
  font-weight: 600;
  color: var(--text-secondary);
  text-transform: uppercase;
  letter-spacing: 0.5px;
  border-bottom: 1px solid var(--border-color);
}

.data-table td {
  padding: 11px 14px;
  font-size: 13.5px;
  color: var(--text-primary);
  border-bottom: 1px solid var(--border-color);
}

.data-table tbody tr:hover {
  background: var(--bg-tertiary);
}

.data-table tbody tr:last-child td {
  border-bottom: none;
}

/* ========== 图片和媒体（紧凑且协调）========== */
canvas,
img,
video,
audio {
  max-width: 100%;
  max-height: 320px;
  height: auto;
  display: block;
  border-radius: 10px;
  border: 1px solid var(--border-primary);
  margin: 14px 0;
  object-fit: contain;
}

#img-canvas {
  background: var(--bg-tertiary);
}

.image-preview,
.media-preview {
  max-width: 100%;
  max-height: 320px;
  overflow: auto;
  background: var(--bg-tertiary);
  border-radius: 10px;
  padding: 14px;
  margin-top: 14px;
  border: 1px solid var(--border-primary);
}

#img-placeholder,
.result-placeholder {
  min-height: 180px;
  max-height: 320px;
  display: flex;
  align-items: center;
  justify-content: center;
  background: var(--bg-tertiary);
  border-radius: 10px;
  border: 1px solid var(--border-primary);
  color: var(--text-muted);
  font-size: 13px;
}

/* ========== 输出区域 ========== */
.output {
  width: 100%;
  min-height: 280px;
  max-height: 400px;
  resize: vertical;
  font-family: var(--mono);
  font-size: 12.5px;
  line-height: 1.7;
  background: #0d1119;
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  padding: 14px;
  color: #c6d2e8;
  white-space: pre-wrap;
  word-break: break-all;
  outline: none;
}

.result-head {
  display: flex;
  align-items: center;
  gap: 12px;
  margin-bottom: 14px;
  flex-wrap: wrap;
}

.result-head .title {
  font-size: 15px;
  font-weight: 650;
  display: flex;
  align-items: center;
  gap: 9px;
}

.result-head .title svg {
  width: 17px;
  height: 17px;
  stroke: var(--success);
}

.result-actions {
  margin-left: auto;
  display: flex;
  gap: 8px;
  flex-wrap: wrap;
}

/* ========== Toast通知 ========== */
#toastContainer,
#toast-container {
  position: fixed;
  bottom: 24px;
  right: 24px;
  z-index: 1000;
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.toast {
  background: var(--bg-secondary);
  border: 1px solid var(--border-primary);
  border-radius: 10px;
  padding: 16px 18px;
  min-width: 300px;
  box-shadow: 0 10px 30px rgba(0, 0, 0, 0.4);
  display: flex;
  align-items: center;
  gap: 12px;
  animation: slideIn 0.3s ease;
}

@keyframes slideIn {
  from {
    transform: translateX(400px);
    opacity: 0;
  }
  to {
    transform: translateX(0);
    opacity: 1;
  }
}

.toast.success {
  border-left: 4px solid var(--success);
}

.toast.error {
  border-left: 4px solid var(--error);
}

.toast.warning {
  border-left: 4px solid var(--warning);
}

.toast.info {
  border-left: 4px solid var(--info);
}

/* ========== 字段列表 ========== */
.field-list {
  display: flex;
  flex-direction: column;
  gap: 12px;
}

.field-item {
  background: var(--bg-tertiary);
  border: 1px solid var(--border-color);
  border-radius: 10px;
  padding: 14px;
  display: grid;
  grid-template-columns: 2fr 2fr 1fr auto;
  gap: 12px;
  align-items: center;
}

.field-item input,
.field-item select {
  padding: 8px 11px;
  background: var(--bg-primary);
  border: 1px solid var(--border-color);
  border-radius: 8px;
  color: var(--text-primary);
  font-size: 13px;
}

.btn-remove {
  width: 32px;
  height: 32px;
  border: none;
  background: var(--error);
  color: white;
  border-radius: 8px;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  transition: all 0.2s;
}

.btn-remove:hover {
  opacity: 0.8;
}

/* ========== 滚动条 ========== */
::-webkit-scrollbar {
  width: 8px;
  height: 8px;
}

::-webkit-scrollbar-track {
  background: var(--bg-primary);
}

::-webkit-scrollbar-thumb {
  background: var(--bg-tertiary);
  border-radius: 4px;
}

::-webkit-scrollbar-thumb:hover {
  background: var(--bg-hover);
}

/* ========== 响应式 ========== */
@media (max-width: 1024px) {
  .sidebar {
    transform: translateX(-100%);
  }
  .sidebar.show {
    transform: translateX(0);
  }
  .main-content {
    margin-left: 0;
  }
  .menu-toggle {
    display: flex;
  }
  .form-grid {
    grid-template-columns: 1fr;
  }
  .field-item {
    grid-template-columns: 1fr;
  }
}

@media (max-width: 768px) {
  .content-area {
    padding: 16px;
  }
  .topbar {
    padding: 0 16px;
  }
  .card {
    padding: 16px;
  }
}
