<template>
  <div class="fertilizer-input-form">
    <el-card shadow="always" class="form-card">
      <div class="card-content">
        <div class="input-section">
          <el-form label-width="250px" label-position="top">
            <div class="form-section">
              <div class="input-group">
                <el-form-item label="氮肥镉含量平均值 (mg/kg)" class="form-item">
                  <el-input v-model="nitrogenCdContent" placeholder="0.05"></el-input>
                </el-form-item>
                <el-form-item label="氮肥单位面积使用量 (t/ha/a)" class="form-item">
                  <el-input v-model="nitrogenUsage" placeholder="0.05"></el-input>
                </el-form-item>
              </div>
              <div class="input-group">
                <el-form-item label="磷肥镉含量平均值 (mg/kg)" class="form-item">
                  <el-input v-model="phosphorusCdContent" placeholder="0.158"></el-input>
                </el-form-item>
                <el-form-item label="磷肥单位面积使用量 (t/ha/a)" class="form-item">
                  <el-input v-model="phosphorusUsage" placeholder="0.158"></el-input>
                </el-form-item>
              </div>
              <div class="input-group">
                <el-form-item label="钾肥镉含量平均值 (mg/kg)" class="form-item">
                  <el-input v-model="potassiumCdContent" placeholder="0.06"></el-input>
                </el-form-item>
                <el-form-item label="钾肥单位面积使用量 (t/ha/a)" class="form-item">
                  <el-input v-model="potassiumUsage" placeholder="0.06"></el-input>
                </el-form-item>
              </div>
              <div class="input-group">
                <el-form-item label="复合肥镉含量平均值 (mg/kg)" class="form-item">
                  <el-input v-model="compoundFertilizerCdContent" placeholder="0.065"></el-input>
                </el-form-item>
                <el-form-item label="复合肥单位面积使用量 (t/ha/a)" class="form-item">
                  <el-input v-model="compoundFertilizerUsage" placeholder="0.065"></el-input>
                </el-form-item>
              </div>
              <div class="input-group">
                <el-form-item label="有机肥镉含量平均值 (mg/kg)" class="form-item">
                  <el-input v-model="organicFertilizerCdContent" placeholder="0.6"></el-input>
                </el-form-item>
                <el-form-item label="有机肥单位面积使用量 (t/ha/a)" class="form-item">
                  <el-input v-model="organicFertilizerUsage" placeholder="0.6"></el-input>
                </el-form-item>
              </div>
              <div class="input-group">
                <el-form-item label="农药镉含量 (mg/kg)" class="form-item">
                  <el-input v-model="pesticideCdContent" placeholder="0.25"></el-input>
                </el-form-item>
                <el-form-item label="农药单位面积使用量 (t/ha/a)" class="form-item">
                  <el-input v-model="pesticideUsage" placeholder="0.25"></el-input>
                </el-form-item>
              </div>
              <div class="input-group">
                <el-form-item label="农家肥镉含量 (mg/kg)" class="form-item">
                  <el-input v-model="farmYardManureCdContent" placeholder="0.35"></el-input>
                </el-form-item>
                <el-form-item label="农家肥单位面积使用量 (t/ha/a)" class="form-item">
                  <el-input v-model="farmYardManureUsage" placeholder="0.35"></el-input>
                </el-form-item>
              </div>
              <div class="input-group">
                <el-form-item label="农膜镉含量 (mg/kg)" class="form-item">
                  <el-input v-model="agriFilmCdContent" placeholder="0.25"></el-input>
                </el-form-item>
                <el-form-item label="农膜(存留)单位面积使用量 (t/ha/a)" class="form-item">
                  <el-input v-model="agriFilmResidueUsage" placeholder="0.6"></el-input>
                </el-form-item>
              </div>
            </div>
          </el-form>
        </div>
        
        <div class="button-section">
          <!-- 按钮区域背景图 -->
          <div class="button-bg"></div>
          <!-- 底部半透明层 -->
          <div class="bottom-overlay"></div>
          <el-button class="calculate-btn">
            <span class="btn-text">农产品输入通量计算</span>
          </el-button>
        </div>
      </div>
    </el-card>
  </div>
</template>

<script>
export default {
  data() {
    return {
      nitrogenCdContent: '0.05',
      nitrogenUsage: '0.05',
      phosphorusCdContent: '0.158',
      phosphorusUsage: '0.158',
      potassiumCdContent: '0.06',
      potassiumUsage: '0.06',
      compoundFertilizerCdContent: '0.065',
      compoundFertilizerUsage: '0.065',
      organicFertilizerCdContent: '0.6',
      organicFertilizerUsage: '0.6',
      pesticideCdContent: '0.25',
      pesticideUsage: '0.25',
      farmYardManureCdContent: '0.35',
      farmYardManureUsage: '0.35',
      agriFilmCdContent: '0.25',
      agriFilmResidueUsage: '0.6'
    };
  }
};
</script>

