/* 基础重置 */
* {
  box-sizing: border-box;
  margin: 0;
  padding: 0;
}

/* 页面主体 */
body {
  font-family: "Segoe UI", system-ui, sans-serif;
  background: linear-gradient(135deg, #f8fafc 0%, #f1f5f9 100%);
  color: #334155;
  min-height: 100vh;
  padding: 12px;
}

/* 主容器 */
#container {
  max-width: 1200px;
  margin: 0 auto;
  position: relative;
  padding-bottom: 70px;
}

/* 标题横幅 */
.header-banner {
  height: 120px;
  background-color: #ff9900;
  display: flex;
  align-items: center;
  justify-content: center;
  margin-bottom: 20px;
}

.header-link {
  text-decoration: none;
  color: white;
}

.header-title {
  color: white;
  font-size: 32px;
  font-weight: bold;
  text-align: center;
}

/* 底部说明 */
.footer-note {
  text-align: center;
  margin-top: 20px;
  color: #666;
  font-size: 14px;
  padding: 0 20px;
}

.footer-note a {
  color: #3b82f6;
  text-decoration: none;
}

/* 图标容器 */
.icon-container {
  position: fixed;
  bottom: 20px;
  right: 20px;
  display: flex;
  flex-direction: column;
  gap: 10px;
  z-index: 100;
}

/* 联系图标通用样式 */
.contact-icon {
  background: white;
  border-radius: 50%;
  width: 50px;
  height: 50px;
  display: flex;
  align-items: center;
  justify-content: center;
  box-shadow: 0 4px 12px rgba(0, 0, 0, 0.15);
  border: 1px solid #e2e8f0;
  transition: all 0.3s ease;
  text-decoration: none;
  cursor: pointer;
}

/* WhatsApp图标 */
.whatsapp-icon:hover {
  background: #25D366;
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 6px 16px rgba(37, 211, 102, 0.3);
}

/* Email图标 */
.email-icon:hover {
  background: #4285F4;
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 6px 16px rgba(66, 133, 244, 0.3);
}

/* Home图标 */
.home-icon-single:hover {
  background: #ff9900;
  transform: scale(1.1) translateY(-3px);
  box-shadow: 0 6px 16px rgba(255, 153, 0, 0.3);
}

/* 图标悬停效果 */
.contact-icon:hover span,
.home-icon-single:hover span {
  color: white;
}

/* 图标内容 */
.contact-icon span,
.home-icon-single span {
  font-size: 24px;
  transition: all 0.3s ease;
}

/* 图标颜色 */
.whatsapp-icon span {
  color: #25D366;
}

.email-icon span {
  color: #4285F4;
}

.home-icon-single span {
  color: #ff9900;
}

/* 零件卡片 */
.part-card {
  background: white;
  border-radius: 10px;
  padding: 16px;
  margin-bottom: 16px;
  box-shadow: 0 2px 6px rgba(0, 0, 0, 0.05), 
              0 3px 12px rgba(0, 0, 0, 0.03);
  border: 1px solid #e2e8f0;
  transition: all 0.2s ease;
  position: relative;
  overflow: hidden;
}

.part-card:hover {
  box-shadow: 0 4px 16px rgba(0, 0, 0, 0.08), 
              0 6px 20px rgba(0, 0, 0, 0.04);
  transform: translateY(-1px);
}

