<template>
  <div class="container">
    <div class="gradient-card">
      <div class="card-header">
        <h1>地表径流计算器</h1>
        <p>评估地表径流量及其环境影响</p>
      </div>

      <div class="card-content">
        <div class="input-section">
          <div class="input-group">
            <label class="label">地表径流 (g/ha/a)</label>
            <input v-model="leakage" placeholder="请输入地表径流" class="custom-input" />
          </div>

          <div class="info-panel">
            <div class="info-item">
              <i class="fas fa-info-circle"></i>
              <span>当前值: {{ leakage || '0.368' }}</span>
            </div>
            <div class="info-item">
              <i class="fas fa-chart-line"></i>
              <span>建议范围: 0.01 - 0.05</span>
            </div>
          </div>
        </div>

        <div class="button-section">
          <button class="calculate-btn" @click="onCalculate">
            <i class="fas fa-calculator"></i> 计算地表径流
          </button>
        </div>
      </div>

      <div class="card-footer">
        <p><i class="fas fa-lightbulb"></i> 提示: 输入地表径流后点击计算按钮获取详细分析</p>
      </div>
    </div>
  </div>
</template>

<script>
import { ref } from 'vue';

export default {
  name: 'LeakageCalculator',
  setup() {
    const leakage = ref('0.368');

    const onCalculate = () => {
      alert(`计算完成！当前地表径流: ${leakage.value || '0.368'} g/ha/a`);
    };

    return {
      leakage,
      onCalculate
    };
  }
};
</script>

<style scoped>
body, html {
  margin: 0;
  padding: 0;
  height: 100%;
  overflow: hidden; /* 禁止页面滚动 */
}

.gradient-card {
  background: linear-gradient(135deg,
      rgba(250, 253, 255, 0.8),
      rgba(137, 223, 252, 0.8));
  border-radius: 20px;
  box-shadow: 0 15px 40px rgba(0, 0, 0, 0.15);
  padding: 30px;
  width: 100%;
  max-width: 500px;
  margin-left: 350px; /* 左侧留出空间 */
  backdrop-filter: blur(8px);
  border: none;
  display: flex;
  flex-direction: column;
  overflow: hidden;
}

.card-header {
  text-align: center;
  margin-bottom: 20px;
}

.card-header h1 {
  font-size: 2rem;
  color: #006064;
  margin-bottom: 10px;
  font-weight: 700;
  text-shadow: 1px 1px 3px rgba(0, 0, 0, 0.1);
}

.card-header p {
  font-size: 1.1rem;
  color: #00838f;
  opacity: 0.9;
}

.input-section {
  margin: 20px 0;
}

.input-group {
  margin-bottom: 20px;
}

.label {
  display: block;
  font-weight: 600;
  font-size: 1.2rem;
  margin-bottom: 10px;
  color: #006064;
}

.custom-input {
  width: 100%;
  padding: 15px 10px;
  border-radius: 12px;
  border: 2px solid #80deea;
  font-size: 1rem;
  background: rgba(255, 255, 255, 0.7);
  transition: all 0.3s ease;
  box-shadow: 0 4px 10px rgba(0, 0, 0, 0.05);
}

.custom-input:focus {
  outline: none;
  border-color: #26c6da;
  box-shadow: 0 0 0 4px rgba(38, 198, 218, 0.3);
}

.info-panel {
  background: rgba(178, 235, 242, 0.4);
  border-radius: 12px;
  padding: 15px;
  margin-top: 15px;
}

.info-item {
  display: flex;
  align-items: center;
  margin-bottom: 10px;
  font-size: 1rem;
  color: #006064;
}

.info-item i {
  margin-right: 10px;
  font-size: 1.2rem;
  color: #00838f;
}

.button-section {
  margin: 25px 0;
  text-align: center;
  flex-grow: 1;
  display: flex;
  align-items: flex-end;
  justify-content: center;
}

.calculate-btn {
  background: linear-gradient(to right, #8DF9F0, #26B046);
  color: white;
  border: none;
  border-radius: 50px;
  padding: 15px 30px;
  font-size: 1.2rem;
  font-weight: 600;
  cursor: pointer;
  transition: all 0.4s ease;
  box-shadow: 0 8px 20px rgba(0, 0, 0, 0.2);
  display: inline-flex;
  align-items: center;
  justify-content: center;
  min-width: 250px;
  position: relative;
  overflow: hidden;
}

.calculate-btn i {
  margin-right: 10px;
  font-size: 1.4rem;
}

.calculate-btn:hover {
  transform: translateY(-5px);
  box-shadow: 0 12px 25px rgba(0, 0, 0, 0.3);
  background: linear-gradient(to right, #7de8df, #20a03d);
}

.calculate-btn:active {
  transform: translateY(-2px);
}

.card-footer {
  text-align: center;
  font-size: 1rem;
  color: #00838f;
  font-style: italic;
  padding-top: 15px;
  border-top: 1px solid rgba(0, 150, 136, 0.2);
}

.card-footer i {
  margin-right: 10px;
}

/* 水波纹效果 */
.calculate-btn::after {
  content: "";
  position: absolute;
  top: 50%;
  left: 50%;
  width: 0;
  height: 0;
  background: rgba(255, 255, 255, 0.3);
  border-radius: 50%;
  transform: translate(-50%, -50%);
  transition: width 0.6s, height 0.6s;
}

.calculate-btn:active::after {
  width: 200px;
  height: 200px;
}

/* 响应式设计 */
@media (max-width: 480px) {
  .gradient-card {
    padding: 20px;
    width: 100%;
    max-width: 100%;
  }

  .card-header h1 {
    font-size: 1.8rem;
  }

  .label {
    font-size: 1rem;
  }

  .custom-input {
    padding: 12px;
    font-size: 0.9rem;
  }

  .calculate-btn {
    padding: 12px 25px;
    font-size: 1rem;
    min-width: 200px;
  }

  .info-item span {
    font-size: 0.9rem;
  }
}
</style>