<style scoped>
.fertilizer-input-form {
  padding: 20px;
  display: flex;
  justify-content: center;
  background-color: rgba(255, 255, 255, 0.8); /* 半透明背景 */
}

.form-card {
  width: 90%;
  max-width: 1200px;
  margin: 0 auto;
  background: linear-gradient(135deg, #FAFDFF, #FFFAA2);
  border: 1px solid #e6e6e6;
  border-radius: 12px;
  overflow: hidden;
  box-shadow: 0 8px 24px rgba(0, 0, 0, 0.1);
}

.card-content {
  display: flex;
  min-height: 600px;
}

.input-section {
  width: 60%;
  padding: 30px;
  border-right: 1px dashed #c0c4cc;
}

.button-section {
  width: 40%;
  display: flex;
  align-items: center;
  justify-content: center;
  padding: 30px;
  position: relative;
  overflow: hidden;
}

/* 按钮区域背景图 - 使用本地图片 */
.button-bg {
  position: absolute;
  top: 0;
  left: 0;
  right: 0;
  bottom: 0;
  /* 请替换为您的本地图片路径 */
  background: url('@/assets/images/fertilizer-bg.jpg') no-repeat center center;
  background-size: cover;
  z-index: 0;
}

/* 底部半透明层 */
.bottom-overlay {
  position: absolute;
  left: 0;
  right: 0;
  bottom: 0;
  height: 40%;
  background: linear-gradient(to top, rgba(255, 255, 255, 0.5), transparent);
  z-index: 1;
}

.form-section {
  display: flex;
  flex-direction: column;
  height: 100%;
}

.input-group {
  display: flex;
  justify-content: space-between;
  margin-bottom: 20px;
  gap: 20px;
}

.form-item {
  flex: 1;
  margin-bottom: 0;
  display: flex;
  flex-direction: column;
  align-items: flex-start;
}

.el-form-item__label {
  font-size: 16px;
  text-align: left;
  margin-bottom: 8px;
  padding: 0 !important;
  font-weight: 600;
  color: #333;
}

.el-input {
  width: 100%;
}

/* 使用 :deep() 替代已弃用的 >>> */
:deep(.el-input) .el-input__inner {
  width: 100% !important;
  padding: 12px 0;
  border: none;
  border-radius: 0;
  background: transparent;
  /* 底部边框效果 */
  border-bottom: 1px solid #dcdfe6;
  /* 底部阴影效果 */
  box-shadow: 0 1px 0 rgba(0, 0, 0, 0.05);
  transition: all 0.3s ease;
}

:deep(.el-input) .el-input__inner:focus {
  border-bottom: 2px solid #409EFF;
  /* 聚焦时底部阴影加强 */
  box-shadow: 0 2px 0 rgba(64, 158, 255, 0.2);
  background: rgba(64, 158, 255, 0.03);
}

/* 占位符样式 */
:deep(.el-input) .el-input__inner::placeholder {
  color: #a0a0a0;
  font-style: italic;
}

.calculate-btn {
  width: 100%;
  max-width: 300px;
  height: 200px;
  border: none;
  border-radius: 25px !important;
  font-size: 24px;
  font-weight: bold;
  transition: all 0.4s ease;
  position: relative;
  z-index: 2; /* 确保按钮在覆盖层之上 */
  
  /* 渐变背景色 */
  background: linear-gradient(to right, #8DF9F0, #26B046);
  /* 按钮整体阴影 */
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.15),
              0 4px 10px rgba(38, 176, 70, 0.3) inset;
}

.calculate-btn:hover {
  transform: scale(1.03);
  box-shadow: 0 10px 25px rgba(0, 0, 0, 0.2),
              0 4px 12px rgba(38, 176, 70, 0.4) inset;
  background: linear-gradient(to right, #7de8df, #20a03d);
}

.calculate-btn:active {
  transform: scale(0.98);
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.15),
              0 2px 8px rgba(38, 176, 70, 0.4) inset;
}

.btn-text {
  position: relative;
  color: white;
  text-shadow: 0 2px 4px rgba(0, 0, 0, 0.5);
  font-size: 26px;
  letter-spacing: 1px;
  z-index: 1;
  padding: 20px;
  text-align: center;
  line-height: 1.4;
}
</style>