.part-card::before {
  content: '';
  position: absolute;
  top: 0;
  left: 0;
  width: 3px;
  height: 100%;
  background: linear-gradient(to bottom, #ff9900, #df7800);
}

/* 零件头部 */
.part-header {
  display: flex;
  justify-content: space-between;
  align-items: center;
  margin-bottom: 16px;
  padding-bottom: 12px;
  border-bottom: 1px solid #f1f5f9;
}

.part-header input {
  font-size: 16px;
  font-weight: 600;
  border: none;
  border-bottom: 1px solid transparent;
  padding: 6px 0;
  width: 70%;
  color: #1e293b;
  background: transparent;
  transition: all 0.2s ease;
}

.part-header input:focus {
  outline: none;
  border-bottom-color: #3b82f6;
}

.part-header button {
  background: linear-gradient(135deg, #ef4444 0%, #dc2626 100%);
  color: white;
  border: none;
  border-radius: 6px;
  padding: 8px 16px;
  font-size: 13px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 4px;
  transition: all 0.2s ease;
  box-shadow: 0 1px 3px rgba(239, 68, 68, 0.2);
}

.part-header button:hover {
  transform: scale(1.03);
  box-shadow: 0 2px 5px rgba(239, 68, 68, 0.3);
}

/* 零件主体 */
.part-body {
  display: flex;
  gap: 20px;
  flex-wrap: wrap;
}

/* 3D查看器 */
.viewer {
  width: 25%;
  aspect-ratio: 1 / 1;
  background: linear-gradient(135deg, #ffffff 0%, #f8fafc 100%);
  border: 2px dashed #cbd5e1;
  border-radius: 8px;
  flex-shrink: 0;
  position: relative;
  cursor: pointer;
  transition: all 0.2s ease;
  overflow: hidden;
}

.viewer.dragover {
  border-color: #3b82f6;
  background: linear-gradient(135deg, #eff6ff 0%, #dbeafe 100%);
  border-style: solid;
  transform: scale(1.01);
}

.viewer .hint {
  position: absolute;
  inset: 0;
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  font-size: 12px;
  color: #64748b;
  text-align: center;
  pointer-events: none;
  padding: 15px;
  gap: 6px;
}

.viewer .hint::before {
  content: "📁";
  font-size: 28px;
  opacity: 0.6;
  margin-bottom: 6px;
}

.viewer canvas {
  border-radius: 6px;
  width: 100% !important;
  height: 100% !important;
  display: block;
}

/* 零件表单 */
.part-form {
  flex: 1;
  font-size: 13px;
  min-width: 280px;
}

/* 参数网格 */
.param-grid {
  display: grid;
  grid-template-columns: repeat(8, 1fr);
  gap: 8px;
  margin-bottom: 12px;
}

.param-item {
  display: flex;
  flex-direction: column;
}

.param-label {
  font-size: 11px;
  font-weight: 500;
  color: #64748b;
  margin-bottom: 4px;
  display: flex;
  align-items: center;
  gap: 3px;
  white-space: nowrap;
}

.param-label::before {
  content: "•";
  color: #3b82f6;
  font-size: 14px;
  line-height: 1;
}

/* 输入框和选择框 */
.param-input,
.param-select {
  width: 100%;
  padding: 6px 6px;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-size: 12px;
  background: white;
  transition: all 0.2s ease;
  box-shadow: 0 1px 2px rgba(0, 0, 0, 0.03);
}

.param-input:focus,
.param-select:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.param-input:hover,
.param-select:hover {
  border-color: #cbd5e1;
}

.steel-custom {
  margin-top: 4px;
}

/* 计算结果 */
.calc-results {
  display: grid;
  grid-template-columns: repeat(4, 1fr);
  gap: 8px;
  margin-top: 12px;
}

.calc-result-item {
  display: flex;
  flex-direction: column;
}

.result-label {
  font-size: 10px;
  color: #64748b;
  font-weight: 500;
  margin-bottom: 2px;
  letter-spacing: 0.5px;
  white-space: nowrap;
}

.result-value {
  font-size: 12px;
  font-weight: 600;
  color: #1e293b;
  padding: 6px 8px;
  background: #f8fafc;
  border: 1px solid #e2e8f0;
  border-radius: 6px;
  font-family: 'SF Mono', 'Courier New', monospace;
  min-height: 32px;
  display: flex;
  align-items: center;
  transition: all 0.2s ease;
  box-sizing: border-box;
}

.result-value.editable {
  background: white;
  cursor: text;
}

.result-value.editable:focus {
  outline: none;
  border-color: #3b82f6;
  box-shadow: 0 0 0 2px rgba(59, 130, 246, 0.1);
}

.mold-price-value {
  color: #059669;
  background: linear-gradient(135deg, #d1fae5 0%, #a7f3d0 100%);
  border-color: #10b981 !important;
}

/* 添加按钮 */
.add-btn {
  background: linear-gradient(135deg, #ff9900 0%, #df7800 100%);
  color: white;
  border: none;
  border-radius: 8px;
  padding: 12px 24px;
  font-size: 14px;
  font-weight: 500;
  cursor: pointer;
  display: flex;
  align-items: center;
  gap: 8px;
  margin: 20px auto 0;
  transition: all 0.2s ease;
  box-shadow: 0 2px 8px rgba(59, 130, 246, 0.25);
}

.add-btn:hover {
  transform: translateY(-1px);
  box-shadow: 0 4px 12px rgba(59, 130, 246, 0.35);
}

.add-btn:active {
  transform: translateY(0);
}

/* 响应式设计 */
@media (max-width: 1200px) {
  .param-grid {
    grid-template-columns: repeat(6, 1fr);
  }
  
  .calc-results {
    grid-template-columns: repeat(3, 1fr);
  }
}

@media (max-width: 1024px) {
  .param-grid {
    grid-template-columns: repeat(4, 1fr);
  }
  
  .calc-results {
    grid-template-columns: repeat(2, 1fr);
  }
}

@media (max-width: 768px) {
  .part-body {
    flex-direction: column;
    gap: 15px;
  }
  
  .viewer {
    width: 100%;
    max-width: 200px;
    aspect-ratio: 1 / 1;
    height: auto;
    margin: 0 auto;
  }
  
  .part-form {
    min-width: 100%;
  }
  
  .param-grid {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .calc-results {
    grid-template-columns: repeat(2, 1fr);
  }
  
  .icon-container {
    bottom: 15px;
    right: 15px;
  }
}

@media (max-width: 480px) {
  body {
    padding: 8px;
  }
  
  .part-card {
    padding: 12px;
  }
  
  .param-grid,
  .calc-results {
    grid-template-columns: 1fr;
  }
  
  .part-header input {
    width: 60%;
    font-size: 14px;
  }
  
  .param-label {
    font-size: 10px;
  }
  
  .icon-container {
    bottom: 10px;
    right: 10px;
  }
  
  .contact-icon,
  .home-icon-single {
    width: 45px;
    height: 45px;
  }
  
  .contact-icon span,
  .home-icon-single span {
    font-size: 22px;
  }
}

/* 看图窗口内覆盖层 */
.viewer {
  position: relative;
}

/* 全屏按钮 - 右上角 (position 2) */
.viewer-fullscreen-btn {
  position: absolute;
  top: 7px;
  right: 7px;
  width: 28px;
  height: 28px;
  background: rgba(255,255,255,0.82);
  border: 1px solid #cbd5e1;
  border-radius: 6px;
  font-size: 16px;
  line-height: 1;
  cursor: pointer;
  display: flex;
  align-items: center;
  justify-content: center;
  z-index: 10;
  transition: background 0.2s, transform 0.15s;
  padding: 0;
  color: #334155;
}

.viewer-fullscreen-btn:hover {
  background: rgba(255,255,255,1);
  transform: scale(1.1);
  box-shadow: 0 2px 8px rgba(0,0,0,0.15);
}

/* 坐标轴小视图 - 左下角 (position 1) */
.viewer-axes-overlay {
  position: absolute;
  bottom: 6px;
  left: 6px;
  width: 28%;
  aspect-ratio: 1 / 1;
  pointer-events: none;
  z-index: 10;
}

.viewer-axes-overlay canvas {
  width: 100% !important;
  height: 100% !important;
  border-radius: 4px;
}
