/* CSR Generator Specific Styles - Modern & Clean Design */

/* Form Container */
.step-content form {
  max-width: 900px;
  margin: 0 auto;
}

/* Section Titles */
.form-section-title {
  font-size: 15px;
  font-weight: 600;
  color: var(--text-primary);
  margin: 40px 0 24px 0;
  padding: 0;
  border: none;
  display: flex;
  align-items: center;
  gap: 8px;
}

.form-section-title:first-child {
  margin-top: 0;
}

/* Form Grid */
.form-grid {
  display: grid;
  grid-template-columns: repeat(2, 1fr);
  gap: 24px;
  margin-bottom: 0;
}

.form-group {
  margin-bottom: 0;
}

.form-group.full-width {
  margin-top: 24px;
  margin-bottom: 24px;
  grid-column: 1 / -1;
}

/* Labels - Lighter & More Modern */
.form-group label {
  display: block;
  margin-bottom: 10px;
  font-weight: 500;
  color: var(--text-secondary);
  font-size: 13px;
  letter-spacing: 0.01em;
}

/* Inputs & Selects - Clean Minimal Design */
.form-group input,
.form-group select {
  width: 100%;
  padding: 13px 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 14px;
  transition: all 0.2s cubic-bezier(0.4, 0, 0.2, 1);
  background: #ffffff;
  color: var(--text-primary);
  font-family: inherit;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.form-group input::placeholder {
  color: #9ca3af;
}

.form-group input:hover,
.form-group select:hover {
  border-color: #d1d5db;
  box-shadow: 0 2px 4px rgba(0, 0, 0, 0.04);
}

.form-group input:focus,
.form-group select:focus {
  outline: none;
  border-color: var(--primary-color);
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.08),
    0 2px 8px rgba(0, 0, 0, 0.06);
  background: #ffffff;
}

/* Help Text */
.help-text {
  display: block;
  margin-top: 8px;
  font-size: 12px;
  color: #9ca3af;
  line-height: 1.4;
}

/* Result Section - More Spacious */
.result-section {
  margin-top: 50px;
  padding: 36px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid #f3f4f6;
}

.result-section h3 {
  margin-bottom: 24px;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 600;
}

/* Info Messages - Softer */
.info-message {
  padding: 14px 18px;
  border-radius: 10px;
  margin-bottom: 24px;
  font-size: 13px;
  line-height: 1.6;
}

.success-message {
  background-color: #f0fdf4;
  color: #166534;
  border: 1px solid #bbf7d0;
}

.warning-message {
  background-color: #fef3c7;
  color: #92400e;
  border: 1px solid #fde68a;
}

/* Result Items - Cleaner */
.result-item {
  margin-bottom: 28px;
}

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

.result-item label {
  display: block;
  margin-bottom: 12px;
  font-weight: 600;
  color: var(--text-primary);
  font-size: 14px;
}

.textarea-wrapper {
  position: relative;
}

.result-item textarea {
  width: 100%;
  height: 160px;
  padding: 16px;
  border: 1.5px solid #e5e7eb;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  background: #f9fafb;
  color: var(--text-primary);
  resize: vertical;
  line-height: 1.6;
  box-shadow: inset 0 1px 2px rgba(0, 0, 0, 0.03);
}

.result-item textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  background: #ffffff;
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.08);
}

/* Copy Button Positioning */
.textarea-wrapper .copy-btn {
  position: absolute;
  top: 12px;
  right: 12px;
}


/* CSR 输入界面 */
.parse-input-section {
  margin-bottom: 40px;
}

.csr-input-wrapper {
  background: white;
  border-radius: 12px;
  padding: 24px;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid #f3f4f6;
}

.csr-input-textarea {
  width: 100%;
  min-height: 200px;
  padding: 16px;
  border: 1.5px dashed #d1d5db;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  background: #f9fafb;
  color: var(--text-primary);
  resize: vertical;
  line-height: 1.6;
  transition: all 0.2s;
}

.csr-input-textarea:focus {
  outline: none;
  border-color: var(--primary-color);
  border-style: solid;
  background: white;
  box-shadow: 0 0 0 4px rgba(var(--primary-rgb), 0.08);
}

.csr-input-textarea.drag-over {
  border-color: var(--primary-color);
  background: rgba(var(--primary-rgb), 0.02);
}

.csr-input-actions {
  display: flex;
  gap: 12px;
  margin-top: 16px;
  justify-content: flex-start;
}

/* 解析结果表格 */
.parse-result-section {
  margin-top: 40px;
}

.csr-info-table {
  width: 100%;
  background: white;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 2px 8px rgba(0, 0, 0, 0.06);
  border: 1px solid #f3f4f6;
}

.csr-info-table tbody tr {
  border-bottom: 1px solid #f3f4f6;
}

.csr-info-table tbody tr:last-child {
  border-bottom: none;
}

.csr-info-table td {
  padding: 16px 20px;
  vertical-align: top;
}

.csr-info-table td:first-child {
  width: 200px;
  font-weight: 500;
  color: var(--text-secondary);
  text-align: right;
  white-space: nowrap;
}

.csr-info-table td:last-child {
  color: var(--text-primary);
  word-break: break-all;
}

.csr-field-value {
  margin: 0;
}

.csr-field-value.code {
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  font-size: 12px;
  background: #f9fafb;
  padding: 12px;
  border-radius: 6px;
  white-space: pre-wrap;
  line-height: 1.6;
}

.csr-field-copy {
  margin-left: 12px;
}

/* 旧样式保留用于兼容 */
.upload-section {
  padding: 24px 0;
  max-width: 700px;
  margin: 0 auto;
}

.upload-area {
  border: 2px dashed #d1d5db;
  border-radius: 16px;
  padding: 64px 48px;
  text-align: center;
  background: linear-gradient(to bottom, #fafafa, #ffffff);
  cursor: pointer;
  transition: all 0.3s cubic-bezier(0.4, 0, 0.2, 1);
}

.upload-area:hover,
.upload-area.dragover {
  border-color: var(--primary-color);
  background: linear-gradient(to bottom,
      rgba(var(--primary-rgb), 0.03),
      rgba(var(--primary-rgb), 0.01));
  transform: translateY(-3px);
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.08);
}

.upload-icon {
  font-size: 72px;
  margin-bottom: 20px;
  opacity: 0.7;
  filter: grayscale(0.3);
}

.upload-area h3 {
  margin-bottom: 12px;
  color: var(--text-primary);
  font-size: 17px;
  font-weight: 600;
}

.upload-area p {
  color: var(--text-tertiary);
  margin-bottom: 28px;
  font-size: 13px;
}

.csr-result-section {
  margin-top: 40px;
  padding: 32px;
  background: #ffffff;
  border-radius: 16px;
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.06);
  border: 1px solid #f3f4f6;
}

.csr-result-section h3 {
  margin-bottom: 20px;
  color: var(--text-primary);
  font-size: 16px;
  font-weight: 600;
}

.csr-content {
  background: #f9fafb;
  border-radius: 12px;
  padding: 4px;
}

.csr-raw {
  background: white;
  border-radius: 10px;
  overflow: hidden;
}

.csr-raw .textarea-wrapper {
  position: relative;
}

.csr-raw textarea {
  height: 500px;
  width: 100%;
  padding: 20px;
  border: none;
  border-radius: 10px;
  font-size: 13px;
  font-family: 'SF Mono', 'Monaco', 'Courier New', monospace;
  background: white;
  color: var(--text-primary);
  resize: vertical;
  line-height: 1.7;
  box-shadow: none;
}

.csr-raw textarea:focus {
  outline: none;
  box-shadow: inset 0 0 0 2px rgba(var(--primary-rgb), 0.15);
}

/* Error Section - Softer */
.error-section {
  margin-top: 24px;
  padding: 20px 24px;
  background: #fef2f2;
  border: 1px solid #fecaca;
  border-radius: 12px;
  color: #991b1b;
}

.error-section h3 {
  margin-bottom: 12px;
  font-size: 15px;
  font-weight: 600;
}

/* Algorithm Badge */
.algorithm-badge {
  display: inline-block;
  padding: 5px 14px;
  background: rgba(var(--primary-rgb), 0.08);
  color: var(--primary-color);
  border-radius: 8px;
  font-size: 12px;
  font-weight: 600;
  margin-left: 10px;
}

/* Responsive */
@media (max-width: 768px) {
  .form-grid {
    grid-template-columns: 1fr;
    gap: 20px;
  }

  .button-group,
  .action-buttons {
    flex-direction: column;
    gap: 12px;
  }

  .upload-area {
    padding: 48px 28px;
  }

  .result-section {
    padding: 24px;
  }

  .form-section-title {
    margin: 32px 0 20px 0;
  }

  /* 移动端复制按钮优化 - 改为块级显示在下方 */
  .textarea-wrapper {
    display: flex;
    flex-direction: column;
  }

  .textarea-wrapper .copy-btn {
    position: static;
    width: 100%;
    margin-top: 12px;
    padding: 12px 16px;
    min-height: 44px;
    /* 确保足够的点击区域 */
  }

  /* 解析结果表格改为卡片式布局 */
  .csr-info-table {
    display: block;
    border: none;
    box-shadow: none;
    background: transparent;
  }

  .csr-info-table tbody {
    display: block;
  }

  .csr-info-table tr {
    display: block;
    margin-bottom: 16px;
    border: 1px solid #f3f4f6;
    border-radius: 10px;
    padding: 16px;
    background: white;
    box-shadow: 0 2px 6px rgba(0, 0, 0, 0.04);
  }

  .csr-info-table tr:last-child {
    margin-bottom: 0;
  }

  .csr-info-table td {
    display: block;
    padding: 0;
    text-align: left !important;
    width: 100% !important;
  }

  .csr-info-table td:first-child {
    font-weight: 600;
    font-size: 13px;
    margin-bottom: 8px;
    color: var(--text-secondary);
    white-space: normal;
  }

  .csr-info-table td:last-child {
    word-break: break-word;
    font-size: 14px;
  }

  /* 确保code字段在移动端也正确显示 */
  .csr-field-value.code {
    font-size: 11px;
    padding: 10px;
    overflow-x: auto;
  }

  /* 优化action-bar在移动端的布局 */
  .action-bar {
    flex-direction: column;
    gap: 12px;
  }

  .action-bar .btn {
    width: 100%;
    min-height: 44px;
  }

  /* CSR输入操作按钮 */
  .csr-input-actions {
    flex-direction: column;
  }

  .csr-input-actions .btn {
    width: 100%;
    min-height: 44px;
  }
}

@media (max-width: 480px) {
  .step-content form {
    padding: 0 4px;
  }

  .upload-icon {
    font-size: 56px;
  }

  /* 进一步优化小屏幕 */
  .result-section {
    padding: 20px 16px;
  }

  .csr-info-table tr {
    padding: 14px;
  }

  .csr-field-value.code {
    font-size: 10px;
    padding: 8px;
  }
}